コード例 #1
0
// Callback for objective entity selection changed in list box
void ObjectivesEditor::_onEntitySelectionChanged()
{
	// Clear the objectives list
	_objectiveList->clear();
	
    Gtk::Button* delEntityButton = gladeWidget<Gtk::Button>(
        "deleteEntityButton"
    );
    Gtk::Widget* objButtonPanel = gladeWidget<Gtk::Widget>(
        "objButtonPanel"
    );

	// Get the selection
    Gtk::TreeView* entityList = gladeWidget<Gtk::TreeView>(
        "entitiesTreeView"
    );
	Gtk::TreeModel::iterator iter = entityList->get_selection()->get_selected();
	if (iter) 
    {
		// Get name of the entity and find the corresponding ObjectiveEntity in
		// the map
		std::string name = Glib::ustring((*iter)[_objEntityColumns.entityName]);

		// Save the current selection and refresh the objectives list
		_curEntity = _entities.find(name);
		refreshObjectivesList();

		// Enable the delete button and objectives panel
		delEntityButton->set_sensitive(true);
        objButtonPanel->set_sensitive(true);

        // Enable mission logic button
        gladeWidget<Gtk::Widget>(
            "editSuccessLogicButton"
        )->set_sensitive(true);

		// Enable obj condition button
        gladeWidget<Gtk::Widget>(
            "editObjectiveConditionsButton"
        )->set_sensitive(true);
	}
	else
    {
		// No selection, disable the delete button and clear the objective
		// panel
		delEntityButton->set_sensitive(false);
		objButtonPanel->set_sensitive(false);

        // Disable mission logic button
        gladeWidget<Gtk::Widget>(
            "editSuccessLogicButton"
        )->set_sensitive(false);

		// Disable obj condition button
        gladeWidget<Gtk::Widget>(
            "editObjectiveConditionsButton"
        )->set_sensitive(false);
	}
}
コード例 #2
0
    virtual void do_refresh_form_data()
    {
        Gtk::Entry *entry;
        xml()->get_widget("name_entry", entry);

        Gtk::TextView *tview;
        xml()->get_widget("text_view", tview);

        Gtk::ComboBox *combo;
        xml()->get_widget("collation_combo", combo);

        Gtk::Button *btn;
        xml()->get_widget("refactor_btn", btn);

        if (_be)
        {
            set_selected_combo_item(combo, _be->get_schema_option_by_name("CHARACTER SET - COLLATE"));

            _old_name = _be->get_name();
            entry->set_text(_old_name);

            tview->get_buffer()->set_text(_be->get_comment());

            bool is_editing_live_obj= is_editing_live_object();
            tview->set_sensitive(!is_editing_live_obj);
            Gtk::Label *tlabel;
            xml()->get_widget("label5", tlabel);
            tlabel->set_sensitive(!is_editing_live_obj);
            btn->set_sensitive(_be->refactor_possible());
        }
    }
コード例 #3
0
 void refactor_schema()
 {
     if (_be)
     {
         _be->refactor_catalog();
         Gtk::Button *btn;
         xml()->get_widget("refactor_btn", btn);
         btn->set_sensitive(_be->refactor_possible());
     }
 }
コード例 #4
0
 void set_name(const std::string& name)
 {
     if (_be)
     {
         _be->set_name(name);
         Gtk::Button *btn;
         xml()->get_widget("refactor_btn", btn);
         btn->set_sensitive(_be->refactor_possible());
     }
 }
