Commit Graph

60 Commits

Author SHA1 Message Date
Kacper Donat
34c85e26da Gui: Allow ActionGroups to not remember choice
This is fix to issue mentioned in the #11717, on discord and forum that
for smart dimension tool the chosen tool should not be remembered. This
will ensure that the "smart" tool is always visible on the toolbar and
other tools are accessible in case that such explicit choice is needed.
2023-12-18 17:51:48 +01:00
André Caldas
89dbab9b0e Avoids using getNameInDocument() to test if DocumentObject is attached to a Document.
This patch substitutes by isAttachedToDocument() (almost) everywhere where
getNameInDocument() is used for this purpose.

The very few places not touched by this patch demand a (just a little) less trivial change.
When we change the returning type of getNameInDocument() to std::string,
those places will be easily found, because they shall generate a compiler error
(converting std::string to bool).

Rationale:
The fact that getNameInDocument() return nullptr to indicate
that the object is not attached to a document is responsible for lots of bugs
where the developer does not check for "nullptr".

The idea is to eliminate all those uses of getNameInDocument() and, in the near future,
make getNameInDocument() return always a valid std::string.
2023-12-11 17:37:58 +01:00
wmayer
531d7de201 Gui: make GroupCommand more flexible
Currently the GroupCommand by default sets the action group as non-exclusive, checkable and having a drop-down menu which isn't always the desired behaviour in sub-classes.
Thus, some new methods are added to let a sub-class in its constructor decide how it should behave.
2023-09-01 13:28:19 +02:00
luzpaz
3110980e6e Fix various typos 2023-07-15 11:17:45 +02:00
marioalexis
ae480d70cd Gui: Add CommandAction descriptor object to access commands action 2023-04-10 16:53:51 +02:00
Zheng, Lei
7942ed61c5 Gui: fix Customize -> Keyboard shortcut priroity list
Add API Command::initAction() to force create action for all commands
with shortcut in order to register with ShortcutManager to obtain a
complete list of actions with the same shortcut.
2022-11-10 23:20:18 +01:00
Zheng, Lei
dc8bcf46c4 Gui: change Command::getRevision() to const 2022-11-10 23:20:18 +01:00
Zheng, Lei
775452cbc0 Gui: add ShortcutManager to unify shortcut handling
Support longest key sequence match with user defined delay (configurable
through 'Customize -> Keyboard -> Key sequence delay').

Support user defined priority to resolve shortcut conflict through
'Customize -> Keyboard')

Add 'All' category in 'Customize -> Keyboard' to list all command and
showing their shortcuts

