Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pr/1446'
Browse files Browse the repository at this point in the history
* upstream/pr/1446:
  middle click to fast create new instance of IOP

Fixes #1446
  • Loading branch information
LebedevRI committed Feb 23, 2017
2 parents 19e0452 + 9e479c2 commit 745e990
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/develop/imageop.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,21 @@ static void dt_iop_gui_duplicate_callback(GtkButton *button, gpointer user_data)
dt_iop_gui_duplicate(user_data, TRUE);
}

static void dt_iop_gui_multimenu_callback(GtkButton *button, gpointer user_data)
static void dt_iop_gui_multiinstance_callback(GtkButton *button, GdkEventButton *event, gpointer user_data)
{
dt_iop_module_t *module = (dt_iop_module_t *)user_data;
if(module->flags() & IOP_FLAGS_ONE_INSTANCE) return;

if(event->button == 2)
{
dt_iop_gui_copy_callback(button, user_data);
return;
}
else if(event->button == 3)
{
return;
}

GtkMenuShell *menu = GTK_MENU_SHELL(gtk_menu_new());
GtkWidget *item;

Expand Down Expand Up @@ -1881,8 +1891,10 @@ GtkWidget *dt_iop_gui_get_expander(dt_iop_module_t *module)
{
hw[idx] = dtgtk_button_new(dtgtk_cairo_paint_multiinstance, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER);
module->multimenu_button = GTK_WIDGET(hw[idx]);
gtk_widget_set_tooltip_text(GTK_WIDGET(hw[idx]), _("multiple instances actions"));
g_signal_connect(G_OBJECT(hw[idx]), "clicked", G_CALLBACK(dt_iop_gui_multimenu_callback), module);
gtk_widget_set_tooltip_text(GTK_WIDGET(hw[idx]),
_("multiple instances actions\nmiddle-click creates new instance"));
g_signal_connect(G_OBJECT(hw[idx]), "button-press-event", G_CALLBACK(dt_iop_gui_multiinstance_callback),
module);
gtk_widget_set_size_request(GTK_WIDGET(hw[idx++]), bs, bs);
}

Expand Down

0 comments on commit 745e990

Please sign in to comment.