Upstream version 2.08F

pull/2/head
Stelios Bounanos 2008-01-24 11:05:43 +00:00
rodzic 580cc21100
commit 3756b2e155
19 zmienionych plików z 445 dodań i 106 usunięć

Wyświetl plik

@ -9,3 +9,8 @@ EMAIL:
AUTHOR: Leigh L Klotz, Jr
CALLSIGN: WA5ZNU
EMAIL:
All authors can be contacted on the linuxham yahoo group
EMAIL: linuxham@yahoo.com

Wyświetl plik

@ -8,7 +8,8 @@ To compile fldigi you will need:
for the Boost C++ library.
* Version 1.1.x of the Fast Light Tool Kit (FLTK), with its
development libraries and headers.
development libraries and headers. Version 1.1.7 and pre-releases of
1.1.8 are known to work. FLTK's multi-threading support is required.
You should also install the libraries and headers for PortAudio, the
Portable audio I/O library. It is possible, but not recommended, to

Wyświetl plik

@ -4,13 +4,16 @@
# Copyright (C) 2007 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)
AC_PREREQ(2.61)
AC_INIT([fldigi], [2.08d], [w1hkj AT w1hkj DOT com])
AC_INIT([fldigi], [2.08F], [w1hkj AT w1hkj DOT com])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall foreign 1.9.6])
AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([src/main.cxx])
AC_CONFIG_HEADER([src/config.h])
AC_DEFINE(PACKAGE_HOME, ["http://www.w1hkj.com/Fldigi-2.x.html"], [Home page])
AC_DEFINE(PACKAGE_DOCS, ["http://www.w1hkj.com/FldigiHelp-2.0/index.html"], [Docs index])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

Wyświetl plik

@ -519,6 +519,14 @@ static void cb_inpQRZuserpassword(Fl_Input* o, void*) {
progdefaults.changed = true;
}
Fl_Button *btnQRZpasswordShow=(Fl_Button *)0;
static void cb_btnQRZpasswordShow(Fl_Button* o, void*) {
inpQRZuserpassword->type(inpQRZuserpassword->type() ^ FL_SECRET_INPUT);
inpQRZuserpassword->redraw();
o->label((inpQRZuserpassword->type() & FL_SECRET_INPUT) ? "Show" : "Hide");
}
Fl_Group *tabSoundCard=(Fl_Group *)0;
Fl_Tabs *tabsSoundCard=(Fl_Tabs *)0;
@ -1473,7 +1481,10 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
}
{ Fl_Input* o = inpQRZuserpassword = new Fl_Input(150, 160, 90, 25, "User password:");
o->callback((Fl_Callback*)cb_inpQRZuserpassword);
o->value(progdefaults.QRZuserpassword.c_str());
o->value(progdefaults.QRZuserpassword.c_str()); o->type(FL_SECRET_INPUT);
}
{ Fl_Button* o = btnQRZpasswordShow = new Fl_Button(245, 160, 50, 25, "Show");
o->callback((Fl_Callback*)cb_btnQRZpasswordShow);
}
o->end();
}

Wyświetl plik

