fix minor error

This commit is contained in:
Xuan Sang LE 2018-01-30 19:06:30 +01:00
parent 02422319ca
commit de387ece25
23 changed files with 190 additions and 95 deletions

View File

@ -46,11 +46,11 @@ class BasicDialog extends BaseDialog
init: () -> init: () ->
@title = @name if not @title @title = @name if not @title
html = "<afx-app-window data-id = 'dia-window' apptitle='#{@title}' width='#{@conf.width}' height='#{@conf.height}'> html = "<afx-app-window data-id = 'dia-window' apptitle='#{@title}' width='#{@conf.width}' height='#{@conf.height}'>
<afx-hbox>" <afx-vbox>"
html += "<#{@conf.tag} #{@conf.att} data-id = 'content'></#{@conf.tag}>" html += "<#{@conf.tag} #{@conf.att} data-id = 'content'></#{@conf.tag}>"
html += "<div data-height = '40' style=' text-align:right;padding-top:3px;'>" html += "<div data-height = '40' style=' text-align:right;padding-top:3px;'>"
html += "<afx-button data-id = 'bt#{k}' text = '#{v.label}' style='margin-right:5px;'></afx-button>" for k,v of @conf.buttons html += "<afx-button data-id = 'bt#{k}' text = '#{v.label}' style='margin-right:5px;'></afx-button>" for k,v of @conf.buttons
html += "</div></afx-hbox></afx-app-window>" html += "</div></afx-vbox></afx-app-window>"
#render the html #render the html
_GUI.htmlToScheme html, @, @host _GUI.htmlToScheme html, @, @host
@ -62,6 +62,7 @@ class BasicDialog extends BaseDialog
# bind action to button # bind action to button
( (me.find "bt#{k}").set "onbtclick", f(v) ) for k, v of @conf.buttons ( (me.find "bt#{k}").set "onbtclick", f(v) ) for k, v of @conf.buttons
@conf.filldata @ if @conf.filldata @conf.filldata @ if @conf.filldata
@conf.xtra @ if @conf.xtra
this.OS.GUI.BasicDialog = BasicDialog this.OS.GUI.BasicDialog = BasicDialog
@ -90,6 +91,9 @@ class PromptDialog extends BasicDialog
filldata: (d) -> filldata: (d) ->
return unless d.data return unless d.data
(d.find "content").value = d.data (d.find "content").value = d.data
xtra: (d) ->
$( d.find "content" ).keyup (e) ->
(d.find "bt0").trigger() if e.which is 13
} }
this.OS.register "PromptDialog", PromptDialog this.OS.register "PromptDialog", PromptDialog
@ -157,7 +161,7 @@ class InfoDialog extends BasicDialog
filldata: (d) -> filldata: (d) ->
return unless d.data return unless d.data
rows = [] rows = []
rows.push [ { value: k }, { value: v } ] for k, v of d.data rows.push [ { value: k }, { value: v } ] for v, k in d.data
(d.find "content").set "rows", rows (d.find "content").set "rows", rows
} }
this.OS.register "InfoDialog", InfoDialog this.OS.register "InfoDialog", InfoDialog
@ -213,6 +217,10 @@ class SelectionDialog extends BasicDialog
filldata: (d) -> filldata: (d) ->
return unless d.data return unless d.data
(d.find "content").set "items", d.data (d.find "content").set "items", d.data
xtra: (d) ->
( d.find "content" ).set "onlistdbclick", (e) ->
(d.find "bt0").trigger()
} }
this.OS.register "SelectionDialog", SelectionDialog this.OS.register "SelectionDialog", SelectionDialog

View File

