mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-18 14:59:49 +02:00
core for app development
This commit is contained in:
@ -1,10 +1,53 @@
|
||||
class NotePad extends this.OS.GUI.BaseApplication
|
||||
constructor: () ->
|
||||
super "NotePad"
|
||||
event: () ->
|
||||
console.log @scheme
|
||||
@on "btclick", (e)->
|
||||
alert "Happy pola"
|
||||
@on "resize", (w,h)->
|
||||
console.log "resize"
|
||||
main: () ->
|
||||
me = @
|
||||
@scheme.set "apptitle", "NotePad"
|
||||
|
||||
div = @find "datarea"
|
||||
ace.require "ace/ext/language_tools"
|
||||
@.editor = ace.edit div
|
||||
@.editor.setTheme "ace/theme/monokai"
|
||||
@.editor.getSession().setMode 'ace/mode/text'
|
||||
@.editor.setOptions {
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true,
|
||||
enableLiveAutocompletion: true,
|
||||
fontSize: "10pt"
|
||||
}
|
||||
@.editor.completers.push {getCompletions:(editor, session, pos, prefix, callback)->}
|
||||
@.editor.getSession().setUseWrapMode true
|
||||
|
||||
list = @find "modelist"
|
||||
@modes = ace.require "ace/ext/modelist"
|
||||
ldata = []
|
||||
ldata.push {text:m.name, mode:m.mode} for m in @modes.modes
|
||||
list.set "items",ldata
|
||||
list.set "onlistselect", (e)->
|
||||
me.editor.session.setMode e.data.mode
|
||||
|
||||
stat = @find "editorstat"
|
||||
#status
|
||||
stup = (e)->
|
||||
c = me.editor.session.selection.getCursor()
|
||||
l = me.editor.session.getLength()
|
||||
$(stat).html "Row #{c.row}, col #{c.column}, lines: #{l}"
|
||||
stup(0)
|
||||
@.editor.getSession().selection.on "changeCursor", (e)->
|
||||
stup(e)
|
||||
|
||||
@on "resize", ()-> me.editor.resize()
|
||||
@on "focus", ()->me.editor.focus()
|
||||
|
||||
menu: ()->
|
||||
menu = [{
|
||||
text:"File",
|
||||
child:[
|
||||
{text:"Open", dataid:"#{@name}-Open"},
|
||||
{text:"Close", dataid:"#{@name}-Close"}
|
||||
]
|
||||
}]
|
||||
menu
|
||||
NotePad.singleton = false
|
||||
this.OS.register "NotePad",NotePad
|
Reference in New Issue
Block a user