Commit 4403d58a authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

Wishlist item #57669:

2001-11-16  Michael Natterer  <mitch@gimp.org>

	Wishlist item #57669:

	* app/gimprc.[ch]: replaced gimprc option "allow-resize-windows"
	by "resize-windows-on-zoom" and "resize-windows-on-resize".

	* app/gui/preferences-dialog.c: added a toggle for
	"resize-windows-on-resize".

	* app/display/gimpdisplayshell-handlers.c
	* app/display/gimpdisplayshell-scale.c
	* app/tools/gimpmagnifytool.c
	* docs/gimprc.5.in
	* etc/gimprc.in
	* etc/gimprc.win32: changed accordingly.

	* app/display/gimpdisplay-area.[ch]: added gimp_area_new().

	* app/display/gimpdisplay.c: cleanup usage of GimpArea.

	* app/display/gimpdisplayshell.[ch]: added configurable canvas
	padding color and a small color_panel to change it in the upper
	right corner of the window.

	* app/display/gimpdisplayshell-callbacks.[ch]: added a callback
	for the color_panel, initialize the color in the "realize"
	callback.

	Wishlist item #51548.

	* app/display/gimpdisplayshell-selection.[ch]
	* app/gui/menus.c
	* app/gui/view-commands.[ch]: made the layer boundary toggleable
	separately from the selection.

	* app/gui/color-notebook.c: #if 0'ed a debugging g_print().
