1
//------------------------------------------------------------------------------
3
// This file is part of Toolkit for Conceptual Modeling (TCM).
4
// (c) copyright 1999, Vrije Universiteit Amsterdam and University of Twente.
5
// Author: Frank Dehne (frank@cs.vu.nl).
6
// Author: Henk van de Zandschulp (henkz@cs.utwente.nl).
8
// TCM is free software; you can redistribute it and/or modify
9
// it under the terms of the GNU General Public License as published by
10
// the Free Software Foundation; either version 2 of the License, or
11
// (at your option) any later version.
13
// TCM is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details.
18
// You should have received a copy of the GNU General Public License
19
// along with TCM; if not, write to the Free Software Foundation, Inc.,
20
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
//-----------------------------------------------------------------------------
22
#include "ucdiagram.h"
27
#include "diagramstubs.h"
29
// X bitmap data for the tiled buttons
31
#include "BoundaryBox.xbm"
32
#include "StickMan.xbm"
34
#include "Comment.xbm"
35
#include "Ellipse.xbm"
36
#include "NoteBox.xbm"
37
#include "EmptyOpenArrow.xbm"
38
#include "DottedLine.xbm"
40
const char *UCWindow::UC_NODE_NAMES[] =
47
const Bitmap UCWindow::UC_NODE_ICONS[] =
48
{{StickMan_width, StickMan_height, StickMan_bits},
49
{Box_width, Box_height, Box_bits},
50
{Ellipse_width, Ellipse_height, Ellipse_bits},
51
{BoundaryBox_width, BoundaryBox_height, BoundaryBox_bits},
52
{NoteBox_width, NoteBox_height, NoteBox_bits},
53
{Comment_width, Comment_height, Comment_bits}};
55
const char* UCWindow::UC_EDGE_NAMES[] =
56
{"Binary association",
60
const Bitmap UCWindow::UC_EDGE_ICONS [] =
61
{{C2Line_width, C2Line_height, C2Line_bits},
62
{EmptyOpenArrow_width, EmptyOpenArrow_height, EmptyOpenArrow_bits},
63
{DottedLine_width, DottedLine_height, DottedLine_bits}};
65
UCWindow::UCWindow(const char *n) : ERWindow(n) {
66
diagramUCBoxItems = 0;
69
UCWindow::~UCWindow() {
70
if (diagramUCBoxItems) {
71
delete diagramUCBoxItems;
75
DiagramViewer *UCWindow::CreateViewer(Config *cfg) {
76
return new UCViewer(cfg, this);
79
Graph *UCWindow::CreateGraph() {
83
Diagram *UCWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
84
return new UCDiagram(c, this, (UCViewer *)v, (UCGraph *)g);
87
void UCWindow::DetermineIcons() {
88
nodeNames = UC_NODE_NAMES;
89
nodeIcons = UC_NODE_ICONS;
90
edgeNames = UC_EDGE_NAMES;
91
edgeIcons = UC_EDGE_ICONS;
92
nrNodes = XtNumber(UC_NODE_NAMES);
93
nrEdges = XtNumber(UC_EDGE_NAMES);
96
void UCWindow::InitMenuItems() {
97
ERWindow::InitMenuItems();
99
diagramUCBoxItems = new MenuItem[10]; i=0;
100
diagramUCBoxItems[i] = MenuItem(
101
"to Actor Class Boxes", MenuItem::PUSHBUTTON, 'C', 0, 0,
102
DiagramStubs::UpdateNodeShapeTypeCB,
103
(XtPointer)GetDiagramViewer(),
104
(XtPointer)Code::UCD_SINGLE_CLASS_BOX, 0, 1); i++;
105
diagramUCBoxItems[i] = MenuItem(
106
"to StickMen", MenuItem::PUSHBUTTON, 'S', 0, 0,
107
DiagramStubs::UpdateNodeShapeTypeCB,
108
(XtPointer)GetDiagramViewer(),
109
(XtPointer)Code::STICKMAN, 0, 1); i++;
110
diagramUCBoxItems[i] = MenuItem::NUL;
112
// delete last menu item: hide value types.
114
while (viewItems[n++].label != 0)
116
viewItems[n-2] = MenuItem::NUL;
119
while (editItems[j++].label != 0)
121
editItems[--j] = MenuItem("", MenuItem::SEPARATOR); j++;
122
editItems[j] = MenuItem(
123
"Change Actor Type", MenuItem::SUBMENU, 'C', 0, 0,
124
0, 0, 0, diagramUCBoxItems, 1); j++;
125
editItems[j] = MenuItem("", MenuItem::SEPARATOR); j++;
126
editItems[j] = MenuItem(
127
"Change Read Direction", MenuItem::SUBMENU, 'R', 0, 0,
128
0, 0, 0, ERReadDirectionItems, 1); j++;
129
editItems[j] = MenuItem::NUL;
132
while (popupEditItems[k++].label != 0)
134
popupEditItems[--k] = MenuItem("", MenuItem::SEPARATOR); k++;
135
popupEditItems[k] = MenuItem(
136
"Change Actor Type", MenuItem::SUBMENU, '\0', 0, 0,
137
0, 0, 0, diagramUCBoxItems, 1); k++;
138
popupEditItems[k] = MenuItem("", MenuItem::SEPARATOR); k++;
139
popupEditItems[j] = MenuItem(
140
"Change Read Direction", MenuItem::SUBMENU, '\0', 0, 0,
141
0, 0, 0, ERReadDirectionItems, 1); k++;
142
popupEditItems[k] = MenuItem::NUL;