diff --git a/fldigi_doxygen/user_src_docs/Doxyfile b/fldigi_doxygen/user_src_docs/Doxyfile index 756bbcc3..3a4f9007 100644 --- a/fldigi_doxygen/user_src_docs/Doxyfile +++ b/fldigi_doxygen/user_src_docs/Doxyfile @@ -63,7 +63,8 @@ INPUT = index.txt \ Multiples.txt Notifier.txt OperatingControls.txt RST-RSQ.txt \ Spotter.txt Synop.txt TransceiverControl.txt UTF8.txt \ pskmail_config.txt PskViewer.txt DXCC_list.txt \ - KeyboardAndKeys.txt KML.txt support_data.txt Installing.txt WindowsOS.txt \ + KeyboardAndKeys.txt xchar.txt \ + KML.txt support_data.txt Installing.txt WindowsOS.txt \ Wizard.txt Menus.txt ModeTable.txt CWkeying.txt \ PseudoFSK.txt w5zit-interface.txt rigxml.txt commandline.txt \ buildinfo.txt xmlrpc-control.txt parseUALR.txt ualr-telnet.txt \ diff --git a/fldigi_doxygen/user_src_docs/KeyboardAndKeys.txt b/fldigi_doxygen/user_src_docs/KeyboardAndKeys.txt index 2b84a86c..2527b8e9 100644 --- a/fldigi_doxygen/user_src_docs/KeyboardAndKeys.txt +++ b/fldigi_doxygen/user_src_docs/KeyboardAndKeys.txt @@ -94,9 +94,13 @@ fldigi text widget supports some short cuts to make your life easier: character following the last one transmitted. CW operation is slightly different, see the help for \ref cw_page . -
  • Ctrl + three digits will insert the ASCII character designated by - that entry.
  • - +
  • Extended UTF-8 characters can be entered into all text entry controls + using Ctrl + three digits. These characters can also be entered using + the right-click pop-up menu item \"Spec Char \". The extended character + transmitted by fldigi will actually be a 2 byte UTF-8 string. + + see \ref xchar_page "Extended Characters" +
  • \section function_keys Function Keys diff --git a/fldigi_doxygen/user_src_docs/fldigi_operating.txt b/fldigi_doxygen/user_src_docs/fldigi_operating.txt index 2e53909e..4effd73e 100644 --- a/fldigi_doxygen/user_src_docs/fldigi_operating.txt +++ b/fldigi_doxygen/user_src_docs/fldigi_operating.txt @@ -10,6 +10,7 @@
  • \subpage fft_scan_page
  • \subpage frequency_analyzer_page
  • \subpage keyboard_operation_page
  • +
  • \subpage xchar_page
  • \subpage kml_page
  • \subpage menus_page
  • \subpage mouse_and_keyboard_shortcuts_page
  • diff --git a/fldigi_doxygen/user_src_docs/index_order.txt b/fldigi_doxygen/user_src_docs/index_order.txt index da9d19aa..21adf252 100644 --- a/fldigi_doxygen/user_src_docs/index_order.txt +++ b/fldigi_doxygen/user_src_docs/index_order.txt @@ -19,7 +19,7 @@ DigiscopeDisplay.txt DigiWWV.txt map.txt MousingKeyboardShortcuts.txt \ Multiples.txt Notifier.txt OperatingControls.txt RST-RSQ.txt \ Spotter.txt Synop.txt TransceiverControl.txt UTF8.txt \ pskmail_config.txt PskViewer.txt DXCC_list.txt \ -KeyboardAndKeys.txt KML.txt Installing.txt WindowsOS.txt \ +KeyboardAndKeys.txt xchar.txt KML.txt Installing.txt WindowsOS.txt \ Wizard.txt Menus.txt ModeTable.txt CWkeying.txt PseudoFSK.txt \ w5zit-interface.txt rigxml.txt commandline.txt \ buildinfo.txt xmlrpc-control.txt parseUALR.txt ualr-telnet.txt \ diff --git a/fldigi_doxygen/user_src_docs/xchar.txt b/fldigi_doxygen/user_src_docs/xchar.txt new file mode 100644 index 00000000..e4c87e94 --- /dev/null +++ b/fldigi_doxygen/user_src_docs/xchar.txt @@ -0,0 +1,67 @@ +/** +\page xchar_page Extended Characters + +Extended UTF-8 characters can be entered into all text entry controls +using Ctrl + three digits. These characters can also be entered using +the right-click pop-up menu item \"Spec Char \". The extended character +transmitted by fldigi will actually be a 2 byte UTF-8 string. + +
    +Extended character set +
    +
    +- |- |- |- |- |- |- |- +:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----: + 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 + iexcl | cent | pound | curren| yen | brvbar| sect | uml + ¡ | ¢ | £ | ¤ | ¥ | ¦ | § | ¨ +- |- |- |- |- |- |- |- + 169 | 170 | 171 | 172 | 173 | 174 | 176 | 177 + copy | ordf | laquo | not | shy | reg | macr | deg + © | ª | « | ¬ | | ® | ¯ | ° +- |- |- |- |- |- |- |- + 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 +plusmn | sup2 | sup3 | acute | micro | para | midot | cedil + ± | ² | ³ | ´ | µ | ¶ | · | ¸ +- |- |- |- |- |- |- |- + 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 + sup1 | ordm | raquo |frac14 |frac12 |frac34 |iquest |Agrave + ¹ | º | » | ¼ | ½ | ¾ | ¿ | À +- |- |- |- |- |- |- |- + 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 + Acute | Acirc |Atilde | Auml | Aring | AElig |Ccedil |Egrave + Á | Â | Ã | Ä | Å | Æ | Ç | È +- |- |- |- |- |- |- |- + 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 +Eacute | Ecirc | Euml |Igrave |Iacute | Icirc | Iuml | ETH + É | Ê | Ë | Ì | Í | Î | Ï | Ð +- |- |- |- |- |- |- |- + 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 +Ntilde |Ograve |Oacute |Ocirc |Otilde | Ouml | times |Oslash + Ñ | Ò | Ó | Ô | Õ | Ö | × | Ø +- |- |- |- |- |- |- |- + 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 +Ugrave |Uacute | Ucirc | Uuml |Yacute | THORN | szlig |agrave + Ù | Ú | Û | Ü | Ý | Þ | ß | à +- |- |- |- |- |- |- |- + 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 +aacute | acirc |atilde | auml | aring | aelig |ccedil |egrave + á | â | ã | ä | å | æ | ç | è +- |- |- |- |- |- |- |- + 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 +eacute |ecirc | euml |igrave |iacute | icirc | iuml | eth + é | ê | ë | ì | í | î | ï | ð +- |- |- |- |- |- |- |- + 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 +ntilde |ograve |oacute | ocirc |otilde | ouml |divide |oslash + ñ | ò | ó | ô | õ | ö | ÷ | ø +- |- |- |- |- |- |- |- + 249 | 250 | 251 | 252 | 253 | 254 | 255 | - +ugrave |uacute | ucirc | uuml |yacute | thorn | yuml | - + ù | ú | û | ü | ý | þ | ÿ | - +
    + +\ref xchar_page "Return to Top of Page" +
    +\ref main_page "Return to Main Page" +*/ diff --git a/src/include/flinput2.h b/src/include/flinput2.h index 9e2234c4..f68fb733 100644 --- a/src/include/flinput2.h +++ b/src/include/flinput2.h @@ -25,6 +25,13 @@ class Fl_Input2 : public Fl_Input { +private: + int ascii_cnt; // restart the numeric keypad entries. + int ascii_chr; // character value of ASCII > 0x80 + int handle_key_ascii(int key); + char *utf8text; + int utf8cnt; + public: Fl_Input2(int x, int y, int w, int h, const char* l = 0); int handle(int event); diff --git a/src/misc/macros.cxx b/src/misc/macros.cxx index b8c4709c..8e3cdf59 100644 --- a/src/misc/macros.cxx +++ b/src/misc/macros.cxx @@ -3085,21 +3085,22 @@ bool queue_must_rx() // occurs immediately after the ^r execution // AND after TX_STATE returns to Rx // ^r is the control string substitute for the macro tag -void Rx_queue_execute() +int time_out = 400; +void Rx_queue_execution(void *) { - if (Rx_cmds.empty()) return; - - int time_out = 100; // force return after ten seconds - while (trx_state != STATE_RX && time_out) { - time_out--; - Fl::awake(); - MilliSleep(100); - } - if (!time_out) { - while (!Rx_cmds.empty()) Rx_cmds.pop(); + if (trx_state != STATE_RX) { + if (time_out-- == 0) { + while (!Rx_cmds.empty()) Rx_cmds.pop(); + LOG_ERROR("%s", "failed"); + time_out = 200; + return; + } + Fl::repeat_timeout( .050, Rx_queue_execution ); return; } + LOG_INFO("action delayed by %4.2f seconds", (400 - time_out)*.050); + time_out = 400; CMDS cmd; while (!Rx_cmds.empty()) { cmd = Rx_cmds.front(); @@ -3109,11 +3110,18 @@ void Rx_queue_execute() cmd.cmd.erase(0,2); cmd.cmd.insert(0,"DataInterleave; i++) { diff --git a/src/rigcontrol/xmlrpc_rig.cxx b/src/rigcontrol/xmlrpc_rig.cxx index 3403e844..ca70a842 100644 --- a/src/rigcontrol/xmlrpc_rig.cxx +++ b/src/rigcontrol/xmlrpc_rig.cxx @@ -122,46 +122,53 @@ bool wait_ptt = false; // wait for transceiver to respond int wait_ptt_timeout = 5; // 5 polls and then disable wait int ptt_state = 0; -void set_flrig_ptt(int on) { - if (!connected_to_flrig) return; +int new_ptt = -1; + +void exec_flrig_ptt() { + if (!connected_to_flrig) { + new_ptt = -1; + return; + } XmlRpcValue val, result; int resp, res; - val = int(on); - guard_lock flrig_lock(&mutex_flrig); // PTT on/off is critical 5 attempts with 10 verify reads per attempt for (int i = 0; i < 5; i++) { - res = flrig_client->execute("rig.set_ptt", val, result, timeout); + res = flrig_client->execute("rig.set_ptt", new_ptt, result, timeout); if (res) { for (int j = 0; j < 10; j++) { MilliSleep(20); - Fl::awake(); res = flrig_client->execute("rig.get_ptt", XmlRpcValue(), result, 10); if (res) { resp = (int)result; - if (resp == on) { + if (resp == new_ptt) { wait_ptt = true; wait_ptt_timeout = 10; - ptt_state = on; + ptt_state = new_ptt; LOG_INFO("ptt %s in %d msec", - on ? "ON" : "OFF", + ptt_state ? "ON" : "OFF", i*50 + (j + 1)*20); + new_ptt = -1; return; } } } } - MilliSleep(50); - Fl::awake(); } wait_ptt = false; wait_ptt_timeout = 0; LOG_ERROR("%s", "rig.set_ptt failed (3)"); - fl_alert2("fldigi/flrig PTT %s failure", on ? "ON" : "OFF"); + fl_alert2("fldigi/flrig PTT %s failure", new_ptt ? "ON" : "OFF"); + new_ptt = -1; return; } +void set_flrig_ptt(int on) { + guard_lock flrig_lock(&mutex_flrig); + new_ptt = on; +} + pthread_mutex_t mutex_flrig_ptt = PTHREAD_MUTEX_INITIALIZER; void xmlrpc_rig_show_ptt(void *data) @@ -858,7 +865,7 @@ void flrig_connection() flrig_get_xcvr(); Fl::awake(flrig_setQSY); } else { - LOG_INFO("%s", "Waiting for flrig"); + LOG_VERBOSE("%s", "Waiting for flrig"); connected_to_flrig = false; poll_interval = 5000; } @@ -900,6 +907,10 @@ void * flrig_thread_loop(void *d) connect_to_flrig(); if (!connected_to_flrig) flrig_connection(); else if (flrig_get_xcvr()) { + if (new_ptt > -1) { + exec_flrig_ptt(); + continue; + } flrig_get_ptt(); if (trx_state == STATE_RX) { flrig_get_frequency(); diff --git a/src/widgets/FTextRXTX.cxx b/src/widgets/FTextRXTX.cxx index b74d523f..373f4366 100644 --- a/src/widgets/FTextRXTX.cxx +++ b/src/widgets/FTextRXTX.cxx @@ -772,6 +772,92 @@ Fl_Menu_Item FTextTX::menu[] = { { 0 }, // EDIT_MENU_READ { 0 }, // EDIT_MENU_WRAP + { _("Spec Char"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "¢ - cent", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "£ - pound", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "µ - micro", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "° - degree", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "¿ - iques", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "× - times", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "÷ - divide", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { _("A"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "À - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "à - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Á - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "á - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Â - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "â - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ã - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ã - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ä - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ä - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Å - ring", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "å - ring", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Æ - aelig", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "æ - aelig", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("E"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "È - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "è - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "É - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "é - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ê - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ê - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ë - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ë - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("I"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ì - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ì - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Í - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "í - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Î - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "î - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ï - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ï - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("N"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ñ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ñ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("O"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ò - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ò - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ó - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ó - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ô - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ô - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Õ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "õ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ö - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ö - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ø - slash", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ø - slash", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("U"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ù - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ù - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ú - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ú - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Û - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "û - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ü - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ü - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("Y"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ý - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ý - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ÿ - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("Other"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "ß - szlig", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ç - cedil", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ç - cedil", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ð - eth", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ð - eth", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Þ - thorn", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0}, { 0 } }; @@ -1310,6 +1396,9 @@ void FTextTX::menu_cb(size_t item) case TX_MENU_WRAP: set_word_wrap(!wrap, true); break; + default: + if (FTextTX::menu[item].flags == 0) // not an FL_SUB_MENU + add(FTextTX::menu[item].text[0]); add(FTextTX::menu[item].text[1]); } } diff --git a/src/widgets/flinput2.cxx b/src/widgets/flinput2.cxx index 35cf9135..94f125e7 100644 --- a/src/widgets/flinput2.cxx +++ b/src/widgets/flinput2.cxx @@ -34,6 +34,7 @@ #include "icons.h" #include "flinput2.h" #include "gettext.h" +#include "debug.h" enum { OP_UNDO, OP_CUT, OP_COPY, OP_PASTE, OP_DELETE, OP_CLEAR, OP_SELECT_ALL }; @@ -46,11 +47,96 @@ static Fl_Menu_Item cmenu[] = { { icons::make_icon_label(_("Delete"), trash_icon), 0, 0, 0, 0, _FL_MULTI_LABEL }, { icons::make_icon_label(_("Clear"), edit_clear_icon), 0, 0, 0, FL_MENU_DIVIDER, _FL_MULTI_LABEL }, { icons::make_icon_label(_("Select All"), edit_select_all_icon), 0, 0, 0, 0, _FL_MULTI_LABEL }, - { 0 } + { _("Spec Char"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "¢ - cent", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "£ - pound", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "µ - micro", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "° - degree", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "¿ - iques", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "× - times", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "÷ - divide", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { _("A"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "À - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "à - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Á - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "á - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Â - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "â - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ã - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ã - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ä - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ä - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Å - ring", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "å - ring", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Æ - aelig", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "æ - aelig", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("E"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "È - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "è - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "É - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "é - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ê - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ê - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ë - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ë - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("I"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ì - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ì - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Í - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "í - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Î - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "î - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ï - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ï - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("N"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ñ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ñ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("O"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ò - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ò - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ó - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ó - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ô - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ô - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Õ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "õ - tilde", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ö - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ö - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ø - slash", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ø - slash", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("U"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ù - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ù - grave", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ú - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ú - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Û - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "û - circ", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ü - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ü - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("Y"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "Ý - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ý - acute", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ÿ - umlaut", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + { _("Other"), 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL }, + { "ß - szlig", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ç - cedil", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ç - cedil", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Ð - eth", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "ð - eth", 0, 0, 0, 0, FL_NORMAL_LABEL }, + { "Þ - thorn", 0, 0, 0, 0, FL_NORMAL_LABEL }, + {0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0}, + {0,0,0,0,0,0,0,0,0} }; static bool cmenu_init = false; - Fl_Input2::Fl_Input2(int x, int y, int w, int h, const char* l) : Fl_Input(x, y, w, h, l) { @@ -60,13 +146,60 @@ Fl_Input2::Fl_Input2(int x, int y, int w, int h, const char* l) icons::set_icon_label(&cmenu[i]); cmenu_init = true; } + ascii_cnt = 0; // restart the numeric keypad entries. + ascii_chr = 0; + utf8text = NULL; } +//---------------------------------------------------------------------- +/// Composes ascii characters and adds them to the Fl_Input2 buffer. +/// Control characters are inserted with the CTRL style. Values larger than 127 +/// (0x7f) are ignored. We cannot really add NULs for the time being. +/// +/// @param key A digit character +/// +/// @return 1 +/// +int Fl_Input2::handle_key_ascii(int key) +{ + if (key >= FL_KP) key -= FL_KP; + key -= '0'; + ascii_cnt++; + ascii_chr *= 10; + ascii_chr += key; + if (ascii_cnt == 3) { + if (ascii_chr < 0x100) { + utf8text = new char[fl_utf8bytes(ascii_chr) + 1]; + utf8cnt = fl_utf8encode(ascii_chr, utf8text); + return 1; + } + ascii_cnt = ascii_chr = 0; + } + + return 0; +} + +//---------------------------------------------------------------------- int Fl_Input2::handle(int event) { switch (event) { case FL_KEYBOARD: { int b = Fl::event_key(); + + if ((Fl::event_state() & FL_CTRL) && (isdigit(b) || isdigit(b - FL_KP))) { + if (handle_key_ascii(b)) { + if (utf8text) { + insert(utf8text, utf8cnt); + delete utf8text; + } + ascii_cnt = 0; + ascii_chr = 0; + } + return 1; + } + ascii_cnt = 0; + ascii_chr = 0; + int p = position(); // stop the move-to-next-field madness, we have Tab for that! if (unlikely((b == FL_Left && p == 0) || (b == FL_Right && p == size()) || @@ -176,6 +309,8 @@ int Fl_Input2::handle(int event) case OP_SELECT_ALL: position(0, size()); break; + default: + insert(m->text, 1); } return 1;