Difference between revisions of "User:Rvojta/Multiplatform shortcuts"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (CWS)
m (Modifiers Support: wiki typo, " replaced with ' ' (italics))
 
(15 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 ==
  
For detailed information, please read framework's article [http://wiki.services.openoffice.org/wiki/Framework/Article/Accelerators_Configuration Accelerators 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 ===
  
It's possible to sort shortcuts with ''install:module'' attribute. But it's not possible to use ''install:module'' with ''xml:lang'' for more than one ''<value>'' pair in ''<prop>'' entry. Shortcut definition example:
+
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>
  
Example above defines ''F11' key as a shortcut for ''.uno:DesignerDialog'' (stylist window).
+
You can add attribute ''install:module'' to ''node'', ''prop'' or ''value'' to make platform dependent configuration.
  
== Modifiers Support ==
+
=== What's not possible ===
  
[http://api.openoffice.org/docs/common/ref/com/sun/star/awt/KeyModifier.html KeyModifier] constant group supports ''SHIFT'', ''MOD1'' and ''MOD2'' only. These modifiers are assigned as:
+
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:
  
''SHIFT'' Shift on all platforms
+
<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>
  
''MOD1'' Ctrl on Windows, UNIX and Cmd on Mac OS X
+
But ''Cmd-T'' is already used in ''Accelerators.xcu'' file and is defined as:
  
''MOD2'' Alt on all platforms
+
<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>
  
As you can see, there's no support for ''Windows'' key (Windows, Linux) and ''Ctrl'' key (Mac OS X). ''Ctrl'' key is needed for some shortcuts on Mac OS X and needs to be introduced.
+
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 ==
 +
 
 +
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.
 +
 
 +
{|
 +
| '''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 =
 
= Enhancement =
  
== Shortcuts Definition ==
+
== 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.
 +
 
 +
=== Sort Shortcuts ===
  
We propose to have possibility to use ''install:module'' with more than one ''<value>'' pair and ''xml:lang'' defined. It's possible now and you can define multiplatform shortcut in this way:
+
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>
  
Example above defines ''F11'' key as a shortcut for ''.uno:DesignerDialog'' on Unix and Windows platforms. Where and how is ''unxwnt'' ''install:module'' value defined / handled is described below.
+
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.
  
As you can see, there's also special ''install:module'' value ''x-no-translate''. You have to use it for ''<value>'' pair with ''xml:lang="x-no-translate"'' attribute if you use ''install:module'' because it's not possible to have ''<value>'' pairs with and without ''install:module'' attribute in one property (''<prop>'').
+
''Cmd-T'' shortcut is already defined and have to add new functionality for Mac OS X. Here it is:
 
+
Example below shows how to define multiplatform shortcut actions for ''Ctrl-T'' (''Cmd-T'' on Mac OS X). ''Cmd-T'' is used to display/hide stylist window on Mac OS X for all languages. ''Ctrl-T'' is used for subscript on Unix, Windows platform (DE language only). ''Ctrl-T'' is used for centering horizontal alignment on Unix, Windows platforms (ES language only).
+
  
 
<source lang="xml">
 
<source lang="xml">
Line 63: Line 123:
 
</source>
 
</source>
  
As you can see, you can define shortcuts for multiple platforms (modules) and for different languages. You can find more example in [http://svn.services.openoffice.org/ooo/cws/macshortcuts01/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu Accelerators.xcu] file.
+
''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:
  
Now, we have defined multiplatform shortcuts and two modules: ''unxwnt'', ''macosx''. We have to edit [http://svn.services.openoffice.org/ooo/cws/macshortcuts01/officecfg/registry/data/org/openoffice/Office/makefile.mk makefile.mk] and add our shortcuts and modules there.
+
* 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 an example how to make selection based on your platform.
+
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>
  
That's all. This is the way how to define multiplatform shortcuts. Most things mentioned here are done. It's enough to modify ''Accelerators.xcu'' file if you do want to provide shortcuts for Mac OS X (''macosx'') or for Windows/Linux (''unxwnt'') platforms.
+
=== 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, Windows || Windows (meta)
+
| ''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. For example ''T_MOD2_MOD1'' for ''Cmd-Option-T'' (Mac OS X), ''Ctrl-Alt-T'' (Unix, Windows), etc.
+
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 =
 
= References =
Line 146: Line 226:
 
== CWS ==
 
== CWS ==
  
Name: macshortcuts01
+
Name: macshortcuts01 ([http://idisk.mac.com/rvojta-Public/OO.o/CWS/cws-dev300-m41-macshortcuts01.diff diff])
 +
 
 +
Status: Ready for QA
  
 
Content:
 
Content:
Line 156: Line 238:
 
* Cmd-Y to Cmd-Shift-Z for Redo on Mac OS X
 
* Cmd-Y to Cmd-Shift-Z for Redo on Mac OS X
 
** Modules: officecfg
 
** Modules: officecfg
* Cmd-M to minimize current windows on Mac OS X
+
* Cmd-M to minimize current window on Mac OS X
 
** Modules: vcl
 
** Modules: vcl
 
* Cmd-Option-M to minimize all application windows on Mac OS X
 
* Cmd-Option-M to minimize all application windows on Mac OS X
Line 165: Line 247:
 
** Modules: officecfg
 
** Modules: officecfg
  
What's missing to be marked ready for QA:
+
This scheduled for macshortcuts02 CWS or later:
  
 
* review Cmd-T shortcut for ES language
 
* review Cmd-T shortcut for ES language

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

Credits

Eric Bachard for initial help. Stephan Bergmann, Carsten Driesner and Philipp Lohmann for helping me with remaining issues.

Personal tools