home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1989, Tera Computer Company
- **/
-
- /* View of the graph, with perspective and everything */
-
- #ifndef gview_h
- #define gview_h
-
- #include <InterViews/interactor.h>
- #include "graph.h"
-
- class Graph;
- class FontHandler;
- class GraphData;
- class GraphFrame;
- class Perspective;
-
- enum ModeType {bmode, cmode, emode}; /* browse, edit, or change mode? */
-
- class GView : public Interactor
- {
- public:
- GView(Graph*);
- void Adjust(Perspective&);
- float GetMagnification() { return mag; }
- void Draw();
- void Redraw(Coord, Coord, Coord, Coord);
- void Erase();
- void Update();
- void UpdateG(); // update the graph (i.e. draw it)
- void UpdateP(); // just an interface to...
- void UpdatePerspective(); // update the perspective
- void CenterGraph();
- void ChangePGrad(int, int);
- void GetBounds(int*, int*, int*, int*, int*, int*, int*, int*);
- void Handle(Event&);
- void SetFHandler (FontHandler*);
- boolean CurOnNonDummyNode();
- boolean CurOnNode();
- boolean CurOnEdge();
- char *CurEdge();
- char *CurNode();
- void ChangeForceNL();
- void ChangeForceEL();
- void ChangeMarkDummy();
- void ChangePA();
- void FocusGraph(int, int, float);
- void ChangeCurNodeLabel(char*);
- void GetCurPos(int*, int*);
- void SetupMove(char*, char*[], char*[], int, int);
- void SetupInsArc();
- void ChangeBC();
- void SetFrame(GraphFrame*);
- void ResetCurrent();
- Canvas *GetCanvas();
- private:
- GraphData** current; // items under cursor
- int currno; // number of elements in current
- Coord eventx, eventy; // absolute version of ...
- Coord cursorx, cursory; // cursor position, in canvas coordinates
- Graph* graph; // the graph itself
- GraphFrame* frame; // so we can pick on the one upstairs
- boolean okaytodraw; // if not true, don't even bother drawing
- boolean resizedone; // we've just done a resize
- boolean firsttime; // we've just started up
- float mag; // magnifaction relative to initial position
- Coord x0, y0; // graph offset relative to initial position
-
- void Init();
- void FixPerspective(Perspective*);
- void Normalize(Perspective&); /* normalize units */
- float ScaleFactor(Perspective&);
- void Zoom(Perspective&);
- void Scroll(Perspective&);
- void SetMagnification(float);
-
- void DoMove(Event&);
- void DoInsArc(Event&);
- void FindIntersect();
- void Resize();
- void translate (Coord, Coord, Coord*, Coord*);
- void invtranslate (Coord, Coord, Coord*, Coord*);
- // handle mouse input
- void DoMiddleDown(Event&, ModeType);
- void DoMiddleUp(Event&, ModeType);
- void DoRightDown(Event&, ModeType);
- void DoRightUp(Event&, ModeType);
- void DoLeftDown(Event&, ModeType);
- void DoLeftUp(Event&, ModeType);
- void DoMouseMove(Event&);
- void ResetCursor();
- void Constrain(Event&);
- boolean EKeyPressed(Event&);
- boolean CKeyPressed(Event&);
- boolean BKeyPressed(Event&);
- };
-
- #endif
-