From 7c2cc7dc1183f9ed394717c3d2c8d5fd67369e10 Mon Sep 17 00:00:00 2001 From: lxsang Date: Sun, 24 Nov 2019 19:33:14 +0000 Subject: [PATCH] add new apps --- Booklet/README.md | 24 ++ Booklet/assets/scheme.html | 9 + Booklet/build/debug/README.md | 24 ++ Booklet/build/debug/main.js | 324 +++++++++++++++++++++++++ Booklet/build/debug/package.json | 13 + Booklet/build/debug/scheme.html | 9 + Booklet/coffees/common.coffee | 106 ++++++++ Booklet/coffees/main.coffee | 102 ++++++++ Booklet/package.json | 13 + Booklet/project.apj | 1 + DrawIOWrapper/README.md | 24 ++ DrawIOWrapper/assets/scheme.html | 5 + DrawIOWrapper/build/debug/README.md | 24 ++ DrawIOWrapper/build/debug/main.js | 15 ++ DrawIOWrapper/build/debug/package.json | 13 + DrawIOWrapper/build/debug/scheme.html | 5 + DrawIOWrapper/coffees/main.coffee | 7 + DrawIOWrapper/package.json | 13 + DrawIOWrapper/project.apj | 8 + OpenPage/build/debug/blank.odt | Bin 133915 -> 133914 bytes OpenPage/build/debug/icon.png | Bin 1336 -> 1334 bytes 21 files changed, 739 insertions(+) create mode 100644 Booklet/README.md create mode 100644 Booklet/assets/scheme.html create mode 100644 Booklet/build/debug/README.md create mode 100644 Booklet/build/debug/main.js create mode 100644 Booklet/build/debug/package.json create mode 100644 Booklet/build/debug/scheme.html create mode 100644 Booklet/coffees/common.coffee create mode 100644 Booklet/coffees/main.coffee create mode 100644 Booklet/package.json create mode 100644 Booklet/project.apj create mode 100644 DrawIOWrapper/README.md create mode 100644 DrawIOWrapper/assets/scheme.html create mode 100644 DrawIOWrapper/build/debug/README.md create mode 100644 DrawIOWrapper/build/debug/main.js create mode 100644 DrawIOWrapper/build/debug/package.json create mode 100644 DrawIOWrapper/build/debug/scheme.html create mode 100644 DrawIOWrapper/coffees/main.coffee create mode 100644 DrawIOWrapper/package.json create mode 100644 DrawIOWrapper/project.apj diff --git a/Booklet/README.md b/Booklet/README.md new file mode 100644 index 0000000..63747e6 --- /dev/null +++ b/Booklet/README.md @@ -0,0 +1,24 @@ +# Booklet +A tool for my online document hub + +## Howto + +1. Open the project.apj file with AntOSDK (simply double Click on it) +2. Modify the UI in *assets/scheme.html* +3. Modify application code in *coffees/main.coffee* +4. Modify CSS style in *css/main.css* +5. Other files need to be copied: put in to assets + +## Set up build target + +Click **Menu> Build > Build Option** or simply hit **ALT-Y** + +In the build options dialog, add or remove files that need to be +included into the build + +Click **Save** + +## Build application +* To build: **Menu > Build > Build** or **ALT-C** +* To build and run: **Menu > Build > Build and Run** or **CTRL-R** +* To release: **Menu > Build > Build release** or **ALT-P** \ No newline at end of file diff --git a/Booklet/assets/scheme.html b/Booklet/assets/scheme.html new file mode 100644 index 0000000..7c27b2f --- /dev/null +++ b/Booklet/assets/scheme.html @@ -0,0 +1,9 @@ + + + + +
+ +
+
+
\ No newline at end of file diff --git a/Booklet/build/debug/README.md b/Booklet/build/debug/README.md new file mode 100644 index 0000000..63747e6 --- /dev/null +++ b/Booklet/build/debug/README.md @@ -0,0 +1,24 @@ +# Booklet +A tool for my online document hub + +## Howto + +1. Open the project.apj file with AntOSDK (simply double Click on it) +2. Modify the UI in *assets/scheme.html* +3. Modify application code in *coffees/main.coffee* +4. Modify CSS style in *css/main.css* +5. Other files need to be copied: put in to assets + +## Set up build target + +Click **Menu> Build > Build Option** or simply hit **ALT-Y** + +In the build options dialog, add or remove files that need to be +included into the build + +Click **Save** + +## Build application +* To build: **Menu > Build > Build** or **ALT-C** +* To build and run: **Menu > Build > Build and Run** or **CTRL-R** +* To release: **Menu > Build > Build release** or **ALT-P** \ No newline at end of file diff --git a/Booklet/build/debug/main.js b/Booklet/build/debug/main.js new file mode 100644 index 0000000..15ec096 --- /dev/null +++ b/Booklet/build/debug/main.js @@ -0,0 +1,324 @@ +(function() { + var Book, Booklet, BookletChapter, BookletEntry, BookletFile, BookletFolder, BookletSection; + + Booklet = class Booklet extends this.OS.GUI.BaseApplication { + constructor(args) { + super("Booklet", args); + } + + main() { + this.initEditor(); + return this.resizeContent(); + } + + initEditor() { + var markarea, me; + markarea = this.find("markarea"); + this.container = this.find("mycontainer"); + this.previewOn = false; + this.currfile = "Untitled".asFileHandler(); + this.editormux = false; + me = this; + this.editor = new SimpleMDE({ + element: markarea, + autofocus: true, + tabSize: 4, + indentWithTabs: true, + toolbar: [ + "bold", + "italic", + "heading", + "|", + "quote", + "code", + "unordered-list", + "ordered-list", + "|", + "link", + "image", + "table", + "horizontal-rule", + "|", + { + name: "preview", + className: "fa fa-eye no-disable", + action: function(e) { + me.previewOn = !me.previewOn; + return SimpleMDE.togglePreview(e); + } + } + ] + }); + //if(self.previewOn) toggle the highlight + //{ + // var container = self._scheme.find(self,"Text") + // .$element.getElementsByClassName("editor-preview"); + // if(container.length == 0) return; + // var codes = container[0].getElementsByTagName('pre'); + // codes.forEach(function(el){ + // hljs.highlightBlock(el); + // }); + // //console.log(code); + //} + this.on("hboxchange", function(e) { + return me.resizeContent(); + }); + this.bindKey("ALT-N", function() { + return me.actionFile(`${me.name}-New`); + }); + this.bindKey("ALT-O", function() { + return me.actionFile(`${me.name}-Open`); + }); + return this.createBook(); + } + + createBook() { + var book, c1, c2, f1, f2, f3, f4, sec1, sec2, sec3; + book = new Book("home://test"); + c1 = new BookletChapter(book, "Chapter one"); + c2 = new BookletChapter(book, "Chapter two"); + sec1 = new BookletSection(c1, "section 1 in c1"); + sec2 = new BookletSection(c1, "section 2 in c1"); + sec3 = new BookletSection(c2, "section 1 in c2"); + f1 = new BookletFile(sec1); + f2 = new BookletFile(sec2); + f3 = new BookletFile(sec3); + f4 = new BookletFile(sec1); + return console.log(book.toc()); + } + + resizeContent() { + var cheight, children, statusbar, titlebar, toolbar; + children = ($(this.container)).children(); + titlebar = (($(this.scheme)).find(".afx-window-top"))[0]; + toolbar = children[1]; + statusbar = children[4]; + cheight = ($(this.scheme)).height() - ($(titlebar)).height() - ($(toolbar)).height() - ($(statusbar)).height() - 40; + return ($(children[2])).css("height", cheight + "px"); + } + + menu() { + var me, menu; + me = this; + menu = [ + { + text: "__(File)", + child: [ + { + text: "__(New booklet)", + dataid: `${this.name}-New`, + shortcut: "A-N" + }, + { + text: "__(Open a booklet)", + dataid: `${this.name}-Open`, + shortcut: "A-O" + } + ], + onmenuselect: function(e) { + return me.actionFile(e.item.data.dataid); + } + } + ]; + return menu; + } + + actionFile(e) { + return console.log("Action file fired"); + } + + }; + + /* + me = @ + switch e + when "#{@name}-Open" + @openDialog "FileDiaLog", ( d, f ) -> + me.open "#{d}/#{f}".asFileHandler() + , __("Open file") + + when "#{@name}-New" + @currfile = "Untitled".asFileHandler() + @currfile.cache = "" + @editor.value("") + */ + Booklet.dependencies = ["mde/simplemde.min"]; + + this.OS.register("Booklet", Booklet); + + BookletEntry = class BookletEntry { + constructor(name1) { + this.name = name1; + this.markAsDirty(); + } + + save() {} + + remove() {} + + markAsDirty() { + return this.dirty = true; + } + + markAsClean() { + return this.dirty = false; + } + + toc() {} + + }; + + BookletFolder = class BookletFolder extends BookletEntry { + constructor(name) { + super(name); + } + + save() {} + + remove() {} + + rename(newname) {} + + }; + + Book = class Book extends BookletFolder { + constructor(path, name) { + super(name); + this.path = path; + this.chapters = []; + this.metaFile = `${this.path}/meta.json`.asFileHandler(); + } + + addChapter(chap) { + chap.book = this; + return this.chapters.push(chap); + } + + size() { + return this.chapters.length; + } + + toc() { + var v; + return { + name: this.name, + path: this.path, + meta: this.metaFile.path, + entries: (function() { + var i, len, ref, results; + ref = this.chapters; + results = []; + for (i = 0, len = ref.length; i < len; i++) { + v = ref[i]; + results.push(v.toc()); + } + return results; + }).call(this) + }; + } + + }; + + BookletChapter = class BookletChapter extends BookletFolder { + constructor(book1, name) { + super(name); + this.book = book1; + this.book.addChapter(this); + this.sections = []; + this.path = `${this.book.path}/${this.book.size()}`; + this.metaFile = `${this.path}/meta.json`.asFileHandler(); + this.descFile = `${this.path}/chapter.md`.asFileHandler(); + } + + addSection(sec) { + sec.chapter = this; + return this.sections.push(sec); + } + + size() { + return this.sections.length; + } + + toc() { + var v; + return { + name: this.name, + path: this.path, + meta: this.metaFile.path, + description: this.descFile.path, + entries: (function() { + var i, len, ref, results; + ref = this.sections; + results = []; + for (i = 0, len = ref.length; i < len; i++) { + v = ref[i]; + results.push(v.toc()); + } + return results; + }).call(this) + }; + } + + }; + + BookletSection = class BookletSection extends BookletFolder { + constructor(chapter, name) { + super(name); + this.chapter = chapter; + this.chapter.addSection(this); + this.path = `${this.chapter.path}/${this.chapter.size()}`; + this.files = []; + this.descFile = `${this.path}/section.md`.asFileHandler(); + } + + addFile(file) { + file.section = this; + return this.files.push(file); + } + + toc() { + var v; + return { + name: this.name, + path: this.path, + description: this.descFile.path, + entries: (function() { + var i, len, ref, results; + ref = this.files; + results = []; + for (i = 0, len = ref.length; i < len; i++) { + v = ref[i]; + results.push(v.toc()); + } + return results; + }).call(this) + }; + } + + size() { + return this.files.length; + } + + }; + + BookletFile = class BookletFile extends BookletEntry { + constructor(section) { + super(""); + this.section = section; + this.section.addFile(this); + this.path = `${this.section.path}/${this.section.size()}.md`; + this.handle = this.path.asFileHandler(); + } + + getTitle() {} + + toc() { + return { + name: this.name, + path: this.path + }; + } + + }; + +}).call(this); diff --git a/Booklet/build/debug/package.json b/Booklet/build/debug/package.json new file mode 100644 index 0000000..d392213 --- /dev/null +++ b/Booklet/build/debug/package.json @@ -0,0 +1,13 @@ +{ + "app":"Booklet", + "name":"Booklet", + "description":"", + "info":{ + "author": "", + "email": "" + }, + "version":"0.0.1-a", + "category":"Other", + "iconclass":"fa fa-adn", + "mimes":["none"] +} \ No newline at end of file diff --git a/Booklet/build/debug/scheme.html b/Booklet/build/debug/scheme.html new file mode 100644 index 0000000..7c27b2f --- /dev/null +++ b/Booklet/build/debug/scheme.html @@ -0,0 +1,9 @@ + + + + +
+ +
+
+
\ No newline at end of file diff --git a/Booklet/coffees/common.coffee b/Booklet/coffees/common.coffee new file mode 100644 index 0000000..578a019 --- /dev/null +++ b/Booklet/coffees/common.coffee @@ -0,0 +1,106 @@ +class BookletEntry + constructor: (@name) -> + @markAsDirty() + save: () -> + + remove: () -> + + markAsDirty: () -> @dirty = true + markAsClean: () -> @dirty = false + + toc: () -> + +class BookletFolder extends BookletEntry + constructor: (name) -> + super name + + save: () -> + + remove: () -> + + rename: (newname) -> + + +class Book extends BookletFolder + constructor: (@path, name) -> + super name + @chapters = [] + @metaFile = "#{@path}/meta.json".asFileHandler() + + addChapter: (chap) -> + chap.book = @ + @chapters.push chap + + size: () -> + return @chapters.length + + toc: () -> + return { + name: @name, + path: @path, + meta: @metaFile.path, + entries: v.toc() for v in @chapters + } + +class BookletChapter extends BookletFolder + constructor: (@book, name) -> + super name + @book.addChapter @ + @sections = [] + @path = "#{@book.path}/#{@book.size()}" + @metaFile = "#{@path}/meta.json".asFileHandler() + @descFile = "#{@path}/chapter.md".asFileHandler() + + addSection: (sec) -> + sec.chapter = @ + @sections.push sec + + size: () -> + return @sections.length + + toc: () -> + return { + name: @name, + path: @path, + meta: @metaFile.path, + description: @descFile.path, + entries: v.toc() for v in @sections + } + +class BookletSection extends BookletFolder + constructor: (@chapter, name) -> + super name + @chapter.addSection @ + @path = "#{@chapter.path}/#{@chapter.size()}" + @files = [] + @descFile = "#{@path}/section.md".asFileHandler() + + addFile: (file) -> + file.section = @ + @files.push file + + toc: () -> + return { + name: @name, + path: @path, + description: @descFile.path, + entries: v.toc() for v in @files + } + + size: () -> + return @files.length + +class BookletFile extends BookletEntry + constructor: (@section) -> + super "" + @section.addFile @ + @path = "#{@section.path}/#{@section.size()}.md" + @handle = @path.asFileHandler() + + getTitle: () -> + + toc: () -> + return { + name: @name, + path: @path + } \ No newline at end of file diff --git a/Booklet/coffees/main.coffee b/Booklet/coffees/main.coffee new file mode 100644 index 0000000..8961bb0 --- /dev/null +++ b/Booklet/coffees/main.coffee @@ -0,0 +1,102 @@ +class Booklet extends this.OS.GUI.BaseApplication + constructor: ( args ) -> + super "Booklet", args + + main: () -> + @initEditor() + @resizeContent() + + initEditor: ()-> + markarea = @find "markarea" + @container = @find "mycontainer" + @previewOn = false + @currfile = "Untitled".asFileHandler() + @editormux = false + me = @ + @editor = new SimpleMDE + element: markarea + autofocus: true + tabSize: 4 + indentWithTabs: true + toolbar: [ + "bold", "italic", "heading", "|", "quote", "code", + "unordered-list", "ordered-list", "|", "link", + "image", "table", "horizontal-rule", "|", + { + name: "preview", + className: "fa fa-eye no-disable", + action: (e) -> + me.previewOn = !me.previewOn + SimpleMDE.togglePreview e + #if(self.previewOn) toggle the highlight + #{ + # var container = self._scheme.find(self,"Text") + # .$element.getElementsByClassName("editor-preview"); + # if(container.length == 0) return; + # var codes = container[0].getElementsByTagName('pre'); + # codes.forEach(function(el){ + # hljs.highlightBlock(el); + # }); + # //console.log(code); + #} + } + ] + @on "hboxchange", (e) -> me.resizeContent() + @bindKey "ALT-N", () -> me.actionFile "#{me.name}-New" + @bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open" + + @createBook() + + createBook: () -> + book = new Book("home://test", "mybook", @) + c1 = new BookletChapter(book, "Chapter one") + c2 = new BookletChapter(book, "Chapter two") + sec1 = new BookletSection(c1, "section 1 in c1") + sec2 = new BookletSection(c1, "section 2 in c1") + sec3 = new BookletSection(c2, "section 1 in c2") + f1 = new BookletFile(sec1) + f2 = new BookletFile(sec2) + f3 = new BookletFile(sec3) + f4 = new BookletFile(sec1) + + console.log(book.toc()) + + resizeContent: () -> + children = ($ @container).children() + titlebar = (($ @scheme).find ".afx-window-top")[0] + toolbar = children[1] + statusbar = children[4] + cheight = ($ @scheme).height() - ($ titlebar).height() - ($ toolbar).height() - ($ statusbar).height() - 40 + ($ children[2]).css("height", cheight + "px") + + + menu: () -> + me = @ + menu = [{ + text: "__(File)", + child: [ + { text: "__(New booklet)", dataid: "#{@name}-New", shortcut: "A-N" }, + { text: "__(Open a booklet)", dataid: "#{@name}-Open", shortcut: "A-O" } + ], + onmenuselect: (e) -> me.actionFile e.item.data.dataid + }] + menu + + actionFile: (e) -> + console.log "Action file fired" + ### + me = @ + switch e + when "#{@name}-Open" + @openDialog "FileDiaLog", ( d, f ) -> + me.open "#{d}/#{f}".asFileHandler() + , __("Open file") + + when "#{@name}-New" + @currfile = "Untitled".asFileHandler() + @currfile.cache = "" + @editor.value("") + ### +Booklet.dependencies = [ "mde/simplemde.min" ] + +this.OS.register "Booklet", Booklet \ No newline at end of file diff --git a/Booklet/package.json b/Booklet/package.json new file mode 100644 index 0000000..d392213 --- /dev/null +++ b/Booklet/package.json @@ -0,0 +1,13 @@ +{ + "app":"Booklet", + "name":"Booklet", + "description":"", + "info":{ + "author": "", + "email": "" + }, + "version":"0.0.1-a", + "category":"Other", + "iconclass":"fa fa-adn", + "mimes":["none"] +} \ No newline at end of file diff --git a/Booklet/project.apj b/Booklet/project.apj new file mode 100644 index 0000000..e95a41d --- /dev/null +++ b/Booklet/project.apj @@ -0,0 +1 @@ +{"name":"Booklet","root":"home://workspace/Booklet","css":[],"javascripts":[],"coffees":["coffees/main.coffee","coffees/common.coffee"],"copies":["assets/scheme.html","package.json","README.md"]} \ No newline at end of file diff --git a/DrawIOWrapper/README.md b/DrawIOWrapper/README.md new file mode 100644 index 0000000..22e4ea9 --- /dev/null +++ b/DrawIOWrapper/README.md @@ -0,0 +1,24 @@ +# DrawIOWrapper +This is an example project, generated by AntOS Development Kit + +## Howto + +1. Open the project.apj file with AntOSDK (simply double Click on it) +2. Modify the UI in *assets/scheme.html* +3. Modify application code in *coffees/main.coffee* +4. Modify CSS style in *css/main.css* +5. Other files need to be copied: put in to assets + +## Set up build target + +Click **Menu> Build > Build Option** or simply hit **ALT-Y** + +In the build options dialog, add or remove files that need to be +included into the build + +Click **Save** + +## Build application +* To build: **Menu > Build > Build** or **ALT-C** +* To build and run: **Menu > Build > Build and Run** or **CTRL-R** +* To release: **Menu > Build > Build release** or **ALT-P** \ No newline at end of file diff --git a/DrawIOWrapper/assets/scheme.html b/DrawIOWrapper/assets/scheme.html new file mode 100644 index 0000000..840a4be --- /dev/null +++ b/DrawIOWrapper/assets/scheme.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/DrawIOWrapper/build/debug/README.md b/DrawIOWrapper/build/debug/README.md new file mode 100644 index 0000000..22e4ea9 --- /dev/null +++ b/DrawIOWrapper/build/debug/README.md @@ -0,0 +1,24 @@ +# DrawIOWrapper +This is an example project, generated by AntOS Development Kit + +## Howto + +1. Open the project.apj file with AntOSDK (simply double Click on it) +2. Modify the UI in *assets/scheme.html* +3. Modify application code in *coffees/main.coffee* +4. Modify CSS style in *css/main.css* +5. Other files need to be copied: put in to assets + +## Set up build target + +Click **Menu> Build > Build Option** or simply hit **ALT-Y** + +In the build options dialog, add or remove files that need to be +included into the build + +Click **Save** + +## Build application +* To build: **Menu > Build > Build** or **ALT-C** +* To build and run: **Menu > Build > Build and Run** or **CTRL-R** +* To release: **Menu > Build > Build release** or **ALT-P** \ No newline at end of file diff --git a/DrawIOWrapper/build/debug/main.js b/DrawIOWrapper/build/debug/main.js new file mode 100644 index 0000000..1e1deff --- /dev/null +++ b/DrawIOWrapper/build/debug/main.js @@ -0,0 +1,15 @@ +(function() { + var DrawIOWrapper; + + DrawIOWrapper = class DrawIOWrapper extends this.OS.GUI.BaseApplication { + constructor(args) { + super("DrawIOWrapper", args); + } + + main() {} + + }; + + this.OS.register("DrawIOWrapper", DrawIOWrapper); + +}).call(this); diff --git a/DrawIOWrapper/build/debug/package.json b/DrawIOWrapper/build/debug/package.json new file mode 100644 index 0000000..2cabed6 --- /dev/null +++ b/DrawIOWrapper/build/debug/package.json @@ -0,0 +1,13 @@ +{ + "app":"DrawIOWrapper", + "name":"DrawIOWrapper", + "description":"", + "info":{ + "author": "", + "email": "" + }, + "version":"0.0.1-a", + "category":"Other", + "iconclass":"fa fa-adn", + "mimes":["none"] +} \ No newline at end of file diff --git a/DrawIOWrapper/build/debug/scheme.html b/DrawIOWrapper/build/debug/scheme.html new file mode 100644 index 0000000..840a4be --- /dev/null +++ b/DrawIOWrapper/build/debug/scheme.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/DrawIOWrapper/coffees/main.coffee b/DrawIOWrapper/coffees/main.coffee new file mode 100644 index 0000000..90473dc --- /dev/null +++ b/DrawIOWrapper/coffees/main.coffee @@ -0,0 +1,7 @@ +class DrawIOWrapper extends this.OS.GUI.BaseApplication + constructor: ( args ) -> + super "DrawIOWrapper", args + + main: () -> + +this.OS.register "DrawIOWrapper", DrawIOWrapper \ No newline at end of file diff --git a/DrawIOWrapper/package.json b/DrawIOWrapper/package.json new file mode 100644 index 0000000..2cabed6 --- /dev/null +++ b/DrawIOWrapper/package.json @@ -0,0 +1,13 @@ +{ + "app":"DrawIOWrapper", + "name":"DrawIOWrapper", + "description":"", + "info":{ + "author": "", + "email": "" + }, + "version":"0.0.1-a", + "category":"Other", + "iconclass":"fa fa-adn", + "mimes":["none"] +} \ No newline at end of file diff --git a/DrawIOWrapper/project.apj b/DrawIOWrapper/project.apj new file mode 100644 index 0000000..be50388 --- /dev/null +++ b/DrawIOWrapper/project.apj @@ -0,0 +1,8 @@ +{ + "name": "DrawIOWrapper", + "root": "home://workspace/DrawIOWrapper", + "css": [], + "javascripts": [], + "coffees": ["coffees/main.coffee"], + "copies": ["assets/scheme.html", "package.json", "README.md"] +} \ No newline at end of file diff --git a/OpenPage/build/debug/blank.odt b/OpenPage/build/debug/blank.odt index 2414e6f3e7842f8b5ddf78858ef321cd88331f11..90a60002d1c93e1480649a9520a0c56a53effae3 100644 GIT binary patch delta 13 UcmbO|jbqj{j)oS-Elg6}03?V6QUCw| delta 15 WcmbO=jbrvSj)oS-Elg6}j0^xRD+E&j diff --git a/OpenPage/build/debug/icon.png b/OpenPage/build/debug/icon.png index 1dceb3d76cfae35a8e812fb5f866d0db0d1c6538..ad142f9855ab7c879f9d23f010eefcf44d106cfc 100644 GIT binary patch delta 7 OcmdnNwT)|o87lw_f&y*; delta 10 RcmdnSwS#Me87mV*1OO8z0>}UW