cam 2005/03/10 01:35:44
Modified: resources/org/apache/batik/apps/svgbrowser/resources Tag:
svg12 GUI.properties
sources/org/apache/batik/util/gui/resource Tag: svg12
MenuFactory.java
Log:
1. Changed resource file menu item accelerator format to that of
javax.swing.KeyStroke to support a wider selection of accelerator
keys.
Revision Changes Path
No revision
No revision
1.64.2.1 +26 -26
xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties
Index: GUI.properties
===================================================================
RCS file:
/home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties,v
retrieving revision 1.64
retrieving revision 1.64.2.1
diff -u -r1.64 -r1.64.2.1
--- GUI.properties 17 Feb 2005 11:47:05 -0000 1.64
+++ GUI.properties 10 Mar 2005 09:35:44 -0000 1.64.2.1
@@ -86,56 +86,56 @@
Open.icon = resources/open.gif
Open.mnemonic = O
Open.action = OpenAction
-Open.accelerator = Ctrl+F
+Open.accelerator = ctrl F
OpenLocation.type = ITEM
OpenLocation.text = Open Location...
OpenLocation.icon = resources/blank.gif
OpenLocation.mnemonic = L
OpenLocation.action = OpenLocationAction
-OpenLocation.accelerator = Ctrl+A
+OpenLocation.accelerator = ctrl A
NewWindow.type = ITEM
NewWindow.text = Create New Window...
NewWindow.icon = resources/blank.gif
NewWindow.mnemonic = N
NewWindow.action = NewWindowAction
-NewWindow.accelerator = Ctrl+N
+NewWindow.accelerator = ctrl N
Reload.type = ITEM
Reload.text = Reload Document
Reload.icon = resources/reload.gif
Reload.mnemonic = R
Reload.action = ReloadAction
-Reload.accelerator = Ctrl+R
+Reload.accelerator = ctrl R
SaveAs.type = ITEM
SaveAs.text = Save SVG As
SaveAs.icon = resources/blank.gif
SaveAs.mnemonic = S
SaveAs.action = SaveAsAction
-SaveAs.accelerator = Ctrl+S
+SaveAs.accelerator = ctrl S
Close.type = ITEM
Close.text = Close
Close.icon = resources/blank.gif
Close.mnemonic = C
Close.action = CloseAction
-Close.accelerator = Ctrl+W
+Close.accelerator = ctrl W
Exit.type = ITEM
Exit.text = Exit
Exit.icon = resources/blank.gif
Exit.mnemonic = E
Exit.action = ExitAction
-Exit.accelerator = Ctrl+Q
+Exit.accelerator = ctrl Q
Print.type = ITEM
Print.text = Print...
Print.icon = resources/print.gif
Print.mnemonic = P
Print.action = PrintAction
-Print.accelerator = Ctrl+P
+Print.accelerator = ctrl P
# Export As submenu ###########
ExportAs = PNG JPG TIFF
@@ -177,14 +177,14 @@
FindDialog.icon = resources/blank.gif
FindDialog.mnemonic = F
FindDialog.action = FindDialogAction
-FindDialog.accelerator = Ctrl+Z
+FindDialog.accelerator = ctrl Z
Preferences.type = ITEM
Preferences.text = Preferences...
Preferences.icon = resources/blank.gif
Preferences.mnemonic = P
Preferences.action = PreferencesAction
-Preferences.accelerator = Ctrl+G
+Preferences.accelerator = ctrl G
Flush.type = ITEM
Flush.text = Flush Cache
@@ -205,28 +205,28 @@
ThumbnailDialog.icon = resources/blank.gif
ThumbnailDialog.mnemonic = M
ThumbnailDialog.action = ThumbnailDialogAction
-ThumbnailDialog.accelerator = Ctrl+Y
+ThumbnailDialog.accelerator = ctrl Y
ResetTransform.type = ITEM
ResetTransform.text = Initial View
ResetTransform.icon = resources/blank.gif
ResetTransform.mnemonic = T
ResetTransform.action = ResetTransformAction
-ResetTransform.accelerator = Ctrl+T
+ResetTransform.accelerator = ctrl T
ZoomIn.type = ITEM
ZoomIn.text = Zoom In
ZoomIn.icon = resources/zoomin.gif
ZoomIn.mnemonic = I
ZoomIn.action = ZoomInAction
-ZoomIn.accelerator = Ctrl+I
+ZoomIn.accelerator = ctrl I
ZoomOut.type = ITEM
ZoomOut.text = Zoom Out
ZoomOut.icon = resources/zoomout.gif
ZoomOut.mnemonic = O
ZoomOut.action = ZoomOutAction
-ZoomOut.accelerator = Ctrl+O
+ZoomOut.accelerator = ctrl O
UseStylesheet = DefaultStylesheet
UseStylesheet.type = MENU
@@ -243,28 +243,28 @@
PreviousTransform.icon = resources/blank.gif
PreviousTransform.mnemonic = P
PreviousTransform.action = PreviousTransformAction
-PreviousTransform.accelerator = Ctrl+K
+PreviousTransform.accelerator = ctrl K
NextTransform.type = ITEM
NextTransform.text = Next Transform
NextTransform.icon = resources/blank.gif
NextTransform.mnemonic = N
NextTransform.action = NextTransformAction
-NextTransform.accelerator = Ctrl+L
+NextTransform.accelerator = ctrl L
SetTransform.type = ITEM
SetTransform.text = Transform...
SetTransform.icon = resources/blank.gif
SetTransform.mnemonic = S
SetTransform.action = SetTransformAction
-SetTransform.accelerator = Ctrl+E
+SetTransform.accelerator = ctrl E
ViewSource.type = ITEM
ViewSource.text = View Source...
ViewSource.icon = resources/source.gif
ViewSource.mnemonic = V
ViewSource.action = ViewSourceAction
-ViewSource.accelerator = Ctrl+U
+ViewSource.accelerator = ctrl U
# Processing menu ################
@@ -278,14 +278,14 @@
Play.icon = resources/play.gif
Play.mnemonic = P
Play.action = PlayAction
-Play.accelerator = Ctrl+H
+Play.accelerator = ctrl H
Pause.type = ITEM
Pause.text = Pause
Pause.icon = resources/pause.gif
Pause.mnemonic = A
Pause.action = PauseAction
-Pause.accelerator = Ctrl+J
+Pause.accelerator = ctrl J
Stop.type = ITEM
Stop.text = Stop
@@ -305,14 +305,14 @@
Back.icon = resources/back.gif
Back.mnemonic = B
Back.action = BackAction
-Back.accelerator = Ctrl+Left
+Back.accelerator = ctrl LEFT
Forward.type = ITEM
Forward.text = Forward
Forward.icon = resources/forward.gif
Forward.mnemonic = F
Forward.action = ForwardAction
-Forward.accelerator = Ctrl+Right
+Forward.accelerator = ctrl RIGHT
HistoryMarker.type = ITEM
HistoryMarker.text = @@@
@@ -329,14 +329,14 @@
Monitor.icon = resources/monitor.gif
Monitor.mnemonic = M
Monitor.action = MonitorAction
-Monitor.accelerator = Ctrl+M
+Monitor.accelerator = ctrl M
DOMViewer.type = ITEM
DOMViewer.text = DOM Viewer...
DOMViewer.icon = resources/domtree.gif
DOMViewer.mnemonic = D
DOMViewer.action = DOMViewerAction
-DOMViewer.accelerator = Ctrl+D
+DOMViewer.accelerator = ctrl D
ScriptDebugger.type = ITEM
ScriptDebugger.text = Script Debugger...
@@ -354,7 +354,7 @@
About.text = About Batik ...
About.mnemonic = A
About.action = AboutAction
-About.accelerator = Ctrl+Shift+A
+About.accelerator = ctrl shift A
#
No revision
No revision
1.7.2.1 +3 -110
xml-batik/sources/org/apache/batik/util/gui/resource/MenuFactory.java
Index: MenuFactory.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/util/gui/resource/MenuFactory.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- MenuFactory.java 18 Aug 2004 07:15:56 -0000 1.7
+++ MenuFactory.java 10 Mar 2005 09:35:44 -0000 1.7.2.1
@@ -57,8 +57,7 @@
* Menu1.enabled = true | false
* ...
* mnemonic is a single character
- * accelerator is of the form: mod+mod+...+X
- * where mod is Shift, Meta, Alt or Ctrl
+ * accelerator is of the form described in [EMAIL PROTECTED]
javax.swing.KeyStroke#getKeyStroke(String)}.
* '-' represents a separator
* </pre>
* All entries are optional except the '.type' entry
@@ -341,7 +340,7 @@
try {
if (!(item instanceof JMenu)) {
String str = getString(name+ACCELERATOR_SUFFIX);
- KeyStroke ks = toKeyStroke(str);
+ KeyStroke ks = KeyStroke.getKeyStroke(str);
if (ks != null) {
item.setAccelerator(ks);
} else {
@@ -360,110 +359,4 @@
} catch (MissingResourceException e) {
}
}
-
- /**
- * Translate a string into a key stroke.
- * See the class comment for details
- * @param str a string
- */
- protected KeyStroke toKeyStroke(String str) {
- int state = 0;
- int code = 0;
- int modif = 0;
- int i = 0;
-
- while (state != 100 && i < str.length()) {
- char curr = Character.toUpperCase(str.charAt(i));
-
- switch (state) {
- case 0 :
- code = curr;
- switch (curr) {
- case 'C': state = 1; break;
- case 'A': state = 5; break;
- case 'M': state = 8; break;
- case 'S': state = 12; break;
- default:
- state = 100;
- }
- break;
-
- case 1 : state = (curr == 'T') ? 2 : 100; break;
- case 2 : state = (curr == 'R') ? 3 : 100; break;
- case 3 : state = (curr == 'L') ? 4 : 100; break;
- case 4 : state = (curr == '+') ? 0 : 100;
- if (state == 0) {
- modif |= Event.CTRL_MASK;
- }
- break;
- case 5 : state = (curr == 'L') ? 6 : 100; break;
- case 6 : state = (curr == 'T') ? 7 : 100; break;
- case 7 : state = (curr == '+') ? 0 : 100;
- if (state == 0) {
- modif |= Event.ALT_MASK;
- }
- break;
- case 8 : state = (curr == 'E') ? 9 : 100; break;
- case 9 : state = (curr == 'T') ? 10: 100; break;
- case 10: state = (curr == 'A') ? 11: 100; break;
- case 11: state = (curr == '+') ? 0 : 100;
- if (state == 0) {
- modif |= Event.META_MASK;
- }
- break;
- case 12: state = (curr == 'H') ? 13: 100; break;
- case 13: state = (curr == 'I') ? 14: 100; break;
- case 14: state = (curr == 'F') ? 15: 100; break;
- case 15: state = (curr == 'T') ? 16: 100; break;
- case 16: state = (curr == '+') ? 0 : 100;
- if (state == 0) {
- modif |= Event.SHIFT_MASK;
- }
- break;
- }
- i++;
- }
- if (code > 0 && modif > 0) {
- if (i < str.length()) {
- char curr = Character.toUpperCase(str.charAt(i));
- switch (code) {
- case 'U':
- if (str.length() - i != 1 || curr != 'P') {
- break;
- }
- code = KeyEvent.VK_UP;
- break;
- case 'L':
- if (str.length() - i != 3 ||
- curr != 'E' ||
- Character.toUpperCase(str.charAt(i + 1)) != 'F' ||
- Character.toUpperCase(str.charAt(i + 2)) != 'T') {
- break;
- }
- code = KeyEvent.VK_LEFT;
- break;
- case 'D':
- if (str.length() - i != 3 ||
- curr != 'O' ||
- Character.toUpperCase(str.charAt(i + 1)) != 'W' ||
- Character.toUpperCase(str.charAt(i + 2)) != 'N') {
- break;
- }
- code = KeyEvent.VK_DOWN;
- break;
- case 'R':
- if (str.length() - i != 4 ||
- curr != 'I' ||
- Character.toUpperCase(str.charAt(i + 1)) != 'G' ||
- Character.toUpperCase(str.charAt(i + 2)) != 'H' ||
- Character.toUpperCase(str.charAt(i + 3)) != 'T') {
- break;
- }
- code = KeyEvent.VK_RIGHT;
- }
- }
- return KeyStroke.getKeyStroke(code, modif);
- }
- return null;
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]