Exemplo n.º 1
0
void NiepceWindow::init_actions()
{
    m_menu = Gio::Menu::create();
    Glib::RefPtr<Gio::Menu> submenu;
    Glib::RefPtr<Gio::Menu> section;

    m_action_group = Gio::SimpleActionGroup::create();
    gtkWindow().insert_action_group("win", m_action_group);

    fwk::add_action(m_action_group, "Close",
                    sigc::mem_fun(
                        gtkWindow(), &Gtk::Window::hide), "win", "<Primary>w");

    // XXX Move to shell?
    create_undo_action(m_action_group);
    create_redo_action(m_action_group);

    fwk::add_action(m_action_group, "Cut",
                    Gio::ActionMap::ActivateSlot(),
                    "win", "<control>x");
    fwk::add_action(m_action_group, "Copy",
                    Gio::ActionMap::ActivateSlot(),
                    "win", "<control>c");
    fwk::add_action(m_action_group, "Paste",
                    Gio::ActionMap::ActivateSlot(),
                    "win" "<control>v");
    fwk::add_action(m_action_group, "Delete",
                    sigc::mem_fun(*this, &NiepceWindow::on_action_edit_delete),
                    "win", "Delete");

    // Main "hamburger" menu
    section = Gio::Menu::create();
    m_main_menu->append_section(section);
    section->append(_("New Catalog..."), "app.NewCatalog");
    section->append(_("Open Catalog..."), "app.OpenCatalog");

    section = Gio::Menu::create();
    m_main_menu->append_section(section);
    m_hide_tools_action
        = fwk::add_menu_action(m_action_group, "ToggleToolsVisible",
                               sigc::mem_fun(*this, &Frame::toggle_tools_visible),
                               section, _("Hide tools"), "win",
                               nullptr);
    fwk::add_menu_action(m_action_group, "EditLabels",
                         sigc::mem_fun(*this, &NiepceWindow::on_action_edit_labels),
                         section, _("Edit Labels..."), "win", nullptr);
    section->append(_("Preferences..."), "app.Preferences");

    section = Gio::Menu::create();
    m_main_menu->append_section(section);
    section->append(_("Help"), "app.Help");
    section->append(_("About"), "app.About");
}
Exemplo n.º 2
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);
	}
    }
}
Exemplo n.º 3
0
// create selectors from gxwmm
void Widget::make_selector(Glib::ustring labela,
                           Glib::ustring tables[],
                           size_t _size,
                           float min, float digits,
                           PortIndex port_name)
{
  Gxw::Selector *regler = static_cast<Gxw::Selector*>
                                    (get_controller_by_port(port_name));
  if (regler)
  {
    float max = static_cast<float>(_size+1);

    Gtk::TreeModelColumn<Glib::ustring> label;
    Gtk::TreeModelColumnRecord rec;
    rec.add(label);
    Glib::RefPtr<Gtk::ListStore> ls = Gtk::ListStore::create(rec);

    for (uint32_t i = 0 ; i< _size; ++i) {
      ls->append()->set_value(0, tables[i]);
    }
    regler->set_model(ls);
    regler->set_has_tooltip();
    regler->set_tooltip_text(labela);
    regler->cp_configure("SELECTOR", labela, min, max, digits);
    regler->set_show_value(false);
    regler->set_name(plug_name);
    regler->signal_value_changed().connect(sigc::bind(sigc::mem_fun(
           *this, &Widget::on_value_changed), port_name));
  }
}
Exemplo n.º 4
0
VRConceptWidget::VRConceptWidget(VRGuiSemantics* m, Gtk::Fixed* canvas, VRConceptPtr concept) : VRSemanticWidget(m, canvas, "#00CCFF") {
    this->concept = concept;
    label->set_text(concept->getName());

    auto toolbar2 = Gtk::manage( new Gtk::Toolbar() );
    toolbar2->set_icon_size(Gtk::ICON_SIZE_MENU);
    toolbar2->set_show_arrow(0);
    toolbar2->set_toolbar_style(Gtk::TOOLBAR_TEXT);
    auto bConceptNew = Gtk::manage( new Gtk::ToolButton("C") );
    auto bEntityNew = Gtk::manage( new Gtk::ToolButton("E") );
    auto bRuleNew = Gtk::manage( new Gtk::ToolButton("R") );
    auto sep = Gtk::manage( new Gtk::SeparatorToolItem() );
    toolbar2->add(*sep);
    toolbar2->add(*bConceptNew);
    toolbar2->add(*bEntityNew);
    toolbar2->add(*bRuleNew);
    toolbars->pack_start(*toolbar2);
    toolbars->show_all();

    bConceptNew->set_tooltip_text("new concept");
    bEntityNew->set_tooltip_text("new entity");
    bRuleNew->set_tooltip_text("new rule");

    bConceptNew->signal_clicked().connect( sigc::mem_fun(*this, &VRConceptWidget::on_new_concept_clicked) );
    bEntityNew->signal_clicked().connect( sigc::mem_fun(*this, &VRConceptWidget::on_new_entity_clicked) );
    bRuleNew->signal_clicked().connect( sigc::mem_fun(*this, &VRConceptWidget::on_new_rule_clicked) );

    Glib::RefPtr<Gtk::TreeStore> treestore = Glib::RefPtr<Gtk::TreeStore>::cast_dynamic( treeview->get_model() );
    for (auto p : concept->properties) {
        setPropRow(treestore->append(), p.second->getName(), p.second->type, "black", 0);
    }
}
Exemplo n.º 5
0
void NaviModules::SetDesEnv(MEnv* aDesEnv)
{
    if (aDesEnv != iDesEnv) {
	unset_model();
	remove_all_columns();
	Glib::RefPtr<TreeModel> curmdl = get_model();
	curmdl.reset();
	iDesEnv = aDesEnv;
	if (iDesEnv != NULL) {
	    Glib::RefPtr<Gtk::ListStore> mdl = Gtk::ListStore::create(iColRec);
	    GtkTreeModel* model = mdl->Gtk::TreeModel::gobj();
	    set_model(mdl);
	    append_column( "one", iColRec.name);
	    enable_model_drag_source();
	    drag_source_set (Gtk::ArrayHandle_TargetEntry(KModListTargets, 1, Glib::OWNERSHIP_NONE), Gdk::MODIFIER_MASK, Gdk::ACTION_COPY);
	    // Fill out the model
	    // List modules directory
	    struct dirent **entlist;
	    string modpath = iDesEnv->Provider()->ModulesPath();
	    int n = scandir (modpath.c_str(), &entlist, FilterModulesDirEntries, alphasort);
	    // Fill out the model
	    for (int cnt = 0; cnt < n; ++cnt) {
		Gtk::TreeIter it = mdl->append();
		Glib::ustring data = entlist[cnt]->d_name;
		(*it).set_value(iColRec.name, data);
	    }
	}
    }
}
Exemplo n.º 6
0
void VRGuiNav::on_preset_changed() {
    auto scene = VRSceneManager::getCurrent();
    if (scene == 0) return;
    VRNavPreset* preset = scene->getNavigation(getComboboxText("combobox5"));
    if (preset == 0) return;

    //get binding type liststore
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("binding_types"));

    //TODO: get all bindings from preset && update nav_bindings
    navBindings_store->clear();
    for (auto& b : *preset) {
        string cb_name;
        if (b.cb) cb_name = b.cb->getName();

        string type = "Event";
        if (b.doRepeat) type = "State";

        Gtk::ListStore::Row row = *navBindings_store->append();
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 0, b.key, -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 1, b.state, -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 2, type.c_str(), -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 3, cb_name.c_str(), -1);
        gtk_list_store_set (navBindings_store->gobj(), row.gobj(), 4, NULL, -1);
    }
}
Exemplo n.º 7
0
void fillStringListstore(string ls, vector<string> list) {
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object(ls.c_str()));
    store->clear();
    for (unsigned int i=0; i<list.size(); i++) {
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, list[i].c_str(), -1);
    }
}
Exemplo n.º 8
0
//
// ノードを分解して Gtk::TreeStore へ Gtk::TreeModel::Row を追加
//
// ただし列は SKELETON::EditColumns を継承したものであること
//
// list_path_expand は開いてるツリーを格納するための参照渡し
//
void Dom::append_treestore( Glib::RefPtr< Gtk::TreeStore >& treestore,
                            SKELETON::EditColumns& columns,
                             std::list< Gtk::TreePath >& list_path_expand,
                             const Gtk::TreeModel::Row& parent )
{
    if( ! this ) return;

    // ノードの子要素を走査
    std::list< Dom* >::iterator it = m_childNodes.begin();
    while( it != m_childNodes.end() )
    {
        const int node_type = (*it)->nodeType();

        if( node_type == NODE_TYPE_ELEMENT )
        {
            const int type = XML::get_type( (*it)->nodeName() );

            if( type != TYPE_UNKNOWN )
            {
                Gtk::TreeModel::Row row;

                // Gtk::TreeStore::append() の追加ポイント
                if( parent ) row = *( treestore->append( parent.children() ) );
                else row = *( treestore->append() );

                // 各値をセット
                columns.setup_row( row, (*it)->getAttribute( "url" ), (*it)->getAttribute( "name" ), (*it)->getAttribute( "data" ), type, 0 );

                if( type == TYPE_DIR ){

                    row[ columns.m_dirid ] = atoi( (*it)->getAttribute( "dirid" ).c_str() );

                    // 開いているツリーを追加
                    if( (*it)->getAttribute( "open" ) == "y" ) list_path_expand.push_back( treestore->get_path( row ) );
                }

                // 再帰
                if( (*it)->hasChildNodes() ) (*it)->append_treestore( treestore, columns, list_path_expand, row );
            }
        }

        ++it;
    }
}
void ControladorVistaEnviar::agregarAreasAlCombo(Glib::RefPtr<Gtk::ListStore> modeloComboBox,
		AreasDeVisionComboBoxModel* columnas){
	const std::list<AreaDeVision*>* areas = modelo->getAreasDeVision();

	std::list<AreaDeVision*>::const_iterator it;
	for (it = areas->begin(); it!= areas->end(); ++it){
		Gtk::TreeModel::Row fila = *(modeloComboBox->append());
		fila[columnas->getColumnaValor()] = (*it)->getId();
		fila[columnas->getColumnaTexto()] = (*it)->getUbicacion();
	}
}
Exemplo n.º 10
0
void VRConceptWidget::update() {
    Glib::RefPtr<Gtk::TreeStore> treestore = Glib::RefPtr<Gtk::TreeStore>::cast_dynamic( treeview->get_model() );

    treestore->clear();
    for (auto p : concept->properties) {
        Gtk::TreeModel::iterator i = treestore->append();
        if (selected_property && p.second->getName() == selected_property->getName())
            setPropRow(i, p.second->getName(), p.second->type, "green", 1);
        else setPropRow(i, p.second->getName(), p.second->type, "black", 0);
    }
}
Exemplo n.º 11
0
/**
 *	Add a flow to the rolelist
 *
 *	\param m_refTreeModel	List to append a new row
 *	\param IP IP address
 *	\param graphlet	Graphlet number
 *	\param flIdx	Index into flowlist
 *	\param flows Number of flows
 *	\param uniflows Number of uniflows
 *	\param protos Number of involved protocols
 *	\param packets Number of packets
 *	\param bytes Number of total bytes
 */