@ -78,9 +78,15 @@ self.OS.GUI =
( f m, i if m ) for m, i in mimes ( f m, i if m ) for m, i in mimes
return apps return apps
appsWithServices: () ->
o = {}
o[k] = v for k, v of _OS.setting.system.packages when v.services and v.services.length > 0
o
openWith: (it) -> openWith: (it) ->
return unless it return unless it
return _GUI.launch it.app if it.type is "app" and it.app return _GUI.launch it.app if it.type is "app" and it.app
return _courrier.osinfo "Application#{it.text} is not executable" if it.type is "app"
apps = _GUI.appsByMime ( if it.type is "dir" then "dir" else it.mime ) apps = _GUI.appsByMime ( if it.type is "dir" then "dir" else it.mime )
return _courrier.osinfo "No application available to open #{it.filename}" if apps.length is 0 return _courrier.osinfo "No application available to open #{it.filename}" if apps.length is 0
return _GUI.launch apps[0].app, [it.path] if apps.length is 1 return _GUI.launch apps[0].app, [it.path] if apps.length is 1
@ -169,6 +175,7 @@ self.OS.GUI =
handler p if p isnt ($ "#workspace").get(0) handler p if p isnt ($ "#workspace").get(0)
handler event.target handler event.target
event.preventDefault() event.preventDefault()
initDM: -> initDM: ->
# check login first # check login first
_API.resource "schemes/dm.html", (x) -> _API.resource "schemes/dm.html", (x) ->
@ -236,7 +243,25 @@ self.OS.GUI =
desktop[0].contextmenuHandler = (e, m) -> desktop[0].contextmenuHandler = (e, m) ->
desktop[0].set "selected", -1 if e.target is desktop[0] desktop[0].set "selected", -1 if e.target is desktop[0]
($ "#sysdock").get(0).set "selectedApp", null ($ "#sysdock").get(0).set "selectedApp", null
console.log "context menu handler for desktop" menu = [
{ text: "Open", dataid: "desktop-open" },
{ text: "Refresh", dataid: "desktop-refresh" }
]
menu = menu.concat _OS.setting.desktop.menu
m.set "items", menu
m.set "onmenuselect", (evt) ->
switch evt.item.data.dataid
when "desktop-open"
it = desktop[0].get "selected"
return _GUI.openWith it if it
it = _OS.setting.desktop.path.asFileHandler()
it.mime = "dir"
_GUI.openWith it
when "desktop-refresh"
desktop[0].fetch()
else
_GUI.launch evt.item.data.app if evt.item.data.app
m.show(e)
desktop[0].fetch() desktop[0].fetch()
_courrier.observable.on "VFS", (d) -> _courrier.observable.on "VFS", (d) ->
@ -303,12 +328,14 @@ self.OS.GUI =
_OS.setting.appearance = conf.appearance if conf.appearance _OS.setting.appearance = conf.appearance if conf.appearance
_OS.setting.user = conf.user _OS.setting.user = conf.user
_OS.setting.VFS = conf.VFS if conf.VFS _OS.setting.VFS = conf.VFS if conf.VFS
_OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
_OS.setting.desktop.menu = [] unless _OS.setting.desktop.menu
_OS.setting.VFS.mountpoints = [ _OS.setting.VFS.mountpoints = [
#TODO: multi app try to write to this object, it neet to be cloned #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: "Applications", path: 'app:///', iconclass: "fa fa-adn", type: "app" },
{ text: "Home", path: 'home:///', iconclass: "fa fa-home", type: "fs" }, { text: "Home", path: 'home:///', iconclass: "fa fa-home", type: "fs" },
{ text: "OS", path: 'os:///', iconclass: "fa fa-inbox", type: "fs" }, { text: "OS", path: 'os:///', iconclass: "fa fa-inbox", type: "fs" },
{ text: "Desktop", path: 'home:///.desktop', iconclass: "fa fa-desktop", type: "fs" }, { text: "Desktop", path: _OS.setting.desktop.path , iconclass: "fa fa-desktop", type: "fs" },
] if not _OS.setting.VFS.mountpoints ] if not _OS.setting.VFS.mountpoints
_OS.setting.system = conf.system if conf.system _OS.setting.system = conf.system if conf.system
@ -317,7 +344,7 @@ self.OS.GUI =
"os:///packages" "os:///packages"
] unless _OS.setting.system.pkgpaths ] unless _OS.setting.system.pkgpaths
_OS.setting.system.menu = [] unless _OS.setting.system.menu _OS.setting.system.menu = [] unless _OS.setting.system.menu
_OS.setting.desktop.path = "home:///.desktop" unless _OS.setting.desktop.path
_OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme _OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme
# load theme # load theme
_GUI.loadTheme _OS.setting.appearance.theme _GUI.loadTheme _OS.setting.appearance.theme

