@@ -57,16 +57,13 @@ struct LayoutConfig
5757
5858constexpr gint LAYOUT_STYLE_SIZE = 48 ;
5959
60- // @todo Use std::array
61- constexpr LayoutStyle layout_config_styles[] = {
60+ constexpr std::array<LayoutStyle, 4 > layout_config_styles{{
6261 /* 1, 2, 3 */
6362 { static_cast <LayoutLocation>(LAYOUT_LEFT | LAYOUT_TOP), static_cast <LayoutLocation>(LAYOUT_LEFT | LAYOUT_BOTTOM), LAYOUT_RIGHT },
6463 { static_cast <LayoutLocation>(LAYOUT_LEFT | LAYOUT_TOP), static_cast <LayoutLocation>(LAYOUT_RIGHT | LAYOUT_TOP), LAYOUT_BOTTOM },
6564 { LAYOUT_LEFT, static_cast <LayoutLocation>(LAYOUT_RIGHT | LAYOUT_TOP), static_cast <LayoutLocation>(LAYOUT_RIGHT | LAYOUT_BOTTOM) },
6665 { LAYOUT_TOP, static_cast <LayoutLocation>(LAYOUT_LEFT | LAYOUT_BOTTOM), static_cast <LayoutLocation>(LAYOUT_RIGHT | LAYOUT_BOTTOM) }
67- };
68-
69- constexpr gint layout_config_style_count = std::size(layout_config_styles);
66+ }};
7067
7168const gchar *layout_titles[] = { N_ (" Tools" ), N_ (" Files" ), N_ (" Image" ) };
7269
@@ -97,7 +94,7 @@ void layout_config_set_order(LayoutLocation l, gint n,
9794void layout_config_from_data (gint style, gint oa, gint ob, gint oc,
9895 LayoutLocation &la, LayoutLocation &lb, LayoutLocation &lc)
9996{
100- style = std::clamp (style, 0 , layout_config_style_count );
97+ style = std::clamp< int > (style, 0 , layout_config_styles. size () );
10198
10299 LayoutStyle ls = layout_config_styles[style];
103100
@@ -316,7 +313,7 @@ void layout_config_set(GtkWidget *widget, gint style, const gchar *order)
316313
317314 if (!lc) return ;
318315
319- style = std::clamp (style, 0 , layout_config_style_count );
316+ style = std::clamp< int > (style, 0 , layout_config_styles. size () );
320317 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lc->style_widgets [style]), TRUE );
321318
322319 gint a;
@@ -355,7 +352,6 @@ GtkWidget *layout_config_new()
355352 GtkListStore *store;
356353 GtkTreeViewColumn *column;
357354 GtkCellRenderer *renderer;
358- gint i;
359355
360356 auto *lc = new LayoutConfig ();
361357
@@ -365,7 +361,7 @@ GtkWidget *layout_config_new()
365361
366362 hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
367363 gq_gtk_box_pack_start (GTK_BOX (box), hbox, FALSE , FALSE , 0 );
368- for (i = 0 ; i < layout_config_style_count ; i++)
364+ for (size_t i = 0 ; i < layout_config_styles. size () ; i++)
369365 {
370366 group = layout_config_widget (group, hbox, i, lc);
371367 lc->style_widgets .push_back (group);
@@ -400,7 +396,7 @@ GtkWidget *layout_config_new()
400396
401397 gtk_tree_view_append_column (GTK_TREE_VIEW (lc->listview ), column);
402398
403- for (i = 0 ; i < 3 ; i++)
399+ for (gint i = 0 ; i < 3 ; i++)
404400 {
405401 GtkTreeIter iter;
406402
0 commit comments