home *** CD-ROM | disk | FTP | other *** search
- /**
- GRAB Graph Layout and Browser System
-
- Copyright (c) 1989, Tera Computer Company
- **/
-
- /**
- Implementation of the frame around everything, the top-level
- interactor, the big cheese.
-
- Most of the routines in here just invoke routines of components of the
- frame. The frame is mostly worried about putting it all together, and
- about changing the cursor to its proper value.
- **/
-
- #include "gframe.h"
- #include "graph.h"
- #include "winview.h"
- #include "fonthandler.h"
- #include "gview.h"
- #include "bview.h"
- #include "tview.h"
- #include "dview.h"
- #include "mypanner.h"
- #include <InterViews/banner.h>
- #include <InterViews/border.h>
- #include <InterViews/box.h>
- #include <InterViews/button.h>
- #include <InterViews/cursor.h>
- #include <InterViews/frame.h>
- #include <InterViews/glue.h>
- #include <InterViews/graphic.h>
- #include <InterViews/scroller.h>
- #include <InterViews/sensor.h>
- #include <InterViews/tray.h>
- #include <InterViews/viewport.h>
- #include "stringedit.h"
- #include <string.h>
- #include "cursor.line"
- #include "cursor.text"
- #include "cursor.button"
-
- Cursor* mainCursor;
- Cursor* lineCursor;
- Cursor* nodeCursor;
- Cursor* browseCursor;
- Cursor* textCursor;
- Cursor* waitCursor;
- Cursor* buttonCursor;
- /* I suspect buttonCursor isn't used and could be eliminated */
-
- void GraphFrame::InitCursors ()
- {
- mainCursor = arrow;
- nodeCursor = crosshairs;
- lineCursor = new Cursor(15, 1, lineCursorData, lineCursorData,
- black, white);
- browseCursor = mainCursor;
- waitCursor = hourglass;
- textCursor = new Cursor(1, 15, textCursorData, textCursorData,
- black, white);
- buttonCursor = new Cursor(1, 15, buttonCursorData, buttonCursorData,
- black, white);
- }
-
- static const sideSize = 150; /* size of the panner et al. */
-
- GraphFrame::GraphFrame (GView* g, TextView* t)
- /* initialize everything, set the proper variables, and put it all together */
- {
- gwin = new GrabWindow (g, t);
- panner = new MyPanner(gwin->gview, sideSize);
- dview = new DrawView(sideSize);
- sidewin = new VBox(dview, new VGlue(10, 0, 0), panner);
- fhandler = new FontHandler();
- gwin->gview->SetFHandler(fhandler);
- Init();
- MakeFrame();
- }
-
- void GraphFrame::Init ()
- /* set variables; let the buttons and the graph know who the frame is */
- {
- SetClassName("GraphFrame");
- delete input;
- input = updownEvents;
- input->Reference();
- Propagate(false);
- InitCursors();
- currentCursor = mainC;
- SetCurs(currentCursor);
- gwin->bview->SetFrame(this);
- gwin->gview->SetFrame(this);
- }
-
- void GraphFrame::ChangeStatusLine (char* s, boolean now)
- {
- gwin->tview->ChangeStatusLine (s, now);
-
- if (now)
- /**
- cheap trick: if we set the cursor, the new status line
- is printed
- **/
- {
- SetCurs(currentCursor);
- }
- }
-
- void GraphFrame::ChangeGraphName (char* s)
- {
- gwin->tview->ChangeGraphName (s);
- }
-
- void GraphFrame::ChangeFileName (char* s)
- {
- gwin->tview->ChangeFileName (s);
- }
-
- void GraphFrame::ChangeToggles (char b[numopts])
- {
- gwin->bview->NewOptionsMenu (b);
- }
-
- void GraphFrame::ChangeZGrad (float zg)
- {
- panner->ChangeZGrad (zg);
- }
-
- void GraphFrame::InitFonts()
- {
- fhandler->newScreen();
- }
-
- void GraphFrame::SmallestFont(int* x, int* y)
- {
- fhandler->SmallestFont(x, y);
- }
-
- void GraphFrame::SetFont(int x, int y)
- {
- fhandler->set_font(x, y);
- }
-
- boolean GraphFrame::TextFits()
- {
- return (fhandler->text_flag);
- }
-
- void GraphFrame::ForceEL()
- {
- fhandler->force_elabel();
- }
-
- void GraphFrame::NoForceEL()
- {
- fhandler->noforce_elabel();
- }
-
- void GraphFrame::ForceNL()
- {
- fhandler->force_nlabel();
- }
-
- void GraphFrame::NoForceNL()
- {
- fhandler->noforce_nlabel();
- }
-
- void GraphFrame::MakeFrame()
- {
- noframe = new HBox(sidewin, new VBorder, gwin);
- Insert(
- new BorderFrame(
- new VBox(
- new Banner("Xgrab2.3", "\0", "04/24/89"),
- new HBorder,
- noframe,
- new HBorder
- )
- )
- );
- }
-
- void GraphFrame::SetCurs(Curs c)
- /* node and line cursors only show up in the graph area */
- {
- currentCursor = c;
-
- switch (c)
- {
- case nodeC:
- gwin->gview->SetCursor(nodeCursor);
- break;
- case lineC:
- gwin->gview->SetCursor(lineCursor);
- break;
- case waitC:
- SetCursor(waitCursor);
- gwin->gview->SetCursor(waitCursor);
- break;
- case browseC:
- SetCursor(browseCursor);
- gwin->gview->SetCursor(browseCursor);
- break;
- case textC:
- SetCursor(textCursor);
- gwin->gview->SetCursor(textCursor);
- break;
- case buttonC:
- SetCursor(buttonCursor);
- gwin->gview->SetCursor(buttonCursor);
- break;
- case mainC:
- SetCursor(mainCursor);
- gwin->gview->SetCursor(mainCursor);
- break;
- }
- }
-
- NShape GraphFrame::CurShape()
- {
- return dview->CurShape();
- }
-
- BType GraphFrame::CurBrush()
- {
- return dview->CurBrush();
- }
-
- CType GraphFrame::CurColor()
- {
- return dview->CurColor();
- }
-
- boolean GraphFrame::ShapeSet()
- {
- return dview->ShapeSet();
- }
-
- boolean GraphFrame::BrushSet()
- {
- return dview->BrushSet();
- }
-
- boolean GraphFrame::ColorSet()
- {
- return dview->ColorSet();
- }
-
- void GraphFrame::UnsetCurs()
- {
- SetCurs(mainC);
- }
-
- void GraphFrame::drawside()
- {
- dview->DrawDep();
- }
-
- void GraphFrame::SetPS(char* fs)
- {
- fhandler->SetPS(fs);
- }
-
- int GraphFrame::WidthPS(char* s)
- {
- return fhandler->WidthPS(s);
- }
-