diff --git a/src/Makefile.am b/src/Makefile.am index 855ab7da..196ad705 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -271,7 +271,7 @@ fldigi_SOURCES += \ include/Fl_Text_Buffer_mod.H \ include/Fl_Text_Display_mod.H \ include/Fl_Text_Editor_mod.H \ - include/Fl_Tile_Check.h \ + include/Panel.h \ include/FreqControl.h \ include/analysis.h \ include/ascii.h \ @@ -484,7 +484,7 @@ fldigi_SOURCES += \ widgets/Fl_Text_Buffer_mod.cxx \ widgets/Fl_Text_Display_mod.cxx \ widgets/Fl_Text_Editor_mod.cxx \ - widgets/Fl_Tile_Check.cxx \ + widgets/Panel.cxx \ widgets/flinput2.cxx \ widgets/flmisc.cxx \ widgets/flslider2.cxx \ diff --git a/src/dialogs/confdialog.cxx b/src/dialogs/confdialog.cxx index 39843fcb..891e40fe 100644 --- a/src/dialogs/confdialog.cxx +++ b/src/dialogs/confdialog.cxx @@ -340,14 +340,6 @@ static void cb_bwsrSldrSelColor(Fl_Button* o, void*) { progdefaults.changed = true; } -Fl_Spinner2 *cntViewerWidth=(Fl_Spinner2 *)0; - -static void cb_cntViewerWidth(Fl_Spinner2* o, void*) { - progdefaults.VIEWERwidth = (int)(o->value()); -UI_select(); -progdefaults.changed = true; -} - Fl_Group *tabMBars=(Fl_Group *)0; Fl_Check_Button *btnMacroMouseWheel=(Fl_Check_Button *)0; @@ -9487,7 +9479,7 @@ ab and newline are automatically included.")); o->value(progdefaults.VIEWERchannels); o->labelsize(FL_NORMAL_SIZE); } // Fl_Spinner2* cntChannels - { Fl_Spinner2* o = cntTimeout = new Fl_Spinner2(303, 105, 50, 24, _("Inactivity timeout")); + { Fl_Spinner2* o = cntTimeout = new Fl_Spinner2(18, 105, 50, 24, _("Inactivity timeout")); cntTimeout->tooltip(_("Clear channel text after\n# seconds of inactivity")); cntTimeout->box(FL_NO_BOX); cntTimeout->color((Fl_Color)FL_BACKGROUND_COLOR); @@ -9562,37 +9554,17 @@ ab and newline are automatically included.")); o->box(FL_ENGRAVED_FRAME); o->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE); { bwsrSliderColor = new Fl_Button(43, 317, 80, 24, _("Backgnd")); - bwsrSliderColor->tooltip(_("Background color for Function key group 1")); + bwsrSliderColor->tooltip(_("Background color of signal viewer squelch control")); bwsrSliderColor->callback((Fl_Callback*)cb_bwsrSliderColor); bwsrSliderColor->color(fl_rgb_color(progdefaults.bwsrSliderColor.R, progdefaults.bwsrSliderColor.G,progdefaults.bwsrSliderColor.B)); } // Fl_Button* bwsrSliderColor { bwsrSldrSelColor = new Fl_Button(135, 317, 80, 24, _("Button")); - bwsrSldrSelColor->tooltip(_("Background color for Function key group 1")); + bwsrSldrSelColor->tooltip(_("Slider hilite color of signal viewer squelch control")); bwsrSldrSelColor->callback((Fl_Callback*)cb_bwsrSldrSelColor); bwsrSldrSelColor->color(fl_rgb_color(progdefaults.bwsrSldrSelColor.R, progdefaults.bwsrSldrSelColor.G,progdefaults.bwsrSliderColor.B)); } // Fl_Button* bwsrSldrSelColor o->end(); } // Fl_Group* o - { Fl_Spinner2* o = cntViewerWidth = new Fl_Spinner2(18, 105, 50, 24, _("Width (% of panel)")); - cntViewerWidth->tooltip(_("Adjust viewer width as % of panel width")); - cntViewerWidth->box(FL_NO_BOX); - cntViewerWidth->color((Fl_Color)FL_BACKGROUND_COLOR); - cntViewerWidth->selection_color((Fl_Color)FL_BACKGROUND_COLOR); - cntViewerWidth->labeltype(FL_NORMAL_LABEL); - cntViewerWidth->labelfont(0); - cntViewerWidth->labelsize(14); - cntViewerWidth->labelcolor((Fl_Color)FL_FOREGROUND_COLOR); - cntViewerWidth->minimum(20); - cntViewerWidth->maximum(80); - cntViewerWidth->step(5); - cntViewerWidth->value(25); - cntViewerWidth->callback((Fl_Callback*)cb_cntViewerWidth); - cntViewerWidth->align(FL_ALIGN_RIGHT); - cntViewerWidth->when(FL_WHEN_RELEASE); - o->minimum(20); o->maximum(80); o->step(5); - o->value(progdefaults.VIEWERwidth); - o->labelsize(FL_NORMAL_SIZE); - } // Fl_Spinner2* cntViewerWidth o->end(); } // Fl_Group* o tabBrowser->end(); diff --git a/src/dialogs/confdialog.fl b/src/dialogs/confdialog.fl index 1ccc823a..fdef873a 100644 --- a/src/dialogs/confdialog.fl +++ b/src/dialogs/confdialog.fl @@ -349,7 +349,7 @@ initViewer();} callback {progdefaults.VIEWERtimeout = (int)(o->value()); progdefaults.changed = true;} tooltip {Clear channel text after -\# seconds of inactivity} xywh {303 105 50 24} align 8 value 10 +\# seconds of inactivity} xywh {18 105 50 24} align 8 value 10 code0 {o->minimum(1); o->maximum(180); o->step(1);} code1 {o->value(progdefaults.VIEWERtimeout);} code2 {o->labelsize(FL_NORMAL_SIZE);} @@ -440,7 +440,7 @@ progdefaults.changed = true;} mvsquelch->redraw(); progdefaults.changed = true;} - tooltip {Background color for Function key group 1} xywh {43 317 80 24} + tooltip {Background color of signal viewer squelch control} xywh {43 317 80 24} code0 {bwsrSliderColor->color(fl_rgb_color(progdefaults.bwsrSliderColor.R, progdefaults.bwsrSliderColor.G,progdefaults.bwsrSliderColor.B));} } Fl_Button bwsrSldrSelColor { @@ -463,21 +463,10 @@ progdefaults.changed = true;} mvsquelch->redraw(); progdefaults.changed = true;} - tooltip {Background color for Function key group 1} xywh {135 317 80 24} + tooltip {Slider hilite color of signal viewer squelch control} xywh {135 317 80 24} code0 {bwsrSldrSelColor->color(fl_rgb_color(progdefaults.bwsrSldrSelColor.R, progdefaults.bwsrSldrSelColor.G,progdefaults.bwsrSliderColor.B));} } } - Fl_Spinner cntViewerWidth { - label {Width (% of panel)} - callback {progdefaults.VIEWERwidth = (int)(o->value()); -UI_select(); -progdefaults.changed = true;} - tooltip {Adjust viewer width as % of panel width} xywh {18 105 50 24} align 8 minimum 20 maximum 80 step 5 value 25 - code0 {o->minimum(20); o->maximum(80); o->step(5);} - code1 {o->value(progdefaults.VIEWERwidth);} - code2 {o->labelsize(FL_NORMAL_SIZE);} - class Fl_Spinner2 - } } } Fl_Group tabMBars { diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index 9b96c7d3..3d066d3b 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -50,7 +50,7 @@ #include #include #include -#include +//#include #include #include #include @@ -63,6 +63,7 @@ #include "waterfall.h" #include "raster.h" #include "progress.h" +#include "Panel.h" #include "main.h" #include "threads.h" @@ -93,7 +94,7 @@ #include "globals.h" #include "misc.h" #include "FTextRXTX.h" -#include "Fl_Tile_Check.h" +//#include "Fl_Tile_Check.h" #include "confdialog.h" #include "configuration.h" @@ -191,18 +192,15 @@ Fl_Light_Button *btnRSID = (Fl_Light_Button *)0; Fl_Light_Button *btnTxRSID = (Fl_Light_Button *)0; Fl_Button *btnMacroTimer = (Fl_Button *)0; -Fl_Tile *VTgroup = 0; -Fl_Group *HTgroup = 0; +Panel *text_panel = 0; Fl_Group *mvgroup = 0; -//Fl_Tile_Check *VTgroup = 0; -//Fl_Tile_Check *HTgroup = 0; + Fl_Group *macroFrame1 = 0; Fl_Group *macroFrame2 = 0; FTextRX *ReceiveText = 0; FTextTX *TransmitText = 0; Raster *FHdisp; -Fl_Box *minVTbox; -Fl_Box *minHTbox; +Fl_Box *minbox; int oix; int minRxHeight; @@ -1378,6 +1376,15 @@ void set_server_label(bool val) void cb_view_hide_channels(Fl_Menu_ *w, void *d) { + if (text_panel->w() != ReceiveText->w()) { + progStatus.tile_x = mvgroup->w(); + progStatus.tile_w = text_panel->w(); + progStatus.tile_y = ReceiveText->h(); + progStatus.tile_h = text_panel->h(); + if (!progStatus.show_channels) progStatus.show_channels = true; + } else + if (progStatus.show_channels) progStatus.show_channels = false; + progStatus.show_channels = !progStatus.show_channels; UI_select(); return; @@ -2413,7 +2420,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2427,7 +2434,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame2->size(w, Hmacros); macroFrame2->position(x, y1); @@ -2446,7 +2453,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2468,7 +2475,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2502,7 +2509,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2516,7 +2523,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame2->size(w, Hmacros); macroFrame2->position(x, y1); @@ -2535,7 +2542,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2557,7 +2564,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2601,7 +2608,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2615,7 +2622,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame2->size(w, Hmacros); macroFrame2->position(x, y1); @@ -2634,7 +2641,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2656,7 +2663,7 @@ void UI_select() MixerFrame->resize(0, y1, sw, HTh); else MixerFrame->resize(0, y1, 0, HTh); - HTgroup->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); + text_panel->resize(MixerFrame->x() + MixerFrame->w(), y1, w - MixerFrame->w(), HTh); y1 += HTh; macroFrame1->position(x, y1); y1 += Hmacros; @@ -2695,24 +2702,16 @@ void UI_select() Status2->show(); UI_return: - if (progStatus.show_channels) { - mvgroup->resize( - HTgroup->x(), HTgroup->y(), - HTgroup->w() * progdefaults.VIEWERwidth / 100, HTgroup->h()); - VTgroup->resize( - HTgroup->x() + HTgroup->w() * progdefaults.VIEWERwidth / 100, HTgroup->y(), - HTgroup->w() - HTgroup->w() * progdefaults.VIEWERwidth / 100, HTgroup->h()); - mvgroup->show(); - } else { - mvgroup->resize(HTgroup->x(), HTgroup->y(), 0, HTgroup->h()); - VTgroup->resize(HTgroup->x(), HTgroup->y(), HTgroup->w(), HTgroup->h()); - mvgroup->hide(); - } - VTgroup->position( - -1, VTgroup->y() + minRxHeight, - -1, VTgroup->y() + progStatus.RxTextHeight * HTgroup->h() / 100); - VTgroup->init_sizes(); - HTgroup->init_sizes(); + if (progStatus.show_channels) + text_panel->position( + text_panel->orgx(), text_panel->orgy(), + text_panel->x() + (int)(1.0*text_panel->w()*progStatus.tile_x/progStatus.tile_w + 0.5), + text_panel->y() + (int)(1.0*text_panel->h()*progStatus.tile_y/progStatus.tile_h + 0.5)); + else + text_panel->position( + text_panel->orgx(), text_panel->orgy(), + text_panel->x(), + text_panel->y() + (int)(1.0*text_panel->h()*progStatus.tile_y/progStatus.tile_h + 0.5)); fl_digi_main->init_sizes(); fl_digi_main->redraw(); } @@ -4199,65 +4198,55 @@ void create_fl_digi_main_primary() { int HTwidth = progStatus.mainW - sw; - HTgroup = new Fl_Group(sw, Y, HTwidth, Htext); - HTgroup->box(FL_DOWN_BOX);//FLAT_BOX); + text_panel = new Panel(sw, Y, HTwidth, Htext); + text_panel->box(FL_UP_BOX);//FLAT_BOX); - mvgroup = new Fl_Group( - HTgroup->x(), HTgroup->y(), - HTgroup->w() * progdefaults.VIEWERwidth / 100, Htext, ""); - mvgroup->box(FL_FLAT_BOX); + mvgroup = new Fl_Group( + text_panel->x(), text_panel->y(), + text_panel->w()/2, Htext, ""); + mvgroup->box(FL_FLAT_BOX); - mainViewer = new pskBrowser(mvgroup->x(), mvgroup->y(), mvgroup->w(), Htext-20, ""); - mainViewer->has_scrollbar(Fl_Browser_::VERTICAL);//_ALWAYS);//BOTH_ALWAYS); - mainViewer->callback((Fl_Callback*)cb_mainViewer); - mainViewer->setfont(progdefaults.ViewerFontnbr, progdefaults.ViewerFontsize); - mainViewer->tooltip(_("Left click - select\nRight click - clear line")); - mainViewer->seek_re = &seek_re; + mainViewer = new pskBrowser(mvgroup->x(), mvgroup->y(), mvgroup->w(), Htext-20, ""); + mainViewer->has_scrollbar(Fl_Browser_::VERTICAL);//_ALWAYS);//BOTH_ALWAYS); + mainViewer->callback((Fl_Callback*)cb_mainViewer); + mainViewer->setfont(progdefaults.ViewerFontnbr, progdefaults.ViewerFontsize); + mainViewer->tooltip(_("Left click - select\nRight click - clear line")); + mainViewer->seek_re = &seek_re; - Fl_Group *g = new Fl_Group(mvgroup->x(), mvgroup->y() + Htext - 20, mvgroup->w(), 20); - g->box(FL_FLAT_BOX); - // squelch - mvsquelch = new Fl_Value_Slider2(g->x(), g->y(), g->w() - 65 - pad, g->h()); - mvsquelch->type(FL_HOR_NICE_SLIDER); - mvsquelch->range(-6.0, 20.0); - mvsquelch->value(progStatus.VIEWERsquelch); - mvsquelch->step(0.5); - mvsquelch->color( fl_rgb_color( - progdefaults.bwsrSliderColor.R, - progdefaults.bwsrSliderColor.G, - progdefaults.bwsrSliderColor.B)); - mvsquelch->selection_color( fl_rgb_color( - progdefaults.bwsrSldrSelColor.R, - progdefaults.bwsrSldrSelColor.G, - progdefaults.bwsrSldrSelColor.B)); - mvsquelch->callback( (Fl_Callback *)cb_mvsquelch); + Fl_Group *g = new Fl_Group(mvgroup->x(), mvgroup->y() + Htext - 20, mvgroup->w(), 20); + g->box(FL_FLAT_BOX); + // squelch + mvsquelch = new Fl_Value_Slider2(g->x(), g->y(), g->w() - 65 - pad, g->h()); + mvsquelch->type(FL_HOR_NICE_SLIDER); + mvsquelch->range(-6.0, 20.0); + mvsquelch->value(progStatus.VIEWERsquelch); + mvsquelch->step(0.5); + mvsquelch->color( fl_rgb_color( + progdefaults.bwsrSliderColor.R, + progdefaults.bwsrSliderColor.G, + progdefaults.bwsrSliderColor.B)); + mvsquelch->selection_color( fl_rgb_color( + progdefaults.bwsrSldrSelColor.R, + progdefaults.bwsrSldrSelColor.G, + progdefaults.bwsrSldrSelColor.B)); + mvsquelch->callback( (Fl_Callback *)cb_mvsquelch); - // clear button - btnClearMViewer = new Fl_Button(mvsquelch->x() + mvsquelch->w() + pad, g->y(), 65, g->h(), - make_icon_label(_("Clear"), edit_clear_icon)); - btnClearMViewer->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); - set_icon_label(btnClearMViewer); - btnClearMViewer->callback((Fl_Callback*)cb_btnClearMViewer); + // clear button + btnClearMViewer = new Fl_Button(mvsquelch->x() + mvsquelch->w() + pad, g->y(), 65, g->h(), + make_icon_label(_("Clear"), edit_clear_icon)); + btnClearMViewer->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); + set_icon_label(btnClearMViewer); + btnClearMViewer->callback((Fl_Callback*)cb_btnClearMViewer); - g->resizable(mvsquelch); - g->end(); + g->resizable(mvsquelch); + g->end(); - mvgroup->resizable(mainViewer); - mvgroup->end(); + mvgroup->resizable(mainViewer); + mvgroup->end(); - VTgroup = new Fl_Tile(HTgroup->x() + mvgroup->w(), HTgroup->y(), HTgroup->w() - mvgroup->w(), Htext); - - int ysmall = VTgroup->y() + 66; - int yheight = Htext - 66 - 40; - minRxHeight = progStatus.RxTextHeight * VTgroup->h() / 100; - minRxHeight = CLAMP(minRxHeight, 66, yheight); - progStatus.RxTextHeight = minRxHeight * 100 / VTgroup->h(); - int minTxHeight = Htext - minRxHeight; - - minVTbox = new Fl_Box(VTgroup->x(), ysmall, VTgroup->x(), yheight); - minVTbox->hide(); - - ReceiveText = new FTextRX(VTgroup->x(), VTgroup->y(), VTgroup->w(), minRxHeight, ""); + ReceiveText = new FTextRX( + text_panel->x() + mvgroup->w(), text_panel->y(), + text_panel->w() - mvgroup->w(), text_panel->h()/2, ""); ReceiveText->color( fl_rgb_color( progdefaults.RxColor.R, @@ -4272,11 +4261,15 @@ void create_fl_digi_main_primary() { ReceiveText->setFontColor(progdefaults.SKIPcolor, FTextBase::SKIP); ReceiveText->setFontColor(progdefaults.ALTRcolor, FTextBase::ALTR); - FHdisp = new Raster(VTgroup->x(), VTgroup->y(), VTgroup->w(), minRxHeight); + FHdisp = new Raster( + text_panel->x() + mvgroup->w(), text_panel->y(), + text_panel->w() - mvgroup->w(), text_panel->h()/2); FHdisp->align(FL_ALIGN_CLIP); FHdisp->hide(); - TransmitText = new FTextTX(VTgroup->x(), VTgroup->y() + ReceiveText->h(), VTgroup->w(), minTxHeight); + TransmitText = new FTextTX( + text_panel->x() + mvgroup->w(), text_panel->y() + ReceiveText->h(), + text_panel->w() - mvgroup->w(), text_panel->h() - ReceiveText->h()); TransmitText->color( fl_rgb_color( progdefaults.TxColor.R, @@ -4292,10 +4285,13 @@ void create_fl_digi_main_primary() { TransmitText->setFontColor(progdefaults.ALTRcolor, FTextBase::ALTR); TransmitText->align(FL_ALIGN_CLIP); - VTgroup->end(); - VTgroup->resizable(minVTbox); + Fl_Box *minbox = new Fl_Box( + text_panel->x(), text_panel->y() + 66, + text_panel->w() - 100, text_panel->h() - 66 - 80); + minbox->hide(); - HTgroup->end(); + text_panel->resizable(minbox); + text_panel->end(); Y += Htext; @@ -4479,7 +4475,7 @@ void create_fl_digi_main_primary() { inpNotes->when(FL_WHEN_RELEASE); fl_digi_main->end(); - fl_digi_main->resizable(HTgroup); + fl_digi_main->resizable(text_panel); fl_digi_main->callback(cb_wMain); scopeview = new Fl_Double_Window(0,0,140,140, _("Scope")); diff --git a/src/include/Panel.h b/src/include/Panel.h new file mode 100644 index 00000000..3ddef166 --- /dev/null +++ b/src/include/Panel.h @@ -0,0 +1,40 @@ +// ---------------------------------------------------------------------------- +// Panel_Check.h +// +// Copyright (C) 2011 +// Dave Freese, W1HKJ +// +// This file is part of fldigi. +// +// fldigi 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. +// +// fldigi 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 Panel_h_ +#define Panel_h_ + +#include + +class Panel : public Fl_Group { +public: + int handle(int); + Panel(int X,int Y,int W,int H,const char*l=0) : Fl_Group(X,Y,W,H,l) { + clip_children(true); + } + void resize(int, int, int, int); + void position(int, int, int, int); + int orgx(); + int orgy(); +}; + +#endif diff --git a/src/include/confdialog.h b/src/include/confdialog.h index 240aa973..dc71f065 100644 --- a/src/include/confdialog.h +++ b/src/include/confdialog.h @@ -59,7 +59,6 @@ extern Fl_Check_Button *btnAscend; extern Fl_Check_Button *btnBrowserHistory; extern Fl_Button *bwsrSliderColor; extern Fl_Button *bwsrSldrSelColor; -extern Fl_Spinner2 *cntViewerWidth; extern Fl_Group *tabMBars; extern Fl_Check_Button *btnMacroMouseWheel; extern Fl_Button *btn_one_bar; diff --git a/src/include/fl_digi.h b/src/include/fl_digi.h index ccb15573..e0612b66 100644 --- a/src/include/fl_digi.h +++ b/src/include/fl_digi.h @@ -29,7 +29,8 @@ #include #include "combo.h" -#include "Fl_Tile_Check.h" +//#include "Fl_Tile_Check.h" +#include "Panel.h" #include "FTextRXTX.h" #include "raster.h" #include "waterfall.h" @@ -53,12 +54,8 @@ extern Fl_Box *hideViewer; extern Raster *FHdisp; //extern Fl_Tile_Check *TiledGroup; -//extern Fl_Tile_Check *VTgroup; -extern Fl_Tile *VTgroup; -extern Fl_Box *minVTbox; -//extern Fl_Tile_Check *HTgroup; -extern Fl_Group *HTgroup; -extern Fl_Box *minHTbox; +extern Panel *text_panel; +extern Fl_Box *minbox; extern Fl_Group *MixerFrame; extern int oix; diff --git a/src/include/status.h b/src/include/status.h index b4fd262d..7aeb941d 100644 --- a/src/include/status.h +++ b/src/include/status.h @@ -42,6 +42,10 @@ struct status { unsigned int VIEWERheight; double VIEWERsquelch; bool VIEWERvisible; + int tile_x; + int tile_w; + int tile_y; + int tile_h; bool LOGenabled; double sldrSquelchValue; bool afconoff; diff --git a/src/misc/status.cxx b/src/misc/status.cxx index fc98d99f..e18b1263 100644 --- a/src/misc/status.cxx +++ b/src/misc/status.cxx @@ -100,6 +100,10 @@ status progStatus = { 400, // uint VIEDWERheight 3.0, // uint VIEWERsquelch false, // bool VIEWERvisible + 100, // int tile_x + 200, // int tile_w; + 50, // int tile_y; + 100, // int tile_h; false, // bool LOGenabled 5.0, // double sldrSquelchValue true, // bool afconoff @@ -186,7 +190,7 @@ void status::saveLastState() } mainW = fl_digi_main->w(); mainH = fl_digi_main->h(); - RxTextHeight = (ReceiveText->h() * 100) / VTgroup->h(); + RxTextHeight = (ReceiveText->h() * 100) / text_panel->h();//VTgroup->h(); carrier = wf->Carrier(); mag = wf->Mag(); @@ -230,6 +234,14 @@ void status::saveLastState() scopeH = scopeview->h(); } + + tile_w = text_panel->w(); + tile_y = ReceiveText->h(); + tile_h = text_panel->h(); + if (text_panel->w() != ReceiveText->w()) + tile_x = text_panel->x() + text_panel->w() - ReceiveText->w(); + + contestiatones = progdefaults.contestiatones; contestiabw = progdefaults.contestiabw; contestiamargin = progdefaults.contestiasmargin; @@ -314,6 +326,11 @@ if (!bWF_only) { spref.set("viewer_squelch", VIEWERsquelch); spref.set("viewer_nchars", static_cast(VIEWERnchars)); + spref.set("tile_x", tile_x); + spref.set("tile_y", tile_y); + spref.set("tile_w", tile_w); + spref.set("tile_h", tile_h); + spref.set("scope_visible", scopeVisible); spref.set("scope_x", scopeX); spref.set("scope_y", scopeY); @@ -461,6 +478,11 @@ void status::loadLastState() spref.get("viewer_squelch", VIEWERsquelch, VIEWERsquelch); spref.get("viewer_nchars", i, VIEWERnchars); VIEWERnchars = i; + spref.get("tile_x", tile_x, tile_x); + spref.get("tile_y", tile_y, tile_y); + spref.get("tile_w", tile_w, tile_w); + spref.get("tile_h", tile_h, tile_h); + spref.get("scope_visible", i, scopeVisible); scopeVisible = i; spref.get("scope_x", scopeX, scopeX); spref.get("scope_y", scopeY, scopeY); @@ -608,7 +630,9 @@ void status::initLastState() fl_digi_main->resize(mainX, mainY, mainW, Hmenu + Hwfall + Hstatus + 4); else { fl_digi_main->resize(mainX, mainY, mainW, mainH); + set_macroLabels(); + UI_select(); } diff --git a/src/widgets/Panel.cxx b/src/widgets/Panel.cxx new file mode 100644 index 00000000..90e9d2bf --- /dev/null +++ b/src/widgets/Panel.cxx @@ -0,0 +1,257 @@ +// ---------------------------------------------------------------------------- +// Panel.cxx +// +// Copyright (C) 2007-2011 +// Dave Freese, W1HKJ +// +// This file is part of fldigi. +// +// Fldigi 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) aRY later version. +// +// Fldigi is distributed in the hope that it will be useful, +// but WITHOUT ARY 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 fldigi. If not, see . +// ---------------------------------------------------------------------------- + +//#include + +#include +#include + +#include +#include +#include + +#include "Panel.h" + +// Drag the edges that were initially at oldx,oldy to newx,newy: +// pass -1 as oldx or oldy to disable drag in that direction: + +int Panel::orgx() +{ + int oldx = w(); + short* p = sizes()+8; + for (int i=children(); i--; p += 4) + if (p[1] < oldx) oldx = p[1]; + return oldx; +} + +int Panel::orgy() +{ + int oldy = h(); + short* p = sizes()+8; + for (int i=children(); i--; p += 4) + if (p[3] < oldy) oldy = p[3]; + return oldy; +} + +void Panel::position(int oix, int oiy, int newx, int newy) { +//printf("oix %3d, oiy %3d, nux %3d, nuy %3d\n", oix, oiy, newx, newy); + Fl_Widget* const* a = array(); + short* p = sizes(); +//printf("p0 %3d, p1 %3d, p2 %3d, p3 %3d\n", p[0], p[1], p[2], p[3]); +//printf("p4 %3d, p5 %3d, p6 %3d, p7 %3d\n", p[0], p[1], p[2], p[3]); + p += 8; // skip group & resizable's saved size + for (int i=children(); i--; p += 4) { + Fl_Widget* o = *a++; + if (o == resizable()) continue; + int X = o->x(); + int Y = o->y(); + int W = o->w(); + int H = o->h(); + int R = X + W; + int B = Y + H; + + if (o == resizable()) + continue; + if (oix > -1) { + int t = p[0]; + if ((t == oix) || (t>oix && Xnewx)) X = newx; + t = p[1]; + if ((t == oix) || (t>oix && Rnewx)) R = newx; + } + if (oiy > -1) { + int t = p[2]; + if ((t == oiy) || (t>oiy && Ynewy)) Y = newy; + t = p[3]; + if ((t == oiy) || (t>oiy && Bnewy)) B = newy; + } + o->damage_resize(X, Y, R-X, B-Y); + } +} + +// move the lower-right corner (sort of): +void Panel::resize(int X,int Y,int W,int H) { + // remember how much to move the child widgets: + short* p = sizes(); + int OX = x(); + int OY = y(); + int OW = w(); + int OH = h(); + int OR = OX + OW; + int OB = OY + OH; + float dw = 1.0 * W / OW; + float dh = 1.0 * H / OH; + // resize this (skip the Fl_Group resize): + Fl_Widget::resize(X,Y,W,H); + // find x, y, w, h of resizable: + int RX = X + (p[4] - p[0]); + int RY = Y + (p[6] - p[2]); + int RR = X + W - (p[1] - p[5]); + int RB = Y + H - (p[3] - p[7]); + int NW = RR - RX; + int NH = RB - RY; + int R; + int B; + int xx; + int yy; + // move everything to be on correct side of new resizable: + Fl_Widget * const *a = array(); + Fl_Widget * o = 0; + p += 8; + for (int i=children(); i--;) { + o = *a++; + if (o == resizable()) { + o->resize(RX, RY, NW, NH); + } else { + xx = X; + if (o->x() != OX) + xx = (o->x() - OX) * dw + X + 0.5; + if (xx > RR) xx = RR; + if (o->x() + o->w() == OR) { + R = X + W; + if (xx != X && xx < RX) xx = RX; + } else { + R = xx + o->w() * dw + 0.5; + if (R < xx) R = xx; + if (xx <= RX && R < RX) R = RX; + if (xx <= RX && R > RR ) R = RR; + } + + yy = Y; + if (o->y() != OY) + yy = (o->y() - OY) * dh + Y + 0.5; + if (yy > RB) yy = RB; + if (o->y() + o->h() == OB) { + B = Y + H; + if (yy != Y && yy < RY) yy = RY; + } else { + B = yy + o->h() * dh + 0.5; + if (B < yy) B = yy; + if (yy <= RY && B < RY) B = RY; + if (yy <= RY && B > RB) B = RB; + } + + o->resize(xx,yy,R-xx,B-yy); + } + p += 4; // next child sizes array +// do *not* call o->redraw() here! If you do, and the tile is inside a +// scroll, it'll set the damage areas wrong for all children! + } +} + +static void set_cursor(Panel *t, Fl_Cursor c) { + static Fl_Cursor cursor; + if (cursor == c || !t->window()) return; + cursor = c; + t->window()->cursor(c); +} + +static Fl_Cursor cursors[4] = { + FL_CURSOR_DEFAULT, + FL_CURSOR_WE, + FL_CURSOR_NS, + FL_CURSOR_MOVE}; + +int Panel::handle(int event) { + static int sdrag; + static int sdx, sdy; + static int sx, sy; +#define DRAGH 1 +#define DRAGV 2 +#define GRABAREA 4 + + int mx = Fl::event_x(); + int my = Fl::event_y(); + + switch (event) { + + case FL_MOVE: + case FL_ENTER: + case FL_PUSH: { + int mindx = 100; + int mindy = 100; + int oldx = 0; + int oldy = 0; + Fl_Widget*const* a = array(); + short* q = sizes(); + short* p = q+8; + for (int i=children(); i--; p += 4) { + Fl_Widget* o = *a++; + if (o == resizable()) continue; + if (p[1]y()<=my+GRABAREA && o->y()+o->h()>=my-GRABAREA) { + int t = mx - (o->x()+o->w()); + if (abs(t) < mindx) { + sdx = t; + mindx = abs(t); + oldx = p[1]; + } + } + if (p[3]x()<=mx+GRABAREA && o->x()+o->w()>=mx-GRABAREA) { + int t = my - (o->y()+o->h()); + if (abs(t) < mindy) { + sdy = t; + mindy = abs(t); + oldy = p[3]; + } + } + } + sdrag = 0; sx = sy = -1; + if (mindx <= GRABAREA) {sdrag = DRAGH; sx = oldx;} + if (mindy <= GRABAREA) {sdrag |= DRAGV; sy = oldy;} + set_cursor(this, cursors[sdrag]); + if (sdrag) return 1; + return Fl_Group::handle(event); + } + + case FL_LEAVE: + set_cursor(this, FL_CURSOR_DEFAULT); + break; + + case FL_DRAG: + // This is necessary if CONSOLIDATE_MOTION in Fl_x.cxx is turned off: + // if (damage()) return 1; // don't fall behind + case FL_RELEASE: { + if (!sdrag) return 0; // should not happen + Fl_Widget* r = resizable(); if (!r) r = this; + int newx; + if (sdrag&DRAGH) { + newx = Fl::event_x()-sdx; + if (newx < r->x()) newx = r->x(); + else if (newx >= r->x()+r->w()) newx = r->x()+r->w(); + } else + newx = sx; + int newy; + if (sdrag&DRAGV) { + newy = Fl::event_y()-sdy; + if (newy < r->y()) newy = r->y(); + else if (newy >= r->y()+r->h()) newy = r->y()+r->h(); + } else + newy = sy; + position(sx,sy,newx,newy); + if (event == FL_DRAG) set_changed(); + do_callback(); + return 1;} + + } + + return Fl_Group::handle(event); +} +