//------------------------------------------------------------------------------
const IntColumn&
ColumnsModel::append_int_column(const int bec_tm_idx, const std::string& name, const Editable editable)
{
  Gtk::TreeModelColumn<int> *col = new Gtk::TreeModelColumn<int>;

  add(*col);
  add_bec_index_mapping(bec_tm_idx);

  int nr_of_cols;
  if ( editable == EDITABLE )
  {
    nr_of_cols= _treeview->append_column_editable(bec::replace_string(name, "_", "__"), *col);

    Gtk::CellRendererText *cell = (Gtk::CellRendererText*)(_treeview->get_column_cell_renderer(nr_of_cols - 1));
    cell->signal_edited().connect(sigc::bind
                                  (sigc::mem_fun(*_tmw
                                                ,&ListModelWrapper::after_cell_edit<int>
                                                )
                                                , sigc::ref(*col)
                                  )
                                 );
  }
  else
    nr_of_cols= _treeview->append_column(bec::replace_string(name, "_", "__"), *col);

  _treeview->get_column(nr_of_cols-1)->set_resizable(true);

  _columns.push_back(col);

  return *col;
}
ArbitratorPropertyWindow::ArbitratorPropertyWindow(MainWindow* parent, 
                               Manager* manager, ApplicationWindow* appWnd)
{   
    m_pParent = parent;
    m_pManager = manager;
    m_pAppWindow = appWnd;
    m_arbPort.clear();

    /* Create a new scrolled window, with scrollbars only if needed */
    set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    add(m_TreeView);

    /* create tree store */
    m_refTreeModel = Gtk::TreeStore::create(m_Columns);
    m_TreeView.set_model(m_refTreeModel);

    //Add the Model’s column to the View’s columns: 
    Gtk::CellRendererText* itemRenderer = Gtk::manage(new Gtk::CellRendererText());
    itemRenderer->property_editable() = false;
    Gtk::TreeViewColumn* itemCol = Gtk::manage(new Gtk::TreeViewColumn("Property", *itemRenderer));
    //itemCol->add_attribute(*itemRenderer, "background-gdk", m_Columns.m_col_color);
    itemCol->add_attribute(*itemRenderer, "text", m_Columns.m_col_name);
    itemCol->set_resizable(true);
    m_TreeView.append_column(*itemCol);



    Gtk::CellRendererText* valueRenderer = Gtk::manage(new Gtk::CellRendererText());
    valueRenderer->property_editable() = false;
    Gtk::TreeViewColumn* valueCol = Gtk::manage(new Gtk::TreeViewColumn("Value", *valueRenderer));
    valueCol->add_attribute(*valueRenderer, "foreground-gdk", m_Columns.m_col_color_value);
    valueCol->add_attribute(*valueRenderer, "text", m_Columns.m_col_value);
    valueCol->set_resizable(true);
    valueRenderer->property_editable() = true;
    //valueCol->set_cell_data_func(*valueRenderer, sigc::mem_fun(*this,
    //    &ArbitratorPropertyWindow::onCellData) );
    valueRenderer->signal_edited().connect( sigc::mem_fun(*this,
              &ArbitratorPropertyWindow::onCellEdited) );
    m_TreeView.append_column(*valueCol);
    valueCol->add_attribute(*valueRenderer, "editable", m_Columns.m_col_editable);   


    //m_TreeView.append_column_editable("Value", m_Columns.m_col_value);
    //m_TreeView.get_column(1)->set_resizable(true);
       //Tell the view column how to render the model values:
    m_TreeView.set_property("enable_grid_lines", true);
    show_all_children();
    m_TreeView.set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);
    m_TreeView.set_rules_hint(true);
}
const StringColumn&
ColumnsModel::append_string_column(const int bec_tm_idx, const std::string& name, const Editable editable, const Iconic have_icon)
{
  Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > *icon= 0;

  Gtk::TreeViewColumn *column= Gtk::manage(new Gtk::TreeViewColumn(bec::replace_string(name, "_", "__")));

  if ( have_icon == WITH_ICON )
  {
    icon = new Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> >;
    add(*icon);
    add_bec_index_mapping(bec_tm_idx);
    column->pack_start(*icon, false);

    _columns.push_back(icon);
  }

  Gtk::TreeModelColumn<Glib::ustring> *col = new Gtk::TreeModelColumn<Glib::ustring>;
  add(*col);
  add_bec_index_mapping(bec_tm_idx);
  column->pack_start(*col);

  _columns.push_back(col);

  int nr_of_cols= _treeview->append_column(*column);
  _treeview->get_column(nr_of_cols-1)->set_resizable(true);

  if (editable == EDITABLE || editable == EDITABLE_WO_FIRST)
  {

    std::vector<Gtk::CellRenderer*> rends= column->get_cell_renderers();

    Gtk::CellRendererText *cell = (Gtk::CellRendererText*)rends[icon ? 1 : 0];
    cell->property_editable()= true;
    cell->signal_edited().connect(sigc::bind
                                  (sigc::mem_fun(*_tmw
                                                ,&ListModelWrapper::after_cell_edit<Glib::ustring>
                                                )
                                                , sigc::ref(*col)
                                  )
                                 );

    if (editable == EDITABLE_WO_FIRST)
      column->set_cell_data_func(*cell, sigc::mem_fun(this, &ColumnsModel::disable_edit_first_row));
  }

  return *col;
}
//------------------------------------------------------------------------------
const StringColumn&
ColumnsModel::append_combo_column(const int bec_tm_idx
                                     ,const std::string            &name
                                     ,Glib::RefPtr<Gtk::ListStore>  list_w
                                     ,const Editable                editable
                                     ,bool popup_only)
{
  Gtk::TreeModelColumn<Glib::ustring> *choosen = new Gtk::TreeModelColumn<Glib::ustring>;
  _columns.push_back(choosen);
  add(*choosen);
  add_bec_index_mapping(bec_tm_idx);

  Gtk::TreeView::Column   *col = Gtk::manage(new Gtk::TreeViewColumn(bec::replace_string(name, "_", "__")));
  Gtk::CellRendererCombo *cell = Gtk::manage(new Gtk::CellRendererCombo);
  col->pack_start(*cell);

  col->add_attribute(cell->property_text(), *choosen);
  cell->property_model() = list_w;
  cell->property_text_column() = 0;
  cell->property_editable() = editable;
  cell->property_has_entry() = !popup_only;
  
  Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel> > *model_col = new Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel> >();
  add_bec_index_mapping(bec_tm_idx);
  add(*model_col);
  const int nr_of_cols = _treeview->append_column(*col);

  _columns.push_back(model_col);

  _treeview->get_column(nr_of_cols-1)->set_resizable(true);

  if ( editable == EDITABLE )
  {
    Gtk::CellRendererText *cell = (Gtk::CellRendererText*)(_treeview->get_column_cell_renderer(nr_of_cols - 1));
    cell->signal_edited().connect(sigc::bind
                                    (sigc::mem_fun(*_tmw
                                                  ,&ListModelWrapper::after_cell_edit<Glib::ustring>
                                                  )
                                                  , sigc::ref(*choosen)
                                   )
                                 );
  }

  return *choosen;
}
Esempio n. 5
0
void DomainIDataViewImpl::setTreeModel(Glib::RefPtr<Gtk::TreeModel> TreeModel,
    DomainIDataColumns* Columns)
{
  mp_TreeView->remove_all_columns();
  mp_TreeView->set_model(TreeModel);

  if (TreeModel->get_n_columns() < 2)
    return;

  mp_TreeView->append_column("Unit ID", *Columns->getIdColumn());
  mp_TreeView->get_column(0)->set_sort_column(*Columns->getIdColumn());

  std::map<std::string, Gtk::TreeModelColumn<std::string>*> ColumnsByTitle =
      Columns->getByTitleColumns();

  for (std::map<std::string, Gtk::TreeModelColumn<std::string>*>::iterator it =
      ColumnsByTitle.begin(); it != ColumnsByTitle.end(); ++it)
  {
    int ColIndex = mp_TreeView->append_column_editable("", *it->second) - 1;

    /*
     * use of a widget label instead of a column title because
     * in column title, underscores have to be escaped by another one
     * (same as Label::set_use_underline(true))
     */
    Gtk::Label* TitleLabel = Gtk::manage(new Gtk::Label(it->first));
    TitleLabel->set_visible(true);
    mp_TreeView->get_column(ColIndex)->set_widget(*TitleLabel);

    mp_TreeView->get_column(ColIndex)->set_sort_column(*it->second);

    Gtk::CellRendererText* CellRend =
        (Gtk::CellRendererText *) mp_TreeView->get_column_cell_renderer(
            ColIndex);

    CellRend->signal_edited().connect(sigc::bind<std::string>(sigc::mem_fun(
        *this, &DomainIDataViewImpl::onDataEdited), it->first));
  }

  mp_TreeView->get_selection()->signal_changed().connect(sigc::mem_fun(*this,
      &DomainIDataViewImpl::onUnitSelectionChanged));

}
Esempio n. 6
0
//TODO: klasse soll window extenden (schoener so)
EwAccountsWin::EwAccountsWin() {
	EWLOG("In EwAccountsWin::EwAccountsWin()", 8);
	Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("data/EwAccountsWin.glade");
	Gtk::Button *add, *del, *close;
	Gtk::ScrolledWindow *scrolledwindow;
	builder->get_widget("EwAccounts", window);
	builder->get_widget("add", add);
	builder->get_widget("delete", del);
	builder->get_widget("close", close);
	builder->get_widget("scrolledwindow", scrolledwindow);
	scrolledwindow->add(treeView);
	add->signal_clicked().connect(sigc::mem_fun(this, &EwAccountsWin::onAddBtnClicked));
	del->signal_clicked().connect(sigc::mem_fun(this, &EwAccountsWin::onDelBtnClicked));
	close->signal_clicked().connect(sigc::mem_fun(this, &EwAccountsWin::onCloseBtnClicked));

	liststore = Gtk::ListStore::create(m_Columns);
	treeView.set_model(liststore);
	treeView.append_column("Enabled", m_Columns.m_col_enab);
	treeView.append_column_editable("Identifier", m_Columns.m_col_identifier);
	treeView.append_column("Use Https", m_Columns.m_col_https);
	Gtk::CellRendererText *crtu;
	Gtk::CellRendererToggle *crtenab, *crthttps;
	crtenab = dynamic_cast<Gtk::CellRendererToggle*>(treeView.get_column_cell_renderer(0));
	crtenab->set_activatable();
	crtenab->signal_toggled().connect(sigc::mem_fun(this, &EwAccountsWin::onColumnEnabledToggled));
	crtu = dynamic_cast<Gtk::CellRendererText*>(treeView.get_column_cell_renderer(1));
	crtu->signal_edited().connect(sigc::mem_fun(this, &EwAccountsWin::onColumnIdentifierChanged));
	crthttps = dynamic_cast<Gtk::CellRendererToggle*>(treeView.get_column_cell_renderer(2));
	crthttps->set_activatable();
	crthttps->signal_toggled().connect(sigc::mem_fun(this, &EwAccountsWin::onColumnHttpsToggled));

	std::list<EwAccountList::EwAccount> accounts = EwAccountList::Instance()->getAccounts();
	for (std::list<EwAccountList::EwAccount>::iterator iter = accounts.begin(); iter != accounts.end(); iter++) {
		Gtk::TreeModel::Row row = *(liststore->append());
		row[m_Columns.m_col_id] = (*iter).id;
		row[m_Columns.m_col_identifier] = (*iter).identifier;
		row[m_Columns.m_col_enab] = (*iter).enabled;
		row[m_Columns.m_col_https] = (*iter).https;
	}
	
	window->show_all_children();
	Gtk::Main::run(*window);
}
// Cringe.
void GtkTorrentSideBar::setupColumns()
{
	int cid = 0;
	Gtk::TreeViewColumn     *col = nullptr;
	Gtk::CellRendererText   *cell = Gtk::manage(new Gtk::CellRendererText());
	Gtk::CellRendererPixbuf *cellp = Gtk::manage(new Gtk::CellRendererPixbuf());

	cell->set_alignment(0, 0.5);
	cell->signal_edited().connect([this](const std::string& path,const std::string& name){ addedItem(path, name); });

	cid = append_column(*Gtk::manage(new Gtk::TreeViewColumn("Name")));	
	col = get_column(cid - 1);
	col->pack_start(*cellp);
	col->pack_start(*cell);
	col->add_attribute(cell->property_markup(), m_cols.name);
	col->add_attribute(cell->property_editable(), m_cols.editable);
	col->add_attribute(cellp->property_pixbuf(), m_cols.icon);

        // This really isn't "setupColumns" anymore from this point.
        // TODO Move to own function
	m_torrent_row = *(m_liststore->append());
	m_torrent_row[m_cols.name] = "Torrents";
	m_torrent_row[m_cols.editable] = false;
	m_torrent_row[m_cols.clickCallback] = [](){}; // clicks on titles don't do shit

	auto torrent_icon = Gdk::Pixbuf::create_from_resource("/org/gtk/gtorrent/icon-torrent.png");
	auto torrent_icon_scaled =  torrent_icon->scale_simple(16, 16, Gdk::INTERP_BILINEAR);
	m_torrent_row[m_cols.icon] = torrent_icon_scaled;

        // XXX TMP WILL REMOVE AND REPLACE WITH PROPER FUNCTION
        // Yes this is horrible. Bear with it for now.
        auto g = Application::getSingleton()->getCore()->getAllTorrents();
	Gtk::TreeModel::Row row = *(m_liststore->append(m_torrent_row.children()));
	row[m_cols.name] = "All";
	row[m_cols.title] = "All";
	row[m_cols.group] = g;
	row[m_cols.group_vector] = &g->m_torrents_all;

	Gtk::TreeModel::Row row2 = *(m_liststore->append(row.children()));
	row2[m_cols.name] = "Downloading";
	row2[m_cols.title] = "Downloading";
	row2[m_cols.group_vector] = &g->m_torrents_downloading;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Seeding";
        row2[m_cols.title] = "Seeding";
        row2[m_cols.group_vector] = &g->m_torrents_seeding;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Checking";
        row2[m_cols.title] = "Checking";
        row2[m_cols.group_vector] = &g->m_torrents_checking;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Finished";
        row2[m_cols.title] = "Finished";
        row2[m_cols.group_vector] = &g->m_torrents_finished;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Stopped";
        row2[m_cols.title] = "Stopped";
        row2[m_cols.group_vector] = &g->m_torrents_stopped;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Paused";
        row2[m_cols.title] = "Paused";
        row2[m_cols.group_vector] = &g->m_torrents_paused;

        // End of new horrible code
        // Continue horrible code from before
	//row = *(m_liststore->append(m_torrent_row.children()));
	//row[m_cols.name] = "Add a label";
	//row[m_cols.editable] = true;
	//row[m_cols.icon] = Gtk::IconTheme::get_default()->lookup_icon("list-add-symbolic", 16, Gtk::ICON_LOOKUP_USE_BUILTIN).load_icon();
	//row[m_cols.clickCallback] = [row](){};

	m_rssfeed_row = *(m_liststore->append());
	m_rssfeed_row[m_cols.name] = "RSS Feeds";
	m_rssfeed_row[m_cols.editable] = false;
	m_rssfeed_row[m_cols.clickCallback] = [](){};

	auto rss_icon = Gdk::Pixbuf::create_from_resource("/org/gtk/gtorrent/icon-rss.png");
	auto rss_icon_scaled =  rss_icon->scale_simple(16, 16, Gdk::INTERP_BILINEAR);
	m_rssfeed_row[m_cols.icon] = rss_icon_scaled;

	for(auto fg : Application::getSingleton()->getCore()->m_feeds)
	{
		row = *(m_liststore->append(m_rssfeed_row.children()));
		row[m_cols.name] = fg->name;
		row[m_cols.editable] = false;
		// TODO change icon to some sort of generic RSS icon
		row[m_cols.clickCallback] = [this, fg](){m_rss->run(fg->name);m_rss->hide();};

	}
	
	row = *(m_liststore->append(m_rssfeed_row.children()));
	row[m_cols.name] = "Add an RSS group";
	row[m_cols.editable] = true;

	row[m_cols.icon] = Gtk::IconTheme::get_default()->lookup_icon("list-add-symbolic", 16, Gtk::ICON_LOOKUP_USE_BUILTIN).load_icon();
	row[m_cols.clickCallback] = [row](){};

	//Maybe migrate settings there
/*	row = *(m_liststore->append());
	row[m_cols.name] = "Settings";
	row[m_cols.title] = true;
	row[m_cols.clickCallback] = [](){}; // clicks on titles don't do shit*/
}
Esempio n. 8
0
PluginDisplay::PluginDisplay(gx_engine::GxMachineBase& machine_, Glib::RefPtr<Gdk::Pixbuf> icon, sigc::slot<void, bool, bool> finished_callback_)
    : machine(machine_), pluginlist(), current_plugin(0), old_state(0), bld(), change_count(0),
      actiongroup(Gtk::ActionGroup::create("ladspa_window")), uimanager(),
      enum_liststore(new EnumListStore), port_liststore(new PortListStore),
      plugin_liststore(new PluginListStore), masteridx_liststore(new MasterIdxListStore),
      on_reordered_conn(), display_type_list(), display_type_list_sr(), output_type_list(),
      finished_callback(finished_callback_)
{
    std::vector<std::string> old_not_found;
    machine.load_ladspalist(old_not_found, pluginlist);
    bld = gx_gui::GxBuilder::create_from_file(machine.get_options().get_builder_filepath("ladspaliste.glade"));
    bld->get_toplevel("window1", window);
    bld->find_widget("treeview1", treeview1);
    bld->find_widget("treeview2", treeview2);
    bld->find_widget("treeview3", treeview3);
    bld->find_widget("ladspa_category", ladspa_category);
    bld->find_widget("ladspa_maker", ladspa_maker);
    bld->find_widget("ladspa_uniqueid", ladspa_uniqueid);
    bld->find_widget("search_entry", search_entry);
    bld->find_widget("combobox_mono_stereo", combobox_mono_stereo);
    bld->find_widget("selected_only", selected_only);
    bld->find_widget("changed_only", changed_only);
    bld->find_widget("ladspa_only", ladspa_only);
    bld->find_widget("lv2_only", lv2_only);
    bld->find_widget("show_all", show_all);
    bld->find_widget("details_box", details_box);
    bld->find_widget("plugin_name", plugin_name);
    bld->find_widget("plugin_category", plugin_category);
    bld->find_widget("plugin_quirks", plugin_quirks);
    bld->find_widget("master_slider_idx", master_slider_idx);
    bld->find_widget("master_slider_name", master_slider_name);
    bld->find_widget("cellrenderer_master", cellrenderer_master);
    bld->find_widget("cellrenderer_newrow", cellrenderer_newrow);
    bld->find_widget("cellrenderer_caption", cellrenderer_caption);
    bld->find_widget("cellrenderer_active", cellrenderer_active);
    bld->find_widget("cellrenderer_category", cellrenderer_category);
    bld->find_widget("cellrenderer_quirks", cellrenderer_quirks);

    set_title();
    actiongroup->add(Gtk::Action::create("FileMenuAction",_("_File")));
    save_action = Gtk::Action::create("SaveAction", _("_Ok"));
    actiongroup->add(save_action, sigc::mem_fun(this, &PluginDisplay::on_save));
    apply_action = Gtk::Action::create("ApplyAction", _("_Apply"));
    actiongroup->add(apply_action, sigc::mem_fun(this, &PluginDisplay::on_apply));
    quit_action = Gtk::Action::create("QuitAction", _("_Quit"));
    actiongroup->add(quit_action, sigc::mem_fun(this, &PluginDisplay::on_quit));
    select_all_action = Gtk::Action::create("SelectAllAction", _("_Select All"));
    actiongroup->add(select_all_action, sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_select_all), true));
    select_none_action = Gtk::Action::create("SelectNoneAction", _("Select _None"));
    actiongroup->add(select_none_action, sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_select_all), false));
    actiongroup->add(Gtk::Action::create("ViewMenuAction", _("_View")));
    Glib::RefPtr<Gtk::Action> act = Gtk::Action::create("FindAction", _("_Find"));
    actiongroup->add(act, sigc::mem_fun(this, &PluginDisplay::on_find));

    uimanager = Gtk::UIManager::create();
    uimanager->insert_action_group(actiongroup, 0);
    uimanager->add_ui_from_string(menudef);
    //uimanager->get_widget("/ladspalist");
    //Gtk::HBox *ww; bld->find_widget("menubox", ww); ww->pack_start(*uimanager->get_widget("/ladspalist"));
    window->add_accel_group(uimanager->get_accel_group());

    window->signal_delete_event().connect(sigc::mem_fun(this, &PluginDisplay::on_delete_event));
    bld->find_widget("show_details", show_details);
    show_details->signal_clicked().connect(sigc::mem_fun(this, &PluginDisplay::on_show_details));
    treeview3->get_selection()->set_mode(Gtk::SELECTION_BROWSE);
    treeview3->set_model(enum_liststore);
    Gtk::CellRendererText *r;
    bld->find_widget("cellrenderer_label", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_label_edited));
    Gtk::TreeViewColumn *c;
    bld->find_widget("treeviewcolumn_label", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_label));
    
    bld->find_widget("dry_wet_button", dry_wet_button);
    dry_wet_button->signal_clicked().connect(sigc::mem_fun(this, &PluginDisplay::on_add_dry_wet_controller));
   // dry_wet_button->set_active(current_plugin->add_wet_dry);

    Glib::RefPtr<Gtk::TreeSelection> sel = treeview2->get_selection();
    sel->set_mode(Gtk::SELECTION_BROWSE);
    sel->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::on_parameter_selection_changed));
    on_reordered_conn = port_liststore->signal_row_deleted().connect(sigc::mem_fun(this, &PluginDisplay::on_reordered));
    treeview2->set_model(port_liststore);

    CellRendererComboDerived *rd;
    bld->find_widget_derived("cellrenderer_type", rd, sigc::ptr_fun(CellRendererComboDerived::create_from_builder));
    rd->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_type_edited));
    bld->find_widget("treeviewcolumn_type", c);
    c->set_cell_data_func(*rd, sigc::mem_fun(this, &PluginDisplay::display_type));

    bld->find_widget_derived("cellrenderer_step", rd, sigc::ptr_fun(CellRendererComboDerived::create_from_builder));
    rd->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_step_edited));
    bld->find_widget("treeviewcolumn_step", c);
    c->set_cell_data_func(*rd, sigc::mem_fun(this, &PluginDisplay::display_step));

    cellrenderer_newrow->signal_toggled().connect(sigc::mem_fun(this, &PluginDisplay::on_newrow_toggled));
    Gtk::Label *label = new Gtk::Label("N");
    label->set_tooltip_text(_("start a new row of controls in the rackbox unit"));
    label->show();
    bld->find_widget("treeviewcolumn_newrow", c);
    c->set_widget(*manage(label));
    c->set_cell_data_func(*cellrenderer_newrow, sigc::mem_fun(this, &PluginDisplay::display_newrow));
    cellrenderer_caption->signal_toggled().connect(sigc::mem_fun(this, &PluginDisplay::on_caption_toggled));
    label = new Gtk::Label("C");
    label->set_tooltip_text(_("display the name as caption above the control"));
    label->show();
    bld->find_widget("treeviewcolumn_caption", c);
    c->set_widget(*manage(label));
    c->set_cell_data_func(*cellrenderer_caption, sigc::mem_fun(this, &PluginDisplay::display_caption));

    bld->find_widget("cellrenderer_name", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_name_edited));
    bld->find_widget("treeviewcolumn_name", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_name));
    bld->find_widget("cellrenderer_dflt", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_dflt_edited));
    bld->find_widget("treeviewcolumn_dflt", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_default));
    bld->find_widget("cellrenderer_low", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_low_edited));
    bld->find_widget("treeviewcolumn_low", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_lower));
    bld->find_widget("cellrenderer_up", r);
    r->signal_edited().connect(sigc::mem_fun(this, &PluginDisplay::on_up_edited));
    bld->find_widget("treeviewcolumn_up", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_upper));
    bld->find_widget("cellrenderer_idx", r);
    bld->find_widget("treeviewcolumn_idx", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_idx));

    bld->find_widget("treeviewcolumn_SR", c);
    label = new Gtk::Label("SR");
    label->set_tooltip_text(_("marked rows: range depends on samplerate; using 44100 as fixed value"));
    label->show();
    c->set_widget(*manage(label));
    Gtk::CellRendererToggle *t;
    bld->find_widget("cellrenderer_SR", t);
    c->set_cell_data_func(*t, sigc::mem_fun(this, &PluginDisplay::display_SR));

    Gtk::TreeModelColumnRecord recdef;
    Gtk::TreeModelColumn<Glib::ustring> strcol;
    Gtk::TreeModelColumn<DisplayType> intcol;
    recdef.add(strcol);
    recdef.add(intcol);
    display_type_list = Gtk::ListStore::create(recdef);
    append_displaytype(display_type_list, tp_scale);
    append_displaytype(display_type_list, tp_scale_log);
    append_displaytype(display_type_list, tp_toggle);
    append_displaytype(display_type_list, tp_int);
    append_displaytype(display_type_list, tp_enum);
    append_displaytype(display_type_list, tp_none);
    display_type_list_sr = Gtk::ListStore::create(recdef);
    append_displaytype(display_type_list_sr, tp_scale);
    append_displaytype(display_type_list_sr, tp_scale_log);
    append_displaytype(display_type_list_sr, tp_none);
    output_type_list = Gtk::ListStore::create(recdef);
    append_displaytype(output_type_list, tp_display);
    append_displaytype(output_type_list, tp_display_toggle);
    append_displaytype(output_type_list, tp_none);

    treeview1->signal_row_activated().connect(sigc::mem_fun(this, &PluginDisplay::on_row_activated));
    treeview1->set_search_equal_func(sigc::mem_fun(this,&PluginDisplay::search_equal));
    Gtk::Entry *e;
    bld->find_widget("search_entry", e);
    e->signal_activate().connect(sigc::mem_fun(this, &PluginDisplay::on_search_entry_activate));
    treeview1->set_search_entry(*e);
    sel = treeview1->get_selection();
    sel->set_mode(Gtk::SELECTION_BROWSE);
    sel->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::selection_changed));
    treeview1->set_model(plugin_liststore);
    cellrenderer_active->signal_toggled().connect(sigc::mem_fun(this, &PluginDisplay::on_active_toggled));
    bld->find_widget("cellrenderer_ladspa", r);
    bld->find_widget("treeviewcolumn_ladspa", c);
    c->set_cell_data_func(*r, sigc::mem_fun(this, &PluginDisplay::display_ladspa));

    Gtk::ComboBox *cb;
    bld->find_widget("plugin_category", cb);
    cb->set_cell_data_func(*cellrenderer_category, sigc::mem_fun(this, &PluginDisplay::display_category));
    bld->find_widget("plugin_quirks", cb);
    cb->set_cell_data_func(*cellrenderer_quirks, sigc::mem_fun(this, &PluginDisplay::display_quirks));

    master_slider_idx->set_cell_data_func(*cellrenderer_master, sigc::mem_fun(this, &PluginDisplay::display_master_idx));
    master_slider_idx->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::set_master_text));

    selected_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), selected_only));
    changed_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), changed_only));
    ladspa_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), ladspa_only));
    lv2_only->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), lv2_only));
    show_all->signal_toggled().connect(sigc::bind(sigc::mem_fun(this, &PluginDisplay::on_view_changed), show_all));

    bld->find_widget("combobox_mono_stereo", cb);
    cb->signal_changed().connect(sigc::mem_fun(this, &PluginDisplay::on_mono_stereo_changed));
    cb->set_active(0);
    Gtk::Button *b;
    bld->find_widget("reset_changes", b);
    b->signal_clicked().connect(sigc::mem_fun(this, &PluginDisplay::on_delete_changes));

    bld->find_widget("master_slider_idx", cb);
    cb->set_model(masteridx_liststore);

    bld->find_widget("button_cancel", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("QuitAction")->gobj());
    bld->find_widget("button_apply", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("ApplyAction")->gobj());
    bld->find_widget("button_save", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("SaveAction")->gobj());
    bld->find_widget("select_all", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("SelectAllAction")->gobj());
    bld->find_widget("select_none", b);
    gtk_activatable_set_related_action(GTK_ACTIVATABLE(b->gobj()), actiongroup->get_action("SelectNoneAction")->gobj());

    window->set_icon(icon);
    window->show();
}
Esempio n. 9
0
DocumentProperties::DocumentProperties (
	RefWindow &refwin
	)
