Commit Graph

78 Commits

Author SHA1 Message Date
Michael Natterer b48846c752 app: remove the "Tab" accelerator from the "windows-hide-docks" action
Apparently this has never worked until we refactored our menus, now it
suddenly does but not as originally intended. Simply remove the
accelerator and let only the canvas event handler deal with the Tab
key. Restores 2.10 behavior which was quite ok.

Fixes #9352
2023-05-26 00:45:30 +02:00
Jehan c6906e77da app: get rid of dummy "*-menu" and "*-popup" actions.
With our old code, we needed dummy actions for every submenu. This is not needed
anymore. Actions are only for end menu items (items which actually do something,
not just open a submenu).
Get rid of them all, as well as the code to ignore any action ending with such
suffixes in action-listing pieces of code.
2023-04-20 15:36:11 +02:00
Jehan b0916fe701 Issue #9362: ordered argument format in printf requires no argument "holes".
Though it actually worked in some cases, and failed in others (I have not
figured out which build option exactly makes the format with hole work anyway),
printf manual actually explicitly says:

> There may be no gaps in the numbers of arguments specified using '$'; for
> example, if arguments 1 and 3 are specified, argument 2 must also be specified
> somewhere in the format string.

This explained while it was crashing GIMP (again, only with some build options,
or lack of build options):

> *** invalid %N$ use detected ***

There were 2 possible solutions for this: either ensure that the order number is
always used, but that defeats the purpose of plural localization. Instead I
reorder the argument so that the file name (which must always be shown for sure)
is first in arguments. This way, even if the order number is sometimes omitted
(be it in English or in any language), we avoid the crash.
2023-04-19 14:30:11 +02:00
Jehan 89772351c9 Issue #9349: Add concept of "short" (contextual) vs "long" label for actions.
All Gimp*ActionEntry (except GimpProcedureActionEntry) now have a short_label
member.
This commit doesn't add any new short label yet. It just fixes the struct usage,
and fixes a few localization contexts here and there when I saw such broken
strings.

I also fixed a few gradient editor action strings which were not proper labels
(like "splitmidpoint" or "splituniform", or missing uppercase, etc.).
2023-04-14 17:48:57 +02:00
Jehan 1b932d10d3 Issue #9349: short and long labels for "windows-display-*" actions.
The short labels are just the file names as we have all the context in the menu
to understand what these actions do (in Windows menu, ordered by view position
and with a `Ctrl+n` shortcut next to each, increasing by position).

In the action search for instance, we keep a 'Show "<image name>"' label.

Also I'm adding a relevant tooltip to further explain what each of these actions
do, using the view position.
2023-04-14 16:33:35 +02:00
Jehan ab33d032ad app: support Forward and Back keys.
Same as ZoomIn/Out keys, these are implemented as secondary shortcuts to actions
"windows-show-display-next" and "windows-show-display-previous" respectively.

See issue #637.
2023-04-12 22:07:09 +02:00
Jehan 71c8ff1f21 app: change all action entry structs to allow several shortcuts.
- The `accelerator` variable is a NULL-terminated array, allowing up to 3
  accelerators per action (so far, none has more than 2).
- Only the struct GimpProcedureActionEntry still has a single accelerator as I
  don't think it makes sense that we change the plug-in API to allow a plug-in
  to register more than 1 shortcut for a procedure (e.g. we don't want a plug-in
  to just register all possible keys for their procedure!).
  Of course, users will still be allowed to register more shortcuts for plug-in
  actions through the shortcut dialog. It's only the initialization which
  1-shortcut max for procedure actions.
- Remove all actions ending up in "-accel" as these were only a trick to
  register more shortcut for a same action. Now we just have the real
  possibility (rather than creating bogus duplicate actions). As a consequence,
  these actions accelerators have been moved as secondary accelerator to their
  main action.
  The deleted actions are: "view-zoom-out-accel", "view-zoom-in-accel",
  "view-zoom-16-1-accel", "view-zoom-4-1-accel", "view-zoom-2-1-accel" and
  "view-zoom-1-1-accel".
