Changeset 154:65c1b103443d in glemon-0.x
- Timestamp:
- 09/25/06 17:30:04 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/glemon/trunk@2958
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
graph_displayer_canvas-node.cc
r96 r154 17 17 double v=fabs((*actual_map)[i]); 18 18 int w; 19 if(min==max) 20 { 21 w=(int)(node_property_defaults[N_RADIUS]); 22 } 23 else 24 { 25 w=(int)(MIN_NODE_RADIUS+(v-min)/(max-min)*(MAX_NODE_RADIUS-MIN_NODE_RADIUS)); 19 if(autoscale) 20 { 21 if(min==max) 22 { 23 w=(int)(node_property_defaults[N_RADIUS]); 24 } 25 else 26 { 27 w=(int)(radius_min+(v-min)/(max-min)*(radius_max-radius_min)); 28 } 29 } 30 else 31 { 32 w=5+(int)(v/radius_unit); 26 33 } 27 34 if(w>=0) … … 42 49 { 43 50 //I think only new nodes use this case 44 // int w=(int)(*actual_map)[node]; 51 //that has no own value, only the default one 52 //int w=(int)(*actual_map)[node]; 45 53 int w=(int)(node_property_defaults[N_RADIUS]); 46 54 if(w>=0) -
graph_displayer_canvas.cc
r151 r154 6 6 nodetextmap(mainw.mapstorage.graph), displayed_graph(*(root()), 0, 0), 7 7 isbutton(0), active_item(NULL), target_item(NULL), nodemap_to_edit(""), 8 edgemap_to_edit(""), mytab(mainw)8 edgemap_to_edit(""), autoscale(true), radius_min(10), radius_max(40), radius_unit(1), mytab(mainw) 9 9 { 10 10 //base event handler is move tool … … 227 227 } 228 228 } 229 230 void GraphDisplayerCanvas::setNodeView(bool autoscale_p, double min_p, double max_p, double unit_p) 231 { 232 autoscale=autoscale_p; 233 radius_min=min_p; 234 radius_max=max_p; 235 radius_unit=unit_p; 236 propertyChange(false, N_RADIUS); 237 } 238 239 void GraphDisplayerCanvas::getNodeView(bool & autoscale_p, double& min_p, double& max_p, double& unit_p) 240 { 241 autoscale_p=autoscale; 242 min_p=radius_min; 243 max_p=radius_max; 244 unit_p=radius_unit; 245 } -
graph_displayer_canvas.h
r151 r154 287 287 int getActualTool(); 288 288 289 ///Sets node representation settings 290 void setNodeView(bool, double, double, double); 291 292 ///Gets node representation settings 293 void getNodeView(bool &, double&, double&, double&); 294 289 295 ///draws the graph 290 296 … … 378 384 static const int zoom_step = 5; 379 385 386 ///Is node radius autoscaled 387 bool autoscale; 388 389 ///Minimum node radius 390 double radius_min; 391 392 ///Maximum node radius 393 double radius_max; 394 395 ///Node radius unit 396 double radius_unit; 397 380 398 private: 381 399 -
main_win.cc
r149 r154 12 12 set_title ("no file"); 13 13 set_default_size(WIN_WIDTH,WIN_HEIGHT); 14 add(vbox); 14 //add(vbox); 15 add(table); 15 16 16 17 // custom icons for the toolbar … … 186 187 Gtk::Widget* menubar = uim->get_widget("/MenuBar"); 187 188 if (menubar){ 188 vbox.pack_start(*menubar, Gtk::PACK_SHRINK); 189 //vbox.pack_start(*menubar, Gtk::PACK_SHRINK); 190 table.attach(*menubar, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); 189 191 } 190 192 … … 193 195 { 194 196 static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS); 195 vbox.pack_start(*toolbar, Gtk::PACK_SHRINK); 197 //hbox.pack_start(*toolbar, Gtk::PACK_EXPAND_WIDGET); 198 199 table.attach(*toolbar, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); 200 196 201 } 202 203 auto_scale= new Gtk::CheckButton("Autoscale"); 204 auto_scale->set_active(false); 205 auto_scale->signal_toggled().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 206 207 table2.set_row_spacings(10); 208 table2.set_col_spacings(5); 209 210 table2.attach(*auto_scale, 0,2,0,1); 211 212 Gtk::Label * unit_label= new Gtk::Label("Unit:"); 213 table2.attach(*unit_label, 2,3,0,1); 214 215 Gtk::Adjustment * adjustment_unit=new Gtk::Adjustment(20, 5, 200, 5, 10); 216 217 radius_unit = new Gtk::SpinButton(*adjustment_unit, 5,0); 218 radius_unit->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 219 table2.attach(*radius_unit, 3,4,0,1); 220 221 Gtk::Label * min_label= new Gtk::Label("Min:"); 222 table2.attach(*min_label, 0,1,1,2); 223 224 Gtk::Adjustment * adjustment_min=new Gtk::Adjustment(20, 5, 200, 5, 10); 225 226 radius_min = new Gtk::SpinButton(*adjustment_min, 5,0); 227 radius_min->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 228 table2.attach(*radius_min, 1,2,1,2); 229 230 Gtk::Label * max_label= new Gtk::Label("Max:"); 231 table2.attach(*max_label, 2,3,1,2); 232 233 Gtk::Adjustment * adjustment_max=new Gtk::Adjustment(20, 5, 200, 5, 10); 234 235 radius_max = new Gtk::SpinButton(*adjustment_max, 5,0); 236 radius_max->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); 237 table2.attach(*radius_max, 3,4,1,2); 238 239 //vbox.pack_start(hbox, Gtk::PACK_SHRINK); 240 table.attach(table2, 1, 2, 0, 2, Gtk::SHRINK, Gtk::SHRINK); 197 241 198 242 tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node"); … … 204 248 active_tool = MOVE; 205 249 206 vbox.pack_start(notebook); 250 //vbox.pack_start(notebook); 251 table.attach(notebook,0,2,2,3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL); 207 252 208 253 show_all_children(); … … 317 362 tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool); 318 363 set_title(tabnames[active_tab]); 364 bool autoscale; 365 double min; 366 double max; 367 double unit; 368 tabs[active_tab]->getNodeView(autoscale, min, max, unit); 369 radius_min->set_value(min); 370 radius_max->set_value(max); 371 radius_unit->set_value(unit); 372 auto_scale->set_active(autoscale); 373 319 374 } 320 375 … … 478 533 nmw->run(); 479 534 } 535 536 537 void MainWin::nodeViewChanged() 538 { 539 double min=radius_min->get_value(); 540 double max=radius_max->get_value(); 541 double unit=radius_unit->get_value(); 542 bool autoscale=auto_scale->get_active(); 543 tabs[active_tab]->setNodeView(autoscale, min, max, unit); 544 } -
main_win.h
r119 r154 21 21 { 22 22 ///Container in which the menus and the notebook is. 23 Gtk::VBox vbox; 23 //Gtk::VBox vbox; 24 Gtk::Table table; 25 Gtk::Table table2; 26 27 ///Container in which the toolbar and the node parametrizer is. 28 Gtk::HBox hbox; 29 30 ///Should nodes be autoscaled or not? 31 Gtk::CheckButton * auto_scale; 32 33 ///Minimum and maximum node radius entry 34 Gtk::SpinButton * radius_min, * radius_max, * radius_unit; 24 35 25 36 ///The notebook that has tabs (\ref NoteBookTab) with different graphs. … … 222 233 ///updates the title of window to the actually selected \ref NoteBookTab. 223 234 virtual void onChangeTab(GtkNotebookPage*, guint); 235 236 virtual void nodeViewChanged(); 224 237 }; 225 238 -
nbtab.cc
r136 r154 219 219 } 220 220 221 void NoteBookTab::setNodeView(bool autoscale, double min, double max, double unit) 222 { 223 gd_canvas->setNodeView(autoscale, min, max, unit); 224 } 225 226 void NoteBookTab::getNodeView(bool & autoscale, double& min, double& max, double& unit) 227 { 228 gd_canvas->getNodeView(autoscale, min, max, unit); 229 } -
nbtab.h
r121 r154 157 157 ///\ref mapwin. 158 158 void closeMapWin(); 159 160 ///Sets node representation settings 161 void setNodeView(bool, double, double, double); 162 163 ///Gets node representation settings 164 void getNodeView(bool &, double&, double&, double&); 159 165 }; 160 166
Note: See TracChangeset
for help on using the changeset viewer.