hegyi@1469
|
1 |
#include <edit_win.h>
|
hegyi@1469
|
2 |
#include <set>
|
hegyi@1469
|
3 |
|
hegyi@1469
|
4 |
bool EditWin::close_if_escape_is_pressed(GdkEventKey* e)
|
hegyi@1469
|
5 |
{
|
hegyi@1469
|
6 |
if(e->keyval==GDK_Escape)
|
hegyi@1469
|
7 |
{
|
hegyi@1469
|
8 |
hide();
|
hegyi@1469
|
9 |
}
|
hegyi@1469
|
10 |
return true;
|
hegyi@1469
|
11 |
}
|
hegyi@1469
|
12 |
|
hegyi@1469
|
13 |
EditWin::EditWin(const std::string& title, GraphDisplayerCanvas & grdispc):gdc(grdispc),table(2, 2, true)
|
hegyi@1469
|
14 |
{
|
hegyi@1469
|
15 |
set_title(title);
|
hegyi@1469
|
16 |
set_default_size(200, 50);
|
hegyi@1478
|
17 |
set_keep_above(true);
|
hegyi@1469
|
18 |
signal_key_press_event().connect(sigc::mem_fun(*this, &EditWin::close_if_escape_is_pressed));
|
hegyi@1469
|
19 |
|
hegyi@1478
|
20 |
//buttons array
|
hegyi@1478
|
21 |
buttons=new (Gtk::RadioButton *) [TOOL_NUM];
|
hegyi@1478
|
22 |
for(int i=0;i<TOOL_NUM;i++)
|
hegyi@1478
|
23 |
{
|
hegyi@1478
|
24 |
buttons[i]=NULL;
|
hegyi@1478
|
25 |
}
|
hegyi@1478
|
26 |
|
hegyi@1478
|
27 |
Gtk::RadioButton::Group group;//=buttons[MOVE]->get_group();
|
hegyi@1478
|
28 |
|
hegyi@1469
|
29 |
//New node button
|
hegyi@1478
|
30 |
buttons[CREATE_NODE]=new Gtk::RadioButton("New Node");
|
hegyi@1478
|
31 |
buttons[CREATE_NODE]->set_mode(false);
|
hegyi@1478
|
32 |
buttons[CREATE_NODE]->set_group(group);
|
hegyi@1478
|
33 |
buttons[CREATE_NODE]->signal_clicked().connect
|
hegyi@1469
|
34 |
(
|
hegyi@1469
|
35 |
sigc::bind
|
hegyi@1469
|
36 |
(
|
hegyi@1469
|
37 |
sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
|
hegyi@1469
|
38 |
1
|
hegyi@1469
|
39 |
)
|
hegyi@1469
|
40 |
);
|
hegyi@1478
|
41 |
table.attach(*buttons[CREATE_NODE],0,1,0,1);
|
hegyi@1469
|
42 |
|
hegyi@1469
|
43 |
//New edge button
|
hegyi@1478
|
44 |
buttons[CREATE_EDGE]=new Gtk::RadioButton("New Edge");
|
hegyi@1478
|
45 |
buttons[CREATE_EDGE]->set_mode(false);
|
hegyi@1478
|
46 |
buttons[CREATE_EDGE]->set_group(group);
|
hegyi@1478
|
47 |
buttons[CREATE_EDGE]->signal_clicked().connect
|
hegyi@1469
|
48 |
(
|
hegyi@1469
|
49 |
sigc::bind
|
hegyi@1469
|
50 |
(
|
hegyi@1469
|
51 |
sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
|
hegyi@1469
|
52 |
2
|
hegyi@1469
|
53 |
)
|
hegyi@1469
|
54 |
);
|
hegyi@1478
|
55 |
table.attach(*buttons[CREATE_EDGE],1,2,0,1);
|
hegyi@1469
|
56 |
|
hegyi@1469
|
57 |
//Move button
|
hegyi@1478
|
58 |
buttons[MOVE]=new Gtk::RadioButton("Move");
|
hegyi@1478
|
59 |
buttons[MOVE]->set_mode(false);
|
hegyi@1478
|
60 |
buttons[MOVE]->set_group(group);
|
hegyi@1478
|
61 |
buttons[MOVE]->signal_clicked().connect
|
hegyi@1469
|
62 |
(
|
hegyi@1469
|
63 |
sigc::bind
|
hegyi@1469
|
64 |
(
|
hegyi@1469
|
65 |
sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
|
hegyi@1469
|
66 |
0
|
hegyi@1469
|
67 |
)
|
hegyi@1469
|
68 |
);
|
hegyi@1478
|
69 |
table.attach(*buttons[MOVE],0,1,1,2);
|
hegyi@1478
|
70 |
|
hegyi@1485
|
71 |
//New edge button
|
hegyi@1485
|
72 |
buttons[ERASER]=new Gtk::RadioButton("Erase Item");
|
hegyi@1485
|
73 |
buttons[ERASER]->set_mode(false);
|
hegyi@1485
|
74 |
buttons[ERASER]->set_group(group);
|
hegyi@1485
|
75 |
buttons[ERASER]->signal_clicked().connect
|
hegyi@1485
|
76 |
(
|
hegyi@1485
|
77 |
sigc::bind
|
hegyi@1485
|
78 |
(
|
hegyi@1485
|
79 |
sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
|
hegyi@1485
|
80 |
3
|
hegyi@1485
|
81 |
)
|
hegyi@1485
|
82 |
);
|
hegyi@1485
|
83 |
table.attach(*buttons[ERASER],1,2,1,2);
|
hegyi@1485
|
84 |
|
hegyi@1469
|
85 |
add(table);
|
hegyi@1469
|
86 |
|
hegyi@1469
|
87 |
show_all_children();
|
hegyi@1469
|
88 |
|
hegyi@1469
|
89 |
}
|
hegyi@1469
|
90 |
|
hegyi@1469
|
91 |
void EditWin::makeEditorialToolChanged(int newtool)
|
hegyi@1469
|
92 |
{
|
hegyi@1469
|
93 |
gdc.changeEditorialTool(newtool);
|
hegyi@1469
|
94 |
}
|