/**** * * Implementation of box-arrow-diagram.h * */ #include "box-arrow-diagram.h" #include #include #include #include #include #include #include #include BoxArrowDiagram::BoxArrowDiagram(Screen* s, int height = 200, int width = 200) : View(s) { Perspective* px = new Perspective();// Needed to solve bogus link problems // See debugging-notes for discussion GraphicBlock* gb; // Temp /* * Do some necessary IV init. */ InitPPaint(); /* * Allocate and intialize the picture. */ p = new Picture(); p->SetTransformer(nil); /* * Set our inherited window interactor to a tray. */ w = new Tray(gb = new GraphicBlock(new Sensor(), p, 0, BottomLeft)); /* * Stick in a panner for fun. Later make this scroll bars. */ ((Tray*) w)->Align(BottomRight, new Frame(new Panner(gb))); gb->Update(); } BoxId BoxArrowDiagram::DrawBox( int l, int b, int r, int t, Color* c, Label* la) { FullGraphic* fg; // Graphic defining color properties ColorIntensity r1,g1,b1; // r,g,b extracted from Color to make PColor FillRect* fr; // Temp for holding box graphic /* * Allocate the full graphic and set its default properities. */ fg = new FullGraphic(); fg->FillBg(true); fg->SetPattern(psolid); fg->SetBrush(psingle); fg->SetFont(pstdfont); /* * Snag the colors from the given color to make a PColor. */ c->Intensities(r1, g1, b1); /* * Set foreground and background colors to the given color. */ fg->SetColors(new PColor(r1, g1, b1), new PColor(r1, g1, b1)); /* * Draw and position the box as a FillRect. */ fr = new FillRect(l, b, r, t, fg); fr->Translate(200,200); /* * Add the box to this' picture. */ p->Append(fr); p->Append(new Line(0, 0, 75, 75, fg)); } BoxArrowDiagram::Connect(BoxId id1, BoxId id2) { }