home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 2001 - Miguel Angel Rojas G.
- // Copyright ⌐ 2001 - Modelworks Software
- // @Modified build 498 - cm20010305
- // @Modified build 501 - cm20010316
-
- /**
- @Tool: Bookmarks~defines a toolbar with a list of buttons for navigate through bookmarks.
- @Summary: Bookmarks~defines Navigator of Bookmarks
- */
-
- var gOutput = getOutput();
- var gBookmarkMap = getMapFile( "Bookmarks" );
-
- function OnNotify()
- {
- var bookmarkCount = gBookmarkMap.count;
- var toolBar = getGlobal("BookmarkToolbar", null);
- if (toolBar)
- {
- toolBar.enableButton(getGlobal("BookmarkToolbar.GotoFirstCommandID"), bookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.GotoNextCommandID"), bookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.GotoLastCommandID"), bookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.ChooseCommandID"), bookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.DeleteCurrentCommandID"), bookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.RemoveCommandID"), bookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.DeleteAllCommandID"), bookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.GotoPrevCommandID"), bookmarkCount > 0);
-
- var editor = getActiveEditor();
- if (editor)
- {
- toolBar.enableButton(getGlobal("BookmarkToolbar.InsertNamedCommandID"), true);
- toolBar.enableButton(getGlobal("BookmarkToolbar.InsertCommandID"), true);
- var editorBookmarkCount = editor.getBookmarkCount();
- toolBar.enableButton(getGlobal("BookmarkToolbar.GoUpCommandID"), editorBookmarkCount > 0);
- toolBar.enableButton(getGlobal("BookmarkToolbar.GoDownCommandID"), editorBookmarkCount > 0);
- }
- else
- {
- toolBar.enableButton(getGlobal("BookmarkToolbar.InsertNamedCommandID"), false);
- toolBar.enableButton(getGlobal("BookmarkToolbar.InsertCommandID"), false);
- toolBar.enableButton(getGlobal("BookmarkToolbar.GoUpCommandID"), false);
- toolBar.enableButton(getGlobal("BookmarkToolbar.GoDownCommandID"), false);
- }
- }
- }
-
- function DoCommand()
- {
- var gToolsPath = File.getToolsPath();
-
- var toolBar = newToolBar( "Bookmarks" );
- setGlobal("BookmarkToolbar", toolBar);
-
- gBookmarkMap.registerNotify(getScriptPath());
- Application.registerNotify(getScriptPath(), "editor.changed");
-
- var toolBarIconIButton = newToolBarButton( "icon" );
- toolBarIconIButton.scriptPath = "\\Bookmark\\insertBookmark.script";
- toolBarIconIButton.imagePath = gToolsPath + "\\Bookmark\\images\\insert.bmp";
- toolBarIconIButton.description = "Insert Bookmark";
- toolBarIconIButton.toolTipText = "Insert Bookmark";
- var InsertCommandID = toolBar.appendButton( toolBarIconIButton );
- setGlobal("BookmarkToolbar.InsertCommandID", InsertCommandID);
-
- var toolBarIconIButton = newToolBarButton( "icon" );
- toolBarIconIButton.scriptPath = "\\Bookmark\\addBookmark.script";
- toolBarIconIButton.imagePath = gToolsPath + "\\Bookmark\\images\\insertNamed.bmp";
- toolBarIconIButton.description = "Insert Named Bookmark...";
- toolBarIconIButton.toolTipText = "Insert Named Bookmark...";
- var InsertNamedCommandID = toolBar.appendButton( toolBarIconIButton );
- setGlobal("BookmarkToolbar.InsertNamedCommandID", InsertNamedCommandID);
-
- var toolBarIconDownButton = newToolBarButton( "icon" );
- toolBarIconDownButton.scriptPath = "\\Bookmark\\goDown.script";
- toolBarIconDownButton.imagePath = gToolsPath + "\\Bookmark\\images\\goDown.bmp";
- toolBarIconDownButton.description = "Go down to next bookmark in file";
- toolBarIconDownButton.toolTipText = "Go down to next bookmark in file";
- var GoDownCommandID = toolBar.appendButton( toolBarIconDownButton );
- setGlobal("BookmarkToolbar.GoDownCommandID", GoDownCommandID);
-
- var toolBarIconUpButton = newToolBarButton( "icon" );
- toolBarIconUpButton.scriptPath = "\\Bookmark\\goUp.script";
- toolBarIconUpButton.imagePath = gToolsPath + "\\Bookmark\\images\\goUp.bmp";
- toolBarIconUpButton.description = "Go up to next bookmark in file";
- toolBarIconUpButton.toolTipText = "Go up to next bookmark in file";
- var GoUpCommandID = toolBar.appendButton( toolBarIconUpButton );
- setGlobal("BookmarkToolbar.GoUpCommandID", GoUpCommandID);
-
- var toolBarIconFButton = newToolBarButton( "icon" );
- toolBarIconFButton.scriptPath = "\\Bookmark\\gotoFirst.script";
- toolBarIconFButton.imagePath = gToolsPath + "\\Bookmark\\images\\gotoFirst.bmp";
- toolBarIconFButton.description = "Go to First Bookmark";
- toolBarIconFButton.toolTipText = "Go to First Bookmark";
- var GotoFirstCommandID = toolBar.appendButton( toolBarIconFButton );
- setGlobal("BookmarkToolbar.GotoFirstCommandID", GotoFirstCommandID);
-
- var toolBarIconPButton = newToolBarButton( "icon" );
- toolBarIconPButton.scriptPath = "\\Bookmark\\gotoPrevious.script";
- toolBarIconPButton.imagePath = gToolsPath + "\\Bookmark\\images\\gotoPrevious.bmp";
- toolBarIconPButton.description = "Go to Previous Bookmark";
- toolBarIconPButton.toolTipText = "Go to Previous Bookmark";
- var GotoPrevCommandID = toolBar.appendButton( toolBarIconPButton );
- setGlobal("BookmarkToolbar.GotoPrevCommandID", GotoPrevCommandID);
-
- var toolBarIconNButton = newToolBarButton( "icon" );
- toolBarIconNButton.scriptPath = "\\Bookmark\\gotoNext.script";
- toolBarIconNButton.imagePath = gToolsPath + "\\Bookmark\\images\\gotoNext.bmp";
- toolBarIconNButton.description = "Go to Next Bookmark";
- toolBarIconNButton.toolTipText = "Go to Next Bookmark";
- var GotoNextCommandID = toolBar.appendButton( toolBarIconNButton );
- setGlobal("BookmarkToolbar.GotoNextCommandID", GotoNextCommandID);
-
- var toolBarIconLButton = newToolBarButton( "icon" );
- toolBarIconLButton.scriptPath = "\\Bookmark\\gotoLast.script";
- toolBarIconLButton.imagePath = gToolsPath + "\\Bookmark\\images\\gotoLast.bmp";
- toolBarIconLButton.description = "Go to Last Bookmark";
- toolBarIconLButton.toolTipText = "Go to Last Bookmark";
- var GotoLastCommandID = toolBar.appendButton( toolBarIconLButton );
- setGlobal("BookmarkToolbar.GotoLastCommandID", GotoLastCommandID);
-
- var toolBarIconWButton = newToolBarButton( "icon" );
- toolBarIconWButton.scriptPath = "\\Bookmark\\chooseBookmark.script";
- toolBarIconWButton.imagePath = gToolsPath + "\\Bookmark\\images\\choose.bmp";
- toolBarIconWButton.description = "Choose and Go to Selected Bookmark";
- toolBarIconWButton.toolTipText = "Choose and Go to Selected Bookmark";
- var ChooseCommandID = toolBar.appendButton( toolBarIconWButton );
- setGlobal("BookmarkToolbar.ChooseCommandID", ChooseCommandID);
-
- var toolBarIconDButton = newToolBarButton( "icon" );
- toolBarIconDButton.scriptPath = "\\Bookmark\\deleteCurrentBookmark.script";
- toolBarIconDButton.imagePath = gToolsPath + "\\Bookmark\\images\\delete.bmp";
- toolBarIconDButton.description = "Delete Current Bookmark";
- toolBarIconDButton.toolTipText = "Delete Current Bookmark";
- var DeleteCurrentCommandID = toolBar.appendButton( toolBarIconDButton );
- setGlobal("BookmarkToolbar.DeleteCurrentCommandID", DeleteCurrentCommandID);
-
- var toolBarIconAButton = newToolBarButton( "icon" );
- toolBarIconAButton.scriptPath = "\\Bookmark\\removeBookmark.script";
- toolBarIconAButton.imagePath = gToolsPath + "\\Bookmark\\images\\remove.bmp";
- toolBarIconAButton.description = "Choose Bookmarks to Remove...";
- toolBarIconAButton.toolTipText = "Choose Bookmarks to Remove...";
- var RemoveCommandID = toolBar.appendButton( toolBarIconAButton );
- setGlobal("BookmarkToolbar.RemoveCommandID", RemoveCommandID);
-
- var toolBarIconAButton = newToolBarButton( "icon" );
- toolBarIconAButton.scriptPath = "\\Bookmark\\deleteAllBookmarks.script";
- toolBarIconAButton.imagePath = gToolsPath + "\\Bookmark\\images\\deleteAll.bmp";
- toolBarIconAButton.description = "Delete All Bookmarks";
- toolBarIconAButton.toolTipText = "Delete All Bookmarks";
- var DeleteAllCommandID = toolBar.appendButton( toolBarIconAButton );
- setGlobal("BookmarkToolbar.DeleteAllCommandID", DeleteAllCommandID);
-
- toolBar.restoreState();
-
-
- OnNotify();
- }
-
- !!/Script
-