2023-04-12 22:07:09 +02:00
Jehan febb9dccd6 app: fix default values of 2 actions.
"windows-show-tabs" and "windows-use-single-window-mode" were set to FALSE by
default, while it is now supposed to be TRUE, same as the config properties. The
discrepancy was only showing with my new GimpMenu which better follows the
action's state.
2023-04-12 22:07:08 +02:00
Jehan a98a903976 app: get rid of gimp_action_(g|s)et_accel_path(). 2023-04-12 22:07:08 +02:00
Jehan ae7ddfd5f5 app: better label the "windows-display-[0-9]*" actions.
Adding a 'Show" before the image identifier, which is now between quotes, and
making this string localizable.
This makes the action more understandable, especially when listed in
less-contextual UI such as the action search.
2023-04-12 22:07:08 +02:00
Jehan 726e690d38 app: make the GimpContext a mandatory property for a Gimp*Action.
Making the action be context-awareness will be useful, in particular as we'll
have access to the GtkApplication.
2023-04-12 22:07:08 +02:00
Jehan 811d356953 app: GimpAction now has a "reason" parameter to explain being disabled.
In some cases, in particular for actions generated from plug-in
procedure right now, we were displaying the reason of the insensitivity
(typically right now, only the drawable type is cited). This was done by
appending the reason to the tooltip, separated by 2 newlines, which
resulted in extra ugly design, no nice way to style this info directly
(with pango for instance if the widget display allows it, or on a
separate info widget in a possible future, or whatnot).

Also it would mean that the action search could match a disabled action
by mistake if a search word happens to be in the reason message.

This improves the situation with the following changes:
* gimp_action_set_sensitive() now takes an optional reason string to set
  the reason message.
* Same for gimp_action_group_set_action_sensitive().
* gimp_action_get_sensitive() returns an optional reason string.
* gimp_procedure_get_sensitive()'s tooltip return value now becomes a
  reason (it won't contain anymore the tooltip and the reason
  concatenated, only the reason for separate processing).
2021-04-23 19:43:30 +02:00
Michael Natterer 7201d48231 Get rid of capitalized "ID" in function and variable names
and use "id" instead.
2019-08-23 22:23:23 +02:00
Sabri Ünal e93a20e7ac Issue #3112 - Missing mnemonics.
(cherry picked from commit 30e4a7ee5e)
2019-08-05 22:44:36 +02:00
Michael Natterer 3b6b3fc189 app: GtkAction -> GAction madness part two
Change all action callbacks so they can be invoked by a GAction:

- add GimpActionCallback typedef:
  void (* cb) (GimpAction*, GVariant*, gpointer)
- change all action callbacks to the GimpActionCallback signature
- add "gimp-activate" and "gimp-change-state" signals to GimpAction,
  with the same signature as the resp. GAction signals
- remove all other custom action signals and only use the new
  GimpAction signals
- pass around appropriate GVariants containing booleans, int32,
  strings
- badly hack around to force a GimpProcedure pointer into a
  uint64 variant
- remove all G_CALLBACK() casts from all action callbacks,
  they all have the same signature now
2019-07-04 01:11:48 +02:00
Michael Natterer 86e07c16b5 app: start porting away from GtkAction and friends
Step one: get rid of all those deprecation warnings that make
it hard to see any other warnings:

- add a lot of dummy API to GimpAction, GimpActionGroup, GimpUIManager
  etc. which simply forwards to the deprecated GTK functions, they
  will all go away again later
- rename GimpAction to GimpActionImpl
- add interface GimpAction that is implemented by all action classes,
  creates a common interface and allows to remove some duplicated
  logic from GimpToggleAction and GimpRadioAction, and at the same
  time adds more features
2019-07-02 14:21:32 +02:00
Michael Natterer c9b10ff3bf Issue #3251 - Windows menu shows doc's old name not new
In windows-actions.c, connect to GimpDisplayShell's "notify::title"
and update the action label when it changes.
2019-05-05 16:23:40 +02:00
Sergio Jiménez Herena 1ca2d74411 app: Add option in the windows menu to hide the image tab bar.
(cherry picked from commit 360aee10d8)
2018-10-23 11:52:07 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer ebe528aca8 app: port most menu items that want images to gimp_menu_item_set_image()
or remove the item setting completely.
2018-05-20 21:06:30 +02:00
Michael Natterer dda54c1df8 Deprecate stock items for good and change all icon defines to GIMP_ICON_*
Try to sort all GIMP_ICON_* defines into FDO categories like in
https://specifications.freedesktop.org/icon-naming-spec/latest/ar01s04.html

