gui/mw-mapselector.cc
changeset 1882 2c3f6c7e01b4
parent 1881 f40cdc2057c2
child 1883 05b0e8d057a6
     1.1 --- a/gui/mw-mapselector.cc	Fri Jan 06 13:58:49 2006 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,136 +0,0 @@
     1.4 -#include "map_win.h"
     1.5 -
     1.6 -MapWin::MapSelector::MapSelector(std::vector<std::string> ml, std::string act, int identifier, bool edge):id(identifier),itisedge(edge),set_new_map(false)
     1.7 -{
     1.8 -  update_list(ml);
     1.9 -
    1.10 -  if(act=="")
    1.11 -    {
    1.12 -      cbt.set_active(0);
    1.13 -      default_state=true;
    1.14 -    }
    1.15 -  else
    1.16 -    {
    1.17 -      cbt.set_active_text((Glib::ustring)act);
    1.18 -      default_state=false;
    1.19 -    }
    1.20 -
    1.21 -  //binding signal to the actual entry
    1.22 -  cbt.signal_changed().connect
    1.23 -    (
    1.24 -     sigc::mem_fun((*this), &MapWin::MapSelector::comboChanged),
    1.25 -     false
    1.26 -     );
    1.27 -  
    1.28 -  if(itisedge)
    1.29 -    {
    1.30 -      label=new Gtk::Label(edge_property_strings[id]);
    1.31 -    }
    1.32 -  else
    1.33 -    {
    1.34 -      label=new Gtk::Label(node_property_strings[id]);
    1.35 -    }
    1.36 -
    1.37 -  label->set_width_chars(longest_property_string_length);
    1.38 -
    1.39 -  defbut=new Gtk::Button();
    1.40 -  defbut->set_label("Reset");
    1.41 -
    1.42 -  defbut->signal_pressed().connect
    1.43 -    (
    1.44 -     sigc::mem_fun(*this, &MapWin::MapSelector::reset)
    1.45 -     );
    1.46 -
    1.47 -  newbut=new Gtk::Button(Gtk::Stock::NEW);
    1.48 -
    1.49 -  newbut->signal_pressed().connect
    1.50 -    (
    1.51 -     sigc::mem_fun(*this, &MapWin::MapSelector::new_but_pressed)
    1.52 -     );
    1.53 -
    1.54 -  add(*label);
    1.55 -
    1.56 -  add(cbt);
    1.57 -
    1.58 -  add(*defbut);
    1.59 -  add(*newbut);
    1.60 -}
    1.61 -
    1.62 -void MapWin::MapSelector::new_but_pressed()
    1.63 -{
    1.64 -  set_new_map=true;
    1.65 -  signal_newmapwin.emit(itisedge);
    1.66 -}
    1.67 -
    1.68 -void MapWin::MapSelector::update_list( std::vector< std::string > ml )
    1.69 -{
    1.70 -  int prev_act=cbt.get_active_row_number();
    1.71 -  cbt.clear();
    1.72 -  std::vector< std::string >::iterator emsi=ml.begin();
    1.73 -  for(;emsi!=ml.end();emsi++)
    1.74 -    {
    1.75 -      cbt.append_text(*emsi);
    1.76 -    }
    1.77 -  cbt.prepend_text("Default values");
    1.78 -  if(prev_act!=-1)
    1.79 -    {
    1.80 -      cbt.set_active(prev_act);
    1.81 -    }
    1.82 -}
    1.83 -
    1.84 -void MapWin::MapSelector::comboChanged()
    1.85 -{
    1.86 -  if(cbt.get_active_row_number()!=0)
    1.87 -    {
    1.88 -      default_state=false;
    1.89 -      Glib::ustring mapname = cbt.get_active_text();
    1.90 -      if(!(mapname.empty())) //We seem to get 2 signals, one when the text is empty.
    1.91 -	{
    1.92 -	  signal_cbt.emit(mapname);
    1.93 -	}
    1.94 -    }
    1.95 -  else if((!default_state)&&(cbt.get_active_row_number()==0))
    1.96 -    {
    1.97 -      reset();
    1.98 -    }
    1.99 -}
   1.100 -
   1.101 -void MapWin::MapSelector::reset()
   1.102 -{
   1.103 -  default_state=true;
   1.104 -
   1.105 -  cbt.set_active(0);
   1.106 -
   1.107 -  signal_cbt.emit("");
   1.108 -}
   1.109 -
   1.110 -
   1.111 -Glib::ustring MapWin::MapSelector::get_active_text()
   1.112 -{
   1.113 -  return cbt.get_active_text();
   1.114 -}
   1.115 -
   1.116 -void MapWin::MapSelector::set_active_text(Glib::ustring text)
   1.117 -{
   1.118 -  cbt.set_active_text(text);
   1.119 -}
   1.120 -
   1.121 -void MapWin::MapSelector::append_text(Glib::ustring text)
   1.122 -{
   1.123 -  cbt.append_text(text);
   1.124 -  if(set_new_map)
   1.125 -    {
   1.126 -      set_active_text(text);
   1.127 -      set_new_map=false;
   1.128 -    }
   1.129 -}
   1.130 -
   1.131 -sigc::signal<void, std::string> MapWin::MapSelector::signal_cbt_ch()
   1.132 -{
   1.133 -  return signal_cbt;
   1.134 -}
   1.135 -
   1.136 -sigc::signal<void, bool> MapWin::MapSelector::signal_newmapwin_needed()
   1.137 -{
   1.138 -  return signal_newmapwin;
   1.139 -}