eps_win.cc
changeset 198 d6cc0579b94b
parent 196 c220f9de6545
child 201 879e47e5b731
equal deleted inserted replaced
2:8e393f36caed 3:f70620986d32
    15  * purpose.
    15  * purpose.
    16  *
    16  *
    17  */
    17  */
    18 
    18 
    19 #include <eps_win.h>
    19 #include <eps_win.h>
       
    20 
       
    21 #include <mapselector.h>
       
    22 
    20 #include <set>
    23 #include <set>
    21 
    24 
    22 bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
    25 bool EpsWin::closeIfEscapeIsPressed(GdkEventKey* e)
    23 {
    26 {
    24   if(e->keyval==GDK_Escape)
    27   if(e->keyval==GDK_Escape)
    26     hide();
    29     hide();
    27   }
    30   }
    28   return true;
    31   return true;
    29 }
    32 }
    30 
    33 
    31 EpsWin::EpsWin(const std::string& title):Gtk::Dialog(title, true, true)
    34 EpsWin::EpsWin(const std::string& title, std::vector<std::string> nml):Gtk::Dialog(title, true, true)
    32 {
    35 {
    33   set_default_size(200, 50);
    36   set_default_size(200, 50);
    34 
    37 
    35   set_resizable(false);
    38   set_resizable(false);
    36 
    39 
    52     {
    55     {
    53       options[i]=new Gtk::CheckButton(labels[i]);
    56       options[i]=new Gtk::CheckButton(labels[i]);
    54       (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
    57       (*table).attach(*(options[i]),0,1,i,i+1,Gtk::FILL,Gtk::SHRINK,10,3);
    55     }
    58     }
    56 
    59 
       
    60   mapselector=new MapSelector(nml, "", "Nodeshapes", false);
       
    61   mapselector->signal_newmapwin_needed().connect(sigc::mem_fun(*this, &EpsWin::newMapWinNeeded));
       
    62 
    57   hbox.pack_start(*(new Gtk::Label("Filename")));
    63   hbox.pack_start(*(new Gtk::Label("Filename")));
    58   hbox.pack_start(name);
    64   hbox.pack_start(name);
    59 
    65 
    60   Gtk::VBox * vbox=get_vbox();
    66   Gtk::VBox * vbox=get_vbox();
    61 
    67 
    62   vbox->pack_start(*table);
    68   vbox->pack_start(*table);
       
    69   vbox->pack_start(*mapselector);
    63   vbox->pack_start(hbox);
    70   vbox->pack_start(hbox);
    64 
    71 
    65   //OK button
    72   //OK button
    66   add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    73   add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
    67   add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    74   add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
    85       values.resize(EPS_PROPERTY_NUM);
    92       values.resize(EPS_PROPERTY_NUM);
    86       for(int i=0;i<EPS_PROPERTY_NUM;i++)
    93       for(int i=0;i<EPS_PROPERTY_NUM;i++)
    87 	{
    94 	{
    88 	  values[i]=options[i]->get_active();
    95 	  values[i]=options[i]->get_active();
    89 	}
    96 	}
    90       signal_eps_details.emit(values, name.get_text());
    97       signal_eps_details.emit(values, name.get_text(), mapselector->get_active_text());
    91     }
    98     }
    92   on_delete_event(NULL);
    99   on_delete_event(NULL);
    93 }
   100 }
       
   101 
       
   102 void EpsWin::newMapWinNeeded(bool isitedge)
       
   103 {
       
   104   signal_new_map.emit(false);
       
   105 }
       
   106 
       
   107 void EpsWin::registerNewNodeMap(std::string newmapname)
       
   108 {
       
   109     mapselector->append_text((Glib::ustring)newmapname);
       
   110 }