Commit Graph

173 Commits

Author SHA1 Message Date
Michael Natterer 3f954350d9 app: don't let gtk_tree_store_clear() mess with our selected item
gimp_container_tree_view_clear_items(): GTK+ 3.x always keeps the row
with the cursor selected, so we get a gazillion selection changed
during gtk_tree_store_clear(), block our selection changed handler
during the clear.
2018-06-03 21:45:16 +02:00
Michael Natterer 895b544af2 app: port GimpContainerTreeView from style_set() to style_updated() 2018-05-20 21:06:29 +02:00
Michael Natterer 1138846d4e app: port GimpContainerTreeView to GtkStyleContext 2018-05-20 21:06:27 +02:00
Ell 5d544c2a17 app: update GimpContainerView row expanded state ...
... when inserting/reordering items

Otherwise, newly inserted/reordered group layers are always
collapsed.
2017-12-08 11:12:33 -05:00
Michael Natterer 8350ab4217 app: add gimp_container_tree_view_name_edited() as public default callback
and use it in GimpBufferView and GimpTemplateView.
2017-11-14 20:54:38 +01:00
Ell d027a059ef app: respond to viewable expanded state changes in container views
Add an "expanded-changed" signal to GimpViewable, which should be
emitted by subclasses when the viewable's expanded state changes.
Emit this signal when the expanded state of group layers changes.
Respond to this signal in GimpContainerView, by calling a new
expand_item() virtual function.  Implement expand_item() in
GimpContainerTreeView, expanding or collapsing the item as
necessary.
2017-10-22 12:30:21 -04:00
Michael Natterer 0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
Michael Natterer 82a2754540 Bug 343090 - Most brushes and all patterns appear renameable but aren't
Introduce virtual function GimpViewable::is_name_editable() and class
member "gboolean name_editable" for the default value. Default to
FALSE and only return TRUE if the name can actually be edited by the
user.

When attemting an edit, check the new API and beep instead of starting
the edit.
2016-11-16 15:13:08 +01:00
Michael Natterer 61f91c7cd2 app: be more deterministic in a list view's name column (name editing etc.)
We handle multi-selection by letting GtkTreeView handle button press
when the widget is in GTK_SELECTION_MULTIPLE mode. Change that code to
only do that when one of the participating modifiers (shift and
control on Linux and Windows, shift and cmd on macOS) is pressed.

This makes sure that the same thing is not randomly handled by two
different pieces of code, and probably fixes bug #738440, tho I can't
be sure.
2016-11-16 13:02:09 +01:00
Michael Natterer fce404cea2 app: minor formatting paranoia in GimpContainerTreeView 2016-10-18 20:19:52 +02:00
Michael Natterer 0089a017f0 Bug 706309 - Add a “Save As” button to the “Quit GIMP” dialog
Add GimpCellRendererButton and use it to add a "Save" icon to each row
of dirty images. Click invokes the "edit-save" action, shift-click
invokes "edit-save-as". Also add a tooltip for the icon button.