: win_ (refwin)
{
	xml_ =  Gtk::Builder::create_from_file 
		(Utility::findDataFile ("documentproperties.ui"));

	xml_->get_widget ("DocumentProperties", dialog_);

	xml_->get_widget ("File", filechooser_);
	filechooser_->signal_selection_changed().connect (
			sigc::mem_fun (*this, &DocumentProperties::onFileChanged));

	xml_->get_widget ("Key", keyentry_);
	xml_->get_widget ("Icon", iconImage_);
	xml_->get_widget ("IconButton", iconButton_);
	iconButton_->signal_clicked().connect (
			sigc::mem_fun (*this, &DocumentProperties::onIconButtonClicked));

	xml_->get_widget ("Lookup", crossrefbutton_);
	crossrefbutton_->signal_clicked().connect(
		sigc::mem_fun (*this, &DocumentProperties::onMetadataLookup));

	xml_->get_widget ("PasteBibtex", pastebibtexbutton_);
	pastebibtexbutton_->signal_clicked().connect(
		sigc::mem_fun (*this, &DocumentProperties::onPasteBibtex));

 	Gtk::Button *clearButton;
	xml_->get_widget ("Clear", clearButton);
	clearButton->signal_clicked().connect (
		sigc::mem_fun (*this, &DocumentProperties::onClear));

	xml_->get_widget ("ExtraFieldsExpander", extrafieldsexpander_);
	xml_->get_widget ("NewExtraField", newextrafieldbutton_);
	xml_->get_widget ("DeleteExtraField", deleteextrafieldbutton_);
	xml_->get_widget ("EditExtraField", editextrafieldbutton_);

	newextrafieldbutton_->signal_clicked ().connect (
		sigc::mem_fun (*this, &DocumentProperties::onNewExtraField));

	deleteextrafieldbutton_->signal_clicked ().connect (
		sigc::mem_fun (*this, &DocumentProperties::onDeleteExtraField));

	editextrafieldbutton_->signal_clicked ().connect (
		sigc::mem_fun (*this, &DocumentProperties::onEditExtraField));

	xml_->get_widget ("ExtraFields", extrafieldsview_);
	cols_.add (extrakeycol_);
	cols_.add (extravalcol_);

	extrafieldssel_ = extrafieldsview_->get_selection ();
	extrafieldssel_->signal_changed ().connect (
		sigc::mem_fun (*this, &DocumentProperties::onExtraFieldsSelectionChanged));

	extrafieldsstore_ = Gtk::ListStore::create (cols_);

	extrafieldsview_->set_model (extrafieldsstore_);
	extrafieldsview_->append_column (_("Name"), extrakeycol_);
	extrafieldsview_->append_column_editable (_("Value"), extravalcol_);


	typecombocols_.add (typebibtexnamecol_);
	typecombocols_.add (typelabelcol_);
	typecombostore_ = Gtk::ListStore::create (typecombocols_);

	// looks like watch for a cell-renderer is the only way 
	// to get information that the cell(s) changed 
	Gtk::CellRendererText* extrafieldsrenderer = 
		dynamic_cast<Gtk::CellRendererText*> (
		extrafieldsview_->get_column(1)->get_first_cell_renderer() );
	extrafieldsrenderer->signal_edited ().connect (
		sigc::mem_fun (*this, &DocumentProperties::onExtraFieldEdited));

	ignoreTypeChanged_ = false;

	typeManager_ = DocumentTypeManager();
}