Author: matt
Date: 2009-09-17 13:40:02 -0700 (Thu, 17 Sep 2009)
New Revision: 6877
Log:
Starting to allow international (unicode) keystrokes as shortcuts.

Modified:
   branches/branch-1.3/FL/fl_types.h
   branches/branch-1.3/ide/Xcode3.1/FLTK.xcodeproj/project.pbxproj
   branches/branch-1.3/test/menubar.cxx
   branches/branch-1.3/test/utf8.cxx

Modified: branches/branch-1.3/FL/fl_types.h
===================================================================
--- branches/branch-1.3/FL/fl_types.h   2009-09-17 20:00:33 UTC (rev 6876)
+++ branches/branch-1.3/FL/fl_types.h   2009-09-17 20:40:02 UTC (rev 6877)
@@ -52,6 +52,9 @@
 typedef const char *Fl_CString;
 
 /** 24-bit Unicode character + 8-bit indicator for keyboard flags */
+typedef unsigned int Fl_Shortcut;
+
+/** 24-bit Unicode character - upper 8-bits are unused */
 typedef unsigned int Fl_Char;
  
 /*...@}*/      /* group: Miscellaneous */

Modified: branches/branch-1.3/ide/Xcode3.1/FLTK.xcodeproj/project.pbxproj
===================================================================
--- branches/branch-1.3/ide/Xcode3.1/FLTK.xcodeproj/project.pbxproj     
2009-09-17 20:00:33 UTC (rev 6876)
+++ branches/branch-1.3/ide/Xcode3.1/FLTK.xcodeproj/project.pbxproj     
2009-09-17 20:40:02 UTC (rev 6877)
@@ -3928,9 +3928,9 @@
                C9A3E9590DD6338B00486E4F /* Library Sources */ = {
                        isa = PBXGroup;
                        children = (
+                               C9A3EAD80DD634CC00486E4F /* Fl_get_key_mac.cxx 
*/,
+                               C9A3EAD70DD634CC00486E4F /* 
Fl_get_key_win32.cxx */,
                                C9A3EAD60DD634CC00486E4F /* 
Fl_get_system_colors.cxx */,
-                               C9A3EAD70DD634CC00486E4F /* 
Fl_get_key_win32.cxx */,
-                               C9A3EAD80DD634CC00486E4F /* Fl_get_key_mac.cxx 
*/,
                                C9A3EAD90DD634CC00486E4F /* Fl_get_key.cxx */,
                                C9A3EADA0DD634CC00486E4F /* fl_font_xft.cxx */,
                                C9A3EADB0DD634CC00486E4F /* fl_font_x.cxx */,

Modified: branches/branch-1.3/test/menubar.cxx
===================================================================
--- branches/branch-1.3/test/menubar.cxx        2009-09-17 20:00:33 UTC (rev 
6876)
+++ branches/branch-1.3/test/menubar.cxx        2009-09-17 20:40:02 UTC (rev 
6877)
@@ -141,6 +141,16 @@
     {"Shadow", 0, 0, 0, 0, FL_SHADOW_LABEL},
     {"@->",    0, 0, 0, 0, FL_SYMBOL_LABEL},
     {0},
+  {"&International",0,0,0,FL_SUBMENU},
+    {"Sharp Ess",0x0000df},
+    {"A Umlaut",0x0000c4},
+    {"a Umlaut",0x0000e4},
+    {"Euro currency",0x0020ac},
+    {"the &ü Umlaut"},
+    {"the capital &Ü"},
+    {"convert ¥ to &£"},
+    {"convert £ to &¥"},
+    {0},
   {"E&mpty",0,0,0,FL_SUBMENU},
     {0},
   {"&Inactive", 0,     0, 0, FL_MENU_INACTIVE|FL_SUBMENU},
@@ -167,7 +177,7 @@
   {0}
 };
 
-#define WIDTH 600
+#define WIDTH 700
 
 Fl_Menu_* menus[4];
 

Modified: branches/branch-1.3/test/utf8.cxx
===================================================================
--- branches/branch-1.3/test/utf8.cxx   2009-09-17 20:00:33 UTC (rev 6876)
+++ branches/branch-1.3/test/utf8.cxx   2009-09-17 20:40:02 UTC (rev 6877)
@@ -490,9 +490,10 @@
       case FL_DND_RELEASE: return 1;
       case FL_PASTE:
         {
+          static const char lut[] = "0123456789abcdef";
           const char *t = Fl::event_text();
           int i, n;
-          fl_utf8decode(t, t+Fl::event_length(), &n);
+          unsigned int ucode = fl_utf8decode(t, t+Fl::event_length(), &n);
           if (n==0) {
             value("");
             return 1;
@@ -501,10 +502,15 @@
           for (i=0; i<n; i++) *d++ = t[i];
           *d++ = ' ';
           for (i=0; i<n; i++) {
-            const char lut[] = "0123456789abcdef";
             *d++ = '\\'; *d++ = 'x';
             *d++ = lut[(t[i]>>4)&0x0f]; *d++ = lut[t[i]&0x0f];
           }
+          *d++ = ' ';
+          *d++ = '0';
+          *d++ = 'x';
+          *d++ = lut[(ucode>>20)&0x0f]; *d++ = lut[(ucode>>16)&0x0f];
+          *d++ = lut[(ucode>>12)&0x0f]; *d++ = lut[(ucode>>8)&0x0f];
+          *d++ = lut[(ucode>>4)&0x0f]; *d++ = lut[ucode&0x0f];
           *d++ = 0;
           value(buffer);
         }

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to