Involves minor changes to GimpContainerTreeView to allow
GimpCellRendererButton to be added, and to allow external
"query-tooltip" handlers to run.
2016-10-01 21:00:39 +02:00
Michael Natterer 3ed305f6f5 libgimpwidgets, app: have all previews track the monitor they are on
and update their color transforms with the new monitor's color
profile. A widget is considered changing monitors when its toplevel
window's center crosses, in order to let widgets within one window
have consistent colors.
2016-06-01 22:42:00 +02:00
Michael Natterer 1125f4df0f app: make sure icons in GimpContainerTreeView follow icon theme changes 2015-12-11 22:46:37 +01:00
Jehan 0aae50cfe2 Bug 750556 - validate a tree cell modification on focus out.
For instance, modifying a layer and going directly to draw in the canvas
should not cancel the layer name.
You can still cancel a layer renaming in progress with ESC.
2015-06-14 14:03:16 +02:00
Michael Natterer 55e8528eff app: GimpContainerTreeView: keep a reference on tree_view->model
during the lifetime of the widget. Leaving that up to the GtkTreeView
was working for mysterious reasons even during destruction of the
widget. It's safer and cleaner this way.
2014-06-06 22:48:35 +02:00
Michael Natterer 0d2d1c3752 app: port most of app's GUI from stock IDs to icon names
There is still quite some stock ID rendering around, stay tuned...
2014-05-07 15:30:38 +02:00
Michael Natterer 78ad0327da app: add new accessor gimp_container_tree_view_get_name_cell() 2013-11-07 11:32:23 +01:00
Jehan 3e082b356c Bug 681709 - GimpContainer continuously scrolls on dnd failure on Windows.
The scroll timeout is looping forever if the drag ends by a failure
event. For instance when hitting the Esc button during scrolling.
2013-10-02 21:18:10 +13:00
Michael Natterer 908f727f0a Chain up unconditionally in GObject::constructed()
It's supported since GLib 2.28.
2012-11-12 21:51:22 +01:00
Michael Natterer 92a3944442 Bug 676821 - No drag layers in "window layers", after commit...
Remove the button_release handler again, setting dnd_widget to NULL on
container change is enough to fix the crash I've seen, I added the
other handler just out of paranoia and apparently didn't test it.
2012-05-25 21:25:29 +02:00
Michael Natterer 27a767ee54 app: set GimpContainerTreeView->dnd_renderer to NULL more reliably
specifically in button_release() and when the container changes, we
can badly crash in some situations otherwise.
2012-05-22 12:58:10 +02:00
Michael Natterer 867da8f293 app: add gimp_context_get_foreground,background_pixel()
which takes a Babl format to convert from/to.
Include <gegl.h> in a million places.
2012-05-02 17:50:41 +02:00
Michael Natterer f72806bbcd app: fix GimpContainerTreeView name editing so it always works the same
no matter how editing was started (double click, keyboard activate, F2).

Connect to "editing-started" of the name cell and set the object's
real name directly on the GtkCellEditable, instead of trying to hack
around in the tree store before the actual editing starts.
2012-02-06 19:28:37 +01:00
Michael Natterer 947ea55a07 app: chain up last in gimp_container_tree_view_set_context()
so all the view renderers already have the right context when the
parent interface code selects the right item, which in turn requires
the context to be already set on the renderers. Fixes warnings when
dragging dockables around.
2012-02-06 01:33:01 +01:00
Michael Natterer fffd1920e2 app: don't hardcode MOD2 in GimpContainerTreeView either
Add new utility function gimp_get_all_modifiers_mask() which returns
all modifiers used for "useful" things on the current platform, like
in the commit below.
2011-10-10 00:17:20 +02:00
Michael Natterer 374f4e5628 app: let GimpContainerTreeView's parent class handle MOD2-click 2011-10-07 01:02:54 +02:00
Michael Natterer f1d4dde36a libgimpwidgets: add gdk_event_triggers_context_menu() to gimp3migration.[ch]
and remove gimp_button_event_triggers_context_menu() again. Update
all callers to use the new function.
2011-10-02 16:23:59 +02:00
Massimo Valentini 0f03ed9e05 Bug 616416: hidden layer groups appear again after an image change
Introduced two virtual functions to a GimpViewable

'set_expanded' and 'get_expanded'

