~ubuntu-branches/ubuntu/intrepid/tcm/intrepid

« back to all changes in this revision

Viewing changes to src/sd/gd/gdwindow.c

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2003-07-03 20:08:21 UTC
  • Revision ID: james.westby@ubuntu.com-20030703200821-se4xtqx25e5miczi
Tags: upstream-2.20
ImportĀ upstreamĀ versionĀ 2.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////////////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
 
4
// (c) copyright 1996, Vrije Universiteit Amsterdam.
 
5
// Author: Frank Dehne (frank@cs.vu.nl).
 
6
//
 
7
// TCM is free software; you can redistribute it and/or modify
 
8
// it under the terms of the GNU General Public License as published by
 
9
// the Free Software Foundation; either version 2 of the License, or 
 
10
// (at your option) any later version.
 
11
//
 
12
// TCM is distributed in the hope that it will be useful,
 
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
// GNU General Public License for more details.
 
16
//
 
17
// You should have received a copy of the GNU General Public License
 
18
// along with TCM; if not, write to the Free Software
 
19
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
20
// 02111-1307, USA.
 
21
////////////////////////////////////////////////////////////////////////////////
 
22
#include "gdwindow.h"
 
23
#include "gddiagram.h"
 
24
#include "gdviewer.h"
 
25
#include "gdgraph.h"
 
26
#include "menu.h"
 
27
#include "diagramstubs.h"
 
28
 
 
29
// X bitmap data for the tiled buttons
 
30
#include "Box.xbm"
 
31
#include "Square.xbm"
 
32
#include "Circle.xbm"
 
33
#include "StickMan.xbm"
 
34
#include "Ellipse.xbm"
 
35
#include "Triangle.xbm"
 
36
#include "Diamond.xbm"
 
37
#include "NoteBox.xbm"
 
38
#include "Hexagon.xbm"
 
39
#include "HorizontalBar.xbm"
 
40
#include "VerticalBar.xbm"
 
41
#include "SolidHorizontalBar.xbm"
 
42
#include "SolidVerticalBar.xbm"
 
43
#include "BlackDot.xbm"
 
44
#include "BullsEye.xbm"
 
45
#include "RoundedBox.xbm"
 
46
#include "EllipsedBox.xbm"
 
47
#include "Comment.xbm"
 
48
#include "BuildingBlock.xbm"
 
49
#include "Folder.xbm"
 
50
#include "SubFolder.xbm"
 
51
#include "Cube.xbm"
 
52
#include "Disk.xbm"
 
53
#include "Line.xbm"
 
54
#include "Arrow.xbm"
 
55
#include "OpenArrow.xbm"
 
56
#include "DoubleArrow.xbm"
 
57
#include "DoubleHeadedArrow.xbm"
 
58
#include "EmptyOpenArrow.xbm"
 
59
 
 
60
#include "GDBoundaryShape.xbm"
 
61
#include "GDControllerShape.xbm"
 
62
#include "GDEntityShape.xbm"
 
63
 
 
64
const char *GDWindow::GD_NODE_NAMES[] =  
 
65
        {"Box", 
 
66
         "Circle", 
 
67
         "Rounded box", 
 
68
         "Triangle", 
 
69
         "Bull's eye",
 
70
         "Stick man",
 
71
         "Cube",
 
72
         "Boundary class",
 
73
         "Text",
 
74
         "Diamond", 
 
75
         "Square",
 
76
         "Vertical bar",
 
77
         "Hexagon", 
 
78
         "Solid vertical bar", 
 
79
         "Folder",
 
80
         "Building block",
 
81
         "Controller class",
 
82
         "Note box",
 
83
         "Ellipse", 
 
84
         "Black dot",
 
85
         "Horizontal bar", 
 
86
         "Ellipsed box", 
 
87
         "Solid horizontal bar",
 
88
         "SubFolder",
 
89
         "Disk",
 
90
         "Entity class"};
 
91
 
 
92
const Bitmap GDWindow::GD_NODE_ICONS [] =
 
