1.1 --- a/main_win.h Tue Jan 10 15:15:57 2006 +0000
1.2 +++ b/main_win.h Wed Jan 11 15:06:17 2006 +0000
1.3 @@ -13,30 +13,66 @@
1.4
1.5
1.6 ///This class is the main window of GUI.
1.7 -///It has menus, but the main part of it is the canvas.
1.8 +
1.9 +///It has menus, and a notebook. Notebook has different pages,
1.10 +///the so called tabs (\ref NoteBookTab). Each \ref NoteBookTab contains a canvas on which graphs can be drawn.
1.11 +///To manage creation and close of tabs and tabswitching is the task of MainWin.
1.12 class MainWin : public Gtk::Window
1.13 {
1.14 - ///Container
1.15 + ///Container in which the menus and the notebook is.
1.16 Gtk::VBox vbox;
1.17
1.18 + ///The notebook that has tabs (\ref NoteBookTab) with different graphs.
1.19 Gtk::Notebook notebook;
1.20
1.21 + ///The tool selected to manipulate graph.
1.22 +
1.23 + ///It has to be stored, because in case of tabswitching
1.24 + ///the correct tool has to be set for the actual graph.
1.25 int active_tool;
1.26
1.27 + ///The number of active tab in the notebook.
1.28 int active_tab;
1.29 +
1.30 + ///Vector of existing tabs in the notebook.
1.31 std::vector<NoteBookTab *> tabs;
1.32 +
1.33 + ///Vector of the name of tabs.
1.34 +
1.35 + ///All \ref NoteBookTab has a name that is stored here. The index of the name
1.36 + ///is the same as the index of the \ref NoteBookTab in \ref tabs.
1.37 std::vector<std::string> tabnames;
1.38
1.39 + ///Counter of occurence of the same file names.
1.40 +
1.41 + ///If a file is opened more than once we have to score
1.42 + ///the occurences to let the titles on tabs different.
1.43 + ///If more than one occurence is present, from the second
1.44 + ///one near the filename the number of the occurence appear.
1.45 std::map<std::string, int> strinst;
1.46
1.47 + ///Set of opened \ref AlgoWin s.
1.48 +
1.49 + ///More than one \refAlgoWin can be opened. We have to
1.50 + ///communicate with them in case of new \ref NoteBookTab creation,
1.51 + ///\ref NoteBookTab close, or map change. Therefore we have to score
1.52 + ///their occurences.
1.53 std::set< AlgoWin* > aws;
1.54
1.55 public:
1.56
1.57 - ///Constructor of the \ref NoteBookTab. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn.
1.58 - ///\param title is the title of the window
1.59 + ///Constructor of the \ref MainWin.
1.60 +
1.61 + ///It creates the menus, the toolbar and the notebook in which
1.62 + ///\ref NoteBookTab s take place. \ref NoteBookTab s are the
1.63 + ///holder of the canvases on which the graphs are drawn.
1.64 MainWin();
1.65
1.66 + ///Sets title of tabs.
1.67 +
1.68 + ///It alse registrates it in \ref tabnames. If more than one
1.69 + ///occurence is in the notebook of the same file it has to
1.70 + ///extend tabname with the number of occurence.
1.71 void set_tabtitle(std::string);
1.72
1.73 ///ActionGroup for menu
1.74 @@ -45,6 +81,9 @@
1.75 ///UIManager for menu
1.76 Glib::RefPtr<Gtk::UIManager> uim;
1.77
1.78 + ///Creates a new \ref NoteBookTab and opens the given file.
1.79 +
1.80 + ///It is called only with command line parameters at stratup.
1.81 void readFile(const std::string &);
1.82
1.83 ///Tooltips
1.84 @@ -64,32 +103,124 @@
1.85 virtual void close();
1.86
1.87 //Toolbar
1.88 +
1.89 + ///Callback for 'zoomIn' action.
1.90 +
1.91 + ///It calls the appropriate function in
1.92 + ///\ref GraphDisplayerCanvas
1.93 virtual void zoomIn();
1.94 + ///Callback for 'zoomOut' action.
1.95 +
1.96 + ///It calls the appropriate function in
1.97 + ///\ref GraphDisplayerCanvas
1.98 virtual void zoomOut();
1.99 + ///Callback for 'zoomFit' action.
1.100 +
1.101 + ///It calls the appropriate function in
1.102 + ///\ref GraphDisplayerCanvas
1.103 virtual void zoomFit();
1.104 + ///Callback for 'zoom100' action.
1.105 +
1.106 + ///It calls the appropriate function in
1.107 + ///\ref GraphDisplayerCanvas
1.108 virtual void zoom100();
1.109
1.110 + ///Callback for Show Maps menupoint.
1.111 +
1.112 + ///It calls the appropriate function in
1.113 + ///\ref NoteBookTab
1.114 virtual void createMapWin();
1.115
1.116 - virtual void createAlgoWin(int);
1.117 - virtual void deRegisterAlgoWin(AlgoWin *);
1.118 + ///Pops up an Algorithm window.
1.119 +
1.120 + ///It not only creates but registrates the newly created \ref AlgoWin.
1.121 + ///It is necessary, because in case of changement between tabs or maps
1.122 + ///we have to communicate with it. Signals are also have to be connected
1.123 + ///to it, because \ref AlgoWin emits signals if it needs anything (maplist, deregistration).
1.124 + ///\param algo type of the algorithm to run.
1.125 + virtual void createAlgoWin(int algo);
1.126 +
1.127 + ///Deregisters AlgoWin
1.128 +
1.129 + ///This is the function connected to the closing signal of \ref AlgoWin.
1.130 + ///It only deletes the sender \ref AlgoWin from \ref aws. This function
1.131 + ///is called only by the closing \ref AlgoWin itself.
1.132 + ///\param aw the \ref AlgoWin to delete.
1.133 + virtual void deRegisterAlgoWin(AlgoWin * aw);
1.134 +
1.135 + ///Updates list of tabs in all of the \ref AlgoWin
1.136 +
1.137 + ///When \ref NoteBookTab inserted somewhere or closed one tablist in all \ref AlgoWin
1.138 + ///have to be updated. That is why we score all the opened \ref AlgoWin.
1.139 + ///During update \ref tabnames will be passed to each \ref AlgoWin.
1.140 virtual void updateAlgoWinTabs();
1.141 - virtual void updateAlgoWinMaps(AlgoWin *, std::string);
1.142
1.143 - virtual void changeEditorialTool(int);
1.144 + ///Refresh list of maps in the AlgoWin that requested it.
1.145
1.146 - virtual void createNewMapWinAfterSignal(NoteBookTab *, bool);
1.147 - virtual void createNewMapWinTabString(std::string, bool);
1.148 + ///In an \ref AlgoWin there is a ComboBoxText, in which
1.149 + ///a \ref NoteBookTab can be chosen that contains the graph and the maps,
1.150 + ///on which we would like to run algorithms. If we change the
1.151 + ///tab the available maps also have to be updated, because
1.152 + ///in the different tabs different maps are available. Therefore
1.153 + ///on tab change the \ref AlgoWin emits a signal that contains itself
1.154 + ///so that the appropriate maps can be sent to it. For the sake of simplicity
1.155 + ///the program answers this call with the mapstorage of the newly selected tab.
1.156 + ///\param aw the caller \ref AlgoWin
1.157 + ///\param tabname the newly selected tab in the \ref AlgoWin
1.158 + virtual void updateAlgoWinMaps(AlgoWin * aw, std::string tabname);
1.159 +
1.160 + ///Registrates the new graph-editor tool in hand.
1.161 +
1.162 + ///The editor-tool in hand is global, it is the same for all tab
1.163 + ///at the same time. Therefore the active tool has to be scored here (\ref active_tool).
1.164 + ///This function is the callback function of the editor-tool buttons. It sets \ref active_tool
1.165 + ///to the correct value.
1.166 + ///\param tool the newly selected graph-editor tool (See all_include.h)
1.167 + virtual void changeEditorialTool(int tool);
1.168 +
1.169 + ///Pops up a \ref NewMapWin dialog after requested by a \ref MapWin
1.170 +
1.171 + ///Each tab can pop-up a \ref MapWin. In \ref MapWin new tab can be created.
1.172 + ///In this case \ref NoteBookTab emits a signal. This function is connected to that signal.
1.173 + ///It sends the caller \ref NoteBookTab and whether an edgemap or a nodemap should be created.
1.174 + ///Caller \ref NoteBookTab is necessary for the window to be able to place the new map in its
1.175 + ///correct place.
1.176 + ///\param nbt the caller tab
1.177 + ///\param itisedge true if edgemap has to be created, false if nodemap
1.178 + virtual void createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge);
1.179 +
1.180 + ///Pops up a \ref NewMapWin dialog after requested by an \ref AlgoWin
1.181 +
1.182 + ///\ref AlgoWin can also can request a \ref NewMapWin to pop-up.
1.183 + ///It emits a signal in this case. This function is bound to that signal.
1.184 + ///The signal contains the name of \ref NoteBookTab in which the new map has to be
1.185 + ///placed and whether the new map is an edgemap or a nodemap.
1.186 + ///\ref tabname the tab in which the new map has to be placed
1.187 + ///\ref itisedge true if the new map will be edge map, false if it will be nodemap
1.188 + virtual void createNewMapWinTabString(std::string tabname, bool itisedge);
1.189 +
1.190 + ///Pops up a \ref NewMapWin dialog if button on \ref MainWin has been pressed.
1.191 +
1.192 + ///In this case a general \ref NewMapWin will be popped up. This means that
1.193 + ///both edge and nodemap can be created by it. The new map will be placed in
1.194 + ///\MapStorage of the actual selected \ref NoteBookTab.
1.195 virtual void createNewMapWin();
1.196
1.197 //Notebook handlers
1.198 ///Callback for 'FileNewTab' action.
1.199 virtual void newTab();
1.200 +
1.201 + ///Callback for 'FileCloseTab' action.
1.202 +
1.203 + ///It closes the actual \ref NoteBookTab and registrates this event:
1.204 + ///data is shifted to the correct places in vectors.
1.205 virtual void closeTab();
1.206 +
1.207 + ///Tabswitching handler
1.208 +
1.209 + ///Sets the variables that have to store the actual state, and it
1.210 + ///updates the title of window to the actually selected \ref NoteBookTab.
1.211 virtual void onChangeTab(GtkNotebookPage*, guint);
1.212 - virtual void onCloseTab();
1.213 -
1.214 -
1.215 };
1.216
1.217 #endif //MAIN_WIN_H