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

« back to all changes in this revision

Viewing changes to src/sd/bv/pswindow.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 "pswindow.h"
 
23
#include "psdiagram.h"
 
24
#include "psviewer.h"
 
25
#include "psstubs.h"
 
26
#include "psgraph.h"
 
27
#include "menu.h"
 
28
#include <Xm/XmAll.h>
 
29
// X bitmap data for the tiled buttons
 
30
#include "Box.xbm"
 
31
#include "EmptyLine.xbm"
 
32
#include "Comment.xbm"
 
33
 
 
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}};
 
38
 
 
39
const char *PSWindow::PS_EDGE_NAMES[] = {"Empty edge"};
 
40
const Bitmap PSWindow::PS_EDGE_ICONS [] =
 
41
         {{EmptyLine_width, EmptyLine_height, EmptyLine_bits}};
 
42
 
 
43
PSWindow::PSWindow(const char *n): DiagramWindow(n) { 
 
44
        diagramPSShowSequenceItems = 0;
 
45
}
 
46
 
 
47
PSWindow::~PSWindow(){ 
 
48
        if (diagramPSShowSequenceItems)
 
49
                delete diagramPSShowSequenceItems;
 
50
}
 
51
 
 
52
DiagramViewer *PSWindow::CreateViewer(Config *cfg) {
 
53
        return new PSViewer(cfg, this);
 
54
}
 
55
 
 
56
Graph *PSWindow::CreateGraph() {
 
57
        return new PSGraph();
 
58
}
 
59
 
 
60
Diagram *PSWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
 
61
         return new PSDiagram(c, this, (PSViewer *)v, (PSGraph *)g);
 
62
}
 
63
 
 
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);
 
71
}
 
72
 
 
73
//Widget PSWindow::CreateMenuBar(Widget parent) {
 
74
//      Widget bar = DiagramWindow::CreateMenuBar(parent);
 
75
//      // make the duplicate item insensitive.
 
76
//      Widget w1 = editMenu->GetMenuItem("Duplicate");
 
77
//      if (w1)
 
78
//              XtVaSetValues(w1, XmNsensitive, False, 0);
 
79
//      return bar;
 
80
//}
 
81
 
 
82
void PSWindow::InitMenuItems() {
 
83
        DiagramWindow::InitMenuItems();
 
84
        int i=0;
 
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();
 
99
 
 
100
        delete viewItems;
 
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(), 
 
105
                0, 0, 1); i++;
 
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();
 
123
}