diff --git a/src/Makefile.am b/src/Makefile.am
index 7a7d15d6..cf60e9cf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -230,6 +230,7 @@ flrig_SOURCES += \
UI/rigpanel.cxx \
widgets/combo.cxx \
widgets/Fl_SigBar.cxx \
+ widgets/flbrowser2.cxx \
widgets/flinput2.cxx \
widgets/flslider2.cxx \
widgets/font_browser.cxx \
@@ -258,14 +259,15 @@ EXTRA_DIST = \
include/morse.h \
include/debug.h \
include/dialogs.h \
+ include/flbrowser2.h \
+ include/flinput2.h \
+ include/flslider2.h \
include/fileselect.h \
include/font_browser.h \
include/flrigrc.h \
- include/flinput2.h \
include/icons.h \
include/KENWOOD.h \
include/pixmaps.h \
- include/flslider2.h \
include/Fl_SigBar.h \
include/FreqControl.h \
include/hspinner.h \
diff --git a/src/UI/rigpanel.cxx b/src/UI/rigpanel.cxx
index e29cc59e..bf0f5a9c 100644
--- a/src/UI/rigpanel.cxx
+++ b/src/UI/rigpanel.cxx
@@ -47,7 +47,6 @@ Hspinner *spnrOUTER = (Hspinner *)0;
Hspinner *spnrNOTCH = (Hspinner *)0;
Hspinner *spnrMICGAIN = (Hspinner *)0;
-static const int freq_sel_widths[]={110, 70, 70, 0};
static Fl_Double_Window *meter_scale_dialog = (Fl_Double_Window *)0;
static Fl_Double_Window *meter_filters = (Fl_Double_Window *)0;
diff --git a/src/UI/ui_memory.cxx b/src/UI/ui_memory.cxx
index 97b8fa43..2cc877d3 100644
--- a/src/UI/ui_memory.cxx
+++ b/src/UI/ui_memory.cxx
@@ -18,11 +18,13 @@
// along with this program. If not, see .
// ----------------------------------------------------------------------------
+#include "font_browser.h"
+
Fl_Button *btnAddFreq=(Fl_Button *)0;
Fl_Button *btnPickFreq=(Fl_Button *)0;
Fl_Button *btnDelFreq=(Fl_Button *)0;
Fl_Button *btnClearList=(Fl_Button *)0;
-Fl_Browser *FreqSelect=(Fl_Browser *)0;
+Fl_Browser2 *FreqSelect=(Fl_Browser2 *)0;
Fl_Input *inAlphaTag=(Fl_Input *)0;
static void cb_btnAddFreq(Fl_Button*, void*) {
@@ -48,87 +50,184 @@ static void cb_Close(Fl_Button*, void*) {
static void cb_FreqSelect(Fl_Browser* o, void*) {
select_and_close();
- switch (Fl::event_button()) {
- case FL_LEFT_MOUSE:
- if (Fl::event_clicks()) { // double click
- if (o->value())
- selectFreq();
- o->parent()->hide();
- }
- break;
- case FL_RIGHT_MOUSE:
- if (o->value()) selectFreq();
- break;
- default:
- break;
- }
}
static void cb_inAlphaTag(Fl_Input*, void*) {
editAlphaTag();
}
+static Font_Browser *fntSelectbrowser = 0;
+static Fl_Browser *header = 0;
+static int freq_sel_widths[] = {140, 15, 70, 15, 80, 15, 0};
+
+extern void updateSelect();
+
+void cbFreqSelectFontBrowser(Fl_Widget*, void*) {
+ progStatus.memfontnbr = fntSelectbrowser->fontNumber();
+ progStatus.memfontsize = fntSelectbrowser->fontSize();
+ if (progStatus.memfontsize > 18) progStatus.memfontsize = 18;
+ if (progStatus.memfontsize < 10) progStatus.memfontsize = 10;
+ fntSelectbrowser->hide();
+
+ char hdrline[256];
+ header->clear();
+ snprintf(hdrline, sizeof(hdrline),
+ "\
+@F%d@S%d@B%d@cFrequency\t\
+@F%d@S%d@B%d|\t\
+@F%d@S%d@B%d@cBW\t\
+@F%d@S%d@B%d|\t\
+@F%d@S%d@B%d@cMode\t\
+@F%d@S%d@B%d|\t\
+@F%d@S%d@B%d@cComments",
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247 );
+ header->add(hdrline);
+ header->redraw();
+
+ updateSelect();
+
+}
+
+void cbFreqFontBrowser()
+{
+ fntSelectbrowser = new Font_Browser;
+ fntSelectbrowser->fontNumber(progStatus.memfontnbr);
+ fntSelectbrowser->fontSize(progStatus.memfontsize);
+ fntSelectbrowser->fontFilter(Font_Browser::FIXED_WIDTH);
+ fntSelectbrowser->fontFilter(Font_Browser::ALL_TYPES);
+ fntSelectbrowser->callback(cbFreqSelectFontBrowser);
+ fntSelectbrowser->show();
+}
+
Fl_Double_Window* Memory_Dialog() {
- Fl_Double_Window* w = new Fl_Double_Window(505, 175, _("Flrig Memory"));
+ Fl_Double_Window* w = new Fl_Double_Window(600, 182, _("Flrig Memory"));
- Fl_Group* mm_grp1 = new Fl_Group(2, 2, 60, 133);
- mm_grp1->box(FL_ENGRAVED_FRAME);
+ Fl_Group* mm_grp1 = new Fl_Group(0, 0, 600, 155);
+ mm_grp1->box(FL_FLAT_BOX);
- btnAddFreq = new Fl_Button(6, 6, 51, 22, _("Add @-1>"));
- btnAddFreq->tooltip(_("Add to list"));
- btnAddFreq->down_box(FL_DOWN_BOX);
- btnAddFreq->labelsize(12);
- btnAddFreq->callback((Fl_Callback*)cb_btnAddFreq);
- btnAddFreq->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+ Fl_Group* mm_grp1a = new Fl_Group(0, 0, 64, 156);
+ mm_grp1a->box(FL_FLAT_BOX);
- btnPickFreq = new Fl_Button(6, 31, 51, 22, _("Pick @-1<"));
- btnPickFreq->tooltip(_("Use selected data"));
- btnPickFreq->down_box(FL_DOWN_BOX);
- btnPickFreq->labelsize(12);
- btnPickFreq->callback((Fl_Callback*)cb_btnPickFreq);
- btnPickFreq->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+ btnAddFreq = new Fl_Button(2, 1, 60, 22, _("Add @-1>"));
+ btnAddFreq->tooltip(_("Add to list"));
+ btnAddFreq->down_box(FL_DOWN_BOX);
+ btnAddFreq->labelsize(14);
+ btnAddFreq->callback((Fl_Callback*)cb_btnAddFreq);
+ btnAddFreq->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
- btnDelFreq = new Fl_Button(6, 57, 51, 22, _("Del @-11+"));
- btnDelFreq->tooltip(_("Delete from list"));
- btnDelFreq->down_box(FL_DOWN_BOX);
- btnDelFreq->labelsize(12);
- btnDelFreq->callback((Fl_Callback*)cb_btnDelFreq);
- btnDelFreq->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+ btnPickFreq = new Fl_Button(2, 25, 60, 22, _("Pick @-1<"));
+ btnPickFreq->tooltip(_("Use selected data"));
+ btnPickFreq->down_box(FL_DOWN_BOX);
+ btnPickFreq->labelsize(14);
+ btnPickFreq->callback((Fl_Callback*)cb_btnPickFreq);
+ btnPickFreq->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
- btnClearList = new Fl_Button(6, 83, 51, 22, _("Clr @-2square"));
- btnClearList->tooltip(_("Clear list"));
- btnClearList->down_box(FL_DOWN_BOX);
- btnClearList->labelsize(12);
- btnClearList->callback((Fl_Callback*)cb_btnClearList);
- btnClearList->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+ btnDelFreq = new Fl_Button(2, 49, 60, 22, _("Del @-11+"));
+ btnDelFreq->tooltip(_("Delete from list"));
+ btnDelFreq->down_box(FL_DOWN_BOX);
+ btnDelFreq->labelsize(14);
+ btnDelFreq->callback((Fl_Callback*)cb_btnDelFreq);
+ btnDelFreq->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
- Fl_Button* close = new Fl_Button(6, 109, 51, 22, _("Close"));
- close->tooltip(_("Close Memory dialog"));
- close->labelsize(12);
- close->callback((Fl_Callback*)cb_Close);
- close->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+ btnClearList = new Fl_Button(2, 73, 60, 22, _("Clr @-2square"));
+ btnClearList->tooltip(_("Clear list"));
+ btnClearList->down_box(FL_DOWN_BOX);
+ btnClearList->labelsize(14);
+ btnClearList->callback((Fl_Callback*)cb_btnClearList);
+ btnClearList->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+
+ Fl_Button * btnFontSel = new Fl_Button(2, 97, 60, 22, _("Font"));
+ btnFontSel->tooltip(_("Select Font/Size"));
+ btnFontSel->down_box(FL_DOWN_BOX);
+ btnFontSel->labelsize(14);
+ btnFontSel->callback((Fl_Callback*)cbFreqFontBrowser);
+ btnFontSel->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+
+ Fl_Button* close = new Fl_Button(2, 121, 60, 22, _("Close"));
+ close->tooltip(_("Close Memory dialog"));
+ close->labelsize(14);
+ close->callback((Fl_Callback*)cb_Close);
+ close->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE));
+
+ Fl_Box *bx1a = new Fl_Box(0, 143, 66, 2, "");
+ bx1a->box(FL_NO_BOX);
+
+ mm_grp1a->end();
+ mm_grp1a->resizable(bx1a);
+
+ Fl_Group *mm_grp1b = new Fl_Group(66, 0, 534, 155);
+ mm_grp1b->box(FL_FLAT_BOX);
+
+ header = new Fl_Browser(66, 0, 532, 24, "");
+ header->column_widths(freq_sel_widths);
+ header->color(247);
+ char hdrline[256];
+ snprintf(hdrline, sizeof(hdrline),
+ "\
+@F%d@S%d@B%d@cFrequency\t\
+@F%d@S%d@B%d|\t\
+@F%d@S%d@B%d@cBW\t\
+@F%d@S%d@B%d|\t\
+@F%d@S%d@B%d@cMode\t\
+@F%d@S%d@B%d|\t\
+@F%d@S%d@B%d@cComments",
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247,
+ progStatus.memfontnbr, progStatus.memfontsize, 247 );
+ header->add(hdrline);
+
+ FreqSelect = new Fl_Browser2(66, 24, 532, 131);
+ FreqSelect->tooltip(
+ _("\
+Left Click: high light\n\
+Dbl Left Click: select\n\
+Right click: select"));
+ FreqSelect->type(2);
+ FreqSelect->labelfont(4);
+ FreqSelect->labelsize(14);
+ FreqSelect->textfont(4);
+ FreqSelect->textsize(14);
+ FreqSelect->column_widths(freq_sel_widths);
+ FreqSelect->callback((Fl_Callback*)cb_FreqSelect);
+// FreqSelect->has_scrollbar(Fl_Browser_::BOTH_ALWAYS);
+
+ mm_grp1b->end();
+ mm_grp1b->resizable(FreqSelect);
mm_grp1->end();
+ mm_grp1->resizable(mm_grp1b);
- FreqSelect = new Fl_Browser(66, 2, 434, 133);
- FreqSelect->tooltip(
- _("Right click => pick freq\nDouble-click ==> pick and close\nLeft click => edit Alpha Tag"));
- FreqSelect->type(2);
- FreqSelect->labelfont(4);
- FreqSelect->labelsize(12);
- FreqSelect->textfont(4);
- FreqSelect->textsize(12);
- FreqSelect->callback((Fl_Callback*)cb_FreqSelect);
- FreqSelect->has_scrollbar(Fl_Browser_::VERTICAL_ALWAYS);
- FreqSelect->column_widths(freq_sel_widths);
+ Fl_Group* mm_grp2 = new Fl_Group(0, 155, 600, 26);
- inAlphaTag = new Fl_Input(290, 140, 190, 25, _("Alpha Tag:"));
- inAlphaTag->tooltip(
-_("Select Tag from browser window\nLeft click => in Tag field to edit\n[Enter] => when done to update"));
- inAlphaTag->callback((Fl_Callback*)cb_inAlphaTag);
- inAlphaTag->when(FL_WHEN_ENTER_KEY_ALWAYS);
+ inAlphaTag = new Fl_Input(66, 156, 532, 24, _("Tag:"));
+ inAlphaTag->tooltip(
+_("Left click => in Tag field to edit\n[Enter] => when done to update"));
+ inAlphaTag->callback((Fl_Callback*)cb_inAlphaTag);
+ inAlphaTag->when(FL_WHEN_ENTER_KEY_ALWAYS);
+ inAlphaTag->textfont(4);
+ inAlphaTag->textsize(14);
+
+ mm_grp2->end();
+ mm_grp2->resizable(inAlphaTag);
w->end();
+ w->resizable(mm_grp1);
+
+ w->size_range(w->w(), w->h(), 0, 0);
+ w->resize(
+ progStatus.memX, progStatus.memY,
+ progStatus.memW, progStatus.memH);
+ w->init_sizes();
return w;
}
diff --git a/src/UI/ui_setup.cxx b/src/UI/ui_setup.cxx
index 4b0e7f99..e364d53f 100644
--- a/src/UI/ui_setup.cxx
+++ b/src/UI/ui_setup.cxx
@@ -452,6 +452,8 @@ Fl_Double_Window* DisplayDialog() {
w->end();
+ w->position( progStatus.ddX, progStatus.ddY );
+
return w;
}
diff --git a/src/include/flbrowser2.h b/src/include/flbrowser2.h
new file mode 100644
index 00000000..fedecd4b
--- /dev/null
+++ b/src/include/flbrowser2.h
@@ -0,0 +1,33 @@
+// ----------------------------------------------------------------------------
+// Copyright (C) 2014
+// David Freese, W1HKJ
+//
+// This file is part of flrig.
+//
+// flrig is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// flrig is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+// ----------------------------------------------------------------------------
+
+#ifndef FL_BROWSER2_
+#define FL_BROWSER2_
+
+#include
+
+class Fl_Browser2 : public Fl_Browser
+{
+public:
+ Fl_Browser2(int x, int y, int w, int h, const char* l = 0);
+ int handle(int event);
+};
+
+#endif // FL_BROWSER2_
diff --git a/src/include/rigpanel.h b/src/include/rigpanel.h
index 2f474249..66bfcaef 100644
--- a/src/include/rigpanel.h
+++ b/src/include/rigpanel.h
@@ -52,6 +52,7 @@
#include
#include "flinput2.h"
+#include "flbrowser2.h"
#include "Fl_SigBar.h"
#include "FreqControl.h"
#include "combo.h"
@@ -399,7 +400,7 @@ extern Fl_Button *btnPickFreq;
extern Fl_Button *btnDelFreq;
extern Fl_Button *btnClearList;
-extern Fl_Browser *FreqSelect;
+extern Fl_Browser2 *FreqSelect;
extern Fl_Input *inAlphaTag;
diff --git a/src/include/status.h b/src/include/status.h
index f7843b9d..ccd431e7 100644
--- a/src/include/status.h
+++ b/src/include/status.h
@@ -38,6 +38,15 @@ struct status {
int mainH;
int UIsize;
bool UIchanged;
+
+ int memX;
+ int memY;
+ int memW;
+ int memH;
+
+ int ddX;
+ int ddY;
+
string xcvr_serial_port;
int comm_baudrate;
int stopbits;
@@ -404,6 +413,10 @@ struct status {
int f2, m2, txT_2, rxT_2, offset_2, oF_2;
int f70, m70, txT_70, rxT_70, offset_70, oF_70;
+// memory management
+ Fl_Font memfontnbr;
+ int memfontsize;
+
// cwio parameters
int cwioWPM;
int cwioKEYLINE;
diff --git a/src/include/support.h b/src/include/support.h
index 08b33eba..12b65651 100644
--- a/src/include/support.h
+++ b/src/include/support.h
@@ -47,7 +47,7 @@
#include "status.h"
#define LISTSIZE 200
-#define ATAGSIZE 21
+#define ATAGSIZE 128 //21
extern bool flrig_abort;
diff --git a/src/support/status.cxx b/src/support/status.cxx
index 3ed257b4..7082716b 100644
--- a/src/support/status.cxx
+++ b/src/support/status.cxx
@@ -27,6 +27,8 @@
#include
#include
+#include "dialogs.h"
+
#include "status.h"
#include "util.h"
#include "rig.h"
@@ -49,6 +51,15 @@ status progStatus = {
150, // int mainH;
small_ui, // UISIZE, UIsize;
false, // UIchanged;
+
+ 20, // int memX;
+ 20, // int memY;
+ 600, // int memW;
+ 164, // int memH;
+
+ 20, // int ddX;
+ 20, // int ddY;
+
"NONE", // string xcvr_serial_port;
0, // int comm_baudrate;
2, // int stopbits;
@@ -416,7 +427,11 @@ status progStatus = {
28070000L, 6, 0, 0, 0, 600, // f10 meters
50070000L, 6, 0, 0, 0, 600, // f6 meters
144070000L, 6, 0, 0, 0, 600, // f2 meters
- 432100000L, 6, 0, 0, 0, 600, // f70 cent'
+ 432100000L, 6, 0, 0, 0, 600, // f70 cent'
+
+// memory management
+ 4, // Fl_Font memfontnbr;
+ 14, // int memfontsize;
// cwio parameters
20, // int cwioWPM;
@@ -441,6 +456,13 @@ void status::saveLastState()
int mW = mainwindow->w();
int mH = mainwindow->h();
+ if (dlgMemoryDialog) {
+ memX = dlgMemoryDialog->x();
+ memY = dlgMemoryDialog->y();
+ memW = dlgMemoryDialog->w();
+ memH = dlgMemoryDialog->h();
+ }
+
if (mX >= 0 && mX >= 0) {
mainX = mX;
mainY = mY;
@@ -458,6 +480,14 @@ void status::saveLastState()
spref.set("uisize", UIsize);
+ spref.set("memx", memX);
+ spref.set("memy", memY);
+ spref.set("memw", memW);
+ spref.set("memh", memH);
+
+ spref.set("ddx", ddX);
+ spref.set("ddy", ddY);
+
spref.set("xcvr_serial_port", xcvr_serial_port.c_str());
spref.set("comm_baudrate", comm_baudrate);
spref.set("comm_stopbits", stopbits);
@@ -870,6 +900,9 @@ void status::saveLastState()
spref.set("hrd_buttons", hrd_buttons);
spref.set("sliders_button", sliders_button);
+ spref.set("memfontnbr", memfontnbr);
+ spref.set("memfontsize", memfontsize);
+
spref.set("cwioWPM", cwioWPM);
spref.set("cwio_comp", cwio_comp);
spref.set("cwioKEYLINE", cwioKEYLINE);
@@ -901,6 +934,15 @@ bool status::loadXcvrState(string xcvr)
spref.get("mainw", mainW, mainW);
spref.get("mainh", mainH, mainH);
spref.get("uisize", UIsize, UIsize);
+
+ spref.get("memx", memX, memX);
+ spref.get("memy", memY, memY);
+ spref.get("memw", memW, memW);
+ spref.get("memh", memH, memH);
+
+ spref.get("ddX", ddX, ddX);
+ spref.get("ddY", ddY, ddY);
+
if (current_ui_size != -1) {
UIsize = current_ui_size;
}
@@ -1407,6 +1449,9 @@ bool status::loadXcvrState(string xcvr)
if (spref.get("hrd_buttons", i, i)) hrd_buttons = i;
spref.get("sliders_button", sliders_button, sliders_button);
+ spref.get("memfontnbr", memfontnbr, memfontnbr);
+ spref.get("memfontsize", memfontsize, memfontsize);
+
spref.get("cwioWPM", cwioWPM, cwioWPM);
spref.get("cwio_comp", cwio_comp, cwio_comp);
spref.get("cwioKEYLINE", cwioKEYLINE, cwioKEYLINE);
diff --git a/src/support/support.cxx b/src/support/support.cxx
index ed5aaf09..3e9c4343 100644
--- a/src/support/support.cxx
+++ b/src/support/support.cxx
@@ -1740,7 +1740,7 @@ void clearList() {
}
void updateSelect() {
- char szline[80 + ATAGSIZE];
+ char szline[1000];
char szatag[ATAGSIZE];
int i;
FreqSelect->clear();
@@ -1753,18 +1753,29 @@ void updateSelect() {
for (int n = 0; n < numinlist; n++) {
memset(szline, 0, sizeof(szline));
memset(szatag, 0, sizeof(szatag));
- for (i = 0; i < ATAGSIZE - 1; i++) {
+ for (i = 0; i < ATAGSIZE; i++) {
szatag[i] = oplist[n].alpha_tag[i];
- if (szatag[i] == 0) szatag[i] = ' ';
+ if (szatag[i] == '\n') szatag[i] = ' ';
}
bg_clr = (n % 2) ? bg1 : bg2;
- snprintf(szline, sizeof(szline),
- "@B%d@r%.3f\t@B%d@r%s\t@B%d@r%s\t@B%d@r%s", bg_clr,
- oplist[n].freq / 1000.0, bg_clr,
- selrig->get_bwname_(oplist[n].iBW, oplist[n].imode), bg_clr,
- selrig->get_modename_(oplist[n].imode), bg_clr,
- szatag );
+ snprintf(szline, sizeof(szline), "\
+@F%d@S%d@B%d@r%.3f\t\
+@F%d@S%d@B%d@.|\t\
+@F%d@S%d@B%d@r%s\t\
+@F%d@S%d@B%d@.|\t\
+@F%d@S%d@B%d@r%s\t\
+@F%d@S%d@B%d@.|\t\
+@F%d@S%d@B%d@.%s",
+ progStatus.memfontnbr, progStatus.memfontsize, bg_clr, oplist[n].freq / 1000.0,
+ progStatus.memfontnbr, progStatus.memfontsize, bg_clr,
+ progStatus.memfontnbr, progStatus.memfontsize, bg_clr, selrig->get_bwname_(oplist[n].iBW, oplist[n].imode),
+ progStatus.memfontnbr, progStatus.memfontsize, bg_clr,
+ progStatus.memfontnbr, progStatus.memfontsize, bg_clr, selrig->get_modename_(oplist[n].imode),
+ progStatus.memfontnbr, progStatus.memfontsize, bg_clr,
+ progStatus.memfontnbr, progStatus.memfontsize, bg_clr, szatag );
FreqSelect->add (szline);
+//if (n == 0)
+//std::cout << szline << std::endl;
}
inAlphaTag->value("");
}
@@ -2114,35 +2125,45 @@ void selectFreq() {
}
}
+#include
void select_and_close()
{
- switch (Fl::event_button()) {
- case FL_LEFT_MOUSE:
- if (FreqSelect->value() > 0)
- inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
- if (Fl::event_clicks()) { // double click
- selectFreq();
- cbCloseMemory();
- }
- break;
- case FL_RIGHT_MOUSE:
- if (FreqSelect->value() > 0)
- inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
- selectFreq();
- break;
- default:
- break;
+ int key = Fl::event_key();
+ int btn = Fl::event_button();
+
+ if (FreqSelect->value() <= 0) return;
+
+ if ((btn == FL_LEFT_MOUSE && Fl::event_clicks()) ||
+ btn == FL_RIGHT_MOUSE ||
+ key == FL_Enter ||
+ key == FL_Left) {
+ inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
+ selectFreq();
+ Fl::focus(FreqSelect);
+ return;
}
-// update Alpha Tag field when keyboard scrolling
- switch (Fl::event_key()) {
- case FL_Up:
- case FL_Down:
- if (FreqSelect->value() > 0)
- inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
- break;
- default:
- break;
+ if (btn == FL_LEFT_MOUSE || key == FL_Up || key == FL_Down) {
+ inAlphaTag->value(oplist[FreqSelect->value() - 1].alpha_tag);
+ Fl::focus(FreqSelect);
+ return;
+ }
+
+ if (key == FL_Right) {
+ addFreq();
+ FreqSelect->select(1, 1);
+ inAlphaTag->value(oplist[0].alpha_tag);
+ Fl::focus(FreqSelect);
+ return;
+ }
+
+ if (key == FL_Delete) {
+ long n = FreqSelect->value();
+ delFreq();
+ FreqSelect->select(n, 1);
+ inAlphaTag->value(oplist[n-1].alpha_tag);
+ Fl::focus(FreqSelect);
+ return;
}
}
diff --git a/src/widgets/flbrowser2.cxx b/src/widgets/flbrowser2.cxx
new file mode 100644
index 00000000..de2eb272
--- /dev/null
+++ b/src/widgets/flbrowser2.cxx
@@ -0,0 +1,63 @@
+// =====================================================================
+//
+// flinput2.cxx
+//
+// Author: Stelios Buononos, M0GLD
+// Copyright: 2010
+//
+// This file is part of flrig.
+//
+// This is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This software is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. It is
+// copyright under the GNU General Public License.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// =====================================================================
+
+#include "config.h"
+
+#include
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "icons.h"
+#include "flbrowser2.h"
+#include "gettext.h"
+#include "util.h"
+
+#include
+
+Fl_Browser2::Fl_Browser2(int x, int y, int w, int h, const char* l)
+: Fl_Browser(x, y, w, h, l)
+{
+}
+
+int Fl_Browser2::handle(int event)
+{
+ int key = Fl::event_key();
+ if (event == FL_KEYUP &&
+ ( key == FL_Enter ||
+ key == FL_Left ||
+ key == FL_Right ||
+ key == FL_Delete ) ) {
+ do_callback();
+ return 1;
+ }
+ return Fl_Browser::handle(event);
+}
+