Skip to content

Commit

Permalink
second window: some GUI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardoh committed Apr 12, 2019
1 parent 5855097 commit 0c31c64
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 36 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Expand Up @@ -161,6 +161,9 @@ when updating from the currently stable 2.4.x series, please bear in mind that y
displayed when the search text is empty. A darkroom shortcut can be
set to focus on the search box.

- A preview window has been added to the darkroom that displays the edited image
on a separate window.

- A new option 'skip' is added to the 'on conflic' setting on the export module
that skips the export if the file already exists.

Expand Down
51 changes: 24 additions & 27 deletions src/common/colorspaces.c
Expand Up @@ -929,29 +929,27 @@ void hsl2rgb(float rgb[3], float h, float s, float l)
rgb[2] = hue2rgb(m1, m2, h - (1.0 / 3.0));
}

static const char *_profile_names[] =
{
"", // 0th entry is a dummy for DT_COLORSPACE_FILE and not used
N_("sRGB"), // this is only used in error messages, no need for the (...) description
N_("Adobe RGB (compatible)"),
N_("linear Rec709 RGB"),
N_("linear Rec2020 RGB"),
N_("linear XYZ"),
N_("Lab"),
N_("linear infrared BGR"),
N_("system display profile"),
N_("embedded ICC profile"),
N_("embedded matrix"),
N_("standard color matrix"),
N_("enhanced color matrix"),
N_("vendor color matrix"),
N_("alternate color matrix"),
N_("BRG (experimental)"),
N_("export profile"),
N_("softproof profile"),
N_("work profile"),
N_("system display2 profile")
};
static const char *_profile_names[]
= { "", // 0th entry is a dummy for DT_COLORSPACE_FILE and not used
N_("sRGB"), // this is only used in error messages, no need for the (...) description
N_("Adobe RGB (compatible)"),
N_("linear Rec709 RGB"),
N_("linear Rec2020 RGB"),
N_("linear XYZ"),
N_("Lab"),
N_("linear infrared BGR"),
N_("system display profile"),
N_("embedded ICC profile"),
N_("embedded matrix"),
N_("standard color matrix"),
N_("enhanced color matrix"),
N_("vendor color matrix"),
N_("alternate color matrix"),
N_("BRG (experimental)"),
N_("export profile"),
N_("softproof profile"),
N_("work profile"),
N_("system display profile") };

static dt_colorspaces_color_profile_t *_create_profile(dt_colorspaces_color_profile_type_t type,
cmsHPROFILE profile, const char *name, int in_pos,
Expand Down Expand Up @@ -1222,10 +1220,9 @@ dt_colorspaces_t *dt_colorspaces_init()
res->profiles = g_list_append(
res->profiles, _create_profile(DT_COLORSPACE_DISPLAY, dt_colorspaces_create_srgb_profile(),
_("system display profile"), -1, -1, ++display_pos, ++category_pos, -1, -1));
res->profiles
= g_list_append(res->profiles, _create_profile(DT_COLORSPACE_DISPLAY2, dt_colorspaces_create_srgb_profile(),
_("system display2 profile"), -1, -1, -1, ++category_pos, -1,
++display2_pos));
res->profiles = g_list_append(
res->profiles, _create_profile(DT_COLORSPACE_DISPLAY2, dt_colorspaces_create_srgb_profile(),
_("system display profile"), -1, -1, -1, ++category_pos, -1, ++display2_pos));
// we want a v4 with parametric curve for input and a v2 with point trc for output
// see http://ninedegreesbelow.com/photography/lcms-make-icc-profiles.html#profile-variants-and-versions
// TODO: what about display?
Expand Down
33 changes: 28 additions & 5 deletions src/views/darkroom.c
Expand Up @@ -1311,6 +1311,25 @@ static gboolean _softproof_quickbutton_pressed(GtkWidget *widget, GdkEvent *even
}
}

static gboolean _second_window_quickbutton_pressed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
dt_develop_t *d = (dt_develop_t *)user_data;
GdkEventButton *e = (GdkEventButton *)event;

gtk_popover_set_relative_to(GTK_POPOVER(d->profile.floating_window), d->second_window.button);

if(e->button == 3)
{
_toolbar_show_popup(d->profile.floating_window);
return TRUE;
}
else
{
d->profile.timeout = g_timeout_add_seconds(1, _toolbar_show_popup, d->profile.floating_window);
return FALSE;
}
}

static gboolean _profile_quickbutton_released(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
dt_develop_t *d = (dt_develop_t *)user_data;
Expand Down Expand Up @@ -1529,7 +1548,7 @@ static void display2_profile_callback(GtkWidget *combo, gpointer user_data)
}

