Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/30ca72b32eba20793b2888be35992fdc5dae375b
...commit
http://git.netsurf-browser.org/netsurf.git/commit/30ca72b32eba20793b2888be35992fdc5dae375b
...tree
http://git.netsurf-browser.org/netsurf.git/tree/30ca72b32eba20793b2888be35992fdc5dae375b
The branch, master has been updated
via 30ca72b32eba20793b2888be35992fdc5dae375b (commit)
from b5fd0ae1ed4558b50cb7e3002e8f0c7042a4617d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=30ca72b32eba20793b2888be35992fdc5dae375b
commit 30ca72b32eba20793b2888be35992fdc5dae375b
Author: François Revol <[email protected]>
Commit: François Revol <[email protected]>
haiku: Rework menu accelerator handling
Instead of splitting accel keys from the item string, we go the GTK
way of using a separate Accel-suffixed string id.
diff --git a/frontends/beos/scaffolding.cpp b/frontends/beos/scaffolding.cpp
index 1fe22ff..a79cf91 100644
--- a/frontends/beos/scaffolding.cpp
+++ b/frontends/beos/scaffolding.cpp
@@ -1566,36 +1566,34 @@ static BMenuItem *make_menu_item(const char *name,
BMessage *message, bool enabl
{
BMenuItem *item;
BString label(messages_get(name));
- BString accel;
+ BString accelKey(name);
+ accelKey += "Accel";
+ BString accel(messages_get(accelKey));
+ if (accel == accelKey)
+ accel = "";
uint32 mods = 0;
char key = 0;
// try to understand accelerators
- int32 start = label.IFindLast(" ");
- if (start > 0 && (label.Length() - start > 1)
- && (label.Length() - start < 7)
- && (label[start + 1] == 'F'
- || !strcmp(label.String() + start + 1, "PRINT")
- || label[start + 1] == '\xe2'
- || label[start + 1] == '^')) {
-
- label.MoveInto(accel, start + 1, label.Length());
- // strip the trailing spaces
- while (label[label.Length() - 1] == ' ')
- label.Truncate(label.Length() - 1);
-
+ if (!accel.IsEmpty()) {
if (accel.FindFirst("\xe2\x87\x91") > -1) {
accel.RemoveFirst("\xe2\x87\x91");
mods |= B_SHIFT_KEY;
}
if (accel.FindFirst("^") > -1) {
accel.RemoveFirst("^");
- mods |= B_CONTROL_KEY; // ALT!!!
+ mods |= B_CONTROL_KEY;
}
if (accel.FindFirst("PRINT") > -1) {
accel.RemoveFirst("PRINT");
//mods |= ; // ALT!!!
key = B_PRINT_KEY;
}
+
+ /* replace UTF-8 glyphs (arrows...) with API codes */
+ accel.ReplaceAll("\xE2\x86\x90",
(BString()+=B_LEFT_ARROW).String());
+ accel.ReplaceAll("\xE2\x86\x92",
(BString()+=B_RIGHT_ARROW).String());
+ accel.ReplaceAll("\xE2\x86\x91",
(BString()+=B_UP_ARROW).String());
+
if (accel.Length() > 1 && accel[0] == 'F') { // Function key
int num;
if (sscanf(accel.String(), "F%d", &num) > 0) {
-----------------------------------------------------------------------
Summary of changes:
frontends/beos/scaffolding.cpp | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/frontends/beos/scaffolding.cpp b/frontends/beos/scaffolding.cpp
index 1fe22ff..a79cf91 100644
--- a/frontends/beos/scaffolding.cpp
+++ b/frontends/beos/scaffolding.cpp
@@ -1566,36 +1566,34 @@ static BMenuItem *make_menu_item(const char *name,
BMessage *message, bool enabl
{
BMenuItem *item;
BString label(messages_get(name));
- BString accel;
+ BString accelKey(name);
+ accelKey += "Accel";
+ BString accel(messages_get(accelKey));
+ if (accel == accelKey)
+ accel = "";
uint32 mods = 0;
char key = 0;
// try to understand accelerators
- int32 start = label.IFindLast(" ");
- if (start > 0 && (label.Length() - start > 1)
- && (label.Length() - start < 7)
- && (label[start + 1] == 'F'
- || !strcmp(label.String() + start + 1, "PRINT")
- || label[start + 1] == '\xe2'
- || label[start + 1] == '^')) {
-
- label.MoveInto(accel, start + 1, label.Length());
- // strip the trailing spaces
- while (label[label.Length() - 1] == ' ')
- label.Truncate(label.Length() - 1);
-
+ if (!accel.IsEmpty()) {
if (accel.FindFirst("\xe2\x87\x91") > -1) {
accel.RemoveFirst("\xe2\x87\x91");
mods |= B_SHIFT_KEY;
}
if (accel.FindFirst("^") > -1) {
accel.RemoveFirst("^");
- mods |= B_CONTROL_KEY; // ALT!!!
+ mods |= B_CONTROL_KEY;
}
if (accel.FindFirst("PRINT") > -1) {
accel.RemoveFirst("PRINT");
//mods |= ; // ALT!!!
key = B_PRINT_KEY;
}
+
+ /* replace UTF-8 glyphs (arrows...) with API codes */
+ accel.ReplaceAll("\xE2\x86\x90",
(BString()+=B_LEFT_ARROW).String());
+ accel.ReplaceAll("\xE2\x86\x92",
(BString()+=B_RIGHT_ARROW).String());
+ accel.ReplaceAll("\xE2\x86\x91",
(BString()+=B_UP_ARROW).String());
+
if (accel.Length() > 1 && accel[0] == 'F') { // Function key
int num;
if (sscanf(accel.String(), "F%d", &num) > 0) {
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org