コード例 #5
0
// Refresh the objectives list from the ObjectiveEntity
void ObjectivesEditor::refreshObjectivesList()
{
	// Clear and refresh the objective list
	_objectiveList->clear();
	_curEntity->second->populateListStore(_objectiveList, _objectiveColumns);

	// If there is at least one objective, make the Clear button available
    Gtk::Button* clearObjButton = gladeWidget<Gtk::Button>(
        "clearObjectivesButton"
    );
	if (_curEntity->second->isEmpty())
	{
		clearObjButton->set_sensitive(false);
	}
	else
	{
		clearObjButton->set_sensitive(true);
	}
}
コード例 #6
0
    SchemaEditor(grt::Module *m, bec::GRTManager *grtm, const grt::BaseListRef &args)
        : PluginEditorBase(m, grtm, args, "modules/data/editor_schema.glade")
        , _be(new MySQLSchemaEditorBE(grtm, db_mysql_SchemaRef::cast_from(args[0])))
    {
        xml()->get_widget("mysql_schema_editor_notebook", _editor_notebook);

        Gtk::Widget *widget;
        xml()->get_widget("base_table", widget);

        Gtk::Image *image;
        xml()->get_widget("image", image);
        image->set(ImageCache::get_instance()->image_from_filename("db.Schema.editor.48x48.png", false));

        bind_entry_and_be_setter("name_entry", this, &SchemaEditor::set_name);
        if (_be->is_editing_live_object() && _be->get_schema()->oldName() != "")
        {
            Gtk::Entry *entry;
            xml()->get_widget("name_entry", entry);
            entry->set_sensitive(false);
        }

        Gtk::Button *btn;
        xml()->get_widget("refactor_btn", btn);
        btn->set_sensitive(_be->refactor_possible());
        btn->signal_clicked().connect(sigc::mem_fun(this, &SchemaEditor::refactor_schema));

        Gtk::ComboBox *combo;
        xml()->get_widget("collation_combo", combo);
        Glib::RefPtr<Gtk::ListStore> store(Glib::RefPtr<Gtk::ListStore>::cast_dynamic(xml()->get_object("collation_store")));
        setup_combo_for_string_list(combo);
        fill_combo_from_string_list(combo, _be->get_charset_collation_list());
        add_option_combo_change_handler(combo, "CHARACTER SET - COLLATE", sigc::mem_fun(this, &SchemaEditor::set_schema_option_by_name));

        Gtk::TextView *tview;
        xml()->get_widget("text_view", tview);
        add_text_change_timer(tview, sigc::mem_fun(this, &SchemaEditor::set_comment));

        //!widget->reparent(*this);
        add(*_editor_notebook);
        _editor_notebook->show();

        show_all();

        refresh_form_data();
    }