void ChostModelColumns::add_row(Glib::RefPtr<Gtk::ListStore> m_refTreeModel, IPv6_addr IP, unsigned int graphlet, unsigned int flIdx, unsigned int flows,
      unsigned int uniflows, unsigned int protos, unsigned int packets, uint64_t bytes) {
	Gtk::TreeModel::Row row = *(m_refTreeModel->append());
	row[m_col_graphlet] = graphlet;
	row[m_col_IP] = IP.toString();
	row[m_col_flIdx] = flIdx;
	row[m_col_flows] = flows;
	row[m_col_uniflows] = uniflows;
	row[m_col_protos] = protos;
	row[m_col_packets] = packets;
	row[m_col_bytes] = bytes;
}
Exemplo n.º 12
0
void VRConceptWidget::on_newp_clicked() {
    Glib::RefPtr<Gtk::TreeStore> treestore = Glib::RefPtr<Gtk::TreeStore>::cast_dynamic( treeview->get_model() );
    string name = "new_property";
    int i=0;
    do {
        i++;
        name = "new_property_" + toString(i);
    } while(concept->getProperty(name));
    setPropRow(treestore->append(), name, "none", "orange", 0);
    concept->addProperty(name, "none");
    saveScene();
}
Exemplo n.º 13
0
/**
 *	Add a flow to the rolelist
 *
 *	\param m_refTreeModel	List to append a new row
 *	\param graphlet	Graphlet number
 *	\param hpgidx	HPG ID (never used?)
 *	\param edges Number of edges
 *	\param protos Number of involved protocols
 *	\param dstIPs Number of remote IPs
 *	\param srcPorts Number of local Ports
 *	\param dstPorts Number of remote Ports
 *	\param bytes Number of total bytes
 */
