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
20
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22
////////////////////////////////////////////////////////////////////////////////
24
#include "atdiagram.h"
28
#include "diagramstubs.h"
30
// X bitmap data for the tiled buttons
31
#include "MiniDiamond.xbm"
32
#include "NoteBox.xbm"
33
#include "SolidHorizontalBar.xbm"
34
#include "SolidVerticalBar.xbm"
35
#include "BlackDot.xbm"
36
#include "BullsEye.xbm"
37
#include "RoundedBox.xbm"
38
#include "EllipsedBox.xbm"
39
#include "Comment.xbm"
41
#include "DottedLine.xbm"
43
const char *ATWindow::AT_NODE_NAMES[] =
46
"Horizontal synchronization bar",
51
"Vertical synchronization bar",
54
const Bitmap ATWindow::AT_NODE_ICONS [] =
55
{{EllipsedBox_width, EllipsedBox_height, EllipsedBox_bits},
56
{MiniDiamond_width, MiniDiamond_height, MiniDiamond_bits},
57
{SolidHorizontalBar_width, SolidHorizontalBar_height,
58
SolidHorizontalBar_bits},
59
{BlackDot_width, BlackDot_height, BlackDot_bits},
60
{Comment_width, Comment_height, Comment_bits},
61
{RoundedBox_width, RoundedBox_height, RoundedBox_bits},
62
{NoteBox_width, NoteBox_height, NoteBox_bits},
63
{SolidVerticalBar_width, SolidVerticalBar_height,
64
SolidVerticalBar_bits},
65
{BullsEye_width, BullsEye_height, BullsEye_bits}};
67
const char *ATWindow::AT_EDGE_NAMES[] =
70
const Bitmap ATWindow::AT_EDGE_ICONS [] =
71
{{Arrow_width, Arrow_height, Arrow_bits},
72
{DottedLine_width, DottedLine_height, DottedLine_bits}};
74
ATWindow::ATWindow(const char *n): DiagramWindow(n) {}
76
DiagramViewer *ATWindow::CreateViewer(Config *cfg) {
77
return new ATViewer(cfg, this);
80
Graph *ATWindow::CreateGraph() {
84
Diagram *ATWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
85
return new ATDiagram(c, this, (ATViewer *)v, (ATGraph *)g);
88
void ATWindow::DetermineIcons() {
89
nodeNames = AT_NODE_NAMES;
90
nodeIcons = AT_NODE_ICONS;
91
edgeNames = AT_EDGE_NAMES;
92
edgeIcons = AT_EDGE_ICONS;
93
nrNodes = XtNumber(AT_NODE_NAMES);
94
nrEdges = XtNumber(AT_EDGE_NAMES);
97
void ATWindow::InitMenuItems() {
98
DiagramWindow::InitMenuItems();
100
updateNodeShapeTypeItems = new MenuItem[10]; i=0;
101
updateNodeShapeTypeItems[i] = MenuItem(
102
"to Horizontal Synchronization Bars",
103
MenuItem::PUSHBUTTON, 'H', 0, 0,
104
DiagramStubs::UpdateNodeShapeTypeCB,
105
(XtPointer)GetDiagramViewer(),
106
(XtPointer)Code::SOLID_HORIZONTAL_BAR, 0, 1); i++;
107
updateNodeShapeTypeItems[i] = MenuItem(
108
"to Vertical Synchronization Bars",
109
MenuItem::PUSHBUTTON, 'V', 0, 0,
110
DiagramStubs::UpdateNodeShapeTypeCB,
111
(XtPointer)GetDiagramViewer(),
112
(XtPointer)Code::SOLID_VERTICAL_BAR, 0, 1); i++;
113
updateNodeShapeTypeItems[i] = MenuItem::NUL;
116
while (editItems[j++].label != 0)
118
editItems[--j] = MenuItem("", MenuItem::SEPARATOR); j++;
119
editItems[j] = MenuItem(
120
"Update Node Shape Type", MenuItem::SUBMENU, 'N', 0, 0,
121
0, 0, 0, updateNodeShapeTypeItems, 1); j++;
122
editItems[j] = MenuItem::NUL;
125
while (popupEditItems[k++].label != 0)
127
popupEditItems[--k] = MenuItem("", MenuItem::SEPARATOR); k++;
128
popupEditItems[k] = MenuItem(
129
"Update Node Shape Type", MenuItem::SUBMENU, 'N', 0, 0,
130
0, 0, 0, updateNodeShapeTypeItems, 1); k++;
131
popupEditItems[k] = MenuItem::NUL;