Add defines for all icons we override, rename some icons to their FDO
standard names, and mark the ones we duplicate with a comment so we
don't forget to rename those to standard names in 3.0.
2017-03-05 16:01:59 +01:00
Jehan 4a9a0723f5 Revert "app: handle gtk_accel_map_change_entry () failure..."
This reverts commit eab4929a78.

Oups it would seem gtk_accel_map_change_entry() could return FALSE even
when the expected shortcut is correctly set (my guess is that it was
already the same shortcut, so indeed no "change" happened, though it is
not a failure either; yet I haven't checked if that is the actual
reason).
Let's just revert this. It's not always a good thing to be too thorough!
Sorry for this!
2016-11-25 06:14:04 +01:00
Jehan eab4929a78 app: handle gtk_accel_map_change_entry () failure...
... for "windows-display-*" actions.
I should not happen, but let's be thorough and properly handle failure
with a message since this is a runtime issue.
2016-11-25 05:16:35 +01:00
Jehan 2081de5a6c app: remove transient actions with gimp_action_group_remove_action().
gtk_action_group_remove_action() removes the action from the group while
not actually cleaning any accelerator. This is a problem for transient
actions which have only a meaning within the current session, such as
the display switching actions named with the display ID (unique within
the session only).
Current commit, combined with the previous one (commit c0ee959), fix
"windows-display-*" actions being saved inside menurc.
2016-11-25 04:50:09 +01:00
Michael Natterer 39909b6008 app: replace GimpList's internal GList with a GQueue
so we can easily iterate in reverse order, and access the last element
in O(1). Nothing makes use of this yet.
2016-05-01 15:22:44 +02:00
Michael Natterer 65a65947d9 app, libgimp: replace GTK_STOCK_FOO by icon names
unless it's a stock ID used for an action button, will address that
later.
2014-05-11 22:49:22 +02:00
Michael Natterer 9ed5b3f45e app: port GimpAction and friends to icon names 2014-05-06 23:47:38 +02:00
Jehan 8267220651 app: the "Tabs Position" menu should only be active in single window mode.
Thanks to Téo for pointing this out.
2013-10-25 14:50:04 +13:00
Michael Natterer 72227435d5 app: use "on the $side" not "to the $side" in the tab position actions 2013-10-11 23:54:29 +02:00
Jehan c15f9799c1 app: tabs position saved in sessionrc and only 1 HELP-ID is enough.
The settings was saved both in sessionrc and gimprc!
2013-10-12 04:30:30 +13:00
Jehan b2e40c4ca7 Bug 667169 - Single window mode: allow tabs position setting. 2013-10-11 23:16:29 +13:00
Alexandre Prokoudine 7be0e1c747 Fix syntaxis in user-visible messages
Phrases starting with "When enabled" should have a comma.
2013-10-11 06:32:04 +04:00
Jehan 34a197e304 Bug 701090: allowing to reorder shell tabs by drag'n drop in single-window-mode. 2013-08-29 18:36:13 +12:00
Ville Skyttä 6b0d1038cc Bug 692641 - Various spelling fixes 2013-01-27 18:59:02 +01:00
Michael Natterer 220b28677b Bug 676566 - Window title becomes "Untitled" after exporting without saving
Fix this and other issues more globally by moving the logic that
formats the image's display name into the GimpImage object, and return
the properly formatted name, e.g. "Foo.xcf", or "[Foo] (imported)"
from gimp_image_get_display_name().

Also add gimp_image_get_display_path() which returns the full path
instead. Use the two functions for formatting the image title, and
apply various other fixes that make sure the UI always uses the same
string to identify the image.

