Gtk::TreeIter ConfigTreeView::search_path( const char* path ) { Gtk::TreeModel::Children children = m_config_tree->children(); Gtk::TreeModel::iterator iter = children.begin(); while ( iter != children.end() ) { Gtk::TreeModel::Row row = *iter; Glib::ustring p = row[ m_config_record.path ]; size_t len = strlen( p.c_str() ); if ( strncmp( p.c_str(), path, len) == 0 ) { if ( strcmp( p.c_str(), path ) == 0 ) { return iter; } else { iter = iter->children().begin(); } } else { ++iter; } } return m_config_tree->children().end(); }
// // 下端へ移動 // void SelectItemPref::slot_bottom() { Gtk::TreeModel::Children children = m_store_shown->children(); if( children.empty() ) return; // 移動先のイテレータ Gtk::TreeIter bottom_it = children.end(); std::list< Gtk::TreePath > selection_path = m_tree_shown.get_selection()->get_selected_rows(); std::list< Gtk::TreePath >::reverse_iterator it = selection_path.rbegin(); while( it != selection_path.rend() ) { Gtk::TreeIter src_it = m_store_shown->get_iter( *it ); Gtk::TreeIter dst_it = bottom_it; // 元と先が同じでない if( src_it != dst_it ) { // 参照渡しなので書き換えられてしまう m_store_shown->move( src_it, dst_it ); bottom_it = dst_it; } // 移動先の位置を上げる if( bottom_it != children.begin() ) --bottom_it; ++it; } // フォーカスを移す set_focus( m_tree_shown ); }
// Populate the active-at-start column. void ObjectivesEditor::populateActiveAtStart() { // Construct the list of entities targeted by the worldspawn TargetList targets(_worldSpawn); // Iterate through each row in the entity list. For each Entity*, get its // name and check if the worldspawn entity has a "target" key for this // entity name. This indicates that the objective entity will be active at // game start. Gtk::TreeModel::Children rows = _objectiveEntityList->children(); for (Gtk::TreeModel::Children::iterator i = rows.begin(); i != rows.end(); ++i) { std::string name = Glib::ustring((*i)[_objEntityColumns.entityName]); ObjectiveEntityPtr obj = _entities[name]; // Test if the worldspawn is targeting this entity by passing the // target list to the objective entity. if (obj->isOnTargetList(targets)) { (*i)[_objEntityColumns.startActive] = true; } } }
static void ClearStore(RefPtr<ObjectStore> os) { Gtk::TreeModel::Children children = os->children(); // с конца быстрее - не требуется реиндексация while( children.size() ) DeleteMedia(os, --children.end()); }
void PredicateDialog::onRenamePredicate() { Glib::RefPtr < Gtk::TreeView::Selection > ref = mTreePredicateList-> get_selection(); if (ref) { Gtk::TreeModel::iterator iter = ref->get_selected(); if (iter) { Gtk::TreeModel::Row row = *iter; std::string oldName(row.get_value(m_viewscolumnrecord.name)); savePreviousPredicate(oldName); SimpleTypeBox box(("Predicate new name?"), ""); std::string name = boost::trim_copy(box.run()); if (box.valid() and checkName(name)) { setSensitivePredicate(false); m_model->erase(iter); Gtk::TreeModel::Children children = m_model->children(); m_iter = children.begin(); iter = m_model->append(); mPredicateNameEntry->set_text(name); Gtk::ListStore::Row row = *iter; row[m_viewscolumnrecord.name] = name; if (mPredicateFunction.find(oldName) != mPredicateFunction.end()) { mTextViewFunction->get_buffer()-> set_text(mPredicateFunction[oldName]); mPredicateFunction[name] = mPredicateFunction[oldName]; mPredicateFunction.erase(oldName); } mPredicateName.push_back(name); // Delete the element in the vector for (std::vector < std::string > ::iterator it = mPredicateName.begin(); it != mPredicateName.end(); ) { if ( *it == oldName ) { it = mPredicateName.erase(it); } else { ++it; } } mTreePredicateList->set_cursor(m_model->get_path(iter)); setSensitivePredicate(true); } else { Gtk::MessageDialog errorDial ("Name error !", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); errorDial.set_title("Error !"); errorDial.run(); } } } }
void VistaCrearVideo::on_button_Descargar(){ std::stringstream ss; ss << m_FPSEntry.get_text().c_str(); double f=0.0; ss >> f; std::cerr << "FPS: " << f << std::endl; if (f<0.5) return this->ventanaError("Ingresa las FPS!\n\n\n--mayor o igual a 0.5--", "Error"); if (f>50) return this->ventanaError("Imposible tantos FPS!", "Error"); /*Abro el dialogo para elegir nombre de archivo, la extencion sera mp4*/ Gtk::FileChooserDialog dialog("Elige donde y con que nombre guardar el video", Gtk::FILE_CHOOSER_ACTION_SAVE); //Add response buttons the the dialog: dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); dialog.add_button("Select", Gtk::RESPONSE_OK); int result = dialog.run(); std::string nombre; //Handle the response: switch(result){ case(Gtk::RESPONSE_OK):{ std::cerr << "Select clicked." << std::endl; std::cerr << "Folder selected: " << dialog.get_filename() << std::endl; nombre = (dialog.get_filename().c_str()); nombre+=".mp4"; break; } case(Gtk::RESPONSE_CANCEL):{ std::cerr << "Cancel clicked." << std::endl; return; } default:{ std::cerr << "Unexpected button clicked." << std::endl; return; } } Gtk::TreeModel::Children children = m_refImagenesListStore->children(); Gtk::TreeModel::Children::iterator it; std::vector<std::string> rutaFrames; for(it=children.begin(); it != children.end(); ++it){ Gtk::TreeModel::Row row = *it; Glib::ustring s = row[m_ImagenesList.m_Columns.m_col_ruta]; std::string strin(s.c_str()); rutaFrames.push_back(strin); } common::Video::guardarAPartirDeImagenes(nombre,rutaFrames,f); }
Gtk::TreeModel::iterator MemberList::getListIter(Gtk::TreeModel:: Children children, const Glib::ustring & id) { /*查找好友列表项 */ return find_if(children.begin(), children.end(), bind2nd(CompareMember(columns), id)); }
std::string ListBoxImpl::get_string_value_from_index (ListBox *self, size_t index) { ListBoxImpl* sel= self->get_data<ListBoxImpl>(); Gtk::TreeModel::Children children = sel->_store->children(); std::string result; if (children.size() > index) children[index]->get_value<std::string>(0, result); return result; }
void ParentChooser::setID(int ID) { Gtk::TreeIter iter; Gtk::TreeModel::Children children = model->children(); iter = findRow(ID); if (iter != children.end()) { model->erase(iter); } }
/** * Select (highlight it) string from ComboBoxString if exist. * * @param str string to select from ComboBoxString. */ void select_string(const Glib::ustring& str) { Gtk::TreeModel::Children children = mListStore->children(); Gtk::TreeModel::Children::iterator it = children.begin(); while (it != children.end()) { Gtk::TreeModel::Row row = (*it); if (row and row[mColumn.mString] == str) { set_active(it); } ++it; } }
void VistaCrearVideo::actualizarFramesReproductor(){ Gtk::TreeModel::Children children = m_refImagenesListStore->children(); Gtk::TreeModel::Children::iterator it; std::vector< Gtk::Image* > frames; for(it=children.begin(); it != children.end(); ++it){ Gtk::TreeModel::Row row = *it; frames.push_back((row[m_ImagenesList.m_Columns.m_col_imgGrande])); } reproductor.setearFrames(frames); }
void MemberList::clearMember() { Gtk::TreeModel::Children children = refListStore->children(); Gtk::TreeModel::iterator iter = children.begin(); while ( iter != children.end()) { //Glib::ustring name = (*iter)[columns.name]; //std::cout<<"erase ============"<<name<<std::endl; iter = refListStore->erase(iter); } m_number = 0; }
void CheatListDialog::vOnCheatMarkAll() { Gtk::TreeModel::Children cListEntries = m_poCheatListStore->children(); for (Gtk::TreeModel::iterator iter = cListEntries.begin(); iter; iter++) { Gtk::TreeModel::Row row = *iter; row[m_oRecordModel.bEnabled] = bMark; vToggleCheat(row[m_oRecordModel.iIndex], row[m_oRecordModel.bEnabled]); } bMark = !bMark; }
void SimulOutSetsAdapterModelImpl::setSelectedSetName(std::string SetName) { Gtk::TreeModel::Children Children = mref_ListStore->children(); for (Gtk::TreeModel::Children::iterator it = Children.begin(); it != Children.end(); ++it) { if (it->get_value(m_Columns.m_Name) == SetName) { m_SelectedRowRef = mref_ListStore->createRowRefFromIter(it); return; } } }
void ConfigurationDialog::on_remove_button_clicked() { Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeView.get_selection(); Gtk::TreeModel::iterator it = refTreeSelection->get_selected(); if(!it) return; m_toolkit->removeSynapseDefinition((*it)[m_indexColumn]); m_refTreeModel2->erase(it); Gtk::TreeModel::Children rows = m_refTreeModel2->children(); m_scIndex = 0; for(Gtk::TreeModel::Children::iterator jt = rows.begin(); jt != rows.end(); jt++){ (*jt)[m_indexColumn] = m_scIndex; m_scIndex++; } }
// // 全ての有効な項目を文字列で取得 // std::string SelectItemPref::get_items() { std::string items; const Gtk::TreeModel::Children children = m_store_shown->children(); Gtk::TreeModel::iterator it = children.begin(); while( it != children.end() ) { Gtk::TreeModel::Row row = *it; items.append( row[ m_columns_shown.m_column_text ] + " " ); ++it; } return items; }
void EntityChooser::importFromString(const std::string& str) { Gtk::TreeModel::Children children = _entityStore->children(); for (Gtk::TreeModel::Children::iterator i = children.begin(); i != children.end(); ++i) { Gtk::TreeModel::Row row = *i; if (row[_listColumns.name] == str) { _selection->select(i); break; } } }
Gtk::TreeModel::iterator ParentChooser::findRow(int id) { Gtk::TreeIter iter; Gtk::TreeModel::Children children = model->children(); for (iter = children.begin(); iter != children.end(); iter++) { Gtk::TreeModel::Row row = *iter; if (row[Columns.col_id] == id) { break; } } return iter; }
//------------------------------------------------------------------------------ void ListBoxImpl::set_index(::mforms::ListBox *self, ssize_t index) { ListBoxImpl* sel= self->get_data<ListBoxImpl>(); if ( sel ) { Glib::RefPtr<Gtk::TreeView::Selection> selection = sel->_lbox.get_selection(); Gtk::TreeModel::Children children = sel->_store->children(); if ( children.size() > (unsigned int)index && index >= 0 ) { Gtk::TreeModel::Row row = children[index]; if ( row ) selection->select(row); } } }
void setup_model(){ { //treeview treemodel = Gtk::ListStore::create(columns); treeview1->set_model(treemodel); treeview1->append_column("Filename", columns.Filename); treeview1->append_column("Url", columns.url); treeview1->append_column("Size", columns.size); treeview1->append_column("%", columns.percentage_complete); treeview1->append_column("Time Left", columns.time_left); treeview1->append_column("Action", columns.action); //make all columns resizeable and set width std::vector<Gtk::TreeViewColumn*> tv_columns = treeview1->get_columns(); std::vector<Gtk::TreeViewColumn*>::iterator iter = tv_columns.begin(); int count = 0; for (; iter!=tv_columns.end(); iter++, count++){ Gtk::TreeViewColumn* col = *iter; col->set_resizable(true); col->set_fixed_width(column_widths[count]); } Gtk::TreeModel::Row row = *(treemodel->append()); row[columns.Filename] = "33"; row[columns.url] = "SFDSD"; Gtk::TreeModel::Children children = treemodel->children(); for(Gtk::TreeModel::Children::iterator iter = children.begin(); iter != children.end(); ++iter){ Gtk::TreeModel::Row row = *iter; row->set_value(0, (Glib::ustring)"asdfaksdhfakshdfklasjdfhklsafdhlaskjdhflksajdhfasdfads"); row->set_value(4, (Glib::ustring)"asdfads"); } } { comboboxmodel = Gtk::ListStore::create(combo_columns); combobox_size->set_model(comboboxmodel); Gtk::TreeModel::Row row = *(comboboxmodel->append()); combobox_size->set_id_column(0); Gtk::CellRendererText *cell = new Gtk::CellRendererText(); combobox_size->pack_start(*cell); combobox_size->add_attribute(*cell, "text", combo_columns.size); row[combo_columns.size] = "kB"; (*(comboboxmodel->append()))[combo_columns.size] = "MB"; combobox_size->set_active(0); } }
void ParentChooser::setParentID(int parentID) { if (parentID >= 0) { this->parentID = parentID; } else { this->parentID = 0; } Gtk::TreeIter iter; Gtk::TreeModel::Children children = model->children(); iter = findRow(parentID); if (iter != children.end()) { set_active(iter); } }
// // 非表示項目から指定した項目を削除 // void SelectItemPref::erase_hidden( const std::string& name ) { if( name == ITEM_NAME_SEPARATOR ) return; const Gtk::TreeModel::Children children = m_store_hidden->children(); Gtk::TreeModel::iterator it = children.begin(); while( it != children.end() ) { Gtk::TreeModel::Row row = *it; if( row[ m_columns_hidden.m_column_text ] == name ) { m_store_hidden->erase( *it ); break; } ++it; } }
/// @fn void LibraryView::loadImagesByTags() /// @brief Method (signal handler) responsible for updating thumbnails in right panel. /// Called when tag from tags list is selected. /// @param path Path to selected row, provided by signal system. /// @param column Clicked column, provided by signal system, not used. void LibraryView::loadImagesByTags() { Gtk::TreeModel::Children children = tags_list->children(); Gtk::TreeModel::Children::iterator iter = children.begin(); Gtk::TreeModel::Row row; std::set<std::string> selected_tags; //looking for selected tags for(; iter != children.end(); ++iter) { row = *iter; if((*row)[tags_columns.selected]) selected_tags.insert((std::string)(*row)[tags_columns.name]); } //loading photos if(!selected_tags.empty()) { core->setCurrentTagSet(selected_tags); //window->showEditView(); } }
VistaCrearVideo::~VistaCrearVideo() { reproductor.matar(); pthread_cond_broadcast(&cond); //para que salga del bloqueo std::cerr << "JOINEO REPRODUCTOR\n"; reproductor.join(); std::cerr << "REPRODUCTOR JOINEADO\n"; pthread_cond_destroy(&cond); Gtk::TreeModel::Children children = m_refImagenesListStore->children(); Gtk::TreeModel::Children::iterator it; /*Libero las imagenes*/ for(it=children.begin(); it != children.end(); ++it){ Gtk::TreeModel::Row row = *it; if (row[m_ImagenesList.m_Columns.m_col_imgGrande]) delete row[m_ImagenesList.m_Columns.m_col_imgGrande]; } }
// // Gtk::TreeModel::Children からノードツリーを生成 // // ただし列は SKELETON::EditColumns を継承したものであること // void Dom::parse( const Gtk::TreeModel::Children& children, SKELETON::EditColumns& columns ) { if( ! this || children.empty() ) return; // Gtk::TreeModel::Children を走査 Gtk::TreeModel::iterator it = children.begin(); while( it != children.end() ) { Gtk::TreeModel::Row row = *it; // 各値を取得( skeleton/editcolumns.h を参照 ) const int type = row[ columns.m_type ]; const Glib::ustring url = row[ columns.m_url ]; const Glib::ustring data = row[ columns.m_data ]; const Glib::ustring name = row[ columns.m_name ]; const size_t dirid = row[ columns.m_dirid ]; const bool expand = row[ columns.m_expand ]; if( type != TYPE_UNKNOWN ) { // タイプにより要素名を決定( board や link など) const std::string node_name = XML::get_name( type ); if( ! node_name.empty() ) { Dom* node = appendChild( NODE_TYPE_ELEMENT, node_name ); if( type == TYPE_DIR && expand ) node->setAttribute( "open", "y" ); if( ! name.empty() ) node->setAttribute( "name", name ); if( ! url.empty() ) node->setAttribute( "url", url ); if( ! data.empty() ) node->setAttribute( "data", data ); if( dirid ) node->setAttribute( "dirid", dirid ); // 再帰 if( ! row.children().empty() ) node->parse( row.children(), columns ); } } ++it; } }
/* * vim: softtabstop=4 shiftwidth=4 cindent foldmethod=marker expandtab * * $LastChangedDate$ * $Revision$ * $LastChangedBy$ * $URL$ * * Copyright 2009-2011 Eric Connell * * This file is part of Mangler. * * Mangler is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Mangler is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Mangler. If not, see <http://www.gnu.org/licenses/>. */ #include "mangler.h" #include "manglerrecorder.h" #include "mangleraudio.h" #include "manglercharset.h" #include <unistd.h> #include <sys/stat.h> #include <dirent.h> ManglerRecorder::ManglerRecorder(Glib::RefPtr<Gtk::Builder> builder) {/*{{{*/ this->builder = builder; builder->get_widget("recWindow", recWindow); builder->get_widget("recHide", menuitem); menuitem->signal_activate().connect(sigc::mem_fun(this, &ManglerRecorder::hide_activate_cb)); builder->get_widget("recOpen", menuitem); menuitem->signal_activate().connect(sigc::mem_fun(this, &ManglerRecorder::open_activate_cb)); builder->get_widget("recClose", menuitem); menuitem->signal_activate().connect(sigc::mem_fun(this, &ManglerRecorder::close_activate_cb)); builder->get_widget("recSaveAs", menuitem); menuitem->signal_activate().connect(sigc::mem_fun(this, &ManglerRecorder::saveas_activate_cb)); builder->get_widget("recDelete", menuitem); menuitem->signal_activate().connect(sigc::mem_fun(this, &ManglerRecorder::delete_activate_cb)); builder->get_widget("recPlayPause", button); button->signal_clicked().connect(sigc::mem_fun(this, &ManglerRecorder::playpause_clicked_cb)); builder->get_widget("recStop", button); button->signal_clicked().connect(sigc::mem_fun(this, &ManglerRecorder::stop_clicked_cb)); builder->get_widget("recRecord", recordbutton); recordbutton->signal_toggled().connect(sigc::mem_fun(this, &ManglerRecorder::record_toggled_cb)); builder->get_widget("recInfo", button); button->signal_clicked().connect(sigc::mem_fun(this, &ManglerRecorder::info_clicked_cb)); builder->get_widget("recOpenEntry", fileentry); builder->get_widget("recOpenButton", button); button->signal_clicked().connect(sigc::mem_fun(this, &ManglerRecorder::open_activate_cb)); filedialog = new Gtk::FileChooserDialog("Open Recording", Gtk::FILE_CHOOSER_ACTION_OPEN); filedialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); filedialog->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); Gtk::FileFilter vrf_filter; vrf_filter.set_name("Ventrilo Recording File (*.vrf)"); vrf_filter.add_pattern("*.vrf"); filedialog->add_filter(vrf_filter); Gtk::FileFilter all_filter; all_filter.set_name("All Files"); all_filter.add_pattern("*"); filedialog->add_filter(all_filter); builder->get_widget("recScrolledWindow", recScrolledWindow); recListModel = Gtk::ListStore::create(recRecord); builder->get_widget("recListTree", recListTree); recListTree->set_model(recListModel); recListTree->append_column("Time", recRecord.time); recListTree->append_column("Duration", recRecord.duration); recListTree->append_column("Status", recRecord.status); recListTree->append_column("Username", recRecord.username); recListTree->append_column("", recRecord.text); recListTree->signal_cursor_changed().connect(sigc::mem_fun(this, &ManglerRecorder::recListTree_cursor_changed_cb)); recListTree->signal_row_activated().connect(sigc::mem_fun(this, &ManglerRecorder::recListTree_row_activated_cb)); builder->get_widget("recInfoDialog", recInfoDialog); builder->get_widget("recInfoCancel", button); button->signal_clicked().connect(sigc::mem_fun(this, &ManglerRecorder::recInfoDialog_cancel_clicked_cb)); builder->get_widget("recInfoSave", button); button->signal_clicked().connect(sigc::mem_fun(this, &ManglerRecorder::recInfoDialog_save_clicked_cb)); recdir = ManglerConfig::confdir() + "/recordings"; DIR *testdir; if ((testdir = opendir(recdir.c_str()))) { closedir(testdir); } else { mkdir(recdir.c_str(), 0700); } filedialog->set_current_folder(recdir); isPlaying = false; isRecording = false; vrfh = NULL; player = NULL; }/*}}}*/ ManglerRecorder::~ManglerRecorder() {/*{{{*/ reset(true); delete filedialog; }/*}}}*/ void ManglerRecorder::show(void) {/*{{{*/ recWindow->present(); }/*}}}*/ void ManglerRecorder::hide_activate_cb(void) {/*{{{*/ recWindow->hide(); }/*}}}*/ void ManglerRecorder::open_activate_cb(void) {/*{{{*/ int result = filedialog->run(); filedialog->hide(); if (result == Gtk::RESPONSE_OK) { path = filedialog->get_current_folder(); filename = filedialog->get_filename(); set(false); } }/*}}}*/ void ManglerRecorder::close_activate_cb(void) {/*{{{*/ reset(); }/*}}}*/ void ManglerRecorder::saveas_activate_cb(void) {/*{{{*/ }/*}}}*/ void ManglerRecorder::delete_activate_cb(void) {/*{{{*/ if (!vrfh || filename.empty()) { return; } Gtk::MessageDialog confirm("<b>Are you sure you want to delete \"" + fileentry->get_text() + "\"?</b>", true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_YES_NO, true); if (confirm.run() == Gtk::RESPONSE_YES) { reset(); unlink(filename.c_str()); } }/*}}}*/ void ManglerRecorder::playpause_clicked_cb(void) {/*{{{*/ if (!vrfh) { return; } isPlaying = true; player = Glib::Thread::create(sigc::mem_fun(*this, &ManglerRecorder::play), false); }/*}}}*/ void ManglerRecorder::stop_clicked_cb(void) {/*{{{*/ player = NULL; }/*}}}*/ void ManglerRecorder::record_toggled_cb(void) {/*{{{*/ if (recordbutton->get_active()) { path = recdir; filename = path + "/" + timestamp() + ".vrf"; set(true); } else { set(false); } }/*}}}*/ void ManglerRecorder::info_clicked_cb(void) {/*{{{*/ if (!vrfh) { return; } v3_vrf_data vrfd; if (v3_vrf_get_info(vrfh, &vrfd) != V3_OK) { mangler->errorDialog(c_to_ustring(_v3_error(NULL))); return; } builder->get_widget("recInfoByEntry", entry); entry->set_text(c_to_ustring(vrfd.username)); builder->get_widget("recInfoComment", textview); textview->get_buffer()->set_text(c_to_ustring(vrfd.comment)); builder->get_widget("recInfoURL", textview); textview->get_buffer()->set_text(c_to_ustring(vrfd.url)); builder->get_widget("recInfoCopyright", textview); textview->get_buffer()->set_text(c_to_ustring(vrfd.copyright)); recInfoDialog->set_icon(mangler->icons["tray_icon"]); recInfoDialog->present(); }/*}}}*/ void ManglerRecorder::recListTree_cursor_changed_cb(void) {/*{{{*/ if (!vrfh) { return; } builder->get_widget("recPlayPause", widget); widget->set_sensitive(recListTree->get_selection()->get_selected()); }/*}}}*/ void ManglerRecorder::recListTree_row_activated_cb(const Gtk::TreeModel::Path& path, Gtk::TreeViewColumn* column) {/*{{{*/ if (!vrfh) { return; } isPlaying = false; player = Glib::Thread::create(sigc::mem_fun(*this, &ManglerRecorder::play), false); }/*}}}*/ void ManglerRecorder::set(bool isRecording) {/*{{{*/ reset(); if (isRecording) { if (v3_vrf_record_start(filename.c_str()) != V3_OK) { mangler->errorDialog(c_to_ustring(_v3_error(NULL))); recordbutton->set_active(false); return; } this->isRecording = true; } else { this->isRecording = false; if (!(vrfh = v3_vrf_init(filename.c_str()))) { mangler->errorDialog(c_to_ustring(_v3_error(NULL))); return; } v3_vrf_data vrfd; if (v3_vrf_get_info(vrfh, &vrfd) != V3_OK) { reset(); mangler->errorDialog(c_to_ustring(_v3_error(NULL))); return; } builder->get_widget("recSize", label); label->set_text(bytes_to_readable(vrfd.size)); builder->get_widget("recCount", label); label->set_text(float_to_ustring(v3_vrf_get_count(vrfh), 0)); builder->get_widget("recPlatform", label); label->set_text(c_to_ustring(vrfd.platform)); builder->get_widget("recVersion", label); label->set_text(c_to_ustring(vrfd.version)); builder->get_widget("recCodec", label); label->set_text(c_to_ustring(v3_get_codec(vrfd.codec, vrfd.codecformat)->name)); totalduration = 0; for (uint32_t ctr = 0, cnt = v3_vrf_get_count(vrfh); ctr < cnt; ctr++) { if (v3_vrf_get_segment(vrfh, ctr, &vrfd) != V3_OK) { reset(); mangler->errorDialog(c_to_ustring(_v3_error(NULL))); return; } Gtk::TreeModel::Row row = *(recListModel->append()); row[recRecord.id] = ctr; row[recRecord.time_val] = vrfd.time; row[recRecord.duration_val] = vrfd.duration; row[recRecord.time] = msec_to_timestamp(vrfd.time); row[recRecord.duration] = float_to_ustring(vrfd.duration / 1000.0, 2); row[recRecord.status] = ""; row[recRecord.username] = c_to_ustring(vrfd.username); row[recRecord.text] = ""; totalduration += vrfd.duration; } builder->get_widget("recDuration", label); label->set_text(float_to_ustring(totalduration / 60000.0, 1) + " min"); builder->get_widget("recInfo", widget); widget->set_sensitive(true); } fileentry->set_text(filename.substr(path.length() + 1)); builder->get_widget("recType", label); label->set_text("VRF"); recListTree->set_sensitive(true); builder->get_widget("recClose", widget); widget->set_sensitive(true); builder->get_widget("recDelete", widget); widget->set_sensitive(true); builder->get_widget("recInfos", widget); widget->set_sensitive(true); recScrolledWindow->get_vadjustment()->set_value(0); if (recListModel->children().size()) { recListTree->set_cursor(recListModel->get_path(recListModel->children().begin())); builder->get_widget("recPlayPause", widget); widget->grab_focus(); } }/*}}}*/ void ManglerRecorder::reset(bool destroying) {/*{{{*/ player = (Glib::Thread*)destroying; isPlaying = false; if (isRecording) { v3_vrf_record_stop(); recordbutton->set_active(false); } isRecording = false; if (vrfh) { v3_vrf_destroy(vrfh); vrfh = NULL; } recListModel->clear(); if (destroying) { return; } for (int ctr = 0, cnt = recListTree->get_columns().size(); ctr < cnt; ctr++) { recListTree->get_column(ctr)->queue_resize(); } recListTree->set_sensitive(false); fileentry->set_text(""); builder->get_widget("recType", label); label->set_text("N/A"); builder->get_widget("recSize", label); label->set_text("N/A"); builder->get_widget("recCount", label); label->set_text("N/A"); builder->get_widget("recDuration", label); label->set_text("N/A"); builder->get_widget("recPlatform", label); label->set_text("N/A"); builder->get_widget("recVersion", label); label->set_text("N/A"); builder->get_widget("recCodec", label); label->set_text("N/A"); builder->get_widget("recClose", widget); widget->set_sensitive(false); builder->get_widget("recDelete", widget); widget->set_sensitive(false); builder->get_widget("recInfos", widget); widget->set_sensitive(false); builder->get_widget("recPlayPause", widget); widget->set_sensitive(false); builder->get_widget("recInfo", widget); widget->set_sensitive(false); builder->get_widget("recInfoByEntry", entry); entry->set_text(""); builder->get_widget("recInfoComment", textview); textview->get_buffer()->set_text(""); builder->get_widget("recInfoURL", textview); textview->get_buffer()->set_text(""); builder->get_widget("recInfoCopyright", textview); textview->get_buffer()->set_text(""); recInfoDialog->hide(); }/*}}}*/ void ManglerRecorder::can_record(bool isConnected) {/*{{{*/ if (!isConnected && isRecording) { set(false); } recordbutton->set_sensitive(isConnected); }/*}}}*/ void ManglerRecorder::record(Glib::ustring username, Glib::ustring text, uint32_t index, uint32_t time, bool stopped, bool flushed) {/*{{{*/ if (!isRecording) { return; } Gtk::TreeModel::Children children = recListModel->children(); Gtk::TreeModel::Row row; if (!flushed && !children[index]) { row = *(recListModel->append()); row[recRecord.id] = index; row[recRecord.time_val] = time; row[recRecord.duration_val] = 0; row[recRecord.diff_val] = 0; row[recRecord.time] = msec_to_timestamp(time); row[recRecord.duration] = float_to_ustring(0, 2); row[recRecord.status] = "Rec"; row[recRecord.username] = username; row[recRecord.text] = (text.length()) ? text : ""; builder->get_widget("recCount", label); label->set_text(float_to_ustring(children.size(), 0)); recListTree->set_cursor(recListModel->get_path(row)); } if (flushed) { for (Gtk::TreeModel::iterator iter = children.begin(); iter != children.end(); iter++) { (*iter)[recRecord.status] = "*"; } return; } row = children[index]; if (stopped) { row[recRecord.status] = "*"; } else { row[recRecord.duration_val] = time - row[recRecord.time_val]; } if (stopped || row[recRecord.diff_val] + 100 < row[recRecord.duration_val]) { row[recRecord.diff_val] = time - row[recRecord.time_val]; row[recRecord.duration] = float_to_ustring(row[recRecord.duration_val] / 1000.0, 2); } }/*}}}*/
void PredicateDialog::onDeletePredicate() { Glib::RefPtr < Gtk::TreeView::Selection > ref = mTreePredicateList-> get_selection(); if (ref) { Gtk::TreeModel::iterator iter = ref->get_selected(); if (iter) { if (Question(_("Are you sure you want to delete this predicate?"))) { mPredicateNameEntry->set_text(""); mTextViewFunction->get_buffer()->set_text(""); mHeaderPred->set_text(""); Gtk::TreeModel::Row row = *iter; std::string name(row.get_value(m_viewscolumnrecord.name)); m_model->erase(iter); Gtk::TreeModel::Children children = m_model->children(); m_iter = children.begin(); // Delete the element in the vector for (std::vector < std::string > ::iterator it = mPredicateName.begin(); it != mPredicateName.end(); ) { if ( *it == name ) { it = mPredicateName.erase(it); } else { ++it; } } if (mPredicateFunction.find(name) != mPredicateFunction.end()) { mPredicateFunction.erase(name); } setSensitivePredicate(false); } } } }
// // 下へ移動 // void SelectItemPref::slot_down() { Gtk::TreeModel::Children children = m_store_shown->children(); if( children.empty() ) return; // 下限のイテレータ Gtk::TreeIter bottom_it = --children.end(); std::list< Gtk::TreePath > selection_path = m_tree_shown.get_selection()->get_selected_rows(); std::list< Gtk::TreePath >::reverse_iterator it = selection_path.rbegin(); while( it != selection_path.rend() ) { Gtk::TreePath src = *it; Gtk::TreeIter src_it = m_store_shown->get_iter( src ); // 限度位置に達していなければ入れ替え if( src_it != bottom_it ) { Gtk::TreePath dst( src ); dst.next(); Gtk::TreeIter dst_it = m_store_shown->get_iter( dst ); if( dst_it ) { m_store_shown->iter_swap( src_it, dst_it ); } } // 下限に達していたら次の限度位置を上げる else if( bottom_it != children.begin() ) --bottom_it; ++it; } // フォーカスを移す set_focus( m_tree_shown ); }
//------------------------------------------------------------------------------ void QueryOutputView::refresh() { const int mode = _mode.get_active_row_number(); switch (mode) { case 2: // History output { const Glib::RefPtr<Gtk::TreeModel> entry_model = _entries_grid.get_model(); const Gtk::TreeModel::Children children = entry_model->children(); const int size = children.size(); if (size > 0) { const Gtk::TreeIter iter = (--children.end()); const Gtk::TreePath path = entry_model->get_path(iter); _entries_grid.set_cursor(path); } _details_grid.scroll_to(1); } case 0: // Action Output - always need refresh even if it's not visible case 1: //Text output { _action_output.refresh(false); const int log_row_count = _action_output.row_count(); if (log_row_count > 0) { Gtk::TreePath path; path.push_back(log_row_count-1); _action_output.scroll_to_row(path); _action_output.set_cursor(path); } break; } } }
// // 上へ移動 // void SelectItemPref::slot_up() { Gtk::TreeModel::Children children = m_store_shown->children(); if( children.empty() ) return; // 上限のイテレータ Gtk::TreeIter upper_it = children.begin(); std::list< Gtk::TreePath > selection_path = m_tree_shown.get_selection()->get_selected_rows(); std::list< Gtk::TreePath >::iterator it = selection_path.begin(); while( it != selection_path.end() ) { Gtk::TreePath src = *it; Gtk::TreeIter src_it = m_store_shown->get_iter( src ); // 限度位置に達していなければ入れ替え if( src_it != upper_it ) { Gtk::TreePath dst( src ); if( dst.prev() ) { Gtk::TreeIter dst_it = m_store_shown->get_iter( dst ); m_store_shown->iter_swap( src_it, dst_it ); } } // 上限に達していたら次の限度位置を下げる else if( upper_it != children.end() ) ++upper_it; ++it; } // フォーカスを移す set_focus( m_tree_shown ); }