mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
app: Blink lock when layer expansion is prevented by lock
In layer expansion if user is trying to draw outside the layer boundary with expand option turned on but the "Lock position and size" enabled, the lock square will be blinked. If user is painting on layer mask, the corresponding layer's lock will be blinked. It will be blinked only once per stroke.
This commit is contained in:
parent
df9d1f54f8
commit
2a41fc7ee4
4 changed files with 48 additions and 3 deletions
|
@ -498,6 +498,9 @@ gimp_paint_core_start (GimpPaintCore *core,
|
|||
}
|
||||
}
|
||||
|
||||
/* initialize the lock_blink_state */
|
||||
core->lock_blink_state = GIMP_PAINT_LOCK_NOT_BLINKED;
|
||||
|
||||
/* Freeze the drawable preview so that it isn't constantly updated. */
|
||||
for (GList *iter = drawables; iter; iter = iter->next)
|
||||
gimp_viewable_preview_freeze (GIMP_VIEWABLE (iter->data));
|
||||
|
@ -843,9 +846,6 @@ gimp_paint_core_expand_drawable (GimpPaintCore *core,
|
|||
else
|
||||
return FALSE;
|
||||
|
||||
if (gimp_item_get_lock_position (GIMP_ITEM (layer)))
|
||||
return FALSE;
|
||||
|
||||
if (!gimp_paint_core_get_show_all (core) && outside_image)
|
||||
return FALSE;
|
||||
|
||||
|
@ -927,6 +927,18 @@ gimp_paint_core_expand_drawable (GimpPaintCore *core,
|
|||
GeglBuffer *undo_buffer;
|
||||
GeglBuffer *new_buffer;
|
||||
|
||||
if (gimp_item_get_lock_position (GIMP_ITEM (layer)))
|
||||
{
|
||||
if (core->lock_blink_state == GIMP_PAINT_LOCK_NOT_BLINKED)
|
||||
core->lock_blink_state = GIMP_PAINT_LOCK_BLINK_PENDING;
|
||||
|
||||
/* Since we are not expanding, set new offset to zero */
|
||||
*new_off_x = 0;
|
||||
*new_off_y = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mask_fill_type = options->expand_mask_fill_type == GIMP_ADD_MASK_BLACK ?
|
||||
GIMP_FILL_TRANSPARENT :
|
||||
GIMP_FILL_WHITE;
|
||||
|
|
|
@ -74,6 +74,8 @@ struct _GimpPaintCore
|
|||
GArray *stroke_buffer;
|
||||
|
||||
GimpSymmetry *sym;
|
||||
GimpPaintLockBlinkState
|
||||
lock_blink_state;
|
||||
};
|
||||
|
||||
struct _GimpPaintCoreClass
|
||||
|
|
|
@ -81,5 +81,12 @@ typedef enum /*< skip, pdb-skip >*/
|
|||
GIMP_PAINT_STATE_FINISH /* Cleanup and/or reset PaintFunc operation */
|
||||
} GimpPaintState;
|
||||
|
||||
/* State of lock blinking */
|
||||
typedef enum /*< skip, pdb-skip >*/
|
||||
{
|
||||
GIMP_PAINT_LOCK_NOT_BLINKED,
|
||||
GIMP_PAINT_LOCK_BLINK_PENDING,
|
||||
GIMP_PAINT_LOCK_BLINKED,
|
||||
} GimpPaintLockBlinkState;
|
||||
|
||||
#endif /* __PAINT_ENUMS_H__ */
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplayer.h"
|
||||
#include "core/gimplayermask.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
||||
#include "paint/gimppaintcore.h"
|
||||
|
@ -37,6 +39,7 @@
|
|||
|
||||
#include "gimppainttool.h"
|
||||
#include "gimppainttool-paint.h"
|
||||
#include "gimptools-utils.h"
|
||||
|
||||
|
||||
#define DISPLAY_UPDATE_INTERVAL 10000 /* microseconds */
|
||||
|
@ -214,6 +217,27 @@ gimp_paint_tool_paint_interpolate (GimpPaintTool *paint_tool,
|
|||
gimp_paint_core_interpolate (core, data->drawables, paint_options,
|
||||
&data->coords, data->time);
|
||||
|
||||
/* Blink the lock box if required */
|
||||
if (core->lock_blink_state == GIMP_PAINT_LOCK_BLINK_PENDING)
|
||||
{
|
||||
GList *iter;
|
||||
GimpLayer *layer;
|
||||
|
||||
/* Blink the lock only once per stroke */
|
||||
core->lock_blink_state = GIMP_PAINT_LOCK_BLINKED;
|
||||
|
||||
for (iter = data->drawables; iter; iter = g_list_next (iter))
|
||||
{
|
||||
layer = GIMP_IS_LAYER_MASK (iter->data) ?
|
||||
GIMP_LAYER_MASK (iter->data)->layer :
|
||||
GIMP_LAYER (iter->data);
|
||||
|
||||
if (gimp_item_get_lock_position (GIMP_ITEM (layer)))
|
||||
gimp_tools_blink_lock_box (GIMP_CONTEXT (paint_options)->gimp,
|
||||
GIMP_ITEM (layer));
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (data->drawables);
|
||||
g_slice_free (InterpolateData, data);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue