ladanyi@53
|
1 |
#include "map_win.h"
|
ladanyi@6
|
2 |
#include <set>
|
ladanyi@6
|
3 |
|
hegyi@30
|
4 |
bool MapWin::closeIfEscapeIsPressed(GdkEventKey* e)
|
ladanyi@6
|
5 |
{
|
hegyi@8
|
6 |
if(e->keyval==GDK_Escape)
|
hegyi@8
|
7 |
{
|
hegyi@96
|
8 |
mytab.closeMapWin();
|
hegyi@95
|
9 |
// hide();
|
hegyi@8
|
10 |
}
|
hegyi@8
|
11 |
return true;
|
hegyi@8
|
12 |
}
|
ladanyi@6
|
13 |
|
hegyi@96
|
14 |
MapWin::MapWin(const std::string& title, std::vector<std::string> eml, std::vector<std::string> nml, NoteBookTab & mw):mytab(mw)
|
hegyi@8
|
15 |
{
|
hegyi@8
|
16 |
set_title(title);
|
hegyi@8
|
17 |
set_default_size(200, 50);
|
ladanyi@6
|
18 |
|
hegyi@146
|
19 |
set_resizable(false);
|
hegyi@146
|
20 |
|
hegyi@30
|
21 |
signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::closeIfEscapeIsPressed));
|
ladanyi@6
|
22 |
|
hegyi@81
|
23 |
e_combo_array=new MapSelector * [EDGE_PROPERTY_NUM];
|
hegyi@8
|
24 |
|
hegyi@81
|
25 |
table=new Gtk::Table(EDGE_PROPERTY_NUM, 1, false);
|
hegyi@28
|
26 |
|
hegyi@28
|
27 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
ladanyi@6
|
28 |
{
|
hegyi@114
|
29 |
e_combo_array[i]=new MapSelector(eml, mytab.getActiveEdgeMap(i), edge_property_strings[i], true);
|
hegyi@8
|
30 |
|
hegyi@81
|
31 |
(*table).attach((*(e_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
|
hegyi@94
|
32 |
|
hegyi@94
|
33 |
e_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::edgeMapChanged), i));
|
hegyi@121
|
34 |
e_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
|
ladanyi@6
|
35 |
}
|
ladanyi@6
|
36 |
|
hegyi@28
|
37 |
vbox.pack_start(*(new Gtk::Label("Edge properties")));
|
hegyi@8
|
38 |
|
hegyi@28
|
39 |
vbox.pack_start(*table);
|
hegyi@28
|
40 |
|
hegyi@28
|
41 |
vbox.pack_start(*(new Gtk::HSeparator));
|
hegyi@28
|
42 |
|
hegyi@81
|
43 |
n_combo_array=new MapSelector * [NODE_PROPERTY_NUM];
|
hegyi@28
|
44 |
|
hegyi@81
|
45 |
table=new Gtk::Table(NODE_PROPERTY_NUM, 1, false);
|
hegyi@28
|
46 |
|
hegyi@28
|
47 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
hegyi@28
|
48 |
{
|
hegyi@114
|
49 |
n_combo_array[i]=new MapSelector(nml, mytab.getActiveNodeMap(i), node_property_strings[i], false);
|
hegyi@28
|
50 |
|
hegyi@81
|
51 |
(*table).attach((*(n_combo_array[i])),0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
|
hegyi@94
|
52 |
|
hegyi@94
|
53 |
n_combo_array[i]->signal_cbt_ch().connect(sigc::bind(sigc::mem_fun(*this, &MapWin::nodeMapChanged), i));
|
hegyi@121
|
54 |
n_combo_array[i]->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &MapWin::newMapWinNeeded));
|
hegyi@28
|
55 |
}
|
hegyi@28
|
56 |
|
hegyi@28
|
57 |
add(vbox);
|
hegyi@28
|
58 |
|
hegyi@28
|
59 |
vbox.pack_start(*(new Gtk::Label("Node properties")));
|
hegyi@28
|
60 |
|
hegyi@28
|
61 |
vbox.pack_start(*table);
|
ladanyi@6
|
62 |
|
ladanyi@6
|
63 |
show_all_children();
|
ladanyi@6
|
64 |
|
ladanyi@6
|
65 |
}
|
ladanyi@6
|
66 |
|
hegyi@94
|
67 |
void MapWin::nodeMapChanged(std::string mapname, int prop)
|
hegyi@94
|
68 |
{
|
hegyi@96
|
69 |
mytab.propertyChange(false, prop, mapname);
|
hegyi@94
|
70 |
}
|
hegyi@94
|
71 |
|
hegyi@94
|
72 |
void MapWin::edgeMapChanged(std::string mapname, int prop)
|
hegyi@94
|
73 |
{
|
hegyi@96
|
74 |
mytab.propertyChange(true, prop, mapname);
|
hegyi@94
|
75 |
}
|
hegyi@94
|
76 |
|
hegyi@121
|
77 |
void MapWin::newMapWinNeeded(bool itisedge)
|
hegyi@94
|
78 |
{
|
hegyi@121
|
79 |
mytab.popupNewMapWin(itisedge);
|
hegyi@94
|
80 |
}
|
hegyi@94
|
81 |
|
hegyi@94
|
82 |
void MapWin::update(std::vector<std::string> eml, std::vector<std::string> nml)
|
ladanyi@53
|
83 |
{
|
ladanyi@53
|
84 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
ladanyi@53
|
85 |
{
|
hegyi@94
|
86 |
e_combo_array[i]->update_list(eml);
|
hegyi@81
|
87 |
}
|
ladanyi@53
|
88 |
|
ladanyi@53
|
89 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
ladanyi@53
|
90 |
{
|
hegyi@94
|
91 |
n_combo_array[i]->update_list(nml);
|
ladanyi@53
|
92 |
}
|
ladanyi@53
|
93 |
}
|
ladanyi@53
|
94 |
|
hegyi@40
|
95 |
void MapWin::registerNewEdgeMap(std::string newmapname)
|
hegyi@38
|
96 |
{
|
hegyi@40
|
97 |
for(int i=0;i<EDGE_PROPERTY_NUM;i++)
|
hegyi@40
|
98 |
{
|
hegyi@40
|
99 |
//filling in combo box with choices
|
hegyi@81
|
100 |
e_combo_array[i]->append_text((Glib::ustring)newmapname);
|
hegyi@40
|
101 |
}
|
hegyi@38
|
102 |
}
|
hegyi@38
|
103 |
|
hegyi@40
|
104 |
void MapWin::registerNewNodeMap(std::string newmapname)
|
hegyi@38
|
105 |
{
|
hegyi@41
|
106 |
for(int i=0;i<NODE_PROPERTY_NUM;i++)
|
hegyi@40
|
107 |
{
|
hegyi@40
|
108 |
//filling in combo box with choices
|
hegyi@82
|
109 |
n_combo_array[i]->append_text((Glib::ustring)newmapname);
|
hegyi@40
|
110 |
}
|
hegyi@38
|
111 |
}
|
hegyi@95
|
112 |
|
hegyi@95
|
113 |
bool MapWin::on_delete_event(GdkEventAny * event)
|
hegyi@95
|
114 |
{
|
hegyi@95
|
115 |
event=event;
|
hegyi@96
|
116 |
mytab.closeMapWin();
|
hegyi@95
|
117 |
return true;
|
hegyi@95
|
118 |
}
|