icon_book.png \
icon_config.png \
icon_tools.png \
- icon_view.png
+ icon_view.png \
+ icon_guidelines.png
ICONS_INLINE_PAIRS = \
folder_closed $(srcdir)/folder_closed.png \
icon_book $(srcdir)/icon_book.png \
icon_config $(srcdir)/icon_config.png \
icon_tools $(srcdir)/icon_tools.png \
- icon_view $(srcdir)/icon_view.png
+ icon_view $(srcdir)/icon_view.png \
+ icon_guidelines $(srcdir)/icon_guidelines.png
icons_inline.h: $(ICONS_INLINE) Makefile.in
@sh -ec "echo '/* Auto generated file, do not edit */'; echo; \
Histogram *histogram;
OsdShowFlags show;
+ OverlayRendererFlags origin;
gint ovl_info;
}
else
{
- if (show & OSD_SHOW_HISTOGRAM)
+ if (show & OSD_SHOW_GUIDELINES)
{
image_osd_set(imd, OSD_SHOW_NOTHING);
}
+ else if (show & OSD_SHOW_HISTOGRAM)
+ {
+ image_osd_set(imd, OSD_SHOW_GUIDELINES);
+ image_osd_set(imd, show | ~OSD_SHOW_HISTOGRAM);
+ }
else
{
image_osd_set(imd, show | OSD_SHOW_HISTOGRAM);
return icon;
}
+static GdkPixbuf *image_osd_guidelines_render(OverlayStateData *osd)
+{
+ gint width, height;
+ GdkPixbuf *rectangles;
+ ImageWindow *imd = osd->imd;
+
+ pixbuf_renderer_get_scaled_size((PixbufRenderer *)imd->pr, &width, &height);
+
+ if (width && height)
+ {
+ rectangles = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
+ if (rectangles)
+ {
+ pixbuf_set_rect_fill(rectangles, 0, 0, width, height, 255, 255, 255, 0);
+ pixbuf_set_rect(rectangles, 0, 0 + (height / 3), width, height / 3,
+ 0, 0, 0, 255,
+ 1, 1, 1, 1);
+ pixbuf_set_rect(rectangles, 0, 0 + (height / 3 + 1), width, height / 3 - 2,
+ 255, 255, 255, 255,
+ 1, 1, 1, 1);
+
+ pixbuf_set_rect(rectangles, 0 + width / 3, 0 , width / 3, height,
+ 0, 0, 0, 255,
+ 1, 1, 1, 1);
+ pixbuf_set_rect(rectangles, 0 + width / 3 + 1, 0, width / 3 - 2, height,
+ 255, 255, 255, 255,
+ 1, 1, 1, 1);
+ return rectangles;
+ }
+ }
+
+ return NULL;
+}
+
static gint image_overlay_add(ImageWindow *imd, GdkPixbuf *pixbuf, gint x, gint y,
OverlayRendererFlags flags)
{
{
if (osd->ovl_info == 0)
{
- osd->ovl_info = image_overlay_add(osd->imd, pixbuf, osd->x, osd->y, OVL_RELATIVE);
+ osd->ovl_info = image_overlay_add(osd->imd, pixbuf, osd->x, osd->y, osd->origin);
}
else
{
with histogram we have to redraw also when loading is finished */
if (osd->changed_states & IMAGE_STATE_IMAGE ||
(osd->changed_states & IMAGE_STATE_LOADING && osd->show & OSD_SHOW_HISTOGRAM) ||
+ (osd->changed_states & IMAGE_STATE_LOADING && osd->show & OSD_SHOW_GUIDELINES) ||
osd->notify & NOTIFY_HISTMAP)
{
GdkPixbuf *pixbuf;
- pixbuf = image_osd_info_render(osd);
- if (pixbuf)
+ if (osd->show & OSD_SHOW_GUIDELINES)
{
- image_osd_info_show(osd, pixbuf);
- g_object_unref(pixbuf);
+ ImageWindow *imd = osd->imd;
+ osd->x = ((PixbufRenderer *)imd->pr)->x_offset;
+ osd->y = ((PixbufRenderer *)imd->pr)->y_offset;
+ osd->origin = OVL_NORMAL;
+
+ pixbuf = image_osd_guidelines_render(osd);
+ if (pixbuf)
+ {
+ image_osd_info_show(osd, pixbuf);
+ g_object_unref(pixbuf);
+ }
+
+ osd->x = options->image_overlay.x;
+ osd->y = options->image_overlay.y;
+ osd->origin = OVL_RELATIVE;
}
else
{
- image_osd_info_hide(osd);
+ pixbuf = image_osd_info_render(osd);
+ if (pixbuf)
+ {
+ image_osd_info_show(osd, pixbuf);
+ g_object_unref(pixbuf);
+ }
+ else
+ {
+ image_osd_info_hide(osd);
+ }
}
}
}
osd->show = OSD_SHOW_NOTHING;
osd->x = options->image_overlay.x;
osd->y = options->image_overlay.y;
+ osd->origin = OVL_RELATIVE;
osd->histogram = histogram_new();
OSD_SHOW_NOTHING = 0,
OSD_SHOW_INFO = 1 << 0,
OSD_SHOW_STATUS = 1 << 1,
- OSD_SHOW_HISTOGRAM = 1 << 2
+ OSD_SHOW_HISTOGRAM = 1 << 2,
+ OSD_SHOW_GUIDELINES = 1 << 3
} OsdShowFlags;
void set_image_overlay_template_string(gchar **template_string, const gchar *value);
}
}
+static void layout_menu_guidelines_cb(GtkToggleAction *action, gpointer data)
+{
+ LayoutWindow *lw = data;
+
+ if (gtk_toggle_action_get_active(action))
+ {
+ OsdShowFlags flags = image_osd_get(lw->image);
+ image_osd_set(lw->image, OSD_SHOW_INFO | OSD_SHOW_STATUS | OSD_SHOW_GUIDELINES);
+ layout_util_sync_views(lw);
+ }
+ else
+ {
+ OsdShowFlags flags = image_osd_get(lw->image);
+ if (flags & OSD_SHOW_GUIDELINES)
+ image_osd_set(lw->image, OSD_SHOW_NOTHING);
+ }
+}
+
static void layout_menu_animate_cb(GtkToggleAction *action, gpointer data)
{
LayoutWindow *lw = data;
{ "Grayscale", NULL, N_("Toggle _grayscale"), "<shift>G", N_("Toggle grayscale"), CB(layout_menu_alter_desaturate_cb), FALSE},
{ "ImageOverlay", NULL, N_("Image _Overlay"), NULL, N_("Image Overlay"), CB(layout_menu_overlay_cb), FALSE },
{ "ImageHistogram", NULL, N_("_Show Histogram"), NULL, N_("Show Histogram"), CB(layout_menu_histogram_cb), FALSE },
+ { "ImageGuidelines", PIXBUF_INLINE_ICON_GUIDELINES, N_("_Show Guidelines"), NULL, N_("Show Guidelines"), CB(layout_menu_guidelines_cb), FALSE },
{ "RectangularSelection", NULL, N_("Rectangular Selection"), "<alt>R", N_("Rectangular Selection"), CB(layout_menu_rectangular_selection_cb), FALSE },
{ "Animate", NULL, N_("GIF _animation"), "A", N_("Toggle GIF animation"), CB(layout_menu_animate_cb), FALSE },
{ "ExifRotate", GTK_STOCK_ORIENTATION_PORTRAIT, N_("_Exif rotate"), "<alt>X", N_("Exif rotate"), CB(layout_menu_exif_rotate_cb), FALSE },
" </menu>"
" <menu action='OverlayMenu'>"
" <menuitem action='ImageOverlay'/>"
+" <menuitem action='ImageGuidelines'/>"
" <menuitem action='ImageHistogram'/>"
" <menuitem action='ImageOverlayCycle'/>"
" <separator/>"
action = gtk_action_group_get_action(lw->action_group, "ImageHistogram");
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), osd_flags & OSD_SHOW_HISTOGRAM);
+ action = gtk_action_group_get_action(lw->action_group, "ImageGuidelines");
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), osd_flags & OSD_SHOW_GUIDELINES);
+
action = gtk_action_group_get_action(lw->action_group, "ExifRotate");
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), options->image.exif_rotate_enable);
gchar *image_l_click_video_editor;
gboolean show_icon_names;
gboolean show_star_rating;
+ gboolean show_guidelines;
/* various */
gboolean tree_descend_subdirs;
{ PIXBUF_INLINE_ICON_CONFIG, icon_config },
{ PIXBUF_INLINE_ICON_TOOLS, icon_tools },
{ PIXBUF_INLINE_ICON_VIEW, icon_view },
+ { PIXBUF_INLINE_ICON_GUIDELINES, icon_guidelines },
{ NULL, NULL }
};
#define PIXBUF_INLINE_ICON_CONFIG "icon_config"
#define PIXBUF_INLINE_ICON_TOOLS "icon_tools"
#define PIXBUF_INLINE_ICON_VIEW "icon_view"
+#define PIXBUF_INLINE_ICON_GUIDELINES "icon_guidelines"
GdkPixbuf *pixbuf_copy_rotate_90(GdkPixbuf *src, gboolean counter_clockwise);
/* General Options */
WRITE_NL(); WRITE_BOOL(*options, show_icon_names);
WRITE_NL(); WRITE_BOOL(*options, show_star_rating);
+ WRITE_NL(); WRITE_BOOL(*options, show_guidelines);
WRITE_SEPARATOR();
WRITE_NL(); WRITE_BOOL(*options, tree_descend_subdirs);
/* General options */
if (READ_BOOL(*options, show_icon_names)) continue;
if (READ_BOOL(*options, show_star_rating)) continue;
+ if (READ_BOOL(*options, show_guidelines)) continue;
if (READ_BOOL(*options, tree_descend_subdirs)) continue;
if (READ_BOOL(*options, view_dir_list_single_click_enter)) continue;
{"ExifWin", N_("Exif window"), GTK_STOCK_FILE},
{"Thumbnails", N_("Show thumbnails"), PIXBUF_INLINE_ICON_THUMB},
{"ShowMarks", N_("Show marks"), GTK_STOCK_FILE},
+ {"ImageGuidelines", N_("Show guidelines"), PIXBUF_INLINE_ICON_GUIDELINES},
{"FloatTools", N_("Float file list"), PIXBUF_INLINE_ICON_FLOAT},
{"SBar", N_("Info sidebar"), GTK_STOCK_FILE},
{"SBarSort", N_("Sort manager"), GTK_STOCK_FILE},