00001
00002
00003 #ifndef GUIDOCUMENT_H
00004 #define GUIDOCUMENT_H
00005
00006 #include "UIDocument.h"
00007 #include "GUINetPopup.h"
00008 #include "GUINetwork.h"
00009 #include <gnome.h>
00010 #include <pthread.h>
00011
00012 namespace FD {
00013
00014 class DocParameterData {
00015 public:
00016
00017 GtkWidget *optionmenu;
00018 GtkWidget *optionmenu_menu;
00019 GtkWidget *combo_entry;
00020 GtkWidget *entry;
00021 GtkWidget *label;
00022
00023 };
00024
00025
00026
00027 class GUIDocument : public UIDocument {
00028 protected:
00029
00030 friend void create_threaded(gchar * str, GUIDocument *doc);
00031 friend void create_net(gchar * str, GUIDocument *doc);
00032 friend void create_iter(gchar * str, GUIDocument *doc);
00033
00034
00035 friend void document_change_current_page_event(GtkNotebook *notebook, gint arg1, GUIDocument *document);
00036 friend gboolean document_focus_tab_event(GtkNotebook *notebook, GtkNotebookTab arg1, GUIDocument *document);
00037 friend gboolean document_select_page_event(GtkNotebook *notebook, gboolean arg1, GUIDocument *document);
00038 friend void document_category_changed_event (GtkEntry *entry, GUIDocument *document);
00039 friend void document_comments_changed_event (GtkTextBuffer *textbuffer, GUIDocument *document);
00040
00041
00042 GnomeMDIGenericChild *mdiChild;
00043
00044
00045 GtkWidget *docproperty;
00046
00047
00048 GtkWidget *label1;
00049 GtkWidget *vbox2;
00050 GtkWidget *document_notebook;
00051 GtkWidget *less2;
00052 GtkWidget *scrolledwindow1;
00053 std::string less_text;
00054
00055 std::vector<DocParameterData> params;
00056 public:
00057 static pthread_mutex_t del_lock;
00058 static pthread_t runThread;
00059 static bool isRunning;
00060 static Network *runningNet;
00061 public:
00062 GUIDocument(std::string _name);
00063
00064 ~GUIDocument();
00065
00066 int closeRequest(bool force=false);
00067
00068 GnomeMDIGenericChild *getMDIChild() {return mdiChild;}
00069
00070 GtkWidget *getView() {return vbox2;}
00071
00072 void add_notebook_network(GUINetwork *net, GtkWidget *child);
00073
00074 void remove_notebook_network(GUINetwork *net, GtkWidget *child);
00075
00076 void less_print(const std::string &message);
00077
00078 void less_print(const char *message);
00079
00080 void less_clear();
00081
00082
00083
00084 void save();
00085
00086
00087
00088 virtual void load();
00089
00090 void removeCurrentNet ();
00091
00092 void renameCurrentNet ();
00093
00094 UINetwork* getCurrentNet();
00095
00096 virtual UINetwork *newNetwork(const std::string &_name, UINetwork::Type type);
00097
00098 virtual UINetwork *newNetwork(xmlNodePtr _net);
00099
00100 virtual void setFullPath(const std::string &fullpath);
00101
00102 virtual void run();
00103
00104 void createParamDialog();
00105
00106 void showParams();
00107
00108 void changedParams();
00109
00110 void applyParams();
00111
00112 void updateSubnet();
00113
00114 void insertLoadedParam(DocParameterData *param, std::string type, std::string value);
00115
00116 void threadRun();
00117
00118 std::string getNewNetName(UINetwork::Type type);
00119
00120
00121 friend class GUINetPopup;
00122
00123 static void threadStop();
00124
00125 protected:
00126
00127 virtual void error(char *err);
00128
00129 GtkWidget *getNotebook() {return document_notebook;}
00130
00131
00132 };
00133
00134 }
00135
00136 #endif