|
WikiDoc |
The AlphaTcl toolbar packageDevelopment.ToolbarPackage HistoryHide minor edits - Show changes to markup October 19, 2007, at 05:13 AM
by - spam cleanup
Deleted line 0:
ricdelr October 18, 2007, at 11:57 PM
by -
Added line 1:
ricdelr December 15, 2006, at 11:36 AM
by - Updated some info
Changed lines 33-35 from:
merged into the Info popup. to:
December 15, 2006, at 11:35 AM
by - Updated some info
Changed lines 33-36 from:
to:
merged into the Info popup. Changed lines 38-39 from:
to:
All these built-in toolbar items have symbolic names so that they can be invoked by several [toolbar] subcommands. See Built-in toolbar items. Changed line 63 from:
cabal.alphax.toolbar.button.toolbaritem1 to:
cabal.alphax.toolbar.button.toolbaritem1 December 15, 2006, at 11:27 AM
by - Updated some info June 19, 2006, at 08:09 AM
by - Notes on the Toolbar package
Changed lines 1-2 from:
to:
(:title The AlphaTcl toolbar package:) Changed lines 32-49 from:
hooks defined in alphaHooks.tcl : wrapMenuHook, fileInfoMenuHook, and modeMenuHook.
command gotoLine with a sheet dialog.
the core using a sheet dialog.
available as a toolbar contextual menu command. It is executed internally by the core.
[toolbar::doPrint] in this file.
the core; the user can add it using the Customize command. It is executed by the procedure [toolbar::doSearch] in this file. to:
Changed lines 66-68 from:
cabal.alphax.toolbar.button.toolbaritem1
to:
June 19, 2006, at 08:04 AM
by - Notes on the Toolbar package
Added lines 1-100:
Starting with version 8.1a4, AlphaX attaches a toolbar to the document windows (see the AlphaToolbar page) and provides a [toolbar] command to create custom items for this toolbar and manipulate them (more about this on the ToolbarCommand page). On the AlphaTcl side, there is a a new early and always-on feature called toolbar which takes care of managing additional custom toolbar items provided by the library. The purpose of this page is to provide more insight about the technique of creating custom toolbar items and considerations about the implications. The toolbar feature is defined in
Notes about the AlphaX toolbarA few notes about the AlphaX implementation of the toolbar will help explain why this procedure is very important, and should be modified with care. The user's toolbar configuration is always saved between editing sessions; internally it is built with the kHIToolbarAutoSavesConfig flag turned on. This includes the size (small, normal, default), the mode (iconlabel, icon, label, and default), and any items added to the toolbar via the Customize command. The AlphaX core defines a few default items as well as a Default Set, and hard-wires the names of any AlphaTcl callback procedures required to execute them. These include:
hooks defined in alphaHooks.tcl : wrapMenuHook, fileInfoMenuHook, and modeMenuHook.
command gotoLine with a sheet dialog.
the core using a sheet dialog.
available as a toolbar contextual menu command. It is executed internally by the core.
[toolbar::doPrint] in this file.
the core; the user can add it using the Customize command. It is executed by the procedure [toolbar::doSearch] in this file. When the user changes the toolbar configuration, the new settings are
saved in the file The initializePackage procedureThe procedure [toolbar::initializePackage] defines additional default items that will appear in the Customize sheet, allowing the user to add them if desired, and these customized configuration settings are also saved in the user's .plist file. If you create a custom item with [toolbar create] it receives a token toolbaritem1. If the user inserts it in the toolbar, the preferences are saved to disk when AlphaX quits. (If you open the net.cabal.alphax.plist file with Property List Editor, for instance, you will see the list of the identifiers corresponding to the items present in your toolbar (in the left to right order). The custom item will have the following identifier:
cabal.alphax.toolbar.button.toolbaritem1
Now when you relaunch AlphaX there is no problem until you display a window: at this point the toolbar must be attached to the window and the toolbar object reads the preferences file in order to reconstruct the items in the right order. A kEventToolbarCreateItemWithIdentifier CarbonEvent is sent for each item; when it sees
cabal.alphax.toolbar.button.toolbaritem1
the core recognizes that it is one of our objects so it checks to see if it already knows the toolbaritem1 token. The answer will be no if the [toolbar create] command has not yet been invoked), so it skips the creation of the item. Here is the tricky scenario: if, before any window is displayed, AlphaTcl has created some custom items there would certainly be an item with token toolbaritem1 so, in the previous steps, this item would be instanciated. But we have no way to know if this toolbaritem1 corresponds to the same object as the toolbaritem1 which had been saved in the .plist file. And that is why we have this package: so long as it is defined as an early and always-on AlphaTcl feature in runAlphaTcl.tcl then we know that the procedure [toolbar::initializePackage] will be evaluated before any other code has an opportunity to make any [toolbar create ...] calls. This will ensure that toolbaritem1 will always correspond to the very first item defined here, and toolbaritem2 will always correspond to the second item, etc. ImplicationsThus there are three implications of this scheme that AlphaTcl developers should keep in mind:
|
|
Edit -
History -
Print -
Recent Changes -
Search
Page last modified on October 19, 2007, at 05:13 AM
|
Hosted on
|