Call gimp_object_name_changed() whenever the save/export status
changes, so the image's cached display name and path get cleared.
2012-07-17 22:52:49 +02:00
Martin Nordholts f7aa27a7e8 app: Remove "Far from completely implemented!" in SWM action
Unfortunately this is a string change, but we simply can't not let it
say "Far from completely implemented!". Single-window mode works fine
now.
2012-02-23 19:29:56 +01:00
Michael Natterer f70bc837fa app: remove gimpdisplay-utils.[ch], move its only function to gimpdisplay.[ch] 2012-02-11 17:57:27 +01:00
Massimo Valentini 39368a410d plugged memory leaks 2012-02-07 17:32:02 +01:00
Michael Natterer 8e5f18fb9e app: make Alt+Tab and Alt+Shift+Tab cycle through all open displays
in both multi- and single-window mode. This is useful especially in
multi-window mode because in single-window we can already cycle
through all tabs with Ctrl+PageUp/Down.
2011-05-30 23:46:50 +02:00
Michael Natterer 3b71b71c4c app: always add ALT+number accelerators to the image window menu items
There is no reason why we should have them only in single-window-mode.
The accels are numbered in the order the displays are opened, which is
also the order they appear in the menu. The only thing that needs to
be taken care of is that switching to SWM swallows the image windows
into the single window in the right order. Fixes bug #647524.
2011-05-08 00:00:55 +02:00
Martin Nordholts 3b243bdcfe app: Add gimp_display_get_action_name() utility function 2011-04-07 07:12:32 +02:00
Michael Natterer 61025c6023 Bug 624824 - use gtk-image-menu-item-set-always-show-image on some menu items
Always show icons for:

- Fill FG/BG/Pattern
- Rotate
- Recently opened
- Open images
2011-04-02 15:38:55 +02:00
Martin Nordholts ac773489e4 app: gimp_image_get_uri() -> gimp_image_get_uri_or_untitled() 2011-01-26 07:55:14 +01:00
Martin Nordholts 122feb0dd5 app: Capitalize Windows-menu items
All menu items are capitalized, 'Single-window mode' and 'Hide docks'
shall also be capitalized.
2010-03-20 18:06:29 +01:00
Martin Nordholts 798e2e67e9 app: Move toolbox special casing into dialog factory
Move toolbox special casing into
gimp_dialog_factory_dialog_new_internal() and on the fly fix problems
with double toolboxes appearing and sometimes not appearing.
2010-03-02 22:38:15 +01:00
Martin Nordholts 11b1300b6f app: Introduce gimp_dialog_factory_get_singleton()
Instead of including dialogs/dialogs.h everywhere, introduce
gimp_dialog_factory_get_singleton(). The dialog factory singleton is
still initialized by dialogs.c though.

Right now the assumption is that we never will have another dialog
factory instance around. There were so many problems before when we
had four of them, so let's just keep one of them around.
2010-02-28 23:23:24 +01:00
Martin Nordholts 18f3be6bd3 Bug 602223 - Can't hide docks with Tab in single-window mode
Add a "hide-docks" config and connect the Windows->Hide docks menu
item to it. Also connect the image window to the config property so it
can hide/show its docks when it needs to.

Also add and use a utility function
gimp_image_window_keep_canvas_pos() to ensure that the image in the
window remains fixed when toggling visiblity of docks. One problem:
When GimpDrawTool is active on the canvas, there is flicker. The end
position is correct though.

Also add regression testing for this fix to test-ui.c
2010-02-24 19:53:48 +01:00
Martin Nordholts f9a2c5cfe1 app: Add Windows→Hide docks menu item
Add Windows→Hide docks menu item. We don't remove the hardcoding of
having Tab trigger it though, because gtk_accelerator_valid() returns
FALSE for GDK_tab. This means that if the user changes keyboard
shortcut for the menu item, both the user shortcut and the hardcoded
shortcut will work. We remove gimp_dialog_factories_toggle() and make
clients activate the action instead to toggle dock visibility.
2010-02-20 22:54:11 +01:00
Martin Nordholts 8b458fb591 app: Merge "toplevel" and "dock" dialog factories
Merge "toplevel" and "dock" dialog factories. The end goal is to have
only one dialog factory.
2010-02-20 09:28:26 +01:00
Martin Nordholts 66197c5d11 app: global_dock_window_factory -> global_dock_factory
Rename back global_dock_window_factory to
global_dock_factory. Renaming to global_dock_window_factory was done
under the assumption that there would be a separate factory that would
create non-toplevel dockables, but I don't expect this to happen in
the forseeable future.
2010-01-19 22:40:06 +01:00