コード例 #7
0
ファイル: select_dialog.cpp プロジェクト: Panke/zerobugs
void SelectDialog::add_select_button(const char* label, bool sel)
{
   Gtk::Button* btn = DialogBox::add_button(label);

   Gtk_CONNECT_1(btn, clicked, this, &SelectDialog::on_select_all, sel);

   if (sel)
   {
       assert(!selectBtn_);
       selectBtn_ = btn;
   }
   else
   {
       assert(!deselectBtn_);

       deselectBtn_ = btn;
       btn->set_sensitive(false);
   }

}
コード例 #8
0
// Create the objects panel (for manipulating the target_addobjectives objects)
void ObjectivesEditor::setupEntitiesPanel()
{
	// Tree view listing the target_addobjectives entities
    Gtk::TreeView* entityList = gladeWidget<Gtk::TreeView>(
        "entitiesTreeView"
    );
    entityList->set_model(_objectiveEntityList);
	entityList->set_headers_visible(false);

	entityList->get_selection()->signal_changed().connect(
		sigc::mem_fun(*this, &ObjectivesEditor::_onEntitySelectionChanged)
    );
	
	// Active-at-start column (checkbox)
	Gtk::CellRendererToggle* startToggle = Gtk::manage(new Gtk::CellRendererToggle);
	startToggle->signal_toggled().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onStartActiveCellToggled)
    );
	
	Gtk::TreeViewColumn* startCol = Gtk::manage(new Gtk::TreeViewColumn(_("Start")));
	startCol->add_attribute(startToggle->property_active(), _objEntityColumns.startActive);
	
	entityList->append_column(*startCol);
	
	// Name column
	entityList->append_column(*Gtk::manage(new gtkutil::TextColumn("", _objEntityColumns.displayName)));
	
    // Connect button signals
    Gtk::Button* addButton = gladeWidget<Gtk::Button>("createEntityButton");
	addButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onAddEntity)
    );

    Gtk::Button* delButton = gladeWidget<Gtk::Button>("deleteEntityButton");
	delButton->set_sensitive(false); // disabled at start
	delButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onDeleteEntity)
    );
}
コード例 #9
0
void GscPreferencesWindow::device_widget_set_remove_possible(bool b)
{
	Gtk::Button* button = 0;
	if ((button = this->lookup_widget<Gtk::Button*>("device_options_remove_device_button")))
		button->set_sensitive(b);
}
コード例 #10
0
// Create the main objective editing widgets
void ObjectivesEditor::setupObjectivesPanel()
{
    // Tree view
    Gtk::TreeView* objList = gladeWidget<Gtk::TreeView>(
        "objectivesTreeView"
    );
    objList->set_model(_objectiveList);
    objList->set_headers_visible(true);

    objList->get_selection()->signal_changed().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onObjectiveSelectionChanged)
    );
    
    // Key and value text columns
    objList->append_column(*Gtk::manage(
        new gtkutil::TextColumn("#", _objectiveColumns.objNumber, false)));
    objList->append_column(*Gtk::manage(
        new gtkutil::TextColumn(_("Description"), _objectiveColumns.description, false)));
    objList->append_column(*Gtk::manage(
        new gtkutil::TextColumn(_("Diff."), _objectiveColumns.difficultyLevel, false)));
    
    Gtk::Button* addButton = gladeWidget<Gtk::Button>("addObjButton");
    addButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onAddObjective)
    );

    Gtk::Button* editObjButton = gladeWidget<Gtk::Button>(
        "editObjButton"
    );
    editObjButton->set_sensitive(false); // not enabled without selection 
    editObjButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onEditObjective)
    );

    Gtk::Button* moveUpObjButton = gladeWidget<Gtk::Button>(
        "objMoveUpButton"
    );
    moveUpObjButton->set_sensitive(false); // not enabled without selection 
    moveUpObjButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onMoveUpObjective)
    );

    Gtk::Button* moveDownObjButton = gladeWidget<Gtk::Button>(
        "objMoveDownButton"
    );
    moveDownObjButton->set_sensitive(false); // not enabled without selection 
    moveDownObjButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onMoveDownObjective)
    );

    Gtk::Button* delObjButton = gladeWidget<Gtk::Button>(
        "delObjButton"
    );
    delObjButton->set_sensitive(false); // not enabled without selection 
    delObjButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onDeleteObjective)
    );
    
    Gtk::Button* clearObjButton = gladeWidget<Gtk::Button>(
        "clearObjectivesButton"
    );
    clearObjButton->set_sensitive(false); // requires >0 objectives
    clearObjButton->signal_clicked().connect(
        sigc::mem_fun(*this, &ObjectivesEditor::_onClearObjectives)
    );
}
コード例 #11
0
ファイル: ResViewerView.cpp プロジェクト: VaysseB/openfluid
void ResViewerViewImpl::setFileContentsByName(std::map<std::string,
    Glib::RefPtr<Gtk::TextBuffer> > FileContents)
{
  Glib::ustring ExistingTabSelection = "";
  if (mp_Notebook->get_current())
    ExistingTabSelection = mp_Notebook->get_current()->get_tab_label_text();

  int TabToSelect = 0;

  while (mp_Notebook->get_n_pages() > 1)
    mp_Notebook->remove_page(1);

  for (std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> >::iterator it =
      FileContents.begin(); it != FileContents.end(); ++it)
  {
    Gtk::TextView* TextView = Gtk::manage(new Gtk::TextView(it->second));
    TextView->set_editable(false);
    TextView->set_visible(true);

    Gtk::ScrolledWindow* Win = Gtk::manage(new Gtk::ScrolledWindow());
    Win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    Win->set_visible(true);
    Win->set_shadow_type(Gtk::SHADOW_ETCHED_IN);
    Win->add(*TextView);

    Gtk::Label* TabLabel = Gtk::manage(new Gtk::Label(it->first));
    Gtk::Label* MenuLabel = Gtk::manage(new Gtk::Label(it->first,
        Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER));

    Gtk::Button* SingleGNUplotButton = Gtk::manage(new Gtk::Button(
        _("Plot file with GNUplot\n(All-in-one window)")));
    Gtk::Button* MultiGNUplotButton = Gtk::manage(new Gtk::Button(
        _("Plot file with GNUplot\n(Multiple windows)")));

    Gtk::VBox* RightButtonsBox = Gtk::manage(new Gtk::VBox());
    RightButtonsBox->pack_start(*SingleGNUplotButton, Gtk::PACK_SHRINK);
    RightButtonsBox->pack_start(*MultiGNUplotButton, Gtk::PACK_SHRINK, 5);
    RightButtonsBox->show_all_children(true);
    RightButtonsBox->set_visible(true);

#if WIN32
    SingleGNUplotButton->set_sensitive(false);
    MultiGNUplotButton->set_sensitive(false);
#else
    if (ViewWithGNUplot::IsGNUplotAvailable())
    {
      SingleGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr<
          Gtk::TextBuffer>, std::string, std::string, std::string, bool>(
          sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked),
          (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep,
          m_CommentChar, true));
      SingleGNUplotButton->set_sensitive(true);

      MultiGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr<
          Gtk::TextBuffer>, std::string, std::string, std::string, bool>(
          sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked),
          (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep,
          m_CommentChar, false));
      MultiGNUplotButton->set_sensitive(true);
    }
    else
    {
      SingleGNUplotButton->set_sensitive(false);
      MultiGNUplotButton->set_sensitive(false);
    }
