void DrawableTreeView::add_group ( const ::Gtk::TreeRow & row, Group::pointer group ) { ::Gtk::TreeModel::iterator iter, liter; Group::Layers::const_iterator layers_iter; Group::Layer::const_iterator layer_iter; Group::pointer subgroup; for ( layers_iter = group->layers().begin(); layers_iter != group->layers().end(); layers_iter++ ) { if ( m_show_layers ) { std::ostringstream sout; sout.str(""); sout << "Layer " << layers_iter->first; liter = m_store->append(row.children()); liter->set_value( m_column_record.type, Glib::ustring(sout.str()) ); } for ( layer_iter = layers_iter->second.begin(); layer_iter != layers_iter->second.end(); layer_iter++ ) { if ( m_show_layers ) { this->add_drawable( *liter, *layer_iter ); } else { this->add_drawable( row, *layer_iter ); } } } }
void HistoryTreeStore::insert_action(Gtk::TreeRow row,etl::handle<synfigapp::Action::Undoable> action, bool /*is_active*/, bool is_undo, bool is_redo) { assert(action); row[model.action] = action; row[model.name] = static_cast<Glib::ustring>(action->get_local_name()); row[model.is_active] = action->is_active(); row[model.is_undo] = is_undo; row[model.is_redo] = is_redo; synfigapp::Action::CanvasSpecific *specific_action; specific_action=dynamic_cast<synfigapp::Action::CanvasSpecific*>(action.get()); if(specific_action) { row[model.canvas] = specific_action->get_canvas(); row[model.canvas_id] = specific_action->get_canvas()->get_id(); } etl::handle<synfigapp::Action::Group> group; group=etl::handle<synfigapp::Action::Group>::cast_dynamic(action); if(group) { synfigapp::Action::ActionList::const_iterator iter; for(iter=group->action_list().begin();iter!=group->action_list().end();++iter) { Gtk::TreeRow child_row = *(append(row.children())); insert_action(child_row,*iter,true,is_undo,is_redo); } } //row[model.icon] = Gtk::Button().render_icon_pixbuf(Gtk::StockID("synfig-canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR); }
void DomainEventsAdapterModelImpl::setUnitsColl( openfluid::core::UnitsCollection* UnitsColl) { mref_TreeModel->clear(); if (!UnitsColl) return; EngineHelper::sortUnitsCollectionById(*UnitsColl); openfluid::core::UnitsList_t::iterator it; for (it = UnitsColl->getList()->begin(); it != UnitsColl->getList()->end(); ++it) { openfluid::core::Unit* TheUnit = const_cast<openfluid::core::Unit*> (&(*it)); if (TheUnit->getEvents()->getCount()) { Gtk::TreeRow UnitRow = *mref_TreeModel->append(); UnitRow[m_Columns.m_Id_Date_Info] = Glib::ustring::compose("%1", TheUnit->getID()); openfluid::core::EventsList_t* Events = TheUnit->getEvents()->getEventsList(); EngineHelper::sortEventsListByDateTime(*Events); openfluid::core::EventsList_t::iterator itEvents; for (itEvents = Events->begin(); itEvents != Events->end(); ++itEvents) { Gtk::TreeRow EventRow = *mref_TreeModel->append(UnitRow->children()); EventRow[m_Columns.m_Id_Date_Info] = (*itEvents).getDateTime().getAsISOString(); openfluid::core::Event::EventInfosMap_t Infos = (*itEvents).getInfos(); openfluid::core::Event::EventInfosMap_t::iterator itInfos; for (itInfos = Infos.begin(); itInfos != Infos.end(); ++itInfos) { Gtk::TreeRow InfoRow = *mref_TreeModel->append(EventRow->children()); InfoRow[m_Columns.m_Id_Date_Info] = Glib::ustring::compose("%1 : %2", itInfos->first, itInfos->second.get()); } } } } }
void DrawableTreeView::add_drawable ( const ::Gtk::TreeRow & row, Drawable::pointer d ) { ::Gtk::TreeModel::iterator iter; Group::pointer group; if ( not d ) return; iter = m_store->append(row.children()); iter->set_value ( m_column_record.type, Glib::ustring ( d->class_name() ) ); iter->set_value ( m_column_record.id, Glib::ustring ( d->id() ) ); if ( d->is_group() ) { Group::pointer group = papyrus_dynamic_pointer_cast<Group> ( d ); this->add_group( *iter, group ); } else if ( d->class_name() == "Reference" ) { Reference::pointer ref = papyrus_dynamic_pointer_cast<Reference>(d); this->add_drawable( *iter, ref->referenced() ); } }
void DomainUnitRelationAddDialog::update(std::set<std::string> ClassNames) { mref_TreeModel->clear(); for (std::set<std::string>::iterator itClass = ClassNames.begin(); itClass != ClassNames.end(); ++itClass) { Gtk::TreeRow ClassRow = *mref_TreeModel->append(); ClassRow[m_Columns.m_Class] = *itClass; ClassRow[m_Columns.m_Text] = *itClass; std::set<int> Ids = EngineHelper::getIDs(mp_CoreRepos, *itClass); for (std::set<int>::iterator itId = Ids.begin(); itId != Ids.end(); ++itId) { Gtk::TreeRow Row = *mref_TreeModel->append(ClassRow->children()); Row[m_Columns.m_Class] = *itClass; Row[m_Columns.m_Id] = *itId; Row[m_Columns.m_Text] = Glib::ustring::compose("%1", *itId); } } mp_TreeView->expand_all(); }
void CanvasTreeStore::set_row(Gtk::TreeRow row,synfigapp::ValueDesc value_desc, bool do_children) { Gtk::TreeModel::Children children = row.children(); while(!children.empty() && erase(children.begin())) ; row[model.value_desc]=value_desc; try { //row[model.icon] = get_tree_pixbuf(value_desc.get_value_type()); if(value_desc.is_value_node()) { ValueNode::Handle value_node=value_desc.get_value_node(); // todo: if the parent is animated and expanded, and we drag the time slider so that it changes, // it's not updated. it still shows the previous bone valuenode. // maybe replace the ValueNode_Const or ValueNode_Animated with the contained ValueNode_Bone value_node = expandable_bone_parent(value_node); assert(value_node); row[model.value_node] = value_node; //row[model.is_canvas] = false; //row[model.is_value_node] = true; //row[model.is_editable] = synfigapp::is_editable(value_node); //row[model.id]=value_node->get_id(); // Set the canvas if(value_desc.parent_is_canvas()) row[model.canvas]=value_desc.get_canvas(); else row[model.canvas]=canvas_interface()->get_canvas(); LinkableValueNode::Handle linkable; // printf("%s:%d value_node = %s\n", __FILE__, __LINE__, value_node->get_description().c_str()); linkable=LinkableValueNode::Handle::cast_dynamic(value_node); // printf("linkable: %d; do_children: %d\n", bool(linkable), bool(do_children)); if(linkable && do_children) { row[model.link_count] = linkable->link_count(); LinkableValueNode::Vocab vocab(linkable->get_children_vocab()); LinkableValueNode::Vocab::iterator iter(vocab.begin()); for(int i=0;i<linkable->link_count();i++, iter++) { if(iter->get_hidden()) continue; Gtk::TreeRow child_row=*(append(row.children())); child_row[model.link_id] = i; child_row[model.canvas] = static_cast<Canvas::Handle>(row[model.canvas]); child_row[model.name] = linkable->link_local_name(i); child_row[model.tooltip] = iter->get_description(); child_row[model.child_param_desc] = *iter; set_row(child_row,synfigapp::ValueDesc(linkable,i)); } } return; } else { //row[model.is_value_node] = false; //row[model.is_editable] = true; //row[model.label] = Glib::ustring(row[model.name]); return; } } catch(synfig::Exception::IDNotFound x) { synfig::error(__FILE__":%d: IDNotFound thrown",__LINE__); erase(row); return; } // We should never get to this point assert(0); }