* correct WF hesitation when processing post Tx macros
  * remove xmlrpc_rig ptt transition waiting from main loop
  * correct WF hesitation when transmitting MT63 start tones
  * added CTRL-nnn numeric sequence character entry to Fl_Input2
    class.  Allows direct entry of characters such as ñ in
    QSO fields, macro editor, etc.
  * added new menu items to FTextEdit and Fl_Input2 widgets
    - allow user to select UTF-8 special characters from
      pop-up menu (right click in widget).  This effects
      TX text widgets and all data entry controls which use
      the Fl_Input2 widget.
pull/4/head
David Freese 2015-12-07 11:37:27 -06:00
rodzic 78baf6cde3
commit e9e8b36506
11 zmienionych plików z 359 dodań i 35 usunięć

Wyświetl plik

@ -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 \

Wyświetl plik

@ -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 .</li>
<li>Ctrl + three digits will insert the ASCII character designated by
that entry.</li>
<li>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"
</li>
</ul>
\section function_keys Function Keys

Wyświetl plik

@ -10,6 +10,7 @@
<li> \subpage fft_scan_page </li>
<li> \subpage frequency_analyzer_page </li>
<li> \subpage keyboard_operation_page </li>
<li> \subpage xchar_page </li>
<li> \subpage kml_page </li>
<li> \subpage menus_page </li>
<li> \subpage mouse_and_keyboard_shortcuts_page </li>

Wyświetl plik

@ -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 \

Wyświetl plik

@ -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.
<center>
<b>Extended character set</b>
</center>
<center>
- |- |- |- |- |- |- |-
:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:|:-----:
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 | -
ù | ú | û | ü | ý | þ | ÿ | -
</center>
\ref xchar_page "Return to Top of Page"
<br>
\ref main_page "Return to Main Page"
*/

Wyświetl plik

@ -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);

Wyświetl plik

@ -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 <RX> 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,"<!");
cmd.fp(cmd.cmd);
Fl::awake();
if (macro_rx_wait) return;
}
return;
}
void Rx_queue_execute()
{
if (Rx_cmds.empty()) return;
Fl::add_timeout(0, Rx_queue_execution);
}
void rx_que_continue(void *)
{
macro_rx_wait = false;

Wyświetl plik

@ -76,9 +76,10 @@ int mt63::tx_process()
double w2 = 2.0 * M_PI * (get_txfreq_woffset() + 31.0 * bandwidth / 64.0) / samplerate;
double phi1 = 0.0;
double phi2 = 0.0;
double buff[samplerate];
for (int i = 0; i < progdefaults.mt63_tone_duration; i++) {
for (int j = 0; j < samplerate; j++) {
double buff[512];
int numsmpls = samplerate * progdefaults.mt63_tone_duration / 512;
for (int i = 0; i < numsmpls; i++) {
for (int j = 0; j < 512; j++) {
buff[j] = TONE_AMP * (progdefaults.mt63_twotones ? 0.5 : 1.0) * cos(phi1) +
TONE_AMP * (progdefaults.mt63_twotones ? 0.5 : 0.0) * cos(phi2);
phi1 += w1;
@ -88,7 +89,7 @@ int mt63::tx_process()
buff[j] *= (1.0 - exp(-1.0 * (samplerate - j) / 40.0));
}
Fl::awake();
ModulateXmtr(buff, samplerate);
ModulateXmtr(buff, 512);
}
}
for (int i = 0; i < Tx->DataInterleave; i++) {

Wyświetl plik

@ -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();

Wyświetl plik

@ -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]);
}
}

Wyświetl plik

@ -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;