# HG changeset patch # User hegyi # Date 1159815120 0 # Node ID 7e6ad28aeb9e3c0dcadf009dd55c4137e623d98a # Parent c5cdf6690cdfde60839e99fd697dc31ebad7b597 View settings also for edges. diff -r c5cdf6690cdf -r 7e6ad28aeb9e graph_displayer_canvas-edge.cc --- a/graph_displayer_canvas-edge.cc Thu Sep 28 14:32:40 2006 +0000 +++ b/graph_displayer_canvas-edge.cc Mon Oct 02 18:52:00 2006 +0000 @@ -1,6 +1,7 @@ #include "graph_displayer_canvas.h" #include +const int minimum_edge_width=2; int GraphDisplayerCanvas::resetEdgeWidth (Edge edge) { @@ -24,6 +25,11 @@ { w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH)); } + if(zoomtrack) + { + double actual_ppu=get_pixels_per_unit(); + w=(int)(w/actual_ppu*fixed_zoom_factor); + } edgesmap[i]->setLineWidth(w); } } @@ -54,13 +60,29 @@ { double v=fabs((*actual_map)[i]); int w; - if(min==max) + if(autoscale) { - w=(int)(edge_property_defaults[E_WIDTH]); + if(min==max) + { + w=(int)(edge_property_defaults[E_WIDTH]); + } + else + { + w=(int)(minimum_edge_width+(v-min)/(max-min)*(edge_width-minimum_edge_width)); + } } else { - w=(int)(MIN_EDGE_WIDTH+(v-min)/(max-min)*(MAX_EDGE_WIDTH-MIN_EDGE_WIDTH)); + w=(int)(v*edge_width); + } + if(wsetLineWidth(w); } diff -r c5cdf6690cdf -r 7e6ad28aeb9e graph_displayer_canvas-node.cc --- a/graph_displayer_canvas-node.cc Thu Sep 28 14:32:40 2006 +0000 +++ b/graph_displayer_canvas-node.cc Mon Oct 02 18:52:00 2006 +0000 @@ -1,7 +1,7 @@ #include "graph_displayer_canvas.h" #include -const int minimum_node_radius=0; +const int minimum_node_radius=5; int GraphDisplayerCanvas::changeNodeRadius (std::string mapname, Node node) { @@ -25,17 +25,17 @@ } else { - w=(int)(minimum_node_radius+(v-min)/(max-min)*(radius_max-minimum_node_radius)); + w=(int)(minimum_node_radius+(v-min)/(max-min)*(radius_size-minimum_node_radius)); } } else { - w=(int)(v*radius_max); + w=(int)(v*radius_size); } - if(w<5) + if(wsignal_toggled().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); table2.attach(*auto_scale, 0,2,0,1); - Gtk::Label * unit_label= new Gtk::Label("Unit:"); -// table2.attach(*unit_label, 2,3,0,1); + Gtk::Label * width_label= new Gtk::Label("Edge Width:"); + table2.attach(*width_label, 0,1,1,2); - Gtk::Adjustment * adjustment_unit=new Gtk::Adjustment(20, 5, 200, 5, 10); + Gtk::Adjustment * adjustment_width=new Gtk::Adjustment(20, 1, 200, 5, 10); + + edge_width = new Gtk::SpinButton(*adjustment_width, 5,0); + edge_width->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); + table2.attach(*edge_width, 1,2,1,2); - radius_unit = new Gtk::SpinButton(*adjustment_unit, 5,0); - radius_unit->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); -// table2.attach(*radius_unit, 3,4,0,1); + Gtk::Label * radius_label= new Gtk::Label("Node Radius:"); + table2.attach(*radius_label, 2,3,1,2); + + Gtk::Adjustment * adjustment_radius=new Gtk::Adjustment(20, 0, 500, 5, 10); - Gtk::Label * min_label= new Gtk::Label("Min:"); -// table2.attach(*min_label, 0,1,1,2); - - Gtk::Adjustment * adjustment_min=new Gtk::Adjustment(20, 5, 200, 5, 10); - - radius_min = new Gtk::SpinButton(*adjustment_min, 5,0); - radius_min->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); -// table2.attach(*radius_min, 1,2,1,2); - - Gtk::Label * max_label= new Gtk::Label("Size:"); - table2.attach(*max_label, 2,3,1,2); - - Gtk::Adjustment * adjustment_max=new Gtk::Adjustment(20, 0, 200, 5, 10); - - radius_max = new Gtk::SpinButton(*adjustment_max, 5,0); - radius_max->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); - table2.attach(*radius_max, 3,4,1,2); + radius_size = new Gtk::SpinButton(*adjustment_radius, 5,0); + radius_size->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged)); + table2.attach(*radius_size, 3,4,1,2); zoom_track = new Gtk::CheckButton("Zoom tracking"); zoom_track->set_active(false); @@ -241,7 +232,6 @@ table2.attach(*zoom_track, 2,4,0,1); - //vbox.pack_start(hbox, Gtk::PACK_SHRINK); table.attach(table2, 1, 2, 0, 2, Gtk::SHRINK, Gtk::SHRINK); tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node"); @@ -252,7 +242,6 @@ active_tool = MOVE; - //vbox.pack_start(notebook); table.attach(notebook,0,2,2,3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL); show_all_children(); @@ -368,13 +357,12 @@ set_title(tabnames[active_tab]); bool autoscale; bool zoomtrack; - double min; - double max; + double width; + double radius; double unit; - tabs[active_tab]->getNodeView(autoscale, zoomtrack, min, max, unit); - radius_min->set_value(min); - radius_max->set_value(max); - radius_unit->set_value(unit); + tabs[active_tab]->getView(autoscale, zoomtrack, width, radius); + edge_width->set_value(width); + radius_size->set_value(radius); zoom_track->set_active(zoomtrack); auto_scale->set_active(autoscale); @@ -543,10 +531,10 @@ void MainWin::nodeViewChanged() { - double min=radius_min->get_value(); - double max=radius_max->get_value(); - double unit=radius_unit->get_value(); + double width=edge_width->get_value(); + double radius=radius_size->get_value(); + double unit; bool zoomtrack=zoom_track->get_active(); bool autoscale=auto_scale->get_active(); - tabs[active_tab]->setNodeView(autoscale, zoomtrack, min, max, unit); + tabs[active_tab]->setView(autoscale, zoomtrack, width, radius); } diff -r c5cdf6690cdf -r 7e6ad28aeb9e main_win.h --- a/main_win.h Thu Sep 28 14:32:40 2006 +0000 +++ b/main_win.h Mon Oct 02 18:52:00 2006 +0000 @@ -34,7 +34,7 @@ Gtk::CheckButton * zoom_track; ///Minimum and maximum node radius entry - Gtk::SpinButton * radius_min, * radius_max, * radius_unit; + Gtk::SpinButton * radius_size, * edge_width; ///The notebook that has tabs (\ref NoteBookTab) with different graphs. Gtk::Notebook notebook; diff -r c5cdf6690cdf -r 7e6ad28aeb9e nbtab.cc --- a/nbtab.cc Thu Sep 28 14:32:40 2006 +0000 +++ b/nbtab.cc Mon Oct 02 18:52:00 2006 +0000 @@ -218,12 +218,12 @@ return signal_title; } -void NoteBookTab::setNodeView(bool autoscale, bool zoomtrack, double min, double max, double unit) +void NoteBookTab::setView(bool autoscale, bool zoomtrack, double width, double radius) { - gd_canvas->setNodeView(autoscale, zoomtrack, min, max, unit); + gd_canvas->setView(autoscale, zoomtrack, width, radius); } -void NoteBookTab::getNodeView(bool & autoscale, bool & zoomtrack, double& min, double& max, double& unit) +void NoteBookTab::getView(bool & autoscale, bool & zoomtrack, double& width, double& radius) { - gd_canvas->getNodeView(autoscale, zoomtrack, min, max, unit); + gd_canvas->getView(autoscale, zoomtrack, width, radius); } diff -r c5cdf6690cdf -r 7e6ad28aeb9e nbtab.h --- a/nbtab.h Thu Sep 28 14:32:40 2006 +0000 +++ b/nbtab.h Mon Oct 02 18:52:00 2006 +0000 @@ -158,10 +158,10 @@ void closeMapWin(); ///Sets node representation settings - void setNodeView(bool, bool, double, double, double); + void setView(bool, bool, double, double); ///Gets node representation settings - void getNodeView(bool &, bool &, double&, double&, double&); + void getView(bool &, bool &, double&, double&); }; #endif //NBTAB_H