/*
- * Geeqie
- * (C) 2006 John Ellis
- * Copyright (C) 2008 - 2010 The Geeqie Team
+ * Copyright (C) 2006 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
* Author: John Ellis
*
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "main.h"
#include "layout_config.h"
#include "layout_image.h"
#include "layout_util.h"
+#include "logwindow.h"
#include "menu.h"
#include "pixbuf-renderer.h"
#include "pixbuf_util.h"
#include "bar.h"
#include "bar_sort.h"
#include "preferences.h"
-
+#include "shortcuts.h"
#ifdef HAVE_LIRC
#include "lirc.h"
#endif
GList *work;
if (!id || !id[0]) return NULL;
-
+
if (strcmp(id, LAYOUT_ID_CURRENT) == 0)
{
if (current_lw) return current_lw;
char id[10];
gint i;
if (lw->options.id && lw->options.id[0]) return; /* id is already set */
-
+
g_free(lw->options.id);
lw->options.id = NULL;
-
+
if (!layout_find_by_layout_id("main"))
{
lw->options.id = g_strdup("main");
return;
}
-
+
i = 1;
while (TRUE)
{
return FALSE;
}
+static void layout_box_folders_changed_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutWindow *lw;
+ GList *work;
+
+/* FIXME: this is probably not the correct way to implement this */
+ work = layout_window_list;
+ while (work)
+ {
+ lw = work->data;
+ lw->options.folder_window.vdivider_pos = gtk_paned_get_position(GTK_PANED(widget));
+ work = work->next;
+ }
+}
+
/*
*-----------------------------------------------------------------------------
* menu, toolbar, and dir view
buf = g_strdup(path);
parse_out_relatives(buf);
-
+
if (isdir(buf))
{
if ((!lw->dir_fd || strcmp(lw->dir_fd->path, buf) != 0) && layout_set_path(lw, buf))
}
g_free(base);
}
-
+
g_free(buf);
}
static GtkWidget *layout_tool_setup(LayoutWindow *lw)
{
GtkWidget *box;
+ GtkWidget *box_folders;
+ GtkWidget *scd;
GtkWidget *menu_bar;
GtkWidget *tabcomp;
GtkWidget *toolbar;
menu_bar = layout_actions_menu_bar(lw);
gtk_box_pack_start(GTK_BOX(box), menu_bar, FALSE, FALSE, 0);
- gtk_widget_show(menu_bar);
toolbar = layout_actions_toolbar(lw, TOOLBAR_MAIN);
gtk_box_pack_start(GTK_BOX(box), toolbar, FALSE, FALSE, 0);
- if (!lw->options.toolbar_hidden) gtk_widget_show(toolbar);
+ if (lw->options.toolbar_hidden) gtk_widget_hide(toolbar);
tabcomp = tab_completion_new_with_history(&lw->path_entry, NULL, "path_list", -1,
layout_path_entry_cb, lw);
gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0);
gtk_widget_show(tabcomp);
- g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed",
+#if GTK_CHECK_VERSION(3,20,0)
+ g_signal_connect(G_OBJECT(gtk_widget_get_parent(gtk_widget_get_parent(lw->path_entry))), "changed",
+ G_CALLBACK(layout_path_entry_changed_cb), lw);
+#else
+ g_signal_connect(G_OBJECT(gtk_widget_get_parent(lw->path_entry)), "changed",
G_CALLBACK(layout_path_entry_changed_cb), lw);
+#endif
+
+ box_folders = GTK_WIDGET(gtk_hpaned_new());
+ gtk_box_pack_start(GTK_BOX(box), box_folders, TRUE, TRUE, 0);
lw->vd = vd_new(lw->options.dir_view_type, lw->dir_fd);
vd_set_layout(lw->vd, lw);
vd_set_select_func(lw->vd, layout_vd_select_cb, lw);
lw->dir_view = lw->vd->widget;
-
- gtk_box_pack_start(GTK_BOX(box), lw->dir_view, TRUE, TRUE, 0);
+ gtk_paned_add2(GTK_PANED(box_folders), lw->dir_view);
gtk_widget_show(lw->dir_view);
+ scd = shortcuts_new_default(lw);
+ gtk_paned_add1(GTK_PANED(box_folders), scd);
+ gtk_paned_set_position(GTK_PANED(box_folders), lw->options.folder_window.vdivider_pos);
+
+ gtk_widget_show(box_folders);
+
+ g_signal_connect(G_OBJECT(box_folders), "notify::position",
+ G_CALLBACK(layout_box_folders_changed_cb), lw);
+
gtk_widget_show(box);
return box;
static void layout_sort_menu_hide_cb(GtkWidget *widget, gpointer data)
{
/* destroy the menu */
-#if GTK_CHECK_VERSION(2,12,0)
g_object_unref(widget);
-#else
- gtk_widget_unref(GTK_WIDGET(widget));
-#endif
}
static void layout_sort_button_press_cb(GtkWidget *widget, gpointer data)
return button;
}
+static void layout_zoom_menu_cb(GtkWidget *widget, gpointer data)
+{
+ ZoomMode mode;
+
+ if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
+
+ mode = (ZoomMode)GPOINTER_TO_INT(data);
+ options->image.zoom_mode = mode;
+}
+
+static void layout_scroll_menu_cb(GtkWidget *widget, gpointer data)
+{
+ guint scroll_type;
+
+ if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) return;
+
+ scroll_type = GPOINTER_TO_UINT(data);
+ options->image.scroll_reset_method = scroll_type;
+ image_options_sync();
+}
+
+static void layout_zoom_menu_hide_cb(GtkWidget *widget, gpointer data)
+{
+ /* destroy the menu */
+ g_object_unref(widget);
+}
+
+static void layout_zoom_button_press_cb(GtkWidget *widget, gpointer data)
+{
+ LayoutWindow *lw = data;
+ GtkWidget *menu;
+ GdkEvent *event;
+ guint32 etime;
+
+ menu = submenu_add_zoom(NULL, G_CALLBACK(layout_zoom_menu_cb),
+ lw, FALSE, FALSE, TRUE, options->image.zoom_mode);
+
+ /* take ownership of menu */
+#ifdef GTK_OBJECT_FLOATING
+ /* GTK+ < 2.10 */
+ g_object_ref(G_OBJECT(menu));
+ gtk_object_sink(GTK_OBJECT(menu));
+#else
+ /* GTK+ >= 2.10 */
+ g_object_ref_sink(G_OBJECT(menu));
+#endif
+
+ menu_item_add_divider(menu);
+
+ menu_item_add_radio(menu, _("Scroll to top left corner"),
+ GUINT_TO_POINTER(SCROLL_RESET_TOPLEFT),
+ options->image.scroll_reset_method == SCROLL_RESET_TOPLEFT,
+ G_CALLBACK(layout_scroll_menu_cb),
+ GUINT_TO_POINTER(SCROLL_RESET_TOPLEFT));
+ menu_item_add_radio(menu, _("Scroll to image center"),
+ GUINT_TO_POINTER(SCROLL_RESET_CENTER),
+ options->image.scroll_reset_method == SCROLL_RESET_CENTER,
+ G_CALLBACK(layout_scroll_menu_cb),
+ GUINT_TO_POINTER(SCROLL_RESET_CENTER));
+ menu_item_add_radio(menu, _("Keep the region from previous image"),
+ GUINT_TO_POINTER(SCROLL_RESET_NOCHANGE),
+ options->image.scroll_reset_method == SCROLL_RESET_NOCHANGE,
+ G_CALLBACK(layout_scroll_menu_cb),
+ GUINT_TO_POINTER(SCROLL_RESET_NOCHANGE));
+
+ g_signal_connect(G_OBJECT(menu), "selection_done",
+ G_CALLBACK(layout_zoom_menu_hide_cb), NULL);
+
+ event = gtk_get_current_event();
+ if (event)
+ {
+ etime = gdk_event_get_time(event);
+ gdk_event_free(event);
+ }
+ else
+ {
+ etime = 0;
+ }
+
+ gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, etime);
+}
+
+static GtkWidget *layout_zoom_button(LayoutWindow *lw, GtkWidget *box, gint size, gboolean expand)
+{
+ GtkWidget *button;
+ GtkWidget *frame;
+
+
+ frame = gtk_frame_new(NULL);
+ if (size) gtk_widget_set_size_request(frame, size, -1);
+ gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
+
+ gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0);
+
+ gtk_widget_show(frame);
+
+ button = gtk_button_new_with_label("1:1");
+ g_signal_connect(G_OBJECT(button), "clicked",
+ G_CALLBACK(layout_zoom_button_press_cb), lw);
+ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
+
+ gtk_container_add(GTK_CONTAINER(frame), button);
+ gtk_widget_show(button);
+
+ return button;
+}
+
/*
*-----------------------------------------------------------------------------
* status bar
{
guint n;
gint64 n_bytes = 0;
-
+
n = layout_list_count(lw, &n_bytes);
-
+
if (n)
{
guint s;
{
ss = "";
}
-
+
s = layout_selection_count(lw, &s_bytes);
-
+
layout_bars_new_selection(lw, s);
-
+
if (s > 0)
{
gchar *b = text_from_size_abrev(n_bytes);
{
buf = g_strdup_printf(_("%d files%s"), n, ss);
}
-
+
text = buf;
-
+
image_osd_update(lw->image);
}
else
text = "";
}
}
-
+
if (lw->info_status) gtk_label_set_text(GTK_LABEL(lw->info_status), text);
g_free(buf);
}
void layout_status_update_image(LayoutWindow *lw)
{
guint64 n;
-
+
if (!layout_valid(&lw) || !lw->image) return;
+ if (!lw->info_zoom || !lw->info_details) return; /*called from layout_style_set */
n = layout_list_count(lw, NULL);
-
+
if (!n)
{
- gtk_label_set_text(GTK_LABEL(lw->info_zoom), "");
+ gtk_button_set_label(GTK_BUTTON(lw->info_zoom), "");
gtk_label_set_text(GTK_LABEL(lw->info_details), "");
}
else
gchar *b;
text = image_zoom_get_as_text(lw->image);
- gtk_label_set_text(GTK_LABEL(lw->info_zoom), text);
+ gtk_button_set_label(GTK_BUTTON(lw->info_zoom), text);
g_free(text);
b = image_get_fd(lw->image) ? text_from_size(image_get_fd(lw->image)->size) : g_strdup("0");
else
{
gint width, height;
-
+
image_get_image_size(lw->image, &width, &height);
text = g_strdup_printf(_("( %d x %d ) %s bytes"),
width, height, b);
}
g_signal_emit_by_name (lw->image->pr, "update-pixel");
-
+
g_free(b);
-
+
gtk_label_set_text(GTK_LABEL(lw->info_details), text);
g_free(text);
}
}
lw->info_progress_bar = gtk_progress_bar_new();
gtk_widget_set_size_request(lw->info_progress_bar, PROGRESS_WIDTH, -1);
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(lw->info_progress_bar), "");
+ gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(lw->info_progress_bar), TRUE);
+#endif
gtk_box_pack_start(GTK_BOX(hbox), lw->info_progress_bar, FALSE, FALSE, 0);
gtk_widget_show(lw->info_progress_bar);
lw->info_sort = layout_sort_button(lw);
+ gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_sort), _("Select sort order"));
gtk_box_pack_start(GTK_BOX(hbox), lw->info_sort, FALSE, FALSE, 0);
gtk_widget_show(lw->info_sort);
lw->info_status = layout_status_label(NULL, lw->info_box, TRUE, 0, (!small_format));
+ gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_status), _("Folder contents (files selected)"));
if (small_format)
{
gtk_widget_show(hbox);
}
lw->info_details = layout_status_label(NULL, hbox, TRUE, 0, TRUE);
+ gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_details), _("(Image dimensions) Image size"));
toolbar = layout_actions_toolbar(lw, TOOLBAR_STATUS);
-
+
toolbar_frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(toolbar_frame), GTK_SHADOW_IN);
gtk_container_add(GTK_CONTAINER(toolbar_frame), toolbar);
gtk_widget_show(toolbar_frame);
gtk_widget_show(toolbar);
gtk_box_pack_end(GTK_BOX(hbox), toolbar_frame, FALSE, FALSE, 0);
- lw->info_zoom = layout_status_label(NULL, hbox, FALSE, ZOOM_LABEL_WIDTH, FALSE);
+ lw->info_zoom = layout_zoom_button(lw, hbox, ZOOM_LABEL_WIDTH, TRUE);
+ gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_zoom), _("Select zoom mode"));
+ gtk_widget_show(lw->info_zoom);
+
if (small_format)
{
hbox = gtk_hbox_new(FALSE, 0);
gtk_widget_show(hbox);
}
lw->info_pixel = layout_status_label(NULL, hbox, FALSE, 0, small_format); /* expand only in small format */
+ gtk_widget_set_tooltip_text(GTK_WIDGET(lw->info_pixel), _("[Pixel x,y coord]: (Pixel R,G,B value)"));
if (!lw->options.show_info_pixel) gtk_widget_hide(gtk_widget_get_parent(lw->info_pixel));
}
vf_set_thumb_status_func(lw->vf, layout_list_thumb_cb, lw);
vf_marks_set(lw->vf, lw->options.show_marks);
-
+
layout_list_sync_thumb(lw);
return lw->vf->widget;
static void layout_list_scroll_to_subpart(LayoutWindow *lw, const gchar *needle)
{
if (!lw) return;
-#if 0
- if (lw->vf) vf_scroll_to_subpart(lw->vf, needle);
-#endif
}
GList *layout_list(LayoutWindow *lw)
gboolean ret;
if (!path) return FALSE;
-
- fd = file_data_new_simple(path);
+
+ fd = file_data_new_group(path);
ret = layout_set_fd(lw, fd);
file_data_unref(fd);
return ret;
file_data_unregister_real_time_monitor(lw->dir_fd);
file_data_unref(lw->dir_fd);
}
- lw->dir_fd = file_data_new_simple(base);
+ lw->dir_fd = file_data_new_dir(base);
file_data_register_real_time_monitor(lw->dir_fd);
g_free(base);
}
if (lw->path_entry) tab_completion_append_to_history(lw->path_entry, lw->dir_fd->path);
layout_sync_path(lw);
layout_list_sync_sort(lw);
-
+
if (have_file)
{
gint row;
lw->sort_method = type;
lw->sort_ascend = ascend;
- if (lw->info_sort) gtk_label_set_text(GTK_LABEL(GTK_BIN(lw->info_sort)->child),
+ if (lw->info_sort) gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(lw->info_sort))),
sort_type_get_text(type));
layout_list_sync_sort(lw);
}
gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h)
{
+ GdkWindow *window;
if (!layout_valid(&lw)) return FALSE;
- gdk_window_get_root_origin(lw->window->window, x, y);
- gdk_drawable_get_size(lw->window->window, w, h);
+ window = gtk_widget_get_window(lw->window);
+ gdk_window_get_root_origin(window, x, y);
+ *w = gdk_window_get_width(window);
+ *h = gdk_window_get_height(window);
return TRUE;
}
gboolean layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v)
{
+ GtkAllocation h_allocation;
+ GtkAllocation v_allocation;
+
if (!layout_valid(&lw)) return FALSE;
- if (lw->h_pane && GTK_PANED(lw->h_pane)->child1->allocation.x >= 0)
+ if (lw->h_pane)
+ {
+ GtkWidget *child = gtk_paned_get_child1(GTK_PANED(lw->h_pane));
+ gtk_widget_get_allocation(child, &h_allocation);
+ }
+
+ if (lw->v_pane)
+ {
+ GtkWidget *child = gtk_paned_get_child1(GTK_PANED(lw->v_pane));
+ gtk_widget_get_allocation(child, &v_allocation);
+ }
+
+ if (lw->h_pane && h_allocation.x >= 0)
{
- *h = GTK_PANED(lw->h_pane)->child1->allocation.width;
+ *h = h_allocation.width;
}
else if (h != &lw->options.main_window.hdivider_pos)
{
*h = lw->options.main_window.hdivider_pos;
}
- if (lw->v_pane && GTK_PANED(lw->v_pane)->child1->allocation.x >= 0)
+ if (lw->v_pane && v_allocation.x >= 0)
{
- *v = GTK_PANED(lw->v_pane)->child1->allocation.height;
+ *v = v_allocation.height;
}
else if (v != &lw->options.main_window.vdivider_pos)
{
gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos)
{
+ GdkWindow *window;
+ GtkAllocation allocation;
if (!layout_valid(&lw)) return FALSE;
- if (!lw->tools || !GTK_WIDGET_VISIBLE(lw->tools))
+ if (!lw->tools || !gtk_widget_get_visible(lw->tools))
{
/* use the stored values (sort of breaks success return value) */
return FALSE;
}
- gdk_window_get_root_origin(lw->tools->window, x, y);
- gdk_drawable_get_size(lw->tools->window, w, h);
+ window = gtk_widget_get_window(lw->tools);
+ gdk_window_get_root_origin(window, x, y);
+ *w = gdk_window_get_width(window);
+ *h = gdk_window_get_height(window);
+ gtk_widget_get_allocation(gtk_paned_get_child1(GTK_PANED(lw->tools_pane)), &allocation);
if (GTK_IS_VPANED(lw->tools_pane))
{
- *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.height;
+ *divider_pos = allocation.height;
}
else
{
- *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.width;
+ *divider_pos = allocation.width;
+ }
+
+ return TRUE;
+}
+
+gboolean layout_geometry_get_log_window(LayoutWindow *lw, gint *x, gint *y,
+ gint *w, gint *h)
+{
+ GdkWindow *window;
+
+ if (!layout_valid(&lw)) return FALSE;
+
+ if (!lw->log_window)
+ {
+ return FALSE;
}
+ window = gtk_widget_get_window(lw->log_window);
+ gdk_window_get_root_origin(window, x, y);
+ *w = gdk_window_get_width(window);
+ *h = gdk_window_get_height(window);
+
return TRUE;
}
static void layout_tools_geometry_sync(LayoutWindow *lw)
{
- layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.x,
+ layout_geometry_get_tools(lw, &lw->options.float_window.x, &lw->options.float_window.y,
&lw->options.float_window.w, &lw->options.float_window.h, &lw->options.float_window.vdivider_pos);
}
if (hide)
{
- if (GTK_WIDGET_VISIBLE(lw->tools))
+ if (gtk_widget_get_visible(lw->tools))
{
layout_tools_geometry_sync(lw);
gtk_widget_hide(lw->tools);
}
else
{
- if (!GTK_WIDGET_VISIBLE(lw->tools))
+ if (!gtk_widget_get_visible(lw->tools))
{
gtk_widget_show(lw->tools);
if (lw->vf) vf_refresh(lw->vf);
vertical = (layout_location_single(lw->image_location) && !layout_location_vertical(lw->image_location)) ||
(!layout_location_single(lw->image_location) && layout_location_vertical(layout_grid_compass(lw)));
-#if 0
- layout_location_compute(lw->dir_location, lw->file_location,
- tools, files, &w1, &w2);
-#endif
/* for now, tools/dir are always first in order */
w1 = tools;
w2 = files;
{
layout_tools_geometry_sync(lw);
/* dump the contents */
- gtk_widget_destroy(GTK_BIN(lw->tools)->child);
+ gtk_widget_destroy(gtk_bin_get_child(GTK_BIN(lw->tools)));
}
layout_actions_add_window(lw, lw->tools);
if (lw->split_images[i])
{
gtk_widget_hide(lw->split_images[i]->widget);
- if (lw->split_images[i]->widget->parent != lw->utility_paned)
- gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget);
+ if (gtk_widget_get_parent(lw->split_images[i]->widget) != lw->utility_paned)
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->split_images[i]->widget)), lw->split_images[i]->widget);
}
}
gtk_container_remove(GTK_CONTAINER(lw->utility_paned), lw->split_image_widget);
image = layout_image_setup_split(lw, lw->split_mode);
image_sb = layout_bars_prepare(lw, image);
}
-
+
tools = layout_tools_new(lw);
files = layout_list_new(lw);
/* remember state */
- /* layout_image_slideshow_stop(lw); slideshow should survive */
+ /* layout_image_slideshow_stop(lw); slideshow should survive */
layout_image_full_screen_stop(lw);
dir_fd = lw->dir_fd;
/* preserve utility_box (image + sidebars), menu_bar and toolbars to be reused later in layout_grid_setup */
/* lw->image is preserved together with lw->utility_box */
- if (lw->utility_box) gtk_container_remove(GTK_CONTAINER(lw->utility_box->parent), lw->utility_box);
- if (lw->menu_bar) gtk_container_remove(GTK_CONTAINER(lw->menu_bar->parent), lw->menu_bar);
+ if (lw->utility_box) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->utility_box)), lw->utility_box);
+ if (lw->menu_bar) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->menu_bar)), lw->menu_bar);
for (i = 0; i < TOOLBAR_COUNT; i++)
- if (lw->toolbar[i]) gtk_container_remove(GTK_CONTAINER(lw->toolbar[i]->parent), lw->toolbar[i]);
+ if (lw->toolbar[i]) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->toolbar[i])), lw->toolbar[i]);
/* clear it all */
gint i;
LayoutWindow *lw = work->data;
work = work->next;
-
+
if (!lw->image) continue;
for (i = 0; i < MAX_SPLIT_IMAGES; i++)
if (!lw->split_images[i]) continue;
image_background_set_color_from_options(lw->split_images[i], !!lw->full_screen);
}
-
+
image_background_set_color_from_options(lw->image, !!lw->full_screen);
}
}
void layout_toolbar_toggle(LayoutWindow *lw)
{
if (!layout_valid(&lw)) return;
- if (!lw->toolbar) return;
+ if (!lw->toolbar[TOOLBAR_MAIN]) return;
lw->options.toolbar_hidden = !lw->options.toolbar_hidden;
if (lw->options.toolbar_hidden)
{
- if (GTK_WIDGET_VISIBLE(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
+ if (gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_hide(lw->toolbar[TOOLBAR_MAIN]);
}
else
{
- if (!GTK_WIDGET_VISIBLE(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
+ if (!gtk_widget_get_visible(lw->toolbar[TOOLBAR_MAIN])) gtk_widget_show(lw->toolbar[TOOLBAR_MAIN]);
}
}
void layout_info_pixel_set(LayoutWindow *lw, gboolean show)
{
GtkWidget *frame;
-
+
if (!layout_valid(&lw)) return;
if (!lw->info_pixel) return;
{
gtk_widget_show(frame);
}
-
+
g_signal_emit_by_name (lw->image->pr, "update-pixel");
}
GtkWidget *configwindow;
GtkWidget *home_path_entry;
GtkWidget *layout_widget;
-
+
LayoutOptions options;
};
static void layout_config_close_cb(GtkWidget *widget, gpointer data)
{
LayoutConfig *lc = data;
-
+
gtk_widget_destroy(lc->configwindow);
free_layout_options_content(&lc->options);
g_free(lc);
static void layout_config_apply_cb(GtkWidget *widget, gpointer data)
{
LayoutConfig *lc = data;
-
+
g_free(lc->options.order);
lc->options.order = layout_config_get(lc->layout_widget, &lc->options.style);
layout_apply_options(lc->lw, &lc->options);
}
+static void layout_config_help_cb(GtkWidget *widget, gpointer data)
+{
+ help_window_show("GuideOptionsLayout.html");
+}
+
static void layout_config_ok_cb(GtkWidget *widget, gpointer data)
{
LayoutConfig *lc = data;
button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE,
G_CALLBACK(layout_config_ok_cb), lc);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_grab_default(button);
gtk_widget_show(button);
gtk_container_add(GTK_CONTAINER(hbox), button);
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
gtk_widget_show(button);
-*/
+*/
+ button = pref_button_new(NULL, GTK_STOCK_HELP, NULL, FALSE,
+ G_CALLBACK(layout_config_help_cb), lc);
+ gtk_container_add(GTK_CONTAINER(hbox), button);
+ gtk_widget_set_can_default(button, TRUE);
+ gtk_widget_show(button);
+
button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE,
G_CALLBACK(layout_config_apply_cb), lc);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE,
G_CALLBACK(layout_config_close_cb), lc);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
if (!generic_dialog_get_alternative_button_order(lc->configwindow))
}
frame = pref_frame_new(win_vbox, TRUE, NULL, GTK_ORIENTATION_VERTICAL, PREF_PAD_GAP);
-
+
vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE);
gtk_container_add(GTK_CONTAINER(frame), vbox);
gtk_widget_show(vbox);
lw->options.image_overlay.state = image_osd_get(lw->image);
histogram = image_osd_get_histogram(lw->image);
-
+
lw->options.image_overlay.histogram_channel = histogram->histogram_channel;
lw->options.image_overlay.histogram_mode = histogram->histogram_mode;
g_free(lw->options.last_path);
lw->options.last_path = g_strdup(layout_get_path(lw));
+
+ layout_geometry_get_log_window(lw, &lw->options.log_window.x, &lw->options.log_window.y,
+ &lw->options.log_window.w, &lw->options.log_window.h);
+
}
void layout_apply_options(LayoutWindow *lw, LayoutOptions *lop)
if (current_lw == lw) current_lw = NULL;
if (lw->exif_window) g_signal_handlers_disconnect_matched(G_OBJECT(lw->exif_window), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, lw);
-
+
layout_bars_close(lw);
g_object_unref(lw->menu_bar);
for (i = 0; i < TOOLBAR_COUNT; i++)
{
if (lw->toolbar[i]) g_object_unref(lw->toolbar[i]);
- string_list_free(lw->toolbar_actions[i]);
}
-
+
gtk_widget_destroy(lw->window);
-
+
if (lw->split_image_sizegroup) g_object_unref(lw->split_image_sizegroup);
file_data_unregister_notify_func(layout_image_notify_cb, lw);
layout_config_parse(lw->options.style, lw->options.order,
&lw->dir_location, &lw->file_location, &lw->image_location);
- if (lw->options.dir_view_type >= VIEW_DIR_TYPES_COUNT) lw->options.dir_view_type = 0;
- if (lw->options.file_view_type >= VIEW_FILE_TYPES_COUNT) lw->options.file_view_type = 0;
+ if (lw->options.dir_view_type > DIRVIEW_LAST) lw->options.dir_view_type = 0;
+ if (lw->options.file_view_type > FILEVIEW_LAST) lw->options.file_view_type = 0;
/* divider positions */
GdkPixbuf *pixbuf;
pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
-
+
/* FIXME: the zoom value set here is the value, which is then copied again and again
in "Leave Zoom at previous setting" mode. This is not ideal. */
image_change_pixbuf(lw->image, pixbuf, 0.0, FALSE);
image_osd_set(lw->image, lw->options.image_overlay.state);
histogram = image_osd_get_histogram(lw->image);
-
+
histogram->histogram_channel = lw->options.image_overlay.histogram_channel;
histogram->histogram_mode = lw->options.image_overlay.histogram_mode;
WRITE_NL(); WRITE_INT(*layout, main_window.vdivider_pos);
WRITE_SEPARATOR();
+ WRITE_NL(); WRITE_INT(*layout, folder_window.vdivider_pos);
+ WRITE_SEPARATOR();
+
WRITE_NL(); WRITE_INT(*layout, float_window.x);
WRITE_NL(); WRITE_INT(*layout, float_window.y);
WRITE_NL(); WRITE_INT(*layout, float_window.w);
WRITE_NL(); WRITE_UINT(*layout, image_overlay.state);
WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_channel);
WRITE_NL(); WRITE_INT(*layout, image_overlay.histogram_mode);
+
+ WRITE_NL(); WRITE_INT(*layout, log_window.x);
+ WRITE_NL(); WRITE_INT(*layout, log_window.y);
+ WRITE_NL(); WRITE_INT(*layout, log_window.w);
+ WRITE_NL(); WRITE_INT(*layout, log_window.h);
+ WRITE_SEPARATOR();
+
+ WRITE_NL(); WRITE_BOOL(*layout, animate);
}
bar_sort_write_config(lw->bar_sort, outstr, indent + 1);
bar_write_config(lw->bar, outstr, indent + 1);
-
- layout_toolbar_write_config(lw, TOOLBAR_MAIN, outstr, indent + 1);
- layout_toolbar_write_config(lw, TOOLBAR_STATUS, outstr, indent + 1);
WRITE_NL(); WRITE_STRING("</layout>");
}
void layout_load_attributes(LayoutOptions *layout, const gchar **attribute_names, const gchar **attribute_values)
{
gchar *id = NULL;
-
+
while (*attribute_names)
{
const gchar *option = *attribute_names++;
if (READ_INT(*layout, style)) continue;
if (READ_CHAR(*layout, order)) continue;
-
+
if (READ_UINT(*layout, dir_view_type)) continue;
if (READ_UINT(*layout, file_view_type)) continue;
if (READ_BOOL(*layout, show_marks)) continue;
if (READ_INT(*layout, main_window.hdivider_pos)) continue;
if (READ_INT(*layout, main_window.vdivider_pos)) continue;
+ if (READ_INT_CLAMP(*layout, folder_window.vdivider_pos, 1, 1000)) continue;
+
if (READ_INT(*layout, float_window.x)) continue;
if (READ_INT(*layout, float_window.y)) continue;
if (READ_INT(*layout, float_window.w)) continue;
if (READ_INT(*layout, float_window.h)) continue;
if (READ_INT(*layout, float_window.vdivider_pos)) continue;
-
+
if (READ_INT(*layout, properties_window.w)) continue;
if (READ_INT(*layout, properties_window.h)) continue;
if (READ_INT(*layout, image_overlay.histogram_channel)) continue;
if (READ_INT(*layout, image_overlay.histogram_mode)) continue;
+ if (READ_INT(*layout, log_window.x)) continue;
+ if (READ_INT(*layout, log_window.y)) continue;
+ if (READ_INT(*layout, log_window.w)) continue;
+ if (READ_INT(*layout, log_window.h)) continue;
+
+ if (READ_BOOL(*layout, animate)) continue;
+
log_printf("unknown attribute %s = %s\n", option, value);
}
if (id && strcmp(id, LAYOUT_ID_CURRENT) != 0)
*path = get_current_dir();
break;
}
-}
+}
static void layout_config_commandline(LayoutOptions *lop, gchar **path)
*path = g_strdup(command_line->path);
}
else layout_config_startup_path(lop, path);
-
+
if (command_line->tools_show)
{
lop->tools_float = FALSE;
LayoutOptions lop;
LayoutWindow *lw;
gchar *path = NULL;
-
+
init_layout_options(&lop);
if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values);
-
+
if (use_commandline)
{
layout_config_commandline(&lop, &path);
}
- else
+ else
{
layout_config_startup_path(&lop, &path);
}
if (use_commandline && command_line->startup_full_screen) layout_image_full_screen_start(lw);
if (use_commandline && command_line->startup_in_slideshow) layout_image_slideshow_start(lw);
-
+ if (use_commandline && command_line->log_window_show) log_window_new(lw);
g_free(path);
free_layout_options_content(&lop);
void layout_update_from_config(LayoutWindow *lw, const gchar **attribute_names, const gchar **attribute_values)
{
LayoutOptions lop;
-
+
init_layout_options(&lop);
if (attribute_names) layout_load_attributes(&lop, attribute_names, attribute_values);
layout_apply_options(lw, &lop);
-
+
free_layout_options_content(&lop);
}