@ -616,7 +616,14 @@ progdefaults.changed = true;}
callback {progdefaults.QRZuserpassword = o->value();
progdefaults.changed = true;}
xywh {150 160 90 25}
code0 {o->value(progdefaults.QRZuserpassword.c_str());}
code0 {o->value(progdefaults.QRZuserpassword.c_str()); o->type(FL_SECRET_INPUT);}
}
Fl_Button btnQRZpasswordShow {
label Show
callback {inpQRZuserpassword->type(inpQRZuserpassword->type() ^ FL_SECRET_INPUT);
inpQRZuserpassword->redraw();
o->label((inpQRZuserpassword->type() & FL_SECRET_INPUT) ? "Show" : "Hide");}
xywh {245 160 50 25}
}
}
Fl_Group tabSoundCard {

Wyświetl plik

@ -577,11 +577,74 @@ void cb_mnuSaveConfig(Fl_Menu_ *, void *) {
// restoreFocus();
//}
void cb_mnuAbout(Fl_Menu_*,void*) {
fl_message ("fldigi @@W1HKJ\n\nw1hkj@@w1hkj.com\n\nVersion - %s", PACKAGE_VERSION);
void cb_mnuAbout(Fl_Widget*, void*)
{
fl_message ("%s @@W1HKJ\n\n%s\n\n%s\n\nVersion %s", PACKAGE_NAME,
PACKAGE_BUGREPORT, PACKAGE_HOME, PACKAGE_VERSION);
restoreFocus();
}
void cb_mnuVisitURL(Fl_Widget*, void* arg)
{
const char* url = reinterpret_cast<const char *>(arg);
const char* browsers[] = { getenv("BROWSER"), "xdg-open", "sensible-brower",
"firefox", "mozilla" };
switch (fork()) {
case 0:
for (size_t i = 0; i < sizeof(browsers)/sizeof(browsers[0]); i++)
if (browsers[i])
execlp(browsers[i], browsers[i], url, (char*)0);
perror("Could not execute a web browser");
exit(EXIT_FAILURE);
case -1:
fl_alert("Could not run a web browser:\n%s\n\n"
"Open this URL manually:\n%s",
strerror(errno), url);
}
restoreFocus();
}
void cb_mnuCmdLineHelp(Fl_Widget*, void*)
{
extern std::string option_help;
fl_message_font(FL_SCREEN, FL_NORMAL_SIZE - 1);
fl_message("%s", option_help.c_str());
fl_message_font(FL_HELVETICA, FL_NORMAL_SIZE);
restoreFocus();
}
void cb_mnuBuildInfo(Fl_Widget*, void*)
{
extern void print_versions(std::ostream&);
std::ostringstream ss;
print_versions(ss);
std::string s = ss.str();
std::string::size_type i = 0;
// escape the at chars
while ((i = s.find('@', i)) != std::string::npos) {
s.insert(i, 1, '@');
i += 2;
}
fl_message_font(FL_SCREEN, FL_NORMAL_SIZE - 1);
fl_message("%s", s.c_str());
fl_message_font(FL_HELVETICA, FL_NORMAL_SIZE);
restoreFocus();
}
#ifndef NDEBUG
void cb_mnuFun(Fl_Widget*, void*)
{
fl_message("Sunspot creation underway!");
}
#endif
void cbTune(Fl_Widget *w, void *) {
Fl_Button *b = (Fl_Button *)w;
if (active_modem == wwv_modem || active_modem == anal_modem) {
@ -869,12 +932,23 @@ Fl_Menu_Item menu_[] = {
{"Modems", 0, (Fl_Callback*)cb_mnuConfigModems, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Save Config", 0, (Fl_Callback*)cb_mnuSaveConfig, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{" ", 0, 0, 0, FL_MENU_INACTIVE, FL_NORMAL_LABEL, 0, 14, 0},
{"Rig", 0, (Fl_Callback*)cb_mnuRig, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{" ", 0, 0, 0, FL_MENU_INACTIVE, FL_NORMAL_LABEL, 0, 14, 0},
{"Help", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{"About", 0, (Fl_Callback*)cb_mnuAbout, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
#ifndef NDEBUG
// settle the gmfsk vs fldigi argument once and for all
{"@-1circle Create sunspots", 0, cb_mnuFun, 0, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
#endif
{"Online documentation", 0, cb_mnuVisitURL, (void *)PACKAGE_DOCS, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Home page", 0, cb_mnuVisitURL, (void *)PACKAGE_HOME, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{"Command line options", 0, cb_mnuCmdLineHelp, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Build info", 0, cb_mnuBuildInfo, 0, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{"About", 0, cb_mnuAbout, 0, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{" ", 0, 0, 0, FL_MENU_INACTIVE, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
};
@ -933,8 +1007,72 @@ void make_pixmap(Pixmap *xpm, const char **data)
fl_end_offscreen();
}
int rightof(Fl_Widget* w)
{
int a = w->align();
if (a == FL_ALIGN_CENTER || a & FL_ALIGN_INSIDE)
return w->x() + w->w();
fl_font(FL_HELVETICA, FL_NORMAL_SIZE);
int lw = static_cast<int>(ceil(fl_width(w->label())));
if (a & (FL_ALIGN_TOP | FL_ALIGN_BOTTOM)) {
if (a & FL_ALIGN_LEFT)
return w->x() + MAX(w->w(), lw);
else if (a & FL_ALIGN_RIGHT)
return w->x() + w->w();
else
return w->x() + ((lw > w->w()) ? (lw - w->w())/2 : w->w());
}
else
return w->x() + w->w() + lw;
}
int leftof(Fl_Widget* w)
{
int a = w->align();
if (a == FL_ALIGN_CENTER || a & FL_ALIGN_INSIDE)
return w->x();
fl_font(FL_HELVETICA, FL_NORMAL_SIZE);
int lw = static_cast<int>(ceil(fl_width(w->label())));
if (a & (FL_ALIGN_TOP | FL_ALIGN_BOTTOM)) {
if (a & FL_ALIGN_LEFT)
return w->x();
else if (a & FL_ALIGN_RIGHT)
return w->x() - (lw > w->w() ? lw - w->w() : 0);
else
return w->x() - (lw > w->w() ? (lw - w->w())/2 : 0);
}
else {
if (a & FL_ALIGN_LEFT)
return w->x() - lw;
else
return w->x();
}
}
int above(Fl_Widget* w)
{
int a = w->align();
if (a == FL_ALIGN_CENTER || a & FL_ALIGN_INSIDE)
return w->y();
return (a & FL_ALIGN_TOP) ? w->y() + FL_NORMAL_SIZE : w->y();
}
int below(Fl_Widget* w)
{
int a = w->align();
if (a == FL_ALIGN_CENTER || a & FL_ALIGN_INSIDE)
return w->y() + w->h();
return (a & FL_ALIGN_BOTTOM) ? w->y() + w->h() + FL_NORMAL_SIZE : w->y() + w->h();
}
void create_fl_digi_main() {
int Y = 0;
int pad = wSpace, Y = 0;
fl_digi_main = new Fl_Double_Window(WNOM, HNOM, "fldigi");
mnu = new Fl_Menu_Bar(0, 0, WNOM - 142, Hmenu);
// FL_NORMAL_SIZE may have changed; update the menu items
@ -947,64 +1085,78 @@ void create_fl_digi_main() {
btnTune->type(FL_TOGGLE_BUTTON);
btnTune->callback(cbTune, 0);
btnMacroTimer = new Fl_Button(WNOM - 82, 0, 80, Hmenu);
btnMacroTimer = new Fl_Button(WNOM - 80 - pad, 0, 80, Hmenu);
btnMacroTimer->color(fl_rgb_color(255, 255, 100));
btnMacroTimer->labelcolor(FL_RED);
btnMacroTimer->callback(cbMacroTimerButton, 0);
btnMacroTimer->hide();
Fl_Box *bx = new Fl_Box(WNOM - 82, 0, 80, Hmenu,"");
Fl_Box *bx = new Fl_Box(WNOM - 80 - pad, 0, 80, Hmenu,"");
bx->box(FL_UP_BOX);
Y += Hmenu;
Fl_Group *qsoFrame = new Fl_Group(0,Y, WNOM, Hqsoframe);
inpFreq = new Fl_Input(2,Y + Hqsoframe/2 - 2, 85, Hqsoframe/2,"Freq: ");
Fl_Group *qsoFrame = new Fl_Group(0, Y, WNOM, Hqsoframe);
inpFreq = new Fl_Input(pad, Y + Hqsoframe/2 - pad, 85, Hqsoframe/2, "Frequency");
inpFreq->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
inpTime = new Fl_Input(89,Y + Hqsoframe/2 - 2, 45, Hqsoframe/2,"Time: ");
inpTime = new Fl_Input(rightof(inpFreq) + pad, Y + Hqsoframe/2 - pad, 45, Hqsoframe/2, "Time");
inpTime->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
qsoTime = new Fl_Button(136, Y + Hqsoframe/2 - 2, 24, Hqsoframe/2);
qsoTime = new Fl_Button(rightof(inpTime) + pad, Y + Hqsoframe/2 - pad, 24, Hqsoframe/2);
Fl_Image *pixmap = new Fl_Pixmap(cal_16);
qsoTime->image(pixmap);
qsoTime->callback(qsoTime_cb, 0);
inpCall = new Fl_Input(162,Y + Hqsoframe/2 - 2, 80,Hqsoframe/2,"Call: ");
inpCall = new Fl_Input(rightof(qsoTime) + pad, Y + Hqsoframe/2 - pad, 80, Hqsoframe/2, "Call");
inpCall->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
inpName = new Fl_Input(244,Y + Hqsoframe/2 - 2, 100,Hqsoframe/2,"Name: ");
// this is likely to be more readable in a constant width font
inpCall->textfont(FL_SCREEN);
inpName = new Fl_Input(rightof(inpCall) + pad, Y + Hqsoframe/2 - pad, 100, Hqsoframe/2, "Name");
inpName->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
inpRstIn = new Fl_Input(346,Y + Hqsoframe/2 - 2, 40,Hqsoframe/2,"Rst(r): ");
inpRstIn = new Fl_Input(rightof(inpName) + pad, Y + Hqsoframe/2 - pad, 40, Hqsoframe/2, "RST(r)");
inpRstIn->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
inpRstOut = new Fl_Input(388,Y + Hqsoframe/2 - 2, 40,Hqsoframe/2,"Rst(s): ");
inpRstOut = new Fl_Input(rightof(inpRstIn) + pad, Y + Hqsoframe/2 - pad, 40, Hqsoframe/2, "RST(s)");
inpRstOut->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
inpQth = new Fl_Input(430,Y + Hqsoframe/2 - 2, WNOM - 430 - 126,Hqsoframe/2,"Qth: ");
inpQth->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
inpLoc = new Fl_Input(WNOM - 124,Y + Hqsoframe/2 - 2, 80,Hqsoframe/2,"Loc: ");
inpLoc->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
qsoClear = new Fl_Button(WNOM - 42, Y + Hqsoframe/2 + 1, 40, Hqsoframe/2 - 2, "Clear");
qsoClear->callback(qsoClear_cb, 0);
btnQRZ = new Fl_Button( WNOM - 42, Y + 1, 40, Hqsoframe/2 - 2, "QRZ");
btnQRZ = new Fl_Button(WNOM - 40 - pad, Y + 1, 40, Hqsoframe/2 - pad, "QRZ");
btnQRZ->callback(cb_QRZ, 0);
inpLoc = new Fl_Input(leftof(btnQRZ) - pad - 80, Y + Hqsoframe/2 - pad, 80, Hqsoframe/2, "Locator");
inpLoc->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
inpLoc->textfont(FL_SCREEN);
inpQth = new Fl_Input(rightof(inpRstOut) + pad, Y + Hqsoframe/2 - pad,
leftof(inpLoc) - rightof(inpRstOut) - 2*pad, Hqsoframe/2, "QTH");
inpQth->align(FL_ALIGN_TOP | FL_ALIGN_LEFT);
qsoFrame->resizable(inpQth);
qsoClear = new Fl_Button(WNOM - 40 - pad, Y + Hqsoframe/2 + 1, 40, Hqsoframe/2 - pad, "Clear");
qsoClear->callback(qsoClear_cb, 0);
qsoFrame->end();
Y += Hqsoframe;
Fl_Group *qsoFrame2 = new Fl_Group(0,Y, WNOM, Hnotes);
qsoSave = new Fl_Button(WNOM - 40 - pad, Y + 1, 40, Hnotes - 2, "Save");
qsoSave->callback(qsoSave_cb, 0);
inpNotes = new Fl_Input(136, Y, WNOM - 136 - 44 - 120, Hnotes,"Notes: ");
inpNotes->align(FL_ALIGN_LEFT);
cboBand = new Fl_ComboBox(2, Y, 110, Hnotes, "");
cboBand->hide();
btnSideband = new Fl_Button(112, Y+1, Hnotes-2, Hnotes-2, "U");
btnSideband->callback(cb_btnSideband, 0);
btnSideband->hide();
inpAZ = new Fl_Input(WNOM - 44 - 80, Y, 80, Hnotes, "AZ:"); // WA5ZNU
inpAZ = new Fl_Input(leftof(qsoSave) - 80 - pad, Y, 80, Hnotes, "AZ"); // WA5ZNU
inpAZ->align(FL_ALIGN_LEFT);
qsoSave = new Fl_Button(WNOM - 42, Y + 1, 40, Hnotes- 2, "Save");
qsoSave->callback(qsoSave_cb, 0);
// align this vertically with the Call field
inpNotes = new Fl_Input(leftof(inpCall), Y, leftof(inpAZ) - leftof(inpCall) - 2*pad, Hnotes, "Notes");
inpNotes->align(FL_ALIGN_LEFT);
qsoFrame2->resizable(inpNotes);
btnSideband = new Fl_Button(leftof(inpNotes) - 2*pad - (Hnotes-2), Y+1, Hnotes-2, Hnotes-2, "U");
btnSideband->callback(cb_btnSideband, 0);
btnSideband->hide();
cboBand = new Fl_ComboBox(pad, Y, leftof(btnSideband) - pad, Hnotes, "");
cboBand->hide();
qsoFrame2->end();
Y += Hnotes;

Wyświetl plik

@ -258,7 +258,7 @@ void dominoex::decodesymbol(unsigned char curtone, unsigned char prevtone)
}
// Add to the symbol buffer. Position 0 is the newest symbol.
for (int i = MAX_VARICODE_LEN-1; i >= 0; i--)
for (int i = MAX_VARICODE_LEN-1; i > 0; i--)
symbolbuf[i] = symbolbuf[i-1];
symbolbuf[0] = c;

Wyświetl plik

@ -25,6 +25,8 @@
#include <config.h>
#include <iosfwd>
#include <iomanip>
#include <sstream>
#include "globals.h"
#include "modem.h"
@ -94,3 +96,36 @@ std::istream& operator>>(std::istream& s, qrg_mode_t& m)
{
return s >> m.rfcarrier >> m.rmode >> m.carrier >> m.mode;
}
std::string qrg_mode_t::str(void)
{
ostringstream s;
s << setiosflags(ios::fixed) << setprecision(3) << rfcarrier/1000.0 << '\t'
<< rmode << '\t'
<< (mode < NUM_MODES ? mode_info[mode].sname : "NONE") << '\t'
<< carrier;
return s.str();
// This an example of how we would do things if we were not using
// Fl_Browser and had to format the fields manually and add the string
// to a menu
// static unsigned max_mode_sname = 0;
// if (max_mode_sname == 0)
// for (size_t i = 0; i < NUM_MODES; i++)
// if (max_mode_sname < strlen(mode_info[i].sname))
// max_mode_sname = strlen(mode_info[i].sname);
// ostringstream s;
// s << setw(11) << setiosflags(ios::right) << setiosflags(ios::fixed) << setprecision(3)
// << rfcarrier/1000.0 << ' '
// << setw(max_mode_sname) << resetiosflags(ios::right) << setiosflags(ios::left)
// << (mode < NUM_MODES ? mode_info[mode].sname : "NONE") << ' '
// << setw(4) << resetiosflags(ios::left) << setiosflags(ios::right)
// << carrier << ' ' << rmode;
// return s.str();
}

Wyświetl plik

@ -75,6 +75,7 @@ extern Fl_Check_Button *btnQRZsocket;
extern Fl_Check_Button *btnQRZcdrom;
extern Fl_Input *inpQRZusername;
extern Fl_Input *inpQRZuserpassword;
extern Fl_Button *btnQRZpasswordShow;
extern Fl_Group *tabSoundCard;
extern Fl_Tabs *tabsSoundCard;
extern Fl_Group *tabAudio;

Wyświetl plik

@ -52,18 +52,18 @@ extern int WNOM;
#define WFMARKER 6
#define BTN_HEIGHT 20
#define bwColor 30
#define bwColor 25
#define bwFFT 30
#define bwX1 30
#define bwX1 20
#define bwMov 20
#define cwCnt 100
#define cwRef 50
#define cwMode 85
#define bwQsy 45
#define bwQsy 35
#define bwRate 45
#define bwXmtLock 45
#define bwRev 45
#define bwMem 45
#define bwXmtLock 40
#define bwRev 40
#define bwMem 37
#define bwXmtRcv 45
#define wSpace 2

Wyświetl plik

@ -119,6 +119,12 @@ public:
{
return rfcarrier < rhs.rfcarrier;
}
bool operator==(const qrg_mode_t& rhs) const
{
return rfcarrier == rhs.rfcarrier && rmode == rhs.rmode &&
carrier == rhs.carrier && mode == rhs.mode;
}
std::string str(void);
};
std::ostream& operator<<(std::ostream& s, const qrg_mode_t& m);
std::istream& operator>>(std::istream& s, qrg_mode_t& m);

Wyświetl plik

@ -26,7 +26,7 @@ extern void selBW(int);
extern void selFreq(long int);
extern void clearList();
extern void updateSelect();
extern void addtoList(long val);
extern size_t addtoList(long val);
extern void buildlist();
extern int movFreq();
extern void selectFreq();

Wyświetl plik

@ -388,8 +388,8 @@ void generate_option_help(void) {
help << "\nAdditional UI options:\n"
<< setw(width) << setiosflags(ios::left)
<< " --fast-text" << "Use fast text widgets\n"
// << setw(width) << setiosflags(ios::left)
// << " --fast-text" << "Use fast text widgets\n"
<< setw(width) << setiosflags(ios::left)
<< " --font FONT[:SIZE]"

Wyświetl plik

@ -51,10 +51,9 @@ static void cb_btnRCclose(Fl_Button*, void*) {
Fl_Double_Window* rig_dialog() {
Fl_Double_Window* w;
{ Fl_Double_Window* o = new Fl_Double_Window(390, 80, "Rig Controller");
{ Fl_Double_Window* o = new Fl_Double_Window(560, 80, "Rig Controller");
w = o;
o->box(FL_DOWN_BOX);
o->color((Fl_Color)23);
{ cFreqControl* o = FreqDisp = new cFreqControl(4, 31, 253, 44, "9");
o->box(FL_DOWN_BOX);
o->color(FL_BACKGROUND_COLOR);
@ -68,8 +67,8 @@ Fl_Double_Window* rig_dialog() {
o->setCallBack(movFreq);
o->SetONOFFCOLOR( FL_RED, FL_BLACK);
}
{ Fl_Browser* o = FreqSelect = new Fl_Browser(278, 5, 108, 70);
o->tooltip("Select operating frequency");
{ Fl_Browser* o = FreqSelect = new Fl_Browser(278, 5, 280, 70);
o->tooltip("Select operating mode and frequency");
o->type(2);
o->box(FL_DOWN_BOX);
o->labelfont(4);
@ -123,5 +122,14 @@ Fl_Double_Window* rig_dialog() {
}
o->end();
}
// Resizable kludge
// Move FreqSelect one pixel down so that we can define a box
// that will be used resize this widget only. There has to be
// a better way of doing this...
{
FreqSelect->resize(FreqSelect->x(), FreqSelect->y() + 1, FreqSelect->w(), FreqSelect->h());
Fl_Box* b_ = new Fl_Box(FreqSelect->x() + FreqSelect->w() - 1, FreqSelect->y() + FreqSelect->h() - 1, 1, 1);
w->add_resizable(*b_);
}
return w;
}

Wyświetl plik

@ -10,7 +10,7 @@ Function {rig_dialog()} {open
} {
Fl_Window {} {
label {Rig Controller} open selected
xywh {667 300 390 80} type Double box DOWN_BOX color 23
xywh {667 300 560 80} type Double box DOWN_BOX
code0 {\#include <stdlib.h>} visible
} {
Fl_Box FreqDisp {
@ -25,7 +25,7 @@ Function {rig_dialog()} {open
Fl_Browser FreqSelect {
callback {if (FreqSelect->value())
(Fl::event_state() & FL_SHIFT) ? delFreq() : selectFreq();}
tooltip {Select operating frequency} xywh {278 5 108 70} type Hold box DOWN_BOX labelfont 4 labelsize 12 textfont 4
tooltip {Select operating mode and frequency} xywh {278 5 280 70} type Hold box DOWN_BOX labelfont 4 labelsize 12 textfont 4
}
Fl_Group opMODE {
callback {setMode();} open
@ -61,4 +61,13 @@ Function {rig_dialog()} {open
code0 {extern void closeRigDialog();}
}
}
code {// Resizable kludge
// Move FreqSelect one pixel down so that we can define a box
// that will be used resize this widget only. There has to be
// a better way of doing this...
{
FreqSelect->resize(FreqSelect->x(), FreqSelect->y() + 1, FreqSelect->w(), FreqSelect->h());
Fl_Box* b_ = new Fl_Box(FreqSelect->x() + FreqSelect->w() - 1, FreqSelect->y() + FreqSelect->h() - 1, 1, 1);
w->add_resizable(*b_);
}} {}
}

Wyświetl plik

@ -32,6 +32,10 @@ string windowTitle;
vector<qrg_mode_t> freqlist;
const unsigned char nfields = 4;
int fwidths[nfields];
enum { max_rfcarrier, max_rmode, max_mode };
#if USE_HAMLIB
struct rmode_name_t {
rmode_t mode;
@ -126,17 +130,13 @@ void clearList()
void updateSelect()
{
FreqSelect->clear();
if (freqlist.size() == 0)
if (freqlist.empty())
return;
char freq[20];
for (size_t i = 0; i < freqlist.size(); i++) {
snprintf(freq, sizeof(freq), "%9.3f", freqlist[i].rfcarrier / 1000.0);
FreqSelect->add(freq);
}
for (size_t i = 0; i < freqlist.size(); i++)
FreqSelect->add(freqlist[i].str().c_str());
}
void addtoList(long val)
size_t addtoList(long val)
{
qrg_mode_t m;
@ -149,6 +149,12 @@ void addtoList(long val)
}
freqlist.push_back(m);
sort(freqlist.begin(), freqlist.end());
vector<qrg_mode_t>::const_iterator pos = find(freqlist.begin(), freqlist.end(), m);
if (pos != freqlist.end())
return pos - freqlist.begin();
else
return 0;
}
bool readFreqList()
@ -166,6 +172,7 @@ bool readFreqList()
is >> m;
freqlist.push_back(m);
}
sort(freqlist.begin(), freqlist.end());
updateSelect();
return freqlist.size();
@ -186,6 +193,30 @@ void saveFreqList()
void buildlist()
{
// calculate the column widths
memset(fwidths, 0, sizeof(fwidths));
// these need to be a little wider than fl_width thinks
fwidths[max_rmode] = fwidths[max_mode] = 10;
fl_font(FreqSelect->textfont(), FreqSelect->textsize());
fwidths[max_rfcarrier] += (int)ceil(fl_width("99999999.999"));
fwidths[max_rmode] += (int)ceil(fl_width("XXXX"));
// find mode with longest shortname
size_t s, smax = 0, mmax = 0;
for (size_t i = 0; i < NUM_MODES; i++) {
s = strlen(mode_info[i].sname);
if (smax < s) {
smax = s;
mmax = i;
}
}
fwidths[max_mode] += (int)ceil(fl_width(mode_info[mmax].sname));
FreqSelect->column_widths(fwidths);
if (readFreqList() == true)
return;
Fl::lock();
@ -243,15 +274,15 @@ void selectFreq()
{
int n = FreqSelect->value() - 1;
if (freqlist[n].rfcarrier > 0) {
FreqDisp->value(freqlist[n].rfcarrier);
movFreq();
MilliSleep(100);
}
if (freqlist[n].rmode != "NONE") {
opMODE->value(freqlist[n].rmode.c_str());
setMode();
MilliSleep(100);
}
if (freqlist[n].rfcarrier > 0) {
FreqDisp->value(freqlist[n].rfcarrier);
movFreq();
}
if (freqlist[n].mode != NUM_MODES) {
@ -268,7 +299,7 @@ void delFreq()
if (v >= 0) {
freqlist.erase(freqlist.begin() + v);
updateSelect();
FreqSelect->remove(v + 1);
}
}
@ -276,8 +307,8 @@ void addFreq()
{
long freq = FreqDisp->value();
if (freq) {
addtoList(freq);
updateSelect();
size_t pos = addtoList(freq);
FreqSelect->insert(pos+1, freqlist[pos].str().c_str());
}
}

Wyświetl plik

@ -495,9 +495,11 @@ int cSoundOSS::Read(double *buffer, int buffersize)
if (playback) {
readPlayback( buffer, buffersize);
double vol = valRcvMixer->value();
for (int i = 0; i < buffersize; i++)
buffer[i] *= vol;
if (progdefaults.EnableMixer) {
double vol = valRcvMixer->value();
for (int i = 0; i < buffersize; i++)
buffer[i] *= vol;
}
return buffersize;
}
@ -779,22 +781,37 @@ void cSoundPA::Close(void)
int cSoundPA::Read(double *buf, int count)
{
int ncount = (int)floor(MIN(count, SND_BUF_LEN) / rx_src_data->src_ratio);
int err;
int err;
static int retries = 0;
if ((err = Pa_ReadStream(stream, fbuf, ncount)) != paNoError) {
pa_perror(err, "Pa_ReadStream");
if (err == paInputOverflowed)
switch (err) {
case paInputOverflowed:
return adjust_stream() ? Read(buf, count) : 0;
throw SndException(err);
case paUnanticipatedHostError:
if (Pa_GetHostApiInfo((*idev)->hostApi)->type == paOSS && retries++ < 8) {
cerr << "Retrying read\n";
return Read(buf, count);
}
else
cerr << "Giving up\n";
// fall through
default:
throw SndException(err);
}
}
retries = 0;
if (capture)
writeCapture(buf, count);
if (playback) {
readPlayback(buf, count);
double vol = valRcvMixer->value();
for (int i = 0; i < count; i++)
buf[i] *= vol;
if (progdefaults.EnableMixer) {
double vol = valRcvMixer->value();
for (int i = 0; i < count; i++)
buf[i] *= vol;
}
return count;
}
@ -827,12 +844,25 @@ int cSoundPA::write_samples(double *buf, int count)
}
int err;
static int retries = 0;
if ((err = Pa_WriteStream(stream, wbuf, count)) != paNoError) {
pa_perror(err, "Pa_WriteStream");
if (err == paOutputUnderflowed)
switch (err) {
case paOutputUnderflowed:
return adjust_stream() ? write_samples(buf, count) : 0;
throw SndException(err);
case paUnanticipatedHostError:
if (Pa_GetHostApiInfo((*idev)->hostApi)->type == paOSS && retries++ < 8) {
cerr << "Retrying write\n";
return write_samples(buf, count);
}
else
cerr << "Giving up\n";
// fall through
default:
throw SndException(err);
}
}
retries = 0;
return count;
}
@ -855,12 +885,27 @@ int cSoundPA::write_stereo(double *bufleft, double *bufright, int count)
}
int err;
static int retries = 0;
if ((err = Pa_WriteStream(stream, wbuf, count)) != paNoError) {
pa_perror(err, "Pa_WriteStream");
if (err == paOutputUnderflowed)
switch (err) {
case paOutputUnderflowed:
return adjust_stream() ? write_stereo(bufleft, bufright, count) : 0;
case paUnanticipatedHostError:
if (Pa_GetHostApiInfo((*idev)->hostApi)->type == paOSS && retries++ < 8) {
cerr << "Retrying write\n";
return write_stereo(bufleft, bufright, count);
}
else
cerr << "Giving up\n";
// fall through
default:
throw SndException(err);
}
throw SndException(err);
}
retries = 0;
return count;
}
@ -1096,7 +1141,7 @@ void cSoundPA::pa_perror(int err, const char* str)
if (i < 0) { // PA failed without setting its "last host error" info. Sigh...
cerr << "Host API error info not available\n";
if ((*idev)->hostApi == paOSS && errno)
if (Pa_GetHostApiInfo((*idev)->hostApi)->type == paOSS && errno)
cerr << "Possible OSS error " << errno << ": "
<< strerror(errno) << '\n';
}

Wyświetl plik

@ -92,9 +92,9 @@ void trx_trx_receive_loop()
scard->Open(O_RDONLY, active_modem->get_samplerate());
}
catch (const SndException& e) {
put_status(e.what());
put_status(e.what(), 5);
#if USE_PORTAUDIO
if (e.error() == EBUSY) {
if (e.error() == EBUSY && progdefaults.btnAudioIOis == 1) {
cSoundPA::terminate();
cSoundPA::initialize();
}
@ -102,11 +102,18 @@ void trx_trx_receive_loop()
MilliSleep(1000);
return;
}
put_status("");
active_modem->rx_init();
while (1) {
numread = scard->Read(_trx_scdbl, SCBLOCKSIZE);
try {
numread = scard->Read(_trx_scdbl, SCBLOCKSIZE);
}
catch (const SndException& e) {
scard->Close();
put_status(e.what(), 5);
MilliSleep(10);
return;
}
if (numread == -1 || (trx_state != STATE_RX))
break;
if (numread > 0) {
@ -142,8 +149,16 @@ void trx_trx_transmit_loop()
active_modem->tx_init(scard);
while (trx_state == STATE_TX) {
if (active_modem->tx_process() < 0)
trx_state = STATE_RX;
try {
if (active_modem->tx_process() < 0)
trx_state = STATE_RX;
}
catch (const SndException& e) {
scard->Close();
put_status(e.what(), 5);
MilliSleep(10);
return;
}
}
if (!scard->full_duplex())
scard->Close();
@ -177,15 +192,23 @@ void trx_tune_loop()
push2talk->set(true);
active_modem->tx_init(scard);
while (trx_state == STATE_TUNE) {
if (_trx_tune == 0) {
REQ_SYNC(&waterfall::set_XmtRcvBtn, wf, true);
xmttune::keydown(active_modem->get_txfreq_woffset(), scard);
_trx_tune = 1;
} else
xmttune::tune(active_modem->get_txfreq_woffset(), scard);
try {
while (trx_state == STATE_TUNE) {
if (_trx_tune == 0) {
REQ_SYNC(&waterfall::set_XmtRcvBtn, wf, true);
xmttune::keydown(active_modem->get_txfreq_woffset(), scard);
_trx_tune = 1;
} else
xmttune::tune(active_modem->get_txfreq_woffset(), scard);
}
xmttune::keyup(active_modem->get_txfreq_woffset(), scard);
}
catch (const SndException& e) {
scard->Close();
put_status(e.what(), 5);
MilliSleep(10);
return;
}
xmttune::keyup(active_modem->get_txfreq_woffset(), scard);
if (!scard->full_duplex())
scard->Close();
_trx_tune = 0;

Wyświetl plik

@ -36,6 +36,7 @@
#include "File_Selector.h"
#include "ascii.h"
#include "configuration.h"
#include "qrunner.h"
@ -290,16 +291,16 @@ void FTextBase::adjust_colours(void)
Fl_Menu_Item FTextView::view_menu[] = {
{ "@-9$returnarrow &QRZ this call", 0, 0 },
{ "@-4>> &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 },
{ "@-9-> &RST(r)", 0, 0, 0, FL_MENU_DIVIDER },
{ "Insert divider", 0, 0 },
{ "C&lear", 0, 0 },
{ "&Copy", 0, 0, 0, FL_MENU_DIVIDER },
#ifndef NDEBUG
#if 0 //#ifndef NDEBUG
{ "(debug) &Append file...", 0, 0, 0, FL_MENU_DIVIDER },
#endif
{ "Save to &file...", 0, 0, 0, FL_MENU_DIVIDER },
@ -373,6 +374,7 @@ int FTextView::handle(int event)
view_menu[RX_MENU_WRAP].flags |= FL_MENU_VALUE;
else
view_menu[RX_MENU_WRAP].flags &= ~FL_MENU_VALUE;
context_menu = progdefaults.QRZ ? view_menu : view_menu + 1;
show_context_menu();
return 1;
@ -450,7 +452,8 @@ void FTextView::add(char c, int attr)
///
void FTextView::menu_cb(int val)
{
handle(FL_UNFOCUS);
if (progdefaults.QRZ == 0)
++val;
switch (val) {
char *s;
@ -731,7 +734,7 @@ int FTextEdit::nextChar(void)
else {
if ((c = tbuf->character(txpos))) {
++txpos;
REQ(FTextEdit::changed_cb, txpos, 0, 0, 0,
REQ(FTextEdit::changed_cb, txpos, 0, 0, -1,
static_cast<const char *>(0), this);
}
}
@ -914,7 +917,6 @@ int FTextEdit::handle_key_ascii(int key)
///
void FTextEdit::menu_cb(int val)
{
handle(FL_UNFOCUS);
switch (val) {
case TX_MENU_TX:
active_modem->set_stopflag(false);
@ -978,7 +980,7 @@ void FTextEdit::changed_cb(int pos, int nins, int ndel, int nsty, const char *dt
FTextEdit *e = reinterpret_cast<FTextEdit *>(arg);
if (nins == 0 && ndel == 0) {
if (nsty == 0) { // update transmitted text style
if (nsty == -1) { // called by nextChar to update transmitted text style
char s[] = { FTEXT_DEF + XMIT, '\0' };
e->sbuf->replace(pos - 1, pos, s);
e->redisplay_range(pos - 1, pos);
@ -986,7 +988,7 @@ void FTextEdit::changed_cb(int pos, int nins, int ndel, int nsty, const char *dt
else if (nsty > 0) // restyled, e.g. selected, text
return e->buffer_modified_cb(pos, nins, ndel, nsty, dtext,
dynamic_cast<Fl_Text_Editor_mod *>(e));
// No changes, e.g., a paste with an empty clipboard.
return;
}
else if (nins > 0 && e->sbuf->length() < e->tbuf->length()) {