From 6ffabd2318ba970eebf3f7f5299805ac4332b255 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 27 Sep 2017 13:25:27 +1300 Subject: [PATCH] Added docs tools --- README.md | 85 ++++++++++++++++-------------------- sources/index.html | 6 +++ sources/scripts/docs.js | 86 +++++++++++++++++++++++++++++++++++++ sources/scripts/keyboard.js | 5 +++ sources/scripts/ronin.js | 1 + 5 files changed, 136 insertions(+), 47 deletions(-) create mode 100644 sources/scripts/docs.js diff --git a/README.md b/README.md index b5d5aa6..5008fc5 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,42 @@ # Ronin - Ronin is a simple open-source graphic design tool. - - - -## Example file - -``` -surface.resize 300x300 -layer.fill #AAAAAA -magnet.grid 15x15 4,4 -path:line_width 2 -path.stroke M60,60 A1,1 0 0,0 240,60 A1,1 0 0,0 240,240 -path.stroke M240,240 A1,1 0 0,0 60,240 A1,1 0 0,0 60,60 -``` - -## Load a preset - -Where `http://localhost:8022` will load the /presets/default.rin file, `http://localhost:8022/blank` will load /presets/blank.rin. - -## TODOs - General - Merge layers - Export multiple layers file - Syntax highlight - % Render - balance auto=true ~ auto color - balance 0.8 ~ equal RGB balance - Brush - Texture paint - Save - source.save 1280x800 ~ Export with size - > Terminal - Auto Complete(tab) - ? Interrog - Inline Help - * Eye - Swatches, handle all colors - - Widget - Clickeable links - - Render - Progress update - - # Verreciel - -Feel free to send pull requests if you find an issue that you wish to correct. - + +## Modules +## brush +### Settings +- size +- color +- opacity +### Methods +### Ports +- speed +- distance +- red +- green +- blue +- alpha +- x +- noise +## eraser +### Settings +### Methods +### Ports +## frame +### Settings +- width +- height +### Methods +- resize +- rescale +- crop +### Ports +## line +### Settings +- steps +### Methods +- tween +- stroke +### Ports +- index ## License - See the [LICENSE](LICENSE.md) file for license rights and limitations (CC). diff --git a/sources/index.html b/sources/index.html index 25ccf6e..3c4a7f4 100644 --- a/sources/index.html +++ b/sources/index.html @@ -11,6 +11,7 @@ + @@ -26,6 +27,11 @@ diff --git a/sources/scripts/docs.js b/sources/scripts/docs.js new file mode 100644 index 0000000..9f7a5b4 --- /dev/null +++ b/sources/scripts/docs.js @@ -0,0 +1,86 @@ +function Docs() +{ + this.export = function() + { + var html = ""; + + html += this.print_intro(); + html += "## Modules\n"; + html += this.print_modules(ronin.modules); + + html += this.print_license(); + + var str = html; + + dialog.showSaveDialog((fileName) => { + if (fileName === undefined){ return; } + fs.writeFile("README.md", str, (err) => { + if(err){ alert("An error ocurred creating the file "+ err.message); return; } + }); + }); + + return html; + } + + this.print_intro = function() + { + html = "# Ronin\n"; + html += "Ronin is a simple open-source graphic design tool.\n"; + html += "\n"; + return html; + } + + this.print_modules = function(modules) + { + var html = ""; + + for(module_name in modules){ + var module = modules[module_name]; + html += "## "+module_name+"\n"; + html += this.print_settings(module.settings); + html += this.print_methods(module.methods); + html += this.print_ports(module.ports); + } + return html; + } + + this.print_settings = function(settings) + { + var html = "### Settings\n"; + + for(setting_name in settings){ + var setting = settings[setting_name]; + html += "- "+setting_name+"\n"; + } + return html; + } + + this.print_methods = function(methods) + { + var html = "### Methods\n"; + + for(method_name in methods){ + var method = methods[method_name]; + html += "- "+method_name+"\n"; + } + return html; + } + + this.print_ports = function(ports) + { + var html = "### Ports\n"; + + for(port_name in ports){ + var port = ports[setting_name]; + html += "- "+port_name+"\n"; + } + return html; + } + + this.print_license = function() + { + html = "## License\n"; + html += "See the [LICENSE](LICENSE.md) file for license rights and limitations (CC).\n"; + return html; + } +} \ No newline at end of file diff --git a/sources/scripts/keyboard.js b/sources/scripts/keyboard.js index 604d0f4..df530d5 100644 --- a/sources/scripts/keyboard.js +++ b/sources/scripts/keyboard.js @@ -33,6 +33,11 @@ function Keyboard() ronin.render.clear(); } + if(e.key == "H" && (e.ctrlKey || e.metaKey) && e.shiftKey){ + e.preventDefault(); + ronin.docs.export(); + } + ronin.hint.update(e); } } \ No newline at end of file diff --git a/sources/scripts/ronin.js b/sources/scripts/ronin.js index 24e1b31..c8b8357 100644 --- a/sources/scripts/ronin.js +++ b/sources/scripts/ronin.js @@ -8,6 +8,7 @@ function Ronin() this.commander = new Commander(); this.cursor = new Cursor(); this.hint = new Hint(); + this.docs = new Docs(); this.grid = new Grid(); this.guide = new Guide();