@@ -18,6 +18,8 @@ import { MainMenu, JupyterLabMenu } from '@jupyterlab/mainmenu';
1818
1919import { IChangedArgs , PathExt } from '@jupyterlab/coreutils' ;
2020
21+ import { undoIcon , redoIcon } from '@jupyterlab/ui-components' ;
22+
2123import { CommandRegistry } from '@lumino/commands' ;
2224
2325import { Signal } from '@lumino/signaling' ;
@@ -26,6 +28,19 @@ import { DrawIOWidget } from './widget';
2628
2729import { DrawIOToolbarButton } from './toolbar' ;
2830
31+ import {
32+ formatPanelIcon ,
33+ plusIcon ,
34+ zoominIcon ,
35+ zoomoutIcon ,
36+ deleteIcon ,
37+ toFrontIcon ,
38+ toBackIcon ,
39+ fillColorIcon ,
40+ strokeColorIcon ,
41+ shadowIcon
42+ } from './icons' ;
43+
2944const DIRTY_CLASS = 'jp-mod-dirty' ;
3045
3146export class DrawIODocumentWidget extends DocumentWidget < DrawIOWidget > {
@@ -41,12 +56,13 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
4156 this . _menubar = new MainMenu ( this . _commands ) ;
4257
4358 this . _menubar . clearMenus ( ) ;
59+ this . toolbar . addClass ( 'dio-toolbar' ) ;
4460
4561 //TODO:
4662 // Add toolbar actions to change the default style of arrows and conections.
4763 this . _menuView = new JupyterLabMenu ( { commands : this . _commands } ) ;
4864 this . _menuView . menu . title . caption = 'View (Space+Drag to Scroll)' ;
49- this . _menuView . menu . title . iconClass = 'geSprite geSprite-formatpanel' ;
65+ this . _menuView . menu . title . icon = formatPanelIcon ;
5066 this . _menubar . addMenu ( this . _menuView . menu , { rank : 1 } ) ;
5167
5268 this . _menuZoom = new JupyterLabMenu ( { commands : this . _commands } ) ;
@@ -57,7 +73,7 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
5773
5874 this . _menuInsert = new JupyterLabMenu ( { commands : this . _commands } ) ;
5975 this . _menuInsert . menu . title . caption = 'Insert' ;
60- this . _menuInsert . menu . title . iconClass = 'geSprite geSprite-plus' ;
76+ this . _menuInsert . menu . title . icon = plusIcon ;
6177 this . _menubar . addMenu ( this . _menuInsert . menu , { rank : 2 } ) ;
6278
6379 this . context . ready . then ( async value => {
@@ -201,41 +217,56 @@ export class DrawIODocumentWidget extends DocumentWidget<DrawIOWidget> {
201217
202218 this . toolbar . addItem ( 'ViewDropdown' , this . _menubar ) ;
203219
204- actions [ 'zoomIn' ] . iconCls = 'geSprite geSprite-zoomin' ;
220+ actions [ 'zoomIn' ] . icon = zoominIcon ;
221+ actions [ 'zoomIn' ] . tooltip = 'Zoom In (Ctrl+(Numpad)/Alt+Mousewheel)' ;
205222 this . toolbar . addItem ( 'zoomIn' , new DrawIOToolbarButton ( actions [ 'zoomIn' ] ) ) ;
206- actions [ 'zoomOut' ] . iconCls = 'geSprite geSprite-zoomout' ;
223+
224+ actions [ 'zoomOut' ] . icon = zoomoutIcon ;
225+ actions [ 'zoomOut' ] . tooltip = 'Zoom Out (Ctrl-(Numpad)/Alt+Mousewheel)' ;
207226 this . toolbar . addItem (
208227 'zoomOut' ,
209228 new DrawIOToolbarButton ( actions [ 'zoomOut' ] )
210229 ) ;
211230
212- actions [ 'undo' ] . iconCls = 'geSprite geSprite-undo' ;
231+ actions [ 'undo' ] . icon = undoIcon ;
232+ actions [ 'fillColor' ] . tooltip = 'Undo (Ctrl+Z)' ;
213233 this . toolbar . addItem ( 'undo' , new DrawIOToolbarButton ( actions [ 'undo' ] ) ) ;
214- actions [ 'redo' ] . iconCls = 'geSprite geSprite-redo' ;
234+
235+ actions [ 'redo' ] . icon = redoIcon ;
236+ actions [ 'redo' ] . tooltip = 'Redo (Ctrl+Shift+Z)' ;
215237 this . toolbar . addItem ( 'redo' , new DrawIOToolbarButton ( actions [ 'redo' ] ) ) ;
216238
217- actions [ 'delete' ] . iconCls = 'geSprite geSprite-delete' ;
239+ actions [ 'delete' ] . icon = deleteIcon ;
240+ actions [ 'delete' ] . tooltip = 'Delete' ;
218241 this . toolbar . addItem ( 'delete' , new DrawIOToolbarButton ( actions [ 'delete' ] ) ) ;
219242
220- actions [ 'toFront' ] . iconCls = 'geSprite geSprite-tofront' ;
243+ actions [ 'toFront' ] . icon = toFrontIcon ;
244+ actions [ 'toFront' ] . tooltip = 'To Front (Ctrl+Shift+F)' ;
221245 this . toolbar . addItem (
222246 'toFront' ,
223247 new DrawIOToolbarButton ( actions [ 'toFront' ] )
224248 ) ;
225- actions [ 'toBack' ] . iconCls = 'geSprite geSprite-toback' ;
249+
250+ actions [ 'toBack' ] . icon = toBackIcon ;
251+ actions [ 'toBack' ] . tooltip = 'To Back (Ctrl+Shift+B)' ;
226252 this . toolbar . addItem ( 'toBack' , new DrawIOToolbarButton ( actions [ 'toBack' ] ) ) ;
227253
228- actions [ 'fillColor' ] . iconCls = 'geSprite geSprite-fillcolor' ;
254+ actions [ 'fillColor' ] . icon = fillColorIcon ;
255+ actions [ 'fillColor' ] . tooltip = 'Fill Color' ;
229256 this . toolbar . addItem (
230257 'fillColor' ,
231258 new DrawIOToolbarButton ( actions [ 'fillColor' ] )
232259 ) ;
233- actions [ 'strokeColor' ] . iconCls = 'geSprite geSprite-strokecolor' ;
260+
261+ actions [ 'strokeColor' ] . icon = strokeColorIcon ;
262+ actions [ 'strokeColor' ] . tooltip = 'Fill Stroke Color' ;
234263 this . toolbar . addItem (
235264 'strokeColor' ,
236265 new DrawIOToolbarButton ( actions [ 'strokeColor' ] )
237266 ) ;
238- actions [ 'shadow' ] . iconCls = 'geSprite geSprite-shadow' ;
267+
268+ actions [ 'shadow' ] . icon = shadowIcon ;
269+ actions [ 'shadow' ] . tooltip = 'Shadow' ;
239270 this . toolbar . addItem ( 'shadow' , new DrawIOToolbarButton ( actions [ 'shadow' ] ) ) ;
240271 }
241272
0 commit comments