replaced the QMask radio buttons ba a single check button. Still needs
2001-11-29 Michael Natterer <mitch@gimp.org> * app/display/gimpdisplayshell.[ch]: replaced the QMask radio buttons ba a single check button. Still needs some tuning. * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-qmask.[ch]: changed accordingly. * app/tools/gimptool.[ch]: added "gboolean handle_empty_image" to the GimpTool structure. * app/tools/gimpmovetool.c: set it to TRUE. * app/tools/gimpfuzzyselecttool.c: don't gimp_[set|unset]_busy() while calculating the selection but set the busy cursor on the display manually (we have the pointer grabbed anyway). * app/display/gimpdisplayshell-callbacks.c: don't check for GIMP_IS_MODE_TOOL(active_tool) but look at active_tool->handle_empty_image. Removed the checks for GIMP_IS_FUZZY_SELECT_TOOL(active_tool) because fuzzy_select doesn't set GIMP busy while it's active any more. * app/tools/transform_options.[ch] * app/tools/gimptransformtool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c: added widgets for the transform tools' constraints (one more #51108 issue fixed). * app/tools/gimperasertool.c: cosmetic. * app/widgets/gimpdockbook.c: don't hardcode GtkNotebook's tab_border to 0 but add a style property for it... * themes/Default/gtkrc: ...and set it to 0 here.
This commit is contained in:

committed by
Michael Natterer

