//---------------------------------------------------------------------------- // Copyright (C) 2011 The IPython Development Team // // Distributed under the terms of the BSD License. The full license is in // the file COPYING, distributed as part of this software. //---------------------------------------------------------------------------- //============================================================================ // ToolBar //============================================================================ var IPython = (function (IPython) { var MainToolBar = function (selector) { IPython.ToolBar.apply(this, arguments); this.construct(); this.add_celltype_list(); this.add_celltoolbar_list(); this.bind_events(); }; MainToolBar.prototype = new IPython.ToolBar(); MainToolBar.prototype.construct = function () { this.add_buttons_group([ { id : 'save_b', label : 'Save and Checkpoint', icon : 'icon-hdd', callback : function () { IPython.notebook.save_checkpoint(); } } ]); this.add_buttons_group([ { id : 'cut_b', label : 'Cut Cell', icon : 'icon-cut', callback : function () { IPython.notebook.cut_cell(); } }, { id : 'copy_b', label : 'Copy Cell', icon : 'icon-copy', callback : function () { IPython.notebook.copy_cell(); } }, { id : 'paste_b', label : 'Paste Cell Below', icon : 'icon-paste', callback : function () { IPython.notebook.paste_cell_below(); } } ],'cut_copy_paste'); this.add_buttons_group([ { id : 'move_up_b', label : 'Move Cell Up', icon : 'icon-arrow-up', callback : function () { IPython.notebook.move_cell_up(); } }, { id : 'move_down_b', label : 'Move Cell Down', icon : 'icon-arrow-down', callback : function () { IPython.notebook.move_cell_down(); } } ],'move_up_down'); this.add_buttons_group([ { id : 'insert_above_b', label : 'Insert Cell Above', icon : 'icon-circle-arrow-up', callback : function () { IPython.notebook.insert_cell_above('code'); } }, { id : 'insert_below_b', label : 'Insert Cell Below', icon : 'icon-circle-arrow-down', callback : function () { IPython.notebook.insert_cell_below('code'); } } ],'insert_above_below'); this.add_buttons_group([ { id : 'run_b', label : 'Run Cell', icon : 'icon-play', callback : function () { IPython.notebook.execute_selected_cell(); } }, { id : 'interrupt_b', label : 'Interrupt', icon : 'icon-stop', callback : function () { IPython.notebook.kernel.interrupt(); } } ],'run_int'); }; MainToolBar.prototype.add_celltype_list = function () { this.element .append($('') // .addClass('ui-widget-content') .attr('id', 'ctb_select') .append($('