kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Upstream version 1.35q
rodzic
a140f84608
commit
ffb63c1c97
|
@ -12,6 +12,13 @@ Change Log:
|
|||
9) Corrected memory leak bugs found in version 1.34
|
||||
10) Added "Test" capability to save Rx or Tx waveforms in ".wav"
|
||||
format and to play them back for testing modem decoders.
|
||||
11) Replaced text editing widgets with new widgets capable of cut,
|
||||
copy and paste.
|
||||
12) Added new functions on text widget popup menus
|
||||
13) Added a QSY undo (right button press)
|
||||
14) Added a who is this capability to waterfall -- press right
|
||||
button and hold on a signal and decoding occurs on that signal.
|
||||
Release and decoding returns to normal tracking point.
|
||||
1.34 1) Cleaned up unused code segments
|
||||
2) Modified CW decoder to allow setting upper and lower limits on
|
||||
Tx WPM
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <cstring>
|
||||
|
||||
#include "TextView.h"
|
||||
#include "main.h"
|
||||
|
@ -41,33 +39,36 @@
|
|||
using namespace std;
|
||||
|
||||
|
||||
Fl_Menu_Item viewmenu[] = {
|
||||
{"@-9-> Call", 0, 0 },
|
||||
{"@-9-> Name", 0, 0 },
|
||||
{"@-9-> QTH", 0, 0 },
|
||||
{"@-9-> Locator", 0, 0 },
|
||||
{"@-9-> RSTin", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Insert divider", 0, 0 },
|
||||
{"Clear", 0, 0 },
|
||||
{"Copy", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Save to file...", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Word wrap", 0, 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE } ,
|
||||
Fl_Menu_Item TextView::viewmenu[] = {
|
||||
{"@-9$returnarrow &QRZ this call", 0, 0 },
|
||||
{"@-9-> &Call", 0, 0 },
|
||||
{"@-9-> &Name", 0, 0 },
|
||||
{"@-9-> QT&H", 0, 0 },
|
||||
{"@-9-> &Locator", 0, 0 },
|
||||
{"@-9-> &RSTin", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Insert divider", 0, 0 },
|
||||
{"C&lear", 0, 0 },
|
||||
{"&Copy", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Save to &file...", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Word &wrap", 0, 0, 0, FL_MENU_TOGGLE },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
Fl_Text_Display::Style_Table_Entry TextView::styles[NSTYLES];
|
||||
|
||||
TextView::TextView(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Text_Display(x, y, w, h, l)
|
||||
: Fl_Text_Display(x, y, w, h, l), wrap(true)
|
||||
{
|
||||
tbuf = new Fl_Text_Buffer;
|
||||
sbuf = new Fl_Text_Buffer;
|
||||
|
||||
buffer(tbuf);
|
||||
highlight_data(sbuf, styles, NSTYLES, 'A', 0, 0);
|
||||
tbuf->add_modify_callback(changed_cb, this);
|
||||
cursor_style(Fl_Text_Display::BLOCK_CURSOR);
|
||||
|
||||
wrap_mode();
|
||||
wrap_mode(wrap, 0);
|
||||
scrollbar_width((int)floor(scrollbar_width() * 3.0/4.0));
|
||||
|
||||
// set some defaults
|
||||
setFont(FL_COURIER);
|
||||
|
@ -97,32 +98,46 @@ int TextView::handle(int event)
|
|||
show_cursor(1);
|
||||
if (tbuf->selected())
|
||||
redraw();
|
||||
return 1;
|
||||
case FL_ENTER:
|
||||
show_cursor(1);
|
||||
return 1;
|
||||
break;
|
||||
case FL_PUSH:
|
||||
if (Fl::event_button() == FL_RIGHT_MOUSE) {
|
||||
if (!(Fl::event_inside(this) && Fl::focus() == this))
|
||||
break;
|
||||
if ( !(Fl::event_inside(this) && Fl::event_button() == FL_RIGHT_MOUSE) )
|
||||
break;
|
||||
|
||||
const Fl_Menu_Item * m;
|
||||
int xpos = Fl::event_x();
|
||||
int ypos = Fl::event_y();
|
||||
const Fl_Menu_Item * m;
|
||||
int xpos = Fl::event_x();
|
||||
int ypos = Fl::event_y();
|
||||
|
||||
popx = xpos - x();
|
||||
popy = ypos - y();
|
||||
m = viewmenu->popup(xpos, ypos, 0, 0, 0);
|
||||
if (m) {
|
||||
int msize = sizeof(viewmenu) / sizeof(viewmenu[0]);
|
||||
for (int i = 0; i < msize; i++)
|
||||
if (m == &viewmenu[i]) {
|
||||
menu_cb(i);
|
||||
break;
|
||||
}
|
||||
if (tbuf->length())
|
||||
viewmenu[RX_MENU_CLEAR].flags &= ~FL_MENU_INACTIVE;
|
||||
else
|
||||
viewmenu[RX_MENU_CLEAR].flags |= FL_MENU_INACTIVE;
|
||||
|
||||
if (tbuf->selected())
|
||||
viewmenu[RX_MENU_COPY].flags &= ~FL_MENU_INACTIVE;
|
||||
else
|
||||
viewmenu[RX_MENU_COPY].flags |= FL_MENU_INACTIVE;
|
||||
if (wrap)
|
||||
viewmenu[RX_MENU_WRAP].flags |= FL_MENU_VALUE;
|
||||
else
|
||||
viewmenu[RX_MENU_WRAP].flags &= ~FL_MENU_VALUE;
|
||||
|
||||
popx = xpos - x();
|
||||
popy = ypos - y();
|
||||
m = viewmenu->popup(xpos, ypos, 0, 0, 0);
|
||||
if (m) {
|
||||
int msize = sizeof(viewmenu) / sizeof(viewmenu[0]);
|
||||
for (int i = 0; i < msize; i++) {
|
||||
if (m == &viewmenu[i]) {
|
||||
menu_cb(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -151,10 +166,6 @@ void TextView::add(char c, int attr)
|
|||
break;
|
||||
}
|
||||
|
||||
// if we are displaying the last line we should scroll down to keep it visible
|
||||
if (mTopLineNum + mNVisibleLines > mNBufferLines)
|
||||
scroll(mNBufferLines - 1, 0);
|
||||
|
||||
redraw();
|
||||
Fl::unlock();
|
||||
Fl::awake();
|
||||
|
@ -212,6 +223,11 @@ void TextView::menu_cb(int val)
|
|||
handle(FL_UNFOCUS);
|
||||
switch (val) {
|
||||
char *s;
|
||||
case RX_MENU_QRZ_THIS:
|
||||
menu_cb(RX_MENU_CALL);
|
||||
extern void QRZquery();
|
||||
QRZquery();
|
||||
break;
|
||||
case RX_MENU_CALL:
|
||||
s = get_word(popx, popy);
|
||||
inpCall->value(s);
|
||||
|
@ -254,13 +270,28 @@ void TextView::menu_cb(int val)
|
|||
|
||||
case RX_MENU_WRAP:
|
||||
viewmenu[RX_MENU_WRAP].flags ^= FL_MENU_VALUE;
|
||||
wrap_mode(!wrap);
|
||||
wrap_mode((wrap = !wrap), 0);
|
||||
show_insert_position();
|
||||
break;
|
||||
}
|
||||
|
||||
// restoreFocus();
|
||||
}
|
||||
|
||||
void TextView::changed_cb(int pos, int nins, int ndel, int nsty, const char *dtext, void *arg)
|
||||
{
|
||||
TextView *v = (TextView *)arg;
|
||||
|
||||
// if we are displaying the last line we should scroll down to keep it visible
|
||||
if (v->mTopLineNum + v->mNVisibleLines > v->mNBufferLines)
|
||||
v->scroll(v->mNBufferLines - 1, 0);
|
||||
if (!v->wrap) {
|
||||
// keep the cursor at the end of the buffer; this does not affect mouse
|
||||
// selections or scrolling
|
||||
v->insert_position(v->tbuf->length());
|
||||
v->show_insert_position();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// caller must free() returned string
|
||||
char *TextView::get_word(int x, int y)
|
||||
{
|
||||
|
@ -289,27 +320,30 @@ void TextView::clipboard_copy(void)
|
|||
}
|
||||
}
|
||||
|
||||
void TextView::wrap_mode(bool v)
|
||||
#ifdef HSCROLLBAR_KLUDGE
|
||||
void TextView::resize(int X, int Y, int W, int H)
|
||||
{
|
||||
int row, col;
|
||||
|
||||
xy_to_rowcol(this->x(), this->y(), &row, &col, Fl_Text_Display::CHARACTER_POS);
|
||||
Fl_Text_Display::wrap_mode(wrap = v, col);
|
||||
Fl_Text_Display::resize(X, Y, W, H);
|
||||
if (!wrap || !mVScrollBar->visible())
|
||||
return;
|
||||
# include "TextView_resize.cxx"
|
||||
}
|
||||
#endif // HSCROLLBAR_KLUDGE
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
||||
Fl_Menu_Item editmenu[] = {
|
||||
{"Transmit", 0, 0 },
|
||||
{"Receive", 0, 0 },
|
||||
{"MFSK16 image...", 0, 0, 0, FL_MENU_DIVIDER},
|
||||
{"Clear", 0, 0, },
|
||||
{"Cut", 0, 0, },
|
||||
{"Copy", 0, 0, },
|
||||
{"Paste", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Insert file...", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Word wrap", 0, 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE } ,
|
||||
|
||||
Fl_Menu_Item TextEdit::editmenu[] = {
|
||||
{"&Transmit", 0, 0 },
|
||||
{"&Receive", 0, 0 },
|
||||
{"Send &image...", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"C&lear", 0, 0, },
|
||||
{"Cu&t", 0, 0, },
|
||||
{"&Copy", 0, 0, },
|
||||
{"&Paste", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Append &file...", 0, 0, 0, FL_MENU_DIVIDER },
|
||||
{"Word &wrap", 0, 0, 0, FL_MENU_TOGGLE } ,
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
@ -317,7 +351,8 @@ Fl_Text_Display::Style_Table_Entry TextEdit::styles[NSTYLES];
|
|||
int *TextEdit::ptxpos = 0; // needed by our static kf functions
|
||||
|
||||
TextEdit::TextEdit(int x, int y, int w, int h, const char *l)
|
||||
: Fl_Text_Editor(x, y, w, h, l), PauseBreak(false), txpos(0), bkspaces(0)
|
||||
: Fl_Text_Editor(x, y, w, h, l), PauseBreak(false), txpos(0),
|
||||
bkspaces(0), wrap(true)
|
||||
{
|
||||
ptxpos = &txpos;
|
||||
|
||||
|
@ -327,9 +362,10 @@ TextEdit::TextEdit(int x, int y, int w, int h, const char *l)
|
|||
cursor_style(Fl_Text_Display::NORMAL_CURSOR);
|
||||
buffer(tbuf);
|
||||
highlight_data(sbuf, styles, NSTYLES, 'A', 0, 0);
|
||||
tbuf->add_modify_callback(style_cb, this);
|
||||
tbuf->add_modify_callback(changed_cb, this);
|
||||
|
||||
wrap_mode();
|
||||
wrap_mode(wrap, 0);
|
||||
scrollbar_width((int)floor(scrollbar_width() * 3.0/4.0));
|
||||
|
||||
// set some defaults
|
||||
setFont(-1, FL_COURIER);
|
||||
|
@ -351,38 +387,57 @@ int TextEdit::handle(int event)
|
|||
{
|
||||
if (event == FL_KEYBOARD) {
|
||||
autolock txlock;
|
||||
if (handle_key(Fl::event_key()))
|
||||
return 1;
|
||||
else
|
||||
return Fl_Text_Editor::handle(event);
|
||||
return handle_key(Fl::event_key()) ? 1 : Fl_Text_Editor::handle(event);
|
||||
}
|
||||
if (Fl::event_inside( this )) {
|
||||
const Fl_Menu_Item * m;
|
||||
int xpos = Fl::event_x();
|
||||
int ypos = Fl::event_y();
|
||||
if ( !(Fl::event_inside(this) && event == FL_PUSH &&
|
||||
Fl::event_button() == FL_RIGHT_MOUSE) )
|
||||
return Fl_Text_Editor::handle(event);
|
||||
|
||||
if (event == FL_PUSH && Fl::event_button() == FL_RIGHT_MOUSE) {
|
||||
popx = xpos - x();
|
||||
popy = ypos - y();
|
||||
m = editmenu->popup(xpos, ypos, 0, 0, 0);
|
||||
if (m) {
|
||||
int msize = sizeof(editmenu) / sizeof(editmenu[0]);
|
||||
for (int i = 0; i < msize; i++)
|
||||
if (m == &editmenu[i]) {
|
||||
menu_cb(i);
|
||||
break;
|
||||
}
|
||||
// handle a right click
|
||||
const Fl_Menu_Item * m;
|
||||
int xpos = Fl::event_x();
|
||||
int ypos = Fl::event_y();
|
||||
|
||||
if (active_modem != mfsk16_modem)
|
||||
editmenu[TX_MENU_MFSK16_IMG].flags |= FL_MENU_INACTIVE;
|
||||
else
|
||||
editmenu[TX_MENU_MFSK16_IMG].flags &= ~FL_MENU_INACTIVE;
|
||||
if (tbuf->length())
|
||||
editmenu[TX_MENU_CLEAR].flags &= ~FL_MENU_INACTIVE;
|
||||
else
|
||||
editmenu[TX_MENU_CLEAR].flags |= FL_MENU_INACTIVE;
|
||||
if (tbuf->selected()) {
|
||||
editmenu[TX_MENU_CUT].flags &= ~FL_MENU_INACTIVE;
|
||||
editmenu[TX_MENU_COPY].flags &= ~FL_MENU_INACTIVE;
|
||||
}
|
||||
else {
|
||||
editmenu[TX_MENU_CUT].flags |= FL_MENU_INACTIVE;
|
||||
editmenu[TX_MENU_COPY].flags |= FL_MENU_INACTIVE;
|
||||
}
|
||||
if (wrap)
|
||||
editmenu[TX_MENU_WRAP].flags |= FL_MENU_VALUE;
|
||||
else
|
||||
editmenu[TX_MENU_WRAP].flags &= ~FL_MENU_VALUE;
|
||||
|
||||
popx = xpos - x();
|
||||
popy = ypos - y();
|
||||
m = editmenu->popup(xpos, ypos, 0, 0, 0);
|
||||
if (m) {
|
||||
int msize = sizeof(editmenu) / sizeof(editmenu[0]);
|
||||
for (int i = 0; i < msize; i++)
|
||||
if (m == &editmenu[i]) {
|
||||
menu_cb(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Fl_Text_Editor::handle(event);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void TextEdit::add(const char *s, int attr)
|
||||
{
|
||||
tbuf->append(s);
|
||||
insert_position(tbuf->length());
|
||||
show_insert_position();
|
||||
}
|
||||
void TextEdit::clear(void)
|
||||
{
|
||||
|
@ -413,7 +468,9 @@ int TextEdit::nextChar(void)
|
|||
else {
|
||||
if ((c = tbuf->character(txpos)))
|
||||
++txpos;
|
||||
tbuf->call_modify_callbacks();
|
||||
// we do not call tbuf->call_modify_callbacks() here
|
||||
// because we are only updating the style buffer
|
||||
changed_cb(0, 0, 0, 0, 0, this);
|
||||
redraw();
|
||||
}
|
||||
|
||||
|
@ -585,10 +642,11 @@ void TextEdit::readFile(void)
|
|||
if (fn) {
|
||||
tbuf->appendfile(fn);
|
||||
insert_position(tbuf->length());
|
||||
show_insert_position();
|
||||
}
|
||||
}
|
||||
|
||||
void TextEdit::style_cb(int pos, int nins, int ndel, int nsty, const char *dtext, void *arg)
|
||||
void TextEdit::changed_cb(int pos, int nins, int ndel, int nsty, const char *dtext, void *arg)
|
||||
{
|
||||
TextEdit *e = (TextEdit *)arg;
|
||||
|
||||
|
@ -654,33 +712,24 @@ void TextEdit::menu_cb(int val)
|
|||
|
||||
case TX_MENU_WRAP:
|
||||
editmenu[TX_MENU_WRAP].flags ^= FL_MENU_VALUE;
|
||||
wrap_mode(!wrap);
|
||||
wrap_mode((wrap = !wrap), 0);
|
||||
show_insert_position();
|
||||
break;
|
||||
}
|
||||
restoreFocus();
|
||||
}
|
||||
|
||||
void TextEdit::wrap_mode(bool v)
|
||||
{
|
||||
int row, col;
|
||||
|
||||
xy_to_rowcol(this->x(), this->y(), &row, &col, Fl_Text_Display::CHARACTER_POS);
|
||||
Fl_Text_Display::wrap_mode(wrap = v, col);
|
||||
}
|
||||
|
||||
|
||||
void TextEdit::change_keybindings(void)
|
||||
{
|
||||
struct {
|
||||
Fl_Text_Editor::Key_Func function;
|
||||
Fl_Text_Editor::Key_Func override;
|
||||
Fl_Text_Editor::Key_Func function, override;
|
||||
} fbind[] = { { Fl_Text_Editor::kf_default, TextEdit::kf_default },
|
||||
{ Fl_Text_Editor::kf_enter, TextEdit::kf_enter },
|
||||
{ Fl_Text_Editor::kf_delete, TextEdit::kf_delete },
|
||||
{ Fl_Text_Editor::kf_cut, TextEdit::kf_cut },
|
||||
{ Fl_Text_Editor::kf_paste, TextEdit::kf_paste } };
|
||||
|
||||
int n = sizeof(fbind) / sizeof(fbind[0]);
|
||||
|
||||
for (Fl_Text_Editor::Key_Binding *k = key_bindings; k; k = k->next) {
|
||||
for (int i = 0; i < n; i++)
|
||||
if (fbind[i].function == k->function)
|
||||
|
@ -740,3 +789,14 @@ int TextEdit::kf_paste(int c, Fl_Text_Editor* e)
|
|||
autolock txlock;
|
||||
return e->insert_position() < *ptxpos ? 1 : Fl_Text_Editor::kf_paste(c, e);
|
||||
}
|
||||
|
||||
|
||||
#ifdef HSCROLLBAR_KLUDGE
|
||||
void TextEdit::resize(int X, int Y, int W, int H)
|
||||
{
|
||||
Fl_Text_Editor::resize(X, Y, W, H);
|
||||
if (!wrap || !mVScrollBar->visible())
|
||||
return;
|
||||
# include "TextView_resize.cxx"
|
||||
}
|
||||
#endif // HSCROLLBAR_KLUDGE
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
// This code is part of Fl_Text_Display::resize from fltk 1.1.7, modified
|
||||
// to not hide the horizontal scrollbar when word wrapping is enabled.
|
||||
|
||||
#define TOP_MARGIN 1
|
||||
#define BOTTOM_MARGIN 1
|
||||
#define LEFT_MARGIN 3
|
||||
#define RIGHT_MARGIN 3
|
||||
|
||||
const int oldWidth = w();
|
||||
|
||||
mHScrollBar->clear_visible();
|
||||
mVScrollBar->resize(mVScrollBar->x(), mVScrollBar->y(),
|
||||
mVScrollBar->w(), mVScrollBar->h() + scrollbar_width());
|
||||
|
||||
text_area.h += scrollbar_width();
|
||||
if (scrollbar_align() & FL_ALIGN_TOP)
|
||||
text_area.y -= scrollbar_width();
|
||||
mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y,
|
||||
text_area.w+LEFT_MARGIN+RIGHT_MARGIN, scrollbar_width());
|
||||
|
||||
|
||||
if (mContinuousWrap && !mWrapMargin && W!=oldWidth) {
|
||||
int oldFirstChar = mFirstChar;
|
||||
mNBufferLines = count_lines(0, buffer()->length(), true);
|
||||
mFirstChar = line_start(mFirstChar);
|
||||
mTopLineNum = count_lines(0, mFirstChar, true)+1;
|
||||
absolute_top_line_number(oldFirstChar);
|
||||
}
|
||||
|
||||
int nvlines = (text_area.h + mMaxsize - 1) / mMaxsize;
|
||||
if (nvlines < 1) nvlines = 1;
|
||||
if (mNVisibleLines != nvlines) {
|
||||
mNVisibleLines = nvlines;
|
||||
if (mLineStarts) delete[] mLineStarts;
|
||||
mLineStarts = new int [mNVisibleLines];
|
||||
}
|
||||
|
||||
calc_line_starts(0, mNVisibleLines);
|
||||
calc_last_char();
|
||||
|
||||
// user request to change viewport
|
||||
if (mTopLineNumHint != mTopLineNum || mHorizOffsetHint != mHorizOffset)
|
||||
scroll_(mTopLineNumHint, mHorizOffsetHint);
|
||||
|
||||
// everything will fit in the viewport
|
||||
if (mNBufferLines < mNVisibleLines || mBuffer == NULL || mBuffer->length() == 0)
|
||||
scroll_(1, mHorizOffset);
|
||||
/* if empty lines become visible, there may be an opportunity to
|
||||
display more text by scrolling down */
|
||||
else while (mLineStarts[mNVisibleLines-2] == -1)
|
||||
scroll_(mTopLineNum-1, mHorizOffset);
|
||||
|
||||
// in case horizontal offset is now greater than longest line
|
||||
int maxhoffset = max(0, longest_vline()-text_area.w);
|
||||
if (mHorizOffset > maxhoffset)
|
||||
scroll_(mTopLineNumHint, maxhoffset);
|
||||
|
||||
mTopLineNumHint = mTopLineNum;
|
||||
mHorizOffsetHint = mHorizOffset;
|
||||
display_insert_position_hint = 0;
|
||||
|
||||
if (mContinuousWrap)
|
||||
redraw();
|
||||
|
||||
update_v_scrollbar();
|
||||
update_h_scrollbar();
|
|
@ -43,6 +43,15 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
#if (FL_MAJOR_VERSION == 1 && FL_MINOR_VERSION == 1 && \
|
||||
FL_PATCH_VERSION == 7 || FL_PATCH_VERSION == 8) && \
|
||||
!defined(NO_HSCROLLBAR_KLUDGE)
|
||||
# define HSCROLLBAR_KLUDGE
|
||||
#else
|
||||
# warning "Not suppressing horizontal scrollbars with this version of fltk"
|
||||
# undef HSCROLLBAR_KLUDGE
|
||||
#endif
|
||||
|
||||
class TextView : public Fl_Text_Display
|
||||
{
|
||||
public:
|
||||
|
@ -62,21 +71,25 @@ public:
|
|||
void setFont(int n, Fl_Font f);
|
||||
void setFontSize(int n, int s);
|
||||
void setFontColor(int n, Fl_Color c);
|
||||
#ifdef HSCROLLBAR_KLUDGE
|
||||
void resize(int X, int Y, int W, int H);
|
||||
#endif
|
||||
|
||||
public:
|
||||
enum TV_ATTR {RCV, XMT};
|
||||
enum { NSTYLES = 16 };
|
||||
|
||||
protected:
|
||||
enum { RX_MENU_CALL, RX_MENU_NAME, RX_MENU_QTH, RX_MENU_LOC,
|
||||
RX_MENU_RST_IN, RX_MENU_DIV, RX_MENU_CLEAR, RX_MENU_COPY,
|
||||
RX_MENU_SAVE, RX_MENU_WRAP };
|
||||
enum { RX_MENU_QRZ_THIS, RX_MENU_CALL, RX_MENU_NAME, RX_MENU_QTH,
|
||||
RX_MENU_LOC, RX_MENU_RST_IN, RX_MENU_DIV, RX_MENU_CLEAR,
|
||||
RX_MENU_COPY, RX_MENU_SAVE, RX_MENU_WRAP };
|
||||
void draw(void);
|
||||
void menu_cb(int val);
|
||||
static void changed_cb(int pos, int nins, int ndel, int nsty,
|
||||
const char *dtext, void *arg);
|
||||
char *get_word(int x, int y);
|
||||
void saveFile(void);
|
||||
void clipboard_copy(void);
|
||||
void wrap_mode(bool v = true);
|
||||
|
||||
private:
|
||||
TextView();
|
||||
|
@ -84,10 +97,12 @@ private:
|
|||
protected:
|
||||
Fl_Text_Buffer *tbuf, *sbuf;
|
||||
static Fl_Text_Display::Style_Table_Entry styles[NSTYLES];
|
||||
static Fl_Menu_Item viewmenu[];
|
||||
int popx, popy;
|
||||
bool wrap;
|
||||
};
|
||||
|
||||
|
||||
class TextEdit : public Fl_Text_Editor
|
||||
{
|
||||
public:
|
||||
|
@ -106,6 +121,9 @@ public:
|
|||
void setFontSize(int s) { setFontSize(-1, s); }
|
||||
void setFontColor(Fl_Color c) { setFontColor(-1, c); }
|
||||
void cursorON(void);
|
||||
#ifdef HSCROLLBAR_KLUDGE
|
||||
void resize(int X, int Y, int W, int H);
|
||||
#endif
|
||||
|
||||
public:
|
||||
enum { NSTYLES = 16 };
|
||||
|
@ -116,10 +134,9 @@ protected:
|
|||
TX_MENU_WRAP };
|
||||
int handle_key(int key);
|
||||
void readFile(void);
|
||||
static void style_cb(int pos, int nins, int ndel, int nsty,
|
||||
const char *dtext, void *arg);
|
||||
static void changed_cb(int pos, int nins, int ndel, int nsty,
|
||||
const char *dtext, void *arg);
|
||||
void menu_cb(int val);
|
||||
void wrap_mode(bool v = true);
|
||||
|
||||
void change_keybindings(void);
|
||||
static int kf_default(int c, Fl_Text_Editor* e);
|
||||
|
@ -134,6 +151,7 @@ private:
|
|||
protected:
|
||||
Fl_Text_Buffer *tbuf, *sbuf;
|
||||
static Fl_Text_Display::Style_Table_Entry styles[NSTYLES];
|
||||
static Fl_Menu_Item editmenu[];
|
||||
bool PauseBreak;
|
||||
int txpos;
|
||||
static int *ptxpos;
|
||||
|
|
|
@ -25,7 +25,7 @@ extern void get_riglist();
|
|||
extern void hamlib_close();
|
||||
extern bool hamlib_init(bool bPtt);
|
||||
extern void hamlib_set_ptt(int);
|
||||
extern void hamlib_set_qsy();
|
||||
extern void hamlib_set_qsy(long long f, long long fmid);
|
||||
extern int hamlib_setfreq(long int);
|
||||
extern int hamlib_setmode(rmode_t);
|
||||
extern rmode_t hamlib_getmode();
|
||||
|
|
|
@ -6,7 +6,7 @@ extern void rigMEM_init(void);
|
|||
extern void rigMEM_close(void);
|
||||
extern bool rigMEM_active(void);
|
||||
extern void setrigMEM_PTT (bool);
|
||||
extern void rigMEM_set_qsy(void);
|
||||
extern void rigMEM_set_qsy(long long f, long long fmid);
|
||||
extern bool rigMEM_CanPTT(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,7 @@ extern void rigCAT_close();
|
|||
extern bool rigCAT_init();
|
||||
|
||||
extern void rigCAT_set_ptt(int);
|
||||
extern void rigCAT_set_qsy();
|
||||
extern void rigCAT_set_qsy(long long f, long long fmid);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _VERSION_H
|
||||
#define _VERSION_H
|
||||
|
||||
#define FLDIGI_VERSION "1.35o"
|
||||
#define FLDIGI_VERSION "1.35q"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -184,42 +184,28 @@ void hamlib_set_ptt(int ptt)
|
|||
fl_unlock(&hamlib_mutex);
|
||||
}
|
||||
|
||||
void hamlib_set_qsy(void)
|
||||
void hamlib_set_qsy(long long f, long long fmid)
|
||||
{
|
||||
long int fmid;
|
||||
long int f;
|
||||
if (xcvr->isOnLine() == false)
|
||||
return;
|
||||
fl_lock(&hamlib_mutex);
|
||||
// this is the sweet spot frequency that is the center of the PBF in the rig
|
||||
if (active_modem->get_mode() == MODE_CW)
|
||||
fmid = (long int)progdefaults.CWsweetspot;
|
||||
else if (active_modem->get_mode() == MODE_RTTY)
|
||||
fmid = (long int)progdefaults.RTTYsweetspot;
|
||||
else
|
||||
fmid = (long int)progdefaults.PSKsweetspot;
|
||||
f = wf->rfcarrier();
|
||||
if (wf->USB())
|
||||
f += (wf->carrier() - fmid);
|
||||
else
|
||||
f -= (wf->carrier() - fmid);
|
||||
double fdbl = f;
|
||||
hamlib_qsy = false;
|
||||
try {
|
||||
xcvr->setFreq(fdbl);
|
||||
if (active_modem->freqlocked() == true) {
|
||||
active_modem->set_freqlock(false);
|
||||
active_modem->set_freq((int)fmid);
|
||||
active_modem->set_freqlock(true);
|
||||
} else
|
||||
active_modem->set_freq((int)fmid);
|
||||
wf->rfcarrier(f);
|
||||
wf->movetocenter();
|
||||
}
|
||||
catch (RigException Ex) {
|
||||
show_error("QSY", Ex.message);
|
||||
hamlib_passes = 0;
|
||||
}
|
||||
double fdbl = f;
|
||||
hamlib_qsy = false;
|
||||
try {
|
||||
xcvr->setFreq(fdbl);
|
||||
if (active_modem->freqlocked() == true) {
|
||||
active_modem->set_freqlock(false);
|
||||
active_modem->set_freq((int)fmid);
|
||||
active_modem->set_freqlock(true);
|
||||
} else
|
||||
active_modem->set_freq((int)fmid);
|
||||
wf->rfcarrier(f);
|
||||
wf->movetocenter();
|
||||
}
|
||||
catch (RigException Ex) {
|
||||
show_error("QSY", Ex.message);
|
||||
hamlib_passes = 0;
|
||||
}
|
||||
fl_unlock(&hamlib_mutex);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@ static bool rigMEM_PTT = PTT_OFF;
|
|||
static bool rig_qsy = false;
|
||||
static bool TogglePTT = false;
|
||||
static bool rigMEMisPTT = false;
|
||||
static long long qsy_f;
|
||||
static long long qsy_fmid;
|
||||
|
||||
struct ST_SHMEM {
|
||||
int flag;
|
||||
|
@ -130,11 +132,13 @@ void setrigMEM_PTT (bool on)
|
|||
TogglePTT = true;
|
||||
}
|
||||
|
||||
void rigMEM_set_qsy(void)
|
||||
void rigMEM_set_qsy(long long f, long long fmid)
|
||||
{
|
||||
if (!rigMEM_enabled)
|
||||
return;
|
||||
|
||||
qsy_f = f;
|
||||
qsy_fmid = fmid;
|
||||
rig_qsy = true;
|
||||
}
|
||||
|
||||
|
@ -153,31 +157,16 @@ static void *rigMEM_loop(void *args)
|
|||
// MilliSleep(20);
|
||||
|
||||
if (rig_qsy) {
|
||||
long int fmid;
|
||||
long int f0 = wf->carrier();
|
||||
|
||||
// this is the sweet spot frequency that is the center of the PBF in the rig
|
||||
if (active_modem->get_mode() == MODE_CW)
|
||||
fmid = (long int)progdefaults.CWsweetspot;
|
||||
else if (active_modem->get_mode() == MODE_RTTY)
|
||||
fmid = (long int)progdefaults.RTTYsweetspot;
|
||||
else
|
||||
fmid = (long int)progdefaults.PSKsweetspot;
|
||||
|
||||
if (wf->USB())
|
||||
freqflag->freq += (f0 - fmid);
|
||||
else
|
||||
freqflag->freq -= (f0 - fmid);
|
||||
|
||||
freqflag->freq = qsy_f;
|
||||
freqflag->flag = -2; // set frequency
|
||||
MilliSleep(20);
|
||||
if (active_modem->freqlocked() == true) {
|
||||
active_modem->set_freqlock(false);
|
||||
active_modem->set_freq((int)fmid);
|
||||
active_modem->set_freq((int)qsy_fmid);
|
||||
active_modem->set_freqlock(true);
|
||||
} else
|
||||
active_modem->set_freq((int)fmid);
|
||||
wf->carrier((int)fmid);
|
||||
active_modem->set_freq((int)qsy_fmid);
|
||||
wf->carrier((int)qsy_fmid);
|
||||
wf->rfcarrier(freqflag->freq);
|
||||
wf->movetocenter();
|
||||
rig_qsy = false;
|
||||
|
|
|
@ -833,35 +833,22 @@ void rigCAT_set_ptt(int ptt)
|
|||
fl_unlock(&rigCAT_mutex);
|
||||
}
|
||||
|
||||
void rigCAT_set_qsy(void)
|
||||
void rigCAT_set_qsy(long long f, long long fmid)
|
||||
{
|
||||
long long fmid;
|
||||
long long f;
|
||||
if (rigCAT_open == false)
|
||||
return;
|
||||
// this is the sweet spot frequency that is the center of the PBF in the rig
|
||||
if (active_modem->get_mode() == MODE_CW)
|
||||
fmid = (long long)progdefaults.CWsweetspot;
|
||||
else if (active_modem->get_mode() == MODE_RTTY)
|
||||
fmid = (long long)progdefaults.RTTYsweetspot;
|
||||
else
|
||||
fmid = (long long)progdefaults.PSKsweetspot;
|
||||
f = wf->rfcarrier();
|
||||
if (wf->USB())
|
||||
f += (wf->carrier() - fmid);
|
||||
else
|
||||
f -= (wf->carrier() - fmid);
|
||||
// send new freq to rig
|
||||
rigCAT_setfreq(f);
|
||||
|
||||
if (active_modem->freqlocked() == true) {
|
||||
active_modem->set_freqlock(false);
|
||||
active_modem->set_freq((int)fmid);
|
||||
active_modem->set_freqlock(true);
|
||||
} else
|
||||
active_modem->set_freq((int)fmid);
|
||||
wf->rfcarrier(f);
|
||||
wf->movetocenter();
|
||||
|
||||
// send new freq to rig
|
||||
rigCAT_setfreq(f);
|
||||
|
||||
if (active_modem->freqlocked() == true) {
|
||||
active_modem->set_freqlock(false);
|
||||
active_modem->set_freq((int)fmid);
|
||||
active_modem->set_freqlock(true);
|
||||
} else
|
||||
active_modem->set_freq((int)fmid);
|
||||
wf->rfcarrier(f);
|
||||
wf->movetocenter();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -630,7 +630,7 @@ int cSoundPA::Read(double *buf, int count)
|
|||
|
||||
float *rbuf = fbuf;
|
||||
|
||||
if (req_sample_rate != dev_sample_rate || rxppm != progdefaults.RX_corr) {
|
||||
if (req_sample_rate != dev_sample_rate || rxppm != 0) {
|
||||
resample(rbuf, ncount, count);
|
||||
rbuf = rx_src_data->data_out;
|
||||
count = rx_src_data->output_frames_gen;
|
||||
|
@ -650,7 +650,7 @@ int cSoundPA::write_samples(double *buf, int count)
|
|||
fbuf[2*i] = fbuf[2*i + 1] = buf[i];
|
||||
|
||||
float *wbuf = fbuf;
|
||||
if (req_sample_rate != dev_sample_rate || txppm != progdefaults.TX_corr) {
|
||||
if (req_sample_rate != dev_sample_rate || txppm != 0) {
|
||||
resample(wbuf, count);
|
||||
wbuf = tx_src_data->data_out;
|
||||
count = tx_src_data->output_frames_gen;
|
||||
|
@ -679,7 +679,7 @@ int cSoundPA::write_stereo(double *bufleft, double *bufright, int count)
|
|||
}
|
||||
|
||||
float *wbuf = fbuf;
|
||||
if (req_sample_rate != dev_sample_rate || txppm != progdefaults.TX_corr) {
|
||||
if (req_sample_rate != dev_sample_rate || txppm != 0) {
|
||||
resample(wbuf, count);
|
||||
wbuf = tx_src_data->data_out;
|
||||
count = tx_src_data->output_frames_gen;
|
||||
|
|
|
@ -792,10 +792,44 @@ void carrier_cb(Fl_Widget *w, void *v) {
|
|||
}
|
||||
|
||||
void qsy_cb(Fl_Widget *w, void *v) {
|
||||
rigCAT_set_qsy();
|
||||
rigMEM_set_qsy();
|
||||
static const int qrgs_size = 16 + 1;
|
||||
static struct qrg {
|
||||
long long f;
|
||||
long long fmid;
|
||||
} qrgs[qrgs_size], *top = qrgs, *p;
|
||||
|
||||
if (Fl::event_button() != FL_RIGHT_MOUSE) { // store
|
||||
if (top < qrgs + qrgs_size - 1)
|
||||
top++;
|
||||
else
|
||||
memmove(qrgs + 1, qrgs + 2, qrgs_size - 2);
|
||||
top->f = wf->rfcarrier();
|
||||
top->fmid = active_modem->get_freq();
|
||||
|
||||
p = qrgs;
|
||||
// this is the sweet spot frequency that is the center of the PBF in the rig
|
||||
if (active_modem->get_mode() == MODE_CW)
|
||||
p->fmid = (long long)progdefaults.CWsweetspot;
|
||||
else if (active_modem->get_mode() == MODE_RTTY)
|
||||
p->fmid = (long long)progdefaults.RTTYsweetspot;
|
||||
else
|
||||
p->fmid = (long long)progdefaults.PSKsweetspot;
|
||||
p->f = wf->rfcarrier();
|
||||
if (wf->USB())
|
||||
p->f += (wf->carrier() - p->fmid);
|
||||
else
|
||||
p->f -= (wf->carrier() - p->fmid);
|
||||
}
|
||||
else { // qsy to top of stack
|
||||
if (top == qrgs)
|
||||
return;
|
||||
p = top--;
|
||||
}
|
||||
|
||||
rigCAT_set_qsy(p->f, p->fmid);
|
||||
rigMEM_set_qsy(p->f, p->fmid);
|
||||
#ifndef NOHAMLIB
|
||||
hamlib_set_qsy();
|
||||
hamlib_set_qsy(p->f, p->fmid);
|
||||
#endif
|
||||
restoreFocus();
|
||||
}
|
||||
|
@ -1058,7 +1092,7 @@ waterfall::waterfall(int x0, int y0, int w0, int h0, char *lbl) :
|
|||
xpos = xpos + cwRef + wSpace;
|
||||
qsy = new Fl_Button(xpos, buttonrow, bwQsy, BTN_HEIGHT, "QSY");
|
||||
qsy->callback(qsy_cb, 0);
|
||||
qsy->tooltip("Cntr in Xcvr PB");
|
||||
qsy->tooltip("Cntr in Xcvr PB\nRight click to undo");
|
||||
qsy->deactivate();
|
||||
|
||||
xpos = xpos + bwQsy + wSpace;
|
||||
|
@ -1094,19 +1128,46 @@ int waterfall::handle(int event) {
|
|||
if (trx_state != STATE_RX)
|
||||
return 1;
|
||||
int xpos = Fl::event_x() - wfdisp->x();
|
||||
wfdisp->wantcursor = true;
|
||||
if (event == FL_MOVE) {
|
||||
|
||||
static int nucarrier, oldcarrier;
|
||||
switch (event) {
|
||||
case FL_MOVE:
|
||||
wfdisp->wantcursor = true;
|
||||
wfdisp->cursorpos = xpos;
|
||||
wfdisp->makeMarker();
|
||||
wfdisp->redrawCursor();
|
||||
} else if (event == FL_RELEASE) {
|
||||
int nucarrier;
|
||||
nucarrier = wfdisp->cursorFreq(xpos);
|
||||
active_modem->set_freq(nucarrier);
|
||||
carrier(nucarrier);
|
||||
active_modem->set_sigsearch(5);
|
||||
wfdisp->redrawCursor();
|
||||
restoreFocus();
|
||||
break;
|
||||
case FL_DRAG: case FL_PUSH:
|
||||
switch (Fl::event_button()) {
|
||||
case FL_RIGHT_MOUSE:
|
||||
wfdisp->wantcursor = false;
|
||||
if (event == FL_PUSH)
|
||||
oldcarrier = carrier();
|
||||
// fall through
|
||||
case FL_LEFT_MOUSE:
|
||||
nucarrier = wfdisp->cursorFreq(xpos);
|
||||
active_modem->set_freq(nucarrier);
|
||||
carrier(nucarrier);
|
||||
active_modem->set_sigsearch(5);
|
||||
wfdisp->redrawCursor();
|
||||
restoreFocus();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FL_RELEASE:
|
||||
switch (Fl::event_button()) {
|
||||
case FL_RIGHT_MOUSE:
|
||||
active_modem->set_freq(oldcarrier);
|
||||
carrier(oldcarrier);
|
||||
active_modem->set_sigsearch(5);
|
||||
wfdisp->redrawCursor();
|
||||
restoreFocus();
|
||||
break;
|
||||
case FL_LEFT_MOUSE:
|
||||
oldcarrier = nucarrier;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
} else if (wfdisp->wantcursor == true) {
|
||||
|
|
Ładowanie…
Reference in New Issue