#endif

    Gtk::HBox* MainHBox = Gtk::manage(new Gtk::HBox());
    MainHBox->pack_start(*Win, Gtk::PACK_EXPAND_WIDGET, 5);
    MainHBox->pack_start(*RightButtonsBox, Gtk::PACK_SHRINK, 5);
    MainHBox->set_border_width(8);
    MainHBox->set_visible(true);

    int PageNum = mp_Notebook->append_page(*MainHBox, *TabLabel, *MenuLabel);

    if (it->first == ExistingTabSelection)
      TabToSelect = PageNum;

    mp_Notebook->set_tab_reorderable(*Win, true);
  }

  mp_Notebook->set_current_page(TabToSelect);
}
コード例 #12
0
ファイル: Info.cpp プロジェクト: VaysseB/openfluid
void Info::show(std::string ClassName, std::set<int> UnitIDs)
{
  mp_IDLabel->set_label("");
  mp_ProcessOrderLabel->set_label("");
  mref_ListStoreFrom->clear();
  mref_ListStoreTo->clear();
  mref_ListStoreParent->clear();
  mref_ListStoreChildren->clear();
  mref_ListStoreIDs->clear();
  m_InputDataNames.clear();
  if (!m_InputDataLineTable.empty())
  {
    std::map<Gtk::Label*, std::pair<Gtk::Entry*, Gtk::Button*> >::iterator iter;
    for (iter = m_InputDataLineTable.begin(); iter
    != m_InputDataLineTable.end(); ++iter)
    {
      delete((*iter).first);
      delete((*iter).second.second);
      delete((*iter).second.first);
    }

  }
  m_InputDataLineTable.clear();

  mp_NameClassLabel->set_label(ClassName);
  mp_TreeViewIDs->set_name("");

  std::set<int>::iterator it;
  for (it = UnitIDs.begin(); it != UnitIDs.end(); it++)
  {
    Gtk::TreeRow Row = *mref_ListStoreIDs->append();
    Row[m_ModelColumnIDs.m_ID] = *it;

    m_InputDataNames
    = mp_CoreRepos->getUnit(ClassName, *it)->getInputData()->getInputDataNames();

    if(m_InputDataNames.empty())
      mp_InputDataTable->set_visible(false);
    else
    {
      mp_InputDataTable->resize((m_InputDataNames.size() * 2) - 1, 3);
      mp_InputDataTable->set_homogeneous(false);
      mp_InputDataTable->set_spacings(5);

      int compt = 0;
      for (unsigned int i = 0; i < (m_InputDataNames.size() * 2) - 1; i++)
      {
        if ((i % 2) == 0)
        {
          Gtk::Label* InputDataLabel = Gtk::manage(
              new Gtk::Label(m_InputDataNames[compt]));

          mp_InputDataTable->attach(*InputDataLabel, 0, 1, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);

          Gtk::Entry* InputDataValueEntry = Gtk::manage(new Gtk::Entry());
          InputDataValueEntry->set_name(InputDataLabel->get_label());
          mp_InputDataTable->attach(*InputDataValueEntry, 1, 2, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
          InputDataValueEntry->signal_activate().connect(
              sigc::bind<std::string>(
                  sigc::mem_fun(*this, &Info::onEntryInputDataChanged),
                  InputDataValueEntry->get_name()));
          InputDataValueEntry->signal_focus_out_event().connect(
              sigc::bind<std::string>(
                  sigc::mem_fun(*this, &Info::on_focus_out_event),
                  InputDataValueEntry->get_name()));
          InputDataValueEntry->set_activates_default(true);

          Gtk::Button* RestoreDefaultButton = Gtk::manage(
              new Gtk::Button(_("Restore"), false));
          mp_InputDataTable->attach(*RestoreDefaultButton, 2, 3, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);

          std::pair<Gtk::Entry*, Gtk::Button*> TempPairEntryButton =
              std::make_pair(InputDataValueEntry, RestoreDefaultButton);
          m_InputDataLineTable.insert(
              std::pair<Gtk::Label*, std::pair<Gtk::Entry*, Gtk::Button*> >(
                  InputDataLabel, TempPairEntryButton));

          InputDataLabel->set_visible(true);
          InputDataValueEntry->set_visible(true);
          RestoreDefaultButton->set_visible(true);
          RestoreDefaultButton->set_sensitive(false);
          compt++;
        } else
        {
          mp_InputDataTable->attach(*ToolBox::setHSeparator(), 0, 3, i, i + 1,
              Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK);
        }
      }
      mp_InputDataTable->set_visible(true);
    }
  }

  if(! mref_ListStoreIDs->children().empty())
      mp_TreeViewIDs->get_selection()->select(mref_ListStoreIDs->children()[0]);


  if (mp_Dialog->run() == Gtk::RESPONSE_OK)
  {

  }

  mp_Dialog->hide();
}