fix setting, add New menu to Markon and NotePad

This commit is contained in:
Xuan Sang LE 2018-02-28 16:10:25 +01:00
parent 52a5f7351d
commit 0578f41c9c
3 changed files with 12 additions and 2 deletions

View File

@ -10,9 +10,9 @@
#TODO: multi app try to write to this object, it neet to be cloned
{ text: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" },
{ text: "Home", path: 'home:///', iconclass: "fa fa-home", type: "fs" },
{ text: "OS", path: 'os:///', iconclass: "fa fa-inbox", type: "fs" },
{ text: "Desktop", path: _OS.setting.desktop.path , iconclass: "fa fa-desktop", type: "fs" },
{ text: "Google Drive", path: 'gdv:///', iconclass: "fa fa-google-drive", type: "fs" },
{ text: "OS", path: 'os:///', iconclass: "fa fa-inbox", type: "fs" },
{ text: "Google Drive", path: 'gdv:///', iconclass: "fa fa-inbox", type: "fs" },
{ text: "Shared", path: 'shared:///' , iconclass: "fa fa-share-square", type: "fs" }
] if not _OS.setting.VFS.mountpoints

View File

@ -44,6 +44,7 @@ class MarkOn extends this.OS.GUI.BaseApplication
me.currfile.dirty = true
me.scheme.set "apptitle", "#{me.currfile.basename}*"
@on "hboxchange", (e) -> me.resizeContent()
@bindKey "ALT-N", () -> me.actionFile "#{me.name}-New"
@bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open"
@bindKey "CTRL-S", () -> me.actionFile "#{me.name}-Save"
@bindKey "ALT-W", () -> me.actionFile "#{me.name}-Saveas"
@ -83,6 +84,7 @@ class MarkOn extends this.OS.GUI.BaseApplication
menu = [{
text: "File",
child: [
{ text: "Open", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: "Open", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: "Save", dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: "Save as", dataid: "#{@name}-Saveas", shortcut: "A-W" }
@ -110,6 +112,10 @@ class MarkOn extends this.OS.GUI.BaseApplication
when "#{@name}-Saveas"
@currfile.cache = @editor.value()
saveas()
when "#{@name}-New"
@currfile = "Untitled".asFileHandler()
@currfile.cache = ""
@editor.value("")
cleanup: (evt) ->
return unless @currfile.dirty

View File

@ -104,6 +104,7 @@ class NotePad extends this.OS.GUI.BaseApplication
, "Close tab", { text: "Close without saving ?" }
return false
#@tabarea.set "closable", true
@bindKey "ALT-N", () -> me.actionFile "#{me.name}-New"
@bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open"
@bindKey "CTRL-S", () -> me.actionFile "#{me.name}-Save"
@bindKey "ALT-W", () -> me.actionFile "#{me.name}-Saveas"
@ -243,6 +244,7 @@ class NotePad extends this.OS.GUI.BaseApplication
menu = [{
text: "File",
child: [
{ text: "New", dataid: "#{@name}-New", shortcut: "A-N" },
{ text: "Open", dataid: "#{@name}-Open", shortcut: "A-O" },
{ text: "Save", dataid: "#{@name}-Save", shortcut: "C-S" },
{ text: "Save as", dataid: "#{@name}-Saveas", shortcut: "A-W" }
@ -278,6 +280,8 @@ class NotePad extends this.OS.GUI.BaseApplication
when "#{@name}-Saveas"
@currfile.cache = @editor.getValue()
saveas()
when "#{@name}-New"
@open "Untitled".asFileHandler()
cleanup: (evt) ->
dirties = ( v for v in @tabarea.get "items" when v.dirty )