~ubuntu-branches/ubuntu/intrepid/tcm/intrepid

« back to all changes in this revision

Viewing changes to src/sd/bv/atwindow.c

  • Committer: Bazaar Package Importer
  • Author(s): Otavio Salvador
  • Date: 2003-07-03 20:08:21 UTC
  • Revision ID: james.westby@ubuntu.com-20030703200821-se4xtqx25e5miczi
Tags: upstream-2.20
ImportĀ upstreamĀ versionĀ 2.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////////////////////////////////////////////////////////////////////////////////
 
2
//
 
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).
 
7
//
 
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.
 
12
//
 
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.
 
17
//
 
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
 
21
// 02111-1307, USA.
 
22
////////////////////////////////////////////////////////////////////////////////
 
23
#include "atwindow.h"
 
24
#include "atdiagram.h"
 
25
#include "atviewer.h"
 
26
#include "atgraph.h"
 
27
#include "menu.h"
 
28
#include "diagramstubs.h"
 
29
 
 
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"
 
40
#include "Arrow.xbm"
 
41
#include "DottedLine.xbm"
 
42
 
 
43
const char *ATWindow::AT_NODE_NAMES[] =  
 
44
        {"Action state", 
 
45
         "Decision", 
 
46
         "Horizontal synchronization bar",
 
47
         "Start state",
 
48
         "Comment",
 
49
         "Inactive state", 
 
50
         "Note",
 
51
         "Vertical synchronization bar",
 
52
         "End state"};
 
53
 
 
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}};
 
66
 
 
67
const char *ATWindow::AT_EDGE_NAMES[] = 
 
68
        {"Control flow",
 
69
         "Note connector"};
 
70
const Bitmap ATWindow::AT_EDGE_ICONS [] =
 
71
        {{Arrow_width, Arrow_height, Arrow_bits},
 
72
         {DottedLine_width, DottedLine_height, DottedLine_bits}};
 
73
 
 
74
ATWindow::ATWindow(const char *n): DiagramWindow(n) {}
 
75
 
 
76
DiagramViewer *ATWindow::CreateViewer(Config *cfg) {
 
77
        return new ATViewer(cfg, this);
 
78
}
 
79
 
 
80
Graph *ATWindow::CreateGraph() {
 
81
        return new ATGraph();
 
82
}
 
83
 
 
84
Diagram *ATWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
 
85
         return new ATDiagram(c, this, (ATViewer *)v, (ATGraph *)g);
 
86
}
 
87
 
 
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);
 
95
}
 
96
 
 
97
void ATWindow::InitMenuItems() {
 
98
        DiagramWindow::InitMenuItems();
 
99
        int i = 0;
 
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;
 
114
 
 
115
        int j = 0;
 
116
        while (editItems[j++].label != 0)
 
117
                ;
 
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;
 
123
 
 
124
        int k = 0;
 
125
        while (popupEditItems[k++].label != 0)
 
126
                ;
 
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;
 
132
}