コード例 #1
0
void RSFilechooser::do_action()
{
  const Gtk::FileChooserAction action = ((Gtk::FileChooser*)chooser)->get_action();
  if (action == Gtk::FILE_CHOOSER_ACTION_OPEN)
    view->do_load();
  else if (action == Gtk::FILE_CHOOSER_ACTION_SAVE) {
    switch(filetype) {
    case MODEL: view->do_save_stl(); break;
    case GCODE: view->do_save_gcode(); break;
    case SETTINGS: view->do_save_settings_as(); break;
    case SVG:
      {
	bool singlelayer = false;
	Gtk::CheckButton *mult;
	builder->get_widget("save_multiple", mult);
	if (mult) 
	  singlelayer = mult->get_state();
	view->do_slice_svg(singlelayer); 
      }
      break;
    default: break;
    }
  }
  // get updated paths
  Model * model = view->get_model(); 
  if (model) {
    ModelPath    = model->settings.STLPath;
    GCodePath    = model->settings.GCodePath;
    SettingsPath = model->settings.SettingsPath;
  } else cerr << "no settings default paths" << endl;
  if (filetype == GCODE)
    view->show_notebooktab("gcode_tab", "controlnotebook");
  else
    view->show_notebooktab("model_tab", "controlnotebook");
}