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

« back to all changes in this revision

Viewing changes to src/sd/fv/dcfwindow.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 "dcfwindow.h"
 
23
#include "dcfdiagram.h"
 
24
#include "dcfviewer.h"
 
25
#include "dcfgraph.h"
 
26
#include "dcfstubs.h"
 
27
#include "menu.h"
 
28
 
 
29
// X bitmap data for the tiled buttons
 
30
#include "Arrow.xbm"
 
31
#include "HorizontalBar.xbm"
 
32
#include "TopLabeledCircle.xbm"
 
33
#include "DashedTopLabeledCircle.xbm"
 
34
#include "DashedHorizontalBar.xbm"
 
35
#include "DoubleArrow.xbm"
 
36
#include "DashedArrow.xbm"
 
37
#include "DoubleHeadedArrow.xbm"
 
38
#include "DashedDoubleHeadedArrow.xbm"
 
39
#include "Comment.xbm"
 
40
#include "Square.xbm"
 
41
#include "BlackDot.xbm"
 
42
 
 
43
const char *DCFWindow::DCF_NODE_NAMES[] =  
 
44
        {"Data process", "Control process",
 
45
         "External entity", "Data store", 
 
46
         "Event Store", "Split/merge node", "Comment"};
 
47
const Bitmap DCFWindow::DCF_NODE_ICONS [] =
 
48
        {{TopLabeledCircle_width, TopLabeledCircle_height, TopLabeledCircle_bits},
 
49
        {DashedTopLabeledCircle_width, DashedTopLabeledCircle_height, 
 
50
         DashedTopLabeledCircle_bits},
 
51
        {Square_width, Square_height, Square_bits},
 
52
        {HorizontalBar_width, HorizontalBar_height, HorizontalBar_bits},
 
53
        {DashedHorizontalBar_width, DashedHorizontalBar_height, 
 
54
         DashedHorizontalBar_bits},
 
55
        {BlackDot_width, BlackDot_height, BlackDot_bits},
 
56
        {Comment_width, Comment_height, Comment_bits}};
 
57
 
 
58
const char *DCFWindow::DCF_EDGE_NAMES[] =  
 
59
        {"Discrete data flow", "Discrete Event flow", 
 
60
         "Bidirectional discrete data flow", "Continuous data flow",
 
61
         "Continuous event flow" };
 
62
const Bitmap DCFWindow::DCF_EDGE_ICONS [] =
 
63
        {{Arrow_width, Arrow_height, Arrow_bits},
 
64
         {DashedArrow_width, DashedArrow_height, DashedArrow_bits},
 
65
         {DoubleArrow_width, DoubleArrow_height, DoubleArrow_bits},
 
66
         {DoubleHeadedArrow_width, DoubleHeadedArrow_height, 
 
67
          DoubleHeadedArrow_bits},
 
68
         {DashedDoubleHeadedArrow_width, DashedDoubleHeadedArrow_height, 
 
69
          DashedDoubleHeadedArrow_bits}};
 
70
 
 
71
DCFWindow::DCFWindow(const char *n): DFWindow(n) { }
 
72
 
 
73
DiagramViewer *DCFWindow::CreateViewer(Config *cfg) {
 
74
        return new DCFViewer(cfg, this);
 
75
}
 
76
 
 
77
Graph *DCFWindow::CreateGraph() {
 
78
        return new DCFGraph();
 
79
}
 
80
 
 
81
Diagram *DCFWindow::CreateDiagram(Config *c, DiagramViewer *v, Graph *g) {
 
82
         return new DCFDiagram(c, this, (DCFViewer *)v, (DCFGraph *)g);
 
83
}
 
84
 
 
85
void DCFWindow::DetermineIcons() {
 
86
         nodeNames = DCF_NODE_NAMES;
 
87
         nodeIcons = DCF_NODE_ICONS;
 
88
         edgeNames = DCF_EDGE_NAMES;
 
89
         edgeIcons = DCF_EDGE_ICONS;
 
90
         nrNodes = XtNumber(DCF_NODE_NAMES);
 
91
         nrEdges = XtNumber(DCF_EDGE_NAMES);
 
92
}
 
93
 
 
94
void DCFWindow::InitMenuItems() {
 
95
        DiagramWindow::InitMenuItems();
 
96
        int i=0;
 
97
        dfdItems = new MenuItem[25]; i=0;
 
98
        dfdItems[i] = MenuItem(
 
99
                "Minispec...", MenuItem::PUSHBUTTON, 'M', 0, 0,
 
100
                DCFStubs::MinispecCB, (XtPointer)GetDiagramViewer(), 0, 0, 1); i++;
 
101
        dfdItems[i] = MenuItem(
 
102
                "Persistence...", MenuItem::PUSHBUTTON, 'P', 0, 0,
 
103
                DCFStubs::PersistenceCB, (XtPointer)GetDiagramViewer(), 0, 0, 1); i++;
 
104
        dfdItems[i] = MenuItem(
 
105
                "Activation mechanism...", MenuItem::PUSHBUTTON, 'A', 0, 0,
 
106
                DCFStubs::ActivationCB, (XtPointer)GetDiagramViewer(), 0, 0, 1); i++;
 
107
        dfdItems[i] = MenuItem::NUL;
 
108
}