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 "rpdiagram.h"
27
#include "diagramstubs.h"
29
// X bitmap data for the tiled buttons
31
#include "MiniArrowEllipse.xbm"
33
#include "Comment.xbm"
34
#include "RoundedBox.xbm"
36
const char *RPWindow::RP_NODE_NAMES[] =
37
{"Root node", "Unlabeled node", "Labeled Node", "Comment"};
39
const Bitmap RPWindow::RP_NODE_ICONS [] =
40
{{MiniArrowEllipse_width, MiniArrowEllipse_height, MiniArrowEllipse_bits},
41
{Dot_width, Dot_height, Dot_bits},
42
{RoundedBox_width, RoundedBox_height, RoundedBox_bits},
43
{Comment_width, Comment_height, Comment_bits}};
45
const char *RPWindow::RP_EDGE_NAMES[] = {"Event"};
46
const Bitmap RPWindow::RP_EDGE_ICONS [] =
47
{{Arrow_width, Arrow_height, Arrow_bits}};
49
RPWindow::RPWindow(const char *n): DiagramWindow(n) {
52
DiagramViewer *RPWindow::CreateViewer(Config *cfg) {
53
return new RPViewer(cfg, this);
56
Graph *RPWindow::CreateGraph() {
60
Diagram *RPWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
61
return new RPDiagram(c, this, (RPViewer *)v, (RPGraph *)g);
64
void RPWindow::DetermineIcons() {
65
nodeNames = RP_NODE_NAMES;
66
nodeIcons = RP_NODE_ICONS;
67
edgeNames = RP_EDGE_NAMES;
68
edgeIcons = RP_EDGE_ICONS;
69
nrNodes = XtNumber(RP_NODE_NAMES);
70
nrEdges = XtNumber(RP_EDGE_NAMES);
74
void RPWindow::InitMenuItems() {
75
DiagramWindow::InitMenuItems();
77
convertItems = new MenuItem[10]; i=0;
78
convertItems[i] = MenuItem("to Labeled Nodes",
79
MenuItem::PUSHBUTTON, 'L', 0, 0,
80
DiagramStubs::UpdateNodeShapeTypeCB,
81
(XtPointer)GetDiagramViewer(),
82
(XtPointer)Code::ROUNDED_BOX, 0, 1); i++;
83
convertItems[i] = MenuItem("to Unlabeled Nodes",
84
MenuItem::PUSHBUTTON, 'U', 0, 0,
85
DiagramStubs::UpdateNodeShapeTypeCB,
86
(XtPointer)GetDiagramViewer(),
87
(XtPointer)Code::MINI_ELLIPSE, 0, 1); i++;
88
convertItems[i] = MenuItem::NUL;
90
// add menu for converting node shapes.
92
while (editItems[j++].label != 0)
94
editItems[--j] = MenuItem("", MenuItem::SEPARATOR); j++;
95
editItems[j] = MenuItem(
96
"Change Node Shape Type", MenuItem::SUBMENU, 'C', 0, 0,
97
0, 0, 0, convertItems, 1); j++;
98
editItems[j] = MenuItem::NUL;
100
while (popupEditItems[k++].label != 0)
102
popupEditItems[--k] = MenuItem("", MenuItem::SEPARATOR); k++;
103
popupEditItems[k] = MenuItem(
104
"Change Node Shape Type", MenuItem::SUBMENU, 'C', 0, 0,
105
0, 0, 0, convertItems, 1); k++;
106
popupEditItems[k] = MenuItem::NUL;