Fix icc compilation failures.
6 #include "all_include.h"
9 #include "new_map_win.h"
11 #include <libgnomecanvasmm.h>
12 #include <libgnomecanvasmm/polygon.h>
15 ///This class is the main window of GUI.
17 ///It has menus, and a notebook. Notebook has different pages,
18 ///the so called tabs (\ref NoteBookTab). Each \ref NoteBookTab contains a canvas on which graphs can be drawn.
19 ///To manage creation and close of tabs and tabswitching is the task of MainWin.
20 class MainWin : public Gtk::Window
22 ///Container in which the menus and the notebook is.
25 ///The notebook that has tabs (\ref NoteBookTab) with different graphs.
26 Gtk::Notebook notebook;
28 ///The tool selected to manipulate graph.
30 ///It has to be stored, because in case of tabswitching
31 ///the correct tool has to be set for the actual graph.
34 ///The number of active tab in the notebook.
37 ///Vector of existing tabs in the notebook.
38 std::vector<NoteBookTab *> tabs;
40 ///Vector of the name of tabs.
42 ///All \ref NoteBookTab has a name that is stored here. The index of the name
43 ///is the same as the index of the \ref NoteBookTab in \ref tabs.
44 std::vector<std::string> tabnames;
46 ///Counter of occurence of the same file names.
48 ///If a file is opened more than once we have to score
49 ///the occurences to let the titles on tabs different.
50 ///If more than one occurence is present, from the second
51 ///one near the filename the number of the occurence appear.
52 std::map<std::string, int> strinst;
54 ///Set of opened \ref AlgoWin s.
56 ///More than one \refAlgoWin can be opened. We have to
57 ///communicate with them in case of new \ref NoteBookTab creation,
58 ///\ref NoteBookTab close, or map change. Therefore we have to score
60 std::set< AlgoWin* > aws;
64 ///Constructor of the \ref MainWin.
66 ///It creates the menus, the toolbar and the notebook in which
67 ///\ref NoteBookTab s take place. \ref NoteBookTab s are the
68 ///holder of the canvases on which the graphs are drawn.
71 ///Sets title of tabs.
73 ///It alse registrates it in \ref tabnames. If more than one
74 ///occurence is in the notebook of the same file it has to
75 ///extend tabname with the number of occurence.
76 void set_tabtitle(std::string);
78 ///ActionGroup for menu
79 Glib::RefPtr<Gtk::ActionGroup> ag;
82 Glib::RefPtr<Gtk::UIManager> uim;
84 ///Creates a new \ref NoteBookTab and opens the given file.
86 ///It is called only with command line parameters at stratup.
87 void readFile(const std::string &);
90 Gtk::Tooltips tooltips;
92 //Call-backs of buttons
94 ///Callback for 'FileNew' action.
95 virtual void newFile();
96 ///Callback for 'FileOpen' action.
97 virtual void openFile();
98 ///Callback for 'FileSave' action.
99 virtual void saveFile();
100 ///Callback for 'FileSaveAs' action.
101 virtual void saveFileAs();
102 ///Callback for 'Close' action.
103 virtual void close();
107 ///Callback for 'zoomIn' action.
109 ///It calls the appropriate function in
110 ///\ref GraphDisplayerCanvas
111 virtual void zoomIn();
112 ///Callback for 'zoomOut' action.
114 ///It calls the appropriate function in
115 ///\ref GraphDisplayerCanvas
116 virtual void zoomOut();
117 ///Callback for 'zoomFit' action.
119 ///It calls the appropriate function in
120 ///\ref GraphDisplayerCanvas
121 virtual void zoomFit();
122 ///Callback for 'zoom100' action.
124 ///It calls the appropriate function in
125 ///\ref GraphDisplayerCanvas
126 virtual void zoom100();
128 ///Callback for Show Maps menupoint.
130 ///It calls the appropriate function in
132 virtual void createMapWin();
134 ///Pops up an Algorithm window.
136 ///It not only creates but registrates the newly created \ref AlgoWin.
137 ///It is necessary, because in case of changement between tabs or maps
138 ///we have to communicate with it. Signals are also have to be connected
139 ///to it, because \ref AlgoWin emits signals if it needs anything (maplist, deregistration).
140 ///\param algo type of the algorithm to run.
141 virtual void createAlgoWin(int algo);
143 ///Deregisters AlgoWin
145 ///This is the function connected to the closing signal of \ref AlgoWin.
146 ///It only deletes the sender \ref AlgoWin from \ref aws. This function
147 ///is called only by the closing \ref AlgoWin itself.
148 ///\param aw the \ref AlgoWin to delete.
149 virtual void deRegisterAlgoWin(AlgoWin * aw);
151 ///Updates list of tabs in all of the \ref AlgoWin
153 ///When \ref NoteBookTab inserted somewhere or closed one tablist in all \ref AlgoWin
154 ///have to be updated. That is why we score all the opened \ref AlgoWin.
155 ///During update \ref tabnames will be passed to each \ref AlgoWin.
156 virtual void updateAlgoWinTabs();
158 ///Refresh list of maps in the AlgoWin that requested it.
160 ///In an \ref AlgoWin there is a ComboBoxText, in which
161 ///a \ref NoteBookTab can be chosen that contains the graph and the maps,
162 ///on which we would like to run algorithms. If we change the
163 ///tab the available maps also have to be updated, because
164 ///in the different tabs different maps are available. Therefore
165 ///on tab change the \ref AlgoWin emits a signal that contains itself
166 ///so that the appropriate maps can be sent to it. For the sake of simplicity
167 ///the program answers this call with the mapstorage of the newly selected tab.
168 ///\param aw the caller \ref AlgoWin
169 ///\param tabname the newly selected tab in the \ref AlgoWin
170 virtual void updateAlgoWinMaps(AlgoWin * aw, std::string tabname);
172 ///Registrates the new graph-editor tool in hand.
174 ///The editor-tool in hand is global, it is the same for all tab
175 ///at the same time. Therefore the active tool has to be scored here (\ref active_tool).
176 ///This function is the callback function of the editor-tool buttons. It sets \ref active_tool
177 ///to the correct value.
178 ///\param tool the newly selected graph-editor tool (See all_include.h)
179 virtual void changeEditorialTool(int tool);
181 ///Pops up a \ref NewMapWin dialog after requested by a \ref MapWin
183 ///Each tab can pop-up a \ref MapWin. In \ref MapWin new tab can be created.
184 ///In this case \ref NoteBookTab emits a signal. This function is connected to that signal.
185 ///It sends the caller \ref NoteBookTab and whether an edgemap or a nodemap should be created.
186 ///Caller \ref NoteBookTab is necessary for the window to be able to place the new map in its
188 ///\param nbt the caller tab
189 ///\param itisedge true if edgemap has to be created, false if nodemap
190 virtual void createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge);
192 ///Pops up a \ref NewMapWin dialog after requested by an \ref AlgoWin
194 ///\ref AlgoWin can also can request a \ref NewMapWin to pop-up.
195 ///It emits a signal in this case. This function is bound to that signal.
196 ///The signal contains the name of \ref NoteBookTab in which the new map has to be
197 ///placed and whether the new map is an edgemap or a nodemap.
198 ///\ref tabname the tab in which the new map has to be placed
199 ///\ref itisedge true if the new map will be edge map, false if it will be nodemap
200 virtual void createNewMapWinTabString(std::string tabname, bool itisedge);
202 ///Pops up a \ref NewMapWin dialog if button on \ref MainWin has been pressed.
204 ///In this case a general \ref NewMapWin will be popped up. This means that
205 ///both edge and nodemap can be created by it. The new map will be placed in
206 ///\MapStorage of the actual selected \ref NoteBookTab.
207 virtual void createNewMapWin();
210 ///Callback for 'FileNewTab' action.
211 virtual void newTab();
213 ///Callback for 'FileCloseTab' action.
215 ///It closes the actual \ref NoteBookTab and registrates this event:
216 ///data is shifted to the correct places in vectors.
217 virtual void closeTab();
219 ///Tabswitching handler
221 ///Sets the variables that have to store the actual state, and it
222 ///updates the title of window to the actually selected \ref NoteBookTab.
223 virtual void onChangeTab(GtkNotebookPage*, guint);