void ChpgModelColumns::add_row(Glib::RefPtr<Gtk::ListStore> m_refTreeModel, unsigned int graphlet, unsigned int hpgidx, unsigned int edges,
      unsigned int protos, unsigned int dstIPs, unsigned int srcPorts, unsigned int dstPorts, uint64_t bytes) {
	Gtk::TreeModel::Row row = *(m_refTreeModel->append());
	row[m_col_graphlet] = graphlet;
	row[m_col_hpgidx] = hpgidx;
	row[m_col_edges] = edges;
	row[m_col_protos] = protos;
	row[m_col_dstIPs] = dstIPs;
	row[m_col_srcPorts] = srcPorts;
	row[m_col_dstPorts] = dstPorts;
	row[m_col_bytes] = bytes;
}
Exemplo n.º 14
0
// scene updated, get cameras and nav presets
void VRGuiBits::update() {
    // update camera liststore
    VRScene* scene = VRSceneManager::get()->getActiveScene();
    setLabel("label24", "Project: None");
    if (scene == 0) return;

    vector<VRCamera*> cams = scene->getCameraMap();
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("cameras"));
    store->clear();
    int active;
    for (uint i=0; i<cams.size(); i++) {
        if (cams[i] == scene->getActiveCamera()) active = i;
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, cams[i]->getName().c_str(), -1);
    }

    // set active cam active
    Gtk::ComboBox* cb;
    VRGuiBuilder()->get_widget("combobox4", cb);
    cb->set_active(active);

    // update nav_presets liststore
    map<string, VRNavPreset*>::iterator itr;
    map<string, VRNavPreset*> presets = scene->getPresets();
    store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("nav_presets"));
    store->clear();
    for (itr = presets.begin(); itr != presets.end(); itr++) {
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, itr->first.c_str(), -1);
        //if (itr->second) itr->second->setScene(scene);
    }

    // set first element active
    VRGuiBuilder()->get_widget("combobox9", cb);
    cb->set_active(0);

    // update setup and project label
    cout << " now running: " << scene->getName() << endl;
    setLabel("label24", "Project: " + scene->getName());
}
Exemplo n.º 15
0
void VRGuiBits_on_internal_update(int i) {
    VRInternalMonitor* mnr = VRInternalMonitor::get();
    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("liststore4"));
    store->clear();

    map<string, string> vars = mnr->getVariables();
    map<string, string>::iterator itr;
    for (itr = vars.begin(); itr != vars.end(); itr++) {
        Gtk::ListStore::Row row = *store->append();
        gtk_list_store_set (store->gobj(), row.gobj(), 0, itr->first.c_str(), -1);
        gtk_list_store_set (store->gobj(), row.gobj(), 1, itr->second.c_str(), -1);
    }
}
Exemplo n.º 16
0
void VRGuiNav::on_new_preset_clicked() {
    auto scene = VRSceneManager::getCurrent();
    if (scene == 0) return;
    VRNavPreset* preset = new VRNavPreset();
    scene->addNavigation(preset);
    preset->setTarget(scene->getActiveCamera());

    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("nav_presets"));
    Gtk::ListStore::Row row = *store->append();
    gtk_list_store_set (store->gobj(), row.gobj(), 0, preset->getName().c_str(), -1);

    setComboboxLastActive("combobox5");
}
Exemplo n.º 17
0
void KeysStoreDialog::onInputCommit(const Glib::ustring key) {
	// Add key to list store
	if(key == "")
		return;

	Glib::RefPtr<Gtk::TreeModel> model = treeView->get_model();
	Glib::RefPtr<Gtk::ListStore> listStore = Glib::RefPtr<Gtk::ListStore>::cast_static(model);

	Gtk::TreeModel::Row row = *(listStore->append());
	row.set_value<Glib::ustring>(0, key);

	signal_changed(prepareModel());
}
Exemplo n.º 18
0
void ModelFiller::operator()(const NoteBase::Ptr & note)
{
  if (!note)
    return;

  ModelColumnRecord model_column_record;
  const Gtk::TreeModel::iterator iter = m_list_store->append();
  Gtk::TreeModel::Row row = *iter;

  row[model_column_record.get_column_selected()] = true;
  row[model_column_record.get_column_title()] = note->get_title();
  row[model_column_record.get_column_note()] = note;
}
// Populate a list store with conversations
void ConversationEntity::populateListStore(const Glib::RefPtr<Gtk::ListStore>& store,
										   const ConversationColumns& columns) const
{
	for (ConversationMap::const_iterator i = _conversations.begin();
		 i != _conversations.end();
		 ++i)
	{
		Gtk::TreeModel::Row row = *store->append();

		row[columns.index] = i->first;
		row[columns.name] = i->second.name;
	}
}
Exemplo n.º 20
0
Glib::RefPtr<Gtk::ListStore> WelcomeWindow::PopulateTeamNumberCombo()
{
	TeamComboColumns teamColumns;
	Glib::RefPtr<Gtk::ListStore> listStore = Gtk::ListStore::create(teamColumns);

	TreeModel::Row row = *(listStore->append());
	row[teamColumns.m_teamNum] = 1;
	row[teamColumns.m_teamString] = "Team 1";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 2;
	row[teamColumns.m_teamString] = "Team 2";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 3;
	row[teamColumns.m_teamString] = "Team 3";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 4;
	row[teamColumns.m_teamString] = "Team 4";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 5;
	row[teamColumns.m_teamString] = "Team 5";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 6;
	row[teamColumns.m_teamString] = "Team 6";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 7;
	row[teamColumns.m_teamString] = "Team 7";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 8;
	row[teamColumns.m_teamString] = "Team 8";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 9;
	row[teamColumns.m_teamString] = "Referee";
	row = *(listStore->append());
	row[teamColumns.m_teamNum] = 0;
	row[teamColumns.m_teamString] = "Spectator";

	return listStore;
}
void ConversationCommandLibrary::populateListStore(const Glib::RefPtr<Gtk::ListStore>& store,
												   const CommandColumns& columns)
{
	// Iterate over everything and push the data into the liststore
	for (ConversationCommandInfoMap::const_iterator i = _commandInfo.begin();
		 i != _commandInfo.end();
		 ++i)
	{
		Gtk::TreeModel::Row row = *store->append();

		row[columns.cmdNumber] = i->second->id;
		row[columns.caption] = i->second->name;
	}
}
Exemplo n.º 22
0
void Info::fillNameClassIDListStore(Glib::RefPtr<Gtk::ListStore>& ListStore,
    ModelColumnsNameClassIDs& ModelColumnsNameClassIDs,
    const openfluid::core::UnitsPtrList_t* TempListUnit, std::string ClassName)
{
  openfluid::core::UnitsPtrList_t::const_iterator itF;

  if (TempListUnit != NULL)
  {
    for (itF = TempListUnit->begin(); itF != TempListUnit->end(); ++itF)
    {
      Gtk::TreeRow Row = *ListStore->append();
      Row[ModelColumnsNameClassIDs.m_ID] = (*itF)->getID();
      Row[ModelColumnsNameClassIDs.m_NameClass] = ClassName;
    }
  }
}
Exemplo n.º 23
0
void VRGuiNav_on_new_preset_clicked(GtkButton* b, gpointer d) {
    VRNavPreset* preset = new VRNavPreset();
    VRScene* scene = VRSceneManager::get()->getActiveScene();

    string name = "preset"; //TODO: dialog with name, and copy from other scene options
    scene->addPreset(preset, name);

    //preset->setDevice(VRMouse::get());
    preset->setTarget(scene->getActiveCamera());

    Glib::RefPtr<Gtk::ListStore> store = Glib::RefPtr<Gtk::ListStore>::cast_static(VRGuiBuilder()->get_object("nav_presets"));
    Gtk::ListStore::Row row = *store->append();
    gtk_list_store_set (store->gobj(), row.gobj(), 0, name.c_str(), -1);

    setComboboxLastActive("combobox5");
}
Exemplo n.º 24
0
void getPostData(Glib::RefPtr<Gtk::ListStore> m_threads_tree_model) {
	///Get the post data as JSON, and then push it onto the ListStore given in m_threads_tree_model
	
	Json::Value json = getPosts(BOARD, THREAD);
	m_threads_tree_model->clear();
	Json::Value posts = json["posts"];
	for(int i=0;i<posts.size();++i) {
		Gtk::TreeModel::Row row = *(m_threads_tree_model->append());
		
		string text = standardPostFormatting(posts[i]);
		row[m_post_list.text] = text;
		row[m_post_list.tim] = posts[i]["tim"].asString();
		row[m_post_list.ext] = trim(posts[i]["ext"].asString());
		
		ostringstream convert2;
		convert2 << posts[i]["no"].asInt();
		row[m_post_list.no] = convert2.str();
		
		row[m_post_list.file] = posts[i].isMember("filename") ? 1 : 0;
		
		if(posts[i].isMember("filename")) {
			row[m_post_list.fn] = posts[i]["filename"].asString();
		}
		
		boost::regex double_meme_arrows("(&gt;&gt;(?!&gt;)\\d{1,})");
		string curPost = stripBreaks(posts[i]["com"].asString());
		boost::sregex_token_iterator iter(curPost.begin(), curPost.end(), double_meme_arrows, 0);
		boost::sregex_token_iterator end;
		
		boost::regex actual_arrows("&gt;&gt;");
		string tool = "";
		for( ; iter != end; ++iter ) {
			string s = boost::regex_replace(string(*iter), actual_arrows, "");
			int s2 = atoi(s.c_str());
			for(int j=0;j<posts.size();++j) {
				if(posts[j]["no"].asInt() == s2) {
					tool = tool+"<b>"+*iter+"</b>\n"+stripTags(posts[j]["com"].asString())+"\n\n";
					break;
				}
			}
		}
		
		row[m_post_list.tool] = trim(tool);
	}
}
Exemplo n.º 25
0
        // Visit function
        bool pre(const scene::INodePtr& node)
		{
			// Check for an entity
            Entity* entity = Node_getEntity(node);

            if (entity != NULL)
			{
				// Get the entity name
                std::string entName = entity->getKeyValue("name");

				// Append the name to the list store
				Gtk::TreeModel::Row row = *_store->append();

				row[_columns.name] = entName;
            }

            return false; // don't traverse deeper, we're traversing root children
        }
