COIN-OR::LEMON - Graph Library

source: glemon-0.x/nbtab.h @ 174:95872af46fc4

Last change on this file since 174:95872af46fc4 was 174:95872af46fc4, checked in by Alpar Juttner, 17 years ago

Add copyright headers

File size: 8.5 KB
1/* -*- C++ -*-
2 *
3 * This file is a part of LEMON, a generic C++ optimization library
4 *
5 * Copyright (C) 2003-2006
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 *
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
12 *
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
15 * purpose.
16 *
17 */
19#ifndef NBTAB_H
20#define NBTAB_H
22class NoteBookTab;
24#include "mapstorage.h"
25#include "map_win.h"
26#include "design_win.h"
27#include "graph_displayer_canvas.h"
28#include <libgnomecanvasmm.h>
29#include <libgnomecanvasmm/polygon.h>
31///One tab in the Notebook that is placed in the main window (\ref MainWin).
33///One graph and all of its accessories like maps are assigned to one tab in the notebook.
34///\ref NoteBookTab is responsible for the user defined display of the graph: view can be
35///set by visualized maps, therefore \ref NoteBookTab must provide an interface to set the
36///view of graph. This is \ref Mapwin window.
38///\ref NoteBookTab is also
39///responsible for modify the graph if it is
40///requested. Therefore it is responsible for translating user events to modifications to
41///do on graph, like node/edge addition/deletion, map modification, addition and so on.
43///To be able to solve these tasks the help of \ref MainWin is also needed, for example to
44///know which editor-tool is active at the moment. Therefore \ref MainWin knows \ref NoteBookTab.
46///Some information in the other direction is needed as well: for example when new map creation is requested for this tab
47///\ref NoteBookTab must ask \ref MainWin to pop-up a \ref NewMapWin. Communication in this direction is realized by signals
48///therefore \ref NoteBookTab does not know \ref MainWin at all, but in this way it is not necessary.
49class NoteBookTab : public Gtk::VBox
53  ///Constructor of \ref NoteBookTab
55  ///It initiates the \re GraphDisplayerCanvas, on which the graph will be drawn
56  ///Signals of \ref MapStorage will be bound to the appropriate callback functions here.
57  NoteBookTab();
59  ///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook.
60  MapStorage mapstorage;
62  ///Title changement indicator.
64  ///If graph is loaded from disk or saved to disk or changed its name somehow
65  ///this signal will be emit to let
66  ///\ref MainWin know that it has to modify the title of the main window.
67  ///It contains the new title.
68  sigc::signal<void, std::string> signal_title;
70  ///Returns \ref signal_title to be the caller able to connect it to a callback function.
71  sigc::signal<void, std::string> signal_title_ch();
73  ///Indicates that new map window should be popped up.
75  ///\ref NoteBookTab can ask \ref MainWin to pop up a \ref NweMapWin ny emitting this signal.
76  ///The signal contains whether an edgemap or a nodemap should be popped up. \ref NewMapWin
77  ///is not popped up by \ref NoteBookTab, because not only \ref NoteBookTab needs \ref NewMapWin,
78  ///but for example \ref MainWin and \ref AlgoWin s as well.
79  sigc::signal<void, NoteBookTab *, bool> signal_newmap;
81  ///Returns \ref signal_newmap to be the caller able to connect it to a callback function.
82  sigc::signal<void, NoteBookTab *, bool> signal_newmap_needed();
84  ///Loads the given file.
86  ///The given file will be load in the \ref MapStorage and afeter that
87  ///\ref GraphDisplayerCanvas will be requested to display the graph.
88  ///\ref GraphDisplayer will get datas from the recently set \ref MapStorage.
89  void readFile(const std::string &);
91  ///The graph will be drawn on this \ref GraphDisplayerCanvas
92  GraphDisplayerCanvas * gd_canvas;
94  ///Indicates whether the \ref MapWin is opened or not. See \ref mapwin.
95  bool mapwinexists;
97  ///Indicates whether the \ref DesignWin is opened or not. See \ref designwin.
98  bool designwinexists;
100  ///Address of the only \ref MapWin that the \ref NoteBookTab can open.
102  ///Only one of this window can be opened at the same time (\ref mapwinexists),
103  ///because there is no need for more, one per tab is enough.
104  ///There won1t be benefit of more than one, but it would be
105  ///more complicated to synchronize them.
106  MapWin * mapwin;
108  ///Address of the only \ref DesignWin that the \ref NoteBookTab can open.
110  ///Only one of this window can be opened at the same time (\ref designwinexists),
111  ///because there is no need for more, one per tab is enough.
112  ///There won't be benefit of more than one, but it would be
113  ///more complicated to synchronize them.
114  DesignWin * designwin;
117  ///Callback for 'FileNew' action.
118  virtual void newFile();
119  ///Callback for 'FileOpen' action.
120  virtual void openFile();
121  ///Callback for 'FileSave' action.
122  virtual void saveFile();
123  ///Callback for 'FileSaveAs' action.
124  virtual void saveFileAs();
125  ///Callback for 'Close' action.
126  virtual void close();
128  ///Handles changement of view of graph.
130  ///If the user changes the map to show by a property to a nother in \ref MapWin,
131  ///\ref MapWin will call this function. This function will registrate in \ref MapStorage
132  ///the new map to display by the changed property. After that \ref MapStorage will
133  ///emits a signal that will be forwarded to \ref GraphDisplayerCanvas to update the
134  ///appropriate parts of graph.
135  ///\param itiesedge whether the changed property is edge property or node property
136  ///\param prop id of property, see all_include.h
137  ///\param mapname name of the recently selected map
138  void propertyChange(bool itisedge, int prop, std::string mapname);
140  ///Emits a signal that request \ref MainWin to pop up \ref NewMapWin
142  ///This function is called by \ref MapWin.
143  ///\param itisedge whether the new map should be an edgemap or a nodemap.
144  void popupNewMapWin(bool itisedge);
146  ///Returns the actually selected edgemap to visualize by the given property.
148  ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage.
149  ///\param prop property to inquire.
150  std::string getActiveEdgeMap(int prop);
152  ///Returns the actually selected nodemap to visualize by the given property.
154  ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage.
155  ///\param prop property to inquire.
156  std::string getActiveNodeMap(int prop);
158  ///Registers recently created edgemap in \ref MapWin.
160  ///After creation of new map \ref MapStorage emits a signal.
161  ///This signal is bound to this callback function, that will call
162  ///a function with the same name and same parameterin \ref MapWin.
163  ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin
164  ///\param mapname name of new map
165  void registerNewEdgeMap(std::string mapname);
167  ///Registers recently created nodemap in \ref MapWin.
169  ///After creation of new map \ref MapStorage emits a signal.
170  ///This signal is bound to this callback function, that will call
171  ///a function with the same name and same parameter in \ref MapWin.
172  ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin
173  ///\param mapname name of new map
174  void registerNewNodeMap(std::string mapname);
176  ///Pops up and registrates the \ref MapWin of \ref NoteBookTab.
178  ///See also
179  ///\ref mapwin.
180  void createMapWin(std::string);
182  ///Pops up and registrates the \ref DesignWin of \ref NoteBookTab.
184  ///See also
185  ///\ref mapwin.
186  void createDesignWin(std::string);
188  ///Closes and deregistrates the \ref MapWin of \ref NoteBookTab.
190  ///See also
191  ///\ref mapwin.
192  void closeMapWin();
194  bool closeDesignWin(GdkEventAny *);
196  ///Sets node representation settings
197  void setView(bool, bool, double, double);
199  ///Gets node representation settings
200  void getView(bool &, bool &, double&, double&);
202  ///Let the graph redesign, based on gravity and edge elasticity.
203  void reDesignGraph();
205  ///Indicates that attraction factor is changed
206  void attraction_ch(double);
208  ///Indicates that propulsation factor is changed
209  void propulsation_ch(double);
211  ///Indicates that iteration number of redesign is changed
212  void iteration_ch(int);
214  ///\ref MapWin calls this function when it updates the maplist in comboboxes.
215  void active_maps_needed();
218  ///Signal connection from \ref MapStorage to \ref MapWin
220  ///If \ref MapWin is closed this connection has to be disconnected,
221  ///therefore we have to store it.
222  sigc::connection mapst2mapwin;
225#endif //NBTAB_H
Note: See TracBrowser for help on using the repository browser.