@@ -41,29 +41,12 @@ typedef enum _style_items_columns_t
4141 DT_HIST_ITEMS_NUM_COLS
4242} _styles_columns_t ;
4343
44- static gboolean _gui_hist_is_copy_module_order_set (dt_history_copy_item_t * d )
44+ static void _gui_hist_iop_order_toggled (GtkToggleButton * button ,
45+ gpointer data )
4546{
46- /* iterate through TreeModel to find if module order was copied
47- * (num=-1 and active) */
48- GtkTreeIter iter ;
49- GtkTreeModel * model = gtk_tree_view_get_model (GTK_TREE_VIEW (d -> items ));
50-
51- gboolean active = FALSE;
52- gboolean module_order_was_copied = FALSE;
53- gint num = 0 ;
54-
55- gtk_tree_model_get_iter_first (model , & iter );
56- do
57- {
58- gtk_tree_model_get (model , & iter ,
59- DT_HIST_ITEMS_COL_ENABLED , & active ,
60- DT_HIST_ITEMS_COL_NUM , & num ,
61- -1 );
62- if (active && (num == -1 )) module_order_was_copied = TRUE;
63- }
64- while (gtk_tree_model_iter_next (model , & iter ));
47+ dt_history_copy_item_t * d = (dt_history_copy_item_t * )data ;
6548
66- return module_order_was_copied ;
49+ d -> copy_iop_order = gtk_toggle_button_get_active ( button ) ;
6750}
6851
6952static GList * _gui_hist_get_active_items (dt_history_copy_item_t * d )
@@ -86,7 +69,7 @@ static GList *_gui_hist_get_active_items(dt_history_copy_item_t *d)
8669 DT_HIST_ITEMS_COL_NUM , & num ,
8770 -1 );
8871
89- if (active && num >= 0 )
72+ if (active )
9073 result = g_list_prepend (result , GINT_TO_POINTER (autoinit ? - num : num ));
9174
9275 } while (gtk_tree_model_iter_next (model , & iter ));
@@ -130,13 +113,11 @@ static void _gui_hist_copy_response(GtkDialog *dialog,
130113
131114 case GTK_RESPONSE_OK :
132115 g -> selops = _gui_hist_get_active_items (g );
133- g -> copy_iop_order = _gui_hist_is_copy_module_order_set (g );
134116 g -> paste_mode = DT_HISTORY_COPY_APPEND ;
135117 break ;
136118
137119 case GTK_RESPONSE_APPLY :
138120 g -> selops = _gui_hist_get_active_items (g );
139- g -> copy_iop_order = _gui_hist_is_copy_module_order_set (g );
140121 g -> paste_mode = DT_HISTORY_COPY_OVERWRITE ;
141122 break ;
142123 }
@@ -352,21 +333,6 @@ int dt_gui_hist_dialog_new(dt_history_copy_item_t *d,
352333 }
353334 }
354335 g_list_free_full (items , dt_history_item_free );
355-
356- /* last item is for copying the module order, or if paste and was selected */
357- if (iscopy || d -> copy_iop_order )
358- {
359- const dt_iop_order_t order = dt_ioppr_get_iop_order_version (imgid );
360- char * label = g_strdup_printf ("%s (%s)" , _ ("module order" ),
361- dt_iop_order_string (order ));
362- gtk_list_store_insert_with_values (liststore , NULL , -1 ,
363- DT_HIST_ITEMS_COL_ENABLED , d -> copy_iop_order ,
364- DT_HIST_ITEMS_COL_ISACTIVE , is_active_pb ,
365- DT_HIST_ITEMS_COL_NAME , label ,
366- DT_HIST_ITEMS_COL_NUM , -1 ,
367- -1 );
368- g_free (label );
369- }
370336 }
371337 else
372338 {
@@ -378,6 +344,17 @@ int dt_gui_hist_dialog_new(dt_history_copy_item_t *d,
378344 G_CALLBACK (tree_on_row_activated ), GTK_WIDGET (dialog ));
379345 g_object_unref (liststore );
380346
347+ // the module order travels as a whole, not as one of the items above
348+ const dt_iop_order_t order = dt_ioppr_get_iop_order_version (imgid );
349+ char * label = g_strdup_printf ("%s (%s)" , _ ("module order" ),
350+ dt_iop_order_string (order ));
351+ GtkWidget * iop_order = gtk_check_button_new_with_label (label );
352+ g_free (label );
353+
354+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (iop_order ), d -> copy_iop_order );
355+ g_signal_connect (iop_order , "toggled" , G_CALLBACK (_gui_hist_iop_order_toggled ), d );
356+ dt_gui_dialog_add (GTK_DIALOG (dialog ), iop_order );
357+
381358 g_signal_connect (dialog , "response" , G_CALLBACK (_gui_hist_copy_response ), d );
382359
383360 gtk_widget_show_all (GTK_WIDGET (dialog ));
@@ -404,6 +381,8 @@ void dt_gui_hist_dialog_init(dt_history_copy_item_t *d)
404381 d -> selops = NULL ;
405382 d -> copied_imageid = NO_IMGID ;
406383 d -> copy_iop_order = FALSE;
384+ d -> full_copy = FALSE;
385+ d -> paste_mode = DT_HISTORY_COPY_APPEND ;
407386}
408387
409388// clang-format off
0 commit comments