var editor_html = '
\n' +'
\n' +''; var top_html = "
" + "
" + "
" + " " + "
" +"
"; var editor_syntax_ac = { getCompletions: function(editor, session, pos, prefix, callback) { $.getJSON("ffvm/editor_ac", function(list) { callback(null,list)}); } }; // system config var config = { layout:{ name: 'layout', panels: [ { type: 'top', size: 45, style: 'padding: 0px;', content: top_html //title: 'FireFly Smalltalk' }, { type: 'left', size: 200, style: 'padding: 0px;', resizable: true, content: 'left', toolbar: { items: [ { type: 'html', id: 'classbr_header', html: '
'+ 'Classes browser'+'
' }, { type: 'spacer' }, { type: 'menu', id: 'cls_ed', caption: '', icon: ' fa-edit', items: [ { id:'new_cls', text: 'New class', icon: 'fa-plus' }, { text: 'Edit class', icon: 'fa-pencil' }, { text: 'Delete class', icon: 'fa-trash' } ]}, { type: 'button', id: 'clsbr_ref', caption: '', icon: 'fa-refresh'} ], onClick: function (event) { // this.owner.content('main', event); switch(event.target) { case 'cls_ed:new_cls': sclbrr_config.openClassEditor(); break; case 'clsbr_ref': sclbrr_config.reload(); break; default: console.log(event); } } } }, { type: 'main', style: 'padding: 0px;', content: 'main' } ] }, right_layout:{ name: 'right_layout', panels: [ { type: 'left', size: 200, //style: 'padding: 0px;', resizable: true, content: 'left', toolbar: { items: [ { type: 'html', id: 'methodsbr_header', html: '
'+ 'Methods browser'+'
' }, { type: 'spacer' }, { type: 'button', id: 'methbr_del', caption: '', icon: 'fa-trash'}, { type: 'button', id: 'methbr_ref', caption: '', icon: 'fa-refresh'} ], onClick: function (event) { // this.owner.content('main', event); if(event.target == 'methbr_ref') methodsb_config.reload(); } } }, { type: 'main', //style: 'padding: 0px;', content: editor_html, toolbar: { items: [ { type: 'html', id: 'source_header', html: '
'+ ' Source code'+'
' } , { type: 'spacer' }, { type: 'button', id: 'ed_ac_reload', caption: '', icon: 'fa-repeat', hint: 'Reload AC keywords' }, { type: 'button', id: 'src_save', caption: 'Save', icon: 'fa-save', hint: 'Save method' } ], onClick: function (event) { // this.owner.content('main', event); switch(event.target) { case 'src_save': methodsb_config.save_method(); break; case 'ed_ac_reload': $.post( "/ffvm/run_on_ws", {code:"imgMeta imageKeywords"}); break; default: } } } } ] }, class_content_layout: { name: 'class_content_layout', panels: [ { type: 'main', style: 'padding: 0px;', content: '' }, { type: 'bottom', style: 'padding: 0px;', content: '', size:200, resizable: true, toolbar: { items: [ { type: 'html', id: 'ivbr_header', html: '
'+ 'Instance variables'+'
' }, { type: 'spacer' }, { type: 'menu', id: 'iv_ed', caption: '', icon: ' fa-edit', items: [ { text: 'New instance variable', icon: 'fa-plus' }, { text: 'Edit variable', icon: 'fa-pencil' }, { text: 'Delete variable', icon: 'fa-trash' } ]}, { type: 'button', id: 'vrsbr_ref', caption: '', icon: 'fa-refresh'} ], onClick: function (event) { // this.owner.content('main', event); if(event.target == 'vrsbr_ref') ivb_config.reload(); } } } ] }, save_image() { w2confirm('Do you want to save the current image', function (btn) { if(btn == "Yes") { $.post( "/ffvm/save_image", {name:'backup'}) .done(function( data ) { w2alert("The image is saved"); }); } }); } } // init the main layout $(function () { $().w2layout(playground_config.layout); $().w2layout(config.class_content_layout); $().w2layout(config.right_layout); $('#layout').w2layout(config.layout); w2ui.class_content_layout.content('main',w2ui.method_sidebar); w2ui.class_content_layout.content('bottom',w2ui.iv_sidebar); w2ui.right_layout.content('left',w2ui.class_content_layout); w2ui.layout.content('left', w2ui.cls_sidebar); w2ui.layout.content('main', w2ui.right_layout); $('#bt_workspace').click(function() { playground_config.open_pl_editor(); //console.log('open WS'); }); $('#bt_save_image').click(function() { config.save_image(); //console.log('open WS'); }); });