View File

@ -1,5 +1,5 @@
<afx-app-window data-id = 'about-window' width='300' height='200'> <afx-app-window data-id = 'about-window' width='300' height='200'>
<afx-hbox> <afx-vbox>
<div style="text-align:center; margin-top:10px;" data-height="50"> <div style="text-align:center; margin-top:10px;" data-height="50">
<h3 style = "margin:0;padding:0;"> <h3 style = "margin:0;padding:0;">
<afx-label data-id = 'mylabel'></afx-label> <afx-label data-id = 'mylabel'></afx-label>
@ -7,5 +7,5 @@
<i><p style = "margin:0; padding:0" data-id = 'mydesc'></p></i> <i><p style = "margin:0; padding:0" data-id = 'mydesc'></p></i>
</div> </div>
<afx-grid-view data-id = 'mygrid'></afx-grid-view> <afx-grid-view data-id = 'mygrid'></afx-grid-view>
</afx-hbox> </afx-vbox>
</afx-app-window> </afx-app-window>

View File

@ -1,13 +1,13 @@
<afx-app-window data-id = 'file-dialog-window' width='400' height='300'> <afx-app-window data-id = 'file-dialog-window' width='400' height='300'>
<afx-vbox>
<afx-list-view data-id = "location" dropdown = "false" data-width = "120"></afx-list-view>
<afx-hbox> <afx-hbox>
<afx-list-view data-id = "location" dropdown = "false" data-width = "120"></afx-list-view>
<afx-vbox>
<afx-file-view data-id = "fileview" view='tree' status = false></afx-file-view> <afx-file-view data-id = "fileview" view='tree' status = false></afx-file-view>
<input data-height = '26' type = "text" data-id = "filename" style="margin-left:5px; margin-right:5px;display:none;" /> <input data-height = '26' type = "text" data-id = "filename" style="margin-left:5px; margin-right:5px;display:none;" />
<div data-height = '30' style=' text-align:right;padding-top:3px;'> <div data-height = '30' style=' text-align:right;padding-top:3px;'>
<afx-button data-id = "bt-ok" text = "Ok"></afx-button> <afx-button data-id = "bt-ok" text = "Ok"></afx-button>
<afx-button data-id = "bt-cancel" text = "Cancel"></afx-button> <afx-button data-id = "bt-cancel" text = "Cancel"></afx-button>
</div> </div>
</afx-hbox>
</afx-vbox> </afx-vbox>
</afx-hbox>
</afx-app-window> </afx-app-window>

View File

@ -1,5 +1,5 @@
<afx-button> <afx-button>
<button disabled={ enable == "false" } onclick="{ _onbtclick }" > <button disabled={ enable == "false" } onclick="{ _onbtclick }" ref = "mybtn" >
<afx-label color = {color} icon={icon} iconclass = {iconclass} text = {text} ></afx-label> <afx-label color = {color} icon={icon} iconclass = {iconclass} text = {text} ></afx-label>
</button> </button>
<script> <script>
@ -19,6 +19,10 @@
self[k] = v self[k] = v
self.update() self.update()
} }
self.root.trigger = function()
{
$(self.refs.mybtn).trigger("click")
}
self.root.get = function(k) self.root.get = function(k)
{ {
return self[k] return self[k]

View File

@ -169,7 +169,14 @@
} }
self.refs.treeview.ontreeselect = function(d) self.refs.treeview.ontreeselect = function(d)
{ {
if(!d.data) return; if(!d) return;
if(!d.data)// select the root
{
var r = self.path.asFileHandler()
r.size = 0
r.filename = r.path
d.data = { child: r , i:0 }
}
var data = {id:self.rid, data:d.data.child, idx:d.data.i} var data = {id:self.rid, data:d.data.child, idx:d.data.i}
self.root.observable.trigger("fileselect",data) self.root.observable.trigger("fileselect",data)
} }

