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 "psdiagram.h"
29
// X bitmap data for the tiled buttons
31
#include "EmptyLine.xbm"
32
#include "Comment.xbm"
34
const char *PSWindow::PS_NODE_NAMES[] = {"Process", "Comment"};
35
const Bitmap PSWindow::PS_NODE_ICONS[] =
36
{{Box_width, Box_height, Box_bits},
37
{Comment_width, Comment_height, Comment_bits}};
39
const char *PSWindow::PS_EDGE_NAMES[] = {"Empty edge"};
40
const Bitmap PSWindow::PS_EDGE_ICONS [] =
41
{{EmptyLine_width, EmptyLine_height, EmptyLine_bits}};
43
PSWindow::PSWindow(const char *n): DiagramWindow(n) {
44
diagramPSShowSequenceItems = 0;
47
PSWindow::~PSWindow(){
48
if (diagramPSShowSequenceItems)
49
delete diagramPSShowSequenceItems;
52
DiagramViewer *PSWindow::CreateViewer(Config *cfg) {
53
return new PSViewer(cfg, this);
56
Graph *PSWindow::CreateGraph() {
60
Diagram *PSWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
61
return new PSDiagram(c, this, (PSViewer *)v, (PSGraph *)g);
64
void PSWindow::DetermineIcons() {
65
nodeNames = PS_NODE_NAMES;
66
nodeIcons = PS_NODE_ICONS;
67
edgeNames = PS_EDGE_NAMES;
68
edgeIcons = PS_EDGE_ICONS;
69
nrNodes = XtNumber(PS_NODE_NAMES);
70
nrEdges = XtNumber(PS_EDGE_NAMES);
73
//Widget PSWindow::CreateMenuBar(Widget parent) {
74
// Widget bar = DiagramWindow::CreateMenuBar(parent);
75
// // make the duplicate item insensitive.
76
// Widget w1 = editMenu->GetMenuItem("Duplicate");
78
// XtVaSetValues(w1, XmNsensitive, False, 0);
82
void PSWindow::InitMenuItems() {
83
DiagramWindow::InitMenuItems();
85
diagramPSShowSequenceItems = new MenuItem[10]; i=0;
86
diagramPSShowSequenceItems[i] = MenuItem(
87
"Show no sequence labels", MenuItem::PUSHBUTTON, 'n', 0, 0,
88
PSStubs::ShowSequenceCB, (XtPointer)GetDiagramViewer(),
89
(XtPointer)0, 0, 1); i++;
90
diagramPSShowSequenceItems[i] = MenuItem(
91
"Update action sequences", MenuItem::PUSHBUTTON, 'a', 0, 0,
92
PSStubs::ShowSequenceCB, (XtPointer)GetDiagramViewer(),
93
(XtPointer)1, 0, 1); i++;
94
diagramPSShowSequenceItems[i] = MenuItem(
95
"Update process sequences", MenuItem::PUSHBUTTON, 'p', 0, 0,
96
PSStubs::ShowSequenceCB, (XtPointer)GetDiagramViewer(),
97
(XtPointer)2, 0, 1); i++;
98
diagramPSShowSequenceItems[i] = MenuItem();
101
viewItems = new MenuItem[25]; i=0;
102
viewItems[i] = MenuItem(
103
"Refresh", MenuItem::PUSHBUTTON, 'R', "Ctrl<Key>V", "Ctrl+V",
104
PSStubs::RefreshCB, (XtPointer)GetDiagramViewer(),
106
viewItems[i] = MenuItem(
107
"Grid", MenuItem::SUBMENU, 'G', 0, 0,
108
0, 0, 0, gridItems, 1); i++;
109
viewItems[i] = MenuItem("", MenuItem::SEPARATOR); i++;
110
viewItems[i] = MenuItem(
111
"Autoresizing", MenuItem::CHECKBUTTON, 'A', 0, 0,
112
PSStubs::SetAutoResizeCB, (XtPointer)GetDocument(),
113
(XtPointer)1, 0, 1); i++;
114
viewItems[i] = MenuItem(
115
"In-line Editor", MenuItem::CHECKBUTTON, 'E', 0, 0,
116
PSStubs::SetInlineEditCB, (XtPointer)GetDocument(),
117
(XtPointer)1, 0, 1); i++;
118
viewItems[i] = MenuItem("", MenuItem::SEPARATOR); i++;
119
viewItems[i] = MenuItem(
120
"Update Sequence Labels", MenuItem::SUBMENU, 'O', 0, 0,
121
0, 0, 0, diagramPSShowSequenceItems, 1); i++;
122
viewItems[i] = MenuItem();