Esempio 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);
    }
}
Esempio n. 2
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 ();
    }
Esempio n. 3
0
void PluginDisplay::on_type_edited(const ustring& path, const ustring& newtext) {
    Gtk::TreeIter it = port_liststore->get_iter(path);
    PortDesc *q = it->get_value(port_liststore->col.port);
    DisplayType tp_old = q->user.get_tp();
    DisplayType tp = tp_scale;
    for (unsigned int i = 0; i < sizeof(display_type_names)/sizeof(display_type_names[0]); i++) {
	if (newtext == display_type_names[i]) {
	    tp = static_cast<DisplayType>(i);
	    break;
	}
    }
    q->set_tp(tp);
    if (tp != tp_old) {
	if (tp == tp_scale_log) {
	    if (q->get_low() <= 0) {
		q->set_low(1e-7);
	    }
	    if (q->get_up() <= q->get_low()) {
		q->set_up(q->get_low()*1000);
	    }
	    float dflt = q->get_dflt();
	    if (!(q->get_low() <= dflt && dflt <= q->get_up())) {
		q->set_dflt(q->get_low());
	    }
	} else if (tp == tp_toggle) {
	    q->set_dflt(int(q->get_dflt() != 0));
	    q->set_low(0);
	    q->set_up(1);
	} else if (tp == tp_enum || tp == tp_int) {
	    q->set_dflt(round(q->get_dflt()));
	    q->set_low(round(q->get_low()));
	    q->set_up(round(q->get_up()));
	}
	float dflt = q->get_dflt();
	float low = q->get_low();
	float up = q->get_up();
	if (q->has_sr && !q->use_sr) {
	    dflt *= q->SR;
	    low *= q->SR;
	    up *= q->SR;
	}
	it->set_value(port_liststore->col.dflt, ustring::format(dflt));
	it->set_value(port_liststore->col.low, ustring::format(low));
	it->set_value(port_liststore->col.up, ustring::format(up));
    }
    it->set_value(port_liststore->col.display, newtext);
    on_parameter_selection_changed();
}
Esempio n. 4
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;
}
Esempio n. 5
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();
}
Esempio n. 6
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);
	    }
	}
    }
}
Esempio n. 7
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);
	}
    }
}
Esempio n. 8
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();
    }
}
Esempio n. 9
0
void PluginDisplay::on_up_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);
    float val;
    if (text.empty()) {
	q->user.unset(ChangeableValues::up_set);
	val = q->factory.get_up();
	if (q->get_dflt() > val) {
	    q->set_dflt(val);
	}
	if (q->get_low() > val) {
	    q->set_low(max(q->get_low(),val-1));
	}
	if (q->has_sr && !q->use_sr) {
	    val *= q->SR;
	}
    } else {
	char *p;
	val = strtod(text.c_str(), &p);
	if (p != text.c_str() + text.size()) {
	    return;
	}
	float val2;
	if (q->has_sr && !q->use_sr) {
	    val2 = val/q->SR;
	} else {
	    val2 = val;
	}
	if (!(val2 > q->get_low())) {
	    return;
	}
	if (q->get_dflt() > val2) {
	    q->user.set_dflt(val2);
	}
	it->set_value(port_liststore->col.dflt, ustring::format(q->get_dflt()));
	q->set_up(val2);
	if (q->get_tp() == tp_enum) {
	    on_parameter_selection_changed();
	}
    }
    it->set_value(port_liststore->col.up, ustring::format(val));
}
Esempio n. 10
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);
    }
}
Esempio n. 11
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());
}
Esempio n. 12
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);
}
Esempio n. 13
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();
    }
}
Esempio n. 14
0
    Notebook::Ptr NotebookManager::get_or_create_notebook(const std::string & notebookName)
    {
      if (notebookName.empty())
        throw sharp::Exception ("NotebookManager.GetNotebook () called with a null name.");
      
      Notebook::Ptr notebook = get_notebook (notebookName);
      if (notebook) {
        return notebook;
      }
      
      Gtk::TreeIter iter;
//      lock (locker) {
        notebook = get_notebook (notebookName);
        if (notebook)
          return notebook;
        
        try {
          m_adding_notebook = true;
          notebook = Notebook::Ptr(new Notebook (notebookName));
        } 
        catch(...)
        {
          // set flag to fast and rethrow
          m_adding_notebook = false;
          throw;
        }
        m_adding_notebook = false;
        iter = m_notebooks->append ();
        iter->set_value(0, notebook);
        m_notebookMap [notebook->get_normalized_name()] = iter;
        
        // Create the template note so the system tag
        // that represents the notebook actually gets
        // saved to a note (and persisted after Tomboy
        // is shut down).
        Note::Ptr templateNote = notebook->get_template_note ();
        
        // Make sure the template note has the notebook tag.
        // Since it's possible for the template note to already
        // exist, we need to make sure it gets tagged.
        templateNote->add_tag (notebook->get_tag());
        m_note_added_to_notebook (*templateNote, notebook);
//      }

      return notebook;
    }
