core for app development

This commit is contained in:
Xuan Sang LE
2017-08-14 00:20:19 +02:00
parent f4c54c712d
commit 2985689217
43 changed files with 1414 additions and 172 deletions

View File

@ -7,27 +7,27 @@ cssfiles = main.css
copyfiles = scheme.html package.json
BLUE=\033[0;34m
BLUE=\033[1;34m
NC=\033[0m
main: title clean js css copy
title:
- echo "$(BLUE)======= Package NotePad =======$(NC)"
@echo "$(BLUE)======= Package NotePad =======$(NC)"
coffee:
- mkdir build
- for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
- for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
for f in $(coffee_files); do (coffee -cs < $$f >build/"$$f.js");done
for f in build/*.coffee.js; do (cat "$${f}"; echo) >> build/main.js; done
- rm build/*.coffee.js
js: coffee
- for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
for f in $(jsfiles); do (cat "$${f}"; echo) >> build/main.js; done
css:
- for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
for f in $(cssfiles); do (cat "$${f}"; echo) >> build/main.css; done
copy:
- cp -rf $(copyfiles) build/
cp -rf $(copyfiles) build/
clean:
- rm -rf build/*

View File

@ -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

View File

@ -1,3 +1,9 @@
fut{
background-color: black
afx-app-window[data-id="notepad"] afx-list-view[data-id="modelist"]{
margin:2px;
}
afx-app-window[data-id="notepad"] span[data-id="editorstat"]{
padding:5px;
display: inline-block;
}

View File

@ -7,6 +7,6 @@
"email": "xsang.le@gmail.com"
},
"category":"System",
"icon":"",
"iconclass":"fa fa-pencil-square-o",
"mimes":["*"]
}

View File

@ -1,16 +1,24 @@
<afx-app-window apptitle="Preview" width="600" height="400">
<afx-vbox>
<afx-app-window apptitle="" width="600" height="400" data-id="notepad">
<afx-hbox>
<afx-list-view data-width = "250"> </afx-list-view>
<!--afx-list-view data-id = "flist" data-width = "150" > </afx-list-view>
<afx-hbox>
<afx-button data-height="50" onbtclick="alert('im clicked')" text="Read more" icon="fa fa-camera-retro fa-lg" id="button">
<afx-button data-height="50" text="Read more" iconclass="fa fa-camera-retro fa-lg" id="button">
</afx-button>
<div style=" vertical-align: top; width:100%;height:100%;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
<div>
big text here
</div>
<div data-height="100" style=" vertical-align: top; width:100%;height:100%;">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div data-width="100">Test</div>
</afx-hbox>
</afx-vbox>
</afx-hbox-->
<div data-id="datarea"></div>
<afx-vbox data-height="30">
<div ><span data-id = "editorstat"></span></div>
<afx-list-view data-width="170" data-id = "modelist" dropdown = "true" width="150"></afx-list-view>
</afx-vbox>
</afx-hbox>
</afx-app-window>