Patch #1913 2007-03-01 17:29

stahta01

Patch Key Binder plugin for wxW28 with disable_compat26
Download
1913-Patch_Key_Bind.patch (2.2 KB)
Category
Plugin::Refinement
Status
Closed
Close date
2007-03-16 20:46
Assigned to
 
Index: src/plugins/contrib/keybinder/menuutils.cpp
===================================================================
--- src/plugins/contrib/keybinder/menuutils.cpp    (revision 3652)
+++ src/plugins/contrib/keybinder/menuutils.cpp    (working copy)
@@ -187,7 +187,11 @@
     newtext = strLabel+wxT("\t")+GetShortcut(0)->GetStr();
 
     // change the accelerator...but only if it has changed
+#if wxCHECK_VERSION(2, 8, 0)
+    wxAcceleratorEntry* pPrfAccel = wxAcceleratorEntry::Create(newtext);
+#else
     wxAcceleratorEntry* pPrfAccel = wxGetAccelFromString(newtext);
+#endif
     if ( ! pPrfAccel) return;
     if ( pItemAccel
          && ( pItemAccel->GetFlags() == pPrfAccel->GetFlags() )
Index: src/plugins/contrib/keybinder/keybinder.cpp
===================================================================
--- src/plugins/contrib/keybinder/keybinder.cpp    (revision 3652)
+++ src/plugins/contrib/keybinder/keybinder.cpp    (working copy)
@@ -416,11 +416,12 @@
     if (keyName == wxT("ESCAPE"))   return WXK_ESCAPE;
     if (keyName == wxT("SPACE"))    return WXK_SPACE;
     if (keyName == wxT("DELETE"))   return WXK_DELETE;
-
+#if not wxCHECK_VERSION(2, 8, 0)
     if (keyName == wxT("PRIOR"))    return WXK_PRIOR;               //v4.15
     if (keyName == wxT("PgUp"))     return WXK_PRIOR;               //v4.15
     if (keyName == wxT("NEXT"))     return WXK_NEXT;               //v4.15
     if (keyName == wxT("PgDn"))     return WXK_NEXT;               //v4.15
+#endif
     if (keyName == wxT("LEFT"))     return WXK_LEFT ;       //+v0.5
     if (keyName == wxT("UP"))       return WXK_UP;          //+v0.5
     if (keyName == wxT("RIGHT"))    return WXK_RIGHT;       //+v0.5
@@ -438,7 +439,9 @@
     if (keyName == wxT("DOWN (numpad)"))     return WXK_NUMPAD_DOWN;        //+v0.1-
     if (keyName == wxT("HOME (numpad)"))     return WXK_NUMPAD_HOME;        //+v0.1-
     if (keyName == wxT("PAGEUP (numpad)"))   return WXK_NUMPAD_PAGEUP;      //+v0.1-
+#if not wxCHECK_VERSION(2, 8, 0)
     if (keyName == wxT("PgDn (numpad)"))     return WXK_NUMPAD_NEXT;        //+v0.1-
+#endif
     if (keyName == wxT("PAGEDOWN (numpad)")) return WXK_NUMPAD_PAGEDOWN;    //+v0.1-
     if (keyName == wxT("END (numpad)"))      return WXK_NUMPAD_END;         //+v0.1-
     if (keyName == wxT("BEGIN (numpad)"))    return WXK_NUMPAD_BEGIN;       //+v0.1-
stahta01 2007-03-01 17:30

Filename: disable_compat26_keybinder-unix.patch

Purpose: Change Key Binder files to improve support for wxWidgets 2.8 with option disable_compat26.

Problem 1: Depreciated method wxGetAccelFromString was removed.

Reference 1a: wx/utils.h (wxGetAccelFromString)

Reference 1b: wx/accel.h (wxAcceleratorEntry::Create)

Solution 1: Use #if/else/endif block with method wxAcceleratorEntry::Create for wxWidgets 2.8

Problem 2: Constants WXK_PRIOR, WXK_NEXT, WXK_NUMPAD_NEXT removed.

Reference 2: wx/defs.h

Solution 2: Added #if/endif blocks around use of Constants.

pecan 2007-03-09 15:44

Commited SVN 3680