Exemplo n.º 26
0
		// Visit function
		bool pre(const scene::INodePtr& node)
		{
			Entity* entity = Node_getEntity(node);

			if (entity != NULL)
			{
				// Get the entity name
				std::string entName = entity->getKeyValue("name");

				// Append the name to the list store
				Gtk::TreeModel::Row row = *_store->append();
				row[_columns.name] = entName;

				return false; // don't traverse children if entity found
	        }

	        return true; // traverse children otherwise
		}
Exemplo n.º 27
0
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_selector_items(ToolBarItem *item, const std::vector<std::string> &values) {
  if (item->get_type() == mforms::SelectorItem || item->get_type() == mforms::FlatSelectorItem) {
    Gtk::ComboBoxText *w = cast<Gtk::ComboBoxText *>(item->get_data_ptr());
    if (w) {
      w->set_data("ignore_signal", (void *)1);
#if ((GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION >= 24) || GTKMM_MAJOR_VERSION > 2)
      w->remove_all();
#else
      w->clear_items();
#endif
      const int size = values.size();
      for (int i = 0; i < size; ++i)
        w->append(values[i]);

      if (w->get_active_row_number() < 0 && !values.empty())
        w->set_active_text(values[0]);

      w->set_data("ignore_signal", 0);
    }
  } else if (item->get_type() == mforms::ColorSelectorItem) {
    Gtk::ComboBox *w = cast<Gtk::ComboBox *>(item->get_data_ptr());
    if (w) {
      w->set_data("ignore_signal", (void *)1);
      Glib::RefPtr<Gtk::ListStore> model = Gtk::ListStore::create(*color_combo_columns);
      const int size = values.size();
      for (int i = 0; i < size; ++i) {
        Gtk::TreeRow row = *model->append();
        Gdk::Color color(values[i]);
        Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, false, 8, 16, 14);
        pixbuf->fill((guint32)color.get_red() << 24 | (guint32)color.get_green() << 16 | (guint32)color.get_blue() << 8);

        row[color_combo_columns->color] = values[i];
        row[color_combo_columns->image] = pixbuf;
      }

      w->set_model(model);

      if (w->get_active_row_number() < 0)
        w->set_active(0);

      w->set_data("ignore_signal", 0);
    }
  }
}
Exemplo n.º 28
0
FactoryInfoWindow::FactoryInfoWindow (const std::string& factory_name)
{
  builder = Builder::create_from_file ("src/clients/studio/ui/plugininfo.glade");

  builder->get_widget<Gtk::Window> ("elementInfoWindow", window);

  Glib::RefPtr<ListStore> model = ListStore::create (model_columns);
  TreeView *tree = get_widget<TreeView> ("metadataTreeView");

  tree->append_column(_("Key"), model_columns.key);
  tree->append_column(_("Value"), model_columns.value);
  tree->set_model (model);

  GstreamerStudio::Core::PluginInfo plugin_info;

  for (auto item : plugin_info.get_factory_metadata (factory_name))
  {
    TreeModel::Row row = *(model->append ());
    row[model_columns.key] = item.first;
    row[model_columns.value] = item.second;
  }

  get_widget<Button> ("pluginDetailsButton")->signal_clicked ().connect ([factory_name, plugin_info]{
      std::make_shared<PluginInfoWindow> (plugin_info.get_factory_plugin (factory_name))->show_window ();
  });

  Glib::RefPtr<ListStore> properties_model = ListStore::create (properties_model_columns);
  TreeView *props_tree = get_widget<TreeView> ("propertiesTreeView");

  props_tree->append_column(_("Property"), properties_model_columns.key);
  props_tree->append_column(_("Value"), properties_model_columns.value);
  props_tree->set_model (properties_model);

  Core::PropertyContainer props(Gst::ElementFactory::create_element(factory_name));

  for (auto property : props.get_properties())
  {
    TreeModel::Row row = *(properties_model->append());
    row[properties_model_columns.key] = property->get_name();
    row[properties_model_columns.value] = property->get_description();
  }
}
Exemplo n.º 29
0
void display_template_info(const Glib::RefPtr<Gst::PadTemplate> &tpl,
                           const Glib::RefPtr<Gtk::TreeStore> &model, const Gtk::TreeModelColumn<Glib::ustring> &col_name,
                           const Gtk::TreeModelColumn<Glib::ustring> &col_value, boost::optional<const Gtk::TreeModel::Row&> parent_row)
{
    Gtk::TreeRow row;
    if (parent_row)
    {
        row = APPEND_SUB_ROW(_("Template"), tpl->get_name_template(), parent_row.get());
    }
    else
    {
        row = *(model->append());
        row[col_name] = _("Template");
        row[col_value] = tpl->get_name_template();
    }
    APPEND_SUB_ROW(_("Presence"), get_presence_str(tpl->get_presence()), row);
    APPEND_SUB_ROW(_("Direction"), get_direction_str(tpl->get_direction()), row);
    row = APPEND_SUB_ROW("Caps", "", row);
    display_caps(tpl->get_caps(), model, col_name, col_value, row);
}
Exemplo n.º 30
0
void getThreadData(Glib::RefPtr<Gtk::ListStore> m_threads_tree_model) {
	///Get the thread data as JSON, and then push it onto the ListStore given in m_threads_tree_model
	
	Gtk::Spinner *spin = 0;
	builder->get_widget("spinner1", spin);
	spin->set_visible(true);
	spin->show();
	
	Gtk::TreeView *tree = 0;
	builder->get_widget("treeview2", tree);
	tree->hide();
	tree->set_visible(false);
	Json::Value json = getThreads(BOARD);
	
	for(int j=0;j<json.size();++j) {
		Json::Value threads = json[j]["threads"];
		for(int i=0;i<threads.size();++i) {
			Gtk::TreeModel::Row row = *(m_threads_tree_model->append());
			
			ostringstream convert3;
			convert3 << threads[i]["replies"].asUInt();
			
			row[m_thread_list.text] = standardPostFormatting(threads[i])+"\n\n"+convert3.str()+" replies";
			row[m_thread_list.tim] = threads[i]["tim"].asString();
			row[m_thread_list.ext] = trim(threads[i]["ext"].asString());
			if(threads[i].isMember("filename")) {
				row[m_thread_list.fn] = threads[i]["filename"].asString();
			}
			
			ostringstream convert2;
			convert2 << threads[i]["no"].asInt();
			row[m_thread_list.no] = convert2.str();
		}
	}
	
	spin->hide();
	spin->set_visible(false);
	
	tree->show();
	tree->set_visible(true);
}