7 |
7 |
8 #include <all_include.h> |
8 #include <all_include.h> |
9 #include <graph_displayer_canvas.h> |
9 #include <graph_displayer_canvas.h> |
10 #include <libgnomecanvasmm.h> |
10 #include <libgnomecanvasmm.h> |
11 #include <libgnomecanvasmm/polygon.h> |
11 #include <libgnomecanvasmm/polygon.h> |
|
12 #include <stack> |
12 |
13 |
13 ///This class is responsible for creating a window, |
14 ///This class is responsible for creating a window, |
14 ///on which the parameters of a new map can be set. |
15 ///on which the parameters of a new map can be set. |
15 |
16 |
16 class NewMapWin : public Gtk::Window |
17 class NewMapWin : public Gtk::Window |
19 ///It has to be known for this class, because |
20 ///It has to be known for this class, because |
20 ///when a map is created |
21 ///when a map is created |
21 ///a function of the \ref GraphDisplayerCanvas will be called. |
22 ///a function of the \ref GraphDisplayerCanvas will be called. |
22 GraphDisplayerCanvas & gdc; |
23 GraphDisplayerCanvas & gdc; |
23 |
24 |
24 public: |
25 public: |
|
26 struct tree_node |
|
27 { |
|
28 char ch; |
|
29 tree_node * left_child; |
|
30 tree_node * right_child; |
|
31 }; |
|
32 |
25 ///Constructor of NewMapWin creates the widgets shown in NewMapWin. |
33 ///Constructor of NewMapWin creates the widgets shown in NewMapWin. |
26 NewMapWin(const std::string& title, GraphDisplayerCanvas &); |
34 NewMapWin(const std::string& title, GraphDisplayerCanvas &); |
27 |
35 |
28 |
36 |
29 ///Signal on button is connected to this function, |
37 ///Signal on button is connected to this function, |
30 ///Therefore this function determines whether to |
38 ///Therefore this function determines whether to |
31 ///call the map/creatort function, and if yes, it |
39 ///call the map/creatort function, and if yes, it |
32 //tells it the attributes.(name, default value) |
40 //tells it the attributes.(name, default value) |
33 virtual void buttonPressed(); |
41 virtual void buttonPressed(); |
34 |
42 |
35 virtual void showByPreChoose(bool); |
43 virtual void showByPreChoose(bool); |
36 |
44 |
37 virtual bool closeIfEscapeIsPressed(GdkEventKey*); |
45 virtual bool closeIfEscapeIsPressed(GdkEventKey*); |
|
46 |
|
47 ///Function that creates a tree from an appropriately manipulated string |
|
48 tree_node * weightedString2Tree(std::string, std::vector<unsigned int> &, int); |
|
49 |
|
50 ///Function that creates a string from a tree by postorder reading. |
|
51 std::string postOrder(tree_node *); |
|
52 |
|
53 std::string string2Polishform(std::string, bool); |
|
54 |
|
55 bool validVariable(std::string, bool); |
|
56 |
|
57 std::map<char, std::string> ch2var; |
38 |
58 |
39 Gtk::Entry name, default_value; |
59 Gtk::Entry name, default_value; |
40 |
60 |
41 Gtk::VBox vbox; |
61 Gtk::VBox vbox; |
42 |
62 |