home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
- // @Modified build 232 cm19981109 - exposed findwhat and replacewith edit boxes
-
- var gOutput = getOutput();
-
- function OnNotify()
- {
- var output = getOutput();
- var logEvents = getGlobal("LogEvents", false);
- if (logEvents)
- {
- output.writeLine("Running Objects/FinderToolbar");
- }
-
- CreateFinderToolbar();
- }
-
- var gFindParameters = getGlobal("FindParameters", null);
-
- function onUpdateFindWhat(text)
- {
- if (text)
- {
- gFindComboBox.text = text;
- }
- }
-
- function onUpdateReplaceWith(text)
- {
- if (text)
- {
- gReplaceComboBox.text = text;
- }
- }
-
- function onFindTextChange(text)
- {
- if (text)
- {
- // Break infinte update loop
- gFindParameters.updateFindWhat(text);
- }
- }
-
- function onFindTextReturnKeyPressed()
- {
- var editor = getActiveEditor();
- if (editor)
- {
- editor.findNext();
- }
- }
-
-
- function onReplaceTextChange(text)
- {
- // Break infinte update loop
- gFindParameters.updateReplaceWith(text);
- }
-
- function onFindDropDown()
- {
- return gFindParameters.findHistoryList;
- }
-
- function onReplaceDropDown()
- {
- return gFindParameters.replaceHistoryList;
- }
-
- var gFindComboBox = newToolBarButton("combobox");
- var gReplaceComboBox = newToolBarButton("combobox");
-
- function CreateFinderToolbar()
- {
- setGlobal("FinderFindWhat",gFindComboBox); // cm19981109
- setGlobal("FinderReplaceWith",gReplaceComboBox);// cm19981109
-
- var toolBar = newToolBar("Finder", "finder");
- if (toolBar)
- {
- var findLabel = newToolBarButton("label");
- findLabel.width = 30;
- findLabel.text = "Find:";
- toolBar.setButton(0, findLabel);
-
- gFindComboBox.dropDownHeight = 150;
- gFindComboBox.width = 200;
- gFindComboBox.scriptHandler = "Objects\\FinderToolBar.script";
- gFindComboBox.onDropDownHandler = "onFindDropDown";
- gFindComboBox.onTextChangeHandler = "onFindTextChange";
- gFindComboBox.onReturnHandler = "onFindTextReturnKeyPressed";
- toolBar.setButton(1, gFindComboBox);
- gFindComboBox.text = gFindParameters.findWhat;
-
- var findInWindowsButton = newToolBarButton("icon");
- findInWindowsButton.scriptPath = "\\Misc\\findInOpenDocuments.script";
- findInWindowsButton.description = "Find in windows";
- findInWindowsButton.toolTipText = "Find in windows";
- toolBar.setButton(5, findInWindowsButton);
-
- var replaceLabel = newToolBarButton("label");
- replaceLabel.width = 55;
- replaceLabel.text = "Replace:";
- toolBar.setButton(7, replaceLabel);
-
- gReplaceComboBox.dropDownHeight = 150;
- gReplaceComboBox.width = 200;
- gReplaceComboBox.scriptHandler = "Objects\\FinderToolBar.script";
- gReplaceComboBox.onDropDownHandler = "onReplaceDropDown";
- gReplaceComboBox.onTextChangeHandler = "onReplaceTextChange";
- gReplaceComboBox.onReturnHandler = "onFindTextReturnKeyPressed";
- toolBar.setButton(8, gReplaceComboBox);
- gReplaceComboBox.text = gFindParameters.replaceWith;
-
- var replaceInWindowsButton = newToolBarButton("icon");
- replaceInWindowsButton.scriptPath = "\\Misc\\replaceInOpenDocuments.script";
- replaceInWindowsButton.description = "Replace in windows";
- replaceInWindowsButton.toolTipText = "Replace in windows";
- toolBar.setButton(12, replaceInWindowsButton);
-
- var findInWindowsButton = newToolBarButton("icon");
- findInWindowsButton.scriptPath = "\\Misc\\replaceInFiles.script";
- findInWindowsButton.description = "Replace in files";
- findInWindowsButton.toolTipText = "Replace in files";
- toolBar.setButton(13, findInWindowsButton);
-
- toolBar.restoreState();
- }
- }
-
- !!/Script
-
-