Esempio n. 15
0
void FillThumbnail(const Gtk::TreeIter& itr, RefPtr<MenuStore> ms, bool force_thumb = false)
{
    Menu mn = GetMenu(ms, itr);
    RefPtr<Gdk::Pixbuf> thumb_pix = itr->get_value(ms->columns.thumbnail);
    if( !thumb_pix )
    {
        thumb_pix = mn->GetData<MenuPack>().thumbPix;
        itr->set_value(ms->columns.thumbnail, thumb_pix);
    }

    // *
    MenuPack& mn_pack = UpdateMenuPack(mn);
    if( force_thumb )
        RenderThumbnail(mn_pack);
    // *
    if( mn_pack.thumbNeedUpdate || force_thumb )
        ms->row_changed(ms->get_path(itr), itr);
    mn_pack.thumbNeedUpdate = false;
}
Esempio n. 16
0
 /// <summary>
 /// Loop through the system tags looking for notebooks
 /// </summary>
 void NotebookManager::load_notebooks()
 {
   Gtk::TreeIter iter;
   std::list<Tag::Ptr> tags;
   ITagManager::obj().all_tags(tags);
   for(std::list<Tag::Ptr>::const_iterator tag_iter = tags.begin();
       tag_iter != tags.end(); ++tag_iter) {
     
     const Tag::Ptr & tag(*tag_iter);
     // Skip over tags that aren't notebooks
     if (!tag->is_system()
         || !Glib::str_has_prefix(tag->name(),
                                  std::string(Tag::SYSTEM_TAG_PREFIX)
                                  + Notebook::NOTEBOOK_TAG_PREFIX)) {
       continue;
     }
     Notebook::Ptr notebook(new Notebook(m_note_manager, tag));
     iter = m_notebooks->append ();
     iter->set_value(0, notebook);
     m_notebookMap [notebook->get_normalized_name()] = iter;
   }
 }