View File

@ -21,6 +21,9 @@
{ {
if(self.selidx != -1) if(self.selidx != -1)
self.items[self.selidx].selected =false self.items[self.selidx].selected =false
if(v == -1)
self.selidx = -1
else
if(self.items[v]) self.items[v].selected = true if(self.items[v]) self.items[v].selected = true
} }
else if(k == "*") else if(k == "*")

View File

@ -1,5 +1,5 @@
<afx-hbox style = "display:block;"> <afx-hbox style = "display:block;">
<div ref = "container" class="afx-hbox-container"> <div ref = "container" class="afx-vbox-container">
<yield/> <yield/>
</div> </div>
<script> <script>
@ -7,10 +7,8 @@
this.on('mount', function(){ this.on('mount', function(){
$(self.refs.container) $(self.refs.container)
.css("display","flex") .css("display","flex")
.css("flex-direction","column") .css("flex-direction","row")
.css("width","100%") .css("width","100%")
//.css("background-color","red")
//.css("overflow", "hidden")
calibrate_size() calibrate_size()
@ -21,13 +19,12 @@
}) })
} }
}) })
var calibrate_size = function() var calibrate_size = function()
{ {
var auto_height = [] var auto_width = []
var csize, ocheight = 0, avaiheight; var csize, ocwidth = 0, avaiheight;
avaiheight = $(self.root).height() avaiheight = $(self.root).height()
avaiwidth = $(self.root).width() avaiWidth = $(self.root).width()
$(self.refs.container).css("height",avaiheight + "px") $(self.refs.container).css("height",avaiheight + "px")
$(self.refs.container) $(self.refs.container)
.children() .children()
@ -36,25 +33,25 @@
this.observable = self.root.observable this.observable = self.root.observable
$(this) $(this)
.css("flex-grow","1") .css("flex-grow","1")
//.css("border","1px solid black") //.css("height",avaiheight + "px")
var dw = $(this).attr("data-height") var dw = $(this).attr("data-width")
if(dw) if(dw)
{ {
$(this).css("height",dw + "px") $(this).css("width",dw + "px")
ocheight += Number(dw) ocwidth += Number(dw)
} }
else else
{ {
auto_height.push(this) auto_width.push(this)
} }
}) })
csize = (avaiheight - ocheight)/ (auto_height.length) csize = (avaiWidth - ocwidth)/ (auto_width.length)
$.each(auto_height, function(i,v) $.each(auto_width, function(i,v)
{ {
$(v).css("height", csize + "px") $(v).css("width", csize + "px")
}) })
self.root.observable.trigger("hboxchange", self.root.observable.trigger("vboxchange",
{id:$(self.root).attr("data-id"), w:avaiwidth, h:csize}) {id:$(self.root).attr("data-id"), w:csize, h:avaiheight})
} }
</script> </script>
</afx-hbox> </afx-hbox>

View File

@ -24,6 +24,9 @@
{ {
if(self.selidx != -1) if(self.selidx != -1)
self.items[self.selidx].selected =false self.items[self.selidx].selected =false
if(v == -1)
self.selidx = -1
else
if(self.items[v]) self.items[v].selected = true if(self.items[v]) self.items[v].selected = true
} }
else if(k == "*") else if(k == "*")