// profile not found, fall back to system display2 profile. shouldn't happen
fprintf(stderr, "can't find display2 profile `%s', using system display2 profile instead\n",
fprintf(stderr, "can't find preview display profile `%s', using system display profile instead\n",
dt_bauhaus_combobox_get_text(combo));
profile_changed = darktable.color_profiles->display2_type != DT_COLORSPACE_DISPLAY2;
darktable.color_profiles->display2_type = DT_COLORSPACE_DISPLAY2;
Expand Down Expand Up @@ -1743,6 +1762,10 @@ void gui_init(dt_view_t *self)
= dtgtk_togglebutton_new(dtgtk_cairo_paint_display2, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER, NULL);
g_signal_connect(G_OBJECT(dev->second_window.button), "clicked", G_CALLBACK(_second_window_quickbutton_clicked),
dev);
g_signal_connect(G_OBJECT(dev->second_window.button), "button-press-event",
G_CALLBACK(_second_window_quickbutton_pressed), dev);
g_signal_connect(G_OBJECT(dev->second_window.button), "button-release-event",
G_CALLBACK(_profile_quickbutton_released), dev);
gtk_widget_set_tooltip_text(dev->second_window.button, _("display a second darkroom image window"));
dt_view_manager_view_toolbox_add(darktable.view_manager, dev->second_window.button, DT_VIEW_DARKROOM);

Expand Down Expand Up @@ -1941,7 +1964,7 @@ void gui_init(dt_view_t *self)
dt_bauhaus_combobox_add(display_intent, _("absolute colorimetric"));

GtkWidget *display2_intent = dt_bauhaus_combobox_new(NULL);
dt_bauhaus_widget_set_label(display2_intent, NULL, _("display intent"));
dt_bauhaus_widget_set_label(display2_intent, NULL, _("preview display intent"));
gtk_box_pack_start(GTK_BOX(vbox), display2_intent, TRUE, TRUE, 0);
dt_bauhaus_combobox_add(display2_intent, _("perceptual"));
dt_bauhaus_combobox_add(display2_intent, _("relative colorimetric"));
Expand All @@ -1962,7 +1985,7 @@ void gui_init(dt_view_t *self)
GtkWidget *histogram_profile = dt_bauhaus_combobox_new(NULL);
dt_bauhaus_widget_set_label(softproof_profile, NULL, _("softproof profile"));
dt_bauhaus_widget_set_label(display_profile, NULL, _("display profile"));
dt_bauhaus_widget_set_label(display2_profile, NULL, _("display2 profile"));
dt_bauhaus_widget_set_label(display2_profile, NULL, _("preview display profile"));
dt_bauhaus_widget_set_label(histogram_profile, NULL, _("histogram profile"));
gtk_box_pack_start(GTK_BOX(vbox), softproof_profile, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox), display_profile, TRUE, TRUE, 0);
Expand Down Expand Up @@ -2020,7 +2043,7 @@ void gui_init(dt_view_t *self)
char *tooltip = g_strdup_printf(_("display ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
gtk_widget_set_tooltip_text(display_profile, tooltip);
g_free(tooltip);
tooltip = g_strdup_printf(_("display2 ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
tooltip = g_strdup_printf(_("preview display ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
gtk_widget_set_tooltip_text(display2_profile, tooltip);
g_free(tooltip);
tooltip = g_strdup_printf(_("softproof ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
Expand Down Expand Up @@ -3850,7 +3873,7 @@ static void _darkroom_display_second_window(dt_develop_t *dev)
_second_window_configure_ppd_dpi(dev);

gtk_window_set_icon_name(GTK_WINDOW(dev->second_window.second_wnd), "darktable");
gtk_window_set_title(GTK_WINDOW(dev->second_window.second_wnd), "darktable");
gtk_window_set_title(GTK_WINDOW(dev->second_window.second_wnd), _("darktable - darkroom preview"));

GtkWidget *container = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(dev->second_window.second_wnd), container);
Expand Down
8 changes: 4 additions & 4 deletions src/views/lighttable.c
Expand Up @@ -3997,7 +3997,7 @@ static void display2_profile_callback(GtkWidget *combo, gpointer user_data)
}

// profile not found, fall back to system display2 profile. shouldn't happen
fprintf(stderr, "can't find display2 profile `%s', using system display2 profile instead\n",
fprintf(stderr, "can't find preview display profile `%s', using system display profile instead\n",
dt_bauhaus_combobox_get_text(combo));
profile_changed = darktable.color_profiles->display2_type != DT_COLORSPACE_DISPLAY2;
darktable.color_profiles->display2_type = DT_COLORSPACE_DISPLAY2;
Expand Down Expand Up @@ -4118,7 +4118,7 @@ void gui_init(dt_view_t *self)
dt_bauhaus_combobox_add(display_intent, _("absolute colorimetric"));

GtkWidget *display2_intent = dt_bauhaus_combobox_new(NULL);
dt_bauhaus_widget_set_label(display2_intent, NULL, _("display2 intent"));
dt_bauhaus_widget_set_label(display2_intent, NULL, _("preview display intent"));
gtk_box_pack_start(GTK_BOX(vbox), display2_intent, TRUE, TRUE, 0);
dt_bauhaus_combobox_add(display2_intent, _("perceptual"));
dt_bauhaus_combobox_add(display2_intent, _("relative colorimetric"));
Expand All @@ -4130,7 +4130,7 @@ void gui_init(dt_view_t *self)
gtk_box_pack_start(GTK_BOX(vbox), display_profile, TRUE, TRUE, 0);

GtkWidget *display2_profile = dt_bauhaus_combobox_new(NULL);
dt_bauhaus_widget_set_label(display2_profile, NULL, _("display2 profile"));
dt_bauhaus_widget_set_label(display2_profile, NULL, _("preview display profile"));
gtk_box_pack_start(GTK_BOX(vbox), display2_profile, TRUE, TRUE, 0);

for(GList *profiles = darktable.color_profiles->profiles; profiles; profiles = g_list_next(profiles))
Expand Down Expand Up @@ -4163,7 +4163,7 @@ void gui_init(dt_view_t *self)
char *tooltip = g_strdup_printf(_("display ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
gtk_widget_set_tooltip_text(display_profile, tooltip);
g_free(tooltip);
tooltip = g_strdup_printf(_("display2 ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
tooltip = g_strdup_printf(_("preview display ICC profiles in %s or %s"), user_profile_dir, system_profile_dir);
gtk_widget_set_tooltip_text(display2_profile, tooltip);
g_free(tooltip);
g_free(system_profile_dir);
Expand Down

0 comments on commit 0c31c64

Please sign in to comment.