// Copyright (c) IPython Development Team. // Distributed under the terms of the Modified BSD License. define([ 'base/js/namespace', 'components/jquery/jquery.min', 'notebook/js/toolbar', 'notebook/js/celltoolbar', ], function(IPython, $, Toolbar, CellToolbar) { "use strict"; var MainToolBar = function (selector, layout_manager, notebook, events) { ToolBar.apply(this, arguments); this.events = events; this.notebook = notebook; this.construct(); this.add_celltype_list(); this.add_celltoolbar_list(); this.bind_events(); }; MainToolBar.prototype = new ToolBar(); MainToolBar.prototype.construct = function () { this.add_buttons_group([ { id : 'save_b', label : 'Save and Checkpoint', icon : 'icon-save', callback : function () { this.notebook.save_checkpoint(); } } ]); this.add_buttons_group([ { id : 'insert_below_b', label : 'Insert Cell Below', icon : 'icon-plus-sign', callback : function () { this.notebook.insert_cell_below('code'); this.notebook.select_next(); this.notebook.focus_cell(); } } ],'insert_above_below'); this.add_buttons_group([ { id : 'cut_b', label : 'Cut Cell', icon : 'icon-cut', callback : function () { this.notebook.cut_cell(); } }, { id : 'copy_b', label : 'Copy Cell', icon : 'icon-copy', callback : function () { this.notebook.copy_cell(); } }, { id : 'paste_b', label : 'Paste Cell Below', icon : 'icon-paste', callback : function () { this.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 () { this.notebook.move_cell_up(); } }, { id : 'move_down_b', label : 'Move Cell Down', icon : 'icon-arrow-down', callback : function () { this.notebook.move_cell_down(); } } ],'move_up_down'); this.add_buttons_group([ { id : 'run_b', label : 'Run Cell', icon : 'icon-play', callback : function () { // emulate default shift-enter behavior this.notebook.execute_cell_and_select_below(); } }, { id : 'interrupt_b', label : 'Interrupt', icon : 'icon-stop', callback : function () { this.notebook.session.interrupt_kernel(); } }, { id : 'repeat_b', label : 'Restart Kernel', icon : 'icon-repeat', callback : function () { this.notebook.restart_kernel(); } } ],'run_int'); }; MainToolBar.prototype.add_celltype_list = function () { this.element .append($('') // .addClass('ui-widget-content') .attr('id', 'ctb_select') .addClass('form-control select-xs') .append($('