View File

@ -7,7 +7,7 @@
<afx-label color = {data.color} iconclass = {data.iconclass} icon = {data.icon} text = {data.text} ></afx-label> <afx-label color = {data.color} iconclass = {data.iconclass} icon = {data.icon} text = {data.text} ></afx-label>
</a> </a>
<afx-menu if={data.child != null} child={data.child} onmenuselect = {data.onmenuselect} observable = {parent.root.observable} rootid = {parent.rid}></afx-menu> <afx-menu if={data.child != null} child={data.child.constructor === Array?data.child:data.child()} onmenuselect = {data.onmenuselect} observable = {parent.root.observable} rootid = {parent.rid}></afx-menu>
</li> </li>
<li class="afx-corner-fix"></li> <li class="afx-corner-fix"></li>
</ul> </ul>

View File

@ -1,5 +1,5 @@
<afx-vbox style = "display:block;"> <afx-vbox style = "display:block;">
<div ref = "container" class="afx-vbox-container"> <div ref = "container" class="afx-hbox-container">
<yield/> <yield/>
</div> </div>
<script> <script>
@ -7,8 +7,10 @@
this.on('mount', function(){ this.on('mount', function(){
$(self.refs.container) $(self.refs.container)
.css("display","flex") .css("display","flex")
.css("flex-direction","row") .css("flex-direction","column")
.css("width","100%") .css("width","100%")
//.css("background-color","red")
//.css("overflow", "hidden")
calibrate_size() calibrate_size()
@ -19,12 +21,13 @@
}) })
} }
}) })
var calibrate_size = function() var calibrate_size = function()
{ {
var auto_width = [] var auto_height = []
var csize, ocwidth = 0, avaiheight; var csize, ocheight = 0, avaiheight;
avaiheight = $(self.root).height() avaiheight = $(self.root).height()
avaiWidth = $(self.root).width() avaiwidth = $(self.root).width()
$(self.refs.container).css("height",avaiheight + "px") $(self.refs.container).css("height",avaiheight + "px")
$(self.refs.container) $(self.refs.container)
.children() .children()
@ -33,25 +36,25 @@
this.observable = self.root.observable this.observable = self.root.observable
$(this) $(this)
.css("flex-grow","1") .css("flex-grow","1")
//.css("height",avaiheight + "px") //.css("border","1px solid black")
var dw = $(this).attr("data-width") var dw = $(this).attr("data-height")
if(dw) if(dw)
{ {
$(this).css("width",dw + "px") $(this).css("height",dw + "px")
ocwidth += Number(dw) ocheight += Number(dw)
} }
else else
{ {
auto_width.push(this) auto_height.push(this)
} }
}) })
csize = (avaiWidth - ocwidth)/ (auto_width.length) csize = (avaiheight - ocheight)/ (auto_height.length)
$.each(auto_width, function(i,v) $.each(auto_height, function(i,v)
{ {
$(v).css("width", csize + "px") $(v).css("height", csize + "px")
}) })
self.root.observable.trigger("vboxchange", self.root.observable.trigger("hboxchange",
{id:$(self.root).attr("data-id"), w:csize, h:avaiheight}) {id:$(self.root).attr("data-id"), w:avaiwidth, h:csize})
} }
</script> </script>
</afx-vbox> </afx-vbox>

View File

@ -1,6 +1,6 @@
<afx-app-window data-id = "am-window" apptitle="" width="400" height="300"> <afx-app-window data-id = "am-window" apptitle="" width="400" height="300">
<afx-hbox> <afx-vbox>
<afx-grid-view data-id = "mygrid"></afx-grid-view> <afx-grid-view data-id = "mygrid"></afx-grid-view>
<afx-button data-height="30" data-id = "btkill" text = "Kill process" iconclass="fa fa-times"></afx-button> <afx-button data-height="30" data-id = "btkill" text = "Kill process" iconclass="fa fa-times"></afx-button>
</afx-hbox> </afx-vbox>
</afx-app-window> </afx-app-window>

