mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 22:34:37 +00:00
app/gtkhwrapbox.[ch] sync from gle
* app/gtkhwrapbox.[ch] * app/gtkwrapbox.[ch]: sync from gle * app/inteface.c: set allow_shrink on the toolbox window, use gtk_hwrap_box_new * app/blend.c: use shift to constrain to 45 deg: XachCode (tm) -Yosh
This commit is contained in:
parent
42b6faccc0
commit
52b5222052
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Thu Sep 2 11:51:02 PDT 1999 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* app/gtkhwrapbox.[ch]
|
||||
* app/gtkwrapbox.[ch]: sync from gle
|
||||
|
||||
* app/inteface.c: set allow_shrink on the toolbox window, use
|
||||
gtk_hwrap_box_new
|
||||
|
||||
* app/blend.c: use shift to constrain to 45 deg: XachCode (tm)
|
||||
|
||||
Thu Sep 2 19:25:03 MEST 1999 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/app_procs.c: call device_status_free before freeing brushes
|
||||
|
|
27
app/blend.c
27
app/blend.c
|
@ -630,6 +630,33 @@ blend_motion (Tool *tool,
|
|||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
|
||||
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
|
||||
|
||||
|
||||
/* Restrict to multiples of 45 degrees if shift is pressed */
|
||||
if (mevent->state & GDK_SHIFT_MASK) {
|
||||
int dx, dy, d;
|
||||
int abs_dx, abs_dy;
|
||||
|
||||
dx = blend_tool->endx - blend_tool->startx;
|
||||
dy = blend_tool->endy - blend_tool->starty;
|
||||
abs_dx = abs(dx);
|
||||
abs_dy = abs(dy);
|
||||
|
||||
d = (abs_dx + abs_dy) >> 1;
|
||||
|
||||
if ((abs_dx >> 1) < abs_dy && (abs_dy >> 1) < abs_dx)
|
||||
{
|
||||
blend_tool->endx = blend_tool->startx + ((dx < 0) ? -d : d);
|
||||
blend_tool->endy = blend_tool->starty + ((dy < 0) ? -d : d);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs_dx > abs_dy)
|
||||
blend_tool->endy = blend_tool->starty;
|
||||
else
|
||||
blend_tool->endx = blend_tool->startx;
|
||||
}
|
||||
}
|
||||
|
||||
/* restrict to horizontal/vertical blend, if modifiers are pressed */
|
||||
if (mevent->state & GDK_MOD1_MASK)
|
||||
{
|
||||
|
|
|
@ -630,6 +630,33 @@ blend_motion (Tool *tool,
|
|||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
|
||||
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
|
||||
|
||||
|
||||
/* Restrict to multiples of 45 degrees if shift is pressed */
|
||||
if (mevent->state & GDK_SHIFT_MASK) {
|
||||
int dx, dy, d;
|
||||
int abs_dx, abs_dy;
|
||||
|
||||
dx = blend_tool->endx - blend_tool->startx;
|
||||
dy = blend_tool->endy - blend_tool->starty;
|
||||
abs_dx = abs(dx);
|
||||
abs_dy = abs(dy);
|
||||
|
||||
d = (abs_dx + abs_dy) >> 1;
|
||||
|
||||
if ((abs_dx >> 1) < abs_dy && (abs_dy >> 1) < abs_dx)
|
||||
{
|
||||
blend_tool->endx = blend_tool->startx + ((dx < 0) ? -d : d);
|
||||
blend_tool->endy = blend_tool->starty + ((dy < 0) ? -d : d);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs_dx > abs_dy)
|
||||
blend_tool->endy = blend_tool->starty;
|
||||
else
|
||||
blend_tool->endx = blend_tool->startx;
|
||||
}
|
||||
}
|
||||
|
||||
/* restrict to horizontal/vertical blend, if modifiers are pressed */
|
||||
if (mevent->state & GDK_MOD1_MASK)
|
||||
{
|
||||
|
|
|
@ -349,7 +349,7 @@ create_tools (GtkWidget *parent)
|
|||
gint i, j;
|
||||
|
||||
/*create_logo (parent);*/
|
||||
wbox = GTK_WIDGET (gtk_type_new (gtk_hwrap_box_get_type ()));
|
||||
wbox = gtk_hwrap_box_new (FALSE);
|
||||
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (wbox), .36);
|
||||
gtk_box_pack_start (GTK_BOX (parent), wbox, TRUE, TRUE, 0);
|
||||
|
||||
|
@ -526,6 +526,7 @@ create_toolbox ()
|
|||
|
||||
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
|
||||
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
|
||||
session_set_window_geometry (window, &toolbox_session_info, TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (toolbox_delete),
|
||||
|
|
|
@ -349,7 +349,7 @@ create_tools (GtkWidget *parent)
|
|||
gint i, j;
|
||||
|
||||
/*create_logo (parent);*/
|
||||
wbox = GTK_WIDGET (gtk_type_new (gtk_hwrap_box_get_type ()));
|
||||
wbox = gtk_hwrap_box_new (FALSE);
|
||||
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (wbox), .36);
|
||||
gtk_box_pack_start (GTK_BOX (parent), wbox, TRUE, TRUE, 0);
|
||||
|
||||
|
@ -526,6 +526,7 @@ create_toolbox ()
|
|||
|
||||
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
|
||||
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
|
||||
session_set_window_geometry (window, &toolbox_session_info, TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (toolbox_delete),
|
||||
|
|
|
@ -88,6 +88,18 @@ gtk_hwrap_box_init (GtkHWrapBox *hwbox)
|
|||
hwbox->max_child_height = 0;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_hwrap_box_new (gboolean homogeneous)
|
||||
{
|
||||
GtkHWrapBox *hwbox;
|
||||
|
||||
hwbox = GTK_HWRAP_BOX (gtk_widget_new (gtk_hwrap_box_get_type (), NULL));
|
||||
|
||||
GTK_WRAP_BOX (hwbox)->homogeneous = homogeneous ? TRUE : FALSE;
|
||||
|
||||
return GTK_WIDGET (hwbox);
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_child_requisition (GtkWrapBox *wbox,
|
||||
GtkWidget *child,
|
||||
|
@ -252,10 +264,10 @@ gtk_hwrap_box_size_request (GtkWidget *widget,
|
|||
}
|
||||
|
||||
/*<h2v-off>*/
|
||||
g_print ("ratio for width %d height %d = %f\n",
|
||||
/* g_print ("ratio for width %d height %d = %f\n",
|
||||
(gint) layout_width,
|
||||
(gint) layout_height,
|
||||
ratio);
|
||||
ratio); */
|
||||
/*<h2v-on>*/
|
||||
}
|
||||
while (row_inc);
|
||||
|
@ -263,9 +275,9 @@ gtk_hwrap_box_size_request (GtkWidget *widget,
|
|||
/*<h2v-off>*/
|
||||
requisition->width += GTK_CONTAINER (wbox)->border_width * 2;
|
||||
requisition->height += GTK_CONTAINER (wbox)->border_width * 2;
|
||||
g_print ("choosen: width %d, height %d\n",
|
||||
/* g_print ("choosen: width %d, height %d\n",
|
||||
requisition->width,
|
||||
requisition->height);
|
||||
requisition->height); */
|
||||
/*<h2v-on>*/
|
||||
}
|
||||
|
||||
|
@ -449,11 +461,11 @@ layout_row (GtkWrapBox *wbox,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_print ("child_allocation.x %d += %d * %f ",
|
||||
child_allocation.x, n_children, extra);
|
||||
/* g_print ("child_allocation.x %d += %d * %f ",
|
||||
child_allocation.x, n_children, extra); */
|
||||
child_allocation.x += n_children * extra;
|
||||
g_print ("= %d\n",
|
||||
child_allocation.x);
|
||||
/* g_print ("= %d\n",
|
||||
child_allocation.x); */
|
||||
child_allocation.width = MIN (child_requisition.width,
|
||||
area->width - child_allocation.x + area->x);
|
||||
}
|
||||
|
@ -619,9 +631,9 @@ gtk_hwrap_box_size_allocate (GtkWidget *widget,
|
|||
area.height = MAX (1, (gint) allocation->height - border * 2);
|
||||
|
||||
/*<h2v-off>*/
|
||||
g_print ("got: width %d, height %d\n",
|
||||
/* g_print ("got: width %d, height %d\n",
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
allocation->height); */
|
||||
/*<h2v-on>*/
|
||||
|
||||
layout_rows (wbox, &area);
|
||||
|
|
|
@ -61,7 +61,7 @@ struct _GtkHWrapBoxClass
|
|||
|
||||
/* --- prototypes --- */
|
||||
GtkType gtk_hwrap_box_get_type (void);
|
||||
|
||||
GtkWidget* gtk_hwrap_box_new (gboolean homogeneous);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "gtkwrapbox.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "gtkwrapbox.h"
|
||||
|
||||
|
||||
/* --- arguments --- */
|
||||
enum {
|
||||
|
|
|
@ -123,7 +123,3 @@ void gtk_wrap_box_set_child_packing (GtkWrapBox *wbox,
|
|||
|
||||
|
||||
#endif /* __GTK_WRAP_BOX_H__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ create_tools (GtkWidget *parent)
|
|||
gint i, j;
|
||||
|
||||
/*create_logo (parent);*/
|
||||
wbox = GTK_WIDGET (gtk_type_new (gtk_hwrap_box_get_type ()));
|
||||
wbox = gtk_hwrap_box_new (FALSE);
|
||||
gtk_wrap_box_set_aspect_ratio (GTK_WRAP_BOX (wbox), .36);
|
||||
gtk_box_pack_start (GTK_BOX (parent), wbox, TRUE, TRUE, 0);
|
||||
|
||||
|
@ -526,6 +526,7 @@ create_toolbox ()
|
|||
|
||||
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
|
||||
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
|
||||
session_set_window_geometry (window, &toolbox_session_info, TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (toolbox_delete),
|
||||
|
|
|
@ -630,6 +630,33 @@ blend_motion (Tool *tool,
|
|||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
|
||||
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
|
||||
|
||||
|
||||
/* Restrict to multiples of 45 degrees if shift is pressed */
|
||||
if (mevent->state & GDK_SHIFT_MASK) {
|
||||
int dx, dy, d;
|
||||
int abs_dx, abs_dy;
|
||||
|
||||
dx = blend_tool->endx - blend_tool->startx;
|
||||
dy = blend_tool->endy - blend_tool->starty;
|
||||
abs_dx = abs(dx);
|
||||
abs_dy = abs(dy);
|
||||
|
||||
d = (abs_dx + abs_dy) >> 1;
|
||||
|
||||
if ((abs_dx >> 1) < abs_dy && (abs_dy >> 1) < abs_dx)
|
||||
{
|
||||
blend_tool->endx = blend_tool->startx + ((dx < 0) ? -d : d);
|
||||
blend_tool->endy = blend_tool->starty + ((dy < 0) ? -d : d);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs_dx > abs_dy)
|
||||
blend_tool->endy = blend_tool->starty;
|
||||
else
|
||||
blend_tool->endx = blend_tool->startx;
|
||||
}
|
||||
}
|
||||
|
||||
/* restrict to horizontal/vertical blend, if modifiers are pressed */
|
||||
if (mevent->state & GDK_MOD1_MASK)
|
||||
{
|
||||
|
|
|
@ -630,6 +630,33 @@ blend_motion (Tool *tool,
|
|||
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y,
|
||||
&blend_tool->endx, &blend_tool->endy, FALSE, 1);
|
||||
|
||||
|
||||
/* Restrict to multiples of 45 degrees if shift is pressed */
|
||||
if (mevent->state & GDK_SHIFT_MASK) {
|
||||
int dx, dy, d;
|
||||
int abs_dx, abs_dy;
|
||||
|
||||
dx = blend_tool->endx - blend_tool->startx;
|
||||
dy = blend_tool->endy - blend_tool->starty;
|
||||
abs_dx = abs(dx);
|
||||
abs_dy = abs(dy);
|
||||
|
||||
d = (abs_dx + abs_dy) >> 1;
|
||||
|
||||
if ((abs_dx >> 1) < abs_dy && (abs_dy >> 1) < abs_dx)
|
||||
{
|
||||
blend_tool->endx = blend_tool->startx + ((dx < 0) ? -d : d);
|
||||
blend_tool->endy = blend_tool->starty + ((dy < 0) ? -d : d);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs_dx > abs_dy)
|
||||
blend_tool->endy = blend_tool->starty;
|
||||
else
|
||||
blend_tool->endx = blend_tool->startx;
|
||||
}
|
||||
}
|
||||
|
||||
/* restrict to horizontal/vertical blend, if modifiers are pressed */
|
||||
if (mevent->state & GDK_MOD1_MASK)
|
||||
{
|
||||
|
|
|
@ -88,6 +88,18 @@ gtk_hwrap_box_init (GtkHWrapBox *hwbox)
|
|||
hwbox->max_child_height = 0;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_hwrap_box_new (gboolean homogeneous)
|
||||
{
|
||||
GtkHWrapBox *hwbox;
|
||||
|
||||
hwbox = GTK_HWRAP_BOX (gtk_widget_new (gtk_hwrap_box_get_type (), NULL));
|
||||
|
||||
GTK_WRAP_BOX (hwbox)->homogeneous = homogeneous ? TRUE : FALSE;
|
||||
|
||||
return GTK_WIDGET (hwbox);
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_child_requisition (GtkWrapBox *wbox,
|
||||
GtkWidget *child,
|
||||
|
@ -252,10 +264,10 @@ gtk_hwrap_box_size_request (GtkWidget *widget,
|
|||
}
|
||||
|
||||
/*<h2v-off>*/
|
||||
g_print ("ratio for width %d height %d = %f\n",
|
||||
/* g_print ("ratio for width %d height %d = %f\n",
|
||||
(gint) layout_width,
|
||||
(gint) layout_height,
|
||||
ratio);
|
||||
ratio); */
|
||||
/*<h2v-on>*/
|
||||
}
|
||||
while (row_inc);
|
||||
|
@ -263,9 +275,9 @@ gtk_hwrap_box_size_request (GtkWidget *widget,
|
|||
/*<h2v-off>*/
|
||||
requisition->width += GTK_CONTAINER (wbox)->border_width * 2;
|
||||
requisition->height += GTK_CONTAINER (wbox)->border_width * 2;
|
||||
g_print ("choosen: width %d, height %d\n",
|
||||
/* g_print ("choosen: width %d, height %d\n",
|
||||
requisition->width,
|
||||
requisition->height);
|
||||
requisition->height); */
|
||||
/*<h2v-on>*/
|
||||
}
|
||||
|
||||
|
@ -449,11 +461,11 @@ layout_row (GtkWrapBox *wbox,
|
|||
}
|
||||
else
|
||||
{
|
||||
g_print ("child_allocation.x %d += %d * %f ",
|
||||
child_allocation.x, n_children, extra);
|
||||
/* g_print ("child_allocation.x %d += %d * %f ",
|
||||
child_allocation.x, n_children, extra); */
|
||||
child_allocation.x += n_children * extra;
|
||||
g_print ("= %d\n",
|
||||
child_allocation.x);
|
||||
/* g_print ("= %d\n",
|
||||
child_allocation.x); */
|
||||
child_allocation.width = MIN (child_requisition.width,
|
||||
area->width - child_allocation.x + area->x);
|
||||
}
|
||||
|
@ -619,9 +631,9 @@ gtk_hwrap_box_size_allocate (GtkWidget *widget,
|
|||
area.height = MAX (1, (gint) allocation->height - border * 2);
|
||||
|
||||
/*<h2v-off>*/
|
||||
g_print ("got: width %d, height %d\n",
|
||||
/* g_print ("got: width %d, height %d\n",
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
allocation->height); */
|
||||
/*<h2v-on>*/
|
||||
|
||||
layout_rows (wbox, &area);
|
||||
|
|
|
@ -61,7 +61,7 @@ struct _GtkHWrapBoxClass
|
|||
|
||||
/* --- prototypes --- */
|
||||
GtkType gtk_hwrap_box_get_type (void);
|
||||
|
||||
GtkWidget* gtk_hwrap_box_new (gboolean homogeneous);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "gtkwrapbox.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "gtkwrapbox.h"
|
||||
|
||||
|
||||
/* --- arguments --- */
|
||||
enum {
|
||||
|
|
|
@ -123,7 +123,3 @@ void gtk_wrap_box_set_child_packing (GtkWrapBox *wbox,
|
|||
|
||||
|
||||
#endif /* __GTK_WRAP_BOX_H__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue