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

« back to all changes in this revision

Viewing changes to src/dg/diagramwindow.h

  • 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 1995, 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
#ifndef _DIAGRAMWINDOW_H
 
23
#define _DIAGRAMWINDOW_H
 
24
 
 
25
#include "bitmap.h"
 
26
#include "drawwindow.h"
 
27
#include "drawingarea.h"
 
28
class DiagramViewer;
 
29
class Diagram;
 
30
class Graph;
 
31
 
 
32
/// edit window class that is common to all diagram editors.
 
33
class DiagramWindow: public DrawWindow {
 
34
/*@Doc: {\large {\bf scope:} diagram} */
 
35
public:
 
36
        ///
 
37
        DiagramWindow(const char *name);
 
38
        ///
 
39
        virtual ~DiagramWindow();
 
40
 
 
41
        /// Show in status that node type n is selected.
 
42
        void SetNodeName(int n);
 
43
 
 
44
        /// Show in status that edge type n is selected.
 
45
        void SetEdgeName(int n);
 
46
 
 
47
        /// set hierarchic document toggle.
 
48
        virtual void SetHierarchic(bool s);
 
49
protected:
 
50
        /// points to the names of the node shapes. 
 
51
        const char** nodeNames; 
 
52
        /// points to the names of the edge shapes. 
 
53
        const char** edgeNames; 
 
54
        ///
 
55
        int nrNodes;
 
56
        ///
 
57
        int nrEdges;
 
58
 
 
59
        /// List of Icons for the "Nodes" tiled buttons.
 
60
        const Bitmap *nodeIcons; 
 
61
        /// List of Icons for the "Edges" tiled buttons.
 
62
        const Bitmap *edgeIcons; 
 
63
 
 
64
        /// create menu bar
 
65
        Widget CreateMenuBar(Widget parent);
 
66
 
 
67
        /// created tiled buttons.
 
68
        virtual Widget CreateTiles(Widget parent);
 
69
 
 
70
        ///
 
71
        void CreateNodeIcons(Widget parent);
 
72
        ///
 
73
        void CreateEdgeIcons(Widget parent);
 
74
        ///
 
75
        void CreateIndexToggle(Widget parent);
 
76
 
 
77
        ///
 
78
        DiagramViewer *GetDiagramViewer() const {return viewer;}
 
79
 
 
80
        ///
 
81
        void SetShowLineStyleOptionMenu(bool b) {
 
82
                showLineStyleOptionMenu = b;}
 
83
        ///
 
84
        Widget GetNodeIconsRC() const {return nodeIconsRC;}
 
85
        ///
 
86
        Widget GetEdgeIconsRC() const {return edgeIconsRC;}
 
87
        ///
 
88
        void CreateLineStyleOptionMenu(Widget w, bool nodes, bool minimize);
 
89
 
 
90
        ///
 
91
        void InitMenuItems();
 
92
private:
 
93
        ///
 
94
        DiagramViewer *viewer;
 
95
 
 
96
        /// parse the command line options.
 
97
        void ParseUserOptions(int argc, char** argv);
 
98
 
 
99
        ///
 
100
        void WriteUsage(const char *prog);
 
101
 
 
102
        /// initialize window: create menubar, tiles, scrolled window, etc
 
103
        void CreateComponents(Widget window);
 
104
 
 
105
        ///
 
106
        virtual Menu *BuildViewMenu(Widget bar);
 
107
 
 
108
        /// Motif RowColumn widget containing tiled buttons.
 
109
        Widget tiles;
 
110
 
 
111
        ///
 
112
        void Finalize();
 
113
        ///
 
114
        void CreateDocument();
 
115
        ///
 
116
        virtual DiagramViewer *CreateViewer(Config *c) = 0;
 
117
        ///
 
118
        virtual Graph *CreateGraph() = 0;
 
119
        ///
 
120
        virtual Diagram *CreateDiagram(
 
121
                Config *c, DiagramViewer *v, Graph *g) = 0;
 
122
 
 
123
        /// Determine icon lists to be used for the window.
 
124
        virtual void DetermineIcons() = 0;
 
125
 
 
126
        ///
 
127
        void GetNodeName(int i, string *name);
 
128
        ///
 
129
        void GetEdgeName(int i, string *name);
 
130
 
 
131
        ///
 
132
        static const Bitmap CURVE_ICON;
 
133
        ///
 
134
        static const Bitmap SOLID_LINE_ICON;
 
135
        ///
 
136
        static const Bitmap DASHED_LINE_ICON;
 
137
        ///
 
138
        static const Bitmap DOTTED_LINE_ICON;
 
139
 
 
140
        ///
 
141
        Widget edgeIconsRC;
 
142
        ///
 
143
        Widget nodeIconsRC;
 
144
        ///
 
145
        int iconColumns;
 
146
        ///
 
147
        bool showLineStyleOptionMenu;
 
148
protected:
 
149
        ///
 
150
        virtual bool ShowIndexToggle() {return False;}
 
151
        ///
 
152
        void CalcIconColumns();
 
153
        ///
 
154
        int GetIconsScrollHeight(int rows);
 
155
        ///
 
156
        Menu *gridMenu;
 
157
        ///
 
158
        MenuItem *diagramAlignItems;
 
159
        ///
 
160
        MenuItem *defPropertiesItems;
 
161
        ///
 
162
        MenuItem *gridItems;
 
163
        ///
 
164
        MenuItem *nodeLineStyleItems;
 
165
        ///
 
166
        MenuItem *edgeLineStyleItems;
 
167
        ///
 
168
        MenuItem *updateNodeShapeTypeItems;
 
169
};
 
170
#endif