Documentation of MainWin.
authorhegyi
Wed, 11 Jan 2006 15:06:17 +0000
changeset 1889edcb68a93a95
parent 1888 eed01ce27087
child 1890 4a583e07d4b8
Documentation of MainWin.
gui/main_win.cc
gui/main_win.h
     1.1 --- a/gui/main_win.cc	Tue Jan 10 15:15:57 2006 +0000
     1.2 +++ b/gui/main_win.cc	Wed Jan 11 15:06:17 2006 +0000
     1.3 @@ -323,10 +323,6 @@
     1.4    set_title(tabnames[active_tab]);
     1.5  }
     1.6  
     1.7 -void MainWin::onCloseTab()
     1.8 -{
     1.9 -}
    1.10 -
    1.11  void MainWin::newFile()
    1.12  {
    1.13    if(active_tab!=-1)
    1.14 @@ -432,7 +428,6 @@
    1.15    for(;(i<(int)tabnames.size())&&(tabnames[i]!=tabname);i++)
    1.16      {
    1.17      }
    1.18 -  //awp->update_maplist(tabs[i]->mapstorage.getNodeMapList(),tabs[i]->mapstorage.getEdgeMapList());
    1.19    awp->update_maplist(&(tabs[i]->mapstorage));
    1.20  }
    1.21  
     2.1 --- a/gui/main_win.h	Tue Jan 10 15:15:57 2006 +0000
     2.2 +++ b/gui/main_win.h	Wed Jan 11 15:06:17 2006 +0000
     2.3 @@ -13,30 +13,66 @@
     2.4  
     2.5  
     2.6  ///This class is the main window of GUI.
     2.7 -///It has menus, but the main part of it is the canvas.
     2.8 +
     2.9 +///It has menus, and a notebook. Notebook has different pages,
    2.10 +///the so called tabs (\ref NoteBookTab). Each \ref NoteBookTab contains a canvas on which graphs can be drawn.
    2.11 +///To manage creation and close of tabs and tabswitching is the task of MainWin.
    2.12  class MainWin : public Gtk::Window
    2.13  {
    2.14 -  ///Container
    2.15 +  ///Container in which the menus and the notebook is.
    2.16    Gtk::VBox vbox;
    2.17  
    2.18 +  ///The notebook that has tabs (\ref NoteBookTab) with different graphs.
    2.19    Gtk::Notebook notebook;
    2.20  
    2.21 +  ///The tool selected to manipulate graph.
    2.22 +
    2.23 +  ///It has to be stored, because in case of tabswitching
    2.24 +  ///the correct tool has to be set for the actual graph.
    2.25    int active_tool;
    2.26  
    2.27 +  ///The number of active tab in the notebook.
    2.28    int active_tab;
    2.29 +
    2.30 +  ///Vector of existing tabs in the notebook.
    2.31    std::vector<NoteBookTab *> tabs;
    2.32 +
    2.33 +  ///Vector of the name of tabs.
    2.34 +
    2.35 +  ///All \ref NoteBookTab has a name that is stored here. The index of the name
    2.36 +  ///is the same as the index of the \ref NoteBookTab in \ref tabs.
    2.37    std::vector<std::string> tabnames;
    2.38  
    2.39 +  ///Counter of occurence of the same file names.
    2.40 +
    2.41 +  ///If a file is opened more than once we have to score
    2.42 +  ///the occurences to let the titles on tabs different.
    2.43 +  ///If more than one occurence is present, from the second
    2.44 +  ///one near the filename the number of the occurence appear.
    2.45    std::map<std::string, int> strinst;
    2.46  
    2.47 +  ///Set of opened \ref AlgoWin s.
    2.48 +
    2.49 +  ///More than one \refAlgoWin can be opened. We have to
    2.50 +  ///communicate with them in case of new \ref NoteBookTab creation,
    2.51 +  ///\ref NoteBookTab close, or map change. Therefore we have to score
    2.52 +  ///their occurences.
    2.53    std::set< AlgoWin* > aws;
    2.54  
    2.55  public:
    2.56    
    2.57 -  ///Constructor of the \ref NoteBookTab. It creates the menu and the \ref GraphDisplayerCanvas on which the graph will be drawn.
    2.58 -  ///\param title is the title of the window
    2.59 +  ///Constructor of the \ref MainWin.
    2.60 +
    2.61 +  ///It creates the menus, the toolbar and the notebook in which
    2.62 +  ///\ref NoteBookTab s take place. \ref NoteBookTab s are the
    2.63 +  ///holder of the canvases on which the graphs are drawn.
    2.64    MainWin();
    2.65  
    2.66 +  ///Sets title of tabs.
    2.67 +
    2.68 +  ///It alse registrates it in \ref tabnames. If more than one
    2.69 +  ///occurence is in the notebook of the same file it has to
    2.70 +  ///extend tabname with the number of occurence.
    2.71    void set_tabtitle(std::string);
    2.72  
    2.73    ///ActionGroup for menu
    2.74 @@ -45,6 +81,9 @@
    2.75    ///UIManager for menu
    2.76    Glib::RefPtr<Gtk::UIManager> uim;
    2.77  
    2.78 +  ///Creates a new \ref NoteBookTab and opens the given file.
    2.79 +
    2.80 +  ///It is called only with command line parameters at stratup.
    2.81    void readFile(const std::string &);
    2.82  
    2.83    ///Tooltips
    2.84 @@ -64,32 +103,124 @@
    2.85    virtual void close();
    2.86  
    2.87    //Toolbar
    2.88 +
    2.89 +  ///Callback for 'zoomIn' action.
    2.90 +
    2.91 +  ///It calls the appropriate function in
    2.92 +  ///\ref GraphDisplayerCanvas
    2.93    virtual void zoomIn();
    2.94 +  ///Callback for 'zoomOut' action.
    2.95 +
    2.96 +  ///It calls the appropriate function in
    2.97 +  ///\ref GraphDisplayerCanvas
    2.98    virtual void zoomOut();
    2.99 +  ///Callback for 'zoomFit' action.
   2.100 +
   2.101 +  ///It calls the appropriate function in
   2.102 +  ///\ref GraphDisplayerCanvas
   2.103    virtual void zoomFit();
   2.104 +  ///Callback for 'zoom100' action.
   2.105 +
   2.106 +  ///It calls the appropriate function in
   2.107 +  ///\ref GraphDisplayerCanvas
   2.108    virtual void zoom100();
   2.109  
   2.110 +  ///Callback for Show Maps menupoint.
   2.111 +
   2.112 +  ///It calls the appropriate function in
   2.113 +  ///\ref NoteBookTab
   2.114    virtual void createMapWin();
   2.115  
   2.116 -  virtual void createAlgoWin(int);
   2.117 -  virtual void deRegisterAlgoWin(AlgoWin *);
   2.118 +  ///Pops up an Algorithm window.
   2.119 +
   2.120 +  ///It not only creates but registrates the newly created \ref AlgoWin.
   2.121 +  ///It is necessary, because in case of changement between tabs or maps
   2.122 +  ///we have to communicate with it. Signals are also have to be connected
   2.123 +  ///to it, because \ref AlgoWin emits signals if it needs anything (maplist, deregistration).
   2.124 +  ///\param algo type of the algorithm to run.
   2.125 +  virtual void createAlgoWin(int algo);
   2.126 +
   2.127 +  ///Deregisters AlgoWin
   2.128 +
   2.129 +  ///This is the function connected to the closing signal of \ref AlgoWin.
   2.130 +  ///It only deletes the sender \ref AlgoWin from \ref aws. This function
   2.131 +  ///is called only by the closing \ref AlgoWin itself.
   2.132 +  ///\param aw the \ref AlgoWin to delete.
   2.133 +  virtual void deRegisterAlgoWin(AlgoWin * aw);
   2.134 +
   2.135 +  ///Updates list of tabs in all of the \ref AlgoWin
   2.136 +
   2.137 +  ///When \ref NoteBookTab inserted somewhere or closed one tablist in all \ref AlgoWin
   2.138 +  ///have to be updated. That is why we score all the opened \ref AlgoWin.
   2.139 +  ///During update \ref tabnames will be passed to each \ref AlgoWin.
   2.140    virtual void updateAlgoWinTabs();
   2.141 -  virtual void updateAlgoWinMaps(AlgoWin *, std::string);
   2.142  
   2.143 -  virtual void changeEditorialTool(int);
   2.144 +  ///Refresh list of maps in the AlgoWin that requested it.
   2.145  
   2.146 -  virtual void createNewMapWinAfterSignal(NoteBookTab *, bool);
   2.147 -  virtual void createNewMapWinTabString(std::string, bool);
   2.148 +  ///In an \ref AlgoWin there is a ComboBoxText, in which
   2.149 +  ///a \ref NoteBookTab can be chosen that contains the graph and the maps,
   2.150 +  ///on which we would like to run algorithms. If we change the
   2.151 +  ///tab the available maps also have to be updated, because
   2.152 +  ///in the different tabs different maps are available. Therefore
   2.153 +  ///on tab change the \ref AlgoWin emits a signal that contains itself
   2.154 +  ///so that the appropriate maps can be sent to it. For the sake of simplicity
   2.155 +  ///the program answers this call with the mapstorage of the newly selected tab.
   2.156 +  ///\param aw the caller \ref AlgoWin
   2.157 +  ///\param tabname the newly selected tab in the \ref AlgoWin
   2.158 +  virtual void updateAlgoWinMaps(AlgoWin * aw, std::string tabname);
   2.159 +
   2.160 +  ///Registrates the new graph-editor tool in hand.
   2.161 +
   2.162 +  ///The editor-tool in hand is global, it is the same for all tab
   2.163 +  ///at the same time. Therefore the active tool has to be scored here (\ref active_tool).
   2.164 +  ///This function is the callback function of the editor-tool buttons. It sets \ref active_tool
   2.165 +  ///to the correct value.
   2.166 +  ///\param tool the newly selected graph-editor tool (See all_include.h)
   2.167 +  virtual void changeEditorialTool(int tool);
   2.168 +
   2.169 +  ///Pops up a \ref NewMapWin dialog after requested by a \ref MapWin
   2.170 +
   2.171 +  ///Each tab can pop-up a \ref MapWin. In \ref MapWin new tab can be created.
   2.172 +  ///In this case \ref NoteBookTab emits a signal. This function is connected to that signal.
   2.173 +  ///It sends the caller \ref NoteBookTab and whether an edgemap or a nodemap should be created.
   2.174 +  ///Caller \ref NoteBookTab is necessary for the window to be able to place the new map in its
   2.175 +  ///correct place.
   2.176 +  ///\param nbt the caller tab
   2.177 +  ///\param itisedge true if edgemap has to be created, false if nodemap
   2.178 +  virtual void createNewMapWinAfterSignal(NoteBookTab * nbt, bool itisedge);
   2.179 +
   2.180 +  ///Pops up a \ref NewMapWin dialog after requested by an \ref AlgoWin
   2.181 +
   2.182 +  ///\ref AlgoWin can also can request a \ref NewMapWin to pop-up. 
   2.183 +  ///It emits a signal in this case. This function is bound to that signal.
   2.184 +  ///The signal contains the name of \ref NoteBookTab in which the new map has to be
   2.185 +  ///placed and whether the new map is an edgemap or a nodemap.
   2.186 +  ///\ref tabname the tab in which the new map has to be placed
   2.187 +  ///\ref itisedge true if the new map will be edge map, false if it will be nodemap
   2.188 +  virtual void createNewMapWinTabString(std::string tabname, bool itisedge);
   2.189 +
   2.190 +  ///Pops up a \ref NewMapWin dialog if button on \ref MainWin has been pressed.
   2.191 +
   2.192 +  ///In this case a general \ref NewMapWin will be popped up. This means that
   2.193 +  ///both edge and nodemap can be created by it. The new map will be placed in
   2.194 +  ///\MapStorage of the actual selected \ref NoteBookTab.
   2.195    virtual void createNewMapWin();
   2.196  
   2.197    //Notebook handlers
   2.198    ///Callback for 'FileNewTab' action.
   2.199    virtual void newTab();
   2.200 +
   2.201 +  ///Callback for 'FileCloseTab' action.
   2.202 +
   2.203 +  ///It closes the actual \ref NoteBookTab and registrates this event:
   2.204 +  ///data is shifted to the correct places in vectors.
   2.205    virtual void closeTab();
   2.206 +
   2.207 +  ///Tabswitching handler
   2.208 +
   2.209 +  ///Sets the variables that have to store the actual state, and it
   2.210 +  ///updates the title of window to the actually selected \ref NoteBookTab.
   2.211    virtual void onChangeTab(GtkNotebookPage*, guint);
   2.212 -  virtual void onCloseTab();
   2.213 -
   2.214 -
   2.215  };
   2.216  
   2.217  #endif //MAIN_WIN_H