and a PROP_GROUP_ITEM_FLAGS to load/save the expanded state
of layer_groups and use them.
2011-09-25 21:57:20 +02:00
Massimo Valentini a67bb11cf5 Revert "Bug 616416: hidden layer groups appear again after an image change"
This reverts commit 359c9c22d9.
2011-09-25 21:49:36 +02:00
Massimo Valentini 359c9c22d9 Bug 616416: hidden layer groups appear again after an image change 2011-09-25 21:38:50 +02:00
Michael Natterer d92cd2f6c8 Add gimp_button_event_triggers_context_menu() and use it
instead of checking for event->button == 3, so context menus
work correctly on the Mac. Didn't change the image menu yet
because thet requires some more refactoring.
2011-09-19 00:47:23 +02:00
Michael Natterer 7c60bb5181 app: use more of the new GDK_KEY_foo key names
and move the compat defines from display-enums.h to widgets-enums.h
2011-03-29 17:24:08 +02:00
Michael Natterer fcfb7cf160 Use the new g_[s]list_free_full() instead of foreach() and free() 2011-03-07 17:11:28 +01:00
Michael Natterer 95f14f5de8 app: add an "edit-name" binding signal and default to F2 2011-02-14 20:01:08 +01:00
Michael Natterer 202124c438 app: implement GObject::constructed() instead of ::constructor() 2011-01-14 09:38:46 +01:00
Michael Natterer d2fd8a8dc8 app: don't call gimp_cell_renderer_viewable_pre_clicked() on a NULL cell 2010-06-28 00:13:19 +02:00
Martin Nordholts 706900c4f6 Bug 589010 - Don't make Alt-Clicked layers active
Add a "pre-clicked" signal to GimpCellRendererViewable that can
prevent a selection from happening. Move the Alt-Click code in
GimpLayerTreeView to this signal and if a layer is Alt-Clicked, don't
go ahead and make the layer active. Also add a test for this use case.
2010-06-27 21:46:53 +02:00
Michael Natterer 15906be4d9 app: pull more code into GimpContainerTreeStore
Keep a list of GimpCellRendererViewable around and add API to add
them. When items are removed or the store is cleared, set the
renderers' "viewable" property to NULL so they don't keep refing the
viewable.

This is not really "model" code but needs to be done for all container
views that have viewable cell renderers.

GimpContainerComboBox and GimpContainerEntry lacked that clearing, so
this change might fix some cases where objects (even images) were
removed but still stuck in memory until the model changed again.
2010-06-03 22:09:02 +02:00
Michael Natterer 788ba611af app: base multiple selection API on the GtkSelectionMode enum
change get,set_multiple_selection(gboolean) to
get,set_selection_mode(GtkSelectionMode) so the APIs are consistent
with GTK+.
2010-05-19 20:07:31 +02:00
Michael Natterer 89f7500b79 app: add gimp_container_tree_store_columns_init()
which initializes the type array with the default columns.
2010-05-17 21:34:11 +02:00
Michael Natterer e1a88379d0 app: remove the model column enum from gimpcontainertreeview.h
and use the right enum from gimpcontainertreestore.h all over the
place instead.
2010-05-17 21:28:17 +02:00
Michael Natterer 104d0ffb3e app: add gimp_container_tree_store_columns_add()
which adds a column to the GType array used for creating a
GimpContainerTreeStore.
2010-05-17 21:22:36 +02:00
Michael Natterer 82a5c62e54 app: add GimpContainerTreeStore which is a GtkTreeStore subclass
and pulls the store handling logic out of GimpContainerTreeView so
it can be reused.
2010-05-17 21:06:28 +02:00
Michael Natterer 7ea16558b6 app: some cosmetic cleanup in the multiple selection code 2010-04-04 15:00:26 +02:00
Aurimas Juška 381088b4b8 app: Bug 614604 - Crash when selecting a gradient from tool dialog
Actually disable multiple selection in all views by default. (It is
enabled explicitly where needed).
2010-04-02 00:29:43 +03:00
Michael Natterer 9565ef44a9 app: make sure the selected item's parent paths are all expanded 2010-03-14 22:59:29 +01:00
Aurimas Juška b46a89a302 app: Add methods to enable multiple selection in GimpContainerView
Enable multiple selection in GimpDataFactoryView now. It remains
disabled everywhere else.
2010-03-11 18:24:56 +02:00
Aurimas Juška 9e2723d390 app: Revert add flags for multiple selection support
Don't add additional constructor argument.
2010-03-11 18:24:56 +02:00
Aurimas Juška 8fb846160a app: Fix crash when GimpContainerTreeView is used to activate items
Use old code path when multiselection is not needed. Rely on parent
class to handle multiselection when it is.
2010-03-09 01:19:50 +02:00
Aurimas Juška 13b172b675 app: Add flags for multiple selection support
Multiple item selection is disabled by default and
currently enabled only for data views.
2010-03-07 18:59:28 +02:00