DeeMaker
Volume Number: | | 8
|
Issue Number: | | 2
|
Column Tag: | | Tools of the Trade
|
Related Info: Dialog Manager Window Manager
DeeMaker for DeeManager
A new refreshing way to create human interfaces
By Dave Kelly, MacTutor Regular Contributing Author Don Bresee, MacTutor Technical Editor
If youre tired of dealing with the Dialog Manager and wish that it would do more than it does, Dees are the answer. With Dees, you get all the functionality of the Dialog Manager and much more. DeeMaker for DeeManager version 1.0.4 enhances the standard Macintosh user interface without sacrificing the standard. [As of print time, n Dimensions is now shipping DeeMaker Version 1.1. - Ed.]
DeeMaker is a unique dialog creation tool designed to quickly develop robust, professional fixed layout windows. The three fixed layout constructs of the human interface are: modal, modeless and floating windows (windoids). DeeMaker has taken a big step forward in providing you with a MacDraw-like interface and the power of the best draw applications. Each data type has been crafted carefully so that runtime calls are minimized as you specify your intention with this high level tool. Whats really neat is that youve got a transparent way to substantially modify your human interface, without affecting your code and its recompilation.
DeeManager is designed from scratch to work with an object-driven model. Each item is an instance of an object. As objects, all items share several important attributes. One of these attributes is the item method interface.
Each Dee item is completely customizable because DeeManager has a full-range messaging system. With DeeMaker you specify the messages that your method wants to receive and install (or engage) the method by calling the DeeManager function EngageMethod(ProcPtr theMethod; id: Integer). All methods are of the form: MyMethod(Var DeeMessages: msg). This allows creation of just about any human interface effect you could want.
The on_Action message is especially important because it allows you to create modeless windows whose entire action code resides in a separate method. You would never need to fix your main event loop. This and other design factors of DeeManager will let you create very clean and maintainable programs.
Each item has an optional member list. The simplest member list is a string list, such as a STR# resource. Suppose you had a check box that could have one of three titles. You would just assign three members and change the items current member to change the title. The member list is part of the item object itself and thus all the data that could ever appear on the screen will reside in one place. You may have buttons, static text items, or windows with several titles.
Member list elements are objects too, by default they contain a string, but could have other data. This is how DeeManager implements the Alert mechanism for you. You assign an alert meaning to each string of a member list associated with a static text item. The meaning being, Note, Stop or Caution Alert. Then, with a single call to DeeManager: DeeAlert(deeId: Integer; member: Integer), an alert is displayed with the appropriate alert icon. Changing later the type of an alert is done with DeeMaker and is transparent to the program.
Parameter substitution capabilities are far and above the Dialog Manager also. DeeManager allows 26 parameters instead of 4. Button, CheckBox, Radio, and Window titles, as well as static text items are analyzed by DeeManager for parameter substitution. The key sequence being =a thru =z (instead of ^0 thru ^3). Any of the built-in 26 params can be loaded at runtime with one of several DeeManager parameter loader functions.
Figure 1: Method Interface Editor
Another feature of each item object is its ShineThrough property. This is perhaps the most profound feature of this development tool. You have seen conventional Draw/CAD applications that give multiple views. The interface paradigm there is the creation of layers without addressing the physical aspect of space. DeeMakers paradigm is the use of a view space. You dont have to create layers - as each Dee is automatically postulated to have a view space (currently 32 views). This presupposed space allows for the ShineThrough phenomena to occur and for the easiest most intuitive way we have ever seen of addressing the problem of superimposition of human interface elements. With DeeMaker you simply assign a ShineThrough vector to an item, to allow the item to be active through every view it shines through.
Figure 2: Member Editor
Whats really great about DeeMaker is that it was actually created with itself, and it uses ShineThrough to implement its elegant type editors. For example, the Text editor has another view for setting edit type attributes. When the EditTypes button is pressed, some 40 elements swiftly change position. In conventional tools you would have to write 40 calls in your program to physically move the items. Here, you just call DeeManager SetView(2) and what you saw in the DeeMaker editing environment is what you get at runtime: all items which either belong to view 2 or shine through to view 2 from view 1 are presented, all others are hidden. No item is physically moved anywhere; rather, you, the observer, moves to another view or dimension. There is a tremendous time saving here. Using DeeMaker, a non-programmer could easily stupefy an experienced developer who could spend hours to implement, in hard coded sweat, the movement of items.
Here is a small example of view usage. This is the modeless handler method of DeeMakers ShortCuts taken from its manual. Such a handler would process any number of shortcut views (up to 32) without any change to code.
{1}
Procedure ShortCutsHandler(Var Msg: DeeMessage);
CONST
bNext = OK;
bPrev = 2;
VAR
whichView: Integer;
whichIsBold: Integer;
BEGIN
WITH Msg, dResult DO
CASE dMessage OF
on_Activate:
BEGIN
IF LastDeeView(whichView) THEN
whichIsBold := bPrev
ELSE
whichIsBold := bNext;
DimItem(Not dActivate, whichIsBold)
END;
On_Action:
CASE Id OF
bPrev:
BEGIN
whichView := TheDeeView;
{previous button belongs to view 2}
IF whichView = 2 THEN
SetDeeKey(Char(13), bNext);
SetView(whichView - 1);
END;
bNext:
BEGIN
whichView := TheDeeView;
SetView(whichView + 1);
IF LastDeeView(whichView) THEN
SetDeeKey(Char(13), bPrev);
END
END
END
END; {of ShortCutsHandler}
Figure 3: DeeMaker Tool Palette
DeeManager includes support for windoids. These windoids are defined with DeeMaker to have a windoid frame and otherwise are Dees with all the benefits of being a Dee. n Dimensions has solved a very sticky problem here for the entire developer community: how to implement easily any number of floating windows that might be either modeless (such as DeeMakers tool palette) or appear in modal contexts (being removed when the modal window is removed from the screen). A brilliant idea was implemented here to allow your code to be orderly and modular. A windoid may be linked with the DeeManager function Link_Windoid(theWindoid, theDee: DeePtr). After this function call, the windoid is linked to a Dee owner, and actions in the windoids are reported to the controlling code of the owner. Not only that, any windoid can be torn off any menu by calling Link_Menu(theWindoid: DeePtr; theMenu: MenuHandle). DeeManager tears off the windoid palette for you and when MenuSelect returns -1, you call Tear_Windoid() to physically move the windoid to a new place.
All the sticky problems of having another floating window layer on top of regular windows are seamlessly handled by DeeManager. You only need to substitute in your event loop at the critical places, old window manager calls with matching DeeManager calls. Thus HideWindow, SelectWindow, DragWindow are replaced with Hide_Window, Select_Window and Drag_Window. Once you write a DeeManager compatible event loop (Examples are provided) - any number of windoids and modeless windows can be added to your interface as your project develops. Consider that you can change a modeless window to be floating without affecting your program. This change that would otherwise result in hundreds of source line changes, is entirely transparent using the DeeMaker development tool.
At the heart of DeeMaker is a powerful toolkit called DeeManager (25K). This is the runtime package which supports your Dee dialogs. You almost cant tell that DeeManager wasnt originally a part of the Macintosh Toolbox, because DeeManager has A-Trap interface. This is the first commercial product to come with such an interface. All DeeManager functions are inline substituted for A-Trap code. (To do that only a single patch is performed. The original Dialog/Window managers are untouched and are fully operable.)
You will gain access to DeeManager through a small object file, DeeLib.o (1K), which is linked to your modules. DeeLib.o contains the glue functions, OpenDeeMgr and CloseDeeMgr, to establish communication between DeeManager which resides in a DeeM resource and your code. DeeManager was written entirely in 68000 macro assembly language. Efficiency was designed into it from the very start.
DeeManager was designed with System 7.0 in mind. Balloon help is provided by adding a help member to your item object. The developers of DeeMaker for DeeManager have kept up with the latest and greatest System developments. Many of the concepts you see in DeeMaker were taken from observing how the HyperCard interface works. In the manual, n Dimensions formally acknowledges HyperCard as a great source of inspiration.
However inspirational, regretfully, DeeManager 1.0.4 doesnt yet work with HyperCard 2.0. (Previous versions such as HyperCard 1.x.x use DeeManager correctly.) This is not because anything is wrong with DeeManager, but rather the architects of HyperCard have limited the freedom of external windows. Hopefully, someday Claris will rectify this.
DeeMaker moves far beyond the limits of the Dialog Manager that we are familiar with (including all the prototypers which generate code for it). You still have the traditional tools, but now you use them in a new way. DeeMaker allows you to choose flow of control, dimming, hiding, edit types, styles, window frames, grouping, command keys, initializers, ornamentation, automated edit sorting, fixed item identities, Extended List Format, accurate alignments and other capabilities. In addition, you can easily assign key equivalents to any radio button, check box or button.
DeeMakers Group command permits all the necessary grouping you will need. You simply select the items and choose the Group command. Thus, Radios, Buttons, Edit Texts, CheckBoxes, PopUp and EditText items, can be grouped. Each group has its own distinct meaning implemented by DeeManager and your methods.
The following Dee is presented by DeeMaker when you select the GetInfo command for a Dee resource. The Attributes are implemented by grouping the CheckBoxes and assigning to each (with DeeMaker CheckBox editor) its InsideMac (Resource Manager chapter) bit value. The program need only have 2 lines of code to create the proper program interchange. theAttrs := GetCGroup(cResAttr); or SetCGroup(theAttrs , cResAttr). The synopsis was created with parameter substitution and member lists.
Figure 4: Dee Info
And if you wonder what is Extended List Format (ELF). It is DeeMakers concept of having its List items extend the familiar List Manager to create many types of Lists without having to write LDEFs. Lists are also part of a Dees TabTrail (System 7.0 feature) and receive keyboard events just like Editable text items. ELF format has allowed DeeManager to be able to integrate the Menu Manager and List Manager, supplying Menu2List and List2Menu which preserve all information. This is another way DeeManager has become like a master manager on top of the old toolbox, uniting distant formats into harmony.
DeeMaker has many features and we could not possibly cover all of them here. Each data type gives you more power than you would ever expect to get. All of these add tremendous savings in time and effort and return your investment in the product very quickly.
There is one problem that you will encounter if you use QuicKeys (and I hate not having my QuicKeys). DeeManager does not use the Control Manager for buttons (push buttons, check boxes and radio buttons). This means the Buttons feature in QuicKeys will not work with any Dee. You can sometimes overcome this by using the Click feature but not in most cases. All other features of QuicKeys seem to work fine with Dees. I did discover that floating windows cause a general confusion problem with QuicKeys, this is not due to Dees but instead will happen with any application that uses floating windows. This is due to the fact that the active window, whether it is a dialog (modal or modeless) or a document window, will not be the first window in the window list if floating windows are present. QuicKeys usually locates the desired window by counting windows starting with the frontmost. However, QuicKeys can also locate the desired window by title. This is only useful if the title never changes.
The package comes in an expensive customized three ring notebook. Pascal, C and Motorola 68000, are the preferred environments. But you could easily adapt DeeManager to work in any environment that uses A-Trap interface, such as Common Lisp or Fortran. The manual has three major sections: (1) Touring Dee Dialogs which covers all Dee human interface concepts as an introduction to Dee dialogs; (2) DeeMaker tutorial which describes the attributes of Dees and their capabilities, and (3) Inside DeeManager - a description of all DeeManager resources, data types and functions. A summary of all DeeManager functions and procedures is given for 68000, Pascal, and C. Unfortunatly, no index is provided and as with many programming tool manuals, some sections or statements dont make a great deal of sense until you have actually played with the code. A few additional examples in other languages (e.g. Pascal) would be extremely helpful and at least one should be in an old fashioned procedural environment (for us dummies who are still a bit inexperienced with objects).
A few examples are provided in the manual but the DeeMaker bundle comes with a complete C++ example, DeeApp, and all the source code that is necessary to immediately start deriving professional programs. This collection of classes demonstrates very clearly the usage of DeeManager. It also includes a very useful MPW tool MenuRez for allowing DeeApp applications to have menu command numbers independent of menu id and item position.
A final note about the screen shots in this article. DeeManager has a very convenient function SnapDee(theDee: DeePtr): PictHandle. DeeMaker implements its snapshot commands by calling this DeeManager function which takes any Dee and translates it to QuickDraw PICT format. Instead of taking screen snapshots which are bitmaps, DeeMakers RedSnapper (Cmd-Shift-7), provides the same effect only with PICT opcodes which take 1/10 of the space of the picture as bits, allowing you to print to a PostScript printer any Dee window (SnapDee snaps window frames too) with laser quality. This is how we generated the above snapshots for this article.
Bottom Line
DeeManager is a very powerful development tool with a well thought out design. The tool is set up in a logical manner allowing for easy customization of the basic behavior of Dees. DeeMaker is an effective design tool that allows even the novice programmer to quickly and easily design a full-featured, working interface in almost no time. It is complete and it is fast. The products only drawbacks are that buttons wont work with utilities such as QuicKeys because controls are not always implemented using the Control Manager. In fairness, n Dimensions is aware of this and will be working on the problem. Overall, two thumbs up!
DeeMaker for DeeManager includes a license to make 100 copies of DeeManager. A flat fee is available for unlimited copies per end user. DeeMaker is licensed for use on one computer just as most commercial software is. Site licenses may be purchased for additional copies.
n Dimensions has a permanent folder on AppleLink at location: Software Sampler:3rd Party Demos/Updates:Software Updates:n Dimensions. You may download from that location an unabridged copy of DeeMaker.