Add option to specify non-word characters

These characters delineate words when selecting RX text for QSO data
entry to the log fields. The defaults characters are "*,-.;"; tab and
newline are automatically included.
pull/2/head
David Freese 2010-03-01 06:01:06 -06:00
rodzic 8cea906f79
commit dcbfb7d59d
7 zmienionych plików z 99 dodań i 49 usunięć

Wyświetl plik

@ -132,6 +132,15 @@ static void cb_mnuScheme(Fl_Choice* o, void*) {
progdefaults.changed = true;
}
Fl_Button *bVisibleModes=(Fl_Button *)0;
static void cb_bVisibleModes(Fl_Button* o, void*) {
mode_browser->label(o->label());
mode_browser->callback(toggle_visible_modes);
mode_browser->show(&progdefaults.visible_modes);
progdefaults.changed = true;
}
Fl_Check_Button *btnRXClicks=(Fl_Check_Button *)0;
static void cb_btnRXClicks(Fl_Check_Button* o, void*) {
@ -146,12 +155,10 @@ static void cb_btnRXTooltips(Fl_Check_Button* o, void*) {
progdefaults.changed = true;
}
Fl_Button *bVisibleModes=(Fl_Button *)0;
Fl_Input2 *inpNonword=(Fl_Input2 *)0;
static void cb_bVisibleModes(Fl_Button* o, void*) {
mode_browser->label(o->label());
mode_browser->callback(toggle_visible_modes);
mode_browser->show(&progdefaults.visible_modes);
static void cb_inpNonword(Fl_Input2* o, void*) {
progdefaults.nonwordchars = o->value();
progdefaults.changed = true;
}
@ -2570,51 +2577,72 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
mnuScheme->add("plastic");
mnuScheme->value(mnuScheme->find_item(progdefaults.ui_scheme.c_str()));
} // Fl_Choice* mnuScheme
{ Fl_Check_Button* o = btnRXClicks = new Fl_Check_Button(15, 295, 305, 20, _("Double-click on RX text enters QSO data"));
btnRXClicks->tooltip(_("I like to double click in Rx panel"));
{ bVisibleModes = new Fl_Button(250, 100, 120, 20, _("Visible modes"));
bVisibleModes->callback((Fl_Callback*)cb_bVisibleModes);
} // Fl_Button* bVisibleModes
{ Fl_Group* o = new Fl_Group(9, 277, 481, 80, _("Text Capture"));
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ Fl_Check_Button* o = btnRXClicks = new Fl_Check_Button(125, 314, 305, 20, _("Double-click on RX text enters QSO data"));
btnRXClicks->tooltip(_("Enable if you cannot use the middle mouse button"));
btnRXClicks->down_box(FL_DOWN_BOX);
btnRXClicks->callback((Fl_Callback*)cb_btnRXClicks);
o->value(progdefaults.rxtext_clicks_qso_data);
} // Fl_Check_Button* btnRXClicks
{ Fl_Check_Button* o = btnRXTooltips = new Fl_Check_Button(15, 325, 282, 20, _("Show callsign tooltips in received text"));
} // Fl_Check_Button* btnRXClicks
{ Fl_Check_Button* o = btnRXTooltips = new Fl_Check_Button(125, 336, 282, 20, _("Show callsign tooltips in received text"));
btnRXTooltips->tooltip(_("Popup info after a 2 second hover on a callsign"));
btnRXTooltips->down_box(FL_DOWN_BOX);
btnRXTooltips->callback((Fl_Callback*)cb_btnRXTooltips);
o->value(progdefaults.rxtext_tooltips);
} // Fl_Check_Button* btnRXTooltips
{ bVisibleModes = new Fl_Button(250, 100, 120, 20, _("Visible modes"));
bVisibleModes->callback((Fl_Callback*)cb_bVisibleModes);
} // Fl_Button* bVisibleModes
} // Fl_Check_Button* btnRXTooltips
{ Fl_Input2* o = inpNonword = new Fl_Input2(125, 285, 75, 24, _("Word delimiters"));
inpNonword->tooltip(_("RX text QSO data entry is bounded by the non-word characters\ndefined here. T\
ab and newline are automatically included."));
inpNonword->box(FL_DOWN_BOX);
inpNonword->color((Fl_Color)FL_BACKGROUND2_COLOR);
inpNonword->selection_color((Fl_Color)FL_SELECTION_COLOR);
inpNonword->labeltype(FL_NORMAL_LABEL);
inpNonword->labelfont(0);
inpNonword->labelsize(14);
inpNonword->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
inpNonword->textfont(4);
inpNonword->callback((Fl_Callback*)cb_inpNonword);
inpNonword->align(FL_ALIGN_RIGHT);
inpNonword->when(FL_WHEN_RELEASE);
o->value(progdefaults.nonwordchars.c_str());
o->labelsize(FL_NORMAL_SIZE);
} // Fl_Input2* inpNonword
o->end();
} // Fl_Group* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(15, 130, 470, 160, _("QSO logging"));
{ Fl_Group* o = new Fl_Group(8, 130, 484, 146, _("QSO logging"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ Fl_Check_Button* o = btnNagMe = new Fl_Check_Button(25, 155, 155, 20, _("Prompt to save log"));
{ Fl_Check_Button* o = btnNagMe = new Fl_Check_Button(125, 139, 155, 20, _("Prompt to save log"));
btnNagMe->tooltip(_("Bug me about saving log entries"));
btnNagMe->down_box(FL_DOWN_BOX);
btnNagMe->callback((Fl_Callback*)cb_btnNagMe);
o->value(progdefaults.NagMe);
} // Fl_Check_Button* btnNagMe
{ Fl_Check_Button* o = btnClearOnSave = new Fl_Check_Button(25, 180, 125, 20, _("Clear on save"));
{ Fl_Check_Button* o = btnClearOnSave = new Fl_Check_Button(125, 164, 125, 20, _("Clear on save"));
btnClearOnSave->tooltip(_("Clear log entries after saving or using macro <LOG>"));
btnClearOnSave->down_box(FL_DOWN_BOX);
btnClearOnSave->callback((Fl_Callback*)cb_btnClearOnSave);
o->value(progdefaults.ClearOnSave);
} // Fl_Check_Button* btnClearOnSave
{ Fl_Check_Button* o = btnAutoFillQSO = new Fl_Check_Button(25, 205, 225, 20, _("Auto-fill Country and Azimuth"));
{ Fl_Check_Button* o = btnAutoFillQSO = new Fl_Check_Button(125, 189, 225, 20, _("Auto-fill Country and Azimuth"));
btnAutoFillQSO->tooltip(_("Fill in Country / Azimuth using cty.dat information"));
btnAutoFillQSO->down_box(FL_DOWN_BOX);
btnAutoFillQSO->callback((Fl_Callback*)cb_btnAutoFillQSO);
o->value(progdefaults.autofill_qso_fields);
} // Fl_Check_Button* btnAutoFillQSO
{ Fl_Check_Button* o = btnCallUpperCase = new Fl_Check_Button(25, 230, 282, 20, _("Convert callsign field to upper case"));
{ Fl_Check_Button* o = btnCallUpperCase = new Fl_Check_Button(125, 214, 282, 20, _("Convert callsign field to upper case"));
btnCallUpperCase->tooltip(_("Force callsign field to UPPERCASE"));
btnCallUpperCase->down_box(FL_DOWN_BOX);
btnCallUpperCase->callback((Fl_Callback*)cb_btnCallUpperCase);
o->value(progdefaults.calluppercase);
} // Fl_Check_Button* btnCallUpperCase
{ Fl_Input2* o = inpMyPower = new Fl_Input2(25, 256, 50, 24, _("Transmit Power"));
{ Fl_Input2* o = inpMyPower = new Fl_Input2(125, 240, 50, 24, _("Transmit Power"));
inpMyPower->tooltip(_("Tx power used for logbook entries"));
inpMyPower->box(FL_DOWN_BOX);
inpMyPower->color((Fl_Color)FL_BACKGROUND2_COLOR);

Wyświetl plik

@ -88,7 +88,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
code {} {}
Fl_Window {} {
label {Fldigi configuration} open
xywh {468 111 500 400} type Double color 45 selection_color 51 labelsize 18 align 80 visible
xywh {490 127 500 400} type Double color 45 selection_color 51 labelsize 18 align 80 visible
} {
Fl_Tabs tabsConfigure {open
xywh {-3 0 520 372} color 50 selection_color 50
@ -215,20 +215,6 @@ progdefaults.changed = true;}
code2 {mnuScheme->add("plastic");}
code3 {mnuScheme->value(mnuScheme->find_item(progdefaults.ui_scheme.c_str()));}
} {}
Fl_Check_Button btnRXClicks {
label {Double-click on RX text enters QSO data}
callback {progdefaults.rxtext_clicks_qso_data = o->value();
progdefaults.changed = true;}
tooltip {I like to double click in Rx panel} xywh {15 295 305 20} down_box DOWN_BOX
code0 {o->value(progdefaults.rxtext_clicks_qso_data);}
}
Fl_Check_Button btnRXTooltips {
label {Show callsign tooltips in received text}
callback {progdefaults.rxtext_tooltips = o->value();
progdefaults.changed = true;}
tooltip {Popup info after a 2 second hover on a callsign} xywh {15 325 282 20} down_box DOWN_BOX
code0 {o->value(progdefaults.rxtext_tooltips);}
}
Fl_Button bVisibleModes {
label {Visible modes}
callback {mode_browser->label(o->label());
@ -237,44 +223,73 @@ mode_browser->show(&progdefaults.visible_modes);
progdefaults.changed = true;}
xywh {250 100 120 20}
}
Fl_Group {} {
label {Text Capture} open
xywh {9 277 481 80} align 21
} {
Fl_Check_Button btnRXClicks {
label {Double-click on RX text enters QSO data}
callback {progdefaults.rxtext_clicks_qso_data = o->value();
progdefaults.changed = true;}
tooltip {Enable if you cannot use the middle mouse button} xywh {125 314 305 20} down_box DOWN_BOX
code0 {o->value(progdefaults.rxtext_clicks_qso_data);}
}
Fl_Check_Button btnRXTooltips {
label {Show callsign tooltips in received text}
callback {progdefaults.rxtext_tooltips = o->value();
progdefaults.changed = true;}
tooltip {Popup info after a 2 second hover on a callsign} xywh {125 336 282 20} down_box DOWN_BOX
code0 {o->value(progdefaults.rxtext_tooltips);}
}
Fl_Input inpNonword {
label {Word delimiters}
callback {progdefaults.nonwordchars = o->value();
progdefaults.changed = true;}
tooltip {RX text QSO data entry is bounded by the non-word characters
defined here. Tab and newline are automatically included.} xywh {125 285 75 24} align 8 textfont 4
code0 {o->value(progdefaults.nonwordchars.c_str());}
code1 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Input2
}
}
}
Fl_Group {} {
label {QSO logging} open
xywh {15 130 470 160} box ENGRAVED_FRAME align 21
xywh {8 130 484 146} box ENGRAVED_FRAME align 21
} {
Fl_Check_Button btnNagMe {
label {Prompt to save log}
callback {progdefaults.NagMe=o->value();
progdefaults.changed = true;}
tooltip {Bug me about saving log entries} xywh {25 155 155 20} down_box DOWN_BOX
tooltip {Bug me about saving log entries} xywh {125 139 155 20} down_box DOWN_BOX
code0 {o->value(progdefaults.NagMe);}
}
Fl_Check_Button btnClearOnSave {
label {Clear on save}
callback {progdefaults.ClearOnSave=o->value();
progdefaults.changed = true;}
tooltip {Clear log entries after saving or using macro <LOG>} xywh {25 180 125 20} down_box DOWN_BOX
tooltip {Clear log entries after saving or using macro <LOG>} xywh {125 164 125 20} down_box DOWN_BOX
code0 {o->value(progdefaults.ClearOnSave);}
}
Fl_Check_Button btnAutoFillQSO {
label {Auto-fill Country and Azimuth}
callback {progdefaults.autofill_qso_fields = o->value();
progdefaults.changed = true;}
tooltip {Fill in Country / Azimuth using cty.dat information} xywh {25 205 225 20} down_box DOWN_BOX
tooltip {Fill in Country / Azimuth using cty.dat information} xywh {125 189 225 20} down_box DOWN_BOX
code0 {o->value(progdefaults.autofill_qso_fields);}
}
Fl_Check_Button btnCallUpperCase {
label {Convert callsign field to upper case}
callback {progdefaults.calluppercase = o->value();
progdefaults.changed = true;}
tooltip {Force callsign field to UPPERCASE} xywh {25 230 282 20} down_box DOWN_BOX
tooltip {Force callsign field to UPPERCASE} xywh {125 214 282 20} down_box DOWN_BOX
code0 {o->value(progdefaults.calluppercase);}
}
Fl_Input inpMyPower {
label {Transmit Power}
callback {progdefaults.mytxpower = o->value();
progdefaults.changed = true;}
tooltip {Tx power used for logbook entries} xywh {25 256 50 24} align 8
tooltip {Tx power used for logbook entries} xywh {125 240 50 24} align 8
code0 {o->value(progdefaults.mytxpower.c_str());}
code1 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Input2

Wyświetl plik

@ -81,7 +81,7 @@ protected:
int set = SET_FONT | SET_SIZE | SET_COLOR);
int readFile(const char* fn = 0);
void saveFile(void);
char* get_word(int x, int y, bool ontext = true);
char* get_word(int x, int y, const char* nwchars = "", bool ontext = true);
void init_context_menu(void);
void show_context_menu(void);
virtual void menu_cb(size_t item) { }

Wyświetl plik

@ -34,10 +34,11 @@ extern Fl_Check_Button *btnShowTooltips;
extern Fl_Check_Button *chkMenuIcons;
#include <FL/Fl_Choice.H>
extern Fl_Choice *mnuScheme;
extern Fl_Check_Button *btnRXClicks;
extern Fl_Check_Button *btnRXTooltips;
#include <FL/Fl_Button.H>
extern Fl_Button *bVisibleModes;
extern Fl_Check_Button *btnRXClicks;
extern Fl_Check_Button *btnRXTooltips;
extern Fl_Input2 *inpNonword;
extern Fl_Check_Button *btnNagMe;
extern Fl_Check_Button *btnClearOnSave;
extern Fl_Check_Button *btnAutoFillQSO;

Wyświetl plik

@ -804,6 +804,9 @@
ELEM_(int, ContestDigits, "CONTESTDIGITS", \
"Number of digits in serial number", \
4) \
ELEM_(std::string, nonwordchars, "NONWORDCHARS", \
"Additional characters used to delimit WORDS", \
"*,-.;") \
ELEM_(std::string, myXchg, "MYXCGH", \
"Free form exchange", \
"") \

Wyświetl plik

@ -25,6 +25,7 @@
#include <config.h>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
@ -311,7 +312,7 @@ static fre_t call("([[:alnum:]]?[[:alpha:]/]+[[:digit:]]+[[:alnum:]/]+)", REG_EX
void FTextRX::handle_qso_data(int start, int end)
{
char* s = get_word(start, end);
char* s = get_word(start, end, progdefaults.nonwordchars.c_str());
if (!s)
return;
char* p = s;
@ -476,7 +477,7 @@ void FTextRX::menu_cb(size_t item)
if (!input)
return;
char* s = get_word(popx, popy);
char* s = get_word(popx, popy, progdefaults.nonwordchars.c_str());
if (!s)
return;
@ -494,7 +495,7 @@ void FTextRX::menu_cb(size_t item)
const char* FTextRX::dxcc_lookup_call(int x, int y)
{
char* s = get_word(x - this->x(), y - this->y());
char* s = get_word(x - this->x(), y - this->y(), progdefaults.nonwordchars.c_str());
char* mem = s;
if (!(s && *s && call.match(s))) {
free(s);

Wyświetl plik

@ -330,7 +330,7 @@ void FTextBase::saveFile(void)
///
/// @return The selection, or the word text at (x,y). <b>Must be freed by the caller</b>.
///
char* FTextBase::get_word(int x, int y, bool ontext)
char* FTextBase::get_word(int x, int y, const char* nwchars, bool ontext)
{
int p = xy_to_position(x + this->x(), y + this->y(), Fl_Text_Display_mod::CURSOR_POS);
int start, end;
@ -342,11 +342,13 @@ char* FTextBase::get_word(int x, int y, bool ontext)
return tbuf->selection_text();
}
if (!tbuf->findchars_backward(p, " \t\n", &start))
string nonword = nwchars;
nonword.append(" \t\n");
if (!tbuf->findchars_backward(p, nonword.c_str(), &start))
start = 0;
else
start++;
if (!tbuf->findchars_forward(p, " .,;|\t\n", &end))
if (!tbuf->findchars_forward(p, nonword.c_str(), &end))
end = tbuf->length();
if (ontext && (p < start || p >= end))