Esempio n. 17
0
void PluginDisplay::on_label_edited(const ustring& path, const ustring& newtext) {
    Gtk::TreeIter it = enum_liststore->get_iter(path);
    PortDesc *q = it->get_value(enum_liststore->col.port);
    ustring text(newtext);
    gx_system::strip(text);
    int idx = it->get_value(enum_liststore->col.value);
    std::map<int, ustring>::iterator i = q->factory.find_enum(idx);
    if (text.empty() || (i != q->factory.enum_end() && i->second == text)) {
	q->user.erase_enum(idx);
	text = "";
    }
    if (text.empty()) {
	std::map<int, ustring>::iterator i = q->factory.find_enum(idx);
	if (i == q->factory.enum_end()) {
	    text = ustring::format(idx);
	} else {
	    text = i->second;
	}
    } else {
	q->user.set_enumvalue(idx, text);
    }
    it->set_value(enum_liststore->col.label, text);
}
Esempio n. 18
0
void PluginDisplay::on_dflt_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);
    float val;
    if (text.empty()) {
	q->user.unset(ChangeableValues::dflt_set);
	val = q->factory.get_dflt();
	if (val < q->get_low()) {
	    q->set_low(val);
	}
	if (val > q->get_up()) {
	    q->set_up(val);
	}
	if (q->has_sr && !q->use_sr) {
	    val *= q->SR;
	}
    } else {
	char *p;
	val = strtod(text.c_str(), &p);
	if (p != text.c_str() + text.size()) {
	    return;
	}
	float val2;
	if (q->has_sr && !q->use_sr) {
	    val2 = val / q->SR;
	} else {
	    val2 = val;
	}
	if (!(q->get_low() <= val2 && val2 <= q->get_up())) {
	    return;
	}
	q->set_dflt(val2);
    }
    it->set_value(port_liststore->col.dflt, ustring::format(val));
}
Esempio n. 19
0
Gtk::TreeIter AddinsTreeModel::append(const gnote::AddinInfo & module_info,
                                      const sharp::DynamicModule *module)
{
    gnote::AddinCategory category = module_info.category();
    Gtk::TreeIter iter = children().begin();
    while(iter != children().end()) {
        gnote::AddinCategory row_value;
        iter->get_value(3, row_value);
        if(row_value == category)
            break;
        else ++iter;
    }
    if(iter == children().end()) {
        iter = Gtk::TreeStore::append();
        iter->set_value(0, get_addin_category_name(category));
        iter->set_value(3, category);
    }
    iter = Gtk::TreeStore::append(iter->children());
    iter->set_value(0, std::string(module_info.name()));
    iter->set_value(1, std::string(module_info.version()));
    iter->set_value(2, module);
    iter->set_value(4, module_info.id());
    return iter;
}
Esempio n. 20
0
void AddinsTreeModel::set_module(const Gtk::TreeIter & iter, const sharp::DynamicModule * dmod)
{
    if(iter) {
        iter->set_value(2, dmod);
    }
}
Esempio n. 21
0
void PluginDisplay::selection_changed() {
    Gtk::TreeIter it = treeview1->get_selection()->get_selected();
    PluginDesc *p = 0;
    if (it) {
	p = it->get_value(plugin_liststore->col.pdesc);
	if (current_plugin == p) {
	    return;
	}
    }
    save_current();
    on_reordered_conn.block();
    port_liststore->clear();
    on_reordered_conn.unblock();
    ladspa_category->set_text("");
    ladspa_maker->set_text("");
    ladspa_uniqueid->set_text("");
    plugin_name->set_text("");
    plugin_category->set_active(-1);
    plugin_quirks->set_active(-1);
    if (!p) {
	return;
    }
    set_old_state(p);
    if (p->shortname != p->Name) {
	plugin_name->modify_text(Gtk::STATE_NORMAL, Gdk::Color("red"));
    } else {
	plugin_name->unset_text(Gtk::STATE_NORMAL);
    }
    plugin_name->set_text(p->shortname);
    Gtk::TreeNodeChildren ch = plugin_category->get_model()->children();
    int i = 0;
    for (it = ch.begin(); it != ch.end(); ++it, ++i) {
	ustring cat;
	it->get_value(1, cat);
	if (cat == p->category) {
	    plugin_category->set_active(i);
	    break;
	}
    }
    ch = plugin_quirks->get_model()->children();
    for (i = 0, it = ch.begin(); it != ch.end(); ++it, ++i) {
	int quirks;
	it->get_value(1, quirks);
	if (quirks == p->quirks) {
	    plugin_quirks->set_active(i);
	    break;
	}
    }
    Glib::RefPtr<Gtk::ListStore> ls_master = Glib::RefPtr<Gtk::ListStore>::cast_dynamic(master_slider_idx->get_model());
    ls_master->clear();
    it = ls_master->append();
    i = -1;
    it->set_value(0, i);
    ustring ml("");
    for (unsigned int i = 0; i < p->ctrl_ports.size(); ++i) {
	it = ls_master->append();
	it->set_value(0, int(i));
	if (p->ctrl_ports[i]->pos == p->MasterIdx) {
	    ml = p->ctrl_ports[i]->factory.get_name();
	}
    }
    master_slider_idx->set_active(p->MasterIdx+1);
    master_slider_name->unset_text(Gtk::STATE_NORMAL);
    if (!p->MasterLabel.empty()) {
	master_slider_name->set_text(p->MasterLabel);
	if (p->MasterLabel != ml) {
	    master_slider_name->modify_text(Gtk::STATE_NORMAL, Gdk::Color("red"));
	}
    }
    dry_wet_button->set_active(current_plugin->add_wet_dry);
    ladspa_category->set_text(p->ladspa_category);
    ladspa_maker->set_text(p->Maker);
    if (p->is_lv2) {
	ladspa_uniqueid->set_text(ustring::compose("LV2: %1", p->path));
    } else {
	ladspa_uniqueid->set_text(ustring::compose("%1: %2[%3]", p->UniqueID, p->path, p->index));
    }
    for (unsigned int i = 0; i < p->ctrl_ports.size(); ++i) {
	PortDesc *q = p->ctrl_ports[i];
	Glib::RefPtr<Gtk::ListStore> tls;
	if (q->is_output) {
	    tls = output_type_list;
	} else if (q->has_sr) {
	    tls = display_type_list_sr;
	} else {
	    tls = display_type_list;
	}
	float dflt = q->get_dflt();
	float low = q->get_low();
	float up = q->get_up();
	if (q->has_sr && !q->use_sr) {
	    if (q->factory.is_set(ChangeableValues::dflt_set)) {
		dflt *= q->SR;
	    }
	    if (q->factory.is_set(ChangeableValues::low_set)) {
		low *= q->SR;
	    }
	    if (q->factory.is_set(ChangeableValues::up_set)) {
		up *= q->SR;
	    }
	}
	it = port_liststore->append();
	it->set_value(port_liststore->col.pos, q->pos);
	it->set_value(port_liststore->col.name, q->get_name());
	it->set_value(port_liststore->col.dflt, ustring::format(dflt));
	it->set_value(port_liststore->col.low, ustring::format(low));
	it->set_value(port_liststore->col.up, ustring::format(up));
	it->set_value(port_liststore->col.step, ustring(step_type_names[q->step]));
	it->set_value(port_liststore->col.display, ustring(display_type_names[q->get_tp()]));
	it->set_value(port_liststore->col.display_types, tls);
	it->set_value(port_liststore->col.port, q);
	it->set_value(port_liststore->col.newrow, q->get_newrow());
	it->set_value(port_liststore->col.use_sr, q->has_sr && !q->use_sr);
	it->set_value(port_liststore->col.has_caption, q->has_caption);
    }
}