Dependency problem (guipixbufs.h) is solved.
1 #include <new_map_win.h>
3 bool NewMapWin::closeIfEscapeIsPressed(GdkEventKey* e)
5 if(e->keyval==GDK_Escape)
12 NewMapWin::NewMapWin(const std::string& title, GraphDisplayerCanvas & grdispc):gdc(grdispc),node("Create NodeMap"),edge("Create EdgeMap")
15 set_default_size(200, 50);
17 signal_key_press_event().connect(sigc::mem_fun(*this, &NewMapWin::closeIfEscapeIsPressed));
21 table=new Gtk::Table(3, 2, false);
24 label->set_text("Name of new map:");
27 (*table).attach(*label,0,1,0,1,Gtk::SHRINK,Gtk::SHRINK,10,3);
28 (*table).attach(name,1,2,0,1,Gtk::SHRINK,Gtk::SHRINK,10,3);
31 label->set_text("Default value in the map:");
32 default_value.set_text("0");
34 (*table).attach(*label,0,1,1,2,Gtk::SHRINK,Gtk::SHRINK,10,3);
35 (*table).attach(default_value,1,2,1,2,Gtk::SHRINK,Gtk::SHRINK,10,3);
37 //node vs. edge map selector
38 Gtk::RadioButton::Group group = node.get_group();
39 edge.set_group(group);
41 (*table).attach(node,0,1,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
42 (*table).attach(edge,1,2,2,3,Gtk::SHRINK,Gtk::SHRINK,10,3);
44 vbox.pack_start(*table);
47 button=new Gtk::Button("OK");
49 button->signal_clicked().connect
51 sigc::mem_fun(*this, &NewMapWin::buttonPressed)
55 vbox.pack_start(*button);
63 void NewMapWin::buttonPressed()
65 bool valid_double=true;
68 std::string def_val_str=default_value.get_text();
69 char * def_val_ch=new char [def_val_str.length()];
70 for(int i=0;i<(int)(def_val_str.length());i++)
72 if(((def_val_str[i]<'0')||(def_val_str[i]>'9'))&&(def_val_str[i]!='.'))
78 if(def_val_str[i]=='.')
83 def_val_ch[i]=def_val_str[i];
86 double def_val=atof(def_val_ch);
88 std::string mapname=name.get_text();
90 if((point_num<=1)&&(valid_double)&&(!mapname.empty()))
95 abortion=gdc.addNewEdgeMap(def_val,mapname);
99 abortion=gdc.addNewNodeMap(def_val,mapname);
104 default_value.set_text("0");