MatchToolTutorial.tioga
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Bier, November 14, 1987 11:13:28 pm PST
Pier, August 19, 1988 6:23:42 pm PDT
The Match Tool Tutorial
Eric Bier
1. Introduction
1.1 Getting Started
Start up Gargoyle (see GargoyleDoc.tioga for details). Then, in a CommandTool, type
PushV Commands; Bringover -pm MatchTool.df; Pop
MatchTool
If MatchTool complains that you must "Invoke a gargoyle viewer first." type "Gargoyle"
to the CommandTool once more, followed by "MatchTool". The newly created Gargoyle viewer will share its control panel with the MatchTool. None of the others will.
1.2 Introductory Hints
For the most part, using the MatchTool is like using the EditTool. However, graphical matching does differ from textual matching in a number of respects, and these tend to cause trouble.
When a graphical match occurs, the MatchTool notices the position, orientation, and size differences between the search pattern and the matched scene object. These same differences are then applied to the replacement pattern if a replacement is performed. Hence, where the replacement ends up in the picture depends both on the position of the search pattern in the Search window and on the position of the replacement pattern in the Replace window. If BiScrollers have been used to look at one part of the Search window and a different part of the Replace window, unexpected pictures often result. To keep this from happening, create both your search pattern and your replacement pattern in the same window, so you know how the two patterns relate to each other, and then Fetch them into the MatchTool panes. This and other techniques will be illustrated in the Exercises.
Both of the panes of the MatchTool are Gargoyle action areas. All Gargoyle mouse and keyboard commands work in them as usual. However, the MatchTool panes have no control panel of their own. They share the control panel of the Gargoyle viewer with which the MatchTool is associated. This sharing is not complete. The menu commands do not apply to the MatchTool panes. Only the alignment object menus and gravity modes apply. The history/undo tools are not shared. Someday this sharing will be improved.
When the MatchTool is searching in a Gargoyle viewer, it expects that Gargoyle viewer to have the input focus. If this is not the case, strange things may happen.
2. Exercises
2.1 Triangle Subdivision
Place the caret in the Gargoyle viewer that is associated with the MatchTool (see section 1.1). Click "Triangle" in the Shapes Menu. In the MatchTool, click the leftmost Fetch button (right above the word CHARACTERISTICS). You may need to put the input focus back in the Gargoyle viewer (ShiftLeftMouse will do this). Probably nothing visual will happen. You have fetched the triangle into the Search pane of the MatchTool, but it is off the screen. Click the CenterSel button to the right of Fetch in the MatchTool. You should now see the triangle. You have specified the search pattern.
In Gargoyle build the following picture so that its three extreme vertices coincide to the vertices of the original triangle (each of these new triangles has half the edge-length of the original):
[Artwork node; type 'Artwork on' to command tool]
Select these three triangles (and nothing else) and click the rightmost Fetch button on the MatchTool. Then hit the rightmost CenterSel button in the MatchTool. The three triangles should appear in the Replace pane of the MatchTool.
In the set of options near the right edge of the MatchTool, turn on "ScaleInv". This allows the MatchTool to search for triangles regardless of size. You have specified the replacement pattern.
Back in Gargoyle, delete everything but a single triangle. Scale it up (Gargoyle scale, not BiScrollers Scale) to almost fill the viewer. You have specified the starting illustration. It is time to try searching and replacing.
In Gargoyle, deselect everything (LeftMouse in empty space) and place the caret above the triangle (ShiftLeftMouse). In the MatchTool, click Find. The triangle will become selected and the caret will move down to be at the same height as the top of the triangle. In the MatchTool, click Yes. Your triangle should be replaced by three triangles.
Again, place your caret above all of the triangles in Gargoyle and click Find in the MatchTool. In the MatchTool, click Yes three times. Each of the three triangles should be replaced by three more triangles.
Again, place your caret above all of the triangles. This time, click ChangeAll in the MatchTool. You should now have a picture that looks like this:
[Artwork node; type 'Artwork on' to command tool]
Experiment further. Place the caret at an intermediate height and do a few Finds. Notice that the MatchTool finds the first triangle at that height or below. Try clicking the Find button with the Right mouse button a few times. Now the search goes up from the caret position. If you Middle-click ChangeAll the caret is automatically moved above all shapes before substitution begins, so all shapes participate in the search. Otherwise, only the shapes below the caret participate in the search.
If you make a mistake, you will want to clear the Search and Replace areas of the MatchTool and try again. You can do this by placing the input focus in these areas (LeftMouse will do) and using CTRL-D followed by DEL.