Difference between revisions of "User:Rvojta/Multiplatform shortcuts"
m (→Modifiers Support: wiki typo, " replaced with ' ' (italics)) |
|||
(19 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | = Abstract = | ||
+ | |||
OpenOffice.org violates many shortcuts on Mac OS X platform. There was an effort (accelerators01 CWS) to define all shortcuts in one place, but there isn't possibility to easily define multiplatform shortcuts. Because of these reasons macshortcuts01 CWS was introduced to fix all these issues and provide fixes for small amount of Mac OS X shortcuts to show how it can be done. | OpenOffice.org violates many shortcuts on Mac OS X platform. There was an effort (accelerators01 CWS) to define all shortcuts in one place, but there isn't possibility to easily define multiplatform shortcuts. Because of these reasons macshortcuts01 CWS was introduced to fix all these issues and provide fixes for small amount of Mac OS X shortcuts to show how it can be done. | ||
Many thanks to Stephan Bergmann, Eric Bachard, Philipp Lohmann, Carsten Driesner and others. I can't remember all people who helped me and if I missed you, I'm sorry. Feel free to drop me a note and I'll fix it. | Many thanks to Stephan Bergmann, Eric Bachard, Philipp Lohmann, Carsten Driesner and others. I can't remember all people who helped me and if I missed you, I'm sorry. Feel free to drop me a note and I'll fix it. | ||
+ | |||
+ | == Owner == | ||
+ | |||
+ | Name: Robert Vojta | ||
+ | Email: rvojta@openoffice.org | ||
= Current State = | = Current State = | ||
Line 7: | Line 14: | ||
== Shortcuts Configuration == | == Shortcuts Configuration == | ||
− | + | There's new shortcuts configuration approach since DEV300_m37. You can read framework's article [http://wiki.services.openoffice.org/wiki/Framework/Article/Accelerators_Configuration Accelerators Configuration] to have idea what was changed. But even with this new approach, it's not possible to easily define multiplatform shortcuts. There are some limitations. | |
+ | |||
+ | === What's possible === | ||
− | + | Simple shortcut definition. Example below defines ''F11'' key as a shortcut for ''.uno:DesignerDialog'' (Stylist window). | |
<source lang="xml"> | <source lang="xml"> | ||
Line 19: | Line 28: | ||
</source> | </source> | ||
− | + | You can add attribute ''install:module'' to ''node'', ''prop'' or ''value'' to make platform dependent configuration. | |
+ | |||
+ | === What's not possible === | ||
+ | |||
+ | It's not possible to have two nodes, props or values with the same ''oor:name'', different ''xml:lang'' and different ''install:module''. Let's say you want to change ''F11'' shortcut to ''Cmd-T'' on Mac OS X only. For the ''F11'' key, it's quite easy. You can add ''install:module="unxwnt"'' to ''value'', ''prop'' or ''node''. This entry will be assigned to ''unxwnt'' module only. Example: | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <node oor:name="F11" oor:op="replace"> | ||
+ | <prop oor:name="Command" install:module="unxwnt"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> | ||
+ | <value xml:lang="en-US">.uno:DesignerDialog</value> | ||
+ | </prop> | ||
+ | </node> | ||
+ | </source> | ||
+ | |||
+ | But ''Cmd-T'' is already used in ''Accelerators.xcu'' file and is defined as: | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <node oor:name="T_MOD1" oor:op="replace"> | ||
+ | <prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value> | ||
+ | <value xml:lang="de">.uno:SubScript</value> | ||
+ | <value xml:lang="es">.uno:AlignHorizontalCenter</value> | ||
+ | </prop> | ||
+ | </node> | ||
+ | </source> | ||
+ | |||
+ | It's possible to add new ''<value>'' pair. | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <value xml:lang="en-US">.uno:DesignerDialog</value> | ||
+ | </source> | ||
+ | |||
+ | But it's possible to sort this shortcut by modules? No, it's not possible. Because current limitations are: | ||
+ | |||
+ | * you can't have more ''<value>'' pairs with ''xml:lang'' and ''install:module'' attributes, | ||
+ | * you can't have more ''<prop>'' pairs with the same ''oor:name'', but width different ''install:module'' value, | ||
+ | * you can't have more ''<node>'' pairs with the same ''oor:name'', but width different ''install:module'' values. | ||
+ | * you can't have ''<value>'' pairs with and without ''install:module'' attribute (applies to ''x-no-translate''). | ||
+ | |||
+ | You can easily define shortcuts, but you can't sort them to modules now. | ||
== Modifiers Support == | == Modifiers Support == | ||
− | [http://api.openoffice.org/docs/common/ref/com/sun/star/awt/KeyModifier.html KeyModifier] constant group | + | Currently, OpenOffice.org supports three modifiers only - ''SHIFT'', ''MOD1'' and ''MOD2''. You can see this in API reference of the |
+ | [http://api.openoffice.org/docs/common/ref/com/sun/star/awt/KeyModifier.html KeyModifier] constant group. | ||
− | + | These modifiers are assigned to different keys on different platforms. | |
− | ''MOD1'' | + | {| |
+ | | '''Modifier''' || '''Platform''' || '''Key''' | ||
+ | |- | ||
+ | | ''SHIFT'' || All || Shift | ||
+ | |- | ||
+ | | ''MOD1'' || Windows, UNIX || Ctrl | ||
+ | |- | ||
+ | | || Mac OS X || Cmd | ||
+ | |- | ||
+ | | ''MOD2'' || All || Alt (Option) | ||
+ | |} | ||
+ | |||
+ | There's no support for ''Ctrl'' on Mac OS X and for ''Windows'' (Meta) on Windows, Unix. | ||
+ | |||
+ | = Enhancement = | ||
− | + | == Sort Shortcuts by Platform == | |
− | + | Stephan Bergmann already fixed issue [http://www.openoffice.org/issues/show_bug.cgi?id=99296 99296], which adds support for multiple ''<value>'' pairs in one ''<prop>'' with different ''xml:lang'' and ''install:module'' attribute values. Thanks. | |
− | + | Below is a description of ''F11'' shortcut change to ''Cmd-T'' on Mac OS X only. Here's an example how to do it from scratch. But most parts are already implemented in ''macshortcuts01'' CWS. | |
− | == Shortcuts | + | === Sort Shortcuts === |
− | + | First of all, we have to define ''F11'' for Unix and Windows platform only. We can do this with ''install:module'' attribute. | |
<source lang="xml"> | <source lang="xml"> | ||
Line 47: | Line 109: | ||
</source> | </source> | ||
− | + | Note: See special ''x-no-translate'' module. Because there's no way how to add ''<value>'' pairs with and without ''install:module'' attribute, you have to use this special ''install:module'' value if you do want to use ''install:module'' attribute in remaining ''<value>'' pairs. | |
− | |||
− | |||
− | + | ''Cmd-T'' shortcut is already defined and have to add new functionality for Mac OS X. Here it is: | |
<source lang="xml"> | <source lang="xml"> | ||
Line 63: | Line 123: | ||
</source> | </source> | ||
− | + | ''T_MOD1'' is ''Cmd-T'' on Mac OS X and ''Ctrl-T'' on other platforms. This configuration part defines actions for shortcut in this way: | |
+ | |||
+ | * it's binded to ''.uno:SubScript'' command on Unix, Windows platforms and DE language only, | ||
+ | * it's binded to ''.uno:AlighHorizontalCenter'' command on Unix, Windows platforms and ES language only, | ||
+ | * it's binded to ''.uno:DesignerDialog'' command on Mac OS X for all languages. | ||
+ | |||
+ | === Build Shortcuts === | ||
− | + | We have defined multiplatform shortcuts and we introduced two modules ''unxwnt'' and ''macosx''. We have to add them to [http://svn.services.openoffice.org/ooo/cws/macshortcuts01/officecfg/registry/data/org/openoffice/Office/makefile.mk makefile.mk]. | |
''Accelerators.xcu'' must be added to ''XCUFILES'' and ''LOCALIZEDFILES''. Module files are generated automatically during build process and they have names ''Accelerators-unxwnt.xcu'' and ''Accelerators-macosx.xcu''. Both files must be added to ''MODULEFILES''. Example below: | ''Accelerators.xcu'' must be added to ''XCUFILES'' and ''LOCALIZEDFILES''. Module files are generated automatically during build process and they have names ''Accelerators-unxwnt.xcu'' and ''Accelerators-macosx.xcu''. Both files must be added to ''MODULEFILES''. Example below: | ||
<source lang="make"> | <source lang="make"> | ||
− | |||
XCUFILES = Accelerators \ | XCUFILES = Accelerators \ | ||
... | ... | ||
Line 81: | Line 146: | ||
... | ... | ||
</source> | </source> | ||
+ | |||
+ | This part is already done in ''macshortcuts01'' CWS. | ||
+ | |||
+ | === Packing === | ||
We have define directory where we want to see our modules ''XCU'' files. This is defined in [http://svn.services.openoffice.org/ooo/cws/macshortcuts01/scp2/source/ooo/directory_ooo.scp directory_ooo.scp] file. | We have define directory where we want to see our modules ''XCU'' files. This is defined in [http://svn.services.openoffice.org/ooo/cws/macshortcuts01/scp2/source/ooo/directory_ooo.scp directory_ooo.scp] file. | ||
Line 106: | Line 175: | ||
</source> | </source> | ||
− | Here's | + | This part is already done in ''macshortcuts01'' CWS. |
+ | |||
+ | Here's additional example how to make selection based on your platform. | ||
<source lang="c"> | <source lang="c"> | ||
Line 118: | Line 189: | ||
</source> | </source> | ||
− | + | === Additional Modules === | |
+ | |||
+ | You can define more modules in ''Accelerators.xcu'' file (basically, in any ''.xcu'' file), but you have to do: | ||
+ | |||
+ | * add support for them to ''makefile.mk'' (module ''officecfg''), | ||
+ | * sort them properly in ''file_ooo.scp'' (module ''scp2''). | ||
== Modifiers Support == | == Modifiers Support == | ||
Line 135: | Line 211: | ||
| ''MOD2'' || All || Alt (Option) | | ''MOD2'' || All || Alt (Option) | ||
|- | |- | ||
− | | ''MOD3'' || Unix, | + | | ''MOD3'' || Unix - Gtk || GDK_SUPER_MASK, GDK_META_MASK |
+ | |- | ||
+ | | || Unix - X11, KDE || XK_SUPER_L/R, XK_META_L/R | ||
|- | |- | ||
| || Mac OS X || Ctrl | | || Mac OS X || Ctrl | ||
+ | |- | ||
+ | | || Windows || no key assigned (see [http://gsl.openoffice.org/servlets/ReadMsg?list=dev&msgNo=2220 dev@gsl]) | ||
|} | |} | ||
− | You can combine all these modifiers in ''Accelerators.xcu'' file. | + | You can combine all these modifiers in ''Accelerators.xcu'' file. Basically, all things from [http://wiki.services.openoffice.org/wiki/Framework/Article/Accelerators_Configuration Accelerators Configuration] article applies here, but you have one additional modifier ''MOD3'', which is binded to ''Ctrl'' on Mac OS X and to ''Windows'' (META/SUPER) on other unixes. |
+ | |||
+ | = References = | ||
+ | |||
+ | == CWS == | ||
+ | |||
+ | Name: macshortcuts01 ([http://idisk.mac.com/rvojta-Public/OO.o/CWS/cws-dev300-m41-macshortcuts01.diff diff]) | ||
+ | |||
+ | Status: Ready for QA | ||
+ | |||
+ | Content: | ||
+ | |||
+ | * Introduced ''MOD3'' modifier (including changes in lot of modules to support it) | ||
+ | ** Modules: dbaccess, sfx2, vcl, sc, sd, toolkit, offapi, framework, accessibility, svx, forms, svtools | ||
+ | * Possibility to have multiple ''<value>'' pairs with ''xml:lang'' and ''install:module'' attributes | ||
+ | ** Modules: officecfg, scp2 (for ''unxwnt'' and ''macosx'' modules) | ||
+ | * Cmd-Y to Cmd-Shift-Z for Redo on Mac OS X | ||
+ | ** Modules: officecfg | ||
+ | * Cmd-M to minimize current window on Mac OS X | ||
+ | ** Modules: vcl | ||
+ | * Cmd-Option-M to minimize all application windows on Mac OS X | ||
+ | ** Modules: vcl | ||
+ | * Cmd-M to Ctrl-M for Default formatting on Mac OS X | ||
+ | ** Modules: officecfg | ||
+ | * F11 to Cmd-T for Stylist window on Mac OS X | ||
+ | ** Modules: officecfg | ||
+ | |||
+ | This scheduled for macshortcuts02 CWS or later: | ||
+ | |||
+ | * review Cmd-T shortcut for ES language | ||
+ | * review Cmd-T shortcut for DE language (thanks to Andre Schnabel) | ||
+ | |||
+ | == Issues == | ||
+ | |||
+ | * [http://www.openoffice.org/issues/show_bug.cgi?id=99254 99254 - Support for MOD3] | ||
+ | * [http://www.openoffice.org/issues/show_bug.cgi?id=99296 99296 - Check node/prop/value uniqueness after install:module sorting] | ||
+ | * [http://www.openoffice.org/issues/show_bug.cgi?id=99177 99177 - Mac OS X - Redo should be Cmd-Shift-Z] | ||
+ | * [http://www.openoffice.org/issues/show_bug.cgi?id=98949 98949 - Command-M fails to minimise windows to Dock] | ||
+ | * [http://www.openoffice.org/issues/show_bug.cgi?id=98950 98950 - Command-M for Default Formatting prevents more normal use of command-M for minimising to Dock] | ||
+ | * [http://www.openoffice.org/issues/show_bug.cgi?id=98951 98951 - Command-M for Default Formatting prevents more normal use of command-M for minimising to Dock] | ||
+ | * [http://www.openoffice.org/issues/show_bug.cgi?id=99637 99637 - Mac OS X - F11 (Stylist) doesn't work] | ||
+ | |||
+ | == Credits == | ||
+ | |||
+ | Eric Bachard for initial help. Stephan Bergmann, Carsten Driesner and Philipp Lohmann for helping me with remaining issues. |
Latest revision as of 00:24, 31 May 2009
Abstract
OpenOffice.org violates many shortcuts on Mac OS X platform. There was an effort (accelerators01 CWS) to define all shortcuts in one place, but there isn't possibility to easily define multiplatform shortcuts. Because of these reasons macshortcuts01 CWS was introduced to fix all these issues and provide fixes for small amount of Mac OS X shortcuts to show how it can be done.
Many thanks to Stephan Bergmann, Eric Bachard, Philipp Lohmann, Carsten Driesner and others. I can't remember all people who helped me and if I missed you, I'm sorry. Feel free to drop me a note and I'll fix it.
Owner
Name: Robert Vojta Email: rvojta@openoffice.org
Current State
Shortcuts Configuration
There's new shortcuts configuration approach since DEV300_m37. You can read framework's article Accelerators Configuration to have idea what was changed. But even with this new approach, it's not possible to easily define multiplatform shortcuts. There are some limitations.
What's possible
Simple shortcut definition. Example below defines F11 key as a shortcut for .uno:DesignerDialog (Stylist window).
<node oor:name="F11" oor:op="replace">
<prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="en-US">.uno:DesignerDialog</value>
</prop>
</node>
You can add attribute install:module to node, prop or value to make platform dependent configuration.
What's not possible
It's not possible to have two nodes, props or values with the same oor:name, different xml:lang and different install:module. Let's say you want to change F11 shortcut to Cmd-T on Mac OS X only. For the F11 key, it's quite easy. You can add install:module="unxwnt" to value, prop or node. This entry will be assigned to unxwnt module only. Example:
<node oor:name="F11" oor:op="replace">
<prop oor:name="Command" install:module="unxwnt"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="en-US">.uno:DesignerDialog</value>
</prop>
</node>
But Cmd-T is already used in Accelerators.xcu file and is defined as:
<node oor:name="T_MOD1" oor:op="replace">
<prop oor:name="Command"><value xml:lang="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="de">.uno:SubScript</value>
<value xml:lang="es">.uno:AlignHorizontalCenter</value>
</prop>
</node>
It's possible to add new <value> pair.
<value xml:lang="en-US">.uno:DesignerDialog</value>
But it's possible to sort this shortcut by modules? No, it's not possible. Because current limitations are:
- you can't have more <value> pairs with xml:lang and install:module attributes,
- you can't have more <prop> pairs with the same oor:name, but width different install:module value,
- you can't have more <node> pairs with the same oor:name, but width different install:module values.
- you can't have <value> pairs with and without install:module attribute (applies to x-no-translate).
You can easily define shortcuts, but you can't sort them to modules now.
Modifiers Support
Currently, OpenOffice.org supports three modifiers only - SHIFT, MOD1 and MOD2. You can see this in API reference of the KeyModifier constant group.
These modifiers are assigned to different keys on different platforms.
Modifier | Platform | Key |
SHIFT | All | Shift |
MOD1 | Windows, UNIX | Ctrl |
Mac OS X | Cmd | |
MOD2 | All | Alt (Option) |
There's no support for Ctrl on Mac OS X and for Windows (Meta) on Windows, Unix.
Enhancement
Sort Shortcuts by Platform
Stephan Bergmann already fixed issue 99296, which adds support for multiple <value> pairs in one <prop> with different xml:lang and install:module attribute values. Thanks.
Below is a description of F11 shortcut change to Cmd-T on Mac OS X only. Here's an example how to do it from scratch. But most parts are already implemented in macshortcuts01 CWS.
Sort Shortcuts
First of all, we have to define F11 for Unix and Windows platform only. We can do this with install:module attribute.
<node oor:name="F11" oor:op="replace">
<prop oor:name="Command"><value xml:lang="x-no-translate" install:module="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="en-US" install:module="unxwnt">.uno:DesignerDialog</value>
</prop>
</node>
Note: See special x-no-translate module. Because there's no way how to add <value> pairs with and without install:module attribute, you have to use this special install:module value if you do want to use install:module attribute in remaining <value> pairs.
Cmd-T shortcut is already defined and have to add new functionality for Mac OS X. Here it is:
<node oor:name="T_MOD1" oor:op="replace">
<prop oor:name="Command"><value xml:lang="x-no-translate" install:module="x-no-translate">I10N SHORTCUTS - NO TRANSLATE</value>
<value xml:lang="de" install:module="unxwnt">.uno:SubScript</value>
<value xml:lang="es" install:module="unxwnt">.uno:AlignHorizontalCenter</value>
<value xml:lang="en-US" install:module="macosx">.uno:DesignerDialog</value>
</prop>
</node>
T_MOD1 is Cmd-T on Mac OS X and Ctrl-T on other platforms. This configuration part defines actions for shortcut in this way:
- it's binded to .uno:SubScript command on Unix, Windows platforms and DE language only,
- it's binded to .uno:AlighHorizontalCenter command on Unix, Windows platforms and ES language only,
- it's binded to .uno:DesignerDialog command on Mac OS X for all languages.
Build Shortcuts
We have defined multiplatform shortcuts and we introduced two modules unxwnt and macosx. We have to add them to makefile.mk.
Accelerators.xcu must be added to XCUFILES and LOCALIZEDFILES. Module files are generated automatically during build process and they have names Accelerators-unxwnt.xcu and Accelerators-macosx.xcu. Both files must be added to MODULEFILES. Example below:
XCUFILES = Accelerators \
...
MODULEFILES = Accelerators-macosx.xcu \
Accelerators-unxwnt.xcu \
...
LOCALIZEDFILES = Accelerators.xcu \
...
This part is already done in macshortcuts01 CWS.
Packing
We have define directory where we want to see our modules XCU files. This is defined in directory_ooo.scp file.
Directory gid_Dir_Share_Registry_Modules_Oo_Office_Accelerators
ParentID = gid_Dir_Share_Registry_Modules_Oo_Office;
HostName = "Accelerators";
End
We have defined shortcuts, build system, directory for our modules and the only thing we need to do is to select proper modules for platforms. It's done in file_ooo.scp file.
File gid_File_Registry_Spool_Oo_Accelerators_System_Xcu
TXT_FILE_BODY;
Styles = (PACKED);
Dir = gid_Dir_Share_Registry_Modules_Oo_Office_Accelerators;
#ifdef QUARTZ
Name = "/registry/spool/org/openoffice/Office/Accelerators-macosx.xcu";
#else
Name = "/registry/spool/org/openoffice/Office/Accelerators-unxwnt.xcu";
#endif
End
This part is already done in macshortcuts01 CWS.
Here's additional example how to make selection based on your platform.
#ifdef WNT
Platform = "Windows";
#elif defined QUARTZ
Platform = "Mac OS X";
#else
Platform = "Unix";
#endif
Additional Modules
You can define more modules in Accelerators.xcu file (basically, in any .xcu file), but you have to do:
- add support for them to makefile.mk (module officecfg),
- sort them properly in file_ooo.scp (module scp2).
Modifiers Support
This enhancement introduces MOD3 modifier in KeyModifier.idl. For now, OpenOffice.org supports SHIFT, MOD1, MOD2, MOD3. Platform specific usage:
Modifier | Platform | Key |
SHIFT | All | Shift |
MOD1 | Unix, Windows | Ctrl |
Mac OS X | Cmd | |
MOD2 | All | Alt (Option) |
MOD3 | Unix - Gtk | GDK_SUPER_MASK, GDK_META_MASK |
Unix - X11, KDE | XK_SUPER_L/R, XK_META_L/R | |
Mac OS X | Ctrl | |
Windows | no key assigned (see dev@gsl) |
You can combine all these modifiers in Accelerators.xcu file. Basically, all things from Accelerators Configuration article applies here, but you have one additional modifier MOD3, which is binded to Ctrl on Mac OS X and to Windows (META/SUPER) on other unixes.
References
CWS
Name: macshortcuts01 (diff)
Status: Ready for QA
Content:
- Introduced MOD3 modifier (including changes in lot of modules to support it)
- Modules: dbaccess, sfx2, vcl, sc, sd, toolkit, offapi, framework, accessibility, svx, forms, svtools
- Possibility to have multiple <value> pairs with xml:lang and install:module attributes
- Modules: officecfg, scp2 (for unxwnt and macosx modules)
- Cmd-Y to Cmd-Shift-Z for Redo on Mac OS X
- Modules: officecfg
- Cmd-M to minimize current window on Mac OS X
- Modules: vcl
- Cmd-Option-M to minimize all application windows on Mac OS X
- Modules: vcl
- Cmd-M to Ctrl-M for Default formatting on Mac OS X
- Modules: officecfg
- F11 to Cmd-T for Stylist window on Mac OS X
- Modules: officecfg
This scheduled for macshortcuts02 CWS or later:
- review Cmd-T shortcut for ES language
- review Cmd-T shortcut for DE language (thanks to Andre Schnabel)
Issues
- 99254 - Support for MOD3
- 99296 - Check node/prop/value uniqueness after install:module sorting
- 99177 - Mac OS X - Redo should be Cmd-Shift-Z
- 98949 - Command-M fails to minimise windows to Dock
- 98950 - Command-M for Default Formatting prevents more normal use of command-M for minimising to Dock
- 98951 - Command-M for Default Formatting prevents more normal use of command-M for minimising to Dock
- 99637 - Mac OS X - F11 (Stylist) doesn't work
Credits
Eric Bachard for initial help. Stephan Bergmann, Carsten Driesner and Philipp Lohmann for helping me with remaining issues.