* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "main.h"
#include "image-overlay.h"
+#include <config.h>
+
+#include "collect.h"
+#include "debug.h"
#include "filedata.h"
#include "histogram.h"
+#include "image-load.h"
#include "image.h"
#include "img-view.h"
+#include "intl.h"
#include "layout.h"
+#include "main-defines.h"
#include "osd.h"
#include "pixbuf-renderer.h"
#include "pixbuf-util.h"
+#include "slideshow.h"
#include "ui-fileops.h"
-#include "image-load.h"
/*
*----------------------------------------------------------------------------
*/
-typedef struct _OverlayStateData OverlayStateData;
-struct _OverlayStateData {
+struct OverlayStateData {
ImageWindow *imd;
ImageState changed_states;
NotifyType notify;
};
-typedef struct _OSDIcon OSDIcon;
-struct _OSDIcon {
+struct OSDIcon {
gboolean reset; /* reset on new image */
gint x; /* x, y offset */
gint y;
#define OSD_DATA "overlay-data"
-#define IMAGE_OSD_DEFAULT_DURATION 30
+enum {
+ IMAGE_OSD_DEFAULT_DURATION = 30
+};
-#define HISTOGRAM_HEIGHT 140
-#define HISTOGRAM_WIDTH 256
+enum {
+ HISTOGRAM_HEIGHT = 140,
+ HISTOGRAM_WIDTH = 256
+};
static void image_osd_timer_schedule(OverlayStateData *osd);
image_osd_set(imd, static_cast<OsdShowFlags>(OSD_SHOW_INFO | OSD_SHOW_STATUS));
return;
}
+
+ if (show & OSD_SHOW_HISTOGRAM)
+ {
+ image_osd_set(imd, OSD_SHOW_NOTHING);
+ }
else
{
- if (show & OSD_SHOW_HISTOGRAM)
- {
- image_osd_set(imd, OSD_SHOW_NOTHING);
- }
- else
- {
- image_osd_set(imd, static_cast<OsdShowFlags>(show | OSD_SHOW_HISTOGRAM));
- }
+ image_osd_set(imd, static_cast<OsdShowFlags>(show | OSD_SHOW_HISTOGRAM));
}
}
static GdkPixbuf *image_osd_info_render(OverlayStateData *osd)
{
GdkPixbuf *pixbuf = nullptr;
- gint width, height;
+ gint width;
+ gint height;
PangoLayout *layout;
const gchar *name;
gchar *text;
name = image_get_name(imd);
if (name)
{
- gint n, t;
+ gint n;
+ gint t;
CollectionData *cd;
CollectInfo *info;
GHashTable *vars;
if (!imd->unknown)
{
- gint w, h;
+ gint w;
+ gint h;
GdkPixbuf *load_pixbuf = image_loader_get_pixbuf(imd->il);
if (imd->delay_flip &&
if (active_marks > 0)
{
- GString *buf = g_string_sized_new(FILEDATA_MARKS_SIZE * 2);
+ GString *buf = g_string_sized_new(strlen(text) + 1 + FILEDATA_MARKS_SIZE * 2);
+
+ if (*text)
+ {
+ g_string_append_printf(buf, "%s\n", text);
+ }
for (mark = 0; mark < FILEDATA_MARKS_SIZE; mark++)
{
g_string_append_printf(buf, file_data_get_mark(fd, mark) ? " <span background='#FF00FF'>%c</span>" : " %c", '1' + (mark < 9 ? mark : -1) );
}
- if (*text)
- text2 = g_strdup_printf("%s\n%s", text, buf->str);
- else
- text2 = g_strdup(buf->str);
- g_string_free(buf, TRUE);
g_free(text);
- text = text2;
+ text = g_string_free(buf, FALSE);
}
if (with_hist)
return pixbuf;
}
+/**
+ * @brief Create non-standard icons for the OSD
+ * @param flag
+ * @returns
+ *
+ * IMAGE_OSD_COLOR
+ * \image html image-osd-color.png
+ * IMAGE_OSD_FIRST
+ * \image html image-osd-first.png
+ * IMAGE_OSD_ICON
+ * \image html image-osd-icon.png
+ * IMAGE_OSD_LAST
+ * \image html image-osd-last.png
+ * IMAGE_OSD_ROTATE_AUTO
+ * \image html image-osd-rotate-auto.png
+ *
+ */
static GdkPixbuf *image_osd_icon_pixbuf(ImageOSDFlag flag)
{
static GdkPixbuf **icons = nullptr;
}
}
-static void image_osd_state_cb(ImageWindow *UNUSED(imd), ImageState state, gpointer data)
+static void image_osd_state_cb(ImageWindow *, ImageState state, gpointer data)
{
auto osd = static_cast<OverlayStateData *>(data);
g_free(osd);
}
-static void image_osd_destroy_cb(GtkWidget *UNUSED(widget), gpointer data)
+static void image_osd_destroy_cb(GtkWidget *, gpointer data)
{
auto osd = static_cast<OverlayStateData *>(data);
void image_osd_copy_status(ImageWindow *src, ImageWindow *dest)
{
- Histogram *h_src, *h_dest;
+ Histogram *h_src;
+ Histogram *h_dest;
image_osd_set(dest, image_osd_get(src));
h_src = image_osd_get_histogram(src);