parent a1439a3c
2001-11-16 Michael Natterer <mitch@gimp.org>
Wishlist item #57669:
* app/gimprc.[ch]: replaced gimprc option "allow-resize-windows"
by "resize-windows-on-zoom" and "resize-windows-on-resize".
* app/gui/preferences-dialog.c: added a toggle for
"resize-windows-on-resize".
* app/display/gimpdisplayshell-handlers.c
* app/display/gimpdisplayshell-scale.c
* app/tools/gimpmagnifytool.c
* docs/gimprc.5.in
* etc/gimprc.in
* etc/gimprc.win32: changed accordingly.
* app/display/gimpdisplay-area.[ch]: added gimp_area_new().
* app/display/gimpdisplay.c: cleanup usage of GimpArea.
* app/display/gimpdisplayshell.[ch]: added configurable canvas
padding color and a small color_panel to change it in the upper
right corner of the window.
* app/display/gimpdisplayshell-callbacks.[ch]: added a callback
for the color_panel, initialize the color in the "realize"
callback.
Wishlist item #51548.
* app/display/gimpdisplayshell-selection.[ch]
* app/gui/menus.c
* app/gui/view-commands.[ch]: made the layer boundary toggleable
separately from the selection.
* app/gui/color-notebook.c: #if 0'ed a debugging g_print().
2001-11-16 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpcolorbutton.[ch]: added Black and White to popup
......
......@@ -164,7 +164,29 @@ view_toggle_selection_cmd_callback (GtkWidget *widget,
{
gimp_display_shell_selection_toggle (shell->select);
gdisplays_flush ();
gimp_display_shell_flush (shell);
}
}
void
view_toggle_layer_boundary_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplayShell *shell;
gint new_val;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
new_val = GTK_CHECK_MENU_ITEM (widget)->active;
/* hidden == TRUE corresponds to the menu toggle being FALSE */
if (new_val == shell->select->layer_hidden)
{
gimp_display_shell_selection_toggle_layer (shell->select);
gimp_display_shell_flush (shell);
}
}
......
......@@ -20,35 +20,37 @@
#define __VIEW_COMMANDS_H__
void view_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_fit_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void view_dot_for_dot_cmd_callback (GtkWidget *widget,
gpointer data);
void view_info_window_cmd_callback (GtkWidget *widget,
gpointer data);
void view_nav_window_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_rulers_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_statusbar_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_guides_cmd_callback (GtkWidget *widget,
gpointer data);
void view_snap_to_guides_cmd_callback (GtkWidget *widget,
gpointer data);
void view_new_view_cmd_callback (GtkWidget *widget,
gpointer data);
void view_shrink_wrap_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_in_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_out_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_fit_cmd_callback (GtkWidget *widget,
gpointer data);
void view_zoom_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void view_dot_for_dot_cmd_callback (GtkWidget *widget,
gpointer data);
void view_info_window_cmd_callback (GtkWidget *widget,
gpointer data);
void view_nav_window_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_selection_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_layer_boundary_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_rulers_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_statusbar_cmd_callback (GtkWidget *widget,
gpointer data);
void view_toggle_guides_cmd_callback (GtkWidget *widget,
gpointer data);
void view_snap_to_guides_cmd_callback (GtkWidget *widget,
gpointer data);
void view_new_view_cmd_callback (GtkWidget *widget,
gpointer data);
void view_shrink_wrap_cmd_callback (GtkWidget *widget,
gpointer data);
#endif /* __VIEW_COMMANDS_H__ */
......@@ -28,6 +28,24 @@
#define OVERHEAD 25 /* in units of pixel area */
GimpArea *
gimp_area_new (gint x1,
gint y1,
gint x2,
gint y2)
{
GimpArea *area;
area = g_new (GimpArea, 1);
area->x1 = x1;
area->y1 = y1;
area->x2 = x2;
area->y2 = y2;
return area;
}
/*
* As far as I can tell, this function takes a GimpArea and unifies it with
* an existing list of GimpAreas, trying to avoid overdraw. [adam]
......
......@@ -28,9 +28,14 @@ struct _GimpArea
};
GSList * gimp_display_area_list_process (GSList *list,
GimpArea *area);
GSList * gimp_display_area_list_free (GSList *list);
GimpArea * gimp_area_new (gint x1,
gint y1,
gint x2,
gint y2);
GSList * gimp_display_area_list_process (GSList *list,
GimpArea *area);
GSList * gimp_display_area_list_free (GSList *list);
#endif /* __GIMP_DISPLAY_AREA_H__ */
......@@ -288,18 +288,17 @@ gimp_display_add_update_area (GimpDisplay *gdisp,
gint w,
gint h)
{
GimpArea *ga;
GimpArea *area;
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
ga = g_new (GimpArea, 1);
area = gimp_area_new (CLAMP (x, 0, gdisp->gimage->width),
CLAMP (y, 0, gdisp->gimage->height),
CLAMP (x + w, 0, gdisp->gimage->width),
CLAMP (y + h, 0, gdisp->gimage->height));
ga->x1 = CLAMP (x, 0, gdisp->gimage->width);
ga->y1 = CLAMP (y, 0, gdisp->gimage->height);
ga->x2 = CLAMP (x + w, 0, gdisp->gimage->width);
ga->y2 = CLAMP (y + h, 0, gdisp->gimage->height);
gdisp->update_areas = gimp_display_area_list_process (gdisp->update_areas, ga);
gdisp->update_areas = gimp_display_area_list_process (gdisp->update_areas,
area);
}
void
......@@ -518,9 +517,6 @@ static void
gimp_display_flush_whenever (GimpDisplay *gdisp,
gboolean now)
{
GSList *list;
GimpArea *ga;
/* Flush the items in the displays and updates lists -
* but only if gdisplay has been mapped and exposed
*/
......@@ -535,22 +531,22 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
{
/* Synchronous */
list = gdisp->update_areas;
while (list)
GSList *list;
GimpArea *area;
for (list = gdisp->update_areas; list; list = g_slist_next (list))
{
/* Paint the area specified by the GimpArea */
ga = (GimpArea *) list->data;
if ((ga->x1 != ga->x2) && (ga->y1 != ga->y2))
area = (GimpArea *) list->data;
if ((area->x1 != area->x2) && (area->y1 != area->y2))
{
gimp_display_paint_area (gdisp,
ga->x1,
ga->y1,
(ga->x2 - ga->x1),
(ga->y2 - ga->y1));
area->x1,
area->y1,
(area->x2 - area->x1),
(area->y2 - area->y1));
}
list = g_slist_next (list);
}
}
else
......@@ -582,26 +578,23 @@ static void
gimp_display_idlerender_init (GimpDisplay *gdisp)
{
GSList *list;
GimpArea *ga, *new_ga;
GimpArea *area, *new_area;
/* We need to merge the IdleRender's and the GimpDisplay's update_areas list
* to keep track of which of the updates have been flushed and hence need
* to be drawn.
*/
list = gdisp->update_areas;
while (list)
for (list = gdisp->update_areas; list; list = g_slist_next (list))
{
ga = (GimpArea *) list->data;
area = (GimpArea *) list->data;
new_ga = g_new (GimpArea, 1);
new_area = g_new (GimpArea, 1);
memcpy (new_ga, ga, sizeof (GimpArea));
memcpy (new_area, area, sizeof (GimpArea));
gdisp->idle_render.update_areas =
gimp_display_area_list_process (gdisp->idle_render.update_areas, new_ga);
list = g_slist_next (list);
gimp_display_area_list_process (gdisp->idle_render.update_areas,
new_area);
}
/* If an idlerender was already running, merge the remainder of its
......@@ -610,17 +603,17 @@ gimp_display_idlerender_init (GimpDisplay *gdisp)
*/
if (gdisp->idle_render.idle_id)
{
new_ga = g_new (GimpArea, 1);
new_ga->x1 = gdisp->idle_render.basex;
new_ga->y1 = gdisp->idle_render.y;
new_ga->x2 = gdisp->idle_render.basex + gdisp->idle_render.width;
new_ga->y2 = gdisp->idle_render.y + (gdisp->idle_render.height -
(gdisp->idle_render.y -
gdisp->idle_render.basey));
new_area =
gimp_area_new (gdisp->idle_render.basex,
gdisp->idle_render.y,
gdisp->idle_render.basex + gdisp->idle_render.width,
gdisp->idle_render.y + (gdisp->idle_render.height -
(gdisp->idle_render.y -
gdisp->idle_render.basey)));
gdisp->idle_render.update_areas =
gimp_display_area_list_process (gdisp->idle_render.update_areas, new_ga);
gimp_display_area_list_process (gdisp->idle_render.update_areas,
new_area);
gimp_display_idle_render_next_area (gdisp);
}
......@@ -667,7 +660,7 @@ gimp_display_idlerender_callback (gpointer data)
workw = gdisp->idle_render.basex + gdisp->idle_render.width - workx;
}
if (worky+workh > gdisp->idle_render.basey+gdisp->idle_render.height)
if (worky + workh > gdisp->idle_render.basey + gdisp->idle_render.height)
{
workh = gdisp->idle_render.basey + gdisp->idle_render.height - worky;
}
......@@ -704,27 +697,22 @@ gimp_display_idlerender_callback (gpointer data)
static gboolean
gimp_display_idle_render_next_area (GimpDisplay *gdisp)
{
GimpArea *ga;
GSList *list;
list = gdisp->idle_render.update_areas;
GimpArea *area;
if (list == NULL)
{
return FALSE;
}
if (! gdisp->idle_render.update_areas)
return FALSE;
ga = (GimpArea *) list->data;
area = (GimpArea *) gdisp->idle_render.update_areas->data;
gdisp->idle_render.update_areas =
g_slist_remove (gdisp->idle_render.update_areas, ga);
g_slist_remove (gdisp->idle_render.update_areas, area);
gdisp->idle_render.x = gdisp->idle_render.basex = ga->x1;
gdisp->idle_render.y = gdisp->idle_render.basey = ga->y1;
gdisp->idle_render.width = ga->x2 - ga->x1;
gdisp->idle_render.height = ga->y2 - ga->y1;
gdisp->idle_render.x = gdisp->idle_render.basex = area->x1;
gdisp->idle_render.y = gdisp->idle_render.basey = area->y1;
gdisp->idle_render.width = area->x2 - area->x1;
gdisp->idle_render.height = area->y2 - area->y1;
g_free (ga);
g_free (area);
return TRUE;
}
......
......@@ -1102,6 +1102,7 @@ color_notebook_update_scales (ColorNotebook *cnp,
cnp);
}
#if 0
g_print ("RGB: %d %d %d HSV: %d %d %d ALPHA: %d\n",
values[GIMP_COLOR_SELECTOR_RED],
values[GIMP_COLOR_SELECTOR_GREEN],
......@@ -1110,6 +1111,7 @@ color_notebook_update_scales (ColorNotebook *cnp,
values[GIMP_COLOR_SELECTOR_SATURATION],
values[GIMP_COLOR_SELECTOR_VALUE],
values[GIMP_COLOR_SELECTOR_ALPHA]);
#endif
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x",
values[GIMP_COLOR_SELECTOR_RED],
......
......@@ -110,7 +110,8 @@ static gint old_transparency_type;
static gint old_transparency_size;
static gint old_levels_of_undo;
static gint old_marching_speed;
static gboolean old_allow_resize_windows;
static gboolean old_resize_windows_on_zoom;
static gboolean old_resize_windows_on_resize;
static gboolean old_auto_save;
static gint old_preview_size;
static gint old_nav_preview_size;
......@@ -560,10 +561,15 @@ prefs_save_callback (GtkWidget *widget,
{
update = g_list_append (update, "marching-ants-speed");
}
if (gimprc.allow_resize_windows != old_allow_resize_windows)
if (gimprc.resize_windows_on_zoom != old_resize_windows_on_zoom)
{
update = g_list_append (update, "allow-resize-windows");
remove = g_list_append (remove, "dont-allow-resize-windows");
update = g_list_append (update, "resize-windows-on-zoom");
remove = g_list_append (remove, "dont-resize-windows-on-zoom");
}
if (gimprc.resize_windows_on_resize != old_resize_windows_on_resize)
{
update = g_list_append (update, "resize-windows-on-resize");
remove = g_list_append (remove, "dont-resize-windows-on-resize");
}
if (gimprc.auto_save != old_auto_save)
{
......@@ -892,7 +898,8 @@ prefs_cancel_callback (GtkWidget *widget,
gimp->config->thumbnail_mode = old_thumbnail_mode;
gimprc.marching_speed = old_marching_speed;
gimprc.allow_resize_windows = old_allow_resize_windows;
gimprc.resize_windows_on_zoom = old_resize_windows_on_zoom;
gimprc.resize_windows_on_resize = old_resize_windows_on_resize;
gimprc.auto_save = old_auto_save;
gimprc.no_cursor_updating = old_no_cursor_updating;
gimprc.perfectmouse = old_perfectmouse;
......@@ -994,26 +1001,27 @@ prefs_toggle_callback (GtkWidget *widget,
val = (gint *) data;
/* toggle buttos */
if (data == &gimprc.allow_resize_windows ||
data == &gimprc.auto_save ||
data == &gimprc.no_cursor_updating ||
data == &gimprc.perfectmouse ||
data == &gimprc.show_tool_tips ||
data == &gimprc.show_rulers ||
data == &gimprc.show_statusbar ||
data == &gimprc.confirm_on_close ||
data == &gimprc.save_session_info ||
data == &gimprc.save_device_status ||
data == &gimprc.always_restore_session ||
data == &gimprc.default_dot_for_dot ||
data == &gimprc.use_help ||
data == &edit_stingy_memory_use ||
data == &edit_install_cmap ||
data == &edit_cycled_marching_ants ||
data == &edit_show_indicators ||
data == &edit_nav_window_per_display ||
data == &edit_info_window_follows_mouse ||
if (data == &gimprc.resize_windows_on_zoom ||
data == &gimprc.resize_windows_on_resize ||
data == &gimprc.auto_save ||
data == &gimprc.no_cursor_updating ||
data == &gimprc.perfectmouse ||
data == &gimprc.show_tool_tips ||
data == &gimprc.show_rulers ||
data == &gimprc.show_statusbar ||
data == &gimprc.confirm_on_close ||
data == &gimprc.save_session_info ||
data == &gimprc.save_device_status ||
data == &gimprc.always_restore_session ||
data == &gimprc.default_dot_for_dot ||
data == &gimprc.use_help ||
data == &edit_stingy_memory_use ||
data == &edit_install_cmap ||
data == &edit_cycled_marching_ants ||
data == &edit_show_indicators ||
data == &edit_nav_window_per_display ||
data == &edit_info_window_follows_mouse ||
data == &edit_disable_tearoff_menus)
{
*val = GTK_TOGGLE_BUTTON (widget)->active;
......@@ -1528,7 +1536,8 @@ preferences_dialog_create (Gimp *gimp)
old_transparency_type = gimprc.transparency_type;
old_transparency_size = gimprc.transparency_size;
old_marching_speed = gimprc.marching_speed;
old_allow_resize_windows = gimprc.allow_resize_windows;
old_resize_windows_on_zoom = gimprc.resize_windows_on_zoom;
old_resize_windows_on_resize = gimprc.resize_windows_on_resize;
old_auto_save = gimprc.auto_save;
old_preview_size = gimprc.preview_size;
old_nav_preview_size = gimprc.nav_preview_size;
......@@ -2159,13 +2168,23 @@ preferences_dialog_create (Gimp *gimp)
button = gtk_check_button_new_with_label(_("Resize Window on Zoom"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
gimprc.allow_resize_windows);
gimprc.resize_windows_on_zoom);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "toggled",
G_CALLBACK (prefs_toggle_callback),
&gimprc.resize_windows_on_zoom);
button = gtk_check_button_new_with_label(_("Resize Window on Image Size Change"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
gimprc.resize_windows_on_resize);
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (G_OBJECT (button), "toggled",
G_CALLBACK (prefs_toggle_callback),
&gimprc.allow_resize_windows);
&gimprc.resize_windows_on_resize);
button = gtk_check_button_new_with_label(_("Show Rulers"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
......
......@@ -28,6 +28,24 @@
#define OVERHEAD 25 /* in units of pixel area */
GimpArea *
gimp_area_new (gint x1,
gint y1,
gint x2,
gint y2)
{
GimpArea *area;
area = g_new (GimpArea, 1);
area->x1 = x1;
area->y1 = y1;
area->x2 = x2;
area->y2 = y2;
return area;
}
/*
* As far as I can tell, this function takes a GimpArea and unifies it with
* an existing list of GimpAreas, trying to avoid overdraw. [adam]
......
......@@ -28,9 +28,14 @@ struct _GimpArea
};
GSList * gimp_display_area_list_process (GSList *list,
GimpArea *area);
GSList * gimp_display_area_list_free (GSList *list);
GimpArea * gimp_area_new (gint x1,
gint y1,
gint x2,
gint y2);
GSList * gimp_display_area_list_process (GSList *list,
GimpArea *area);
GSList * gimp_display_area_list_free (GSList *list);
#endif /* __GIMP_DISPLAY_AREA_H__ */
......@@ -288,18 +288,17 @@ gimp_display_add_update_area (GimpDisplay *gdisp,
gint w,
gint h)
{
GimpArea *ga;
GimpArea *area;
g_return_if_fail (GIMP_IS_DISPLAY (gdisp));
ga = g_new (GimpArea, 1);
area = gimp_area_new (CLAMP (x, 0, gdisp->gimage->width),
CLAMP (y, 0, gdisp->gimage->height),
CLAMP (x + w, 0, gdisp->gimage->width),
CLAMP (y + h, 0, gdisp->gimage->height));
ga->x1 = CLAMP (x, 0, gdisp->gimage->width);
ga->y1 = CLAMP (y, 0, gdisp->gimage->height);
ga->x2 = CLAMP (x + w, 0, gdisp->gimage->width);
ga->y2 = CLAMP (y + h, 0, gdisp->gimage->height);
gdisp->update_areas = gimp_display_area_list_process (gdisp->update_areas, ga);
gdisp->update_areas = gimp_display_area_list_process (gdisp->update_areas,
area);
}
void
......@@ -518,9 +517,6 @@ static void
gimp_display_flush_whenever (GimpDisplay *gdisp,
gboolean now)
{
GSList *list;
GimpArea *ga;
/* Flush the items in the displays and updates lists -
* but only if gdisplay has been mapped and exposed
*/
......@@ -535,22 +531,22 @@ gimp_display_flush_whenever (GimpDisplay *gdisp,
{
/* Synchronous */
list = gdisp->update_areas;
while (list)
GSList *list;
GimpArea *area;
for (list = gdisp->update_areas; list; list = g_slist_next (list))
{
/* Paint the area specified by the GimpArea */
ga = (GimpArea *) list->data;
if ((ga->x1 != ga->x2) && (ga->y1 != ga->y2))
area = (GimpArea *) list->data;
if ((area->x1 != area->x2) && (area->y1 != area->y2))
{