Esempio n. 1
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);
		}
	}
}
Esempio n. 2
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());
    }
Esempio n. 3
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);
    }
Esempio n. 4
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);
    }
}
Esempio n. 5
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. 6
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();
}
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);
	}
    }
}
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
}
Esempio n. 9
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;
}
Esempio n. 10
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. 11
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. 12
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;
 }
Esempio n. 13
0
void PluginDisplay::display_ladspa(Gtk::CellRenderer *cell, const Gtk::TreeIter& iter) {
    PluginDesc *p = iter->get_value(plugin_liststore->col.pdesc);
    if (p->has_settings) {
        dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground().set_value("red");
    } else {
        dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground_set().set_value(false);
    }
}
Esempio n. 14
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);
    }
}
Esempio n. 15
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);
    }
}
Esempio n. 16
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);
    }
}
Esempio n. 17
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);
    }
}
Esempio n. 18
0
std::string AddinsTreeModel::get_module_id(const Gtk::TreeIter & iter)
{
    std::string id;
    if(iter) {
        iter->get_value(4, id);
    }
    return id;
}
Esempio n. 19
0
 /// <summary>
 /// Filter out SpecialNotebooks from the model
 /// </summary>
 bool NotebookManager::filter_notebooks(const Gtk::TreeIter & iter)
 {
   Notebook::Ptr notebook;
   iter->get_value(0, notebook);
   if (!notebook || dynamic_pointer_cast<SpecialNotebook>(notebook)) {
     return false;
   }
   return true;
 }
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);
    }
}
Esempio n. 21
0
    bool NotebookManager::filter_notebooks_to_display(const Gtk::TreeIter & iter)
    {
      Notebook::Ptr notebook;
      iter->get_value(0, notebook);
      if(notebook == m_active_notes) {
        return !static_pointer_cast<ActiveNotesNotebook>(m_active_notes)->empty();
      }

      return true;
    }
Esempio n. 22
0
void PluginDisplay::display_step(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(port_liststore->col.port);
    DisplayType tp = q->get_tp();
    cell->property_visible().set_value(tp == tp_scale || tp == tp_scale_log);
    if (q->step != stp_normal) {
        dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground().set_value("red");
    } else {
        dynamic_cast<Gtk::CellRendererText*>(cell)->property_foreground_set().set_value(false);
    }
}
Esempio n. 23
0
void PluginDisplay::display_master_idx(const Gtk::TreeIter& it) {
    int i;
    it->get_value(0, i);
    if (i < 0) {
	cellrenderer_master->property_text().set_value("--");
	cellrenderer_master->property_foreground_set().set_value(false);
    } else {
	cellrenderer_master->property_foreground().set_value("red");
    }
}
Esempio n. 24
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. 25
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();
}
Esempio n. 26
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. 27
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. 28
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. 29
0
void PluginDisplay::display_category(const Gtk::TreeIter& it) {
    if (!current_plugin) {
	cellrenderer_category->property_foreground_set().set_value(false);
    } else {
	ustring cat;
	it->get_value(0, cat);
	if (cat == current_plugin->deduced_category) {
	    cellrenderer_category->property_foreground_set().set_value(false);
	} else {
	    cellrenderer_category->property_foreground().set_value("red");
	}
    }
}
Esempio n. 30
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;
}