PCE version 4C hlp_buffer first_fragment last_fragmenteditorsmodifiedundo_buffer_sizesyntax generationrequest_renumberfileOIxC hlp_fragment text_buffernextpreviousstylelabelOIxRIC hlp_header text_buffernextpreviousstylelabelOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOI xRIOI xRIOI xRIOI xRIOI xRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOI xRIOI!xRIOI"xRIOI#xRIOI$xRIOI%xRIOI&xRIOI'xRIOI(xRIOI)xRIOI*xRIOI+xRIOI,xRIOI-xRIOI.xRIOI/xRIOI0xRIOI1xRIOI2xRIOI3xRIOI4xRIOI5xRIOI6xRIOI7xRIOI8xRIOI9xRIOI:xRIOI;xRIOIxRIOI?xRIOI@xRIOIAxRIOIBxRIOICxRIOIDxRIOIExRIOIFxRIOIGxRIOIHxRIOIIxRIOIJxRIOIKxRIOILxRIOIMxRIOINxRIOIOxRIOIPxRIOIQxRIOIRxRIOISxRIOITxRIOIUxRIOIVxRIOIWxRIOIXxRIOIYxRIOIZxRIOI[xRIOI\xRIOI]xRIOI^xRIOI_xRIOI`xRIOIaxRIOIbxRIOIcxRIOIdxRIOIexRIOIfxRIOIgxRIOIhxRIOIixRIOIjxRIOIkxRIOIlxRIOImxRIOInxRIOIoxRIOIpxRIOIqxRIOIrxRIOIsxRIOItxRIOIuxRIOIvxRIOIwxRIOIxxRIOIyxRIOIzxRIOI{xRIOI|xRIOI}xRIOI~xRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOIxRIOI xRIOI xRIOI xRInRI NbuttonN338RI NbuttonN148RINbuttonN318 RINbuttonN368RINbuttonN358 RINbuttonN478 RINbuttonN348RINbuttonN338 RINbuttonN328 RINbuttonN318RINbuttonN308{ RINbuttonN298tRINbuttonN268bRINbuttonN288\RINbuttonN278Q RINbuttonN268=RINbuttonN258*RINbuttonN248 RINbuttonN248 RINbuttonN258 RINbuttonN247 RINbuttonN237RINbuttonN97RINbuttonN217RINbuttonN347RINbuttonN227RINbuttonN217RINbuttonN87RINbuttonN267RINbuttonN187RINbuttonN207}RINbuttonN197p RINbuttonN187c RINbuttonN177]RINbuttonN267XRINbuttonN257M RINbuttonN677RINbuttonN2470RINbuttonN157RINbuttonN67 RINbuttonN226RINbuttonN216 RINbuttonN206 RINbuttonN146RINbuttonN116RINbuttonN106RINbuttonN cut_buffer6 RINbuttonNcut6RINbuttonN166RINbuttonN136 RINbuttonN126 RINbuttonN116 RINbuttonN106~ RINbuttonN36t RINbuttonN96cRINbuttonN66\RINbuttonN96Q RINbuttonN76@RINbuttonN460RINbuttonN66)RINbuttonN56 RINbuttonN56RINbuttonN16RINbuttonN46RINbuttonN26 RINbuttonN36RINbuttonN15 RINbuttonN05 RINsectionN6.__concept_index5RINsectionN 5.__status5- RINboldn4iRINboldn4IRINboldn47 RINexamplen3RINboldn3 RINboldn3mRINsectionN 4.__alignment3Z RINexamplen31&RINboldn1_RINkeywordN111yRINkeywordN101`RINboldn0RINexamplen.+RINkeywordN24- RINkeywordN21-RINkeywordN31- RINkeywordN18-gRINkeywordN26-PRINkeywordN24- RINsectionNexportpl,1RIN subsectionN%5.2.__ms-windows:_using_the_clipboard)%RINkeywordN1(RINkeywordN9(wRIN emphasizen'RINkeywordN6'iRINkeywordN8'HRIN subsectionN$5.1.__ms-windows:_saving_as_metafile&$RINkeywordN25& RINkeywordN33& RINkeywordN3&4RINkeywordN2&"RINkeywordN26%yRINkeywordN0%: RINkeywordN15$RINkeywordN36$qRINkeywordN28$RINkeywordN17$ RINkeywordN1# RINkeywordN4#RINkeywordN24#f RINsectionN 5.__printing##RINkeywordN32# RINkeywordN19" RINboldn"RIN subsectionN 4.2.__tricks! RINkeywordN27 RINkeywordN9 RIN subsectionN4.1.__compound_objects RINboldn g RINboldn RINboldnURINboldn RINboldnRINboldnRINboldn`RINkeywordN7RINsectionNattribute_editorRINkeywordN6B RINkeywordN3 RINkeywordN14RINsectionN4.__undokRINkeywordN25VRINkeywordN4RINkeywordN26vRINkeywordN33RIN subsectionN3.2.__creating_prototypestRINbuttonN cut_bufferY RINkeywordN34@RINbuttonN select_mode RINkeywordN47 RI~NsubsubsubsectionN*3.1.3.2.__background_menu_in_drawing_plane*RI}NkeywordN25 RI|NkeywordN24{RI{NkeywordN9m RIzNkeywordN26VRIyNbuttonNattribute_editorRIxNkeywordN22RIwNbuttonNcutRIvNkeywordN16{RIuNkeywordN cut_buffer RItNkeywordNcutRIsNkeywordN21( RIrNkeywordN20( RIqNkeywordN5RIpNsubsubsubsectionN edit_menu4RIoN subsubsectionN 3.1.3.__menus RInNboldnRImNsubsubsubsectionN!3.1.2.8.__user_defined_prototypesI!RIlNboldn RIkNsubsubsubsectionN3.1.2.7.__create_link_mode_(2)RIjNboldnRIiNboldnJRIhNboldn RIgNsubsubsubsectionN3.1.2.6.__create_link_mode_(1)RIfNboldn RIeNboldnRIdNboldnqRIcNboldnWRIbNboldnL RIaNboldn RI`NsubsubsubsectionN3.1.2.5.__path_create_modeRI_NboldnRI^Nboldn RI]NsubsubsubsectionN&3.1.2.4.__box/ellipse/line_create_mode&RI\Nboldn RI[NsubsubsubsectionN3.1.2.3.__text_create_mode~RIZNboldnG RIYNboldn6 RIXNboldn RIWNkeywordN35 RIVNboldn RIUNsubsubsubsectionN select_mode RITNbuttonN!3.1.2.8.__user_defined_prototypes !RISNbuttonN3.1.2.7.__create_link_mode_(2) ZRIRNbuttonN3.1.2.6.__create_link_mode_(1) 4RIQNbuttonN3.1.2.5.__path_create_mode RIPNbuttonN&3.1.2.4.__box/ellipse/line_create_mode &RIONbuttonN3.1.2.3.__text_create_mode RINNbuttonN select_mode RIMN subsubsectionNpalet RILNkeywordN30 RIKNkeywordN13 RIJNkeywordN10 t RIINkeywordN18 d RIHNkeywordN11 ? RIGNsubsubsubsectionN3.1.1.3.__editing_text-objects RIFNkeywordN6 RIENsubsubsubsectionN 3.1.1.3.__editing_bezier_curves_ RIDNboldn rRICNboldn M RIBNboldn RIANboldn RI@NkeywordN12 RI?Nboldn RI>Nboldn RI=NsubsubsubsectionN+3.1.1.2.__editing_path_(multi-line)_objects o+RI RI)NboldnRI(Nboldn? RI'Nboldn RI&NkeywordN5 RI%NkeywordN6RI$NkeywordN14oRI#NsectionN2.__introductionRI"NbuttonN6.__concept_indexRI!NbuttonN 5.__status RI NbuttonN 4.__alignment RINbuttonNexportpl1RINbuttonN%5.2.__ms-windows:_using_the_clipboardo%RINbuttonN$5.1.__ms-windows:_saving_as_metafileG$RINbuttonN 5.__printing,RINbuttonN 4.2.__tricks RINbuttonN4.1.__compound_objectsRINbuttonNattribute_editorRINbuttonN4.__undoRINbuttonN3.2.__creating_prototypesRINbuttonN*3.1.3.2.__background_menu_in_drawing_plane*RINbuttonN edit_menuZ4RINbuttonN 3.1.3.__menusE RINbuttonN!3.1.2.8.__user_defined_prototypes!RINbuttonN3.1.2.7.__create_link_mode_(2)RINbuttonN3.1.2.6.__create_link_mode_(1)RINbuttonN3.1.2.5.__path_create_modeRINbuttonN&3.1.2.4.__box/ellipse/line_create_mode&RINbuttonN3.1.2.3.__text_create_mode`RI NbuttonN select_modeCRI NbuttonNpalet)RI NbuttonN3.1.1.3.__editing_text-objectsRI NbuttonN 3.1.1.3.__editing_bezier_curves_ RI NbuttonN+3.1.1.2.__editing_path_(multi-line)_objects+RINbuttonN 3.1.1.1.__edit_`standard_object' RINbuttonN3.1.1.__drawing_windowdRINbuttonN 3.1.__windowsQ RINbuttonN3.__user_interface;RINbuttonN2.__introduction)RINbuttonN 1.__contents RINsectionN 1.__contents nNtitleNmainRI naI'Adefault_syntax_tableI?uCfilenamepathkindstatusfilterOI xN)/staff/jan/src/xpce/appl-help/pcedraw.hlpdNbinaryNwriten8 PceDraw 1. Contents 1. Contents 2. Introduction 3. User Interface 3.1. Windows 3.1.1. Drawing Window 3.1.1.1. Edit `standard object' 3.1.1.2. Editing path (multi-line) objects 3.1.1.3. Editing Bezier curves 3.1.1.4. Editing text-objects 3.1.2. The Pallet 3.1.2.1. Select Mode 3.1.2.2. Text Create Mode 3.1.2.3. Box/Ellipse/Line Create Mode 3.1.2.4. Path Create Mode 3.1.2.5. Create Link Mode (1) 3.1.2.6. Create Link Mode (2) 3.1.2.7. User defined prototypes 3.1.3. Menus 3.1.3.1. Menu on graphical object and `edit' button 3.1.3.2. Background menu in drawing plane 3.2. Creating prototypes 4. Undo 5. Changing attributes 5.1. Compound objects 5.2. Tricks 6. Saving and Printing 6.1. MS-Windows: saving as metafile 6.2. MS-Windows: Using the clipboard 7. Using PceDraw drawings in Prolog applications 8. Alignment 9. Status 10. Concept Index 2. Introduction PceDraw is probably the most commonly used XPCE application. The tool is very suitable for drawing diagrams. Painting like an artist or drawing like an architect are not supported very well. PceDraw has been written with the following goals in mind: * Testing XPCE and validating its functionality * Demonstration of the graphical features of XPCE * Its sources are intended to form a rich source of examples for users with a little experience in writing PCE programs. Its sources are probably too complex for entire novices. * Provide a usable drawing tool. 3. User Interface 3.1. Windows PceDraw consists of a frame with three windows: * Dialog for menu-options and feedback (at the top) * Pallet of icons * The actual drawing area. Optionally, there is a fourth window for setting attributes such as pen, colour, etc. 3.1.1. Drawing Window Inside the drawing window, the following bindings of the mouse-buttons holds: 3.1.1.1. Edit `standard object' # left-mouse-button Mode dependant. See "The Pallet". If the mode is `select', the selected object(s) may be moved and resized using the left-button similar to the mode-independent middle-button described below. # middle-mouse-button Down near the edge of a graphical resizes it. Down in the middle moves it. # right-mouse-button Selects the object and popup the "edit menu". 3.1.1.2. Editing path (multi-line) objects - Dragging with the middle-button on a control-point will move the control-point. - left-click with the control-key down on a control-point will delete this point. - left-click with the control-key down between two control-points will insert a new control-point. 3.1.1.3. Editing Bezier curves - As editing path objects, but are either one or two control-points. 3.1.1.4. Editing text-objects - Control-L makes a multiple-line text left-aligned - Control-C makes a multiple-line text centred - Control-R makes a multiple-line text right-aligned 3.1.2. The Pallet The palet consists of icons that switch the tool into a certain mode. Except for the above two, the modes allow you to create graphics of some sort. The standard options are: 3.1.2.1. Select Mode 3.1.2.2. Text Create Mode 3.1.2.3. Box/Ellipse/Line Create Mode 3.1.2.4. Path Create Mode 3.1.2.5. Create Link Mode (1) 3.1.2.6. Create Link Mode (2) 3.1.2.7. User defined prototypes 3.1.2.1. Select Mode Left-click on an object sets the selection to this object shift-left-click adds or removes the object to/from the selection left-drag in the background selects all objects in the indicated area. 3.1.2.2. Text Create Mode Left-click creates a new text object and directs further input to it. Left-click on an existing, selected, text enables the caret on the text object. Typing while a text is selected will also modify the text and enable the caret. 3.1.2.3. Box/Ellipse/Line Create Mode Left-down creates such an object; subsequent dragging resizes it to the appropriate size. 3.1.2.4. Path Create Mode Left-click starts a path. Each subsequence left-click adds a point to the path. middle-, right-click or pressing the escape key (ESC) terminates the path. 3.1.2.5. Create Link Mode (1) Creates a link between two objects that is maintained. Left-down on the object at which the link starts and drag to the object to link to. The link can only attach at predefined positions indicated while the dragging. 3.1.2.6. Create Link Mode (2) Same as above, but the link is created between the exact indicated positions instead of at predefined points. 3.1.2.7. User defined prototypes When user-defined prototypes exist. They are shown below the standard options. Left-click creates an instance of the prototype. 3.1.3. Menus 3.1.3.1. Menu on graphical object and `edit' button There is a menu attached to each graphical objects. As with all XPCE menus, the menu is activated using the right mouse-button. Hold it down, drag it to the appropriate item and release it to activate the item. Releasing the button outside the menu cancels it. If the menu is activated, the object below the menu automatically becomes the selection. Options: Align Align this object only. If you want to align this object with specific object(s), first select the objects to align with. Duplicate Make a duplicate of the object, place it a little to the bottom-left and select the duplicate. Cut Copy the object to the cut-buffer (shared my multiple PceDraw instances running in the same XPCE process), and then delete the object. The cut-buffer may be pasted using the `Paste' option from the background menu. Copy Same as `Cut', but does not delete the object. Edit Attributes Start attribute editor on this object. If the attribute editor is already running, just selecting the object activates it on this object too. Hide Put object in the background. Expose Put object in the foreground. 3.1.3.2. Background menu in drawing plane Activated by the right mouse-button. Options: Select Mode Same as selecting `select mode' from the palette. Paste Paste value of the cut-buffer at this point. 3.2. Creating prototypes An important feature of PceDraw is to create and save `prototypes'. There are two types of prototypes. From single objects, `virgin prototypes' may be created. A virgin prototype acts as the original, but with possibly modified attributes. For example, to create a prototype to draw a dotted line with arrows attached, draw a line on the drawing area. Then modify the attributes to dotted and set the arrows using the attribute editor. Select the object and issue the menu-command Proto/Create/Virgin. The second type of prototype is a (part of a) drawing that is to be reused. We call this an `As Is Prototype'. A common usage for this type of prototype is to deal with a box with centred text. To create such a prototype, draw a box and put a text inside. The contents of the text is irrelevant, as it will be cleared and prepared for editing if the prototype is instantiated. Set all attributes properly, select both objects and issue the menu-command Proto/Create/As Is. 4. Undo PceDraw provides two undo interfaces. The most simple one is bound to the Emacs standard key Control-_, and undoes the last action. Subsequent typing toggles between the last two states. The menu entry Edit/Undo opens a dialog box that lets the user move forwards and backwards through the history of the drawing. 5. Changing attributes Attributes of graphicals may be modified using the "attribute editor". This is a separate window with menus for defined editable attributes. You start the attribute editor on some object by either selecting the "edit attributes" option from the popup associated with each graphical object, or by selecting an object using the left-button and then selecting "edit attributes" from the main "edit" menu. Once the attribute editor is started, it will keep editing the selection. The attribute editor will only activate an attribute if there is at least one graphical in the selection for which the attribute makes sense. If an attribute is modified, the effect is immediate and the modification applies to all graphicals in the selection. 5.1. Compound objects When editing compound objects (instantiated prototypes), the displayed attributes are from the first encountered object, while changes apply to any object in the compound (just as if multiple objects are selected). 5.2. Tricks The attribute editor may be used to set some attribute of a collection of objects to the same value: select all objects, start the attribute editor (if not already open) and modify the attribute that should be equal over the selection. For example, typing an `X' value will make all objects left-aligned, typing a `W' (width) value will make all objects same-width. 6. Saving and Printing Printing from PceDraw is done by creating PostScript for the drawing. The generated PostScript is scaled such that it fits on an A4 page. It contains a "%%BoundingBox" comment to allow direct including in LaTeX using psfig or related packages. PostScript generated by PceDraw does not contain a PostScript showpage command as it will normally be included in other documents (encapsulated PostScript). When the "Print" option is selected, PostScript is sent to the printer from the Unix environment variable $PRINTER. When absent, the printer named "postscript" (using lpr -Ppostscript) is choosen. The menu-entry "Postscript" will dump encapsulated Postscript in a file next to the file to which the drawing is related by replacing the .pd extenstion by .eps. If the drawing is not related to a file the PostScript is dumped in scratch.eps The menu-entry "Postscript As" will prompt for the name of a file in which to dump the Postscript. 6.1. MS-Windows: saving as metafile The Win32 version of XPCE can handle the Windows `MetaFile' format. The menu item File/Save As Metafile provides 4 saving options. The ...as versions prompt for a file, while the versions without `... as' generate the file as the Postscript command does, i.e. by replacing the extension of the current file. Metafiles can be saved in two formats: `picture' saves the drawing as a WIndows 3.x format ALDUS encapsulated metafile, which can be read by most Microsoft applications. 'Enhanced Metafile' format is the win32 enhanced version of this format, which is advocated in the Microsoft programmers manual, but -for example- Word 7.0 for Windows 95 cannot read this format. 6.2. MS-Windows: Using the clipboard Finally, the Windows clipboard can be used for transferring PceDraw diagrams or parts thereof to other windows applications. PceDraw can export diagrams both as enhanced metafile and as clipboard picture encapsulated Windows 3.x metafile. At least on Windows-NT, the clipboard does the conversion, so the actual choice is not very important. Metafiles can also be `pasted' into PceDraw. They act as a primitive graphical that can be scaled. The current release cannot save these objects, so the result should be printed immediately. 7. Using PceDraw drawings in Prolog applications PceDraw diagrams consist of instances of subclasses of most of the XPCE graphical primitives. The subclass structures adds the PceDraw editing capabilities. It is possible to translate a drawing into a Prolog term, which can be realised on a graphical device using the predicate realise_drawing/2 from library('draw/importpl'). A drawing is exported as a Prolog term, either by dragging the top-left icon in PceDraw onto a PceEmacs editor in Prolog mode, or by placing it on the clipboard using the popup-menu on this icon and pasting it in any text-editor. The following example realises the Dutch flag in a picture window: :- use_module(library('draw/importpl')). flag(drawing([ display(box(142, 27) + fill_pattern(@black_image) + colour(red), point(153, 133)), display(box(142, 27), point(153, 160)), display(box(142, 27) + fill_pattern(@black_image) + colour(blue), point(153, 187)), display(box(142, 82), point(153, 133)) ])). draw_flag :- new(Flag, device), flag(Drawing), realise_drawing(Flag, Drawing), send(Flag, reference), new(P, picture), send(P, display, Flag, point(20,20)), send(P, open). The argument-term of flag/1 is imported from PceDraw. The format of this term is described in library('draw/exportpl'). The methods `device ->reference' and `device ->resize' may be useful to tailure to drawing to the needs of the application. NOTE: Variables occurring in the drawing will be bound by realise_drawing/2. This should be regarded a feature, as it allows you to get access to parts of the drawing. If multiple drawings needs to be created from the same term, these bindings should be undone. The simplest way to accomplish this is using a failure-driven loop, or the construct: \+ \+ realise_drawing(Device, Drawing) 8. Alignment The settings options auto-align switches automatic alignment off/on. Its default value is on, but may be switched off the Edit/Preferences editor. When auto-align is switched on, PceDraw will attempt to reposition and/or resize graphicals when they are created, resized or moved. It tries to identify standard alignments: centering, edges and making connections between graphicals straight lines. Conflicts are resolved using simple heuristics. 9. Status Various things still have to be done: * Edit existing prototypes * Modify handles of existing prototypes * Menu for driving the printer * Alignment options 10. Concept Index $PRINTER %%BoundingBox .eps .pd A4 ALDUS Align architect artist As Is Prototype attribute editor background Bezier compound objects Control-_ Control-C Control-L control-point Control-R Copy Cut cut-buffer device ->reference device ->resize diagrams Duplicate Duplicate Edit Attributes Edit/Undo encapsulated PostScript Expose File/Save As Metafile foreground Hide LaTeX left-aligned left-aligned left-mouse-button library('draw/importpl'). lpr -Ppostscript MetaFile middle-mouse-button move Paste PceEmacs picture popup PostScript Postscript As Prolog mode Prolog term Proto/Create/As Is Proto/Create/Virgin prototypes psfig realise_drawing/2 resize right-aligned right-mouse-button same-width scratch.eps Select Select Mode selection showpage top-left icon undo virgin prototypes' rIxx