Hopefully, node creation works well, after a small structural consideration.
4 bool MapWin::close_if_escape_is_pressed(GdkEventKey* e)
6 if(e->keyval==GDK_Escape)
13 MapWin::MapWin(const std::string& title, MapStorage & mapst, GraphDisplayerCanvas & grdispc):gdc(grdispc),ms(mapst),table(PROPERTY_NUM, 2, false)
16 set_default_size(200, 50);
18 signal_key_press_event().connect(sigc::mem_fun(*this, &MapWin::close_if_escape_is_pressed));
20 combo_array=new Gtk::Combo [PROPERTY_NUM];
22 for(int i=0;i<PROPERTY_NUM;i++)
25 std::map< std::string,Graph::EdgeMap<double> * >::iterator emsi=ms.beginOfEdgeMaps();
30 //here we find out, which map is the default in MapStorage for this property, which are not
31 for(int j=0;j<ms.numOfEdgeMaps();j++)
33 //this is the default value for this property
34 if(emsi->second==&(ms.default_edgemaps[i]))
38 //this is the other maps to show for this property
39 for(int k=0;k<PROPERTY_NUM;k++)
41 if(emsi->second==&(ms.default_edgemaps[k]))
49 //combo_array[i].set_group(group);
51 //filling in combo box with choices
52 std::list<Glib::ustring> listStrings;
54 listStrings.push_back("Default");
56 emsi=ms.beginOfEdgeMaps();
58 for(int j=0;j<ms.numOfEdgeMaps();j++)
60 if( ( props.find(j) )==( props.end() ) )
62 listStrings.push_back(emsi->first);
67 combo_array[i].set_popdown_strings(listStrings);
69 //Restrict it to these choices only:
70 combo_array[i].set_value_in_list();
72 //binding signal to thew actual entry
73 combo_array[i].get_entry()->signal_changed().connect
77 sigc::mem_fun(*this, &MapWin::combo_changed),
82 //placing actual entry in the right place
85 label->set_text(property_strings[i]);
87 // labelpluscombo=new Gtk::HBox;
88 // labelpluscombo->pack_start(*label);
89 // labelpluscombo->pack_start(combo_array[i]);
91 table.attach(*label,0,1,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
92 table.attach(combo_array[i],1,2,i,i+1,Gtk::SHRINK,Gtk::SHRINK,10,3);
95 if(actpos<(ms.numOfEdgeMaps()-PROPERTY_NUM+1)/2)
97 vbox_r1.pack_start(*labelpluscombo);
101 vbox_r2.pack_start(*labelpluscombo);
108 combos.pack_start(vbox_r1);
109 combos.pack_start(vbox_r2);
118 void MapWin::combo_changed(int prop)
121 //most nem kommentezem fel, mert ugyis valtozik
122 Gtk::Entry* entry = combo_array[prop].get_entry();
126 Glib::ustring mapname = entry->get_text();
127 if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
129 if(mapname=="Default")
131 mapname=property_strings[prop];
134 if( (ms.edgemap_storage).find(mapname) != (ms.edgemap_storage).end() )
139 gdc.changeLineWidth(mapname);
142 gdc.changeColor(mapname);
145 gdc.changeText(mapname);
148 std::cout<<"Error\n";