Sort headers using clang-tidy
[geeqie.git] / src / pan-view / pan-view.cc
index c6111b8..8db42c2 100644 (file)
 
 #include "pan-view.h"
 
+#include <config.h>
+
 #include "bar-exif.h"
+#include "compat.h"
+#include "debug.h"
 #include "dnd.h"
 #include "editors.h"
 #include "exif.h"
 #include "fullscreen.h"
 #include "image.h"
 #include "img-view.h"
+#include "intl.h"
 #include "layout-util.h"
+#include "main-defines.h"
+#include "main.h"
 #include "menu.h"
 #include "metadata.h"
+#include "misc.h"
 #include "pan-calendar.h"
 #include "pan-folder.h"
 #include "pan-grid.h"
+#include "pan-item.h"
 #include "pan-timeline.h"
 #include "pan-util.h"
 #include "pan-view-filter.h"
 #include "pan-view-search.h"
+#include "pixbuf-renderer.h"
 #include "pixbuf-util.h"
 #include "thumb.h"
 #include "ui-fileops.h"
 #include <cmath>
 
 
-#define PAN_WINDOW_DEFAULT_WIDTH 720
-#define PAN_WINDOW_DEFAULT_HEIGHT 500
+enum {
+       PAN_WINDOW_DEFAULT_WIDTH = 720,
+       PAN_WINDOW_DEFAULT_HEIGHT = 500
+};
 
-#define PAN_TILE_SIZE 512
+enum {
+       PAN_TILE_SIZE = 512
+};
 
 #define ZOOM_INCREMENT 1.0
-#define ZOOM_LABEL_WIDTH 64
+enum {
+       ZOOM_LABEL_WIDTH = 64
+};
 
 
 #define PAN_PREF_GROUP         "pan_view_options"
