mirror of https://github.com/GNOME/gimp.git
app: show message when attempting to change layers while there is a floating sel.
In GimpDrawableTreeView, show an error message when attempting to select a different drawable while the image has an active floating selection. In GimpLayerTreeView, also blink the editor button-row when this happens, as a hint that the floating selection can be committed/canceled through the buttons (we already highlight the relevant ones.)
This commit is contained in:
parent
192bc9536c
commit
070e10eda7
|
@ -28,6 +28,7 @@
|
|||
#include "widgets-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpdrawable-edit.h"
|
||||
#include "core/gimpfilloptions.h"
|
||||
|
@ -167,16 +168,27 @@ gimp_drawable_tree_view_select_item (GimpContainerView *view,
|
|||
gpointer insert_data)
|
||||
{
|
||||
GimpItemTreeView *item_view = GIMP_ITEM_TREE_VIEW (view);
|
||||
GimpImage *image = gimp_item_tree_view_get_image (item_view);
|
||||
gboolean success = TRUE;
|
||||
|
||||
if (gimp_item_tree_view_get_image (item_view))
|
||||
if (image)
|
||||
{
|
||||
GimpLayer *floating_sel =
|
||||
gimp_image_get_floating_selection (gimp_item_tree_view_get_image (item_view));
|
||||
GimpLayer *floating_sel = gimp_image_get_floating_selection (image);
|
||||
|
||||
success = (item == NULL ||
|
||||
floating_sel == NULL ||
|
||||
item == GIMP_VIEWABLE (floating_sel));
|
||||
|
||||
if (! success)
|
||||
{
|
||||
Gimp *gimp = image->gimp;
|
||||
GimpContext *context = gimp_get_user_context (gimp);
|
||||
GObject *display = gimp_context_get_display (context);
|
||||
|
||||
gimp_message_literal (gimp, display, GIMP_MESSAGE_WARNING,
|
||||
_("Cannot select item while a floating "
|
||||
"selection is active."));
|
||||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
|
|
|
@ -578,6 +578,16 @@ gimp_layer_tree_view_select_item (GimpContainerView *view,
|
|||
}
|
||||
}
|
||||
|
||||
if (! success)
|
||||
{
|
||||
GimpEditor *editor = GIMP_EDITOR (view);
|
||||
|
||||
/* currently, select_item() only ever fails when there is a floating
|
||||
* selection, which can be committed/canceled through the editor buttons.
|
||||
*/
|
||||
gimp_widget_blink (GTK_WIDGET (gimp_editor_get_button_box (editor)));
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue