add calendar view & stuff

This commit is contained in:
Xuan Sang LE
2017-08-17 00:42:05 +02:00
parent 1a054dbc9c
commit c4fe3ba415
15 changed files with 143 additions and 97 deletions

View File

@ -8,8 +8,6 @@ class NotePad extends this.OS.GUI.BaseApplication
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,
@ -22,22 +20,39 @@ class NotePad extends this.OS.GUI.BaseApplication
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)->
ldata.push {
text: m.name,
mode: m.mode,
selected: if m.mode is 'ace/mode/text' then true else false
} for m in @modes.modes
list.set "items", ldata
list.set "onlistselect", (e) ->
me.editor.session.setMode e.data.mode
themelist = @find "themelist"
themes = ace.require "ace/ext/themelist"
ldata = []
ldata.push {
text: m.caption,
mode: m.theme,
selected: if m.theme is "ace/theme/monokai" then true else false
} for k, m of themes.themesByName
console.log themes.themesByName
themelist.set "items", ldata
themelist.set "onlistselect", (e) ->
me.editor.setTheme e.data.mode
stat = @find "editorstat"
#status
stup = (e)->
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()
@on "resize", () -> me.editor.resize()
@on "focus", () -> me.editor.focus()
menu: ()->
menu = [{

View File

@ -1,9 +1,9 @@
afx-app-window[data-id="notepad"] afx-list-view[data-id="modelist"] {
afx-app-window[data-id="notepad"] afx-list-view {
margin: 2px;
margin-right: 5px;
}
afx-app-window[data-id="notepad"] afx-list-view[data-id="modelist"] div.list-container{
afx-app-window[data-id="notepad"] afx-list-view div.list-container{
z-index: 10;
}

View File

@ -17,6 +17,7 @@
<div data-id="datarea"></div>
<afx-vbox data-height="30" data-id="bottom-vbox">
<div ><span data-id = "editorstat"></span></div>
<afx-list-view data-width="170" data-id = "themelist" dropdown = "true" width="150"></afx-list-view>
<afx-list-view data-width="170" data-id = "modelist" dropdown = "true" width="150"></afx-list-view>
</afx-vbox>