nbtab.h
branchgui
changeset 121 637c12cbd64c
parent 96 e664d8aa3f72
child 154 65c1b103443d
     1.1 --- a/nbtab.h	Wed Jan 11 15:49:06 2006 +0000
     1.2 +++ b/nbtab.h	Thu Jan 12 13:28:54 2006 +0000
     1.3 @@ -11,28 +11,78 @@
     1.4  #include <libgnomecanvasmm.h>
     1.5  #include <libgnomecanvasmm/polygon.h>
     1.6  
     1.7 +///One tab in the Notebook that is placed in the main window (\ref MainWin).
     1.8 +
     1.9 +///One graph and all of its accessories like maps are assigned to one tab in the notebook.
    1.10 +///\ref NoteBookTab is responsible for the user defined display of the graph: view can be
    1.11 +///set by visualized maps, therefore \ref NoteBookTab must provide an interface to set the
    1.12 +///view of graph. This is \ref Mapwin window.
    1.13 +///
    1.14 +///\ref NoteBookTab is also
    1.15 +///responsible for modify the graph if it is
    1.16 +///requested. Therefore it is responsible for translating user events to modifications to
    1.17 +///do on graph, like node/edge addition/deletion, map modification, addition and so on.
    1.18 +///
    1.19 +///To be able to solve these tasks the help of \ref MainWin is also needed, for example to
    1.20 +///know which editor-tool is active at the moment. Therefore \ref MainWin knows \ref NoteBookTab.
    1.21 +///
    1.22 +///Some information in the other direction is needed as well: for example when new map creation is requested for this tab
    1.23 +///\ref NoteBookTab must ask \ref MainWin to pop-up a \ref NewMapWin. Communication in this direction is realized by signals
    1.24 +///therefore \ref NoteBookTab does not know \ref MainWin at all, but in this way it is not necessary.
    1.25  class NoteBookTab : public Gtk::VBox
    1.26  {
    1.27  public:
    1.28 +  
    1.29 +  ///Constructor of \ref NoteBookTab
    1.30 +
    1.31 +  ///It initiates the \re GraphDisplayerCanvas, on which the graph will be drawn
    1.32 +  ///Signals of \ref MapStorage will be bound to the appropriate callback functions here.
    1.33    NoteBookTab();
    1.34    
    1.35 +  ///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook.
    1.36    MapStorage mapstorage;
    1.37      
    1.38 +  ///Title changement indicator.
    1.39 +
    1.40 +  ///If graph is loaded from disk or saved to disk or changed its name somehow
    1.41 +  ///this signal will be emit to let
    1.42 +  ///\ref MainWin know that it has to modify the title of the main window.
    1.43 +  ///It contains the new title.
    1.44    sigc::signal<void, std::string> signal_title;
    1.45  
    1.46 +  ///Returns \ref signal_title to be the caller able to connect it to a callback function.
    1.47    sigc::signal<void, std::string> signal_title_ch();
    1.48  
    1.49 +  ///Indicates that new map window should be popped up.
    1.50 +
    1.51 +  ///\ref NoteBookTab can ask \ref MainWin to pop up a \ref NweMapWin ny emitting this signal.
    1.52 +  ///The signal contains whether an edgemap or a nodemap should be popped up. \ref NewMapWin
    1.53 +  ///is not popped up by \ref NoteBookTab, because not only \ref NoteBookTab needs \ref NewMapWin,
    1.54 +  ///but for example \ref MainWin and \ref AlgoWin s as well.
    1.55    sigc::signal<void, NoteBookTab *, bool> signal_newmap;
    1.56  
    1.57 +  ///Returns \ref signal_newmap to be the caller able to connect it to a callback function.
    1.58    sigc::signal<void, NoteBookTab *, bool> signal_newmap_needed();
    1.59  
    1.60 +  ///Loads the given file.
    1.61 +
    1.62 +  ///The given file will be load in the \ref MapStorage and afeter that
    1.63 +  ///\ref GraphDisplayerCanvas will be requested to display the graph.
    1.64 +  ///\ref GraphDisplayer will get datas from the recently set \ref MapStorage.
    1.65    void readFile(const std::string &);
    1.66      
    1.67    ///The graph will be drawn on this \ref GraphDisplayerCanvas
    1.68    GraphDisplayerCanvas * gd_canvas;
    1.69  
    1.70 +  ///Indicates whether the \ref MapWin is opened or not. See \ref mapwin.
    1.71    bool mapwinexists;
    1.72  
    1.73 +  ///Address of the only \ref MapWin that the \ref NoteBookTab can open.
    1.74 +
    1.75 +  ///Only one of this window can be opened at the same time (\ref mapwinexists), 
    1.76 +  ///because there is no need for more, one per tab is enough.
    1.77 +  ///There won1t be benefit of more than one, but it would be
    1.78 +  ///more complicated to synchronize them.
    1.79    MapWin * mapwin;
    1.80      
    1.81  public:
    1.82 @@ -47,16 +97,64 @@
    1.83    ///Callback for 'Close' action.
    1.84    virtual void close();
    1.85  
    1.86 -  void propertyChange(bool, int, std::string);
    1.87 -  void popupNewMapWin(bool, int);
    1.88 +  ///Handles changement of view of graph.
    1.89  
    1.90 -  std::string getActiveEdgeMap(int);
    1.91 -  std::string getActiveNodeMap(int);
    1.92 +  ///If the user changes the map to show by a property to a nother in \ref MapWin,
    1.93 +  ///\ref MapWin will call this function. This function will registrate in \ref MapStorage
    1.94 +  ///the new map to display by the changed property. After that \ref MapStorage will
    1.95 +  ///emits a signal that will be forwarded to \ref GraphDisplayerCanvas to update the
    1.96 +  ///appropriate parts of graph.
    1.97 +  ///\param itiesedge whether the changed property is edge property or node property
    1.98 +  ///\param prop id of property, see all_include.h
    1.99 +  ///\param mapname name of the recently selected map
   1.100 +  void propertyChange(bool itisedge, int prop, std::string mapname);
   1.101  
   1.102 -  void registerNewEdgeMap(std::string);
   1.103 -  void registerNewNodeMap(std::string);
   1.104 +  ///Emits a signal that request \ref MainWin to pop up \ref NewMapWin
   1.105  
   1.106 +  ///This function is called by \ref MapWin.
   1.107 +  ///\param itisedge whether the new map should be an edgemap or a nodemap.
   1.108 +  void popupNewMapWin(bool itisedge);
   1.109 +
   1.110 +  ///Returns the actually selected edgemap to visualize by the given property.
   1.111 +
   1.112 +  ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage.
   1.113 +  ///\param prop property to inquire.
   1.114 +  std::string getActiveEdgeMap(int prop);
   1.115 +
   1.116 +  ///Returns the actually selected nodemap to visualize by the given property.
   1.117 +
   1.118 +  ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage.
   1.119 +  ///\param prop property to inquire.
   1.120 +  std::string getActiveNodeMap(int prop);
   1.121 +
   1.122 +  ///Registers recently created edgemap in \ref MapWin.
   1.123 +
   1.124 +  ///After creation of new map \ref MapStorage emits a signal.
   1.125 +  ///This signal is bound to this callback function, that will call
   1.126 +  ///a function with the same name and same parameterin \ref MapWin.
   1.127 +  ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin
   1.128 +  ///\param mapname name of new map
   1.129 +  void registerNewEdgeMap(std::string mapname);
   1.130 +
   1.131 +  ///Registers recently created nodemap in \ref MapWin.
   1.132 +
   1.133 +  ///After creation of new map \ref MapStorage emits a signal.
   1.134 +  ///This signal is bound to this callback function, that will call
   1.135 +  ///a function with the same name and same parameter in \ref MapWin.
   1.136 +  ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin
   1.137 +  ///\param mapname name of new map
   1.138 +  void registerNewNodeMap(std::string mapname);
   1.139 +
   1.140 +  ///Pops up and registrates the \ref MapWin of \ref NoteBookTab.
   1.141 +  
   1.142 +  ///See also
   1.143 +  ///\ref mapwin.
   1.144    void createMapWin(std::string);
   1.145 +
   1.146 +  ///Closes and deregistrates the \ref MapWin of \ref NoteBookTab.
   1.147 +  
   1.148 +  ///See also
   1.149 +  ///\ref mapwin.
   1.150    void closeMapWin();
   1.151  };
   1.152