View File

@ -1,5 +1,6 @@
{ {
"app":null, "app":null,
"services": [ "Calendar", "PushNotification", "Spotlight" ]
"name":"CoreServices", "name":"CoreServices",
"description":"This is the core services", "description":"This is the core services",
"info":{ "info":{

View File

@ -11,5 +11,5 @@
"version":"0.1a", "version":"0.1a",
"category":"System", "category":"System",
"iconclass":"fa fa-user-circle-o", "iconclass":"fa fa-user-circle-o",
"mimes":[".*"] "mimes":["none"]
} }

View File

@ -1,13 +1,15 @@
<afx-app-window apptitle="Preview" width="650" height="500"> <afx-app-window apptitle="Preview" width="650" height="500">
<afx-vbox>
<afx-tab-container data-id="mytabs" closable = true></afx-tab-container>
<afx-tree-view data-id="mytree"> </afx-tree-view>
<afx-hbox> <afx-hbox>
<afx-vbox>
<afx-tab-container data-height = "50" data-id="mytabs" closable = true></afx-tab-container>
<afx-tree-view data-id="mytree"> </afx-tree-view>
</afx-vbox>
<afx-vbox>
<afx-button data-height="30" text="Read more" iconclass="fa fa-camera-retro fa-lg" id="button"></afx-button> <afx-button data-height="30" text="Read more" iconclass="fa fa-camera-retro fa-lg" id="button"></afx-button>
<afx-switch enable= true data-height="30"></afx-switch> <afx-switch enable= true data-height="30"></afx-switch>
<afx-calendar-view></afx-calendar-view> <afx-calendar-view></afx-calendar-view>
<afx-color-picker></afx-color-picker> <afx-color-picker></afx-color-picker>
<afx-list-view data-id = "mylist" dropdown = "true" width="200" data-height = "40"></afx-list-view> <afx-list-view data-id = "mylist" dropdown = "true" width="200" data-height = "40"></afx-list-view>
</afx-hbox>
</afx-vbox> </afx-vbox>
</afx-hbox>
</afx-app-window> </afx-app-window>

View File

@ -81,13 +81,20 @@ class Files extends this.OS.GUI.BaseApplication
me.view.set "data", d.result me.view.set "data", d.result
mnFile:() -> mnFile:() ->
#console.log file
me = @ me = @
f = () ->
console.log "called"
file = me.view.get "selectedFile"
return undefined unless file
return me._gui.appsByMime file.mime
{ {
text: "File", text: "File",
child: [ child: [
{ text: "New file", dataid: "#{@name}-mkf" }, { text: "New file", dataid: "#{@name}-mkf" },
{ text: "New folder", dataid: "#{@name}-mkdir" }, { text: "New folder", dataid: "#{@name}-mkdir" },
{ text: "Open", dataid: "#{@name}-open" }, { text: "Open with", dataid: "#{@name}-open", child: f },
{ text: "Upload", dataid: "#{@name}-upload" }, { text: "Upload", dataid: "#{@name}-upload" },
{ text: "Download", dataid: "#{@name}-download" }, { text: "Download", dataid: "#{@name}-download" },
{ text: "Properties", dataid: "#{@name}-info" } { text: "Properties", dataid: "#{@name}-info" }

View File

@ -1,14 +1,14 @@
<afx-app-window data-id = "files-app-window" apptitle="Files" width="600" height="400"> <afx-app-window data-id = "files-app-window" apptitle="Files" width="600" height="400">
<afx-hbox> <afx-vbox>
<afx-vbox data-height = "30" data-id = "nav-bar"> <afx-hbox data-height = "30" data-id = "nav-bar">
<afx-button data-width = "30" data-id = "btback" iconclass = "fa fa-arrow-left"></afx-button> <afx-button data-width = "30" data-id = "btback" iconclass = "fa fa-arrow-left"></afx-button>
<input type = "text" data-id = "navinput"></input> <input type = "text" data-id = "navinput"></input>
<div data-width = "5"></div> <div data-width = "5"></div>
</afx-vbox> </afx-hbox>
<afx-vbox> <afx-hbox>
<afx-list-view data-id = "favouri" data-width = "150"> <afx-list-view data-id = "favouri" data-width = "150">
</afx-list-view> </afx-list-view>
<afx-file-view data-id = "fileview"></afx-file-view> <afx-file-view data-id = "fileview"></afx-file-view>
</afx-vbox>
</afx-hbox> </afx-hbox>
</afx-vbox>
</afx-app-window> </afx-app-window>

View File

@ -8,6 +8,7 @@ class MarkOn extends this.OS.GUI.BaseApplication
@container = @find "mycontainer" @container = @find "mycontainer"
@previewOn = false @previewOn = false
@currfile = if @args and @args.length > 0 then @args[0].asFileHandler() else "Untitled".asFileHandler() @currfile = if @args and @args.length > 0 then @args[0].asFileHandler() else "Untitled".asFileHandler()
@editormux = false
@editor = new SimpleMDE @editor = new SimpleMDE
element: markarea element: markarea
autofocus: true autofocus: true
@ -38,7 +39,10 @@ class MarkOn extends this.OS.GUI.BaseApplication
] ]
@editor.codemirror.on "change", () -> @editor.codemirror.on "change", () ->
console.log "thing changed" return if me.editormux
if me.currfile.dirty is false
me.currfile.dirty = true
me.scheme.set "apptitle", "#{me.currfile.basename}*"
@on "vboxchange", (e) -> me.resizeContent() @on "vboxchange", (e) -> me.resizeContent()
@resizeContent() @resizeContent()
@open @currfile @open @currfile
@ -53,9 +57,14 @@ class MarkOn extends this.OS.GUI.BaseApplication
open: (file) -> open: (file) ->
#find table #find table
return if file.path is "Untitled"
me = @ me = @
file.dirty = false
file.read (d) -> file.read (d) ->
me.editormux = true
me.editor.value d me.editor.value d
me.scheme.set "apptitle", "#{me.currfile.basename}"
me.editormux = false
save: (file) -> save: (file) ->
@ -64,6 +73,7 @@ class MarkOn extends this.OS.GUI.BaseApplication
return me.error "Error saving file #{file.basename}" if d.error return me.error "Error saving file #{file.basename}" if d.error
file.dirty = false file.dirty = false
file.text = file.basename file.text = file.basename
me.scheme.set "apptitle", "#{me.currfile.basename}"
menu: () -> menu: () ->
me = @ me = @
@ -97,4 +107,15 @@ class MarkOn extends this.OS.GUI.BaseApplication
when "#{@name}-Saveas" when "#{@name}-Saveas"
@currfile.cache = @editor.value() @currfile.cache = @editor.value()
saveas() saveas()
cleanup: (evt) ->
return unless @currfile.dirty
me = @
evt.preventDefault()
@.openDialog "YesNoDialog", (d) ->
if d
me.currfile.dirty = false
me.quit()
, "Quit", { text: "Quit without saving ?" }
this.OS.register "MarkOn", MarkOn this.OS.register "MarkOn", MarkOn

View File

@ -1,7 +1,7 @@
<afx-app-window data-id = "markon-win" apptitle="Markon" width="600" height="450"> <afx-app-window data-id = "markon-win" apptitle="Markon" width="600" height="450">
<afx-vbox > <afx-hbox >
<div data-id = "mycontainer"> <div data-id = "mycontainer">
<textarea data-id="markarea" ></textarea> <textarea data-id="markarea" ></textarea>
</div> </div>
</afx-vbox> </afx-hbox>
</afx-app-window> </afx-app-window>

View File

@ -216,6 +216,16 @@ class NotePad extends this.OS.GUI.BaseApplication
@currfile.cache = @editor.getValue() @currfile.cache = @editor.getValue()
saveas() saveas()
cleanup: (evt) ->
dirties = ( v for v in @tabarea.get "items" when v.dirty )
return if dirties.length is 0
me = @
evt.preventDefault()
@.openDialog "YesNoDialog", (d) ->
if d
v.dirty = false for v in dirties
me.quit()
, "Quit", { text: "Ignore all #{dirties.length} unsaved files ?" }
NotePad.singleton = false NotePad.singleton = false
this.OS.register "NotePad", NotePad this.OS.register "NotePad", NotePad

View File

@ -1,18 +1,18 @@
<afx-app-window apptitle="" width="600" height="400" data-id="notepad"> <afx-app-window apptitle="" width="600" height="400" data-id="notepad">
<afx-vbox> <afx-hbox>
<afx-hbox data-width = "175" data-id = "sidebar"> <afx-vbox data-width = "175" data-id = "sidebar">
<afx-list-view data-id = "location" dropdown = "true" data-height= "30" width = "150"></afx-list-view> <afx-list-view data-id = "location" dropdown = "true" data-height= "30" width = "150"></afx-list-view>
<afx-file-view data-id = "fileview" view='tree' status = false></afx-file-view> <afx-file-view data-id = "fileview" view='tree' status = false></afx-file-view>
</afx-hbox> </afx-vbox>
<afx-hbox> <afx-vbox>
<afx-tab-container data-id="tabarea" data-height="26" closable = true></afx-tab-container> <afx-tab-container data-id="tabarea" data-height="26" closable = true></afx-tab-container>
<div data-id="datarea"></div> <div data-id="datarea"></div>
<afx-vbox data-height="30" data-id="bottom-vbox"> <afx-hbox data-height="30" data-id="bottom-vbox">
<div ><span data-id = "editorstat"></span></div> <div ><span data-id = "editorstat"></span></div>
<afx-list-view data-width="160" data-id = "themelist" dropdown = "true" width="135"></afx-list-view> <afx-list-view data-width="160" data-id = "themelist" dropdown = "true" width="135"></afx-list-view>
<afx-list-view data-width="125" data-id = "modelist" dropdown = "true" width="100"></afx-list-view> <afx-list-view data-width="125" data-id = "modelist" dropdown = "true" width="100"></afx-list-view>
</afx-vbox>
</afx-hbox> </afx-hbox>
</afx-vbox> </afx-vbox>
</afx-hbox>
</afx-app-window> </afx-app-window>

View File

@ -31,6 +31,8 @@ class wTerm extends this.OS.GUI.BaseApplication
end = if (i + 1) * 1000 > len then len else (i + 1) * 1000 end = if (i + 1) * 1000 > len then len else (i + 1) * 1000
me.term.write pastedText.substring i * 1000, end me.term.write pastedText.substring i * 1000, end
#self.socket.send("i"+ substr.replace(/\n/g,"\r\n")) #self.socket.send("i"+ substr.replace(/\n/g,"\r\n"))
# make desktop menu if not exist
@systemsetting.desktop.menu.push { text: "Open terminal", app: "wTerm" }
@openSession() @openSession()
@on "vboxchange", (e) -> me.resizeContent e.w, e.h @on "vboxchange", (e) -> me.resizeContent e.w, e.h

View File

@ -1,5 +1,5 @@
<afx-app-window apptitle="Preview" width="600" height="400"> <afx-app-window apptitle="Preview" width="600" height="400">
<afx-vbox data-id = "mybox"> <afx-hbox data-id = "mybox">
<div data-id="myterm" ></div> <div data-id="myterm" ></div>
</afx-vbox> </afx-hbox>
</afx-app-window> </afx-app-window>