Exemplo n.º 1
0
void PluginDisplay::load() {
    int a = combobox_mono_stereo->get_model()->get_path(combobox_mono_stereo->get_active())[0];
    bool s = selected_only->get_active();
    bool c = changed_only->get_active();
    bool d = ladspa_only->get_active();
    bool e = lv2_only->get_active();
    plugin_liststore->clear();
    for (std::vector<PluginDesc*>::iterator v = pluginlist.begin(); v != pluginlist.end(); ++v) {
	if (s && !(*v)->active) {
	    continue;
	}
	else if (c && !(*v)->has_settings) {
	    continue;
	}
	else if (d && (*v)->is_lv2) {
	    continue;
	}
 	else if (e && !(*v)->is_lv2) {
	    continue;
	}
	if ((a == 1 && (*v)->tp != 0) || (a == 2 && (*v)->tp != 1)) {
	    continue;
	}

	Gtk::TreeIter it = plugin_liststore->append();
	it->set_value(plugin_liststore->col.name, ustring((*v)->Name));
	it->set_value(plugin_liststore->col.active, (*v)->active);
	it->set_value(plugin_liststore->col.pdesc, *v);
    }
}
Exemplo n.º 2
0
void jobManWindow::on_job_selected_handler() {
	//g_message("aha");

	Gtk::TreeIter iter = treeView.get_selection()->get_selected();
	if (iter) {
		//std::cout << iter->get_value(modelColumns.jobName) << std::endl;
		//std::cout << iter->get_value(modelColumns.completeDescription) << std::endl;
		detailsLabel.set_markup(iter->get_value(modelColumns.completeDescription));
		selectedJob = iter->get_value(modelColumns.job);
		if (selectedJob.someInstanceRunning) {
			buttonStop.set_sensitive(true);
			buttonRestart.set_sensitive(true);
			buttonStart.set_sensitive(false);
		} else {
			buttonStop.set_sensitive(false);
			buttonRestart.set_sensitive(false);
			buttonStart.set_sensitive(true);
		}
		if (selectedJob.canBeSetToManual) {
			if (selectedJob.manual) {
				buttonSetManual.set_label("Enable (remove manual)");
			} else {
				buttonSetManual.set_label("Disable (set manual)");
			}
			buttonSetManual.set_sensitive(true);
		} else {
			//buttonSetManual.set_label("")
			buttonSetManual.set_sensitive(false);
		}
	}
}
Exemplo n.º 3
0
void SelectInstance::on_avahi_changed() {
    std::vector<Glib::ustring> r;
    av.get_service_names(r);
    if (!win->is_visible()) {
	if (r.size() == 1) {
	    av.invoke_resolver(*r.begin());
	} else {
	    if (splash) {
		splash->hide();
	    }
	    win->show();
	}
    }
    Glib::RefPtr<Gtk::ListStore> ls = Glib::RefPtr<Gtk::ListStore>::cast_dynamic(view->get_model());
    Gtk::TreeIter s = view->get_selection()->get_selected();
    Glib::ustring old;
    if (s) {
	old = s->get_value(cols.name);
    }
    ls->clear();
    for (std::vector<Glib::ustring>::iterator i = r.begin(); i != r.end(); ++i) {
	Gtk::TreeIter j = ls->append();
	j->set_value(cols.name, *i);
	if (old.empty()) {
	    old = *i;
	}
	if (old == *i) {
	    view->get_selection()->select(j);
	}
    }
}
void GscHelpWindow::set_topic(const Glib::ustring& topic)
{
	this->selection_callback_enabled = false;  // temporarily disable it

	// scroll to it

	Gtk::TextView* content = this->lookup_widget<Gtk::TextView*>("content_textview");
	if (content) {
		Glib::RefPtr<Gtk::TextBuffer> buffer = content->get_buffer();

		Glib::RefPtr<Gtk::TextMark> mark = buffer->get_mark(topic);
		if (mark)
			content->scroll_to(mark, 0., 0., 0.);
	}

	// select it in tree view
	Gtk::TreeView* treeview = this->lookup_widget<Gtk::TreeView*>("topics_treeview");

	if (treeview && !list_store->children().empty()) {
		for (Gtk::TreeIter iter = list_store->children().begin(); iter != list_store->children().end(); ++iter) {
			if (iter->get_value(col_topic) == topic) {
				selection->select(*iter);
				treeview->scroll_to_cell(list_store->get_path(iter), *(treeview->get_column(0)), 0.3, 0.);  // about 30% from top
				break;
			}
		}
	}

	this->selection_callback_enabled = true;  // enable it back
}
Exemplo n.º 5
0
void PluginDisplay::on_caption_toggled(const ustring& path) {
    Gtk::TreeIter it = port_liststore->get_iter(path);
    PortDesc *q = it->get_value(port_liststore->col.port);
    bool s = !cellrenderer_caption->get_active();
    it->set_value(port_liststore->col.has_caption, s);
    q->has_caption = s;
}
Exemplo n.º 6
0
void PluginDisplay::on_active_toggled(const ustring& path) {
    Gtk::TreeIter it = plugin_liststore->get_iter(path);
    bool s = !cellrenderer_active->get_active();
    it->set_value(plugin_liststore->col.active, s);
    change_count += it->get_value(plugin_liststore->col.pdesc)->set_active(s);
    set_title();
}
Exemplo n.º 7
0
 bool NotebooksTreeView::on_drag_motion(const Glib::RefPtr<Gdk::DragContext> &,
                             int x, int y, guint )
 {
   Gtk::TreePath treepath;
   Gtk::TreeViewDropPosition pos;
   if (get_dest_row_at_pos (x, y, treepath,pos) == false) {
     gtk_tree_view_set_drag_dest_row (gobj(), NULL, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
     return false;
   }
   
   Gtk::TreeIter iter = get_model()->get_iter (treepath);
   if (!iter) {
     gtk_tree_view_set_drag_dest_row (gobj(), NULL, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
     return false;
   }
   
   Notebook::Ptr destNotebook;
   iter->get_value(0, destNotebook);
   if(std::dynamic_pointer_cast<AllNotesNotebook>(destNotebook)) {
     gtk_tree_view_set_drag_dest_row (gobj(), NULL, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
     return true;
   }
   
   set_drag_dest_row (treepath , Gtk::TREE_VIEW_DROP_INTO_OR_AFTER);
   
   return true;
 }
Exemplo n.º 8
0
    int NotebookManager::compare_notebooks_sort_func(const Gtk::TreeIter &a, 
                                                     const Gtk::TreeIter &b)
    {
      Notebook::Ptr notebook_a;
      a->get_value (0, notebook_a);
      Notebook::Ptr notebook_b;
      b->get_value (0, notebook_b);

      if (!notebook_a || !notebook_b)
        return 0;

      SpecialNotebook::Ptr spec_a = dynamic_pointer_cast<SpecialNotebook>(notebook_a);
      SpecialNotebook::Ptr spec_b = dynamic_pointer_cast<SpecialNotebook>(notebook_b);
      if(spec_a != 0 && spec_b != 0) {
        return strcmp(spec_a->get_normalized_name().c_str(), spec_b->get_normalized_name().c_str());
      }
      else if(spec_a != 0) {
        return -1;
      }
      else if(spec_b != 0) {
        return 1;
      }

      Glib::ustring a_name(notebook_a->get_name());
      a_name = a_name.lowercase();
      Glib::ustring b_name(notebook_b->get_name());
      b_name = b_name.lowercase();
      return a_name.compare(b_name);
    }
Exemplo n.º 9
0
SelectJackControlPgm::SelectJackControlPgm(BaseObjectType* cobject, Glib::RefPtr<GxBuilder> bld, gx_engine::GxMachineBase& m)
    : Gtk::Window(cobject),
      description(),
      customstarter(),
      startercombo(),
      dontask(),
      machine(m),
      close() {
    signal_delete_event().connect(sigc::mem_fun(*this, &SelectJackControlPgm::on_delete_event));
    bld->find_widget("description", description);
    bld->find_widget("customstarter", customstarter);
    customstarter->set_text(machine.get_parameter_value<string>("ui.jack_starter"));
    bld->find_widget("startercombo", startercombo);
    const char *v_id = machine.get_parameter("ui.jack_starter_idx").getValueNames()[machine.get_parameter_value<int>("ui.jack_starter_idx")].value_id;
    int n = 0;
    Glib::RefPtr<Gtk::TreeModel> model = startercombo->get_model();
    for (Gtk::TreeIter i = model->children().begin(); i; ++i, ++n) {
	Glib::ustring s;
	i->get_value(1, s);
	if (s == v_id) {
	    startercombo->set_active(n);
	}
    }
    startercombo->signal_changed().connect(sigc::mem_fun(*this, &SelectJackControlPgm::on_starter_changed));
    bld->find_widget("dontask", dontask);
    dontask->set_active(!machine.get_parameter_value<bool>("ui.ask_for_jack_starter"));
    Gtk::Button *button;
    bld->find_widget("ok_button", button);
    button->signal_clicked().connect(
	sigc::mem_fun(*this, &SelectJackControlPgm::on_ok_button));
    bld->find_widget("cancel_button", button);
    button->signal_clicked().connect(
	sigc::mem_fun(*this, &SelectJackControlPgm::on_cancel_button));
    on_starter_changed();
}
Exemplo n.º 10
0
bool
CanvasTreeStore::find_next_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter)
{
	if(!iter) return find_first_value_node(value_node,iter);

	if(iter) do {
		if(!iter->children().empty())
		{
			Gtk::TreeIter iter2(iter->children().begin());
			//! \todo confirm that the && should be done before the ||
			if((iter2 && value_node==(ValueNode::Handle)(*iter2)[model.value_node]) || find_next_value_node(value_node, iter2))
			{
				iter=iter2;
				return true;
			}
		}
		Gtk::TreeIter iter2(++iter);
		if(!iter2)
		{
			iter==iter->parent();
			if(iter)++iter;
		}
		else
			iter=iter2;
	} while(iter && value_node!=(ValueNode::Handle)(*iter)[model.value_node]);
	return (bool)iter && value_node==(ValueNode::Handle)(*iter)[model.value_node];
}
Exemplo n.º 11
0
bool
CanvasTreeStore::find_first_value_node(const synfig::ValueNode::Handle& value_node, Gtk::TreeIter& iter)
{
	// maybe replace the ValueNode_Const or ValueNode_Animated with the contained ValueNode_Bone
	// todo: do we need to do this in find_next_value_node, and find_*_value_desc too?
	synfig::ValueNode::Handle node(expandable_bone_parent(value_node));

	iter=children().begin();
	while(iter && node!=(ValueNode::Handle)(*iter)[model.value_node])
	{
		if(!iter->children().empty())
		{
			Gtk::TreeIter iter2(iter->children().begin());
			//! \todo confirm that the && should be done before the ||
			if((iter2 && node==(ValueNode::Handle)(*iter2)[model.value_node]) || find_next_value_node(node, iter2))
			{
				iter=iter2;
				return true;
			}
		}
		Gtk::TreeIter iter2(++iter);
		if(!iter2)
			iter==iter->parent();
		else
			iter=iter2;
	}
	return (bool)iter && node==(ValueNode::Handle)(*iter)[model.value_node];
}
Exemplo n.º 12
0
    NotebookManager::NotebookManager()
      : m_adding_notebook(false)
   { 
     m_notebooks = Gtk::ListStore::create(m_column_types);

     m_sortedNotebooks = Gtk::TreeModelSort::create (m_notebooks);
     m_sortedNotebooks->set_sort_func (
       0, sigc::ptr_fun(&NotebookManager::compare_notebooks_sort_func));
     m_sortedNotebooks->set_sort_column (0, Gtk::SORT_ASCENDING);
      
     m_filteredNotebooks = Gtk::TreeModelFilter::create (m_sortedNotebooks);
     m_filteredNotebooks->set_visible_func(
       sigc::ptr_fun(&NotebookManager::filter_notebooks));
      
     Notebook::Ptr allNotesNotebook(new AllNotesNotebook ());
     Gtk::TreeIter iter = m_notebooks->append ();
     iter->set_value(0, Notebook::Ptr(allNotesNotebook));
      
     Notebook::Ptr unfiledNotesNotebook(new UnfiledNotesNotebook ());
     iter = m_notebooks->append ();
     iter->set_value(0, Notebook::Ptr(unfiledNotesNotebook));

      
     load_notebooks ();
    }
Exemplo n.º 13
0
    int NotebookManager::compare_notebooks_sort_func(const Gtk::TreeIter &a, 
                                                     const Gtk::TreeIter &b)
    {
      Notebook::Ptr notebook_a;
      a->get_value (0, notebook_a);
      Notebook::Ptr notebook_b;
      b->get_value (0, notebook_b);

      if (!notebook_a || !notebook_b)
        return 0;
      
      if (std::tr1::dynamic_pointer_cast<SpecialNotebook>(notebook_a) 
          && std::tr1::dynamic_pointer_cast<SpecialNotebook>(notebook_b)) {
        if (std::tr1::dynamic_pointer_cast<AllNotesNotebook>(notebook_a)) {
          return -1;
        }
        else {
          return 1;
        }
      } 
      else if (std::tr1::dynamic_pointer_cast<SpecialNotebook>(notebook_a)) {
        return -1;
      }
      else if (std::tr1::dynamic_pointer_cast<SpecialNotebook>(notebook_b)) {
        return 1;
      }

      return strcmp(notebook_a->get_name().c_str(), 
                    notebook_b->get_name().c_str());
    }
Exemplo n.º 14
0
void PluginDisplay::display_label(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(enum_liststore->col.port);
    if (q->enumkey_changed(int(it->get_value(enum_liststore->col.value)))) {
	dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground().set_value("red");
    } else {
        dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground_set().set_value(false);
    }
}
Exemplo n.º 15
0
void PluginDisplay::on_search_entry_activate() {
    Gtk::TreeIter it = treeview1->get_selection()->get_selected();
    if (it) {
	bool v = !it->get_value(plugin_liststore->col.active);
	it->set_value(plugin_liststore->col.active, v);
	change_count += it->get_value(plugin_liststore->col.pdesc)->set_active(v);
	set_title();
    }
}
Exemplo n.º 16
0
void
LivePathEffectEditor::selectInList(LivePathEffect::Effect* effect)
{
    Gtk::TreeNodeChildren chi = effectlist_view.get_model()->children();
    for (Gtk::TreeIter ci = chi.begin() ; ci != chi.end(); ci++) {
        if (ci->get_value(columns.lperef)->lpeobject->get_lpe() == effect)
            effectlist_view.get_selection()->select(ci);
    }
}
Exemplo n.º 17
0
void PluginDisplay::on_newrow_toggled(const ustring& path) {
    Gtk::TreeIter it = port_liststore->get_iter(path);
    PortDesc *q = it->get_value(port_liststore->col.port);
    bool s = !cellrenderer_newrow->get_active();
    it->set_value(port_liststore->col.newrow, s);
    if (s == q->factory.get_newrow()) {
	q->user.unset(ChangeableValues::newrow_set);
    } else {
	q->user.set_newrow(s);
    }
}
Exemplo n.º 18
0
void SelectInstance::on_response(int response_id) {
    if (response_id == 1) {
	Gtk::TreeIter i = view->get_selection()->get_selected();
	if (!i) {
	    return;
	}
	av.invoke_resolver(i->get_value(cols.name));
	return;
    }
    Gtk::Main::quit();
}
Exemplo n.º 19
0
void PluginDisplay::on_step_edited(const ustring& path, const ustring& newtext) {
    Gtk::TreeIter it = port_liststore->get_iter(path);
    step_mode m = stp_normal;
    for (unsigned int i = 0; i < sizeof(step_type_names)/sizeof(step_type_names[0]); ++i) {
	if (step_type_names[i] == newtext) {
	    m = static_cast<step_mode>(i);
	    break;
	}
    }
    it->get_value(port_liststore->col.port)->step = m;
    it->set_value(port_liststore->col.step, newtext);
}
Exemplo n.º 20
0
void PluginDisplay::on_name_edited(const ustring& path, const ustring& newtext) {
    Gtk::TreeIter it = port_liststore->get_iter(path);
    PortDesc *q = it->get_value(port_liststore->col.port);
    ustring text(newtext);
    gx_system::strip(text);
    if (text.empty() || q->factory.get_name() == text) {
	q->user.unset(ChangeableValues::name_set);
    } else {
	q->user.set_name(text);
    }
    it->set_value(port_liststore->col.name, q->get_name());
}
Exemplo n.º 21
0
void PluginDisplay::on_select_all(bool v) {
    int d = 0;
    Gtk::TreeNodeChildren ch = plugin_liststore->children();
    for (Gtk::TreeIter it = ch.begin(); it != ch.end(); ++it) {
	it->set_value(plugin_liststore->col.active, v);
	d += it->get_value(plugin_liststore->col.pdesc)->set_active(v);
    }
    if (d) {
	change_count += d;
	set_title();
    }
}
Exemplo n.º 22
0
void PluginDisplay::on_reordered(const Gtk::TreePath& path) {
    assert(current_plugin);
    std::map<int,int> d;
    for (unsigned int i = 0; i < current_plugin->ctrl_ports.size(); ++i) {
	d[current_plugin->ctrl_ports[i]->pos] = i;
    }
    std::vector<PortDesc*> l;
    Gtk::TreeNodeChildren ch = port_liststore->children();
    for (Gtk::TreeIter it = ch.begin(); it != ch.end(); ++it) {
	l.push_back(current_plugin->ctrl_ports[d[it->get_value(port_liststore->col.pos)]]);
    }
    current_plugin->ctrl_ports = l;
}
Exemplo n.º 23
0
  void NotebookNoteAddin::get_notebook_menu_items(std::list<NotebookMenuItem*>& items)
  {
    Glib::RefPtr<Gtk::TreeModel> model = NotebookManager::obj().get_notebooks();
    Gtk::TreeIter iter;

    items.clear();

    iter = model->children().begin();
    for(iter = model->children().begin(); iter != model->children().end(); ++iter) {
      Notebook::Ptr notebook;
      iter->get_value(0, notebook);
      NotebookMenuItem *item = manage(new NotebookMenuItem (m_radio_group, 
                                                            get_note(), notebook));
      items.push_back (item);
    }
  }
Exemplo n.º 24
0
bool PluginDisplay::search_equal(const Glib::RefPtr<Gtk::TreeModel>& model, int column, const ustring& key, const Gtk::TreeIter& iter) {
    PluginDesc *p = iter->get_value(plugin_liststore->col.pdesc);
    ustring txt(gx_system::to_string(p->UniqueID));
    if (txt.compare(0, ustring::npos, key, 0, key.size()) == 0) {
        return false;
    }
    txt = iter->get_value(plugin_liststore->col.name).lowercase();
    std::vector<ustring> keyvec;
    split(keyvec, key);
    for (std::vector<ustring>::iterator i = keyvec.begin(); i != keyvec.end(); ++i) {
        if (txt.find(*i) == ustring::npos) {
            return true;
	}
    }
    return false;
}
Exemplo n.º 25
0
void PluginDisplay::on_parameter_selection_changed() {
    Gtk::TreeIter it = treeview2->get_selection()->get_selected();
    enum_liststore->clear();
    if (it) {
	PortDesc *q = it->get_value(port_liststore->col.port);
	if (q->get_tp() == tp_enum) {
	    int up = int(q->get_up());
	    for (int idx = int(q->get_low()); idx <= up; ++idx) {
		it = enum_liststore->append();
		it->set_value(enum_liststore->col.value, idx);
		it->set_value(enum_liststore->col.label, q->get_enum(idx));
		it->set_value(enum_liststore->col.port, q);
	    }
	}
    }
}
Exemplo n.º 26
0
std::string AddinsTreeModel::get_module_id(const Gtk::TreeIter & iter)
{
    std::string id;
    if(iter) {
        iter->get_value(4, id);
    }
    return id;
}
Exemplo n.º 27
0
void PluginDisplay::display_idx(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(port_liststore->col.port);
    if (int(port_liststore->get_path(it)[0]) != q->get_pos()) {
	dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground().set_value("red");
    } else {
        dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground_set().set_value(false);
    }
}
Exemplo n.º 28
0
void PluginDisplay::display_name(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(port_liststore->col.port);
    if (q->is_set(ChangeableValues::name_set)) {
	dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground().set_value("red");
    } else {
        dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground_set().set_value(false);
    }
}
Exemplo n.º 29
0
void PluginDisplay::display_newrow(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(port_liststore->col.port);
    if (q->is_set(ChangeableValues::newrow_set)) {
        cell->property_cell_background().set_value("red");
    } else {
        cell->property_cell_background_set().set_value(false);
    }
}
Exemplo n.º 30
0
void PluginDisplay::display_caption(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(port_liststore->col.port);
    if (!q->has_caption) {
        cell->property_cell_background().set_value("red");
    } else {
        cell->property_cell_background_set().set_value(false);
    }
}