Unify macro command shortcut setting (BaseApp/Preferences/Shortcut).
2022-11-10 23:20:18 +01:00
wmayer
23961706be Gui: modernize C++: replace 'typedef' with 'using' 2022-08-29 14:09:18 +02:00
berniev
3877fc62c3 Gui: Single arg ctors must be explicit (PR #7369) 2022-08-24 15:06:03 +02:00
berniev
75fa455c5d Gui: Use override etc 2 2022-08-09 12:43:23 +02:00
berniev
3d1f70765a Gui: redundant void 2 2022-08-08 10:21:44 +02:00
wmayer
1459fd61a4 cppcoreguidelines-special-member-functions
* disable move constructor and move assignment for several core classes
2022-06-25 17:46:48 +02:00
wmayer
1178df06b4 Gui: modernize C++11
* use nullptr
2022-03-23 18:41:21 +01:00
Uwe
e655ef820b [Gui] Application, command etc: remove unused includes 2022-02-20 22:41:34 +01:00
Chris Hennes
93836b89a5 GUI: Add Python interface to create custom command 2022-02-14 09:56:24 -06:00
wmayer
76da77f80e Gui: add convenience function Command::translatedGroupName() 2021-09-29 15:25:46 +02:00
wmayer
8cbd92d874 port to MSYS2/clang 2021-09-19 19:49:44 +02:00
Yorik van Havre
10c684cfab Merge pull request #4788 from 0penBrain/UserEditMode
Gui: add user edit mode (default edit mode set by user)
2021-09-02 11:50:03 +02:00
Chris Hennes
767bc22948 [Core] Add checks for conflicting accelerators
When compiled in debug mode, this PR adds code to check for conflicting
accelerator keys when a command is created. This can help developers
ensure that their default accelerator key selections don't conflict.

Replace partial match algorithm

Co-authored-by: 0penBrain <48731257+0penBrain@users.noreply.github.com>
2021-08-29 16:13:59 -05:00
Chris Hennes
f194ca7425 [GUI] Refactor tooltip code to rebuild shortcut
When the shortcut/accelerator key is changed, the tooltip should be
recalculated using the same code that calculated the original. Also
ensure this happens when the accelerator preferences are loaded.

Fixes #4664.
2021-08-25 14:24:17 -05:00
0penBrain
c6777b33e2 [Gui] UserEditMode : take into account in edit command
+ Mark strings for translation
2021-05-14 09:23:04 +02:00
wmayer
ca83354bf9 Gui: [skip ci] refactor Command::invoke 2021-03-28 20:04:31 +02:00
luz paz
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
555ecd0427 set platform-specific doCommand() to fix more -Wgnu-zero-variadic-macro-arguments 2019-11-16 00:54:52 +01:00
wmayer
7944c31f93 restore old definition of doCommand macro due to msvc failure 2019-11-14 19:42:24 +01:00
wmayer
aaff1b093e [skip ci] fix more -Wgnu-zero-variadic-macro-arguments 2019-11-14 00:48:26 +01:00
wmayer
84648aea62 improve strict ISO C++11 (-Wpedantic) 2019-10-14 10:54:57 +02:00
wmayer
77d3c19573 fix typo 2019-10-08 10:36:19 +02:00
Zheng, Lei
3b1aa19f05 Gui: add class GroupCommand help with grouped command
As an example usage, changed StdCmdTreeViewActions to be derived from
GroupCommand
2019-10-08 10:16:00 +02:00
Zheng, Lei
b583c2c9ac Gui: add document to Command and Selection 2019-10-08 10:14:41 +02:00
wmayer
9fa56345cf core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
luz.paz
63a577fe07 Fix typos in src/Gio 2019-08-17 15:32:49 +02:00
Zheng, Lei
4bd31c4b91 Gui: Command API changes
* invoke(), distinguish between command triggering source. Also add
  support of auto transaction using App::AutoTransaction. Now all
  command will support undo/redo by default.

* setupCheckable(), a helper function to Improve support of
  PythonGroupCommand

* getObjectCmd(), helper function to output Python command to refer to
  an object without ambiguity. Because with introduction of external
  linking, an object can no longer be safely referred through the
  current active document.

* Support auto MacroManager command logger. For commands that does not
  log any output to MacroManager, a log entry of 'Gui.runCommand()' will
  be auto generated.

* Support linked object in copyVisual()

* Modified do/runCommand() to print calling file and line number.

* Add various helper macros for run command involving a document or
  object.
2019-08-17 14:52:10 +02:00
luz.paz
cb4a0adf71 Misc. typos
Found via `codespell`
2019-02-08 11:01:24 -02:00
luz.paz
360e581672 Misc. typo and whitespace fixes
ref: https://forum.freecadweb.org/viewtopic.php?f=3&t=30988#p256964
along with other misc. fixes
2018-09-19 17:26:03 +02:00
luz.paz
9167064fc1 Misc. typos
Found via `codespell`
2018-04-25 09:41:33 -03:00
Stefan Tröger
1a3fb02eb9 Move App::Part to a separate global toolbar 2017-09-09 16:47:07 +02:00
wmayer
4d6d8e71f4 issue #0002687: zoomin/out during transform 2016-10-09 18:32:18 +02:00
wmayer
947f9575de remove Application::runPythonCode 2016-09-15 23:14:31 +02:00
wmayer
e8554cc77a do not use doCommand without using format string, add overloaded method of runCommand 2016-09-15 18:53:37 +02:00
wmayer
dbac90022d split compound command in separate commands to make shortcus customizable 2016-09-10 14:47:01 +02:00
Stefan Tröger
7fc0111944 better pipe view handling 2016-04-12 18:12:09 +02:00
jriegel
8eb0d198f8 First claimChildren3D implementation and Starting PartItem implementation 2016-04-12 18:11:45 +02:00
Abdullah Tahiri
89e89c8b2d Gui: Extension of CommandMacro for system-wide macros
=====================================================

What?
Extension of the CommandMacro constructor to take an additional optional argument to indicate that the macro
is located in the system-wide directory, and shall be executed accordingly.
2016-01-11 19:25:53 +01:00
wmayer
32377b7635 + use Python's inspect module to get calling instance of addCommand 2015-12-16 23:07:24 +01:00
Mateusz Skowroński
05f95c0506 Fix files encoding. Go from ISO8859-1 to UTF-8. 2015-09-21 19:50:49 -03:00
wmayer
1d8b7f3582 + duplicate string array for Python commands 2015-09-20 14:11:53 +02:00
wmayer
eb4040d6d0 + support of exclusive Python command groups 2015-09-02 22:52:04 +02:00
wmayer
fc9d1e86ac + support of checkable commands 2015-08-25 18:01:37 +02:00