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