93
        {{Box_width, Box_height, Box_bits},
 
94
         {Circle_width, Circle_height, Circle_bits},
 
95
         {RoundedBox_width, RoundedBox_height, RoundedBox_bits},
 
96
         {Triangle_width, Triangle_height, Triangle_bits},
 
97
         {BullsEye_width, BullsEye_height, BullsEye_bits},
 
98
         {StickMan_width, StickMan_height, StickMan_bits},
 
99
         {Cube_width, Cube_height, Cube_bits},
 
100
         {GDBoundaryShape_width, GDBoundaryShape_height, GDBoundaryShape_bits},
 
101
         {Comment_width, Comment_height, Comment_bits},
 
102
         {Diamond_width, Diamond_height, Diamond_bits},
 
103
         {Square_width, Square_height, Square_bits},
 
104
         {VerticalBar_width, VerticalBar_height, VerticalBar_bits},
 
105
         {Hexagon_width, Hexagon_height, Hexagon_bits},
 
106
         {SolidVerticalBar_width, SolidVerticalBar_height,
 
107
          SolidVerticalBar_bits},
 
108
         {Folder_width, Folder_height, Folder_bits},
 
109
         {BuildingBlock_width, BuildingBlock_height, BuildingBlock_bits},
 
110
         {GDControllerShape_width, GDControllerShape_height, GDControllerShape_bits},
 
111
         {NoteBox_width, NoteBox_height, NoteBox_bits},
 
112
         {Ellipse_width, Ellipse_height, Ellipse_bits},
 
113
         {BlackDot_width, BlackDot_height, BlackDot_bits},
 
114
         {HorizontalBar_width, HorizontalBar_height, HorizontalBar_bits},
 
115
         {EllipsedBox_width, EllipsedBox_height, EllipsedBox_bits},
 
116
         {SolidHorizontalBar_width, SolidHorizontalBar_height,
 
117
          SolidHorizontalBar_bits},
 
118
         {SubFolder_width, SubFolder_height, SubFolder_bits},
 
119
         {Disk_width, Disk_height, Disk_bits},
 
120
         {GDEntityShape_width, GDEntityShape_height, GDEntityShape_bits}};
 
121
 
 
122
const char *GDWindow::GD_EDGE_NAMES[] = 
 
123
        {"Line", 
 
124
         "Double arrow", 
 
125
         "Arrow",
 
126
         "Empty open arrow", 
 
127
         "Double headed arrow",
 
128
         "Open arrow"};
 
129
const Bitmap GDWindow::GD_EDGE_ICONS [] =
 
130
        {{Line_width, Line_height, Line_bits},
 
131
         {DoubleArrow_width, DoubleArrow_height, DoubleArrow_bits},
 
132
         {Arrow_width, Arrow_height, Arrow_bits},
 
133
         {EmptyOpenArrow_width, EmptyOpenArrow_height, EmptyOpenArrow_bits},
 
134
        {DoubleHeadedArrow_width, DoubleHeadedArrow_height, 
 
135
          DoubleHeadedArrow_bits},
 
136
         {OpenArrow_width, OpenArrow_height, OpenArrow_bits}};
 
137
 
 
138
 
 
139
GDWindow::GDWindow(const char *n): DiagramWindow(n) {
 
140
        SetShowLineStyleOptionMenu(True);
 
141
}
 
142
 
 
143
DiagramViewer *GDWindow::CreateViewer(Config *cfg) {
 
144
        return new GDViewer(cfg, this);
 
145
}
 
146
 
 
147
Graph *GDWindow::CreateGraph() {
 
148
        return new GDGraph();
 
149
}
 
150
 
 
151
Diagram *GDWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
 
152
         return new GDDiagram(c, this, (GDViewer *)v, (GDGraph *)g);
 
153
}
 
154
 
 
155
void GDWindow::DetermineIcons() {
 
156
         nodeNames = GD_NODE_NAMES;
 
157
         nodeIcons = GD_NODE_ICONS;
 
158
         edgeNames = GD_EDGE_NAMES;
 
159
         edgeIcons = GD_EDGE_ICONS;
 
160
         nrNodes = XtNumber(GD_NODE_NAMES);
 
161
         nrEdges = XtNumber(GD_EDGE_NAMES);
 
162
}
 
163
 
 
164
void GDWindow::InitMenuItems() {
 
165
        DiagramWindow::InitMenuItems();
 
166
 
 
167
        int j = 0;
 
168
        while (editItems[j++].label != 0)
 
169
                ;
 
170
        editItems[--j] = MenuItem("", MenuItem::SEPARATOR); j++;
 
171
        editItems[j] = MenuItem(
 
172
                "Convert Node Shape Type...", MenuItem::PUSHBUTTON, 'N', 0, 0, 
 
173
                DiagramStubs::ConvertNodeShapeTypeCB, 
 
174
                (XtPointer)GetDiagramViewer(), 0, 0, 1); j++;
 
175
        editItems[j] = MenuItem::NUL;
 
176
 
 
177
        int k = 0;
 
178
        while (popupEditItems[k++].label != 0)
 
179
                ;
 
180
        popupEditItems[--k] = MenuItem("", MenuItem::SEPARATOR); k++;
 
181
        popupEditItems[k] = MenuItem(
 
182
                "Convert Node Shape Type...", MenuItem::PUSHBUTTON, '\0', 0, 0, 
 
183
                DiagramStubs::ConvertNodeShapeTypeCB, 
 
184
                (XtPointer)GetDiagramViewer(), 0, 0, 1); k++;
 
185
        popupEditItems[k] = MenuItem::NUL;
 
186
}