kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Add transmit-lock marker
rodzic
652f43f9af
commit
b7d5d6ee05
|
|
@ -434,6 +434,7 @@ static void cb_btnBwTracksColor(Fl_Button* o, void*) {
|
|||
progdefaults.bwTrackRGBI.B) ) {
|
||||
o->color(fl_rgb_color(progdefaults.bwTrackRGBI.R,progdefaults.bwTrackRGBI.G,progdefaults.bwTrackRGBI.B));
|
||||
o->redraw();
|
||||
wf->redraw_marker();
|
||||
progdefaults.changed = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -557,6 +557,7 @@ progdefaults.changed = true;}
|
|||
progdefaults.bwTrackRGBI.B) ) {
|
||||
o->color(fl_rgb_color(progdefaults.bwTrackRGBI.R,progdefaults.bwTrackRGBI.G,progdefaults.bwTrackRGBI.B));
|
||||
o->redraw();
|
||||
wf->redraw_marker();
|
||||
progdefaults.changed = true;
|
||||
}}
|
||||
tooltip {Change color} xywh {346 191 20 20} color 1 align 8
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ unsigned quick_choice_menu(const char* title, unsigned sel, const Fl_Menu_Item*
|
|||
unsigned quick_choice(const char* title, unsigned sel, ...);
|
||||
|
||||
Fl_Color adjust_color(Fl_Color fg, Fl_Color bg);
|
||||
void adjust_color_inv(unsigned char& bg1r, unsigned char& bg1g, unsigned char& bg1b,
|
||||
Fl_Color bg2, Fl_Color def);
|
||||
|
||||
#if !defined(__APPLE__) && !defined(__WOE32__)
|
||||
# include <FL/x.H>
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ public:
|
|||
void movetocenter();
|
||||
void carrier(int cf);
|
||||
int carrier();
|
||||
inline void makeMarker_(int width, const RGB* color, int freq, const RGB* clrMin, RGB* clrM, const RGB* clrMax);
|
||||
void makeMarker();
|
||||
void process_analog(double *sig, int len);
|
||||
void processFFT();
|
||||
|
|
|
|||
|
|
@ -140,9 +140,8 @@ void modem::set_freq(double freq)
|
|||
|
||||
void modem::set_freqlock(bool on)
|
||||
{
|
||||
if (on == false)
|
||||
tx_frequency = frequency;
|
||||
freqlock = on;
|
||||
set_freq(frequency);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
#include "macros.h"
|
||||
#include "arq_io.h"
|
||||
#include "confdialog.h"
|
||||
#include "flmisc.h"
|
||||
#include "gettext.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
@ -195,8 +196,29 @@ void WFdisp::initMarkers() {
|
|||
memset(c2, 196, RGBwidth);
|
||||
}
|
||||
|
||||
// draw a marker of specified width and colour centred at freq and clrM
|
||||
inline void WFdisp::makeMarker_(int width, const RGB* color, int freq, const RGB* clrMin, RGB* clrM, const RGB* clrMax)
|
||||
{
|
||||
// clamp marker to image width
|
||||
int bw_lower = -width, bw_upper = width;
|
||||
if (bw_lower + static_cast<int>(freq+0.5) < 0)
|
||||
bw_lower -= bw_lower + static_cast<int>(freq+0.5);
|
||||
if (bw_upper + static_cast<int>(freq+0.5) > IMAGE_WIDTH)
|
||||
bw_upper -= bw_upper + static_cast<int>(freq+0.5) - IMAGE_WIDTH;
|
||||
|
||||
// draw it
|
||||
RGB* clrPos;
|
||||
for (int y = 0; y < WFMARKER - 2; y++) {
|
||||
for (int x = bw_lower; x < bw_upper; x++) {
|
||||
clrPos = clrM + x + y * IMAGE_WIDTH;
|
||||
if (clrPos > clrMin && clrPos < clrMax)
|
||||
*clrPos = *color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WFdisp::makeMarker() {
|
||||
RGB *clrMin, *clrMax, *clrM, *clrPos;
|
||||
RGB *clrMin, *clrMax, *clrM;
|
||||
clrMin = markerimage + IMAGE_WIDTH;
|
||||
clrMax = clrMin + (WFMARKER - 2) * IMAGE_WIDTH;
|
||||
memset(clrMin, 0, RGBwidth * (WFMARKER - 2));
|
||||
|
|
@ -219,19 +241,11 @@ void WFdisp::makeMarker() {
|
|||
RGBmarker.G = progdefaults.bwTrackRGBI.G;
|
||||
RGBmarker.B = progdefaults.bwTrackRGBI.B;
|
||||
|
||||
// clamp marker to image width
|
||||
bw = marker_width;
|
||||
int bw_lower = -bw, bw_upper = +bw;
|
||||
if (bw_lower + static_cast<int>(carrierfreq+0.5) < 0)
|
||||
bw_lower -= bw_lower + static_cast<int>(carrierfreq+0.5);
|
||||
if (bw_upper + static_cast<int>(carrierfreq+0.5) > IMAGE_WIDTH)
|
||||
bw_upper -= bw_upper + static_cast<int>(carrierfreq+0.5) - IMAGE_WIDTH;
|
||||
for (int y = 0; y < WFMARKER - 2; y++) {
|
||||
for (int i = bw_lower; i < bw_upper; i++) {
|
||||
clrPos = clrM + i + y * IMAGE_WIDTH;
|
||||
if (clrPos > clrMin && clrPos < clrMax)
|
||||
*clrPos = RGBmarker;
|
||||
}
|
||||
makeMarker_(marker_width, &RGBmarker, carrierfreq, clrMin, clrM, clrMax);
|
||||
if (unlikely(active_modem && active_modem->freqlocked())) {
|
||||
int txfreq = active_modem->get_txfreq();
|
||||
adjust_color_inv(RGBmarker.R, RGBmarker.G, RGBmarker.B, FL_BLACK, FL_RED);
|
||||
makeMarker_(bandwidth, &RGBmarker, txfreq, clrMin, clrMin + (int)((double)txfreq + 0.5), clrMax);
|
||||
}
|
||||
|
||||
if (!wantcursor) return;
|
||||
|
|
|
|||
|
|
@ -74,6 +74,17 @@ Fl_Color adjust_color(Fl_Color fg, Fl_Color bg)
|
|||
return fg;
|
||||
}
|
||||
|
||||
// invert colour (bg1r, bg1g, bg1b); return def if new colour does not make
|
||||
// good contrast with bg2
|
||||
void adjust_color_inv(unsigned char& bg1r, unsigned char& bg1g, unsigned char& bg1b,
|
||||
Fl_Color bg2, Fl_Color def)
|
||||
{
|
||||
bg1r = 255 - bg1r; bg1g = 255 - bg1g; bg1b = 255 - bg1b;
|
||||
Fl_Color adj = fl_rgb_color(bg1r, bg1g, bg1b);
|
||||
if (fl_contrast(adj, bg2) != adj)
|
||||
Fl::get_color((def >= 0 ? def : adj), bg1r, bg1g, bg1b);
|
||||
}
|
||||
|
||||
#if !defined(__APPLE__) && !defined(__WOE32__)
|
||||
# include <FL/Fl_Window.H>
|
||||
# include <FL/Fl_Pixmap.H>
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue