/* * See ./idraw-interface.def for the corresponding Modula-2 def module. */ #ifndef idrawinterfaceIncluded #define idrawinterfaceIncluded #include "std-macros.h" #include "parse-tree.h" #include "sym.h" #include "built-ins.h" #include "type.h" #include "cgesture.h" /* * Would like * #include * given that this .h contains the def of the Side enum. However, it also * contains C++, so we must redef Side enum directy. Only prob is if it ever * changes in defs.h, but this is highly unlikely. */ typedef unsigned Alignment; static Alignment Left = 9; static Alignment Right = 10; static Alignment Top = 11; static Alignment Bottom = 12; typedef enum {TOP, BOTTOM, LEFT, RIGHT} InterpSide; typedef void Graphic; typedef int Coord; typedef struct { Graphic* picture; char* stype; GestureMap* map; int x; int y; int l; int b; int r; int t; long flags; } Selection; typedef Selection SelectionList[]; typedef struct { Selection* target; /* Graphic on which event occurred */ int timestamp; /* a relative time */ GestureType gesture; /* type of gesture (see above) */ int x, y; /* mouse position relative to full canvas */ bool control; /* true if control key down */ bool meta; /* true if meta (diamond) key down */ bool shift; /* true if shift key down */ bool shiftlock; /* true if shift-lock on */ int len; /* length of ASCII string */ char* keystring; /* ASCII interpretation of event, if any */ } Event; /* * This first round of function prototypes defines the plain C interface to the * functions defined in $(IDRAWDIR)/peditor-interface.{h,c}, q.q.v. The * prototypes here are the same as in peditor-interface.h, with the ``extern * "C"'' omitted. */ void Select(Selection* s); void SelectMultiple(SelectionList* s); void Unselect(Selection* s); void UnselectMultiple(SelectionList* s); void Move(Coord l, Coord b); void MoveSelection(Selection* s, Coord l, Coord b); void Scale(float factor); void ScaleSelection(Selection* s, float factor); void Stretch(InterpSide s, float amount); void StretchSelection(Selection* sel, InterpSide s, float amount); void Rotate(float degrees); void RotateSelection(Selection* s, float degrees); void Reshape(Coord x0, Coord y0, Coord x1, Coord y1); void ReshapeSelection(Selection* s, Coord x0, Coord y0, int pt, Coord x1, Coord y1); void Magnify(Coord x0, Coord y0, Coord x1, Coord y1); void MagnifySelection(Selection* s, Coord x0, Coord y0, Coord x1, Coord y1); Selection* DrawText(Coord l, Coord b, char* text); Selection* DrawLine(Coord x0, Coord y0, Coord x1, Coord y1); Selection* DrawMultiLine(Coord* x, Coord* y, int n); Selection* DrawOpenSpline(Coord* x, Coord* y, int n); Selection* DrawEllipse(Coord cx, Coord cy, Coord xr, Coord yr); Selection* DrawRect(Coord l, Coord b, Coord r, Coord t); Selection* DrawPolygon(Coord* x, Coord* y, int n); Selection* DrawClosedSpline(Coord* x, Coord* y, int n); void TextInsert(char* text); void TextSelect(int starpos, int endpos); void TextDelete(); void TextForwardChar(); void TextBackwardChar(); void TextNextLine(); void TextPreviousLine(); void TextBeginningOfLine(); void TextEndOfLine(); void TextBeginningOfText(); void TextEndOfText(); void TextPutCursor(int charpos); void FileNew(int width, int height, int x, int y); void FileRevert(); void FileOpen(char* filename); void FileOpenScript(char* filename); void FileCloseScript(char* filename); void FileSave(); void FileSaveAs(char* filenname); void FileSaveAll(); void FileRaiseCanvas(int canvasnum); void FileLowerCanvas(int canvasnum); void FileSelectCanvas(int canvasnum); void FileMoveCanvas(int x, int y); void FileResizeCanvas(int width, int height, int x, int y); void FileShowHideCanvas(int canvasnum, bool show); void FileShowHideMenus(bool show); void FileShowHideTools(bool show); void FilePrint(); void FileQuit(); void EditUndo(); void EditRedo(); void EditCut(); void EditCopy(); void EditPaste(); void EditDuplicate(); void EditDelete(); void EditSelectAll(); void EditUnselectAll(); void EditFlipHorizontal(); void EditFlipVertical(); void Edit90Clockwise(); void Edit90CounterClockwise(); void EditPreciseMove(int x, int y); void EditPreciseScale(float factor); void EditPreciseRotate(float degrees); void EditInterpret(char* command); Selection* StructureGroup(); Selection* StructureUngroup(); void StructureBringToFront(); void StructureSendToBack(); int StructureNumberOfGraphics(); void FontSelect(int fontnumber); void BrushSelect(int brushnumber); void PatternSelect(int patternhnumber); void FgColorSelect(int colornnumber); void BgColorSelect(int colornnumber); void AlignLeftSides(); void AlignRightSides(); void AlignBottoms(); void AlignTops(); void AlignVertCenters(); void AlignHorizCenters(); void AlignCenters(); void AlignLeftToRight(); void AlignRightToLeft(); void AlignBottomToTop(); void AlignTopToBottom(); void AlignToGrid(); void OptionReduce(); void OptionEnlarge(); void OptionNormalSize(); void OptionReduceToFit(); void OptionCenterPage(); void OptionRedrawPage(); void OptionGriddingOnOff(boolean on); void OptionGridVisibleInvisible(boolean visible); void OptionGridSpacing(int gridsize); void OptionOrientation(); void OptionNameObject(char* name); Selection* OptionFindObject(char* name); char* OptionShowObjectName(Selection* obj); int OptionPrintWinNum(); char* OptionShowVersion(); bool Intersects(Selection* s1, Selection* s2); bool Contains(Selection* s1, Selection* s2); bool LeftOf(Selection* s1, Selection* s2); bool RightOf(Selection* s1, Selection* s2); bool Above(Selection* s1, Selection* s2); bool Below(Selection* s1, Selection* s2); bool ContainsLeftEndPoint(Selection* s1, Selection* s2); bool ContainsRightEndPoint(Selection* s1, Selection* s2); bool DistanceFrom(Selection* s1, Selection* s2); bool DirectionFrom(Selection* s1, Selection* s2); bool SameInstanceAs(Selection* s1, Selection* s2); /* * This second round of prototypes defines the underscore-suffixed versions, * that have no parms. These are called directly from the interp in the normal * way (i.e., from interp.c:DoProcCall, q.v.). */ Value* Select_(/* Graphic g */ Node* t, Symtab* st); Value* SelectMultiple_(/* sl: array of Selection */ Node* t, Symtab* st); Value* Unselect_(/* g: Graphic */ Node* t, Symtab* st); Value* UnselectMultiple_(/* sl: array of Selection */ Node* t, Symtab* st); Value* Move_(/* l,b: integer */ Node* t, Symtab* st); Value* MoveSelection_(/* s:Selection, l,b: integer */ Node* t, Symtab* st); Value* Scale_(/* factor: real */ Node* t, Symtab* st); Value* ScaleSelection_(/* s:Selection, factor: real */ Node* t, Symtab* st); Value* Stretch_(/* s: Side; amount: integer */ Node* t, Symtab* st); Value* StretchSelection_(/* s:Selection, s: Side; amount: integer */ Node* t, Symtab* st); Value* Rotate_(/* degrees: real */ Node* t, Symtab* st); Value* RotateSelection_(/* s:Selection, degrees: real */ Node* t, Symtab* st); Value* Reshape_(/* x0, y0, x1, y1: integer */ Node* t, Symtab* st); Value* ReshapeSelection_(/* s:Selection, x0, y0, pt, x1, y1: integer */ Node* t, Symtab* st); Value* Magnify_(/* x0, y0, x1, y1: integer */ Node* t, Symtab* st); Value* MagnifySelection_(/* s:Selection, x0, y0, x1, y1: integer */ Node* t, Symtab* st); Value* DrawText_(/* l, b: integer; text: string */ Node* t, Symtab* st); Value* DrawLine_(/* x0, y0, x1, y1: integer */ Node* t, Symtab* st); Value* DrawMultiLine_(/* x, y: array of integer */ Node* t, Symtab* st); Value* DrawOpenSpline_(/* x, y: array of integer */ Node* t, Symtab* st); Value* DrawEllipse_(/* cx, cy, xr, yr: integer */ Node* t, Symtab* st); Value* DrawRect_(/* nodep t */ Node* t, Symtab* st); Value* DrawPolygon_(/* x, y: array of integer */ Node* t, Symtab* st); Value* DrawClosedSpline_(/* x, y: array of integer */ Node* t, Symtab* st); Value* FileNew_(/* */ Node* t, Symtab* st); Value* FileRevert_(/* */ Node* t, Symtab* st); Value* FileOpen_(/* filename: string */ Node* t, Symtab* st); Value* FileOpenScript_(/* filename: string */ Node* t, Symtab* st); Value* FileSave_(/* */ Node* t, Symtab* st); Value* FileSaveAs_(/* filenname: string */ Node* t, Symtab* st); Value* FileSaveAll_(/* */ Node* t, Symtab* st); Value* FilePrint_(/* command: string */ Node* t, Symtab* st); Value* FileShowCanvas_(/* canvasnum: integer */ Node* t, Symtab* st); Value* FileHideCanvas_(/* canvasnum: integer */ Node* t, Symtab* st); Value* FileRaiseCanvas_(/* canvasnum: integer */ Node* t, Symtab* st); Value* FileLowerCanvas_(/* canvasnum: integer */ Node* t, Symtab* st); Value* FileMoveCanvas_(/* l, b: integer */ Node* t, Symtab* st); Value* FileResizeCanvas_(/* l, b, r, t: integer */ Node* tree, Symtab* st); Value* FileShrinkWrap_(/* */ Node* t, Symtab* st); Value* ShowHideMenus_(/* show: boolean */ Node* t, Symtab* st); Value* ShowHideTools_(/* show: boolean */ Node* t, Symtab* st); Value* FileQuit_(/* */ Node* t, Symtab* st); Value* FileSelectCanvas_(/* canvasnum: integer */ Node* t, Symtab* st); Value* EditUndo_(/* */ Node* t, Symtab* st); Value* EditRedo_(/* */ Node* t, Symtab* st); Value* EditCut_(/* */ Node* t, Symtab* st); Value* EditCopy_(/* */ Node* t, Symtab* st); Value* EditPaste_(/* */ Node* t, Symtab* st); Value* EditDuplicate_(/* */ Node* t, Symtab* st); Value* EditDelete_(/* */ Node* t, Symtab* st); Value* EditSelectAll_(/* */ Node* t, Symtab* st); Value* EditUnselectAll_(/* */ Node* t, Symtab* st); Value* EditFlipHorizontal_(/* */ Node* t, Symtab* st); Value* EditFlipVertical_(/* */ Node* t, Symtab* st); Value* Edit90Clockwise_(/* */ Node* t, Symtab* st); Value* Edit90CounterClockwise_(/* */ Node* t, Symtab* st); Value* EditPreciseMove_(/* x,y: integer */ Node* t, Symtab* st); Value* EditPreciseScale_(/* factor: real */ Node* t, Symtab* st); Value* EditPreciseRotate_(/* degrees: real */ Node* t, Symtab* st); Value* EditInterpret_(/* command: string */ Node* t, Symtab* st); Value* StructureGroup_(/* */ Node* t, Symtab* st); Value* StructureUngroup_(/* */ Node* t, Symtab* st); Value* StructureBringToFront_(/* */ Node* t, Symtab* st); Value* StructureSendToBack_(/* */ Node* t, Symtab* st); Value* StructureNumberOfGraphics_(/* */ Node* t, Symtab* st); Value* FontSelect_(/* fontname: string */ Node* t, Symtab* st); Value* BrushSelect_(/* brushnumber: integer */ Node* t, Symtab* st); Value* PatternSelect_(/* patternnumber: integer */ Node* t, Symtab* st); Value* FgColorSelect_(/* colornnumber: integer */ Node* t, Symtab* st); Value* BgColorSelect_(/* colornnumber: integer */ Node* t, Symtab* st); Value* AlignLeftSides_(/* */ Node* t, Symtab* st); Value* AlignRightSides_(/* */ Node* t, Symtab* st); Value* AlignBottoms_(/* */ Node* t, Symtab* st); Value* AlignTops_(/* */ Node* t, Symtab* st); Value* AlignVertCenters_(/* */ Node* t, Symtab* st); Value* AlignHorizCenters_(/* */ Node* t, Symtab* st); Value* AlignCenters_(/* */ Node* t, Symtab* st); Value* AlignLeftToRight_(/* */ Node* t, Symtab* st); Value* AlignRightToLeft_(/* */ Node* t, Symtab* st); Value* AlignBottomToTop_(/* */ Node* t, Symtab* st); Value* AlignTopToBottom_(/* */ Node* t, Symtab* st); Value* AlignToGrid_(/* */ Node* t, Symtab* st); Value* OptionReduce_(/* */ Node* t, Symtab* st); Value* OptionEnlarge_(/* */ Node* t, Symtab* st); Value* OptionNormalSize_(/* */ Node* t, Symtab* st); Value* OptionReduceToFit_(/* */ Node* t, Symtab* st); Value* OptionCenterPage_(/* */ Node* t, Symtab* st); Value* OptionRedrawPage_(/* */ Node* t, Symtab* st); Value* OptionGriddingOnOff_(/* on: boolean */ Node* t, Symtab* st); Value* OptionGridVisibleInvisible_(/* visible: boolean */ Node* t, Symtab* st); Value* OptionGridSpacing_(/* gridsize: integer */ Node* t, Symtab* st); Value* OptionOrientation_(/* */ Node* t, Symtab* st); Value* OptionNameObject_(/* name: string */ Node* t, Symtab* st); Value* OptionFindObject_(/* name: string */ Node* t, Symtab* st); Value* OptionShowObjectName_(/* obj: Graphic */ Node* t, Symtab* st); Value* OptionPrintWinNum_(/* */ Node* t, Symtab* st); Value* OptionShowVersion_(/* */ Node* t, Symtab* st); Value* Intersects_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* LeftEndPointContained_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* RightEndPointContained_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* Contains_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* ContainsLeftEndPoint_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* ContainsRightEndPoint_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* LeftOf_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* RightOf_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* Above_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* Below_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; Value* DistanceFrom_(/* s1,s2:Selection; d:integer */ Node* t, Symtab* st) /* :boolean */; Value* DirectionFrom_(/* s1,s2:Selection; d:integer */ Node* t, Symtab* st) /* :boolean */; Value* SameInstanceAs_(/* s1,s2:Selection */ Node* t, Symtab* st) /* :boolean */; /* * The following funtions are utilities used in idraw-interface.c. */ Value* MakeSelectionVal(Selection* s, Symtab* st); Alignment ConvertToIdrawSide(int s); void InitIdrawInterface(Symtab* level0st); void InitIdrawConstants(Symtab* st); void SetCProc(char* name, Value* (*func)(Node*, Symtab*), Symtab* st); #ifdef ANIMATION void StartAnimation(); #endif #endif