1
////////////////////////////////////////////////////////////////////////////////
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).
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.
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.
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
21
////////////////////////////////////////////////////////////////////////////////
23
#include "gddiagram.h"
27
#include "diagramstubs.h"
29
// X bitmap data for the tiled buttons
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"
50
#include "SubFolder.xbm"
55
#include "OpenArrow.xbm"
56
#include "DoubleArrow.xbm"
57
#include "DoubleHeadedArrow.xbm"
58
#include "EmptyOpenArrow.xbm"
60
#include "GDBoundaryShape.xbm"
61
#include "GDControllerShape.xbm"
62
#include "GDEntityShape.xbm"
64
const char *GDWindow::GD_NODE_NAMES[] =
87
"Solid horizontal bar",
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}};
122
const char *GDWindow::GD_EDGE_NAMES[] =
127
"Double headed 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}};
139
GDWindow::GDWindow(const char *n): DiagramWindow(n) {
140
SetShowLineStyleOptionMenu(True);
143
DiagramViewer *GDWindow::CreateViewer(Config *cfg) {
144
return new GDViewer(cfg, this);
147
Graph *GDWindow::CreateGraph() {
148
return new GDGraph();
151
Diagram *GDWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
152
return new GDDiagram(c, this, (GDViewer *)v, (GDGraph *)g);
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);
164
void GDWindow::InitMenuItems() {
165
DiagramWindow::InitMenuItems();
168
while (editItems[j++].label != 0)
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;
178
while (popupEditItems[k++].label != 0)
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;