@@ -333,7 +349,10 @@ static gboolean pan_window_request_tile_cb(PixbufRenderer *pr, gint x, gint y,
 
        for (i = (x / PAN_GRID_SIZE) * PAN_GRID_SIZE; i < x + width; i += PAN_GRID_SIZE)
                {
-               gint rx, ry, rw, rh;
+               gint rx;
+               gint ry;
+               gint rw;
+               gint rh;
 
                if (util_clip_region(x, y, width, height,
                                     i, y, 1, height,
@@ -346,7 +365,10 @@ static gboolean pan_window_request_tile_cb(PixbufRenderer *pr, gint x, gint y,
                }
        for (i = (y / PAN_GRID_SIZE) * PAN_GRID_SIZE; i < y + height; i += PAN_GRID_SIZE)
                {
-               gint rx, ry, rw, rh;
+               gint rx;
+               gint ry;
+               gint rw;
+               gint rh;
 
                if (util_clip_region(x, y, width, height,
                                     x, i, width, 1,
@@ -717,10 +739,13 @@ static void pan_grid_clear(PanWindow *pw)
 static void pan_grid_build(PanWindow *pw, gint width, gint height, gint grid_size)
 {
        GList *work;
-       gint col, row;
-       gint cw, ch;
+       gint col;
+       gint row;
+       gint cw;
+       gint ch;
        gint l;
-       gint i, j;
+       gint i;
+       gint j;
 
        pan_grid_clear(pw);
 
@@ -774,7 +799,10 @@ static void pan_grid_build(PanWindow *pw, gint width, gint height, gint grid_siz
                while (grid)
                        {
                        PanGrid *pg;
-                       gint rx, ry, rw, rh;
+                       gint rx;
+                       gint ry;
+                       gint rw;
+                       gint rh;
 
                        pg = static_cast<PanGrid *>(grid->data);
                        grid = grid->next;
@@ -928,7 +956,10 @@ static GList *pan_layout_intersect_l(GList *list, GList *item_list,
        while (work)
                {
                PanItem *pi;
-               gint rx, ry, rw, rh;
+               gint rx;
+               gint ry;
+               gint rw;
+               gint rh;
 
                pi = static_cast<PanItem *>(work->data);
                work = work->next;
@@ -1386,8 +1417,16 @@ void pan_info_update(PanWindow *pw, PanItem *pi)
        PanItem *pbox;
        PanItem *p;
        gchar *buf;
-       gint x1, y1, x2, y2, x3, y3;
-       gint x, y, w, h;
+       gint x1;
+       gint y1;
+       gint x2;
+       gint y2;
+       gint x3;
+       gint y3;
+       gint x;
+       gint y;
+       gint w;
+       gint h;
 
        if (pw->click_pi == pi) return;
        if (pi && !pi->fd) pi = nullptr;
@@ -1457,7 +1496,8 @@ void pan_info_update(PanWindow *pw, PanItem *pi)
 
        if (pw->info_image_size > PAN_IMAGE_SIZE_THUMB_NONE)
                {
-               gint iw, ih;
+               gint iw;
+               gint ih;
                if (image_load_dimensions(pi->fd, &iw, &ih))
                        {
                        gint scale = 25;
@@ -1515,7 +1555,8 @@ static void button_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data)
        auto pw = static_cast<PanWindow *>(data);
        PanItem *pi = nullptr;
        GtkWidget *menu;
-       gint rx, ry;
+       gint rx;
+       gint ry;
 
        rx = ry = 0;
        if (pr->scale)
@@ -1559,7 +1600,8 @@ static void button_cb(PixbufRenderer *pr, GdkEventButton *event, gpointer data)
 
 static void scroll_cb(PixbufRenderer *pr, GdkEventScroll *event, gpointer)
 {
-       gint w, h;
+       gint w;
+       gint h;
 
        w = pr->vis_width;
        h = pr->vis_height;
@@ -1658,7 +1700,8 @@ static void pan_window_image_scroll_notify_cb(PixbufRenderer *pr, gpointer data)
        auto pw = static_cast<PanWindow *>(data);
        GtkAdjustment *adj;
        GdkRectangle rect;
-       gint width, height;
+       gint width;
+       gint height;
 
        if (pr->scale == 0.0) return;
 
@@ -1776,7 +1819,7 @@ static void pan_window_close(PanWindow *pw)
        pan_fullscreen_toggle(pw, TRUE);
        pan_search_ui_destroy(&pw->search_ui);
        pan_filter_ui_destroy(&pw->filter_ui);
-       gtk_widget_destroy(pw->window);
+       gq_gtk_widget_destroy(pw->window);
 
        pan_window_items_free(pw);
        pan_cache_free(pw);
@@ -1830,7 +1873,7 @@ static void pan_window_new_real(FileData *dir_fd)
 
        pw->idle_id = 0;
 
-       pw->window = window_new(GTK_WINDOW_TOPLEVEL, "panview", nullptr, nullptr, _("Pan View"));
+       pw->window = window_new("panview", nullptr, nullptr, _("Pan View"));
        DEBUG_NAME(pw->window);
 
        geometry.min_width = DEFAULT_MINIMAL_WINDOW_SIZE;
@@ -1886,8 +1929,8 @@ static void pan_window_new_real(FileData *dir_fd)
        gtk_widget_show(combo);
 
        table = pref_table_new(vbox, 2, 2, FALSE, TRUE);
-       gtk_table_set_row_spacings(GTK_TABLE(table), 2);
-       gtk_table_set_col_spacings(GTK_TABLE(table), 2);
+       gtk_grid_set_row_spacing(GTK_GRID(table), 2);
+       gtk_grid_set_column_spacing(GTK_GRID(table), 2);
 
        pw->imd = image_new(TRUE);
        pw->imd_normal = pw->imd;
@@ -1897,8 +1940,7 @@ static void pan_window_new_real(FileData *dir_fd)
        g_signal_connect(G_OBJECT(pw->imd->pr), "scroll_notify",
                         G_CALLBACK(pan_window_image_scroll_notify_cb), pw);
 
-       gtk_table_attach(GTK_TABLE(table), pw->imd->widget, 0, 1, 0, 1,
-                        static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), pw->imd->widget, 0, 1, 0, 1, static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), 0, 0);
        gtk_widget_show(GTK_WIDGET(pw->imd->widget));
 
        pan_window_dnd_init(pw);
@@ -1908,15 +1950,13 @@ static void pan_window_new_real(FileData *dir_fd)
        pw->scrollbar_h = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, nullptr);
        g_signal_connect(G_OBJECT(pw->scrollbar_h), "value_changed",
                         G_CALLBACK(pan_window_scrollbar_h_value_cb), pw);
-       gtk_table_attach(GTK_TABLE(table), pw->scrollbar_h, 0, 1, 1, 2,
-                        static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), pw->scrollbar_h, 0, 1, 1, 2,  static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), static_cast<GtkAttachOptions>(0), 0, 0);
        gtk_widget_show(pw->scrollbar_h);
 
        pw->scrollbar_v = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, nullptr);
        g_signal_connect(G_OBJECT(pw->scrollbar_v), "value_changed",
                         G_CALLBACK(pan_window_scrollbar_v_value_cb), pw);
-       gtk_table_attach(GTK_TABLE(table), pw->scrollbar_v, 1, 2, 0, 1,
-                        static_cast<GtkAttachOptions>(0), static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), 0, 0);
+       gq_gtk_grid_attach(GTK_GRID(table), pw->scrollbar_v, 1, 2, 0, 1,  static_cast<GtkAttachOptions>(0), static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), 0, 0);
        gtk_widget_show(pw->scrollbar_v);
 
        /* find bar */
@@ -1934,7 +1974,7 @@ static void pan_window_new_real(FileData *dir_fd)
 
        frame = gtk_frame_new(nullptr);
        DEBUG_NAME(frame);
-       gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
+       gq_gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
        gtk_widget_set_size_request(frame, ZOOM_LABEL_WIDTH, -1);
        gq_gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 0);
        gtk_widget_show(frame);
@@ -1948,7 +1988,7 @@ static void pan_window_new_real(FileData *dir_fd)
 
        frame = gtk_frame_new(nullptr);
        DEBUG_NAME(frame);
-       gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
+       gq_gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
        gtk_widget_set_size_request(frame, ZOOM_LABEL_WIDTH, -1);
        gq_gtk_box_pack_end(GTK_BOX(box), frame, FALSE, FALSE, 0);
        gtk_widget_show(frame);
@@ -2009,7 +2049,7 @@ static gboolean pan_warning(FileData *dir_fd)
        GenericDialog *gd;
        GtkWidget *box;
        GtkWidget *group;
-       GtkWidget *button;
+       GtkWidget *checkbox;
        GtkWidget *ct_button;
        gboolean hide_dlg;
 
@@ -2041,9 +2081,9 @@ static gboolean pan_warning(FileData *dir_fd)
 
        ct_button = pref_checkbox_new_int(group, _("Cache thumbnails"),
                                          options->thumbnails.enable_caching, &options->thumbnails.enable_caching);
-       button = pref_checkbox_new_int(group, _("Use shared thumbnail cache"),
+       checkbox = pref_checkbox_new_int(group, _("Use shared thumbnail cache"),
                                       options->thumbnails.spec_standard, &options->thumbnails.spec_standard);
-       pref_checkbox_link_sensitivity(ct_button, button);
+       pref_checkbox_link_sensitivity(ct_button, checkbox);
 
        pref_line(box, 0);
 
@@ -2305,7 +2345,8 @@ static GtkWidget *pan_popup_menu(PanWindow *pw)
        GtkWidget *menu;
        GtkWidget *submenu;
        GtkWidget *item;
-       gboolean active, video;
+       gboolean active;
+       gboolean video;
        GList *editmenu_fd_list;
        GtkAccelGroup *accel_group;