main_win.cc
changeset 154 65c1b103443d
parent 149 930e838ad5b6
child 155 74065e83844d
     1.1 --- a/main_win.cc	Mon Sep 25 12:08:35 2006 +0000
     1.2 +++ b/main_win.cc	Mon Sep 25 15:30:04 2006 +0000
     1.3 @@ -11,7 +11,8 @@
     1.4  {
     1.5    set_title ("no file");
     1.6    set_default_size(WIN_WIDTH,WIN_HEIGHT);
     1.7 -  add(vbox);
     1.8 +  //add(vbox);
     1.9 +  add(table);
    1.10  
    1.11    // custom icons for the toolbar
    1.12    Glib::RefPtr<Gtk::IconFactory> p_icon_factory = Gtk::IconFactory::create();
    1.13 @@ -185,16 +186,59 @@
    1.14  
    1.15    Gtk::Widget* menubar = uim->get_widget("/MenuBar");
    1.16    if (menubar){
    1.17 -    vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
    1.18 +    //vbox.pack_start(*menubar, Gtk::PACK_SHRINK);
    1.19 +    table.attach(*menubar, 0, 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
    1.20    }
    1.21  
    1.22    Gtk::Widget* toolbar = uim->get_widget("/ToolBar");
    1.23    if (toolbar)
    1.24    {
    1.25      static_cast<Gtk::Toolbar*>(toolbar)->set_toolbar_style(Gtk::TOOLBAR_ICONS);
    1.26 -    vbox.pack_start(*toolbar, Gtk::PACK_SHRINK);
    1.27 +    //hbox.pack_start(*toolbar, Gtk::PACK_EXPAND_WIDGET);
    1.28 +
    1.29 +    table.attach(*toolbar, 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
    1.30 +
    1.31    }
    1.32  
    1.33 +  auto_scale= new Gtk::CheckButton("Autoscale");
    1.34 +  auto_scale->set_active(false);
    1.35 +  auto_scale->signal_toggled().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
    1.36 +
    1.37 +  table2.set_row_spacings(10);
    1.38 +  table2.set_col_spacings(5);
    1.39 +
    1.40 +  table2.attach(*auto_scale, 0,2,0,1);
    1.41 + 
    1.42 +  Gtk::Label * unit_label= new Gtk::Label("Unit:");
    1.43 +  table2.attach(*unit_label, 2,3,0,1);
    1.44 +  
    1.45 +  Gtk::Adjustment * adjustment_unit=new Gtk::Adjustment(20, 5, 200, 5, 10);
    1.46 +
    1.47 +  radius_unit = new Gtk::SpinButton(*adjustment_unit, 5,0);
    1.48 +  radius_unit->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
    1.49 +  table2.attach(*radius_unit, 3,4,0,1);
    1.50 +
    1.51 +  Gtk::Label * min_label= new Gtk::Label("Min:");
    1.52 +  table2.attach(*min_label, 0,1,1,2);
    1.53 +  
    1.54 +  Gtk::Adjustment * adjustment_min=new Gtk::Adjustment(20, 5, 200, 5, 10);
    1.55 +
    1.56 +  radius_min = new Gtk::SpinButton(*adjustment_min, 5,0);
    1.57 +  radius_min->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
    1.58 +  table2.attach(*radius_min, 1,2,1,2);
    1.59 +
    1.60 +  Gtk::Label * max_label= new Gtk::Label("Max:");
    1.61 +  table2.attach(*max_label, 2,3,1,2);
    1.62 +  
    1.63 +  Gtk::Adjustment * adjustment_max=new Gtk::Adjustment(20, 5, 200, 5, 10);
    1.64 +
    1.65 +  radius_max = new Gtk::SpinButton(*adjustment_max, 5,0);
    1.66 +  radius_max->signal_value_changed().connect(sigc::mem_fun(*this, &MainWin::nodeViewChanged));
    1.67 +  table2.attach(*radius_max, 3,4,1,2);
    1.68 +
    1.69 +  //vbox.pack_start(hbox, Gtk::PACK_SHRINK);
    1.70 +  table.attach(table2, 1, 2, 0, 2, Gtk::SHRINK, Gtk::SHRINK);
    1.71 +
    1.72    tooltips.set_tip(*(uim->get_widget("/ToolBar/CreateNode")),"Create Node");
    1.73    tooltips.enable();
    1.74  
    1.75 @@ -203,7 +247,8 @@
    1.76  
    1.77    active_tool = MOVE;
    1.78  
    1.79 -  vbox.pack_start(notebook);
    1.80 +  //vbox.pack_start(notebook);
    1.81 +  table.attach(notebook,0,2,2,3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL);
    1.82    
    1.83    show_all_children();
    1.84  }
    1.85 @@ -316,6 +361,16 @@
    1.86    active_tab=page_num;
    1.87    tabs[active_tab]->gd_canvas->changeEditorialTool(active_tool);
    1.88    set_title(tabnames[active_tab]);
    1.89 +  bool autoscale;
    1.90 +  double min;
    1.91 +  double max;
    1.92 +  double unit;
    1.93 +  tabs[active_tab]->getNodeView(autoscale, min, max, unit);
    1.94 +  radius_min->set_value(min);
    1.95 +  radius_max->set_value(max);
    1.96 +  radius_unit->set_value(unit);
    1.97 +  auto_scale->set_active(autoscale);
    1.98 +
    1.99  }
   1.100  
   1.101  void MainWin::newFile()
   1.102 @@ -477,3 +532,13 @@
   1.103    NewMapWin * nmw=new NewMapWin(_("Create New Map - ")+tabnames[i], *nbt, itisedge, false);
   1.104    nmw->run();
   1.105  }
   1.106 +
   1.107 +
   1.108 +void MainWin::nodeViewChanged()
   1.109 +{
   1.110 +  double min=radius_min->get_value();
   1.111 +  double max=radius_max->get_value();
   1.112 +  double unit=radius_unit->get_value();
   1.113 +  bool autoscale=auto_scale->get_active();
   1.114 +  tabs[active_tab]->setNodeView(autoscale, min, max, unit);
   1.115 +}