parent
ea1173c638
commit
bf6e5a4b9d
36
ChangeLog
36
ChangeLog
@ -1,3 +1,39 @@
|
||||
2001-11-29 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell.[ch]: replaced the QMask radio
|
||||
buttons ba a single check button. Still needs some tuning.
|
||||
|
||||
* app/display/gimpdisplayshell-handlers.c
|
||||
* app/display/gimpdisplayshell-qmask.[ch]: changed accordingly.
|
||||
|
||||
* app/tools/gimptool.[ch]: added "gboolean handle_empty_image" to
|
||||
the GimpTool structure.
|
||||
|
||||
* app/tools/gimpmovetool.c: set it to TRUE.
|
||||
|
||||
* app/tools/gimpfuzzyselecttool.c: don't gimp_[set|unset]_busy()
|
||||
while calculating the selection but set the busy cursor on the
|
||||
display manually (we have the pointer grabbed anyway).
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c: don't check for
|
||||
GIMP_IS_MODE_TOOL(active_tool) but look at
|
||||
active_tool->handle_empty_image. Removed the checks for
|
||||
GIMP_IS_FUZZY_SELECT_TOOL(active_tool) because fuzzy_select
|
||||
doesn't set GIMP busy while it's active any more.
|
||||
|
||||
* app/tools/transform_options.[ch]
|
||||
* app/tools/gimptransformtool.c
|
||||
* app/tools/gimprotatetool.c
|
||||
* app/tools/gimpscaletool.c: added widgets for the transform tools'
|
||||
constraints (one more #51108 issue fixed).
|
||||
|
||||
* app/tools/gimperasertool.c: cosmetic.
|
||||
|
||||
* app/widgets/gimpdockbook.c: don't hardcode GtkNotebook's
|
||||
tab_border to 0 but add a style property for it...
|
||||
|
||||
* themes/Default/gtkrc: ...and set it to 0 here.
|
||||
|
||||
2001-11-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpbase/gimpenv.c
|
||||
|
@ -94,47 +94,8 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_off_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *mask;
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
gimp_display_shell_qmask_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
@ -144,10 +105,10 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set, do nothing */
|
||||
|
||||
@ -208,6 +169,33 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
G_CALLBACK (qmask_removed_callback),
|
||||
gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,47 +94,8 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_off_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *mask;
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
gimp_display_shell_qmask_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
@ -144,10 +105,10 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set, do nothing */
|
||||
|
||||
@ -208,6 +169,33 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
G_CALLBACK (qmask_removed_callback),
|
||||
gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,47 +94,8 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_off_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *mask;
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
gimp_display_shell_qmask_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
@ -144,10 +105,10 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set, do nothing */
|
||||
|
||||
@ -208,6 +169,33 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
G_CALLBACK (qmask_removed_callback),
|
||||
gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,47 +94,8 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_off_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *mask;
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
gimp_display_shell_qmask_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
@ -144,10 +105,10 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set, do nothing */
|
||||
|
||||
@ -208,6 +169,33 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
G_CALLBACK (qmask_removed_callback),
|
||||
gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "display-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontainer.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
@ -36,7 +37,6 @@
|
||||
|
||||
#include "tools/tools-types.h"
|
||||
|
||||
#include "tools/gimpfuzzyselecttool.h"
|
||||
#include "tools/gimpmovetool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
||||
@ -383,6 +383,24 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_FOCUS_CHANGE:
|
||||
{
|
||||
GdkEventFocus *fevent;
|
||||
|
||||
fevent = (GdkEventFocus *) event;
|
||||
|
||||
if (fevent->in)
|
||||
GTK_WIDGET_SET_FLAGS (canvas, GTK_HAS_FOCUS);
|
||||
else
|
||||
GTK_WIDGET_UNSET_FLAGS (canvas, GTK_HAS_FOCUS);
|
||||
|
||||
/* stop the signal because otherwise gtk+ exposes the whole
|
||||
* canvas to get the non-existant focus indicator drawn
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_ENTER_NOTIFY:
|
||||
{
|
||||
GdkEventCrossing *cevent;
|
||||
@ -495,7 +513,7 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
/* FIXME!!! This code is ugly */
|
||||
|
||||
if (active_tool && (! gimp_image_is_empty (gdisp->gimage) ||
|
||||
GIMP_IS_MOVE_TOOL (active_tool) /* EEK */))
|
||||
active_tool->handle_empty_image))
|
||||
{
|
||||
if (active_tool->auto_snap_to)
|
||||
{
|
||||
@ -518,8 +536,8 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
{
|
||||
tool_manager_initialize_active (gdisp->gimage->gimp, gdisp);
|
||||
}
|
||||
else if ((gimp_image_active_drawable (gdisp->gimage) !=
|
||||
active_tool->drawable) &&
|
||||
else if ((active_tool->drawable !=
|
||||
gimp_image_active_drawable (gdisp->gimage)) &&
|
||||
! active_tool->preserve)
|
||||
{
|
||||
/* create a new one, deleting the current
|
||||
@ -569,16 +587,7 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
|
||||
/* ugly side condition: all operations which set busy cursors are
|
||||
* invoked on BUTTON_RELEASE, thus no new BUTTON_PRESS events are
|
||||
* accepted while Gimp is busy, thus it should be safe to block
|
||||
* BUTTON_RELEASE. --Mitch
|
||||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gdisp->gimage->gimp->busy &&
|
||||
! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gdisp->gimage->gimp->busy)
|
||||
return TRUE;
|
||||
|
||||
switch (bevent->button)
|
||||
@ -595,8 +604,8 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
|
||||
gtk_grab_remove (canvas);
|
||||
|
||||
if (active_tool && (GIMP_IS_MOVE_TOOL (active_tool) ||
|
||||
! gimp_image_is_empty (gdisp->gimage)))
|
||||
if (active_tool && (! gimp_image_is_empty (gdisp->gimage) ||
|
||||
active_tool->handle_empty_image))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
{
|
||||
@ -699,16 +708,7 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
|
||||
mevent = (GdkEventMotion *) event;
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
|
||||
/* for the same reason we block BUTTON_RELEASE,
|
||||
* we block MOTION_NOTIFY. --Mitch
|
||||
*
|
||||
* ugly: fuzzy_select sets busy cursors while ACTIVE.
|
||||
*/
|
||||
if (gdisp->gimage->gimp->busy &&
|
||||
! (GIMP_IS_FUZZY_SELECT_TOOL (active_tool) &&
|
||||
active_tool->state == ACTIVE))
|
||||
if (gdisp->gimage->gimp->busy)
|
||||
return TRUE;
|
||||
|
||||
/* Ask for the pointer position, but ignore it except for cursor
|
||||
@ -729,9 +729,11 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
gimp_display_shell_check_device_cursor (shell);
|
||||
}
|
||||
|
||||
active_tool = tool_manager_get_active (gdisp->gimage->gimp);
|
||||
|
||||
if ((state & GDK_BUTTON1_MASK) &&
|
||||
active_tool && (! gimp_image_is_empty (gdisp->gimage) ||
|
||||
GIMP_IS_MOVE_TOOL (active_tool)))
|
||||
active_tool->handle_empty_image))
|
||||
{
|
||||
if (active_tool->state == ACTIVE)
|
||||
{
|
||||
@ -954,7 +956,8 @@ gimp_display_shell_canvas_events (GtkWidget *canvas,
|
||||
|
||||
if (active_tool)
|
||||
{
|
||||
if (! gimp_image_is_empty (gdisp->gimage) &&
|
||||
if ((! gimp_image_is_empty (gdisp->gimage) ||
|
||||
active_tool->handle_empty_image) &&
|
||||
! (state & (GDK_BUTTON1_MASK |
|
||||
GDK_BUTTON2_MASK |
|
||||
GDK_BUTTON3_MASK)))
|
||||
@ -1007,8 +1010,9 @@ gimp_display_shell_hruler_button_press (GtkWidget *widget,
|
||||
GimpToolInfo *tool_info;
|
||||
GimpTool *active_tool;
|
||||
|
||||
tool_info = tool_manager_get_info_by_type (gdisp->gimage->gimp,
|
||||
GIMP_TYPE_MOVE_TOOL);
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gdisp->gimage->gimp->tool_info_list,
|
||||
"gimp:move_tool");
|
||||
|
||||
if (tool_info)
|
||||
{
|
||||
@ -1045,8 +1049,9 @@ gimp_display_shell_vruler_button_press (GtkWidget *widget,
|
||||
GimpToolInfo *tool_info;
|
||||
GimpTool *active_tool;
|
||||
|
||||
tool_info = tool_manager_get_info_by_type (gdisp->gimage->gimp,
|
||||
GIMP_TYPE_MOVE_TOOL);
|
||||
tool_info = (GimpToolInfo *)
|
||||
gimp_container_get_child_by_name (gdisp->gimage->gimp->tool_info_list,
|
||||
"gimp:move_tool");
|
||||
|
||||
if (tool_info)
|
||||
{
|
||||
|
@ -198,8 +198,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
||||
|
||||
shell->hsb = NULL;
|
||||
shell->vsb = NULL;
|
||||
shell->qmaskoff = NULL;
|
||||
shell->qmaskon = NULL;
|
||||
shell->qmask = NULL;
|
||||
shell->hrule = NULL;
|
||||
shell->vrule = NULL;
|
||||
shell->origin = NULL;
|
||||
@ -336,7 +335,6 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
GtkWidget *image;
|
||||
GtkWidget *label_frame;
|
||||
GtkWidget *nav_ebox;
|
||||
GSList *group = NULL;
|
||||
gint image_width, image_height;
|
||||
gint n_width, n_height;
|
||||
gint s_width, s_height;
|
||||
@ -467,8 +465,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
* | |
|
||||
* | +-- lower_hbox
|
||||
* | |
|
||||
* | +-- qmaskoff
|
||||
* | +-- qmaskon
|
||||
* | +-- qmask
|
||||
* | +-- hscrollbar
|
||||
* | +-- navbutton
|
||||
* |
|
||||
@ -509,7 +506,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
gtk_box_pack_start (GTK_BOX (upper_hbox), right_vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
|
||||
/* the hbox containing qmask buttons, vertical scrollbar and nav button */
|
||||
/* the hbox containing qmask button, vertical scrollbar and nav button */
|
||||
lower_hbox = gtk_hbox_new (FALSE, 1);
|
||||
gtk_box_pack_start (GTK_BOX (disp_vbox), lower_hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (lower_hbox);
|
||||
@ -625,50 +622,38 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
|
||||
/* create the contents of the lower_hbox *********************************/
|
||||
|
||||
/* the qmask buttons */
|
||||
shell->qmaskoff = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (shell->qmaskoff));
|
||||
gtk_widget_set_usize (GTK_WIDGET (shell->qmaskoff), 16, 16);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (shell->qmaskoff), FALSE);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmaskoff, GTK_CAN_FOCUS);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmaskoff), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
gimp_help_set_help_data (shell->qmaskoff, NULL, "#qmask_off_button");
|
||||
|
||||
shell->qmaskon = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (shell->qmaskon));
|
||||
gtk_widget_set_usize (GTK_WIDGET (shell->qmaskon), 16, 16);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (shell->qmaskon), FALSE);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmaskon, GTK_CAN_FOCUS);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_ON, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmaskon), image);
|
||||
gtk_widget_show (image);
|
||||
/* the qmask button */
|
||||
shell->qmask = gtk_check_button_new ();
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (shell->qmask), FALSE);
|
||||
gtk_widget_set_usize (GTK_WIDGET (shell->qmask), 16, 16);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmask, GTK_CAN_FOCUS);
|
||||
|
||||
if (gdisp->gimage->qmask_state)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskon), TRUE);
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), TRUE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_ON,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskoff), TRUE);
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->qmaskoff), "toggled",
|
||||
G_CALLBACK (gimp_display_shell_qmask_off_toggled),
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmask), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
gimp_help_set_help_data (shell->qmask,
|
||||
_("Toggle QuickMask"), "#qmask_button");
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->qmask), "toggled",
|
||||
G_CALLBACK (gimp_display_shell_qmask_toggled),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (shell->qmaskoff), "button_press_event",
|
||||
g_signal_connect (G_OBJECT (shell->qmask), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_qmask_button_press),
|
||||
shell);
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->qmaskon), "toggled",
|
||||
G_CALLBACK (gimp_display_shell_qmask_on_toggled),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (shell->qmaskon), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_qmask_button_press),
|
||||
shell);
|
||||
|
||||
gimp_help_set_help_data (shell->qmaskon, NULL, "#qmask_on_button");
|
||||
|
||||
/* the navigation window button */
|
||||
nav_ebox = gtk_event_box_new ();
|
||||
|
||||
@ -739,8 +724,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), shell->vsb, TRUE, TRUE, 0);
|
||||
|
||||
/* fill the lower_hbox */
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->qmaskoff, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->qmaskon, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->qmask, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->hsb, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), nav_ebox, FALSE, FALSE, 0);
|
||||
|
||||
@ -765,8 +749,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
|
||||
gtk_widget_show (shell->padding_button);
|
||||
|
||||
gtk_widget_show (shell->qmaskoff);
|
||||
gtk_widget_show (shell->qmaskon);
|
||||
gtk_widget_show (shell->qmask);
|
||||
gtk_widget_show (nav_ebox);
|
||||
|
||||
gtk_widget_show (label_frame);
|
||||
|
@ -75,8 +75,7 @@ struct _GimpDisplayShell
|
||||
|
||||
GtkWidget *hsb; /* scroll bars */
|
||||
GtkWidget *vsb;
|
||||
GtkWidget *qmaskoff; /* qmask buttons */
|
||||
GtkWidget *qmaskon;
|
||||
GtkWidget *qmask; /* qmask button */
|
||||
GtkWidget *hrule; /* rulers */
|
||||
GtkWidget *vrule;
|
||||
GtkWidget *origin; /* origin button */
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
@ -177,28 +179,25 @@ static void
|
||||
gimp_display_shell_qmask_changed_handler (GimpImage *gimage,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
if (shell->gdisp->gimage->qmask_state !=
|
||||
GTK_TOGGLE_BUTTON (shell->qmaskon)->active)
|
||||
{
|
||||
g_signal_handlers_block_by_func (G_OBJECT (shell->qmaskon),
|
||||
gimp_display_shell_qmask_on_toggled,
|
||||
shell);
|
||||
g_signal_handlers_block_by_func (G_OBJECT (shell->qmaskoff),
|
||||
gimp_display_shell_qmask_off_toggled,
|
||||
shell);
|
||||
GtkImage *image;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskon),
|
||||
shell->gdisp->gimage->qmask_state);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskoff),
|
||||
! shell->gdisp->gimage->qmask_state);
|
||||
image = GTK_IMAGE (GTK_BIN (shell->qmask)->child);
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (shell->qmaskon),
|
||||
gimp_display_shell_qmask_on_toggled,
|
||||
shell);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (shell->qmaskoff),
|
||||
gimp_display_shell_qmask_off_toggled,
|
||||
shell);
|
||||
}
|
||||
g_signal_handlers_block_by_func (G_OBJECT (shell->qmask),
|
||||
gimp_display_shell_qmask_toggled,
|
||||
shell);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask),
|
||||
shell->gdisp->gimage->qmask_state);
|
||||
|
||||
if (shell->gdisp->gimage->qmask_state)
|
||||
gtk_image_set_from_stock (image, GIMP_STOCK_QMASK_ON, GTK_ICON_SIZE_MENU);
|
||||
else
|
||||
gtk_image_set_from_stock (image, GIMP_STOCK_QMASK_OFF, GTK_ICON_SIZE_MENU);
|
||||
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (shell->qmask),
|
||||
gimp_display_shell_qmask_toggled,
|
||||
shell);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -94,47 +94,8 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_off_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *mask;
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
gimp_display_shell_qmask_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
@ -144,10 +105,10 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set, do nothing */
|
||||
|
||||
@ -208,6 +169,33 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
G_CALLBACK (qmask_removed_callback),
|
||||
gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,13 +20,11 @@
|
||||
#define __GIMP_DISPLAY_SHELL_QMASK_H__
|
||||
|
||||
|
||||
gboolean gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GimpDisplayShell *shell);
|
||||
void gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell);
|
||||
void gimp_display_shell_qmask_off_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell);
|
||||
gboolean gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
GimpDisplayShell *shell);
|
||||
void gimp_display_shell_qmask_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_SHELL_QMASK_H__ */
|
||||
|
@ -198,8 +198,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
||||
|
||||
shell->hsb = NULL;
|
||||
shell->vsb = NULL;
|
||||
shell->qmaskoff = NULL;
|
||||
shell->qmaskon = NULL;
|
||||
shell->qmask = NULL;
|
||||
shell->hrule = NULL;
|
||||
shell->vrule = NULL;
|
||||
shell->origin = NULL;
|
||||
@ -336,7 +335,6 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
GtkWidget *image;
|
||||
GtkWidget *label_frame;
|
||||
GtkWidget *nav_ebox;
|
||||
GSList *group = NULL;
|
||||
gint image_width, image_height;
|
||||
gint n_width, n_height;
|
||||
gint s_width, s_height;
|
||||
@ -467,8 +465,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
* | |
|
||||
* | +-- lower_hbox
|
||||
* | |
|
||||
* | +-- qmaskoff
|
||||
* | +-- qmaskon
|
||||
* | +-- qmask
|
||||
* | +-- hscrollbar
|
||||
* | +-- navbutton
|
||||
* |
|
||||
@ -509,7 +506,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
gtk_box_pack_start (GTK_BOX (upper_hbox), right_vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
|
||||
/* the hbox containing qmask buttons, vertical scrollbar and nav button */
|
||||
/* the hbox containing qmask button, vertical scrollbar and nav button */
|
||||
lower_hbox = gtk_hbox_new (FALSE, 1);
|
||||
gtk_box_pack_start (GTK_BOX (disp_vbox), lower_hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (lower_hbox);
|
||||
@ -625,50 +622,38 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
|
||||
/* create the contents of the lower_hbox *********************************/
|
||||
|
||||
/* the qmask buttons */
|
||||
shell->qmaskoff = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (shell->qmaskoff));
|
||||
gtk_widget_set_usize (GTK_WIDGET (shell->qmaskoff), 16, 16);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (shell->qmaskoff), FALSE);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmaskoff, GTK_CAN_FOCUS);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmaskoff), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
gimp_help_set_help_data (shell->qmaskoff, NULL, "#qmask_off_button");
|
||||
|
||||
shell->qmaskon = gtk_radio_button_new (group);
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (shell->qmaskon));
|
||||
gtk_widget_set_usize (GTK_WIDGET (shell->qmaskon), 16, 16);
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (shell->qmaskon), FALSE);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmaskon, GTK_CAN_FOCUS);
|
||||
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_ON, GTK_ICON_SIZE_MENU);
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmaskon), image);
|
||||
gtk_widget_show (image);
|
||||
/* the qmask button */
|
||||
shell->qmask = gtk_check_button_new ();
|
||||
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (shell->qmask), FALSE);
|
||||
gtk_widget_set_usize (GTK_WIDGET (shell->qmask), 16, 16);
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->qmask, GTK_CAN_FOCUS);
|
||||
|
||||
if (gdisp->gimage->qmask_state)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskon), TRUE);
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), TRUE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_ON,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
else
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmaskoff), TRUE);
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (shell->qmask), FALSE);
|
||||
image = gtk_image_new_from_stock (GIMP_STOCK_QMASK_OFF,
|
||||
GTK_ICON_SIZE_MENU);
|
||||
}
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->qmaskoff), "toggled",
|
||||
G_CALLBACK (gimp_display_shell_qmask_off_toggled),
|
||||
gtk_container_add (GTK_CONTAINER (shell->qmask), image);
|
||||
gtk_widget_show (image);
|
||||
|
||||
gimp_help_set_help_data (shell->qmask,
|
||||
_("Toggle QuickMask"), "#qmask_button");
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->qmask), "toggled",
|
||||
G_CALLBACK (gimp_display_shell_qmask_toggled),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (shell->qmaskoff), "button_press_event",
|
||||
g_signal_connect (G_OBJECT (shell->qmask), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_qmask_button_press),
|
||||
shell);
|
||||
|
||||
g_signal_connect (G_OBJECT (shell->qmaskon), "toggled",
|
||||
G_CALLBACK (gimp_display_shell_qmask_on_toggled),
|
||||
shell);
|
||||
g_signal_connect (G_OBJECT (shell->qmaskon), "button_press_event",
|
||||
G_CALLBACK (gimp_display_shell_qmask_button_press),
|
||||
shell);
|
||||
|
||||
gimp_help_set_help_data (shell->qmaskon, NULL, "#qmask_on_button");
|
||||
|
||||
/* the navigation window button */
|
||||
nav_ebox = gtk_event_box_new ();
|
||||
|
||||
@ -739,8 +724,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), shell->vsb, TRUE, TRUE, 0);
|
||||
|
||||
/* fill the lower_hbox */
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->qmaskoff, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->qmaskon, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->qmask, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), shell->hsb, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (lower_hbox), nav_ebox, FALSE, FALSE, 0);
|
||||
|
||||
@ -765,8 +749,7 @@ gimp_display_shell_new (GimpDisplay *gdisp)
|
||||
|
||||
gtk_widget_show (shell->padding_button);
|
||||
|
||||
gtk_widget_show (shell->qmaskoff);
|
||||
gtk_widget_show (shell->qmaskon);
|
||||
gtk_widget_show (shell->qmask);
|
||||
gtk_widget_show (nav_ebox);
|
||||
|
||||
gtk_widget_show (label_frame);
|
||||
|
@ -75,8 +75,7 @@ struct _GimpDisplayShell
|
||||
|
||||
GtkWidget *hsb; /* scroll bars */
|
||||
GtkWidget *vsb;
|
||||
GtkWidget *qmaskoff; /* qmask buttons */
|
||||
GtkWidget *qmaskon;
|
||||
GtkWidget *qmask; /* qmask button */
|
||||
GtkWidget *hrule; /* rulers */
|
||||
GtkWidget *vrule;
|
||||
GtkWidget *origin; /* origin button */
|
||||
|
@ -94,47 +94,8 @@ gimp_display_shell_qmask_button_press (GtkWidget *widget,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_off_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
GimpChannel *mask;
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
gimp_display_shell_qmask_toggled (GtkWidget *widget,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
GimpDisplay *gdisp;
|
||||
GimpImage *gimage;
|
||||
@ -144,10 +105,10 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
|
||||
gdisp = shell->gdisp;
|
||||
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set, do nothing */
|
||||
|
||||
@ -208,6 +169,33 @@ gimp_display_shell_qmask_on_toggled (GtkWidget *widget,
|
||||
G_CALLBACK (qmask_removed_callback),
|
||||
gdisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimage = gdisp->gimage;
|
||||
|
||||
if (! gimp_image_get_qmask_state (gimage))
|
||||
return; /* if already set do nothing */
|
||||
|
||||
mask = gimp_image_get_channel_by_name (gimage, "Qmask");
|
||||
|
||||
if (mask)
|
||||
{
|
||||
undo_push_group_start (gimage, QMASK_UNDO);
|
||||
/* push the undo here since removing the mask will
|
||||
* call the qmask_removed_callback() which will set
|
||||
* the qmask_state to FALSE
|
||||
*/
|
||||
undo_push_qmask (gimage);
|
||||
gimp_image_mask_load (gimage, mask);
|
||||
gimp_image_remove_channel (gimage, mask);
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
|
||||
gimp_image_set_qmask_state (gdisp->gimage, FALSE);
|
||||
|
||||
if (mask)
|
||||
gdisplays_flush ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,8 +186,8 @@ gimp_eraser_tool_modifier_key (GimpTool *tool,
|
||||
if ((key == GDK_CONTROL_MASK) &&
|
||||
! (state & GDK_SHIFT_MASK)) /* leave stuff untouched in line draw mode */
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (options->anti_erase_w), ! options->anti_erase);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->anti_erase_w),
|
||||
! options->anti_erase);
|
||||
}
|
||||
|
||||
tool->toggled = options->anti_erase;
|
||||
|
@ -186,8 +186,8 @@ gimp_eraser_tool_modifier_key (GimpTool *tool,
|
||||
if ((key == GDK_CONTROL_MASK) &&
|
||||
! (state & GDK_SHIFT_MASK)) /* leave stuff untouched in line draw mode */
|
||||
{
|
||||
gtk_toggle_button_set_active
|
||||
(GTK_TOGGLE_BUTTON (options->anti_erase_w), ! options->anti_erase);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->anti_erase_w),
|
||||
! options->anti_erase);
|
||||
}
|
||||
|
||||
tool->toggled = options->anti_erase;
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
@ -366,7 +365,8 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
gimp_set_busy (gdisp->gimage->gimp);
|
||||
gimp_display_shell_install_override_cursor (GIMP_DISPLAY_SHELL (gdisp->shell),
|
||||
GDK_WATCH);
|
||||
|
||||
x = fuzzy_sel->x;
|
||||
y = fuzzy_sel->y;
|
||||
@ -428,7 +428,7 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
||||
/* free boundary segments */
|
||||
g_free (bsegs);
|
||||
|
||||
gimp_unset_busy (gdisp->gimage->gimp);
|
||||
gimp_display_shell_remove_override_cursor (GIMP_DISPLAY_SHELL (gdisp->shell));
|
||||
|
||||
return segs;
|
||||
}
|
||||
|
@ -182,9 +182,10 @@ gimp_move_tool_init (GimpMoveTool *move_tool)
|
||||
move_tool->guide = NULL;
|
||||
move_tool->disp = NULL;
|
||||
|
||||
tool->tool_cursor = GIMP_MOVE_TOOL_CURSOR;
|
||||
tool->auto_snap_to = FALSE; /* Don't snap to guides */
|
||||
tool->handle_empty_image = TRUE; /* Can handle empty images */
|
||||
|
||||
tool->auto_snap_to = FALSE; /* Don't snap to guides */
|
||||
tool->tool_cursor = GIMP_MOVE_TOOL_CURSOR;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "base/tile-manager.h"
|
||||
#include "base/tile.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpchannel.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
@ -366,7 +365,8 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
||||
|
||||
drawable = gimp_image_active_drawable (gdisp->gimage);
|
||||
|
||||
gimp_set_busy (gdisp->gimage->gimp);
|
||||
gimp_display_shell_install_override_cursor (GIMP_DISPLAY_SHELL (gdisp->shell),
|
||||
GDK_WATCH);
|
||||
|
||||
x = fuzzy_sel->x;
|
||||
y = fuzzy_sel->y;
|
||||
@ -428,7 +428,7 @@ fuzzy_select_calculate (GimpFuzzySelectTool *fuzzy_sel,
|
||||
/* free boundary segments */
|
||||
g_free (bsegs);
|
||||
|
||||
gimp_unset_busy (gdisp->gimage->gimp);
|
||||
gimp_display_shell_remove_override_cursor (GIMP_DISPLAY_SHELL (gdisp->shell));
|
||||
|
||||
return segs;
|
||||
}
|
||||
|
@ -349,9 +349,10 @@ static void
|
||||
rotate_tool_motion (GimpTransformTool *transform_tool,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
gdouble angle1, angle2, angle;
|
||||
gdouble cx, cy;
|
||||
gdouble x1, y1, x2, y2;
|
||||
TransformOptions *options;
|
||||
gdouble angle1, angle2, angle;
|
||||
gdouble cx, cy;
|
||||
gdouble x1, y1, x2, y2;
|
||||
|
||||
if (transform_tool->function == TRANSFORM_HANDLE_CENTER)
|
||||
{
|
||||
@ -363,6 +364,8 @@ rotate_tool_motion (GimpTransformTool *transform_tool,
|
||||
return;
|
||||
}
|
||||
|
||||
options = (TransformOptions *) GIMP_TOOL (transform_tool)->tool_info->tool_options;
|
||||
|
||||
cx = transform_tool->trans_info[CENTER_X];
|
||||
cy = transform_tool->trans_info[CENTER_Y];
|
||||
|
||||
@ -394,13 +397,17 @@ rotate_tool_motion (GimpTransformTool *transform_tool,
|
||||
transform_tool->trans_info[REAL_ANGLE] - 2.0 * G_PI;
|
||||
|
||||
/* constrain the angle to 15-degree multiples if ctrl is held down */
|
||||
if (transform_tool->state & GDK_CONTROL_MASK)
|
||||
transform_tool->trans_info[ANGLE] =
|
||||
FIFTEEN_DEG * (int) ((transform_tool->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
if (options->constrain_1)
|
||||
{
|
||||
transform_tool->trans_info[ANGLE] =
|
||||
FIFTEEN_DEG * (int) ((transform_tool->trans_info[REAL_ANGLE] +
|
||||
FIFTEEN_DEG / 2.0) /
|
||||
FIFTEEN_DEG);
|
||||
}
|
||||
else
|
||||
transform_tool->trans_info[ANGLE] = transform_tool->trans_info[REAL_ANGLE];
|
||||
{
|
||||
transform_tool->trans_info[ANGLE] = transform_tool->trans_info[REAL_ANGLE];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -391,14 +391,17 @@ static void
|
||||
gimp_scale_tool_motion (GimpTransformTool *transform_tool,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
gdouble ratio;
|
||||
gdouble *x1;
|
||||
gdouble *y1;
|
||||
gdouble *x2;
|
||||
gdouble *y2;
|
||||
gint w, h;
|
||||
gint dir_x, dir_y;
|
||||
gint diff_x, diff_y;
|
||||
TransformOptions *options;
|
||||
gdouble ratio;
|
||||
gdouble *x1;
|
||||
gdouble *y1;
|
||||
gdouble *x2;
|
||||
gdouble *y2;
|
||||
gint w, h;
|
||||
gint dir_x, dir_y;
|
||||
gint diff_x, diff_y;
|
||||
|
||||
options = (TransformOptions *) GIMP_TOOL (transform_tool)->tool_info->tool_options;
|
||||
|
||||
diff_x = transform_tool->curx - transform_tool->lastx;
|
||||
diff_y = transform_tool->cury - transform_tool->lasty;
|
||||
@ -450,13 +453,15 @@ gimp_scale_tool_motion (GimpTransformTool *transform_tool,
|
||||
}
|
||||
|
||||
/* if just the mod1 key is down, affect only the height */
|
||||
if (transform_tool->state & GDK_MOD1_MASK &&
|
||||
! (transform_tool->state & GDK_CONTROL_MASK))
|
||||
diff_x = 0;
|
||||
if (options->constrain_2 && ! options->constrain_1)
|
||||
{
|
||||
diff_x = 0;
|
||||
}
|
||||
/* if just the control key is down, affect only the width */
|
||||
else if (transform_tool->state & GDK_CONTROL_MASK &&
|
||||
! (transform_tool->state & GDK_MOD1_MASK))
|
||||
diff_y = 0;
|
||||
else if (options->constrain_1 && ! options->constrain_2)
|
||||
{
|
||||
diff_y = 0;
|
||||
}
|
||||
|
||||
*x1 += diff_x;
|
||||
*y1 += diff_y;
|
||||
@ -482,8 +487,7 @@ gimp_scale_tool_motion (GimpTransformTool *transform_tool,
|
||||
/* if both the control key & mod1 keys are down,
|
||||
* keep the aspect ratio intact
|
||||
*/
|
||||
if (transform_tool->state & GDK_CONTROL_MASK &&
|
||||
transform_tool->state & GDK_MOD1_MASK)
|
||||
if (options->constrain_1 && options->constrain_2)
|
||||
{
|
||||
ratio = ((gdouble) (transform_tool->x2 - transform_tool->x1) /
|
||||
(gdouble) (transform_tool->y2 - transform_tool->y1));
|
||||
|
@ -129,20 +129,22 @@ gimp_tool_class_init (GimpToolClass *klass)
|
||||
static void
|
||||
gimp_tool_init (GimpTool *tool)
|
||||
{
|
||||
tool->ID = global_tool_ID++;
|
||||
tool->ID = global_tool_ID++;
|
||||
|
||||
tool->state = INACTIVE;
|
||||
tool->paused_count = 0;
|
||||
tool->scroll_lock = FALSE; /* Allow scrolling */
|
||||
tool->auto_snap_to = TRUE; /* Snap to guides */
|
||||
tool->state = INACTIVE;
|
||||
tool->paused_count = 0;
|
||||
tool->scroll_lock = FALSE; /* Allow scrolling */
|
||||
tool->auto_snap_to = TRUE; /* Snap to guides */
|
||||
|
||||
tool->preserve = TRUE; /* Preserve tool across drawable changes */
|
||||
tool->gdisp = NULL;
|
||||
tool->drawable = NULL;
|
||||
tool->handle_empty_image = FALSE; /* Don't work without active drawable */
|
||||
|
||||
tool->tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
||||
tool->toggle_cursor = GIMP_TOOL_CURSOR_NONE;
|
||||
tool->toggled = FALSE;
|
||||
tool->preserve = TRUE; /* Preserve across drawable changes */
|
||||
tool->gdisp = NULL;
|
||||
tool->drawable = NULL;
|
||||
|
||||
tool->tool_cursor = GIMP_TOOL_CURSOR_NONE;
|
||||
tool->toggle_cursor = GIMP_TOOL_CURSOR_NONE;
|
||||
tool->toggled = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -52,6 +52,10 @@ struct _GimpTool
|
||||
gboolean scroll_lock; /* allow scrolling or not */
|
||||
gboolean auto_snap_to; /* snap to guides automatically */
|
||||
|
||||
gboolean handle_empty_image; /* invoke the tool on images without
|
||||
* active drawable
|
||||
*/
|
||||
|
||||
gboolean preserve; /* Preserve this tool across drawable changes */
|
||||
GimpDisplay *gdisp; /* pointer to currently active gdisp */
|
||||
GimpDrawable *drawable; /* pointer to the tool's current drawable */
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "gimprotatetool.h"
|
||||
#include "gimpscaletool.h"
|
||||
#include "gimptransformtool.h"
|
||||
#include "transform_options.h"
|
||||
#include "tool_manager.h"
|
||||
@ -54,7 +56,7 @@ transform_options_new (GimpToolInfo *tool_info)
|
||||
{
|
||||
TransformOptions *options;
|
||||
|
||||
options = g_new (TransformOptions, 1);
|
||||
options = g_new0 (TransformOptions, 1);
|
||||
|
||||
transform_options_init (options, tool_info);
|
||||
|
||||
@ -69,6 +71,7 @@ transform_options_init (TransformOptions *options,
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *fbox;
|
||||
GtkWidget *grid_density;
|
||||
|
||||
@ -79,12 +82,14 @@ transform_options_init (TransformOptions *options,
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
options->smoothing = options->smoothing_d = TRUE;
|
||||
options->show_path = options->show_path_d = TRUE;
|
||||
options->clip = options->clip_d = FALSE;
|
||||
options->direction = options->direction_d = GIMP_TRANSFORM_FORWARD;
|
||||
options->grid_size = options->grid_size_d = 32;
|
||||
options->show_grid = options->show_grid_d = TRUE;
|
||||
options->smoothing = options->smoothing_d = TRUE;
|
||||
options->show_path = options->show_path_d = TRUE;
|
||||
options->clip = options->clip_d = FALSE;
|
||||
options->direction = options->direction_d = GIMP_TRANSFORM_FORWARD;
|
||||
options->grid_size = options->grid_size_d = 32;
|
||||
options->show_grid = options->show_grid_d = TRUE;
|
||||
options->constrain_1 = options->constrain_1_d = FALSE;
|
||||
options->constrain_2 = options->constrain_2_d = FALSE;
|
||||
|
||||
frame = gimp_radio_group_new2 (TRUE, _("Transform Direction"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
@ -104,6 +109,24 @@ transform_options_init (TransformOptions *options,
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* the smoothing toggle button */
|
||||
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->smoothing_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->smoothing_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->smoothing_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->smoothing);
|
||||
|
||||
/* the clip resulting image toggle button */
|
||||
options->clip_w = gtk_check_button_new_with_label (_("Clip Result"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->clip_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->clip_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->clip_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->clip);
|
||||
|
||||
/* the grid frame */
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
@ -116,12 +139,13 @@ transform_options_init (TransformOptions *options,
|
||||
|
||||
/* the show grid toggle button */
|
||||
options->show_grid_w = gtk_check_button_new_with_label (_("Show Grid"));
|
||||
g_signal_connect (G_OBJECT (options->show_grid_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_grid_update),
|
||||
&options->show_grid);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), options->show_grid_w);
|
||||
gtk_widget_show (options->show_grid_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->show_grid_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_grid_update),
|
||||
&options->show_grid);
|
||||
|
||||
/* the grid density entry */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (fbox), hbox, FALSE, FALSE, 0);
|
||||
@ -137,11 +161,12 @@ transform_options_init (TransformOptions *options,
|
||||
grid_density =
|
||||
gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (grid_density), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), grid_density, FALSE, FALSE, 0);
|
||||
gtk_widget_show (grid_density);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->grid_size_w), "value_changed",
|
||||
G_CALLBACK (gimp_transform_tool_grid_density_update),
|
||||
options);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), grid_density, FALSE, FALSE, 0);
|
||||
gtk_widget_show (grid_density);
|
||||
|
||||
gtk_widget_set_sensitive (label, options->show_grid_d);
|
||||
gtk_widget_set_sensitive (grid_density, options->show_grid_d);
|
||||
@ -151,27 +176,71 @@ transform_options_init (TransformOptions *options,
|
||||
|
||||
/* the show_path toggle button */
|
||||
options->show_path_w = gtk_check_button_new_with_label (_("Show Path"));
|
||||
g_signal_connect (G_OBJECT (options->show_path_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_path_update),
|
||||
&options->show_path);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->show_path_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->show_path_w);
|
||||
|
||||
/* the smoothing toggle button */
|
||||
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
|
||||
g_signal_connect (G_OBJECT (options->smoothing_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->smoothing);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->smoothing_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->smoothing_w);
|
||||
g_signal_connect (G_OBJECT (options->show_path_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_path_update),
|
||||
&options->show_path);
|
||||
|
||||
/* the clip resulting image toggle button */
|
||||
options->clip_w = gtk_check_button_new_with_label (_("Clip Result"));
|
||||
g_signal_connect (G_OBJECT (options->clip_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->clip);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->clip_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->clip_w);
|
||||
if (tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL ||
|
||||
tool_info->tool_type == GIMP_TYPE_SCALE_TOOL)
|
||||
{
|
||||
/* the constraints frame */
|
||||
frame = gtk_frame_new (_("Constraints"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
if (tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL)
|
||||
{
|
||||
options->constrain_1_w =
|
||||
gtk_check_button_new_with_label (_("15 Degrees (<Ctrl>)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), options->constrain_1_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->constrain_1_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->constrain_1_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->constrain_1);
|
||||
}
|
||||
else if (tool_info->tool_type == GIMP_TYPE_SCALE_TOOL)
|
||||
{
|
||||
options->constrain_1_w =
|
||||
gtk_check_button_new_with_label (_("Keep Height (<Ctrl>)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), options->constrain_1_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->constrain_1_w);
|
||||
|
||||
gimp_help_set_help_data (options->constrain_1_w,
|
||||
_("Activate both the \"Keep Height\" and\n"
|
||||
"\"Keep Width\" toggles to constrain\n"
|
||||
"the aspect ratio"), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->constrain_1_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->constrain_1);
|
||||
|
||||
options->constrain_2_w =
|
||||
gtk_check_button_new_with_label (_("Keep Width (<Alt>)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), options->constrain_2_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->constrain_2_w);
|
||||
|
||||
gimp_help_set_help_data (options->constrain_2_w,
|
||||
_("Activate both the \"Keep Height\" and\n"
|
||||
"\"Keep Width\" toggles to constrain\n"
|
||||
"the aspect ratio"), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->constrain_2_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->constrain_2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set options to default values */
|
||||
transform_options_reset ((GimpToolOptions *) options);
|
||||
@ -184,20 +253,29 @@ transform_options_reset (GimpToolOptions *tool_options)
|
||||
|
||||
options = (TransformOptions *) tool_options;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
||||
options->smoothing_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_path_w),
|
||||
options->show_path_d);
|
||||
|
||||
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->direction_w[0]),
|
||||
GINT_TO_POINTER (options->direction_d));
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
||||
options->smoothing_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
|
||||
options->clip_d);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
|
||||
options->show_grid_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
|
||||
7.0 - log (options->grid_size_d) / log (2.0));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
|
||||
options->clip_d);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_path_w),
|
||||
options->show_path_d);
|
||||
|
||||
if (options->constrain_1_w)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->constrain_1_w),
|
||||
options->constrain_1_d);
|
||||
|
||||
if (options->constrain_2_w)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->constrain_2_w),
|
||||
options->constrain_2_d);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,13 +29,17 @@ struct _TransformOptions
|
||||
{
|
||||
GimpToolOptions tool_options;
|
||||
|
||||
GimpTransformDirection direction;
|
||||
GimpTransformDirection direction_d;
|
||||
GtkWidget *direction_w[2]; /* 2 radio buttons */
|
||||
|
||||
gboolean smoothing;
|
||||
gboolean smoothing_d;
|
||||
GtkWidget *smoothing_w;
|
||||
|
||||
GimpTransformDirection direction;
|
||||
GimpTransformDirection direction_d;
|
||||
GtkWidget *direction_w[2]; /* 2 radio buttons */
|
||||
gboolean clip;
|
||||
gboolean clip_d;
|
||||
GtkWidget *clip_w;
|
||||
|
||||
gboolean show_grid;
|
||||
gboolean show_grid_d;
|
||||
@ -45,13 +49,17 @@ struct _TransformOptions
|
||||
gint grid_size_d;
|
||||
GtkObject *grid_size_w;
|
||||
|
||||
gboolean clip;
|
||||
gboolean clip_d;
|
||||
GtkWidget *clip_w;
|
||||
|
||||
gboolean show_path;
|
||||
gboolean show_path_d;
|
||||
GtkWidget *show_path_w;
|
||||
|
||||
gboolean constrain_1;
|
||||
gboolean constrain_1_d;
|
||||
GtkWidget *constrain_1_w;
|
||||
|
||||
gboolean constrain_2;
|
||||
gboolean constrain_2_d;
|
||||
GtkWidget *constrain_2_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -87,6 +87,11 @@ static void gimp_transform_tool_motion (GimpTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_transform_tool_modifier_key (GimpTool *tool,
|
||||
GdkModifierType key,
|
||||
gboolean press,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp);
|
||||
static void gimp_transform_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
@ -169,6 +174,7 @@ gimp_transform_tool_class_init (GimpTransformToolClass *klass)
|
||||
tool_class->button_press = gimp_transform_tool_button_press;
|
||||
tool_class->button_release = gimp_transform_tool_button_release;
|
||||
tool_class->motion = gimp_transform_tool_motion;
|
||||
tool_class->modifier_key = gimp_transform_tool_modifier_key;
|
||||
tool_class->oper_update = gimp_transform_tool_oper_update;
|
||||
tool_class->cursor_update = gimp_transform_tool_cursor_update;
|
||||
|
||||
@ -465,6 +471,29 @@ gimp_transform_tool_motion (GimpTool *tool,
|
||||
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_transform_tool_modifier_key (GimpTool *tool,
|
||||
GdkModifierType key,
|
||||
gboolean press,
|
||||
GdkModifierType state,
|
||||
GimpDisplay *gdisp)
|
||||
{
|
||||
TransformOptions *options;
|
||||
|
||||
options = (TransformOptions *) tool->tool_info->tool_options;
|
||||
|
||||
if (key == GDK_CONTROL_MASK && options->constrain_1_w)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->constrain_1_w),
|
||||
! options->constrain_1);
|
||||
}
|
||||
else if (key == GDK_MOD1_MASK && options->constrain_2_w)
|
||||
{
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->constrain_2_w),
|
||||
! options->constrain_2);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_transform_tool_oper_update (GimpTool *tool,
|
||||
GimpCoords *coords,
|
||||
|
@ -27,6 +27,8 @@
|
||||
|
||||
#include "core/gimptoolinfo.h"
|
||||
|
||||
#include "gimprotatetool.h"
|
||||
#include "gimpscaletool.h"
|
||||
#include "gimptransformtool.h"
|
||||
#include "transform_options.h"
|
||||
#include "tool_manager.h"
|
||||
@ -54,7 +56,7 @@ transform_options_new (GimpToolInfo *tool_info)
|
||||
{
|
||||
TransformOptions *options;
|
||||
|
||||
options = g_new (TransformOptions, 1);
|
||||
options = g_new0 (TransformOptions, 1);
|
||||
|
||||
transform_options_init (options, tool_info);
|
||||
|
||||
@ -69,6 +71,7 @@ transform_options_init (TransformOptions *options,
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *fbox;
|
||||
GtkWidget *grid_density;
|
||||
|
||||
@ -79,12 +82,14 @@ transform_options_init (TransformOptions *options,
|
||||
/* the main vbox */
|
||||
vbox = options->tool_options.main_vbox;
|
||||
|
||||
options->smoothing = options->smoothing_d = TRUE;
|
||||
options->show_path = options->show_path_d = TRUE;
|
||||
options->clip = options->clip_d = FALSE;
|
||||
options->direction = options->direction_d = GIMP_TRANSFORM_FORWARD;
|
||||
options->grid_size = options->grid_size_d = 32;
|
||||
options->show_grid = options->show_grid_d = TRUE;
|
||||
options->smoothing = options->smoothing_d = TRUE;
|
||||
options->show_path = options->show_path_d = TRUE;
|
||||
options->clip = options->clip_d = FALSE;
|
||||
options->direction = options->direction_d = GIMP_TRANSFORM_FORWARD;
|
||||
options->grid_size = options->grid_size_d = 32;
|
||||
options->show_grid = options->show_grid_d = TRUE;
|
||||
options->constrain_1 = options->constrain_1_d = FALSE;
|
||||
options->constrain_2 = options->constrain_2_d = FALSE;
|
||||
|
||||
frame = gimp_radio_group_new2 (TRUE, _("Transform Direction"),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
@ -104,6 +109,24 @@ transform_options_init (TransformOptions *options,
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
/* the smoothing toggle button */
|
||||
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->smoothing_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->smoothing_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->smoothing_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->smoothing);
|
||||
|
||||
/* the clip resulting image toggle button */
|
||||
options->clip_w = gtk_check_button_new_with_label (_("Clip Result"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->clip_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->clip_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->clip_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->clip);
|
||||
|
||||
/* the grid frame */
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
@ -116,12 +139,13 @@ transform_options_init (TransformOptions *options,
|
||||
|
||||
/* the show grid toggle button */
|
||||
options->show_grid_w = gtk_check_button_new_with_label (_("Show Grid"));
|
||||
g_signal_connect (G_OBJECT (options->show_grid_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_grid_update),
|
||||
&options->show_grid);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame), options->show_grid_w);
|
||||
gtk_widget_show (options->show_grid_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->show_grid_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_grid_update),
|
||||
&options->show_grid);
|
||||
|
||||
/* the grid density entry */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (fbox), hbox, FALSE, FALSE, 0);
|
||||
@ -137,11 +161,12 @@ transform_options_init (TransformOptions *options,
|
||||
grid_density =
|
||||
gtk_spin_button_new (GTK_ADJUSTMENT (options->grid_size_w), 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (grid_density), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), grid_density, FALSE, FALSE, 0);
|
||||
gtk_widget_show (grid_density);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->grid_size_w), "value_changed",
|
||||
G_CALLBACK (gimp_transform_tool_grid_density_update),
|
||||
options);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), grid_density, FALSE, FALSE, 0);
|
||||
gtk_widget_show (grid_density);
|
||||
|
||||
gtk_widget_set_sensitive (label, options->show_grid_d);
|
||||
gtk_widget_set_sensitive (grid_density, options->show_grid_d);
|
||||
@ -151,27 +176,71 @@ transform_options_init (TransformOptions *options,
|
||||
|
||||
/* the show_path toggle button */
|
||||
options->show_path_w = gtk_check_button_new_with_label (_("Show Path"));
|
||||
g_signal_connect (G_OBJECT (options->show_path_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_path_update),
|
||||
&options->show_path);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->show_path_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->show_path_w);
|
||||
|
||||
/* the smoothing toggle button */
|
||||
options->smoothing_w = gtk_check_button_new_with_label (_("Smoothing"));
|
||||
g_signal_connect (G_OBJECT (options->smoothing_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->smoothing);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->smoothing_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->smoothing_w);
|
||||
g_signal_connect (G_OBJECT (options->show_path_w), "toggled",
|
||||
G_CALLBACK (gimp_transform_tool_show_path_update),
|
||||
&options->show_path);
|
||||
|
||||
/* the clip resulting image toggle button */
|
||||
options->clip_w = gtk_check_button_new_with_label (_("Clip Result"));
|
||||
g_signal_connect (G_OBJECT (options->clip_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->clip);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), options->clip_w, FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->clip_w);
|
||||
if (tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL ||
|
||||
tool_info->tool_type == GIMP_TYPE_SCALE_TOOL)
|
||||
{
|
||||
/* the constraints frame */
|
||||
frame = gtk_frame_new (_("Constraints"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
||||
gtk_widget_show (vbox2);
|
||||
|
||||
if (tool_info->tool_type == GIMP_TYPE_ROTATE_TOOL)
|
||||
{
|
||||
options->constrain_1_w =
|
||||
gtk_check_button_new_with_label (_("15 Degrees (<Ctrl>)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), options->constrain_1_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->constrain_1_w);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->constrain_1_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->constrain_1);
|
||||
}
|
||||
else if (tool_info->tool_type == GIMP_TYPE_SCALE_TOOL)
|
||||
{
|
||||
options->constrain_1_w =
|
||||
gtk_check_button_new_with_label (_("Keep Height (<Ctrl>)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), options->constrain_1_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->constrain_1_w);
|
||||
|
||||
gimp_help_set_help_data (options->constrain_1_w,
|
||||
_("Activate both the \"Keep Height\" and\n"
|
||||
"\"Keep Width\" toggles to constrain\n"
|
||||
"the aspect ratio"), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->constrain_1_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->constrain_1);
|
||||
|
||||
options->constrain_2_w =
|
||||
gtk_check_button_new_with_label (_("Keep Width (<Alt>)"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), options->constrain_2_w,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (options->constrain_2_w);
|
||||
|
||||
gimp_help_set_help_data (options->constrain_2_w,
|
||||
_("Activate both the \"Keep Height\" and\n"
|
||||
"\"Keep Width\" toggles to constrain\n"
|
||||
"the aspect ratio"), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (options->constrain_2_w), "toggled",
|
||||
G_CALLBACK (gimp_toggle_button_update),
|
||||
&options->constrain_2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set options to default values */
|
||||
transform_options_reset ((GimpToolOptions *) options);
|
||||
@ -184,20 +253,29 @@ transform_options_reset (GimpToolOptions *tool_options)
|
||||
|
||||
options = (TransformOptions *) tool_options;
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
||||
options->smoothing_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_path_w),
|
||||
options->show_path_d);
|
||||
|
||||
gimp_radio_group_set_active (GTK_RADIO_BUTTON (options->direction_w[0]),
|
||||
GINT_TO_POINTER (options->direction_d));
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->smoothing_w),
|
||||
options->smoothing_d);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
|
||||
options->clip_d);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_grid_w),
|
||||
options->show_grid_d);
|
||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (options->grid_size_w),
|
||||
7.0 - log (options->grid_size_d) / log (2.0));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->clip_w),
|
||||
options->clip_d);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->show_path_w),
|
||||
options->show_path_d);
|
||||
|
||||
if (options->constrain_1_w)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->constrain_1_w),
|
||||
options->constrain_1_d);
|
||||
|
||||
if (options->constrain_2_w)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->constrain_2_w),
|
||||
options->constrain_2_d);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,13 +29,17 @@ struct _TransformOptions
|
||||
{
|
||||
GimpToolOptions tool_options;
|
||||
|
||||
GimpTransformDirection direction;
|
||||
GimpTransformDirection direction_d;
|
||||
GtkWidget *direction_w[2]; /* 2 radio buttons */
|
||||
|
||||
gboolean smoothing;
|
||||
gboolean smoothing_d;
|
||||
GtkWidget *smoothing_w;
|
||||
|
||||
GimpTransformDirection direction;
|
||||
GimpTransformDirection direction_d;
|
||||
GtkWidget *direction_w[2]; /* 2 radio buttons */
|
||||
gboolean clip;
|
||||
gboolean clip_d;
|
||||
GtkWidget *clip_w;
|
||||
|
||||
gboolean show_grid;
|
||||
gboolean show_grid_d;
|
||||
@ -45,13 +49,17 @@ struct _TransformOptions
|
||||
gint grid_size_d;
|
||||
GtkObject *grid_size_w;
|
||||
|
||||
gboolean clip;
|
||||
gboolean clip_d;
|
||||
GtkWidget *clip_w;
|
||||
|
||||
gboolean show_path;
|
||||
gboolean show_path_d;
|
||||
GtkWidget *show_path_w;
|
||||
|
||||
gboolean constrain_1;
|
||||
gboolean constrain_1_d;
|
||||
GtkWidget *constrain_1_w;
|
||||
|
||||
gboolean constrain_2;
|
||||
gboolean constrain_2_d;
|
||||
GtkWidget *constrain_2_w;
|
||||
};
|
||||
|
||||
|
||||
|
@ -49,6 +49,8 @@
|
||||
static void gimp_dockbook_class_init (GimpDockbookClass *klass);
|
||||
static void gimp_dockbook_init (GimpDockbook *dockbook);
|
||||
|
||||
static void gimp_dockbook_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style);
|
||||
static gboolean gimp_dockbook_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
gint x,
|
||||
@ -122,7 +124,16 @@ gimp_dockbook_class_init (GimpDockbookClass *klass)
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
widget_class->style_set = gimp_dockbook_style_set;
|
||||
widget_class->drag_drop = gimp_dockbook_drag_drop;
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("tab_border",
|
||||
NULL, NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -130,7 +141,6 @@ gimp_dockbook_init (GimpDockbook *dockbook)
|
||||
{
|
||||
dockbook->dock = NULL;
|
||||
|
||||
gtk_notebook_set_tab_border (GTK_NOTEBOOK (dockbook), 0);
|
||||
gtk_notebook_popup_enable (GTK_NOTEBOOK (dockbook));
|
||||
gtk_notebook_set_scrollable (GTK_NOTEBOOK (dockbook), TRUE);
|
||||
|
||||
@ -146,6 +156,22 @@ gimp_dockbook_new (void)
|
||||
return GTK_WIDGET (g_object_new (GIMP_TYPE_DOCKBOOK, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_dockbook_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style)
|
||||
{
|
||||
gint tab_border;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
||||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"tab_border", &tab_border,
|
||||
NULL);
|
||||
|
||||
gtk_notebook_set_tab_border (GTK_NOTEBOOK (widget), tab_border);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_dockbook_drag_drop (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
|
@ -58,6 +58,7 @@ class "GtkHScale" style "gimp-hscale-style"
|
||||
style "gimp-dock-style" = "gimp-small-font-style"
|
||||
{
|
||||
GimpDock::separator_height = 6
|
||||
GimpDockbook::tab_border = 0
|
||||
GimpDockable::content_border = 2
|
||||
GimpContainerView::content_spacing = 2
|
||||
GimpContainerView::button_spacing = 2
|
||||
|
Reference in New Issue
Block a user