hegyi@1849: // -*- C++ -*- // hegyi@1849: hegyi@1849: #ifndef NBTAB_H hegyi@1849: #define NBTAB_H hegyi@1849: hegyi@1849: class NoteBookTab; hegyi@1849: hegyi@1849: #include "mapstorage.h" hegyi@1849: #include "map_win.h" hegyi@1849: #include "graph_displayer_canvas.h" hegyi@1849: #include hegyi@1849: #include hegyi@1849: hegyi@1891: ///One tab in the Notebook that is placed in the main window (\ref MainWin). hegyi@1891: hegyi@1891: ///One graph and all of its accessories like maps are assigned to one tab in the notebook. hegyi@1891: ///\ref NoteBookTab is responsible for the user defined display of the graph: view can be hegyi@1891: ///set by visualized maps, therefore \ref NoteBookTab must provide an interface to set the hegyi@1891: ///view of graph. This is \ref Mapwin window. hegyi@1891: /// hegyi@1891: ///\ref NoteBookTab is also hegyi@1891: ///responsible for modify the graph if it is hegyi@1891: ///requested. Therefore it is responsible for translating user events to modifications to hegyi@1891: ///do on graph, like node/edge addition/deletion, map modification, addition and so on. hegyi@1891: /// hegyi@1891: ///To be able to solve these tasks the help of \ref MainWin is also needed, for example to hegyi@1891: ///know which editor-tool is active at the moment. Therefore \ref MainWin knows \ref NoteBookTab. hegyi@1891: /// hegyi@1891: ///Some information in the other direction is needed as well: for example when new map creation is requested for this tab hegyi@1891: ///\ref NoteBookTab must ask \ref MainWin to pop-up a \ref NewMapWin. Communication in this direction is realized by signals hegyi@1891: ///therefore \ref NoteBookTab does not know \ref MainWin at all, but in this way it is not necessary. hegyi@1849: class NoteBookTab : public Gtk::VBox hegyi@1849: { hegyi@1849: public: hegyi@1891: hegyi@1891: ///Constructor of \ref NoteBookTab hegyi@1891: hegyi@1891: ///It initiates the \re GraphDisplayerCanvas, on which the graph will be drawn hegyi@1891: ///Signals of \ref MapStorage will be bound to the appropriate callback functions here. hegyi@1849: NoteBookTab(); hegyi@1849: hegyi@1891: ///Maps assigned to the graph displayed in this \ref NoteBookTab of notebook. hegyi@1849: MapStorage mapstorage; hegyi@1849: hegyi@1891: ///Title changement indicator. hegyi@1891: hegyi@1891: ///If graph is loaded from disk or saved to disk or changed its name somehow hegyi@1891: ///this signal will be emit to let hegyi@1891: ///\ref MainWin know that it has to modify the title of the main window. hegyi@1891: ///It contains the new title. hegyi@1849: sigc::signal signal_title; hegyi@1849: hegyi@1891: ///Returns \ref signal_title to be the caller able to connect it to a callback function. hegyi@1849: sigc::signal signal_title_ch(); hegyi@1849: hegyi@1891: ///Indicates that new map window should be popped up. hegyi@1891: hegyi@1891: ///\ref NoteBookTab can ask \ref MainWin to pop up a \ref NweMapWin ny emitting this signal. hegyi@1891: ///The signal contains whether an edgemap or a nodemap should be popped up. \ref NewMapWin hegyi@1891: ///is not popped up by \ref NoteBookTab, because not only \ref NoteBookTab needs \ref NewMapWin, hegyi@1891: ///but for example \ref MainWin and \ref AlgoWin s as well. hegyi@1849: sigc::signal signal_newmap; hegyi@1849: hegyi@1891: ///Returns \ref signal_newmap to be the caller able to connect it to a callback function. hegyi@1849: sigc::signal signal_newmap_needed(); hegyi@1849: hegyi@1891: ///Loads the given file. hegyi@1891: hegyi@1891: ///The given file will be load in the \ref MapStorage and afeter that hegyi@1891: ///\ref GraphDisplayerCanvas will be requested to display the graph. hegyi@1891: ///\ref GraphDisplayer will get datas from the recently set \ref MapStorage. hegyi@1849: void readFile(const std::string &); hegyi@1849: hegyi@1849: ///The graph will be drawn on this \ref GraphDisplayerCanvas hegyi@1849: GraphDisplayerCanvas * gd_canvas; hegyi@1849: hegyi@1891: ///Indicates whether the \ref MapWin is opened or not. See \ref mapwin. hegyi@1849: bool mapwinexists; hegyi@1849: hegyi@1891: ///Address of the only \ref MapWin that the \ref NoteBookTab can open. hegyi@1891: hegyi@1891: ///Only one of this window can be opened at the same time (\ref mapwinexists), hegyi@1891: ///because there is no need for more, one per tab is enough. hegyi@1891: ///There won1t be benefit of more than one, but it would be hegyi@1891: ///more complicated to synchronize them. hegyi@1849: MapWin * mapwin; hegyi@1849: hegyi@1849: public: hegyi@1849: ///Callback for 'FileNew' action. hegyi@1849: virtual void newFile(); hegyi@1849: ///Callback for 'FileOpen' action. hegyi@1849: virtual void openFile(); hegyi@1849: ///Callback for 'FileSave' action. hegyi@1849: virtual void saveFile(); hegyi@1849: ///Callback for 'FileSaveAs' action. hegyi@1849: virtual void saveFileAs(); hegyi@1849: ///Callback for 'Close' action. hegyi@1849: virtual void close(); hegyi@1849: hegyi@1891: ///Handles changement of view of graph. hegyi@1849: hegyi@1891: ///If the user changes the map to show by a property to a nother in \ref MapWin, hegyi@1891: ///\ref MapWin will call this function. This function will registrate in \ref MapStorage hegyi@1891: ///the new map to display by the changed property. After that \ref MapStorage will hegyi@1891: ///emits a signal that will be forwarded to \ref GraphDisplayerCanvas to update the hegyi@1891: ///appropriate parts of graph. hegyi@1891: ///\param itiesedge whether the changed property is edge property or node property hegyi@1891: ///\param prop id of property, see all_include.h hegyi@1891: ///\param mapname name of the recently selected map hegyi@1891: void propertyChange(bool itisedge, int prop, std::string mapname); hegyi@1849: hegyi@1891: ///Emits a signal that request \ref MainWin to pop up \ref NewMapWin hegyi@1849: hegyi@1891: ///This function is called by \ref MapWin. hegyi@1891: ///\param itisedge whether the new map should be an edgemap or a nodemap. hegyi@1891: void popupNewMapWin(bool itisedge); hegyi@1891: hegyi@1891: ///Returns the actually selected edgemap to visualize by the given property. hegyi@1891: hegyi@1891: ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage. hegyi@1891: ///\param prop property to inquire. hegyi@1891: std::string getActiveEdgeMap(int prop); hegyi@1891: hegyi@1891: ///Returns the actually selected nodemap to visualize by the given property. hegyi@1891: hegyi@1891: ///\ref MapWin calls this function, beacuse it does not know \ref MapStorage. hegyi@1891: ///\param prop property to inquire. hegyi@1891: std::string getActiveNodeMap(int prop); hegyi@1891: hegyi@1891: ///Registers recently created edgemap in \ref MapWin. hegyi@1891: hegyi@1891: ///After creation of new map \ref MapStorage emits a signal. hegyi@1891: ///This signal is bound to this callback function, that will call hegyi@1891: ///a function with the same name and same parameterin \ref MapWin. hegyi@1891: ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin hegyi@1891: ///\param mapname name of new map hegyi@1891: void registerNewEdgeMap(std::string mapname); hegyi@1891: hegyi@1891: ///Registers recently created nodemap in \ref MapWin. hegyi@1891: hegyi@1891: ///After creation of new map \ref MapStorage emits a signal. hegyi@1891: ///This signal is bound to this callback function, that will call hegyi@1891: ///a function with the same name and same parameter in \ref MapWin. hegyi@1891: ///This call-forwarder function is needed, because \ref Mapstorage does not know \ref MapWin hegyi@1891: ///\param mapname name of new map hegyi@1891: void registerNewNodeMap(std::string mapname); hegyi@1891: hegyi@1891: ///Pops up and registrates the \ref MapWin of \ref NoteBookTab. hegyi@1891: hegyi@1891: ///See also hegyi@1891: ///\ref mapwin. hegyi@1849: void createMapWin(std::string); hegyi@1891: hegyi@1891: ///Closes and deregistrates the \ref MapWin of \ref NoteBookTab. hegyi@1891: hegyi@1891: ///See also hegyi@1891: ///\ref mapwin. hegyi@1849: void closeMapWin(); hegyi@1849: }; hegyi@1849: hegyi@1849: #endif //NBTAB_H