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@1469
|
17 |
|
hegyi@1469
|
18 |
signal_key_press_event().connect(sigc::mem_fun(*this, &EditWin::close_if_escape_is_pressed));
|
hegyi@1469
|
19 |
|
hegyi@1469
|
20 |
//New node button
|
hegyi@1469
|
21 |
button=new Gtk::Button("New Node");
|
hegyi@1469
|
22 |
button->signal_clicked().connect
|
hegyi@1469
|
23 |
(
|
hegyi@1469
|
24 |
sigc::bind
|
hegyi@1469
|
25 |
(
|
hegyi@1469
|
26 |
sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
|
hegyi@1469
|
27 |
1
|
hegyi@1469
|
28 |
)
|
hegyi@1469
|
29 |
);
|
hegyi@1469
|
30 |
table.attach(*button,0,1,0,1);
|
hegyi@1469
|
31 |
|
hegyi@1469
|
32 |
//New edge button
|
hegyi@1469
|
33 |
button=new Gtk::Button("New Edge");
|
hegyi@1469
|
34 |
button->signal_clicked().connect
|
hegyi@1469
|
35 |
(
|
hegyi@1469
|
36 |
sigc::bind
|
hegyi@1469
|
37 |
(
|
hegyi@1469
|
38 |
sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
|
hegyi@1469
|
39 |
2
|
hegyi@1469
|
40 |
)
|
hegyi@1469
|
41 |
);
|
hegyi@1469
|
42 |
table.attach(*button,1,2,0,1);
|
hegyi@1469
|
43 |
|
hegyi@1469
|
44 |
//Move button
|
hegyi@1469
|
45 |
button=new Gtk::Button("Move");
|
hegyi@1469
|
46 |
button->signal_clicked().connect
|
hegyi@1469
|
47 |
(
|
hegyi@1469
|
48 |
sigc::bind
|
hegyi@1469
|
49 |
(
|
hegyi@1469
|
50 |
sigc::mem_fun(*this, &EditWin::makeEditorialToolChanged),
|
hegyi@1469
|
51 |
0
|
hegyi@1469
|
52 |
)
|
hegyi@1469
|
53 |
);
|
hegyi@1469
|
54 |
table.attach(*button,0,1,1,2);
|
hegyi@1469
|
55 |
|
hegyi@1469
|
56 |
add(table);
|
hegyi@1469
|
57 |
|
hegyi@1469
|
58 |
show_all_children();
|
hegyi@1469
|
59 |
|
hegyi@1469
|
60 |
}
|
hegyi@1469
|
61 |
|
hegyi@1469
|
62 |
void EditWin::makeEditorialToolChanged(int newtool)
|
hegyi@1469
|
63 |
{
|
hegyi@1469
|
64 |
gdc.changeEditorialTool(newtool);
|
hegyi@1469
|
65 |
}
|