[glom] C++11: More use of auto.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] C++11: More use of auto.
- Date: Thu, 2 Jul 2015 15:24:59 +0000 (UTC)
commit 601fd228c43ff8660487d930446416e4b6ebaf07
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jul 2 17:24:32 2015 +0200
C++11: More use of auto.
glom/base_db.cc | 2 +-
glom/base_db_table_data.cc | 2 +-
glom/box_reports.cc | 2 +-
glom/dialog_existing_or_new.cc | 18 +++---
glom/frame_glom.cc | 4 +-
glom/import_csv/dialog_import_csv.cc | 24 +++---
glom/libglom/db_utils.cc | 4 +-
glom/libglom/document/bakery/view/view_composite.h | 2 +-
glom/libglom/document/document.cc | 14 ++--
glom/libglom/privs.cc | 4 +-
glom/libglom/python_embed/py_glom_related.cc | 2 +-
glom/mode_data/box_data_list.cc | 14 ++--
glom/mode_data/datawidget/combo.cc | 4 +-
.../mode_data/datawidget/combo_as_radio_buttons.cc | 2 +-
.../datawidget/combochoiceswithtreemodel.cc | 4 +-
glom/mode_data/datawidget/treemodel_db.cc | 2 +-
glom/mode_data/db_adddel/db_adddel.cc | 30 ++++----
glom/mode_data/flowtablewithfields.cc | 71 ++++++++-----------
glom/mode_design/box_db_table_relationships.cc | 8 +-
glom/mode_design/comboentry_currency.cc | 2 +-
glom/mode_design/dialog_database_preferences.cc | 4 +-
glom/mode_design/fields/box_db_table_definition.cc | 10 ++--
glom/mode_design/fields/combo_fieldtype.cc | 4 +-
glom/mode_design/iso_codes.cc | 4 +-
glom/mode_design/layout/combobox_fields.cc | 10 ++--
glom/mode_design/layout/combobox_relationship.cc | 18 +++---
glom/mode_design/layout/dialog_choose_field.cc | 14 ++--
.../layout/dialog_choose_relationship.cc | 4 +-
glom/mode_design/layout/dialog_layout.cc | 8 +-
.../layout/dialog_layout_calendar_related.cc | 6 +-
glom/mode_design/layout/dialog_layout_details.cc | 73 +++++++++-----------
glom/mode_design/layout/dialog_layout_export.cc | 12 ++--
.../layout/dialog_layout_list_related.cc | 6 +-
.../layout/layout_item_dialogs/box_formatting.cc | 6 +-
.../layout_item_dialogs/combo_summarytype.cc | 4 +-
.../layout_item_dialogs/comboentry_borderwidth.cc | 2 +-
.../layout_item_dialogs/dialog_fieldslist.cc | 16 ++--
.../layout/layout_item_dialogs/dialog_notebook.cc | 10 ++--
.../layout_item_dialogs/dialog_sortfields.cc | 12 ++--
.../mode_design/print_layouts/box_print_layouts.cc | 2 +-
.../print_layouts/window_print_layout_edit.cc | 54 +++++----------
.../window_relationships_overview.cc | 4 +-
.../report_layout/dialog_layout_report.cc | 56 ++++++++--------
.../report_layout/treestore_report_layout.cc | 2 +-
glom/mode_design/translation/combobox_locale.cc | 4 +-
.../mode_design/translation/window_translations.cc | 2 +-
glom/mode_design/users/dialog_groups_list.cc | 22 +++---
glom/mode_design/users/dialog_users_list.cc | 10 ++--
glom/navigation/box_tables.cc | 6 +-
glom/utility_widgets/adddel/adddel.cc | 53 +++++++--------
glom/utility_widgets/adddel/adddel_withbuttons.cc | 4 +-
glom/utility_widgets/combo_textglade.cc | 2 +-
glom/utility_widgets/flowtable.cc | 2 +-
glom/utility_widgets/imageglom.cc | 4 +-
glom/variablesmap.cc | 10 ++--
55 files changed, 317 insertions(+), 358 deletions(-)
---
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 36f40fc..5319239 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -821,7 +821,7 @@ void Base_DB::calculate_field(const LayoutFieldInRecord& field_in_record)
//std::cerr << G_STRFUNC << ": field_name=" << field_name << std::endl;
//Do we already have this in our list?
- type_field_calcs::iterator iterFind = m_FieldsCalculationInProgress.find(field_name);
+ auto iterFind = m_FieldsCalculationInProgress.find(field_name);
if(iterFind == m_FieldsCalculationInProgress.end()) //If it was not found.
{
//Add it:
diff --git a/glom/base_db_table_data.cc b/glom/base_db_table_data.cc
index e1d2df8..66699f8 100644
--- a/glom/base_db_table_data.cc
+++ b/glom/base_db_table_data.cc
@@ -199,7 +199,7 @@ bool Base_DB_Table_Data::record_new(bool use_entered_data, const Gnome::Gda::Val
std::cerr << G_STRFUNC << ": INSERT failed." << std::endl;
else
{
- Gtk::TreeModel::iterator row = get_row_selected(); //Null and ignored for details views.
+ auto row = get_row_selected(); //Null and ignored for details views.
set_primary_key_value(row, primary_key_value); //Needed by Box_Data_List::on_adddel_user_changed().
//Update any lookups, related fields, or calculations:
diff --git a/glom/box_reports.cc b/glom/box_reports.cc
index 6c20ca4..d9863e6 100644
--- a/glom/box_reports.cc
+++ b/glom/box_reports.cc
@@ -109,7 +109,7 @@ bool Box_Reports::fill_from_database()
std::shared_ptr<Report> report = document->get_report(m_table_name, item);
if(report)
{
- Gtk::TreeModel::iterator row = m_AddDel.add_item(report->get_name());
+ auto row = m_AddDel.add_item(report->get_name());
fill_row(row, report);
}
}
diff --git a/glom/dialog_existing_or_new.cc b/glom/dialog_existing_or_new.cc
index 4ef3a83..c95996e 100644
--- a/glom/dialog_existing_or_new.cc
+++ b/glom/dialog_existing_or_new.cc
@@ -174,7 +174,7 @@ Dialog_ExistingOrNew::Dialog_ExistingOrNew(BaseObjectType* cobject, const Glib::
{
if(info->get_mime_type() == "application/x-glom")
{
- Gtk::TreeModel::iterator iter = m_existing_model->append(m_iter_existing_recent->children());
+ auto iter = m_existing_model->append(m_iter_existing_recent->children());
(*iter)[m_existing_columns.m_col_title] = info->get_display_name();
(*iter)[m_existing_columns.m_col_time] = info->get_modified();
(*iter)[m_existing_columns.m_col_recent_info] = info;
@@ -310,7 +310,7 @@ Dialog_ExistingOrNew::~Dialog_ExistingOrNew()
bool Dialog_ExistingOrNew::on_existing_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const
Gtk::TreeModel::Path& path, bool /* path_currently_selected */)
{
- Gtk::TreeModel::iterator iter = model->get_iter(path);
+ auto iter = model->get_iter(path);
#ifndef G_OS_WIN32
if(iter == m_iter_existing_network)
return false; /* Do not allow parent nodes to be selected. */
@@ -324,7 +324,7 @@ bool Dialog_ExistingOrNew::on_existing_select_func(const Glib::RefPtr<Gtk::TreeM
#ifndef GLOM_ENABLE_CLIENT_ONLY
bool Dialog_ExistingOrNew::on_new_select_func(const Glib::RefPtr<Gtk::TreeModel>& model, const
Gtk::TreeModel::Path& path, bool /* path_currently_selected */)
{
- Gtk::TreeModel::iterator iter = model->get_iter(path);
+ auto iter = model->get_iter(path);
if(iter == m_iter_new_template)
return false; /* Do not allow parent nodes to be selected. */
else
@@ -434,7 +434,7 @@ Glib::ustring Dialog_ExistingOrNew::get_service_name() const
std::shared_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_existing(const
Gtk::TreeModel::iterator& parent, const Glib::ustring& text)
{
- Gtk::TreeModel::iterator iter = m_existing_model->append(parent->children());
+ auto iter = m_existing_model->append(parent->children());
(*iter)[m_existing_columns.m_col_title] = text;
return std::shared_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
}
@@ -442,7 +442,7 @@ std::shared_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_ite
#ifndef GLOM_ENABLE_CLIENT_ONLY
std::shared_ptr<Gtk::TreeModel::iterator> Dialog_ExistingOrNew::create_dummy_item_new(const
Gtk::TreeModel::iterator& parent, const Glib::ustring& text)
{
- Gtk::TreeModel::iterator iter = m_new_model->append(parent->children());
+ auto iter = m_new_model->append(parent->children());
(*iter)[m_new_columns.m_col_title] = text;
return std::shared_ptr<Gtk::TreeModel::iterator>(new Gtk::TreeModel::iterator(iter));
}
@@ -603,7 +603,7 @@ void Dialog_ExistingOrNew::update_ui_sensitivity()
}
else
{
- Gtk::TreeModel::iterator sel = m_existing_view->get_selection()->get_selected();
+ auto sel = m_existing_view->get_selection()->get_selected();
sensitivity = (sel != m_iter_existing_recent);
#ifndef G_OS_WIN32
sensitivity = sensitivity && (sel != m_iter_existing_network);
@@ -626,7 +626,7 @@ void Dialog_ExistingOrNew::update_ui_sensitivity()
}
else
{
- Gtk::TreeModel::iterator sel = m_new_view->get_selection()->get_selected();
+ auto sel = m_new_view->get_selection()->get_selected();
sensitivity = (sel != m_iter_new_template &&
(!m_iter_new_template_dummy.get() || sel != *m_iter_new_template_dummy));
}
@@ -683,7 +683,7 @@ void Dialog_ExistingOrNew::append_example(const Glib::ustring& title, const std:
const auto is_first_item = m_iter_new_template_dummy.get();
// Add to list.
- Gtk::TreeModel::iterator iter = m_new_model->append(m_iter_new_template->children());
+ auto iter = m_new_model->append(m_iter_new_template->children());
(*iter)[m_new_columns.m_col_title] = title;
(*iter)[m_new_columns.m_col_template_uri] = "resource://" + resource_name; //GFile understands this for
actual files, though not directories.
@@ -718,7 +718,7 @@ void Dialog_ExistingOrNew::on_service_found(const Glib::ustring& name, EpcServic
{
//Translator hint: This is <Service Name> on <Host> (via Network Interface such as eth0).
gchar* title = g_strdup_printf(_("%s on %s (via %s)"), name.c_str(), epc_service_info_get_host(info),
epc_service_info_get_interface(info));
- Gtk::TreeModel::iterator iter = m_existing_model->prepend(m_iter_existing_network->children());
+ auto iter = m_existing_model->prepend(m_iter_existing_network->children());
(*iter)[m_existing_columns.m_col_title] = title;
(*iter)[m_existing_columns.m_col_time] = std::time(0); /* sort more recently discovered items above */
(*iter)[m_existing_columns.m_col_service_name] = name;
diff --git a/glom/frame_glom.cc b/glom/frame_glom.cc
index 046f9ce..d626569 100644
--- a/glom/frame_glom.cc
+++ b/glom/frame_glom.cc
@@ -1447,7 +1447,7 @@ void Frame_Glom::update_table_in_document_from_database()
if(field_database)
{
//Is the field already in the document?
- type_vec_fields::iterator iterFindDoc = std::find_if( fieldsDocument.begin(), fieldsDocument.end(),
predicate_FieldHasName<Field>( field_database->get_name() ) );
+ auto iterFindDoc = std::find_if( fieldsDocument.begin(), fieldsDocument.end(),
predicate_FieldHasName<Field>( field_database->get_name() ) );
if(iterFindDoc == fieldsDocument.end()) //If it was not found:
{
//Add it
@@ -1492,7 +1492,7 @@ void Frame_Glom::update_table_in_document_from_database()
for(const auto& field : fieldsDocument)
{
//Check whether it's in the database:
- type_vec_fields::iterator iterFindDatabase = std::find_if( fieldsDatabase.begin(),
fieldsDatabase.end(), predicate_FieldHasName<Field>( field->get_name() ) );
+ auto iterFindDatabase = std::find_if( fieldsDatabase.begin(), fieldsDatabase.end(),
predicate_FieldHasName<Field>( field->get_name() ) );
if(iterFindDatabase != fieldsDatabase.end()) //If it was found
{
fieldsActual.push_back(field);
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index e8a5750..4dd415c 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -97,7 +97,7 @@ Dialog_Import_CSV::Dialog_Import_CSV(BaseObjectType* cobject, const Glib::RefPtr
//Fill the list of encodings:
m_encoding_model = Gtk::ListStore::create(m_encoding_columns);
- Gtk::TreeModel::iterator iter = m_encoding_model->append();
+ auto iter = m_encoding_model->append();
(*iter)[m_encoding_columns.m_col_name] = _("Auto Detect");
// Separator:
@@ -196,7 +196,7 @@ void Dialog_Import_CSV::import(const Glib::ustring& uri, const Glib::ustring& in
m_target_table->set_markup("<b>" + Glib::Markup::escape_text(into_table) + "</b>");
m_field_model = Gtk::ListStore::create(m_field_columns);
- Gtk::TreeModel::iterator tree_iter = m_field_model->append();
+ auto tree_iter = m_field_model->append();
(*tree_iter)[m_field_columns.m_col_field_name] = _("<None>");
const Document::type_vec_fields fields(document->get_table_fields(into_table));
@@ -210,7 +210,7 @@ void Dialog_Import_CSV::import(const Glib::ustring& uri, const Glib::ustring& in
// automatically anyway.
if(!field->get_primary_key() || !field->get_auto_increment())
{
- Gtk::TreeModel::iterator tree_iter = m_field_model->append();
+ auto tree_iter = m_field_model->append();
(*tree_iter)[m_field_columns.m_col_field] = field;
(*tree_iter)[m_field_columns.m_col_field_name] = field->get_name();
}
@@ -323,7 +323,7 @@ void Dialog_Import_CSV::on_first_line_as_title_toggled()
{
m_sample_view->set_headers_visible(true);
Gtk::TreeModel::Path path("1");
- Gtk::TreeModel::iterator iter = m_sample_model->get_iter(path);
+ auto iter = m_sample_model->get_iter(path);
// Remove the first row from the view
if(iter && (*iter)[m_sample_columns.m_col_row] == 0)
@@ -342,7 +342,7 @@ void Dialog_Import_CSV::on_first_line_as_title_toggled()
// Check whether row 0 is displayed
Gtk::TreeModel::Path path("1");
- Gtk::TreeModel::iterator iter = m_sample_model->get_iter(path);
+ auto iter = m_sample_model->get_iter(path);
//if((!iter || (*iter)[m_sample_columns.m_col_row] != 0) && !m_parser->get_rows_empty() &&
m_sample_rows->get_value_as_int() > 0)
if((!iter || (*iter)[m_sample_columns.m_col_row] != 0) &&
@@ -384,7 +384,7 @@ void Dialog_Import_CSV::on_sample_rows_changed()
// +1 for the "target field" row
Gtk::TreeModel::Path path(1);
path[0] = new_sample_rows + 1;
- Gtk::TreeModel::iterator iter = m_sample_model->get_iter(path);
+ auto iter = m_sample_model->get_iter(path);
while(iter != m_sample_model->children().end())
iter = m_sample_model->erase(iter);
@@ -398,7 +398,7 @@ void Dialog_Import_CSV::on_sample_rows_changed()
for(guint i = current_sample_rows; i < new_sample_rows; ++i, ++row_index)
{
- Gtk::TreeModel::iterator iter = m_sample_model->append();
+ auto iter = m_sample_model->append();
(*iter)[m_sample_columns.m_col_row] = row_index;
}
}
@@ -406,7 +406,7 @@ void Dialog_Import_CSV::on_sample_rows_changed()
Glib::ustring Dialog_Import_CSV::get_current_encoding() const
{
- Gtk::TreeModel::iterator iter = m_encoding_combo->get_active();
+ auto iter = m_encoding_combo->get_active();
const Glib::ustring encoding = (*iter)[m_encoding_columns.m_col_charset];
if(encoding.empty())
@@ -478,7 +478,7 @@ void Dialog_Import_CSV::on_parser_line_scanned(CsvParser::type_row_strings row,
if(!m_sample_model)
{
setup_sample_model(row);
- Gtk::TreeModel::iterator iter = m_sample_model->append();
+ auto iter = m_sample_model->append();
// -1 means the row to select target fields (see special handling in cell data funcs)
(*iter)[m_sample_columns.m_col_row] = -1;
}
@@ -493,7 +493,7 @@ void Dialog_Import_CSV::on_parser_line_scanned(CsvParser::type_row_strings row,
{
if(sample_rows < static_cast<guint>(m_sample_rows->get_value_as_int()))
{
- Gtk::TreeModel::iterator tree_iter = m_sample_model->append();
+ auto tree_iter = m_sample_model->append();
(*tree_iter)[m_sample_columns.m_col_row] = row_number;
}
}
@@ -639,7 +639,7 @@ void Dialog_Import_CSV::field_data_func(Gtk::CellRenderer* renderer, const Gtk::
void Dialog_Import_CSV::on_field_edited(const Glib::ustring& path, const Glib::ustring& new_text, guint
column_number)
{
Gtk::TreeModel::Path treepath(path);
- Gtk::TreeModel::iterator iter = m_sample_model->get_iter(treepath);
+ auto iter = m_sample_model->get_iter(treepath);
// Lookup field indicated by new_text
const Gtk::TreeNodeChildren& children = m_field_model->children();
@@ -649,7 +649,7 @@ void Dialog_Import_CSV::on_field_edited(const Glib::ustring& path, const Glib::u
{
std::shared_ptr<Field> field = (*field_iter)[m_field_columns.m_col_field];
// Check whether another column is already using that field
- type_vec_fields::iterator vec_field_iter = std::find(m_fields.begin(), m_fields.end(), field);
+ auto vec_field_iter = std::find(m_fields.begin(), m_fields.end(), field);
// Reset the old column since two different columns cannot be imported into the same field
if(vec_field_iter != m_fields.end()) *vec_field_iter = std::shared_ptr<Field>();
diff --git a/glom/libglom/db_utils.cc b/glom/libglom/db_utils.cc
index 6ebd5a0..e8dcfdf 100644
--- a/glom/libglom/db_utils.cc
+++ b/glom/libglom/db_utils.cc
@@ -952,7 +952,7 @@ type_vec_fields get_fields_for_table_from_database(const Glib::ustring& table_na
}
//Hide system fields.
- type_vec_fields::iterator iterFind = std::find_if(result.begin(), result.end(),
predicate_FieldHasName<Field>(GLOM_STANDARD_FIELD_LOCK));
+ auto iterFind = std::find_if(result.begin(), result.end(),
predicate_FieldHasName<Field>(GLOM_STANDARD_FIELD_LOCK));
if(iterFind != result.end())
result.erase(iterFind);
@@ -1035,7 +1035,7 @@ std::shared_ptr<Field> get_fields_for_table_one_field(const Document* document,
return result;
type_vec_fields fields = get_fields_for_table(document, table_name); //TODO_Performance
- type_vec_fields::iterator iter = std::find_if(fields.begin(), fields.end(),
predicate_FieldHasName<Field>(field_name));
+ auto iter = std::find_if(fields.begin(), fields.end(), predicate_FieldHasName<Field>(field_name));
if(iter != fields.end()) //TODO: Handle error?
{
return *iter;
diff --git a/glom/libglom/document/bakery/view/view_composite.h
b/glom/libglom/document/bakery/view/view_composite.h
index b78a0d7..642d2d4 100644
--- a/glom/libglom/document/bakery/view/view_composite.h
+++ b/glom/libglom/document/bakery/view/view_composite.h
@@ -58,7 +58,7 @@ public:
virtual void remove_view(type_view* pView)
{
- typename type_vec_views::iterator iter = std::find(m_vecViews.begin(), m_vecViews.end(), pView);
+ auto iter = std::find(m_vecViews.begin(), m_vecViews.end(), pView);
if(iter != m_vecViews.end())
m_vecViews.erase(iter);
}
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 9449d77..27fdc74 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -735,7 +735,7 @@ void Document::remove_field(const Glib::ustring& table_name, const Glib::ustring
if(info)
{
auto vecFields = info->m_fields;
- type_vec_fields::iterator iterFind = std::find_if( vecFields.begin(), vecFields.end(),
predicate_FieldHasName<Field>(field_name) );
+ auto iterFind = std::find_if( vecFields.begin(), vecFields.end(),
predicate_FieldHasName<Field>(field_name) );
if(iterFind != vecFields.end()) //If it was found:
{
//Remove it:
@@ -4023,7 +4023,7 @@ Document::type_list_groups Document::get_groups() const
void Document::set_group(GroupInfo& group)
{
const auto name = group.get_name();
- type_map_groups::iterator iter = m_groups.find(name);
+ auto iter = m_groups.find(name);
if(iter == m_groups.end())
{
//Add it if necesary:
@@ -4043,7 +4043,7 @@ void Document::set_group(GroupInfo& group)
void Document::remove_group(const Glib::ustring& group_name)
{
- type_map_groups::iterator iter = m_groups.find(group_name);
+ auto iter = m_groups.find(group_name);
if(iter != m_groups.end())
{
m_groups.erase(iter);
@@ -4098,7 +4098,7 @@ void Document::remove_report(const Glib::ustring& table_name, const Glib::ustrin
const auto info = get_table_info(table_name);
if(info)
{
- DocumentTableInfo::type_reports::iterator iterFindReport = info->m_reports.find(report_name);
+ auto iterFindReport = info->m_reports.find(report_name);
if(iterFindReport != info->m_reports.end())
{
info->m_reports.erase(iterFindReport);
@@ -4157,7 +4157,7 @@ void Document::remove_print_layout(const Glib::ustring& table_name, const Glib::
const auto info = get_table_info(table_name);
if(info)
{
- DocumentTableInfo::type_print_layouts::iterator iterFindPrintLayout =
info->m_print_layouts.find(print_layout_name);
+ auto iterFindPrintLayout = info->m_print_layouts.find(print_layout_name);
if(iterFindPrintLayout != info->m_print_layouts.end())
{
info->m_print_layouts.erase(iterFindPrintLayout);
@@ -4708,7 +4708,7 @@ void Document::set_library_module(const Glib::ustring& name, const Glib::ustring
if(name.empty())
return;
- type_map_library_scripts::iterator iter = m_map_library_scripts.find(name);
+ auto iter = m_map_library_scripts.find(name);
if(iter != m_map_library_scripts.end())
{
//Change the existing script, if necessary:
@@ -4739,7 +4739,7 @@ Glib::ustring Document::get_library_module(const Glib::ustring& name) const
void Document::remove_library_module(const Glib::ustring& name)
{
- type_map_library_scripts::iterator iter = m_map_library_scripts.find(name);
+ auto iter = m_map_library_scripts.find(name);
if(iter != m_map_library_scripts.end())
{
m_map_library_scripts.erase(iter);
diff --git a/glom/libglom/privs.cc b/glom/libglom/privs.cc
index d28f3ec..e6b63e0 100644
--- a/glom/libglom/privs.cc
+++ b/glom/libglom/privs.cc
@@ -424,7 +424,7 @@ bool Privs::on_privs_privileges_cache_timeout(const Glib::ustring& table_name)
//std::cout << "debug: " << G_STRFUNC << ": table=" << table_name << std::endl;
//Forget the cached privileges after a few seconds:
- type_map_privileges::iterator iter = m_privileges_cache.find(table_name);
+ auto iter = m_privileges_cache.find(table_name);
if(iter != m_privileges_cache.end())
{
//std::cout << "debug: " << G_STRFUNC << ": Cleared cache for table=" << table_name << std::endl;
@@ -514,7 +514,7 @@ Privileges Privs::get_current_privs(const Glib::ustring& table_name)
//TODO: Make sure we handle the failure well in that unlikely case.
//Stop the existing timeout if it has not run yet.
- type_map_cache_timeouts::iterator iter_connection = m_map_cache_timeouts.find(table_name);
+ auto iter_connection = m_map_cache_timeouts.find(table_name);
if(iter_connection != m_map_cache_timeouts.end())
iter_connection->second.disconnect();
diff --git a/glom/libglom/python_embed/py_glom_related.cc b/glom/libglom/python_embed/py_glom_related.cc
index 5e6df67..19e86e1 100644
--- a/glom/libglom/python_embed/py_glom_related.cc
+++ b/glom/libglom/python_embed/py_glom_related.cc
@@ -53,7 +53,7 @@ boost::python::object PyGlomRelated::getitem(const boost::python::object& cppite
if(!key.empty())
{
//Return a cached item if possible:
- PyGlomRelated::type_map_relatedrecords::iterator iterCacheFind = m_map_relatedrecords.find(key);
+ auto iterCacheFind = m_map_relatedrecords.find(key);
if(iterCacheFind != m_map_relatedrecords.end())
{
//Return a reference to the cached item:
diff --git a/glom/mode_data/box_data_list.cc b/glom/mode_data/box_data_list.cc
index 1cb44a2..50faa19 100644
--- a/glom/mode_data/box_data_list.cc
+++ b/glom/mode_data/box_data_list.cc
@@ -254,7 +254,7 @@ void Box_Data_List::on_details_nav_first()
void Box_Data_List::on_details_nav_previous()
{
- Gtk::TreeModel::iterator iter = m_AddDel.get_item_selected();
+ auto iter = m_AddDel.get_item_selected();
if(iter)
{
//Don't try to select a negative record number.
@@ -270,7 +270,7 @@ void Box_Data_List::on_details_nav_previous()
void Box_Data_List::on_details_nav_next()
{
- Gtk::TreeModel::iterator iter = m_AddDel.get_item_selected();
+ auto iter = m_AddDel.get_item_selected();
if(iter)
{
//Don't go past the last record:
@@ -290,7 +290,7 @@ void Box_Data_List::on_details_nav_next()
void Box_Data_List::on_details_nav_last()
{
- Gtk::TreeModel::iterator iter = m_AddDel.get_last_row();
+ auto iter = m_AddDel.get_last_row();
if(iter)
{
m_AddDel.select_item(iter);
@@ -304,11 +304,11 @@ void Box_Data_List::on_details_nav_last()
void Box_Data_List::on_details_record_deleted(const Gnome::Gda::Value& primary_key_value)
{
//Find out which row is affected:
- Gtk::TreeModel::iterator iter = m_AddDel.get_row(primary_key_value);
+ auto iter = m_AddDel.get_row(primary_key_value);
if(iter)
{
//Remove the row:
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
m_AddDel.remove_item(iter);
@@ -351,7 +351,7 @@ Gnome::Gda::Value Box_Data_List::get_primary_key_value_first() const
Glib::RefPtr<Gtk::TreeModel> model = m_AddDel.get_model();
if(model)
{
- Gtk::TreeModel::iterator iter = model->children().begin();
+ auto iter = model->children().begin();
while(iter != model->children().end())
{
Gnome::Gda::Value value = get_primary_key_value(iter);
@@ -506,7 +506,7 @@ void Box_Data_List::set_open_button_title(const Glib::ustring& title)
void Box_Data_List::set_primary_key_value_selected(const Gnome::Gda::Value& primary_key_value)
{
- Gtk::TreeModel::iterator iter = m_AddDel.get_row(primary_key_value);
+ auto iter = m_AddDel.get_row(primary_key_value);
if(iter)
{
m_AddDel.select_item(iter);
diff --git a/glom/mode_data/datawidget/combo.cc b/glom/mode_data/datawidget/combo.cc
index 24ab385..2a62985 100644
--- a/glom/mode_data/datawidget/combo.cc
+++ b/glom/mode_data/datawidget/combo.cc
@@ -297,7 +297,7 @@ void ComboGlom::set_value(const Gnome::Gda::Value& value)
Gnome::Gda::Value ComboGlom::get_value() const
{
//Get the active row:
- Gtk::TreeModel::iterator iter = get_active();
+ auto iter = get_active();
if(iter)
{
@@ -366,7 +366,7 @@ void ComboGlom::on_changed()
//This signal is emitted for every key press, but sometimes it's just to say that the active item has
changed to "no active item",
//if the text is not in the dropdown list:
- Gtk::TreeModel::iterator iter = get_active();
+ auto iter = get_active();
if(iter)
{
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
index 98982aa..f5d72dc 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
@@ -220,7 +220,7 @@ void ComboAsRadioButtons::set_text(const Glib::ustring& text)
{
m_old_text = text;
- type_map_buttons::iterator iter = m_map_buttons.find(text);
+ auto iter = m_map_buttons.find(text);
if(iter != m_map_buttons.end())
{
Gtk::RadioButton* button = iter->second;
diff --git a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
index c860f6a..d9a71d9 100644
--- a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
+++ b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
@@ -160,7 +160,7 @@ void ComboChoicesWithTreeModel::set_choices_with_second(const type_list_values_w
for(const auto& the_pair : list_values)
{
- Gtk::TreeModel::iterator iterTree = list_store->append();
+ auto iterTree = list_store->append();
Gtk::TreeModel::Row row = *iterTree;
if(layout_choice_first)
@@ -215,7 +215,7 @@ void ComboChoicesWithTreeModel::set_choices_fixed(const Formatting::type_list_va
for(const auto& choicevalue : list_values)
{
- Gtk::TreeModel::iterator iterTree = list_store->append();
+ auto iterTree = list_store->append();
Gtk::TreeModel::Row row = *iterTree;
std::shared_ptr<const LayoutItem_Field> layout_item =
std::dynamic_pointer_cast<LayoutItem_Field>(get_layout_item());
diff --git a/glom/mode_data/datawidget/treemodel_db.cc b/glom/mode_data/datawidget/treemodel_db.cc
index a86c497..9ac698c 100644
--- a/glom/mode_data/datawidget/treemodel_db.cc
+++ b/glom/mode_data/datawidget/treemodel_db.cc
@@ -846,7 +846,7 @@ DbTreeModel::DbValue DbTreeModel::get_key_value(const TreeModel::iterator& iter)
if(check_treeiter_validity(iter))
{
type_datamodel_row_index datamodel_row = get_datamodel_row_index_from_tree_row_iter(iter);
- type_map_rows::iterator iterFind = m_map_rows.find(datamodel_row);
+ auto iterFind = m_map_rows.find(datamodel_row);
if(iterFind != m_map_rows.end())
return iterFind->second.m_key;
else
diff --git a/glom/mode_data/db_adddel/db_adddel.cc b/glom/mode_data/db_adddel/db_adddel.cc
index 4f5b6be..5f4ac37 100644
--- a/glom/mode_data/db_adddel/db_adddel.cc
+++ b/glom/mode_data/db_adddel/db_adddel.cc
@@ -152,7 +152,7 @@ void DbAddDel::set_height_rows_actual(gulong rows_count)
void DbAddDel::do_user_requested_edit()
{
- Gtk::TreeModel::iterator iter = get_item_selected();
+ auto iter = get_item_selected();
if(iter)
{
signal_user_requested_edit()(iter);
@@ -171,7 +171,7 @@ void DbAddDel::on_cell_button_clicked(const Gtk::TreeModel::Path& path)
if(!m_refListStore)
return;
- Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
+ auto iter = m_refListStore->get_iter(path);
if(iter)
{
select_item(iter, false /* start_editing */);
@@ -204,7 +204,7 @@ void DbAddDel::on_MenuPopup_activate_Delete()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_TreeView.get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter && !get_is_placeholder_row(iter))
{
//TODO: We can't handle multiple-selections yet.
@@ -355,7 +355,7 @@ Gnome::Gda::Value DbAddDel::get_value(const Gtk::TreeModel::iterator& iter, cons
Gnome::Gda::Value DbAddDel::get_value_key_selected() const
{
- Gtk::TreeModel::iterator iter = get_item_selected();
+ auto iter = get_item_selected();
if(iter)
{
return get_value_key(iter);
@@ -404,7 +404,7 @@ Gtk::TreeModel::iterator DbAddDel::get_row(const Gnome::Gda::Value& key)
if(!m_refListStore)
return Gtk::TreeModel::iterator();
- for(Gtk::TreeModel::iterator iter = m_refListStore->children().begin(); iter !=
m_refListStore->children().end(); ++iter)
+ for(auto iter = m_refListStore->children().begin(); iter != m_refListStore->children().end(); ++iter)
{
//Gtk::TreeModel::Row row = *iter;
const auto valTemp = get_value_key(iter);
@@ -519,7 +519,7 @@ guint DbAddDel::get_fixed_cell_height()
m_fixed_cell_height = height;
//Look at each column:
- for(type_column_items::iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
+ for(auto iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
{
Glib::ustring font_name;
@@ -694,7 +694,7 @@ void DbAddDel::construct_specified_columns()
const auto has_expandable_column = get_column_to_expand(column_to_expand);
//std::cout << "DEBUG: column_to_expand=" << column_to_expand << ", has=" << has_expandable_column <<
std::endl;
- for(type_column_items::iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
+ for(auto iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
{
const std::shared_ptr<LayoutItem> layout_item = m_column_items[model_column_index]; //TODO: Inefficient.
if(layout_item) //column_info.m_visible)
@@ -1254,7 +1254,7 @@ void DbAddDel::on_cell_layout_button_clicked(const Gtk::TreeModel::Path& path, i
if(!m_refListStore)
return;
- Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
+ auto iter = m_refListStore->get_iter(path);
if(iter)
{
std::shared_ptr<const LayoutItem> layout_item = m_column_items[model_column_index];
@@ -1279,7 +1279,7 @@ void DbAddDel::on_treeview_cell_edited_bool(const Glib::ustring& path_string, in
const Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
+ auto iter = m_refListStore->get_iter(path);
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -1398,7 +1398,7 @@ void DbAddDel::on_treeview_cell_edited(const Glib::ustring& path_string, const G
}
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
+ auto iter = m_refListStore->get_iter(path);
if(iter != get_model()->children().end())
{
Gtk::TreeModel::Row row = *iter;
@@ -1626,9 +1626,9 @@ void DbAddDel::on_treeview_columns_changed()
typedef std::vector<Gtk::TreeViewColumn*> type_vecViewColumns;
type_vecViewColumns vecViewColumns = m_TreeView.get_columns();
- for(type_vecViewColumns::iterator iter = vecViewColumns.begin(); iter != vecViewColumns.end(); ++iter)
+ for(auto iter = vecViewColumns.begin(); iter != vecViewColumns.end(); ++iter)
{
- DbTreeViewColumnGlom* pViewColumn = dynamic_cast<DbTreeViewColumnGlom*>(*iter);
+ auto pViewColumn = dynamic_cast<DbTreeViewColumnGlom*>(*iter);
if(pViewColumn)
{
const auto column_id = pViewColumn->get_column_id();
@@ -2055,7 +2055,7 @@ void DbAddDel::show_hint_model()
m_treeviewcolumn_button = 0; //When we removed the view columns, this was deleted because it's manage()ed.
m_model_hint = Gtk::ListStore::create(m_columns_hint);
- Gtk::TreeModel::iterator iter = m_model_hint->append();
+ auto iter = m_model_hint->append();
(*iter)[m_columns_hint.m_col_hint] = _("Right-click to layout, to specify the related fields.");
m_TreeView.set_model(m_model_hint);
@@ -2065,7 +2065,7 @@ void DbAddDel::show_hint_model()
bool DbAddDel::start_new_record()
{
- Gtk::TreeModel::iterator iter = get_item_placeholder();
+ auto iter = get_item_placeholder();
if(!iter)
return false;
@@ -2081,7 +2081,7 @@ bool DbAddDel::start_new_record()
if(fieldPrimaryKey && fieldPrimaryKey->get_auto_increment())
{
//Start editing in the first cell that is not auto_increment:
- for(type_column_items::iterator iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
+ for(auto iter = m_column_items.begin(); iter != m_column_items.end(); ++iter)
{
std::shared_ptr<LayoutItem> layout_item = *iter;
std::shared_ptr<LayoutItem_Field> layout_item_field =
std::dynamic_pointer_cast<LayoutItem_Field>(layout_item);
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 07e1d8c..3ed2184 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -62,15 +62,15 @@ FlowTableWithFields::FlowTableWithFields(const Glib::ustring& table_name)
FlowTableWithFields::~FlowTableWithFields()
{
//Remove views. The widgets are deleted automatically because they are managed.
- for(type_listFields::iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
+ for(const auto& the_pair : m_listFields)
{
- View_Composite_Glom* pViewFirst = dynamic_cast<View_Composite_Glom*>(iter->m_first);
+ View_Composite_Glom* pViewFirst = dynamic_cast<View_Composite_Glom*>(the_pair.m_first);
if(pViewFirst)
{
remove_view(pViewFirst);
}
- View_Composite_Glom* pViewSecond = dynamic_cast<View_Composite_Glom*>(iter->m_second);
+ View_Composite_Glom* pViewSecond = dynamic_cast<View_Composite_Glom*>(the_pair.m_second);
if(pViewSecond)
{
remove_view(pViewSecond);
@@ -83,9 +83,8 @@ void FlowTableWithFields::set_table(const Glib::ustring& table_name)
m_table_name = table_name;
//Recurse:
- for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end();
++iter)
+ for(const auto& subtable : m_sub_flow_tables)
{
- FlowTableWithFields* subtable = *iter;
if(subtable)
{
subtable->set_table(table_name);
@@ -354,9 +353,9 @@ void FlowTableWithFields::add_layout_notebook(const std::shared_ptr<LayoutItem_N
notebook_widget->show();
notebook_widget->set_layout_item(notebook, m_table_name);
- for(LayoutGroup::type_list_items::iterator iter = notebook->m_list_items.begin(); iter !=
notebook->m_list_items.end(); ++iter)
+ for(const auto& item : notebook->m_list_items)
{
- std::shared_ptr<LayoutGroup> group = std::dynamic_pointer_cast<LayoutGroup>(*iter);
+ std::shared_ptr<LayoutGroup> group = std::dynamic_pointer_cast<LayoutGroup>(item);
if(group)
{
#ifndef GLOM_ENABLE_CLIENT_ONLY
@@ -644,9 +643,9 @@ void FlowTableWithFields::remove_field(const Glib::ustring& id)
{
for(type_listFields::iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
{
- if(iter->m_field->get_name() == id)
+ Info info = *iter;
+ if(info.m_field->get_name() == id)
{
- Info info = *iter;
remove(*(info.m_first));
View_Composite_Glom* pViewFirst = dynamic_cast<View_Composite_Glom*>(info.m_first);
@@ -675,9 +674,9 @@ void FlowTableWithFields::set_field_value(const std::shared_ptr<const LayoutItem
{
//Set widgets which should show the value of this field:
type_list_widgets list_widgets = get_field(field, set_specified_field_layout);
- for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
+ for(const auto& item : list_widgets)
{
- DataWidget* datawidget = dynamic_cast<DataWidget*>(*iter);
+ DataWidget* datawidget = dynamic_cast<DataWidget*>(item);
if(datawidget)
{
datawidget->set_value(value);
@@ -686,9 +685,8 @@ void FlowTableWithFields::set_field_value(const std::shared_ptr<const LayoutItem
//Refresh portal widgets which should show the related records for relationships that use this field:
type_portals list_portals = get_portals(field /* from_key field name */);
- for(type_portals::iterator iter = list_portals.begin(); iter != list_portals.end(); ++iter)
+ for(const auto& portal : list_portals)
{
- Box_Data_Portal* portal = *iter;
if(portal)
{
//std::cerr << G_STRFUNC << ": foreign_key_value=" << value.to_string() << std::endl;
@@ -698,9 +696,8 @@ void FlowTableWithFields::set_field_value(const std::shared_ptr<const LayoutItem
//Refresh choices widgets which should show the related records for relationships that use this field:
type_choice_widgets list_choice_widgets = get_choice_widgets(field /* from_key field name */);
- for(type_choice_widgets::iterator iter = list_choice_widgets.begin(); iter != list_choice_widgets.end();
++iter)
+ for(const auto& widget : list_choice_widgets)
{
- DataWidgetChildren::ComboChoices* widget = *iter;
if(widget)
{
//std::cerr << G_STRFUNC << ": foreign_key_value=" << value.to_string() << std::endl;
@@ -736,9 +733,9 @@ Gnome::Gda::Value FlowTableWithFields::get_field_value(const std::shared_ptr<con
void FlowTableWithFields::set_field_editable(const std::shared_ptr<const LayoutItem_Field>& field, bool
editable)
{
type_list_widgets list_widgets = get_field(field, true);
- for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
+ for(const auto& item : list_widgets)
{
- DataWidget* datawidget = dynamic_cast<DataWidget*>(*iter);
+ DataWidget* datawidget = dynamic_cast<DataWidget*>(item);
if(datawidget)
{
datawidget->set_editable(editable);
@@ -749,9 +746,9 @@ void FlowTableWithFields::set_field_editable(const std::shared_ptr<const LayoutI
void FlowTableWithFields::update_choices(const std::shared_ptr<const LayoutItem_Field>& field)
{
type_list_widgets list_widgets = get_field(field, true);
- for(type_list_widgets::iterator iter = list_widgets.begin(); iter != list_widgets.end(); ++iter)
+ for(const auto& item : list_widgets)
{
- DataWidget* datawidget = dynamic_cast<DataWidget*>(*iter);
+ DataWidget* datawidget = dynamic_cast<DataWidget*>(item);
if(!datawidget)
continue;
@@ -826,9 +823,9 @@ FlowTableWithFields::type_choice_widgets FlowTableWithFields::get_choice_widgets
const auto from_key_name = from_key->get_name();
//Check the single-item widgets:
- for(type_listFields::iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
+ for(const auto& the_pair : m_listFields)
{
- DataWidget* widget = iter->m_second;
+ DataWidget* widget = the_pair.m_second;
if(!widget)
continue;
@@ -952,12 +949,11 @@ void FlowTableWithFields::remove_all()
m_listFields.clear();
- for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end();
++iter)
+ for(auto pSub : m_sub_flow_tables)
{
- FlowTableWithFields* pSub = *iter;
if(pSub)
{
- remove_view(*iter);
+ remove_view(pSub);
delete pSub;
}
@@ -966,9 +962,8 @@ void FlowTableWithFields::remove_all()
m_sub_flow_tables.clear();
- for(type_portals::iterator iter = m_portals.begin(); iter != m_portals.end(); ++iter)
+ for(const auto& pPortal : m_portals)
{
- Box_Data_Portal* pPortal = *iter;
remove_view(pPortal);
delete pPortal;
}
@@ -977,13 +972,13 @@ void FlowTableWithFields::remove_all()
m_list_layoutwidgets.clear();
//Remove views. The widgets are deleted automatically because they are managed.
- for(type_listFields::iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
+ for(const auto& the_pair : m_listFields)
{
- View_Composite_Glom* pViewFirst = dynamic_cast<View_Composite_Glom*>(iter->m_first);
+ View_Composite_Glom* pViewFirst = dynamic_cast<View_Composite_Glom*>(the_pair.m_first);
if(pViewFirst)
remove_view(pViewFirst);
- View_Composite_Glom* pViewSecond = dynamic_cast<View_Composite_Glom*>(iter->m_second);
+ View_Composite_Glom* pViewSecond = dynamic_cast<View_Composite_Glom*>(the_pair.m_second);
if(pViewSecond)
remove_view(pViewSecond);
}
@@ -1050,9 +1045,8 @@ void FlowTableWithFields::set_design_mode(bool value)
#endif
//Set the mode in the sub-flowtables:
- for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end();
++iter)
+ for(const auto& subtable : m_sub_flow_tables)
{
- FlowTableWithFields* subtable = *iter;
if(subtable)
subtable->set_design_mode(value);
}
@@ -1179,9 +1173,8 @@ void FlowTableWithFields::on_portal_user_requested_details(Gnome::Gda::Value pri
void FlowTableWithFields::apply_size_groups_to_labels(const type_vec_sizegroups& size_groups)
{
//Remove widgets from any existing size group:
- for(type_listFields::iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
+ for(auto info : m_listFields)
{
- Info info = *iter;
Gtk::Widget* widget = info.m_first;
Glib::RefPtr<Gtk::SizeGroup> previous_size_group = info.m_first_in_sizegroup;
if(!widget || !previous_size_group)
@@ -1196,9 +1189,8 @@ void FlowTableWithFields::apply_size_groups_to_labels(const type_vec_sizegroups&
if(m_vec_size_groups.empty())
return;
- for(type_listFields::iterator iter = m_listFields.begin(); iter != m_listFields.end(); ++iter)
+ for(auto info : m_listFields)
{
- Info info = *iter;
Gtk::Widget* label = info.m_first;
if(!label)
continue;
@@ -1241,9 +1233,8 @@ void FlowTableWithFields::align_child_group_labels()
vec_sizegroups[i] = Gtk::SizeGroup::create(Gtk::SIZE_GROUP_HORIZONTAL);
}
- for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end();
++iter)
+ for(const auto& subtable : m_sub_flow_tables)
{
- FlowTableWithFields* subtable = *iter;
if(subtable)
subtable->apply_size_groups_to_labels(vec_sizegroups);
}
@@ -1375,9 +1366,8 @@ void FlowTableWithFields::set_find_mode(bool val)
}
//Set find mode in all the child flowtables, recursively:
- for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end();
++iter)
+ for(const auto& subtable : m_sub_flow_tables)
{
- FlowTableWithFields* subtable = *iter;
if(subtable)
{
subtable->set_find_mode(m_find_mode);
@@ -1396,9 +1386,8 @@ void FlowTableWithFields::set_enable_drag_and_drop(bool enabled)
set_drag_enabled(EGG_DRAG_DISABLED);
set_drop_enabled(enabled);
- for(type_sub_flow_tables::iterator iter = m_sub_flow_tables.begin(); iter != m_sub_flow_tables.end();
++iter)
+ for(const auto& child : m_sub_flow_tables)
{
- FlowTableWithFields* child = *iter;
if(child)
{
//std::cout << G_STRFUNC << ": child" << std::endl;
diff --git a/glom/mode_design/box_db_table_relationships.cc b/glom/mode_design/box_db_table_relationships.cc
index 971ee24..e625f13 100644
--- a/glom/mode_design/box_db_table_relationships.cc
+++ b/glom/mode_design/box_db_table_relationships.cc
@@ -107,7 +107,7 @@ bool Box_DB_Table_Relationships::fill_from_database()
if(relationship)
{
//Name:
- Gtk::TreeModel::iterator iterTree = m_AddDel.add_item(relationship->get_name());
+ auto iterTree = m_AddDel.add_item(relationship->get_name());
m_AddDel.set_value(iterTree, m_colName, relationship->get_name());
//Title:
@@ -266,12 +266,12 @@ void Box_DB_Table_Relationships::on_adddel_user_activated(const Gtk::TreeModel::
void Box_DB_Table_Relationships::on_adddel_user_requested_delete(const Gtk::TreeModel::iterator& rowStart,
const Gtk::TreeModel::iterator& /* rowEnd */)
{
- //Gtk::TreeModel::iterator iterAfter = rowEnd;
+ //auto iterAfter = rowEnd;
//++iterAfter;
- //for(Gtk::TreeModel::iterator iter = rowStart; iter != iterAfter; ++iter)
+ //for(auto iter = rowStart; iter != iterAfter; ++iter)
//{ //AddDel::remove_item() can't cope with this.
- Gtk::TreeModel::iterator iter = rowStart;
+ auto iter = rowStart;
const auto relationship_name = m_AddDel.get_value_key(iter);
//Remove the row:
diff --git a/glom/mode_design/comboentry_currency.cc b/glom/mode_design/comboentry_currency.cc
index cba3b71..ab1cdf8 100644
--- a/glom/mode_design/comboentry_currency.cc
+++ b/glom/mode_design/comboentry_currency.cc
@@ -33,7 +33,7 @@ ComboEntry_Currency::ComboEntry_Currency(BaseObjectType* cobject, const Glib::Re
const auto list_currencies = IsoCodes::get_list_of_currency_symbols();
for(const auto& currency : list_currencies)
{
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
Gtk::TreeModel::Row row = *tree_iter;
row[m_model_columns.m_symbol] = currency.m_symbol;
diff --git a/glom/mode_design/dialog_database_preferences.cc b/glom/mode_design/dialog_database_preferences.cc
index 6933c81..c51438b 100644
--- a/glom/mode_design/dialog_database_preferences.cc
+++ b/glom/mode_design/dialog_database_preferences.cc
@@ -114,7 +114,7 @@ void Dialog_Database_Preferences::on_treeview_cell_edited_next_value(const Glib:
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_autoincrements->get_iter(path);
+ auto iter = m_model_autoincrements->get_iter(path);
if(iter != m_model_autoincrements->children().end())
{
Gtk::TreeModel::Row row = *iter;
@@ -196,7 +196,7 @@ void Dialog_Database_Preferences::load_from_document()
const guint count = datamodel->get_n_rows();
for(guint i = 0; i < count; ++i)
{
- Gtk::TreeModel::iterator iter = m_model_autoincrements->append();
+ auto iter = m_model_autoincrements->append();
Gtk::TreeModel::Row row = *iter;
row[m_columns.m_col_table] = Conversions::get_text_for_gda_value(Field::TYPE_TEXT,
datamodel->get_value_at(0, i), numeric_format);
row[m_columns.m_col_field] = Conversions::get_text_for_gda_value(Field::TYPE_TEXT,
datamodel->get_value_at(1, i), numeric_format);
diff --git a/glom/mode_design/fields/box_db_table_definition.cc
b/glom/mode_design/fields/box_db_table_definition.cc
index a01c69c..0384931 100644
--- a/glom/mode_design/fields/box_db_table_definition.cc
+++ b/glom/mode_design/fields/box_db_table_definition.cc
@@ -166,7 +166,7 @@ bool Box_DB_Table_Definition::fill_from_database()
for(const auto& field : m_vecFields)
{
//Name:
- Gtk::TreeModel::iterator tree_iter= m_AddDel.add_item(field->get_name());
+ auto tree_iter= m_AddDel.add_item(field->get_name());
fill_field_row(tree_iter, field);
}
@@ -243,11 +243,11 @@ void Box_DB_Table_Definition::on_adddel_add(const Gtk::TreeModel::iterator& row)
void Box_DB_Table_Definition::on_adddel_delete(const Gtk::TreeModel::iterator& rowStart, const
Gtk::TreeModel::iterator& rowEnd)
{
- Gtk::TreeModel::iterator iterAfterEnd = rowEnd;
+ auto iterAfterEnd = rowEnd;
if(iterAfterEnd != m_AddDel.get_model()->children().end())
++iterAfterEnd;
- for(Gtk::TreeModel::iterator iter = rowStart; iter != iterAfterEnd; ++iter)
+ for(auto iter = rowStart; iter != iterAfterEnd; ++iter)
{
Glib::ustring name = m_AddDel.get_value_key(iter);
if(!name.empty())
@@ -453,7 +453,7 @@ std::shared_ptr<Field> Box_DB_Table_Definition::get_field_definition(const Gtk::
if(pDoc)
{
Document::type_vec_fields vecFields= pDoc->get_table_fields(m_table_name);
- Document::type_vec_fields::iterator iterFind = std::find_if( vecFields.begin(), vecFields.end(),
predicate_FieldHasName<Field>(strFieldNameBeforeEdit) );
+ auto iterFind = std::find_if( vecFields.begin(), vecFields.end(),
predicate_FieldHasName<Field>(strFieldNameBeforeEdit) );
if((iterFind != vecFields.end()) && (*iterFind)) //If it was found:
{
@@ -628,7 +628,7 @@ std::shared_ptr<Field> Box_DB_Table_Definition::change_definition(const std::sha
{
//Find old field:
const auto field_name_old = old_fields[i]->get_name();
- Document::type_vec_fields::iterator iterFind = std::find_if( vecFields.begin(), vecFields.end(),
predicate_FieldHasName<Field>(field_name_old) );
+ auto iterFind = std::find_if( vecFields.begin(), vecFields.end(),
predicate_FieldHasName<Field>(field_name_old) );
if(iterFind != vecFields.end()) //If it was found:
{
//Change it to the new Fields's value:
diff --git a/glom/mode_design/fields/combo_fieldtype.cc b/glom/mode_design/fields/combo_fieldtype.cc
index 47b3d5f..c349d16 100644
--- a/glom/mode_design/fields/combo_fieldtype.cc
+++ b/glom/mode_design/fields/combo_fieldtype.cc
@@ -47,7 +47,7 @@ void Combo_FieldType::init()
for(const auto& the_pair : map_names)
{
- Gtk::TreeModel::iterator iterModel = m_refTreeModel->append();
+ auto iterModel = m_refTreeModel->append();
if(iterModel)
{
Gtk::TreeModel::Row row = *iterModel;
@@ -91,7 +91,7 @@ Field::glom_field_type Combo_FieldType::get_field_type() const
Field::glom_field_type result = Field::TYPE_INVALID;
//Get the active row:
- Gtk::TreeModel::iterator active_row = get_active();
+ auto active_row = get_active();
if(active_row)
{
Gtk::TreeModel::Row row = *active_row;
diff --git a/glom/mode_design/iso_codes.cc b/glom/mode_design/iso_codes.cc
index 1eecd97..13a6be4 100644
--- a/glom/mode_design/iso_codes.cc
+++ b/glom/mode_design/iso_codes.cc
@@ -270,14 +270,14 @@ Glib::ustring get_locale_name(const Glib::ustring& locale_id)
//Get the translated human-readable names of the language and country:
Glib::ustring name;
- type_map_language::iterator iterFindLanguage = map_languages.find(id_language);
+ auto iterFindLanguage = map_languages.find(id_language);
if(iterFindLanguage != map_languages.end()) //Ignore languages that are not listed by iso-codes.
{
name += iterFindLanguage->second;
if(!id_country.empty())
{
- type_map_country::iterator iterFindCountry = map_country.find(id_country);
+ auto iterFindCountry = map_country.find(id_country);
if(iterFindCountry != map_country.end())
name += " (" + iterFindCountry->second + ')';
else
diff --git a/glom/mode_design/layout/combobox_fields.cc b/glom/mode_design/layout/combobox_fields.cc
index 5a70a44..1dc7bb6 100644
--- a/glom/mode_design/layout/combobox_fields.cc
+++ b/glom/mode_design/layout/combobox_fields.cc
@@ -55,7 +55,7 @@ ComboBox_Fields::~ComboBox_Fields()
std::shared_ptr<Field> ComboBox_Fields::get_selected_field() const
{
- Gtk::TreeModel::iterator iter = get_active();
+ auto iter = get_active();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -122,7 +122,7 @@ void ComboBox_Fields::set_fields(Document* document, const Glib::ustring parent_
//Fill the model:
for(const auto& field : fields)
{
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
Gtk::TreeModel::Row row = *tree_iter;
std::shared_ptr<Field> rel = field;
@@ -149,7 +149,7 @@ void ComboBox_Fields::set_fields(Document* document, const Glib::ustring parent_
if(rel && (rel->get_glom_type() == field_type))
{
std::cout << "DEBUG: ComboBox_Fields::set_fields() 1" << std::endl;
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
std::cout << "DEBUG: ComboBox_Fields::set_fields() 2" << std::endl;
Gtk::TreeModel::Row row = *tree_iter;
@@ -169,7 +169,7 @@ void ComboBox_Fields::set_fields(const type_vec_fields& fields, bool with_none_i
if(with_none_item)
{
//Add a special "None" item, so the user can clear the GtkComboBox:
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
Gtk::TreeModel::Row row = *tree_iter;
row[m_model_columns.m_field] = std::shared_ptr<Field>();
@@ -186,7 +186,7 @@ void ComboBox_Fields::set_fields(const type_vec_fields& fields, bool with_none_i
//Fill the model:
for(const auto& field : fields)
{
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
Gtk::TreeModel::Row row = *tree_iter;
row[m_model_columns.m_field] = field;
diff --git a/glom/mode_design/layout/combobox_relationship.cc
b/glom/mode_design/layout/combobox_relationship.cc
index d4eb024..db96f7e 100644
--- a/glom/mode_design/layout/combobox_relationship.cc
+++ b/glom/mode_design/layout/combobox_relationship.cc
@@ -60,7 +60,7 @@ ComboBox_Relationship::~ComboBox_Relationship()
std::shared_ptr<Relationship> ComboBox_Relationship::get_selected_relationship() const
{
- Gtk::TreeModel::iterator iter = get_active();
+ auto iter = get_active();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -72,11 +72,11 @@ std::shared_ptr<Relationship> ComboBox_Relationship::get_selected_relationship()
std::shared_ptr<Relationship>
ComboBox_Relationship::get_selected_relationship(std::shared_ptr<Relationship>& related_relationship) const
{
- Gtk::TreeModel::iterator iter = get_active();
+ auto iter = get_active();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
- Gtk::TreeModel::iterator iterParent = row.parent();
+ auto iterParent = row.parent();
if(iterParent)
{
//It's a related relationship:
@@ -165,7 +165,7 @@ void ComboBox_Relationship::set_relationships(Document* document, const Glib::us
//Fill the model:
for(const auto& rel : relationships)
{
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
Gtk::TreeModel::Row row = *tree_iter;
row[m_model_columns.m_relationship] = rel;
@@ -177,7 +177,7 @@ void ComboBox_Relationship::set_relationships(Document* document, const Glib::us
const auto sub_relationships = document->get_relationships(rel->get_to_table(), false /* plus system
properties */);
for(const auto& rel : sub_relationships)
{
- Gtk::TreeModel::iterator tree_iter_child = m_model->append(tree_iter->children());
+ auto tree_iter_child = m_model->append(tree_iter->children());
Gtk::TreeModel::Row row = *tree_iter_child;
row[m_model_columns.m_relationship] = rel;
@@ -196,7 +196,7 @@ void ComboBox_Relationship::set_relationships(const type_vec_relationships& rela
//Fill the model:
for(const auto& relationship : relationships)
{
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
Gtk::TreeModel::Row row = *tree_iter;
row[m_model_columns.m_relationship] = relationship;
@@ -222,7 +222,7 @@ void ComboBox_Relationship::on_cell_data_title(const Gtk::TreeModel::const_itera
std::shared_ptr<Relationship> relationship = row[m_model_columns.m_relationship];
if(relationship)
{
- Gtk::TreeModel::iterator iterParent = row->parent();
+ auto iterParent = row->parent();
if(iterParent)
{
//related relationship:
@@ -256,7 +256,7 @@ void ComboBox_Relationship::on_cell_data_fromfield(const Gtk::TreeModel::const_i
std::shared_ptr<Relationship> relationship = row[m_model_columns.m_relationship];
if(relationship && relationship->get_has_fields())
{
- Gtk::TreeModel::iterator iterParent = iter->parent();
+ auto iterParent = iter->parent();
if(iterParent)
{
std::shared_ptr<Relationship> parent_relationship = (*iterParent)[m_model_columns.m_relationship];
@@ -286,7 +286,7 @@ void ComboBox_Relationship::set_display_parent_table(const Glib::ustring& table_
if(!already_added)
{
//Add a separator row after the table name:
- Gtk::TreeModel::iterator tree_iter = m_model->prepend();
+ auto tree_iter = m_model->prepend();
Gtk::TreeModel::Row row = *tree_iter;
row[m_model_columns.m_separator] = true;
diff --git a/glom/mode_design/layout/dialog_choose_field.cc b/glom/mode_design/layout/dialog_choose_field.cc
index d6cf4e2..64511ef 100644
--- a/glom/mode_design/layout/dialog_choose_field.cc
+++ b/glom/mode_design/layout/dialog_choose_field.cc
@@ -107,8 +107,8 @@ void Dialog_ChooseField::set_document(Document* document, const Glib::ustring& t
const auto field_name = field->get_name();
//Get the iterator for the row:
- Gtk::TreeModel::iterator iterFound = m_model->children().end();
- for(Gtk::TreeModel::iterator iter = m_model->children().begin(); iter != m_model->children().end();
++iter)
+ auto iterFound = m_model->children().end();
+ for(auto iter = m_model->children().begin(); iter != m_model->children().end(); ++iter)
{
if(field_name == (*iter)[m_ColumnsFields.m_col_name])
{
@@ -168,7 +168,7 @@ void Dialog_ChooseField::set_document(Document* document, const Glib::ustring& t
Document::type_vec_fields vecFields = document->get_table_fields(table_name);
for(const auto& field : vecFields)
{
- Gtk::TreeModel::iterator iterRow = m_model->append();
+ auto iterRow = m_model->append();
Gtk::TreeModel::Row row = *iterRow;
row[m_ColumnsFields.m_col_name] = field->get_name();
@@ -184,7 +184,7 @@ void Dialog_ChooseField::select_item(const Field& field)
//TODO: We do this in set_document() as well.
//Find any items with the same name:
- for(Gtk::TreeModel::iterator iter = m_model->children().begin(); iter != m_model->children().end(); ++iter)
+ auto iter = m_model->children().begin(); iter != m_model->children().end(); ++iter)
{
Gtk::TreeModel::Row row = *iter;
const Field& field_item = row[m_ColumnsFields.m_col_field];
@@ -247,7 +247,7 @@ Dialog_ChooseField::type_list_field_items Dialog_ChooseField::get_fields_chosen(
type_list_paths list_paths = refTreeSelection->get_selected_rows();
for(const auto& path : list_paths)
{
- Gtk::TreeModel::iterator tree_iter = m_model->get_iter(path);
+ auto tree_iter = m_model->get_iter(path);
if(!tree_iter)
continue;
@@ -325,7 +325,7 @@ void Dialog_ChooseField::on_combo_relationship_changed()
m_model->clear();
for(const auto& field : vecFields)
{
- Gtk::TreeModel::iterator iterRow = m_model->append();
+ auto iterRow = m_model->append();
Gtk::TreeModel::Row row = *iterRow;
row[m_ColumnsFields.m_col_name] = field->get_name();
@@ -342,7 +342,7 @@ void Dialog_ChooseField::on_treeview_selection_changed()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
/*
diff --git a/glom/mode_design/layout/dialog_choose_relationship.cc
b/glom/mode_design/layout/dialog_choose_relationship.cc
index 9eee9df..3702499 100644
--- a/glom/mode_design/layout/dialog_choose_relationship.cc
+++ b/glom/mode_design/layout/dialog_choose_relationship.cc
@@ -79,7 +79,7 @@ void Dialog_ChooseRelationship::set_document(Document* document, const Glib::ust
Document::type_vec_relationships vecRelationships = document->get_relationships(table_name);
for(const auto& relationship : vecRelationships)
{
- Gtk::TreeModel::iterator iterRow = m_model->append();
+ auto iterRow = m_model->append();
Gtk::TreeModel::Row row = *iterRow;
if(relationship)
@@ -123,7 +123,7 @@ std::shared_ptr<Relationship> Dialog_ChooseRelationship::get_relationship_chosen
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/layout/dialog_layout.cc b/glom/mode_design/layout/dialog_layout.cc
index 2d08b5b..d022e1e 100644
--- a/glom/mode_design/layout/dialog_layout.cc
+++ b/glom/mode_design/layout/dialog_layout.cc
@@ -67,13 +67,13 @@ void Dialog_Layout::move_treeview_selection_up(Gtk::TreeView* treeview, const Gt
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = treeview->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
Glib::RefPtr<Gtk::TreeModel> model = treeview->get_model();
if(iter != model->children().begin()) //If it is not the first one.
{
- Gtk::TreeModel::iterator iterBefore = iter;
+ auto iterBefore = iter;
--iterBefore;
Gtk::TreeModel::Row row = *iter;
@@ -101,10 +101,10 @@ void Dialog_Layout::move_treeview_selection_down(Gtk::TreeView* treeview, const
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = treeview->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
Glib::RefPtr<Gtk::TreeModel> model = treeview->get_model();
diff --git a/glom/mode_design/layout/dialog_layout_calendar_related.cc
b/glom/mode_design/layout/dialog_layout_calendar_related.cc
index af16eed..683625a 100644
--- a/glom/mode_design/layout/dialog_layout_calendar_related.cc
+++ b/glom/mode_design/layout/dialog_layout_calendar_related.cc
@@ -197,7 +197,7 @@ void Dialog_Layout_Calendar_Related::update_ui(bool including_relationship_list)
else
{
//Add the item to the treeview:
- Gtk::TreeModel::iterator iter = m_model_items->append();
+ auto iter = m_model_items->append();
Gtk::TreeModel::Row row = *iter;
row[m_model_items->m_columns.m_col_layout_item] = glom_sharedptr_clone(item);
}
@@ -384,7 +384,7 @@ void Dialog_Layout_Calendar_Related::on_button_add_field()
continue;
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = m_model_items->append();
+ auto iter = m_model_items->append();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -406,7 +406,7 @@ void Dialog_Layout_Calendar_Related::on_button_edit()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/layout/dialog_layout_details.cc
b/glom/mode_design/layout/dialog_layout_details.cc
index c50c16a..fc22680 100644
--- a/glom/mode_design/layout/dialog_layout_details.cc
+++ b/glom/mode_design/layout/dialog_layout_details.cc
@@ -232,10 +232,8 @@ void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, std
group->remove_all_items(); //Remove the copied child items, if any, so we can add them.
//Get child layout items:
- for(Gtk::TreeModel::iterator iterChild = row.children().begin(); iterChild != row.children().end();
++iterChild)
+ for(const auto& rowChild : row.children())
{
- Gtk::TreeModel::Row rowChild = *iterChild;
-
std::shared_ptr<LayoutItem> layout_item = rowChild[m_model_items->m_columns.m_col_layout_item];
std::shared_ptr<LayoutItem_Portal> layout_portal =
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
@@ -253,7 +251,7 @@ void Dialog_Layout_Details::fill_group(const Gtk::TreeModel::iterator& iter, std
{
//Recurse:
std::shared_ptr<LayoutGroup> group_child = glom_sharedptr_clone(layout_group);
- fill_group(iterChild, group_child);
+ fill_group(rowChild, group_child);
group->add_item(group_child);
}
else if(layout_item)
@@ -306,7 +304,7 @@ void Dialog_Layout_Details::add_group(const Gtk::TreeModel::iterator& parent, co
if(portal) //If it is a portal
{
//Handle this differently to regular groups, so we do not also add its children:
- Gtk::TreeModel::iterator iter = m_model_items->append(iterNewGroup->children());
+ auto iter = m_model_items->append(iterNewGroup->children());
Gtk::TreeModel::Row row = *iter;
row[m_model_items->m_columns.m_col_layout_item] = glom_sharedptr_clone(portal);
}
@@ -318,7 +316,7 @@ void Dialog_Layout_Details::add_group(const Gtk::TreeModel::iterator& parent, co
else
{
//Add the item to the treeview:
- Gtk::TreeModel::iterator iter = m_model_items->append(iterNewGroup->children());
+ auto iter = m_model_items->append(iterNewGroup->children());
Gtk::TreeModel::Row row = *iter;
row[m_model_items->m_columns.m_col_layout_item] = glom_sharedptr_clone(item);
}
@@ -383,12 +381,12 @@ void Dialog_Layout_Details::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_fields->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
//Disable Up if It can't go any higher.
bool enable_up = true;
- Gtk::TreeModel::iterator iterParent = iter->parent();
+ auto iterParent = iter->parent();
if(iterParent)
{
//See whether it is the last child of its parent:
@@ -406,7 +404,7 @@ void Dialog_Layout_Details::enable_buttons()
//Disable Down if It can't go any lower.
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
bool enable_down = true;
@@ -452,7 +450,7 @@ void Dialog_Layout_Details::on_button_field_delete()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_fields->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
m_model_items->erase(iter);
@@ -467,10 +465,10 @@ void Dialog_Layout_Details::on_button_up()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_fields->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
- Gtk::TreeModel::iterator parent = iter->parent();
+ auto parent = iter->parent();
bool is_first = false;
if(parent)
is_first = (iter == parent->children().begin());
@@ -479,7 +477,7 @@ void Dialog_Layout_Details::on_button_up()
if(!is_first)
{
- Gtk::TreeModel::iterator iterBefore = iter;
+ auto iterBefore = iter;
--iterBefore;
m_model_items->iter_swap(iter, iterBefore);
@@ -498,13 +496,13 @@ void Dialog_Layout_Details::on_button_down()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_fields->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
- Gtk::TreeModel::iterator parent = iter->parent();
+ auto parent = iter->parent();
bool is_last = false;
if(parent)
is_last = (iterNext == parent->children().end());
@@ -528,14 +526,13 @@ void Dialog_Layout_Details::on_button_down()
void Dialog_Layout_Details::on_button_add_field()
{
type_list_field_items fields_list = offer_field_list(m_table_name, this);
- for(type_list_field_items::iterator iter_chosen = fields_list.begin(); iter_chosen != fields_list.end();
++iter_chosen)
+ for(const auto& layout_item : fields_list)
{
- std::shared_ptr<LayoutItem_Field> layout_item = *iter_chosen;
if(!layout_item)
continue;
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -614,7 +611,7 @@ Gtk::TreeModel::iterator Dialog_Layout_Details::append_appropriate_row()
{
Gtk::TreeModel::iterator result;
- Gtk::TreeModel::iterator parent = get_selected_group_parent();
+ auto parent = get_selected_group_parent();
//Add the field details to the layout treeview:
if(parent)
@@ -624,7 +621,7 @@ Gtk::TreeModel::iterator Dialog_Layout_Details::append_appropriate_row()
else
{
//Find the first group, and make the new row a child of that:
- Gtk::TreeModel::iterator iter_first = m_model_items->children().begin();
+ auto iter_first = m_model_items->children().begin();
if(iter_first)
{
Gtk::TreeModel::Row row = *iter_first;
@@ -649,7 +646,7 @@ Gtk::TreeModel::iterator Dialog_Layout_Details::append_appropriate_row()
void Dialog_Layout_Details::on_button_add_button()
{
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -674,7 +671,7 @@ void Dialog_Layout_Details::on_button_add_button()
void Dialog_Layout_Details::on_button_add_text()
{
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -699,7 +696,7 @@ void Dialog_Layout_Details::on_button_add_text()
void Dialog_Layout_Details::on_button_add_image()
{
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -724,7 +721,7 @@ void Dialog_Layout_Details::on_button_add_image()
void Dialog_Layout_Details::on_button_add_notebook()
{
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -753,7 +750,7 @@ void Dialog_Layout_Details::on_button_add_related()
if(relationship)
{
*/
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -785,7 +782,7 @@ void Dialog_Layout_Details::on_button_add_related_calendar()
if(relationship)
{
*/
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -817,7 +814,7 @@ Gtk::TreeModel::iterator Dialog_Layout_Details::get_selected_group_parent() cons
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_fields->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -844,7 +841,7 @@ Gtk::TreeModel::iterator Dialog_Layout_Details::get_selected_group_parent() cons
void Dialog_Layout_Details::on_button_add_group()
{
- Gtk::TreeModel::iterator parent = get_selected_group_parent();
+ auto parent = get_selected_group_parent();
Gtk::TreeModel::iterator iterNewGroup;
if(!parent)
@@ -885,7 +882,7 @@ void Dialog_Layout_Details::on_button_formatting()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_fields->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -924,7 +921,7 @@ void Dialog_Layout_Details::on_button_edit()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_fields->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
//Do something different for each type of item:
@@ -1063,17 +1060,15 @@ void Dialog_Layout_Details::save_to_document()
Document::type_list_layout_groups list_groups;
//Add the layout items:
- for(Gtk::TreeModel::iterator iterFields = m_model_items->children().begin(); iterFields !=
m_model_items->children().end(); ++iterFields)
+ for(const auto& row : m_model_items->children())
{
- Gtk::TreeModel::Row row = *iterFields;
-
std::shared_ptr<LayoutItem> layout_item = row[m_model_items->m_columns.m_col_layout_item];
std::shared_ptr<LayoutGroup> layout_group = std::dynamic_pointer_cast<LayoutGroup>(layout_item);
std::shared_ptr<LayoutItem_Portal> layout_portal =
std::dynamic_pointer_cast<LayoutItem_Portal>(layout_item);
if(layout_group && !layout_portal) //There may be top-level groups, but no top-level fields, because
the fields must be in a group (so that they are in columns)
{
std::shared_ptr<LayoutGroup> group = std::make_shared<LayoutGroup>();
- fill_group(iterFields, group);
+ fill_group(row, group);
list_groups.push_back(group);
}
@@ -1282,7 +1277,7 @@ void Dialog_Layout_Details::on_treeview_cell_edited_title(const Glib::ustring& p
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_items->get_iter(path);
+ auto iter = m_model_items->get_iter(path);
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -1306,7 +1301,7 @@ void Dialog_Layout_Details::on_treeview_cell_edited_name(const Glib::ustring& pa
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_items->get_iter(path);
+ auto iter = m_model_items->get_iter(path);
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -1329,7 +1324,7 @@ void Dialog_Layout_Details::on_treeview_cell_edited_column_width(const Glib::ust
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_items->get_iter(path);
+ auto iter = m_model_items->get_iter(path);
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -1358,7 +1353,7 @@ void Dialog_Layout_Details::on_treeview_cell_edited_group_columns(const Glib::us
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_items->get_iter(path);
+ auto iter = m_model_items->get_iter(path);
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/layout/dialog_layout_export.cc b/glom/mode_design/layout/dialog_layout_export.cc
index a3cfea8..f4a6ee9 100644
--- a/glom/mode_design/layout/dialog_layout_export.cc
+++ b/glom/mode_design/layout/dialog_layout_export.cc
@@ -151,7 +151,7 @@ void Dialog_Layout_Export::set_layout_groups(Document::type_list_layout_groups&
std::shared_ptr<const LayoutItem_Field> item = std::dynamic_pointer_cast<const
LayoutItem_Field>(base_item);
if(item)
{
- Gtk::TreeModel::iterator iterTree = m_model_fields->append();
+ auto iterTree = m_model_fields->append();
Gtk::TreeModel::Row row = *iterTree;
row[m_ColumnsFields.m_col_layout_item] = glom_sharedptr_clone(item);
@@ -173,7 +173,7 @@ void Dialog_Layout_Export::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_fields->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
//Disable Up if It can't go any higher.
@@ -185,7 +185,7 @@ void Dialog_Layout_Export::enable_buttons()
//Disable Down if It can't go any lower.
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
bool enable_down = true;
@@ -262,7 +262,7 @@ void Dialog_Layout_Export::on_button_add_field()
continue;
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = m_model_fields->append();
+ auto iter = m_model_fields->append();
if(iter)
{
@@ -289,7 +289,7 @@ void Dialog_Layout_Export::on_button_delete()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
m_model_fields->erase(iter);
@@ -328,7 +328,7 @@ void Dialog_Layout_Export::on_button_edit_field()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/layout/dialog_layout_list_related.cc
b/glom/mode_design/layout/dialog_layout_list_related.cc
index 0102e8e..50afe02 100644
--- a/glom/mode_design/layout/dialog_layout_list_related.cc
+++ b/glom/mode_design/layout/dialog_layout_list_related.cc
@@ -253,7 +253,7 @@ void Dialog_Layout_List_Related::update_ui(bool including_relationship_list)
else
{
//Add the item to the treeview:
- Gtk::TreeModel::iterator iter = m_model_items->append();
+ auto iter = m_model_items->append();
Gtk::TreeModel::Row row = *iter;
row[m_model_items->m_columns.m_col_layout_item] = glom_sharedptr_clone(item);
}
@@ -505,7 +505,7 @@ void Dialog_Layout_List_Related::on_button_add_field()
continue;
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = m_model_items->append();
+ auto iter = m_model_items->append();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -527,7 +527,7 @@ void Dialog_Layout_List_Related::on_button_edit()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
index 05b2935..7b8b70e 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
@@ -109,7 +109,7 @@ Box_Formatting::Box_Formatting(BaseObjectType* cobject, const Glib::RefPtr<Gtk::
//Fill the alignment combo:
m_model_alignment = Gtk::ListStore::create(m_columns_alignment);
- Gtk::TreeModel::iterator iter = m_model_alignment->append();
+ auto iter = m_model_alignment->append();
(*iter)[m_columns_alignment.m_col_alignment] = Formatting::HORIZONTAL_ALIGNMENT_AUTO;
//Translators: This is Automatic text alignment.
(*iter)[m_columns_alignment.m_col_title] = _("Automatic");
@@ -334,7 +334,7 @@ void Box_Formatting::set_formatting_for_non_field(const Formatting& format, bool
//Display the value in the choices list as it would be displayed in the format:
const auto value_text = Conversions::get_text_for_gda_value(m_field->get_glom_type(), value,
format.m_numeric_format);
- Gtk::TreeModel::iterator tree_iter = m_adddel_choices_custom->add_item(value_text);
+ auto tree_iter = m_adddel_choices_custom->add_item(value_text);
m_adddel_choices_custom->set_value(tree_iter, m_col_index_custom_choices, value_text);
}
@@ -360,7 +360,7 @@ bool Box_Formatting::get_formatting(Formatting& format) const
m_checkbox_format_color_negatives->get_active();
//Text formatting:
- Gtk::TreeModel::iterator iter = m_combo_format_text_horizontal_alignment->get_active();
+ auto iter = m_combo_format_text_horizontal_alignment->get_active();
Formatting::HorizontalAlignment alignment = Formatting::HORIZONTAL_ALIGNMENT_LEFT;
if(iter)
alignment = (*iter)[m_columns_alignment.m_col_alignment];
diff --git a/glom/mode_design/layout/layout_item_dialogs/combo_summarytype.cc
b/glom/mode_design/layout/layout_item_dialogs/combo_summarytype.cc
index d268045..951d757 100644
--- a/glom/mode_design/layout/layout_item_dialogs/combo_summarytype.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/combo_summarytype.cc
@@ -33,7 +33,7 @@ Combo_SummaryType::Combo_SummaryType(BaseObjectType* cobject, const Glib::RefPtr
//Fill the model:
- Gtk::TreeModel::iterator iter = m_model->append();
+ auto iter = m_model->append();
(*iter)[m_model_columns.m_summary_type] = LayoutItem_FieldSummary::TYPE_SUM;
(*iter)[m_model_columns.m_name] =
LayoutItem_FieldSummary::get_summary_type_name(LayoutItem_FieldSummary::TYPE_SUM);
iter = m_model->append();
@@ -77,7 +77,7 @@ void Combo_SummaryType::set_summary_type(LayoutItem_FieldSummary::summaryType su
LayoutItem_FieldSummary::summaryType Combo_SummaryType::get_summary_type() const
{
//Get the active row:
- Gtk::TreeModel::iterator active_row = get_active();
+ auto active_row = get_active();
if(active_row)
{
Gtk::TreeModel::Row row = *active_row;
diff --git a/glom/mode_design/layout/layout_item_dialogs/comboentry_borderwidth.cc
b/glom/mode_design/layout/layout_item_dialogs/comboentry_borderwidth.cc
index 108fb29..e36d7a3 100644
--- a/glom/mode_design/layout/layout_item_dialogs/comboentry_borderwidth.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/comboentry_borderwidth.cc
@@ -30,7 +30,7 @@ ComboEntry_BorderWidth::ComboEntry_BorderWidth(BaseObjectType* cobject, const Gl
m_model = Gtk::ListStore::create(m_model_columns);
//Fill the model:
- Gtk::TreeModel::iterator iter = m_model->append();
+ auto iter = m_model->append();
(*iter)[m_model_columns.m_value] = string_for_number(0.05);
iter = m_model->append();
(*iter)[m_model_columns.m_value] = string_for_number(0.1);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
index 6577f89..3a05d1a 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
@@ -121,7 +121,7 @@ void Dialog_FieldsList::set_fields(const Glib::ustring& table_name, const Layout
if(!item)
continue;
- Gtk::TreeModel::iterator iterTree = m_model_fields->append();
+ auto iterTree = m_model_fields->append();
Gtk::TreeModel::Row row = *iterTree;
row[m_ColumnsFields.m_col_layout_item] = item;
@@ -141,7 +141,7 @@ void Dialog_FieldsList::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_fields->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
//Disable Up if It can't go any higher.
@@ -153,7 +153,7 @@ void Dialog_FieldsList::enable_buttons()
//Disable Down if It can't go any lower.
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
bool enable_down = true;
@@ -222,7 +222,7 @@ Gtk::TreeModel::iterator Dialog_FieldsList::append_appropriate_row()
Gtk::TreeModel::iterator result;
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_fields->get_selection();
- Gtk::TreeModel::iterator selected = refTreeSelection->get_selected();
+ auto selected = refTreeSelection->get_selected();
//Add the field details to the layout treeview:
if(selected)
@@ -248,7 +248,7 @@ void Dialog_FieldsList::on_button_add_field()
continue;
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = append_appropriate_row();
+ auto iter = append_appropriate_row();
if(iter)
{
@@ -273,7 +273,7 @@ void Dialog_FieldsList::on_button_delete()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
m_model_fields->erase(iter);
@@ -317,7 +317,7 @@ void Dialog_FieldsList::on_button_edit_field()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -351,7 +351,7 @@ void Dialog_FieldsList::on_button_formatting()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
index 1e15b37..44dd71f 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_notebook.cc
@@ -97,7 +97,7 @@ void Dialog_Notebook::set_notebook(const std::shared_ptr<const LayoutItem_Notebo
std::shared_ptr<const LayoutGroup> item = std::dynamic_pointer_cast<const LayoutGroup>(base_item);
if(item)
{
- Gtk::TreeModel::iterator iterTree = m_model->append();
+ auto iterTree = m_model->append();
Gtk::TreeModel::Row row = *iterTree;
row[m_ColumnsTabs.m_col_item] = glom_sharedptr_clone(item);
@@ -119,7 +119,7 @@ void Dialog_Notebook::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
//Disable Up if It can't go any higher.
@@ -131,7 +131,7 @@ void Dialog_Notebook::enable_buttons()
//Disable Down if It can't go any lower.
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
bool enable_down = true;
@@ -201,7 +201,7 @@ void Dialog_Notebook::on_treeview_selection_changed()
void Dialog_Notebook::on_button_add()
{
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = m_model->append();
+ auto iter = m_model->append();
if(iter)
{
@@ -222,7 +222,7 @@ void Dialog_Notebook::on_button_delete()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
m_model->erase(iter);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
index c2d698f..15e519a 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_sortfields.cc
@@ -116,7 +116,7 @@ void Dialog_SortFields::set_fields(const Glib::ustring& table_name, const Layout
{
std::shared_ptr<const LayoutItem_Field> item = std::dynamic_pointer_cast<const
LayoutItem_Field>(the_pair.first);
- Gtk::TreeModel::iterator iterTree = m_model_fields->append();
+ auto iterTree = m_model_fields->append();
Gtk::TreeModel::Row row = *iterTree;
row[m_ColumnsFields.m_col_layout_item] = item;
@@ -137,7 +137,7 @@ void Dialog_SortFields::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_fields->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
//Disable Up if It can't go any higher.
@@ -149,7 +149,7 @@ void Dialog_SortFields::enable_buttons()
//Disable Down if It can't go any lower.
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
bool enable_down = true;
@@ -221,7 +221,7 @@ void Dialog_SortFields::on_button_add_field()
continue;
//Add the field details to the layout treeview:
- Gtk::TreeModel::iterator iter = m_model_fields->append();
+ auto iter = m_model_fields->append();
if(iter)
{
@@ -247,7 +247,7 @@ void Dialog_SortFields::on_button_delete()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
m_model_fields->erase(iter);
@@ -282,7 +282,7 @@ void Dialog_SortFields::on_button_edit_field()
if(refTreeSelection)
{
//TODO: Handle multiple-selection:
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/print_layouts/box_print_layouts.cc
b/glom/mode_design/print_layouts/box_print_layouts.cc
index b9dedd5..7bf3bfe 100644
--- a/glom/mode_design/print_layouts/box_print_layouts.cc
+++ b/glom/mode_design/print_layouts/box_print_layouts.cc
@@ -108,7 +108,7 @@ bool Box_Print_Layouts::fill_from_database()
std::shared_ptr<PrintLayout> item = document->get_print_layout(m_table_name, print_layout_name);
if(item)
{
- Gtk::TreeModel::iterator row = m_AddDel.add_item(item->get_name());
+ auto row = m_AddDel.add_item(item->get_name());
fill_row(row, item);
}
}
diff --git a/glom/mode_design/print_layouts/window_print_layout_edit.cc
b/glom/mode_design/print_layouts/window_print_layout_edit.cc
index 72f40e1..fc49c39 100644
--- a/glom/mode_design/print_layouts/window_print_layout_edit.cc
+++ b/glom/mode_design/print_layouts/window_print_layout_edit.cc
@@ -1053,10 +1053,8 @@ void Window_PrintLayout_Edit::on_menu_edit_copy()
m_layout_items_to_paste.clear();
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> item = *iter;
if(item)
item->update_layout_position_from_canvas();
@@ -1074,10 +1072,8 @@ void Window_PrintLayout_Edit::on_menu_edit_paste()
if(m_layout_items_to_paste.empty())
return;
- for(type_list_items::iterator iter = m_layout_items_to_paste.begin();
- iter != m_layout_items_to_paste.end(); ++iter)
+ for(const auto& item : m_layout_items_to_paste)
{
- std::shared_ptr<LayoutItem> item = *iter;
if(!item)
continue;
@@ -1136,7 +1132,7 @@ void Window_PrintLayout_Edit::on_menu_align_top()
{
//Get the top-most position:
double top = 0;
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
+ for(auto iter = m_layout_items_selected.begin();
iter != m_layout_items_selected.end(); ++iter)
{
Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
@@ -1154,10 +1150,8 @@ void Window_PrintLayout_Edit::on_menu_align_top()
}
//Give all items the same top position:
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& selected_item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
if(!selected_item)
continue;
@@ -1172,7 +1166,7 @@ void Window_PrintLayout_Edit::on_menu_align_bottom()
{
//Get the bottom-most position:
double bottom = 0;
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
+ for(auto iter = m_layout_items_selected.begin();
iter != m_layout_items_selected.end(); ++iter)
{
Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
@@ -1195,10 +1189,8 @@ void Window_PrintLayout_Edit::on_menu_align_bottom()
}
//Give all items the same top position:
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& selected_item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
if(!selected_item)
continue;
@@ -1220,7 +1212,7 @@ void Window_PrintLayout_Edit::on_menu_align_left()
{
//Get the left-most position:
double left = 0;
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
+ for(auto iter = m_layout_items_selected.begin();
iter != m_layout_items_selected.end(); ++iter)
{
Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
@@ -1238,10 +1230,8 @@ void Window_PrintLayout_Edit::on_menu_align_left()
}
//Give all items the same left position:
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& selected_item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
if(!selected_item)
continue;
@@ -1256,10 +1246,11 @@ void Window_PrintLayout_Edit::on_menu_align_right()
{
//Get the right-most position:
double right = 0;
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
+ for(auto iter = m_layout_items_selected.begin();
iter != m_layout_items_selected.end(); ++iter)
{
Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
+
if(!selected_item)
continue;
@@ -1279,10 +1270,8 @@ void Window_PrintLayout_Edit::on_menu_align_right()
}
//Give all items the same top position:
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& selected_item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
if(!selected_item)
continue;
@@ -1369,10 +1358,8 @@ void Window_PrintLayout_Edit::get_dimensions_of_multiple_selected_items(double&
double x2 = 0;
double y2 = 0;
bool first = true;
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> item = Glib::RefPtr<CanvasLayoutItem>::cast_dynamic(*iter);
if(!item)
continue;
@@ -1412,10 +1399,9 @@ void Window_PrintLayout_Edit::on_canvas_selection_changed()
//Forget about any previously selected items:
m_layout_items_selected.clear();
- for(type_vec_connections::iterator iter = m_connections_items_selected_moved.begin();
- iter != m_connections_items_selected_moved.end(); ++iter)
+ for(auto item : m_connections_items_selected_moved)
{
- iter->disconnect();
+ item.disconnect();
}
m_connections_items_selected_moved.clear();
@@ -1478,10 +1464,8 @@ void Window_PrintLayout_Edit::on_canvas_selection_changed()
void Window_PrintLayout_Edit::on_selected_item_moved(const Glib::RefPtr<CanvasItemMovable>& item, double
x_offset, double y_offset)
{
//Move the other selected items too:
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& selected_item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> selected_item = *iter;
if(!selected_item || (item == selected_item))
continue;
@@ -1525,10 +1509,8 @@ void Window_PrintLayout_Edit::on_spinbutton_x()
const auto offset_x = m_spinbutton_x->get_value() - x;
//Apply the offset to all items:
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> item = *iter;
if(!item)
continue;
@@ -1560,10 +1542,8 @@ void Window_PrintLayout_Edit::on_spinbutton_y()
const auto offset_y = m_spinbutton_y->get_value() - y;
//Apply the offset to all items:
- for(type_vec_canvas_items::iterator iter = m_layout_items_selected.begin();
- iter != m_layout_items_selected.end(); ++iter)
+ for(const auto& item : m_layout_items_selected)
{
- Glib::RefPtr<CanvasLayoutItem> item = *iter;
if(!item)
continue;
diff --git a/glom/mode_design/relationships_overview/window_relationships_overview.cc
b/glom/mode_design/relationships_overview/window_relationships_overview.cc
index 55c18cb..5550fef 100644
--- a/glom/mode_design/relationships_overview/window_relationships_overview.cc
+++ b/glom/mode_design/relationships_overview/window_relationships_overview.cc
@@ -126,7 +126,7 @@ Window_RelationshipsOverview::~Window_RelationshipsOverview()
//so sigc::bind()ed RefPtrs can be released.
while(m_list_table_connections.size())
{
- type_list_connections::iterator iter = m_list_table_connections.begin();
+ auto iter = m_list_table_connections.begin();
sigc::connection the_connection = *iter;
the_connection.disconnect();
m_list_table_connections.erase(iter);
@@ -144,7 +144,7 @@ void Window_RelationshipsOverview::draw_tables()
//so sigc::bind()ed RefPtrs can be released.
while(m_list_table_connections.size())
{
- type_list_connections::iterator iter = m_list_table_connections.begin();
+ auto iter = m_list_table_connections.begin();
sigc::connection the_connection = *iter;
the_connection.disconnect();
m_list_table_connections.erase(iter);
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc
b/glom/mode_design/report_layout/dialog_layout_report.cc
index 9d7c7b0..2088578 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -101,22 +101,22 @@ Dialog_Layout_Report::Dialog_Layout_Report(BaseObjectType* cobject, const Glib::
{
m_model_available_parts_main = type_model::create();
- // Gtk::TreeModel::iterator iterHeader = m_model_available_parts_main->append();
+ // auto iterHeader = m_model_available_parts_main->append();
// (*iterHeader)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Header>();
- Gtk::TreeModel::iterator iter = m_model_available_parts_main->append();
+ auto iter = m_model_available_parts_main->append();
(*iter)[m_model_available_parts_main->m_columns.m_col_item] = std::make_shared<LayoutItem_GroupBy>();
- Gtk::TreeModel::iterator iterField = m_model_available_parts_main->append(iter->children()); //Place
Field under GroupBy to indicate that that's where it belongs in the actual layout.
+ auto iterField = m_model_available_parts_main->append(iter->children()); //Place Field under GroupBy
to indicate that that's where it belongs in the actual layout.
(*iterField)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Field>();
- Gtk::TreeModel::iterator iterText = m_model_available_parts_main->append(iter->children());
+ auto iterText = m_model_available_parts_main->append(iter->children());
(*iterText)[m_model_available_parts_main->m_columns.m_col_item] = std::make_shared<LayoutItem_Text>();
- Gtk::TreeModel::iterator iterImage = m_model_available_parts_main->append(iter->children());
+ auto iterImage = m_model_available_parts_main->append(iter->children());
(*iterImage)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Image>();
- Gtk::TreeModel::iterator iterVerticalGroup = m_model_available_parts_main->append(iter->children());
+ auto iterVerticalGroup = m_model_available_parts_main->append(iter->children());
(*iterVerticalGroup)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_VerticalGroup>();
iter = m_model_available_parts_main->append();
@@ -124,7 +124,7 @@ Dialog_Layout_Report::Dialog_Layout_Report(BaseObjectType* cobject, const Glib::
iter = m_model_available_parts_main->append(iter->children());
(*iter)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_FieldSummary>();
-// Gtk::TreeModel::iterator iterFooter = m_model_available_parts_main->append();
+// auto iterFooter = m_model_available_parts_main->append();
// (*iterFooter)[m_model_available_parts_main->m_columns.m_col_item] =
std::make_shared<LayoutItem_Footer>();
}
@@ -132,16 +132,16 @@ Dialog_Layout_Report::Dialog_Layout_Report(BaseObjectType* cobject, const Glib::
{
m_model_available_parts_headerfooter = type_model::create();
- Gtk::TreeModel::iterator iterVerticalGroup = m_model_available_parts_headerfooter->append();
+ auto iterVerticalGroup = m_model_available_parts_headerfooter->append();
(*iterVerticalGroup)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_VerticalGroup>();
- Gtk::TreeModel::iterator iterField =
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
+ auto iterField = m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
(*iterField)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_Field>();
- Gtk::TreeModel::iterator iterText =
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
+ auto iterText = m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
(*iterText)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_Text>();
- Gtk::TreeModel::iterator iterImage =
m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
+ auto iterImage = m_model_available_parts_headerfooter->append(iterVerticalGroup->children());
(*iterImage)[m_model_available_parts_headerfooter->m_columns.m_col_item] =
std::make_shared<LayoutItem_Image>();
}
@@ -300,7 +300,7 @@ void Dialog_Layout_Report::add_group_children(const Glib::RefPtr<type_model>& mo
}
else
{
- Gtk::TreeModel::iterator iter = model_parts->append(parent->children());
+ auto iter = model_parts->append(parent->children());
Gtk::TreeModel::Row row = *iter;
row[model_parts->m_columns.m_col_item] = glom_sharedptr_clone(item);
}
@@ -394,7 +394,7 @@ void Dialog_Layout_Report::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelectionAvailable = m_treeview_available_parts->get_selection();
if(refSelectionAvailable)
{
- Gtk::TreeModel::iterator iter = refSelectionAvailable->get_selected();
+ auto iter = refSelectionAvailable->get_selected();
if(iter)
{
layout_item_available = (*iter)[m_model_available_parts_main->m_columns.m_col_item];
@@ -419,7 +419,7 @@ void Dialog_Layout_Report::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = treeview->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
layout_item_parent = (*iter)[model->m_columns.m_col_item];
@@ -433,7 +433,7 @@ void Dialog_Layout_Report::enable_buttons()
//Disable Down if It can't go any lower.
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
bool enable_down = true;
@@ -474,7 +474,7 @@ void Dialog_Layout_Report::enable_buttons()
//Maybe it can be a sibling of the parent instead (and that's what would happen if Add was clicked).
std::shared_ptr<LayoutItem> layout_item_parent_of_parent;
- Gtk::TreeModel::iterator iterParent = iter->parent();
+ auto iterParent = iter->parent();
if(iterParent)
layout_item_parent_of_parent = (*iterParent)[model->m_columns.m_col_item];
@@ -542,7 +542,7 @@ void Dialog_Layout_Report::on_button_delete()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = treeview->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
model->erase(iter);
@@ -563,10 +563,10 @@ void Dialog_Layout_Report::on_button_up()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = treeview->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
- Gtk::TreeModel::iterator parent = iter->parent();
+ auto parent = iter->parent();
bool is_first = false;
if(parent)
is_first = (iter == parent->children().begin());
@@ -575,7 +575,7 @@ void Dialog_Layout_Report::on_button_up()
if(!is_first)
{
- Gtk::TreeModel::iterator iterBefore = iter;
+ auto iterBefore = iter;
--iterBefore;
model->iter_swap(iter, iterBefore);
@@ -600,13 +600,13 @@ void Dialog_Layout_Report::on_button_down()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = treeview->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
- Gtk::TreeModel::iterator iterNext = iter;
+ auto iterNext = iter;
iterNext++;
- Gtk::TreeModel::iterator parent = iter->parent();
+ auto parent = iter->parent();
bool is_last = false;
if(parent)
is_last = (iterNext == parent->children().end());
@@ -636,7 +636,7 @@ void Dialog_Layout_Report::on_button_add()
Glib::RefPtr<type_model> model = get_selected_model();
Glib::RefPtr<type_model> model_available =
Glib::RefPtr<type_model>::cast_dynamic(m_treeview_available_parts->get_model());
- Gtk::TreeModel::iterator parent = get_selected_group_parent();
+ auto parent = get_selected_group_parent();
std::shared_ptr<const LayoutItem> pParentPart;
if(parent)
{
@@ -644,7 +644,7 @@ void Dialog_Layout_Report::on_button_add()
pParentPart = temp;
}
- Gtk::TreeModel::iterator available = get_selected_available();
+ auto available = get_selected_available();
std::shared_ptr<const LayoutItem> pAvailablePart;
if(available)
{
@@ -731,7 +731,7 @@ Gtk::TreeModel::iterator Dialog_Layout_Report::get_selected_group_parent() const
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = treeview->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -780,7 +780,7 @@ void Dialog_Layout_Report::on_button_formatting()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = treeview->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -812,7 +812,7 @@ void Dialog_Layout_Report::on_button_edit()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = treeview->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
//Do something different for each type of item:
diff --git a/glom/mode_design/report_layout/treestore_report_layout.cc
b/glom/mode_design/report_layout/treestore_report_layout.cc
index a2dce3e..2c3a5a7 100644
--- a/glom/mode_design/report_layout/treestore_report_layout.cc
+++ b/glom/mode_design/report_layout/treestore_report_layout.cc
@@ -67,7 +67,7 @@ bool TreeStore_ReportLayout::row_drop_possible_vfunc(const Gtk::TreeModel::Path&
return false; //Prevent a row from being dragged onto itself.
- Gtk::TreeModel::iterator iter_dragged_row = refThis->get_iter(path_dragged_row);
+ auto iter_dragged_row = refThis->get_iter(path_dragged_row);
if(!iter_dragged_row)
return false;
diff --git a/glom/mode_design/translation/combobox_locale.cc b/glom/mode_design/translation/combobox_locale.cc
index 574630d..f4c247f 100644
--- a/glom/mode_design/translation/combobox_locale.cc
+++ b/glom/mode_design/translation/combobox_locale.cc
@@ -35,7 +35,7 @@ ComboBox_Locale::ComboBox_Locale(BaseObjectType* cobject, const Glib::RefPtr<Gtk
const auto list_locales = IsoCodes::get_list_of_locales();
for(const auto& the_locale : list_locales)
{
- Gtk::TreeModel::iterator tree_iter = m_model->append();
+ auto tree_iter = m_model->append();
Gtk::TreeModel::Row row = *tree_iter;
row[m_model_columns.m_identifier] = the_locale.m_identifier;
@@ -64,7 +64,7 @@ ComboBox_Locale::~ComboBox_Locale()
Glib::ustring ComboBox_Locale::get_selected_locale() const
{
- Gtk::TreeModel::iterator iter = get_active();
+ auto iter = get_active();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
diff --git a/glom/mode_design/translation/window_translations.cc
b/glom/mode_design/translation/window_translations.cc
index 99f42e7..daad703 100644
--- a/glom/mode_design/translation/window_translations.cc
+++ b/glom/mode_design/translation/window_translations.cc
@@ -247,7 +247,7 @@ void Window_Translations::load_from_document()
if(item->get_title_original().empty())
continue;
- Gtk::TreeModel::iterator iterTree = m_model->append();
+ auto iterTree = m_model->append();
Gtk::TreeModel::Row row = *iterTree;
row[m_columns.m_col_item] = item;
diff --git a/glom/mode_design/users/dialog_groups_list.cc b/glom/mode_design/users/dialog_groups_list.cc
index a8c6e11..eca35ba 100644
--- a/glom/mode_design/users/dialog_groups_list.cc
+++ b/glom/mode_design/users/dialog_groups_list.cc
@@ -183,7 +183,7 @@ void Dialog_GroupsList::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_groups->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
m_button_group_users->set_sensitive(true);
@@ -204,7 +204,7 @@ void Dialog_GroupsList::on_button_group_delete()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_groups->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -274,7 +274,7 @@ void Dialog_GroupsList::on_button_group_users()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_groups->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -321,7 +321,7 @@ Glib::ustring Dialog_GroupsList::get_selected_group() const
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_groups->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -350,7 +350,7 @@ void Dialog_GroupsList::fill_group_list()
type_vec_strings group_list = Privs::get_database_groups();
for(const auto& group : group_list)
{
- Gtk::TreeModel::iterator iterTree = m_model_groups->append();
+ auto iterTree = m_model_groups->append();
Gtk::TreeModel::Row row = *iterTree;
row[m_model_columns_groups.m_col_name] = group;
@@ -365,7 +365,7 @@ void Dialog_GroupsList::fill_group_list()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_groups->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iterFirst = m_model_groups->children().begin();
+ auto iterFirst = m_model_groups->children().begin();
if(iterFirst)
{
refSelection->select(iterFirst);
@@ -396,7 +396,7 @@ void Dialog_GroupsList::fill_table_list(const Glib::ustring& group_name)
for(const auto& table : table_list)
{
- Gtk::TreeModel::iterator iterTree = m_model_tables->append();
+ auto iterTree = m_model_tables->append();
Gtk::TreeModel::Row row = *iterTree;
const auto table_name = table->get_name();
@@ -495,7 +495,7 @@ void Dialog_GroupsList::on_treeview_tables_toggled_view(const Glib::ustring& pat
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_tables->get_iter(path);
+ auto iter = m_model_tables->get_iter(path);
if(iter)
{
Gtk::TreeRow row = *iter;
@@ -534,7 +534,7 @@ void Dialog_GroupsList::on_treeview_tables_toggled_edit(const Glib::ustring& pat
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_tables->get_iter(path);
+ auto iter = m_model_tables->get_iter(path);
if(iter)
{
Gtk::TreeRow row = *iter;
@@ -558,7 +558,7 @@ void Dialog_GroupsList::on_treeview_tables_toggled_create(const Glib::ustring& p
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_tables->get_iter(path);
+ auto iter = m_model_tables->get_iter(path);
if(iter)
{
Gtk::TreeRow row = *iter;
@@ -582,7 +582,7 @@ void Dialog_GroupsList::on_treeview_tables_toggled_delete(const Glib::ustring& p
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_model_tables->get_iter(path);
+ auto iter = m_model_tables->get_iter(path);
if(iter)
{
Gtk::TreeRow row = *iter;
diff --git a/glom/mode_design/users/dialog_users_list.cc b/glom/mode_design/users/dialog_users_list.cc
index ae935fa..041e6d0 100644
--- a/glom/mode_design/users/dialog_users_list.cc
+++ b/glom/mode_design/users/dialog_users_list.cc
@@ -100,7 +100,7 @@ void Dialog_UsersList::enable_buttons()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_treeview_users->get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
m_button_user_edit->set_sensitive(true);
@@ -121,7 +121,7 @@ void Dialog_UsersList::on_button_user_remove()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_users->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
if(warn_about_empty_standard_group())
@@ -148,7 +148,7 @@ void Dialog_UsersList::on_button_user_delete()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_users->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
if(warn_about_empty_standard_group())
@@ -280,7 +280,7 @@ void Dialog_UsersList::on_button_user_edit()
Glib::RefPtr<Gtk::TreeSelection> refTreeSelection = m_treeview_users->get_selection();
if(refTreeSelection)
{
- Gtk::TreeModel::iterator iter = refTreeSelection->get_selected();
+ auto iter = refTreeSelection->get_selected();
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -381,7 +381,7 @@ void Dialog_UsersList::fill_list()
const auto user_list = Privs::get_database_users(group_name);
for(const auto& user : user_list)
{
- Gtk::TreeModel::iterator iterTree = m_model_users->append();
+ auto iterTree = m_model_users->append();
Gtk::TreeModel::Row row = *iterTree;
row[m_model_columns_users.m_col_name] = Privs::get_user_visible_group_name(user);
diff --git a/glom/navigation/box_tables.cc b/glom/navigation/box_tables.cc
index 407a357..40a0242 100644
--- a/glom/navigation/box_tables.cc
+++ b/glom/navigation/box_tables.cc
@@ -202,7 +202,7 @@ bool Box_Tables::fill_from_database()
if(bAddIt)
{
- Gtk::TreeModel::iterator iter = m_AddDel.add_item(strName);
+ auto iter = m_AddDel.add_item(strName);
fill_table_row(iter, table_info);
}
}
@@ -274,11 +274,11 @@ void Box_Tables::on_adddel_Add(const Gtk::TreeModel::iterator& row)
void Box_Tables::on_adddel_Delete(const Gtk::TreeModel::iterator& rowStart, const Gtk::TreeModel::iterator&
rowEnd)
{
- Gtk::TreeModel::iterator iterAfter = rowEnd;
+ auto iterAfter = rowEnd;
++iterAfter;
bool something_changed = false;
- for(Gtk::TreeModel::iterator iter = rowStart; iter != iterAfter; ++iter)
+ for(auto iter = rowStart; iter != iterAfter; ++iter)
{
const auto table_name = m_AddDel.get_value_key(iter);
diff --git a/glom/utility_widgets/adddel/adddel.cc b/glom/utility_widgets/adddel/adddel.cc
index 0e3b965..bd501b1 100644
--- a/glom/utility_widgets/adddel/adddel.cc
+++ b/glom/utility_widgets/adddel/adddel.cc
@@ -173,7 +173,7 @@ AddDel::on_MenuPopup_activate_Edit()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_TreeView.get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
//Discover whether it's the last (empty) row:
@@ -192,7 +192,7 @@ AddDel::on_MenuPopup_activate_Edit()
bool bRowAdded = true;
//The rows might be re-ordered:
- Gtk::TreeModel::iterator rowAdded = iter;
+ auto rowAdded = iter;
Glib::ustring strValue_Added = get_value_key(iter);
if(strValue_Added != strValue)
rowAdded = get_row(strValue);
@@ -219,7 +219,7 @@ void AddDel::on_MenuPopup_activate_Delete()
Glib::RefPtr<Gtk::TreeView::Selection> refSelection = m_TreeView.get_selection();
if(refSelection)
{
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
{
//TODO: We can't handle multiple-selections yet.
@@ -278,7 +278,7 @@ bool AddDel::on_button_press_event_Popup(GdkEventButton *event)
Gtk::TreeModel::iterator AddDel::get_item_placeholder()
{
//Get the existing placeholder row, or add one if necessary:
- Gtk::TreeModel::iterator iter = get_last_row();
+ auto iter = get_last_row();
if( get_is_placeholder_row(iter) )
{
return iter;
@@ -291,7 +291,7 @@ Gtk::TreeModel::iterator AddDel::get_item_placeholder()
Gtk::TreeModel::iterator AddDel::add_item_placeholder()
{
- Gtk::TreeModel::iterator iter = m_refListStore->append();
+ auto iter = m_refListStore->append();
if(iter)
{
iter->set_value(m_col_key, Glib::ustring("")); //Remove temporary key value.
@@ -303,7 +303,7 @@ Gtk::TreeModel::iterator AddDel::add_item_placeholder()
Gtk::TreeModel::iterator AddDel::add_item(const Glib::ustring& strKey)
{
- Gtk::TreeModel::iterator result = get_next_available_row_with_add_if_necessary();
+ auto result = get_next_available_row_with_add_if_necessary();
if(result)
{
@@ -326,7 +326,7 @@ void AddDel::remove_all()
if(m_refListStore)
{
- Gtk::TreeModel::iterator iter = m_refListStore->children().begin();
+ auto iter = m_refListStore->children().begin();
while(iter)
{
m_refListStore->erase(iter);
@@ -398,7 +398,7 @@ Gtk::TreeModel::iterator AddDel::get_item_selected()
Gtk::TreeModel::iterator AddDel::get_row(const Glib::ustring& key)
{
- for(Gtk::TreeModel::iterator iter = m_refListStore->children().begin(); iter !=
m_refListStore->children().end(); ++iter)
+ for(auto iter = m_refListStore->children().begin(); iter != m_refListStore->children().end(); ++iter)
{
const auto strTemp = get_value(iter, m_col_key);
if(strTemp == key)
@@ -457,7 +457,7 @@ bool AddDel::select_item(const Gtk::TreeModel::iterator& iter, guint column, boo
bool AddDel::select_item(const Glib::ustring& strItemText, guint column, bool start_editing)
{
- Gtk::TreeModel::iterator iter = get_row(strItemText);
+ auto iter = get_row(strItemText);
if(iter)
{
return select_item(iter, column, start_editing);
@@ -492,7 +492,7 @@ void AddDel::add_blank()
if(get_allow_user_actions()) //The extra blank line is only used if the user may add items:
{
- Gtk::TreeModel::iterator iter = get_last_row();
+ auto iter = get_last_row();
if(get_is_placeholder_row(iter))
{
bAddNewBlank = false; //One already exists.
@@ -555,11 +555,10 @@ void AddDel::construct_specified_columns()
Gtk::TreeModel::ColumnRecord record;
{
type_vecModelColumns::size_type i = 0;
- for(type_ColumnTypes::iterator iter = m_ColumnTypes.begin(); iter != m_ColumnTypes.end(); ++iter)
+ for(const auto& column_info : m_ColumnTypes)
{
Gtk::TreeModelColumnBase* pModelColumn = 0;
- AddDelColumnInfo column_info = *iter;
switch(column_info.m_style)
{
//Create an appropriate type of Model Column:
@@ -598,10 +597,8 @@ void AddDel::construct_specified_columns()
//Add new View Colums:
int model_column_index = 0;
int view_column_index = 0;
- for(type_vecModelColumns::iterator iter = vecModelColumns.begin(); iter != vecModelColumns.end(); ++iter)
+ for(const auto& pModelColumn : vecModelColumns)
{
- type_vecModelColumns::value_type& pModelColumn = *iter;
-
if(m_ColumnTypes[model_column_index].m_visible)
{
const Glib::ustring column_name = m_ColumnTypes[model_column_index].m_name;
@@ -699,10 +696,8 @@ void AddDel::construct_specified_columns()
//Delete the vector's items:
model_column_index = 0;
- for(type_vecModelColumns::iterator iter = vecModelColumns.begin(); iter != vecModelColumns.end(); ++iter)
+ for(auto& pModelColumn : vecModelColumns)
{
- Gtk::TreeModelColumnBase* pModelColumn = *iter;
-
if(model_column_index < (int)m_ColumnTypes.size())
{
AddDelColumnInfo::enumStyles style = m_ColumnTypes[model_column_index].m_style;
@@ -730,7 +725,7 @@ void AddDel::construct_specified_columns()
}
}
- *iter = 0;
+ pModelColumn = 0;
}
else
{
@@ -1023,7 +1018,7 @@ void AddDel::remove_item(const Gtk::TreeModel::iterator& iter)
void AddDel::remove_item_by_key(const Glib::ustring& strKey)
{
- Gtk::TreeModel::iterator iter = get_row(strKey);
+ auto iter = get_row(strKey);
remove_item(iter);
}
@@ -1078,7 +1073,7 @@ void AddDel::on_treeview_cell_edited_bool(const Glib::ustring& path_string, int
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
+ auto iter = m_refListStore->get_iter(path);
if(iter)
{
Gtk::TreeModel::Row row = *iter;
@@ -1153,7 +1148,7 @@ void AddDel::on_treeview_cell_edited(const Glib::ustring& path_string, const Gli
Gtk::TreeModel::Path path(path_string);
//Get the row from the path:
- Gtk::TreeModel::iterator iter = m_refListStore->get_iter(path);
+ auto iter = m_refListStore->get_iter(path);
if(iter != get_model()->children().end())
{
Gtk::TreeModel::Row row = *iter;
@@ -1270,7 +1265,7 @@ void AddDel::on_treeview_cell_editing_started(Gtk::CellEditable* /* editable */,
if(!m_refListStore)
return;
- Gtk::TreeModel::iterator iterRow = m_refListStore->get_iter(path);
+ auto iterRow = m_refListStore->get_iter(path);
if(iterRow)
signal_user_activated().emit(iterRow, model_column_index);
}
@@ -1357,9 +1352,9 @@ void AddDel::on_treeview_columns_changed()
typedef std::vector<Gtk::TreeViewColumn*> type_vecViewColumns;
type_vecViewColumns vecViewColumns = m_TreeView.get_columns();
- for(type_vecViewColumns::iterator iter = vecViewColumns.begin(); iter != vecViewColumns.end(); ++iter)
+ for(const auto& item : vecViewColumns)
{
- TreeViewColumnGlom* pViewColumn = dynamic_cast<TreeViewColumnGlom*>(*iter);
+ TreeViewColumnGlom* pViewColumn = dynamic_cast<TreeViewColumnGlom*>(item);
if(pViewColumn)
{
const auto column_id = pViewColumn->get_column_id();
@@ -1415,7 +1410,7 @@ Gtk::TreeModel::iterator AddDel::get_next_available_row_with_add_if_necessary()
if(get_allow_user_actions()) //The extra blank line is only used if the user may add items:
{
- Gtk::TreeModel::iterator iter = get_last_row();
+ auto iter = get_last_row();
if(iter != get_model()->children().end())
{
@@ -1449,7 +1444,7 @@ Gtk::TreeModel::iterator AddDel::get_next_available_row_with_add_if_necessary()
Gtk::TreeModel::iterator AddDel::get_last_row() const
{
//TODO_performance: Hopefully there is a better way to do this.
- Gtk::TreeModel::iterator iter = get_model()->children().begin();
+ auto iter = get_model()->children().begin();
guint size = get_model()->children().size();
if(size > 1)
{
@@ -1465,7 +1460,7 @@ Gtk::TreeModel::iterator AddDel::get_last_row() const
Gtk::TreeModel::iterator AddDel::get_last_row()
{
//TODO_performance: Hopefully there is a better way to do this.
- Gtk::TreeModel::iterator iter = get_model()->children().begin();
+ auto iter = get_model()->children().begin();
guint size = get_model()->children().size();
if(size > 1)
{
@@ -1597,7 +1592,7 @@ bool AddDel::row_has_duplicates(const Gtk::TreeModel::iterator& iter) const
//std::cout << "value_text=" << value_text << std::endl;
//Look at each other row to see whether the value exists there already:
- for(Gtk::TreeModel::iterator iterCheck = m_refListStore->children().begin(); iterCheck !=
m_refListStore->children().end(); ++iterCheck)
+ for(auto iterCheck = m_refListStore->children().begin(); iterCheck !=
m_refListStore->children().end(); ++iterCheck)
{
if(iterCheck != iter) //Don't compare the row with itself
{
diff --git a/glom/utility_widgets/adddel/adddel_withbuttons.cc
b/glom/utility_widgets/adddel/adddel_withbuttons.cc
index 0af7ee3..56a2bff 100644
--- a/glom/utility_widgets/adddel/adddel_withbuttons.cc
+++ b/glom/utility_widgets/adddel/adddel_withbuttons.cc
@@ -75,7 +75,7 @@ void AddDel_WithButtons::on_button_add()
{
if(m_auto_add)
{
- Gtk::TreeModel::iterator iter = get_item_placeholder();
+ auto iter = get_item_placeholder();
if(iter)
{
guint first_visible = get_count_hidden_system_columns();
@@ -104,7 +104,7 @@ void AddDel_WithButtons::on_button_extra()
if(!refSelection)
return;
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(!iter)
return;
diff --git a/glom/utility_widgets/combo_textglade.cc b/glom/utility_widgets/combo_textglade.cc
index 392561b..027f9b1 100644
--- a/glom/utility_widgets/combo_textglade.cc
+++ b/glom/utility_widgets/combo_textglade.cc
@@ -41,7 +41,7 @@ void Combo_TextGlade::set_first_active()
if(!model)
return;
- Gtk::TreeModel::iterator iter = model->children().begin();
+ auto iter = model->children().begin();
set_active(iter);
}
diff --git a/glom/utility_widgets/flowtable.cc b/glom/utility_widgets/flowtable.cc
index 68ed70f..ee63e90 100644
--- a/glom/utility_widgets/flowtable.cc
+++ b/glom/utility_widgets/flowtable.cc
@@ -40,7 +40,7 @@ FlowTable::~FlowTable()
{
while(!m_list_hboxes.empty())
{
- type_list_hboxes::iterator iter = m_list_hboxes.begin();
+ auto iter = m_list_hboxes.begin();
Gtk::Box* hbox = *iter;
delete_and_forget_hbox(hbox);
}
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index d9c6ea4..8e55c57 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -328,7 +328,7 @@ void ImageGlom::show_image_data()
//std::cout << "mime_type=" << mime_type << std::endl;
fill_evince_supported_mime_types();
- const type_vec_ustrings::iterator iterFind =
+ const auto iterFind =
std::find(m_evince_supported_mime_types.begin(),
m_evince_supported_mime_types.end(),
mime_type);
@@ -402,7 +402,7 @@ void ImageGlom::show_image_data()
bool use_gdkpixbuf = false;
fill_gdkpixbuf_supported_mime_types();
- const type_vec_ustrings::iterator iterFind =
+ const auto iterFind =
std::find(m_gdkpixbuf_supported_mime_types.begin(),
m_gdkpixbuf_supported_mime_types.end(),
mime_type);
diff --git a/glom/variablesmap.cc b/glom/variablesmap.cc
index d1ff08f..d9552db 100644
--- a/glom/variablesmap.cc
+++ b/glom/variablesmap.cc
@@ -93,18 +93,18 @@ void VariablesMap::transfer_widgets_to_variables()
{
if(validate_widgets()) //If the widgets' data is correct. Useful to override.
{
- for(type_mapWidgetsToVariables::iterator iter = m_mapWidgetsToVariables.begin(); iter !=
m_mapWidgetsToVariables.end(); ++iter)
+ for(const auto& the_pair : m_mapWidgetsToVariables)
{
- transfer_one_widget(iter->first, true); //true = to_variable.
+ transfer_one_widget(the_pair.first, true); //true = to_variable.
}
}
}
void VariablesMap::transfer_variables_to_widgets()
{
- for(type_mapWidgetsToVariables::iterator iter = m_mapWidgetsToVariables.begin(); iter !=
m_mapWidgetsToVariables.end(); ++iter)
+ for(const auto& the_pair : m_mapWidgetsToVariables)
{
- transfer_one_widget(iter->first, false); //false = to_widget.
+ transfer_one_widget(the_pair.first, false); //false = to_widget.
}
}
@@ -112,7 +112,7 @@ void VariablesMap::transfer_variables_to_widgets()
void VariablesMap::transfer_one_widget(Gtk::Widget* pWidget, bool to_variable)
{
//Find the widget in the map:
- type_mapWidgetsToVariables::iterator iterFind = m_mapWidgetsToVariables.find(pWidget);
+ auto iterFind = m_mapWidgetsToVariables.find(pWidget);
if(iterFind != m_mapWidgetsToVariables.end())
{
//Get the variable for the widget:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]