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

« back to all changes in this revision

Viewing changes to src/sd/bv/rpwindow.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 1996, Vrije Universiteit Amsterdam.
 
5
// Author: Frank Dehne (frank@cs.vu.nl).
 
6
//
 
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.
 
11
//
 
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.
 
16
//
 
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
 
20
// 02111-1307, USA.
 
21
////////////////////////////////////////////////////////////////////////////////
 
22
#include "rpwindow.h"
 
23
#include "rpdiagram.h"
 
24
#include "rpviewer.h"
 
25
#include "rpgraph.h"
 
26
#include "menu.h"
 
27
#include "diagramstubs.h"
 
28
 
 
29
// X bitmap data for the tiled buttons
 
30
#include "Dot.xbm"
 
31
#include "MiniArrowEllipse.xbm"
 
32
#include "Arrow.xbm"
 
33
#include "Comment.xbm"
 
34
#include "RoundedBox.xbm"
 
35
 
 
36
const char *RPWindow::RP_NODE_NAMES[] =
 
37
        {"Root node", "Unlabeled node", "Labeled Node", "Comment"};
 
38
 
 
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}};
 
44
 
 
45
const char *RPWindow::RP_EDGE_NAMES[] = {"Event"};
 
46
const Bitmap RPWindow::RP_EDGE_ICONS [] =
 
47
        {{Arrow_width, Arrow_height, Arrow_bits}};
 
48
 
 
49
RPWindow::RPWindow(const char *n): DiagramWindow(n) {
 
50
}
 
51
 
 
52
DiagramViewer *RPWindow::CreateViewer(Config *cfg) {
 
53
        return new RPViewer(cfg, this);
 
54
}
 
55
 
 
56
Graph *RPWindow::CreateGraph() {
 
57
        return new RPGraph();
 
58
}
 
59
 
 
60
Diagram *RPWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
 
61
         return new RPDiagram(c, this, (RPViewer *)v, (RPGraph *)g);
 
62
}
 
63
 
 
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);
 
71
}
 
72
 
 
73
 
 
74
void RPWindow::InitMenuItems() {
 
75
        DiagramWindow::InitMenuItems();
 
76
        int i = 0;
 
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;
 
89
 
 
90
        // add menu for converting node shapes.
 
91
        int j = 0;
 
92
        while (editItems[j++].label != 0)
 
93
                ;
 
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;
 
99
        int k = 0;
 
100
        while (popupEditItems[k++].label != 0)
 
101
                ;
 
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;
 
107
}