kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Upstream version 1.34
rodzic
4d5c3d4768
commit
9621790078
28
ChangeLog
28
ChangeLog
|
@ -1,5 +1,33 @@
|
|||
Change Log:
|
||||
|
||||
1.34 1) Cleaned up unused code segments
|
||||
2) Modified CW decoder to allow setting upper and lower limits on
|
||||
Tx WPM
|
||||
3) Modified sound card PPM corrections to allow a +/-50000 range.
|
||||
Prompted by some users reporting ppm requirements exceeding
|
||||
25,000 ppm at 8000 Hz sample rate. Same card gives < 200 ppm
|
||||
at 11025.
|
||||
4) Modified the combo widget to allow both editable and non-editable
|
||||
forms.
|
||||
The combo widget for the rig selection cannot be edited, but just
|
||||
selected from the pick list.
|
||||
The combo widget for the frequency entry (no rig control) in the
|
||||
qso area can now be modified by direct keyboard entry and also
|
||||
from the pick list. You still need to update the pick list via
|
||||
the $HOME/.fldigi/frequencies.def file.
|
||||
5) Modified pskmail to test for failure in reading gmfsk_autofile
|
||||
6) Wholesale replacement of font browser dialog to correct potential
|
||||
segfaults with some TT fonts.
|
||||
7) Modified pskmail-to-fldigi i/o schema to allow all control and
|
||||
data files to be placed in either the
|
||||
$HOME/pskmail.files or the
|
||||
./ directory.
|
||||
The control files are:
|
||||
PSKmailserver
|
||||
PSKmailclient
|
||||
The data files are:
|
||||
pskmail_out (formerly gmfsk_autofile)
|
||||
mail-io.log (formerly gMFSK.log)
|
||||
1.33 1) Modified Sound Card mixer dialog and interface code
|
||||
2) Modified CW decoder and morse speed tracking algorithm with a
|
||||
new CW configuration tab layout and new CW controls.
|
||||
|
|
4
makefile
4
makefile
|
@ -61,7 +61,7 @@ SRC_OBJS = \
|
|||
$(OBJ_DIR)/configuration.o \
|
||||
$(OBJ_DIR)/filters.o \
|
||||
$(OBJ_DIR)/TextView.o \
|
||||
$(OBJ_DIR)/fl_font_browser.o \
|
||||
$(OBJ_DIR)/font_browser.o \
|
||||
$(OBJ_DIR)/macros.o \
|
||||
$(OBJ_DIR)/macroedit.o \
|
||||
$(OBJ_DIR)/main.o \
|
||||
|
@ -242,7 +242,7 @@ $(OBJ_DIR)/filters.o: src/filters/filters.cxx
|
|||
$(OBJ_DIR)/TextView.o: src/dialogs/TextView.cxx
|
||||
$(compile_source)
|
||||
|
||||
$(OBJ_DIR)/fl_font_browser.o: src/dialogs/fl_font_browser.cxx
|
||||
$(OBJ_DIR)/font_browser.o: src/dialogs/font_browser.cxx
|
||||
$(compile_source)
|
||||
|
||||
$(OBJ_DIR)/macros.o: src/misc/macros.cxx
|
||||
|
|
|
@ -76,7 +76,8 @@ void Fl_PopBrowser::pophide ()
|
|||
void Fl_PopBrowser::popbrwsr_cb_i (Fl_Widget *v, long d)
|
||||
{
|
||||
Fl_PopBrowser *me = (Fl_PopBrowser *)(v->parent());
|
||||
Fl_Output *tgt = me->Rvals.Inp;
|
||||
// Fl_Output *tgt = me->Rvals.Inp;
|
||||
Fl_Input *tgt = me->Rvals.Inp;
|
||||
// update the return values
|
||||
if (tgt) {
|
||||
int row = (me->popbrwsr)->value();
|
||||
|
@ -167,7 +168,8 @@ Fl_ComboBox::Fl_ComboBox (int X,int Y,int W,int H, char *L)
|
|||
Btn = new Fl_Button (X + W - 18, Y + 1, 18, H - 2);
|
||||
(new Fl_Pixmap (brws_12))->label (Btn);
|
||||
Btn->callback ((Fl_Callback *)btnComboBox_cb, 0);
|
||||
Output = new Fl_Output (X, Y, W-18, H);
|
||||
// Output = new Fl_Output (X, Y, W-18, H);
|
||||
Output = new Fl_Input (X, Y, W-18, H);
|
||||
Brwsr = 0;
|
||||
datalist = new datambr *[FL_COMBO_LIST_INCR];
|
||||
maxsize = FL_COMBO_LIST_INCR;
|
||||
|
@ -184,6 +186,11 @@ void Fl_ComboBox::type (int t)
|
|||
{
|
||||
listtype = t;
|
||||
}
|
||||
|
||||
void Fl_ComboBox::readonly()
|
||||
{
|
||||
Output->type(FL_NORMAL_OUTPUT);
|
||||
}
|
||||
|
||||
// ComboBox value is contained in the Output widget
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <sys/time.h>
|
||||
|
||||
#include "cw.h"
|
||||
#include "CWdialog.h"
|
||||
#include "misc.h"
|
||||
//#include "modeIO.h"
|
||||
#include "configuration.h"
|
||||
|
@ -54,12 +53,15 @@ void cw::rx_init()
|
|||
agc_peak = 0;
|
||||
digiscope->mode(Digiscope::SCOPE);
|
||||
put_MODEstatus(mode);
|
||||
usedefaultWPM = false;
|
||||
}
|
||||
|
||||
void cw::init()
|
||||
{
|
||||
modem::init();
|
||||
set_cwXmtWPM(sldrCWxmtWPM->value());
|
||||
trackingfilter->reset();
|
||||
cw_adaptive_receive_threshold = (long int)trackingfilter->run(2 * cw_send_dot_length);
|
||||
put_cwRcvWPM(cw_send_speed);
|
||||
rx_init();
|
||||
}
|
||||
|
||||
|
@ -71,6 +73,7 @@ cw::~cw() {
|
|||
if (cwfilter) delete cwfilter;
|
||||
if (bitfilter) delete bitfilter;
|
||||
if (trackingfilter) delete trackingfilter;
|
||||
// if (keyshape) delete [] keyshape;
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,19 +83,24 @@ cw::cw() : morse(), modem()
|
|||
|
||||
mode = MODE_CW;
|
||||
freqlock = false;
|
||||
cw_speed = progdefaults.CWspeed;
|
||||
frequency = 800;
|
||||
tx_frequency = 800;
|
||||
bandwidth = progdefaults.CWbandwidth;
|
||||
risetime = progdefaults.CWrisetime;
|
||||
// keyshape = new double[KNUM];
|
||||
|
||||
samplerate = CWSampleRate;
|
||||
fragmentsize = CWMaxSymLen;
|
||||
|
||||
cw_speed = progdefaults.CWspeed;
|
||||
bandwidth = progdefaults.CWbandwidth;
|
||||
|
||||
cw_send_speed = cw_speed;
|
||||
cw_receive_speed = cw_speed;
|
||||
// cw_noise_spike_threshold = INITIAL_NOISE_THRESHOLD;
|
||||
cw_adaptive_receive_threshold = 2 * DOT_MAGIC / cw_speed;
|
||||
cw_noise_spike_threshold = cw_adaptive_receive_threshold / 4;
|
||||
cw_send_dot_length = DOT_MAGIC / cw_send_speed;
|
||||
cw_send_dash_length = 3 * cw_send_dot_length;
|
||||
symbollen = (int)(1.0 * samplerate * cw_send_dot_length / USECS_PER_SEC);
|
||||
|
||||
memset(rx_rep_buf, 0, sizeof(rx_rep_buf));
|
||||
|
||||
|
@ -110,8 +118,10 @@ cw::cw() : morse(), modem()
|
|||
bitfilter = new Cmovavg(8);
|
||||
trackingfilter = new Cmovavg(TRACKING_FILTER_SIZE);
|
||||
|
||||
makeshape();
|
||||
sync_parameters();
|
||||
wf->Bandwidth ((int)bandwidth);
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
|
@ -121,32 +131,40 @@ cw::cw() : morse(), modem()
|
|||
|
||||
void cw::sync_parameters()
|
||||
{
|
||||
int lowerwpm, upperwpm;
|
||||
int lowerwpm, upperwpm, nusymbollen;
|
||||
|
||||
if (usedefaultWPM == false)
|
||||
cw_send_dot_length = DOT_MAGIC / progdefaults.CWspeed;
|
||||
else
|
||||
cw_send_dot_length = DOT_MAGIC / progdefaults.defCWspeed;
|
||||
|
||||
cw_send_dash_length = 3 * cw_send_dot_length;
|
||||
nusymbollen = (int)(1.0 * samplerate * cw_send_dot_length / USECS_PER_SEC);
|
||||
if (symbollen != nusymbollen || risetime != progdefaults.CWrisetime) {
|
||||
risetime = progdefaults.CWrisetime;
|
||||
symbollen = nusymbollen;
|
||||
if (symbollen < 12) bitfilter->setLength(4);
|
||||
else bitfilter->setLength(8);
|
||||
makeshape();
|
||||
}
|
||||
|
||||
// check if user changed the tracking or the cw default speed
|
||||
if (cw_send_speed != progdefaults.CWspeed ||
|
||||
cwTrack != progdefaults.CWtrack) {
|
||||
|
||||
cw_send_speed = progdefaults.CWspeed;
|
||||
cw_send_dot_length = DOT_MAGIC / cw_send_speed;
|
||||
cw_send_dash_length = 3 * cw_send_dot_length;
|
||||
symbollen = (int)(1.0 * samplerate * cw_send_dot_length / USECS_PER_SEC);
|
||||
|
||||
if ((cwTrack != progdefaults.CWtrack) ||
|
||||
(cw_send_speed != progdefaults.CWspeed)) {
|
||||
trackingfilter->reset();
|
||||
cw_adaptive_receive_threshold = (long int)trackingfilter->run(2 * cw_send_dot_length);
|
||||
|
||||
put_cwRcvWPM(cw_send_speed);
|
||||
} else {
|
||||
cw_send_speed = progdefaults.CWspeed;
|
||||
cw_send_dot_length = DOT_MAGIC / cw_send_speed;
|
||||
cw_send_dash_length = 3 * cw_send_dot_length;
|
||||
symbollen = (int)(1.0 * samplerate * cw_send_dot_length / USECS_PER_SEC);
|
||||
}
|
||||
cwTrack = progdefaults.CWtrack;
|
||||
|
||||
cw_send_speed = progdefaults.CWspeed;
|
||||
|
||||
// Receive parameters:
|
||||
lowerwpm = cw_send_speed - progdefaults.CWrange;
|
||||
upperwpm = cw_send_speed + progdefaults.CWrange;
|
||||
if (lowerwpm < CW_MIN_SPEED) lowerwpm = CW_MIN_SPEED;
|
||||
if (lowerwpm < progdefaults.CWlowerlimit)
|
||||
lowerwpm = progdefaults.CWlowerlimit;
|
||||
if (upperwpm > progdefaults.CWupperlimit)
|
||||
upperwpm = progdefaults.CWupperlimit;
|
||||
cw_lower_limit = 2 * DOT_MAGIC / upperwpm;
|
||||
cw_upper_limit = 2 * DOT_MAGIC / lowerwpm;
|
||||
|
||||
|
@ -157,23 +175,12 @@ void cw::sync_parameters()
|
|||
cw_adaptive_receive_threshold = 2 * cw_send_dot_length;
|
||||
}
|
||||
|
||||
// receive routines track speeds, but we put hard limits
|
||||
// on the speeds here if necessary.
|
||||
// may not need with new algorithm which limits tracking range
|
||||
// if (cw_receive_speed < CW_MIN_SPEED)
|
||||
// cw_receive_speed = CW_MIN_SPEED;
|
||||
// if (cw_receive_speed > CW_MAX_SPEED)
|
||||
// cw_receive_speed = CW_MAX_SPEED;
|
||||
|
||||
cw_receive_dot_length = DOT_MAGIC / cw_receive_speed;
|
||||
|
||||
// cw_adaptive_receive_threshold = 2 * cw_receive_dot_length;
|
||||
cw_receive_dash_length = 3 * cw_receive_dot_length;
|
||||
|
||||
cw_noise_spike_threshold = cw_receive_dot_length / 4;
|
||||
|
||||
// Set the parameters in sync flag.
|
||||
// cw_in_sync = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -201,6 +208,25 @@ void cw::update_tracking(int idot, int idash)
|
|||
sync_parameters();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//update_syncscope()
|
||||
//Routine called to update the display on the sync scope display.
|
||||
//For CW this is an o scope pattern that shows the cw data stream.
|
||||
//=======================================================================
|
||||
|
||||
void cw::update_Status()
|
||||
{
|
||||
static char RXmsg[20];
|
||||
static char TXmsg[20];
|
||||
sprintf(RXmsg,"Rx %d", cw_receive_speed);
|
||||
if (usedefaultWPM)
|
||||
sprintf(TXmsg,"Tx %d **", progdefaults.defCWspeed);
|
||||
else
|
||||
sprintf(TXmsg,"Tx %d", progdefaults.CWspeed);
|
||||
put_Status1(RXmsg);
|
||||
put_Status2(TXmsg);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//update_syncscope()
|
||||
//Routine called to update the display on the sync scope display.
|
||||
|
@ -216,10 +242,8 @@ void cw::update_syncscope()
|
|||
scopedata[i] = 0.1 + 0.8 * pipe[j] / agc_peak;
|
||||
}
|
||||
set_scope(scopedata, pipesize, false);
|
||||
|
||||
// cwRcvWPM = cw_receive_speed;
|
||||
// put_cwRcvWPM(cwRcvWPM);
|
||||
put_cwRcvWPM(cw_receive_speed);
|
||||
update_Status();
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,6 +459,7 @@ int cw::handle_event(int cw_event, char **c)
|
|||
return CW_ERROR;
|
||||
// MEDIUM time since keyup... check for character space
|
||||
// one shot through this code via receive state logic
|
||||
// FARNSWOTH MOD HERE -->
|
||||
if (element_usec >= (2 * cw_receive_dot_length) &&
|
||||
element_usec <= (4 * cw_receive_dot_length) &&
|
||||
cw_receive_state == RS_AFTER_TONE) {
|
||||
|
@ -449,6 +474,7 @@ int cw::handle_event(int cw_event, char **c)
|
|||
return CW_SUCCESS;
|
||||
}
|
||||
// LONG time since keyup... check for a word space
|
||||
// FARNSWOTH MOD HERE -->
|
||||
if ((element_usec > (4 * cw_receive_dot_length)) && !space_sent) {
|
||||
*c = " ";
|
||||
space_sent = true;
|
||||
|
@ -466,55 +492,21 @@ int cw::handle_event(int cw_event, char **c)
|
|||
// cw transmit routines
|
||||
// Define the amplitude envelop for key down events (32 samples long)
|
||||
// this is 1/2 cycle of a raised cosine
|
||||
// the tables with 32 entries give about 4ms rise and fall times
|
||||
// when using 8000 samples/sec. This shaping of the cw pulses is
|
||||
// very necssary to avoid having a very wide and clicky cw signal
|
||||
// when using the sound card to gen cw. When using the rig key input
|
||||
// the shaping is done in the rig hardware, but we want to be able to
|
||||
// pick one cw signal out of a cluster and be able to respond on his freq.
|
||||
//===========================================================================
|
||||
|
||||
#define KNUM 32
|
||||
// keydown wave shape
|
||||
double kdshape[KNUM] = {
|
||||
0.00240750255310301, 0.00960708477768751,
|
||||
0.02152941088003600, 0.03805966253618680,
|
||||
0.05903864465505320, 0.08426431851158830,
|
||||
0.11349374748686800, 0.14644543667658500,
|
||||
0.18280204383628200, 0.22221343555548300,
|
||||
0.26430005922814900, 0.30865659834558700,
|
||||
0.35485587590940700, 0.40245296837259500,
|
||||
0.45098949048925500, 0.49999800980765500,
|
||||
0.54900654829266300, 0.59754312772456200,
|
||||
0.64514031509964400, 0.69133972425796200,
|
||||
0.73569643038517400, 0.77778325487450100,
|
||||
0.81719487928327800, 0.85355174876454100,
|
||||
0.88650372738152000, 0.91573347010241700,
|
||||
0.94095947900139100, 0.96193881423287900,
|
||||
0.97846943367117300, 0.99039213868324900,
|
||||
0.99759210729604500, 0.99999999999295900
|
||||
};
|
||||
|
||||
// keyup wave shape
|
||||
double kushape[KNUM] = {
|
||||
0.99999999999295900, 0.99759210729604500,
|
||||
0.99039213868324900, 0.97846943367117300,
|
||||
0.96193881423287900, 0.94095947900139100,
|
||||
0.91573347010241700, 0.88650372738152000,
|
||||
0.85355174876454100, 0.81719487928327800,
|
||||
0.77778325487450100, 0.73569643038517400,
|
||||
0.69133972425796200, 0.64514031509964400,
|
||||
0.59754312772456200, 0.54900654829266300,
|
||||
0.49999800980765500, 0.45098949048925500,
|
||||
0.40245296837259500, 0.35485587590940700,
|
||||
0.30865659834558700, 0.26430005922814900,
|
||||
0.22221343555548300, 0.18280204383628200,
|
||||
0.14644543667658500, 0.11349374748686800,
|
||||
0.08426431851158830, 0.05903864465505320,
|
||||
0.03805966253618680, 0.02152941088003600,
|
||||
0.00960708477768751, 0.00240750255310301
|
||||
};
|
||||
double keyshape[KNUM];
|
||||
|
||||
void cw::makeshape()
|
||||
{
|
||||
for (int i = 0; i < KNUM; i++) keyshape[i] = 1.0;
|
||||
knum = (int)(8 * risetime);
|
||||
if (knum > symbollen)
|
||||
knum = symbollen;
|
||||
if (knum > KNUM)
|
||||
knum = KNUM;
|
||||
for (int i = 0; i < knum; i++)
|
||||
keyshape[i] = 0.5 * (1.0 - cos (M_PI * i / knum));
|
||||
}
|
||||
|
||||
inline double cw::nco(double freq)
|
||||
{
|
||||
|
@ -523,7 +515,7 @@ inline double cw::nco(double freq)
|
|||
if (phaseacc > M_PI)
|
||||
phaseacc -= 2.0 * M_PI;
|
||||
|
||||
return cos(phaseacc);
|
||||
return sin(phaseacc);
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
|
@ -534,78 +526,63 @@ inline double cw::nco(double freq)
|
|||
//=======================================================================
|
||||
|
||||
|
||||
void cw::send_symbol(int symbol)
|
||||
void cw::send_symbol(int currsym)
|
||||
{
|
||||
double freq;
|
||||
int sample = 0, i;
|
||||
int currsym = symbol & 1;
|
||||
int nextsym = (symbol >> 1) & 1;
|
||||
// int symlen100 = (int) (samplerate * 0.012);
|
||||
int delta = 0;
|
||||
int keydown;
|
||||
int keyup;
|
||||
int duration = 0;
|
||||
int symlen = 0;
|
||||
double dsymlen = 0.0;
|
||||
|
||||
freq = tx_frequency;
|
||||
|
||||
if ((currsym == 1) && (lastsym == 0)) phaseacc = 0.0;
|
||||
|
||||
if ((currsym == 1 && lastsym == 0) || (currsym == 0 && lastsym == 1))
|
||||
delta = (int) (symbollen * (progdefaults.CWweight - 50) / 100.0);
|
||||
keydown = symbollen - 2 * KNUM + delta;
|
||||
keyup = symbollen - delta;
|
||||
|
||||
if (currsym == 1) {
|
||||
if (cw_send_speed <= 100) {
|
||||
for (i = 0; i < KNUM; i++, sample++) {
|
||||
if (lastsym == 0)
|
||||
outbuf[sample] = nco(freq) * kdshape[i];
|
||||
else
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
for (i = 0; i < keydown; i++, sample++) {
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
for (i = 0; i < KNUM; i++, sample++ ) {
|
||||
if (nextsym == 0)
|
||||
outbuf[sample] = nco(freq) * kushape[i];
|
||||
else
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < KNUM; i += 2, sample++) {
|
||||
if (lastsym == 0)
|
||||
outbuf[sample] = nco(freq) * kdshape[i];
|
||||
else
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
duration += KNUM / 2;
|
||||
for (i = 0; i < keydown + KNUM; i++, sample++) {
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
for (i = 0; i < KNUM; i += 2, sample++ ) {
|
||||
if (nextsym == 0)
|
||||
outbuf[sample] = nco(freq) * kushape[i];
|
||||
else
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
}
|
||||
duration = keydown + 2 * KNUM;
|
||||
} else {
|
||||
if (lastsym == 1) {
|
||||
for (i = 0; i < keyup; i++)
|
||||
outbuf[i] = 0.0;
|
||||
duration = keyup;
|
||||
} else {
|
||||
for (i = 0; i < symbollen; i++)
|
||||
outbuf[i] = 0.0;
|
||||
duration = symbollen;
|
||||
}
|
||||
}
|
||||
dsymlen = symbollen * 4.0 / (progdefaults.CWdash2dot + 1.0);
|
||||
if (lastsym == 1 && currsym == 1)
|
||||
dsymlen *= ((progdefaults.CWdash2dot - 1.0) / 2.0);
|
||||
symlen = (int) dsymlen;
|
||||
if (symlen < knum) symlen = knum;
|
||||
} else
|
||||
symlen = symbollen;
|
||||
// cout << (symbol & 1) << "-" << symlen << ", ";
|
||||
|
||||
// if (progdefaults.useCWkeylineRTS || progdefaults.useCWkeylineDTR) {
|
||||
// if (currsym != lastsym)
|
||||
// cw_keyline(currsym);
|
||||
// std::cout << currsym; fflush(stdout);
|
||||
// }
|
||||
if (delta < -(symlen - knum)) delta = -(symlen - knum);
|
||||
if (delta > (symlen - knum)) delta = symlen - knum;
|
||||
|
||||
keydown = symlen - knum + delta;
|
||||
keyup = symlen - knum - delta;
|
||||
|
||||
if (currsym == 1) {
|
||||
for (i = 0; i < knum; i++, sample++) {
|
||||
if (lastsym == 0)
|
||||
outbuf[sample] = nco(freq) * keyshape[i];
|
||||
else
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
for (i = 0; i < keydown; i++, sample++) {
|
||||
outbuf[sample] = nco(freq);
|
||||
}
|
||||
duration = knum + keydown;
|
||||
} else {
|
||||
for (i = knum - 1; i >= 0; i--, sample++) {
|
||||
if (lastsym == 1)
|
||||
outbuf[sample] = nco(freq) * keyshape[i];
|
||||
else
|
||||
outbuf[sample] = 0.0;
|
||||
}
|
||||
for (i = 0; i < keyup; i++, sample++) {
|
||||
outbuf[sample] = 0.0;
|
||||
}
|
||||
duration = knum + keyup;
|
||||
}
|
||||
|
||||
ModulateXmtr(outbuf, duration);
|
||||
|
||||
|
@ -623,14 +600,17 @@ void cw::send_ch(int ch)
|
|||
|
||||
sync_parameters();
|
||||
// handle word space separately (7 dots spacing)
|
||||
// last char already had 2 dots of inter-character spacing sent with it
|
||||
// last char already had 2 elements of inter-character spacing
|
||||
|
||||
if ((ch == ' ') || (ch == '\n')) {
|
||||
// cout << " ";
|
||||
send_symbol(0);
|
||||
send_symbol(0);
|
||||
send_symbol(0);
|
||||
send_symbol(0);
|
||||
send_symbol(0);
|
||||
put_echo_char(ch);
|
||||
// cout << endl; cout.flush();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -638,19 +618,24 @@ void cw::send_ch(int ch)
|
|||
if ((ch < 256) && (ch >= 0))
|
||||
code = tx_lookup(ch); //cw_tx_lookup(ch);
|
||||
else
|
||||
code = 0x4; // two dot spaces
|
||||
code = 0x04; // two extra dot spaces
|
||||
// loop sending out binary bits of cw character
|
||||
|
||||
// cout << (char) ch << " " << progdefaults.CWdash2dot << " === ";
|
||||
|
||||
while (code > 1) {
|
||||
send_symbol(code);// & 1);
|
||||
send_symbol(code & 1);
|
||||
code = code >> 1;
|
||||
Fl::awake();
|
||||
}
|
||||
// cout << endl; cout.flush();
|
||||
if (ch != 0)
|
||||
put_echo_char(ch);
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
// cw_txprocess()
|
||||
// Read charcters from screen and send them out the sound card.
|
||||
// Read characters from screen and send them out the sound card.
|
||||
// This is called repeatedly from a thread during tx.
|
||||
//=======================================================================
|
||||
|
||||
|
@ -663,37 +648,33 @@ int cw::tx_process()
|
|||
stopflag = false;
|
||||
return -1;
|
||||
}
|
||||
if (c != 0)
|
||||
send_ch(c);
|
||||
else
|
||||
send_symbol(0);
|
||||
|
||||
send_ch(c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
void cw::cw_keyup()
|
||||
void cw::incWPM()
|
||||
{
|
||||
if (progdefaults.useCWkeylineRTS)
|
||||
KeyLine->clearRTS();
|
||||
else if (progdefaults.useCWkeylineDTR)
|
||||
KeyLine->clearDTR();
|
||||
if (usedefaultWPM) return;
|
||||
if (progdefaults.CWspeed < progdefaults.CWupperlimit) {
|
||||
progdefaults.CWspeed++;
|
||||
set_CWwpm();
|
||||
update_Status();
|
||||
}
|
||||
}
|
||||
|
||||
void cw::cw_keydown()
|
||||
void cw::decWPM()
|
||||
{
|
||||
if (progdefaults.useCWkeylineRTS)
|
||||
KeyLine->setRTS();
|
||||
else if (progdefaults.useCWkeylineDTR)
|
||||
KeyLine->setDTR();
|
||||
if (usedefaultWPM) return;
|
||||
if (progdefaults.CWspeed > progdefaults.CWlowerlimit) {
|
||||
progdefaults.CWspeed--;
|
||||
set_CWwpm();
|
||||
update_Status();
|
||||
}
|
||||
}
|
||||
|
||||
void cw::cw_keyline(int symbol)
|
||||
void cw::toggleWPM()
|
||||
{
|
||||
if (symbol)
|
||||
cw_keydown();
|
||||
else
|
||||
cw_keyup();
|
||||
usedefaultWPM = !usedefaultWPM;
|
||||
update_Status();
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ static CW_TABLE cw_table[] = {
|
|||
{"'", ".----.", CW_ENTRY_NORMAL},
|
||||
{"$", "...-..-", CW_ENTRY_NORMAL},
|
||||
// {"(", "-.--.", CW_ENTRY_NORMAL},
|
||||
{")", "-.--.-", CW_ENTRY_NORMAL},
|
||||
// {")", "-.--.-", CW_ENTRY_NORMAL},
|
||||
// {"+", ".-.-.", CW_ENTRY_NORMAL},
|
||||
{",", "--..--", CW_ENTRY_NORMAL},
|
||||
{"-", "-....-", CW_ENTRY_NORMAL},
|
||||
|
@ -206,7 +206,7 @@ bool morse::init()
|
|||
if (cw->type == CW_ENTRY_EXTENDED)
|
||||
continue;
|
||||
len = strlen(cw->rpr);
|
||||
code = 4;
|
||||
code = 0x04;
|
||||
while (len-- > 0) {
|
||||
if (cw->rpr[len] == CW_DASH_REPRESENTATION) {
|
||||
code = (code << 1) | 1;
|
||||
|
|
|
@ -159,7 +159,7 @@ void rtty::restart()
|
|||
put_Status1(msg1);
|
||||
sprintf(msg2,"Baud %-4.1f", rtty_baud);
|
||||
put_Status2(msg2);
|
||||
put_MODEstatus(mode);
|
||||
put_MODEstatus(mode);
|
||||
|
||||
// if (!KeyLine)
|
||||
// KeyLine = new modeIO();
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
// generated by Fast Light User Interface Designer (fluid) version 1.0107
|
||||
|
||||
#include "CWdialog.h"
|
||||
#include "modem.h"
|
||||
extern modem *active_modem;
|
||||
static Fl_Double_Window *cwDialog = 0;
|
||||
|
||||
Fl_Light_Button *btnCWrcvTrack=(Fl_Light_Button *)0;
|
||||
|
||||
static void cb_btnCWrcvTrack(Fl_Light_Button*, void*) {
|
||||
active_modem->set_cwTrack(btnCWrcvTrack->value());
|
||||
}
|
||||
|
||||
Fl_Light_Button *btnCWxmtLock=(Fl_Light_Button *)0;
|
||||
|
||||
static void cb_btnCWxmtLock(Fl_Light_Button*, void*) {
|
||||
active_modem->set_cwLock(btnCWxmtLock->value());
|
||||
}
|
||||
|
||||
Fl_Button *CWDialogClose=(Fl_Button *)0;
|
||||
|
||||
static void cb_CWDialogClose(Fl_Button*, void*) {
|
||||
cwDialog->hide();
|
||||
}
|
||||
|
||||
Fl_Progress *prgsCWrcvWPM=(Fl_Progress *)0;
|
||||
|
||||
Fl_Value_Slider *sldrCWxmtWPM=(Fl_Value_Slider *)0;
|
||||
|
||||
static void cb_sldrCWxmtWPM(Fl_Value_Slider*, void*) {
|
||||
active_modem->set_cwXmtWPM(sldrCWxmtWPM->value());
|
||||
}
|
||||
|
||||
Fl_Value_Output *valCWrcvWPM=(Fl_Value_Output *)0;
|
||||
|
||||
Fl_Value_Slider *sldrCWbandwidth=(Fl_Value_Slider *)0;
|
||||
|
||||
static void cb_sldrCWbandwidth(Fl_Value_Slider*, void*) {
|
||||
if (active_modem->get_mode() == MODE_CW)
|
||||
active_modem->set_bandwidth(sldrCWbandwidth->value());
|
||||
}
|
||||
|
||||
Fl_Double_Window* CW_dialog() {
|
||||
Fl_Double_Window* w;
|
||||
{ Fl_Double_Window* o = new Fl_Double_Window(355, 90, "CW Controls");
|
||||
w = o;
|
||||
{ Fl_Light_Button* o = btnCWrcvTrack = new Fl_Light_Button(289, 18, 60, 20, "Track");
|
||||
o->value(1);
|
||||
o->callback((Fl_Callback*)cb_btnCWrcvTrack);
|
||||
}
|
||||
{ Fl_Light_Button* o = btnCWxmtLock = new Fl_Light_Button(289, 40, 60, 20, "Lock");
|
||||
o->value(1);
|
||||
o->callback((Fl_Callback*)cb_btnCWxmtLock);
|
||||
}
|
||||
{ Fl_Button* o = CWDialogClose = new Fl_Button(289, 62, 60, 20, "Close");
|
||||
o->callback((Fl_Callback*)cb_CWDialogClose);
|
||||
}
|
||||
{ Fl_Progress* o = prgsCWrcvWPM = new Fl_Progress(69, 18, 217, 20, "WPM");
|
||||
o->color(FL_INACTIVE_COLOR);
|
||||
o->selection_color((Fl_Color)110);
|
||||
o->align(FL_ALIGN_TOP);
|
||||
}
|
||||
{ Fl_Value_Slider* o = sldrCWxmtWPM = new Fl_Value_Slider(33, 40, 254, 20, "Xmt");
|
||||
o->type(5);
|
||||
o->color((Fl_Color)17);
|
||||
o->minimum(5);
|
||||
o->maximum(60);
|
||||
o->step(1);
|
||||
o->value(20);
|
||||
o->textsize(14);
|
||||
o->callback((Fl_Callback*)cb_sldrCWxmtWPM);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
}
|
||||
{ Fl_Value_Output* o = valCWrcvWPM = new Fl_Value_Output(33, 18, 36, 20, "Rcv");
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
}
|
||||
{ Fl_Value_Slider* o = sldrCWbandwidth = new Fl_Value_Slider(33, 62, 254, 20, "BW");
|
||||
o->type(5);
|
||||
o->color((Fl_Color)23);
|
||||
o->minimum(50);
|
||||
o->maximum(250);
|
||||
o->step(10);
|
||||
o->value(150);
|
||||
o->textsize(14);
|
||||
o->callback((Fl_Callback*)cb_sldrCWbandwidth);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
void openCWDialog() {
|
||||
if (!cwDialog) cwDialog = CW_dialog();
|
||||
btnCWrcvTrack->value(active_modem->get_cwTrack());
|
||||
btnCWxmtLock->value(active_modem->get_cwLock());
|
||||
prgsCWrcvWPM->value(active_modem->get_cwRcvWPM());
|
||||
valCWrcvWPM->value(active_modem->get_cwXmtWPM());
|
||||
cwDialog->show();
|
||||
}
|
||||
|
||||
void createCWDialog() {
|
||||
if (!cwDialog) cwDialog = CW_dialog();
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
# data file for the Fltk User Interface Designer (fluid)
|
||||
version 1.0107
|
||||
header_name {.h}
|
||||
code_name {.cxx}
|
||||
decl {\#include "modem.h"} {}
|
||||
|
||||
decl {extern modem *active_modem;} {}
|
||||
|
||||
decl {Fl_Double_Window *cwDialog = 0;} {}
|
||||
|
||||
Function {CW_dialog()} {open
|
||||
} {
|
||||
Fl_Window {} {
|
||||
label {CW Controls} open
|
||||
xywh {400 159 355 90} type Double visible
|
||||
} {
|
||||
Fl_Light_Button btnCWrcvTrack {
|
||||
label Track
|
||||
callback {active_modem->set_cwTrack(btnCWrcvTrack->value());}
|
||||
xywh {289 18 60 20} value 1
|
||||
}
|
||||
Fl_Light_Button btnCWxmtLock {
|
||||
label Lock
|
||||
callback {active_modem->set_cwLock(btnCWxmtLock->value());}
|
||||
xywh {289 40 60 20} value 1
|
||||
}
|
||||
Fl_Button CWDialogClose {
|
||||
label Close
|
||||
callback {cwDialog->hide();}
|
||||
xywh {289 62 60 20}
|
||||
}
|
||||
Fl_Progress prgsCWrcvWPM {
|
||||
label WPM
|
||||
xywh {69 18 217 20} color 8 selection_color 110 align 1
|
||||
}
|
||||
Fl_Value_Slider sldrCWxmtWPM {
|
||||
label Xmt
|
||||
callback {active_modem->set_cwXmtWPM(sldrCWxmtWPM->value());}
|
||||
xywh {33 40 254 20} type {Horz Knob} color 17 align 4 minimum 5 maximum 60 step 1 value 20 textsize 14
|
||||
}
|
||||
Fl_Value_Output valCWrcvWPM {
|
||||
label Rcv
|
||||
xywh {33 18 36 20} color 7
|
||||
}
|
||||
Fl_Value_Slider sldrCWbandwidth {
|
||||
label BW
|
||||
callback {if (active_modem->get_mode() == MODE_CW)
|
||||
active_modem->set_bandwidth(sldrCWbandwidth->value());} selected
|
||||
xywh {33 62 254 20} type {Horz Knob} color 23 align 4 minimum 50 maximum 250 step 10 value 150 textsize 14
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Function {openCWDialog()} {open return_type void
|
||||
} {
|
||||
code {if (!cwDialog) cwDialog = CW_dialog();
|
||||
btnCWrcvTrack->value(active_modem->get_cwTrack());
|
||||
btnCWxmtLock->value(active_modem->get_cwLock());
|
||||
prgsCWrcvWPM->value(active_modem->get_cwRcvWPM());
|
||||
valCWrcvWPM->value(active_modem->get_cwXmtWPM());
|
||||
cwDialog->show();} {}
|
||||
}
|
||||
|
||||
Function {createCWDialog()} {open return_type void
|
||||
} {
|
||||
code {if (!cwDialog) cwDialog = CW_dialog();} {}
|
||||
}
|
|
@ -510,13 +510,33 @@ Fl_Tabs *tabsModems=(Fl_Tabs *)0;
|
|||
|
||||
Fl_Group *tabCW=(Fl_Group *)0;
|
||||
|
||||
Fl_Light_Button *btnCWrcvTrack=(Fl_Light_Button *)0;
|
||||
Fl_Value_Slider *sldrCWbandwidth=(Fl_Value_Slider *)0;
|
||||
|
||||
static void cb_btnCWrcvTrack(Fl_Light_Button* o, void*) {
|
||||
static void cb_sldrCWbandwidth(Fl_Value_Slider* o, void*) {
|
||||
progdefaults.CWbandwidth = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Counter *cntCWrange=(Fl_Counter *)0;
|
||||
|
||||
static void cb_cntCWrange(Fl_Counter* o, void*) {
|
||||
progdefaults.CWrange = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Check_Button *btnCWrcvTrack=(Fl_Check_Button *)0;
|
||||
|
||||
static void cb_btnCWrcvTrack(Fl_Check_Button* o, void*) {
|
||||
progdefaults.CWtrack = o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Value_Output *valCWrcvWPM=(Fl_Value_Output *)0;
|
||||
|
||||
static void cb_valCWrcvWPM(Fl_Value_Output*, void*) {
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Progress *prgsCWrcvWPM=(Fl_Progress *)0;
|
||||
|
||||
Fl_Value_Slider *sldrCWxmtWPM=(Fl_Value_Slider *)0;
|
||||
|
@ -526,17 +546,26 @@ static void cb_sldrCWxmtWPM(Fl_Value_Slider* o, void*) {
|
|||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Value_Output *valCWrcvWPM=(Fl_Value_Output *)0;
|
||||
Fl_Counter *cntCWlowerlimit=(Fl_Counter *)0;
|
||||
|
||||
static void cb_valCWrcvWPM(Fl_Value_Output*, void*) {
|
||||
progdefaults.changed = true;
|
||||
static void cb_cntCWlowerlimit(Fl_Counter* o, void*) {
|
||||
progdefaults.CWlowerlimit = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
sldrCWxmtWPM->minimum(o->value());
|
||||
sldrCWxmtWPM->value(progdefaults.CWspeed);
|
||||
sldrCWxmtWPM->redraw();
|
||||
cntCWupperlimit->minimum(o->value()+20);
|
||||
}
|
||||
|
||||
Fl_Value_Slider *sldrCWbandwidth=(Fl_Value_Slider *)0;
|
||||
Fl_Counter *cntCWupperlimit=(Fl_Counter *)0;
|
||||
|
||||
static void cb_sldrCWbandwidth(Fl_Value_Slider* o, void*) {
|
||||
progdefaults.CWbandwidth = (int)o->value();
|
||||
static void cb_cntCWupperlimit(Fl_Counter* o, void*) {
|
||||
progdefaults.CWupperlimit = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
sldrCWxmtWPM->maximum(o->value());
|
||||
sldrCWxmtWPM->value(progdefaults.CWspeed);
|
||||
sldrCWxmtWPM->redraw();
|
||||
cntCWlowerlimit->maximum(o->value()-20);
|
||||
}
|
||||
|
||||
Fl_Counter *cntCWweight=(Fl_Counter *)0;
|
||||
|
@ -546,10 +575,24 @@ static void cb_cntCWweight(Fl_Counter* o, void*) {
|
|||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Counter *cntCWrange=(Fl_Counter *)0;
|
||||
Fl_Counter *cntCWdash2dot=(Fl_Counter *)0;
|
||||
|
||||
static void cb_cntCWrange(Fl_Counter* o, void*) {
|
||||
progdefaults.CWrange = (int)o->value();
|
||||
static void cb_cntCWdash2dot(Fl_Counter* o, void*) {
|
||||
progdefaults.CWdash2dot=o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Counter *cntCWrisetime=(Fl_Counter *)0;
|
||||
|
||||
static void cb_cntCWrisetime(Fl_Counter* o, void*) {
|
||||
progdefaults.CWrisetime=o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Counter *cntCWdefWPM=(Fl_Counter *)0;
|
||||
|
||||
static void cb_cntCWdefWPM(Fl_Counter* o, void*) {
|
||||
progdefaults.defCWspeed = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
|
@ -1019,6 +1062,7 @@ static char *szBaudRates = "300|600|1200|2400|4800|9600|19200|38400|57600|115200
|
|||
o->callback((Fl_Callback*)cb_cboHamlibRig);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->when(FL_WHEN_RELEASE);
|
||||
o->readonly();
|
||||
}
|
||||
{ Fl_Input* o = inpRIGdev = new Fl_Input(269, 126, 120, 22, "Device:");
|
||||
o->callback((Fl_Callback*)cb_inpRIGdev);
|
||||
|
@ -1068,28 +1112,28 @@ static char *szBaudRates = "300|600|1200|2400|4800|9600|19200|38400|57600|115200
|
|||
o->hide();
|
||||
{ Fl_Group* o = new Fl_Group(0, 27, 400, 190);
|
||||
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
|
||||
{ Fl_Group* o = new Fl_Group(5, 35, 395, 145, "Mixer Controls");
|
||||
{ Fl_Group* o = new Fl_Group(5, 35, 395, 115, "Mixer");
|
||||
o->box(FL_ENGRAVED_FRAME);
|
||||
o->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE);
|
||||
{ Fl_Round_Button* o = btnDsp[0] = new Fl_Round_Button(20, 64, 55, 20, "dsp");
|
||||
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
|
||||
{ Fl_Round_Button* o = btnDsp[0] = new Fl_Round_Button(20, 60, 55, 20, "dsp");
|
||||
o->down_box(FL_DIAMOND_DOWN_BOX);
|
||||
o->value(1);
|
||||
o->selection_color((Fl_Color)2);
|
||||
o->callback((Fl_Callback*)cb_btnDsp);
|
||||
}
|
||||
{ Fl_Round_Button* o = btnDsp[1] = new Fl_Round_Button(20, 94, 55, 20, "dsp1");
|
||||
{ Fl_Round_Button* o = btnDsp[1] = new Fl_Round_Button(20, 90, 55, 20, "dsp1");
|
||||
o->down_box(FL_DIAMOND_DOWN_BOX);
|
||||
o->selection_color((Fl_Color)2);
|
||||
o->callback((Fl_Callback*)cb_btnDsp1);
|
||||
}
|
||||
{ Fl_Light_Button* o = btnLineIn = new Fl_Light_Button(145, 63, 74, 22, "Line In");
|
||||
{ Fl_Light_Button* o = btnLineIn = new Fl_Light_Button(125, 59, 74, 22, "Line In");
|
||||
o->selection_color((Fl_Color)3);
|
||||
o->callback((Fl_Callback*)cb_btnLineIn);
|
||||
}
|
||||
{ Fl_Light_Button* o = btnMicIn = new Fl_Light_Button(145, 93, 74, 22, "Mic In");
|
||||
{ Fl_Light_Button* o = btnMicIn = new Fl_Light_Button(125, 89, 74, 22, "Mic In");
|
||||
o->callback((Fl_Callback*)cb_btnMicIn);
|
||||
}
|
||||
{ Fl_Value_Slider* o = valPCMvolume = new Fl_Value_Slider(14, 139, 340, 21, "PCM");
|
||||
{ Fl_Value_Slider* o = valPCMvolume = new Fl_Value_Slider(14, 120, 340, 21, "PCM");
|
||||
o->type(5);
|
||||
o->color((Fl_Color)26);
|
||||
o->selection_color((Fl_Color)1);
|
||||
|
@ -1104,16 +1148,16 @@ static char *szBaudRates = "300|600|1200|2400|4800|9600|19200|38400|57600|115200
|
|||
}
|
||||
o->end();
|
||||
}
|
||||
{ Fl_Group* o = new Fl_Group(5, 180, 395, 34, "SC Corrections");
|
||||
{ Fl_Group* o = new Fl_Group(5, 150, 395, 65, "Sound Card");
|
||||
o->box(FL_ENGRAVED_FRAME);
|
||||
o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
{ Fl_Spinner* o = cntRxRateCorr = new Fl_Spinner(195, 185, 61, 24, "RX ppm:");
|
||||
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
|
||||
{ Fl_Spinner* o = cntRxRateCorr = new Fl_Spinner(294, 156, 75, 24, "RX ppm:");
|
||||
o->callback((Fl_Callback*)cb_cntRxRateCorr);
|
||||
o->step(1);
|
||||
o->minimum(-5000);
|
||||
o->maximum(5000);
|
||||
o->minimum(-50000);
|
||||
o->maximum(50000);
|
||||
}
|
||||
{ Fl_Spinner* o = cntTxRateCorr = new Fl_Spinner(330, 185, 61, 24, "TX ppm:");
|
||||
{ Fl_Spinner* o = cntTxRateCorr = new Fl_Spinner(294, 185, 75, 24, "TX ppm:");
|
||||
o->callback((Fl_Callback*)cb_cntTxRateCorr);
|
||||
o->step(1);
|
||||
o->minimum(-5000);
|
||||
|
@ -1178,20 +1222,47 @@ static char *szBaudRates = "300|600|1200|2400|4800|9600|19200|38400|57600|115200
|
|||
{ Fl_Group* o = tabCW = new Fl_Group(0, 50, 400, 170, "CW");
|
||||
o->color((Fl_Color)51);
|
||||
o->selection_color((Fl_Color)51);
|
||||
{ Fl_Group* o = new Fl_Group(5, 60, 390, 135);
|
||||
{ Fl_Group* o = new Fl_Group(1, 60, 398, 155);
|
||||
o->box(FL_ENGRAVED_FRAME);
|
||||
{ Fl_Light_Button* o = btnCWrcvTrack = new Fl_Light_Button(15, 160, 85, 20, "Rx Track");
|
||||
{ Fl_Value_Slider* o = sldrCWbandwidth = new Fl_Value_Slider(65, 65, 325, 20, "BW");
|
||||
o->type(5);
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->minimum(10);
|
||||
o->maximum(500);
|
||||
o->step(10);
|
||||
o->value(150);
|
||||
o->textsize(14);
|
||||
o->callback((Fl_Callback*)cb_sldrCWbandwidth);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWbandwidth);
|
||||
}
|
||||
{ Fl_Counter* o = cntCWrange = new Fl_Counter(140, 89, 65, 20, "Rx Trkg Rng");
|
||||
o->type(1);
|
||||
o->minimum(5);
|
||||
o->maximum(25);
|
||||
o->step(1);
|
||||
o->value(10);
|
||||
o->callback((Fl_Callback*)cb_cntCWrange);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWrange);
|
||||
}
|
||||
{ Fl_Check_Button* o = btnCWrcvTrack = new Fl_Check_Button(215, 89, 20, 20, "Enable Rx Trkg");
|
||||
o->down_box(FL_DOWN_BOX);
|
||||
o->value(1);
|
||||
o->selection_color((Fl_Color)2);
|
||||
o->callback((Fl_Callback*)cb_btnCWrcvTrack);
|
||||
o->align(FL_ALIGN_RIGHT);
|
||||
o->value(progdefaults.CWtrack);
|
||||
}
|
||||
{ Fl_Progress* o = prgsCWrcvWPM = new Fl_Progress(100, 68, 280, 20);
|
||||
{ Fl_Value_Output* o = valCWrcvWPM = new Fl_Value_Output(65, 113, 35, 20, "RxWPM");
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->callback((Fl_Callback*)cb_valCWrcvWPM);
|
||||
}
|
||||
{ Fl_Progress* o = prgsCWrcvWPM = new Fl_Progress(100, 113, 290, 20);
|
||||
o->color(FL_INACTIVE_COLOR);
|
||||
o->selection_color((Fl_Color)110);
|
||||
o->align(FL_ALIGN_CENTER);
|
||||
}
|
||||
{ Fl_Value_Slider* o = sldrCWxmtWPM = new Fl_Value_Slider(65, 98, 315, 20, "TxWPM");
|
||||
{ Fl_Value_Slider* o = sldrCWxmtWPM = new Fl_Value_Slider(65, 135, 325, 20, "TxWPM");
|
||||
o->type(5);
|
||||
o->color((Fl_Color)215);
|
||||
o->minimum(5);
|
||||
|
@ -1203,41 +1274,65 @@ static char *szBaudRates = "300|600|1200|2400|4800|9600|19200|38400|57600|115200
|
|||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWspeed);
|
||||
}
|
||||
{ Fl_Value_Output* o = valCWrcvWPM = new Fl_Value_Output(65, 68, 35, 20, "RxWPM");
|
||||
o->color(FL_BACKGROUND2_COLOR);
|
||||
o->callback((Fl_Callback*)cb_valCWrcvWPM);
|
||||
}
|
||||
{ Fl_Value_Slider* o = sldrCWbandwidth = new Fl_Value_Slider(65, 128, 315, 20, "BW");
|
||||
o->type(5);
|
||||
o->color((Fl_Color)23);
|
||||
o->minimum(10);
|
||||
o->maximum(500);
|
||||
o->step(10);
|
||||
o->value(150);
|
||||
o->textsize(14);
|
||||
o->callback((Fl_Callback*)cb_sldrCWbandwidth);
|
||||
{ Fl_Counter* o = cntCWlowerlimit = new Fl_Counter(203, 160, 65, 20, "Lower");
|
||||
o->type(1);
|
||||
o->minimum(5);
|
||||
o->maximum(20);
|
||||
o->step(5);
|
||||
o->value(10);
|
||||
o->callback((Fl_Callback*)cb_cntCWlowerlimit);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWbandwidth);
|
||||
o->value(progdefaults.CWlowerlimit);
|
||||
}
|
||||
{ Fl_Counter* o = cntCWweight = new Fl_Counter(300, 159, 80, 20, "Wt (%)");
|
||||
{ Fl_Counter* o = cntCWupperlimit = new Fl_Counter(325, 160, 65, 20, "Upper");
|
||||
o->type(1);
|
||||
o->minimum(25);
|
||||
o->maximum(75);
|
||||
o->maximum(200);
|
||||
o->step(5);
|
||||
o->value(100);
|
||||
o->callback((Fl_Callback*)cb_cntCWupperlimit);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWupperlimit);
|
||||
}
|
||||
{ Fl_Counter* o = cntCWweight = new Fl_Counter(64, 185, 65, 20, "Wt. %");
|
||||
o->type(1);
|
||||
o->minimum(20);
|
||||
o->maximum(80);
|
||||
o->step(1);
|
||||
o->value(50);
|
||||
o->callback((Fl_Callback*)cb_cntCWweight);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWweight);
|
||||
}
|
||||
{ Fl_Counter* o = cntCWrange = new Fl_Counter(165, 159, 80, 21, "Rx Rng");
|
||||
{ Fl_Counter* o = cntCWdash2dot = new Fl_Counter(205, 185, 64, 21, "Dash/Dot");
|
||||
o->type(1);
|
||||
o->minimum(2.5);
|
||||
o->maximum(4);
|
||||
o->step(0.1);
|
||||
o->value(3);
|
||||
o->callback((Fl_Callback*)cb_cntCWdash2dot);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWdash2dot);
|
||||
}
|
||||
{ Fl_Counter* o = cntCWrisetime = new Fl_Counter(325, 185, 65, 21, "Edge");
|
||||
o->type(1);
|
||||
o->minimum(0);
|
||||
o->maximum(15);
|
||||
o->step(0.1);
|
||||
o->value(4);
|
||||
o->callback((Fl_Callback*)cb_cntCWrisetime);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWrisetime);
|
||||
}
|
||||
{ Fl_Counter* o = cntCWdefWPM = new Fl_Counter(65, 160, 64, 21, "Default");
|
||||
o->type(1);
|
||||
o->minimum(5);
|
||||
o->maximum(20);
|
||||
o->maximum(200);
|
||||
o->step(1);
|
||||
o->value(5);
|
||||
o->callback((Fl_Callback*)cb_cntCWrange);
|
||||
o->value(18);
|
||||
o->callback((Fl_Callback*)cb_cntCWdefWPM);
|
||||
o->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.CWrange);
|
||||
o->value(progdefaults.defCWspeed);
|
||||
}
|
||||
o->end();
|
||||
}
|
||||
|
|
|
@ -381,6 +381,7 @@ progdefaults.changed = true;}
|
|||
label {Rig:}
|
||||
callback {progdefaults.changed = true;}
|
||||
xywh {230 101 160 22} box DOWN_BOX color 7 align 4
|
||||
code0 {o->readonly();}
|
||||
class Fl_ComboBox
|
||||
}
|
||||
Fl_Input inpRIGdev {
|
||||
|
@ -466,8 +467,8 @@ progdefaults.changed = true;}
|
|||
xywh {0 27 400 190} align 21
|
||||
} {
|
||||
Fl_Group {} {
|
||||
label {Mixer Controls} open
|
||||
xywh {5 35 395 145} box ENGRAVED_FRAME align 17
|
||||
label Mixer open
|
||||
xywh {5 35 395 115} box ENGRAVED_FRAME align 21
|
||||
} {
|
||||
Fl_Round_Button {btnDsp[0]} {
|
||||
label dsp
|
||||
|
@ -478,7 +479,7 @@ progdefaults.changed = true;}
|
|||
o->value(1);
|
||||
}
|
||||
progdefaults.changed = true;}
|
||||
xywh {20 64 55 20} down_box DIAMOND_DOWN_BOX value 1 selection_color 2
|
||||
xywh {20 60 55 20} down_box DIAMOND_DOWN_BOX value 1 selection_color 2
|
||||
}
|
||||
Fl_Round_Button {btnDsp[1]} {
|
||||
label dsp1
|
||||
|
@ -489,7 +490,7 @@ progdefaults.changed = true;}
|
|||
o->value(1);
|
||||
}
|
||||
progdefaults.changed = true;}
|
||||
xywh {20 94 55 20} down_box DIAMOND_DOWN_BOX selection_color 2
|
||||
xywh {20 90 55 20} down_box DIAMOND_DOWN_BOX selection_color 2
|
||||
}
|
||||
Fl_Light_Button btnLineIn {
|
||||
label {Line In}
|
||||
|
@ -503,7 +504,7 @@ progdefaults.changed = true;}
|
|||
progdefaults.LineIn = false;
|
||||
}
|
||||
progdefaults.changed = true;}
|
||||
xywh {145 63 74 22} selection_color 3
|
||||
xywh {125 59 74 22} selection_color 3
|
||||
code0 {extern void setMixerInput(int);}
|
||||
}
|
||||
Fl_Light_Button btnMicIn {
|
||||
|
@ -518,35 +519,35 @@ progdefaults.changed = true;}
|
|||
progdefaults.MicIn = false;
|
||||
}
|
||||
progdefaults.changed = true;}
|
||||
xywh {145 93 74 22}
|
||||
xywh {125 89 74 22}
|
||||
}
|
||||
Fl_Value_Slider valPCMvolume {
|
||||
label PCM
|
||||
callback {setPCMvolume(o->value());
|
||||
progdefaults.changed = true;}
|
||||
xywh {14 139 340 21} type {Horz Knob} color 26 selection_color 1 align 8 maximum 100 step 1 value 80 textsize 14
|
||||
xywh {14 120 340 21} type {Horz Knob} color 26 selection_color 1 align 8 maximum 100 step 1 value 80 textsize 14
|
||||
code0 {extern void setPCMvolume(double);}
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
label {SC Corrections} open
|
||||
xywh {5 180 395 34} box ENGRAVED_FRAME align 20
|
||||
label {Sound Card} open
|
||||
xywh {5 150 395 65} box ENGRAVED_FRAME align 21
|
||||
} {
|
||||
Fl_Spinner cntRxRateCorr {
|
||||
label {RX ppm:}
|
||||
callback {progdefaults.RX_corr = (int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {195 185 61 24}
|
||||
xywh {294 156 75 24}
|
||||
code0 {o->step(1);}
|
||||
code1 {o->minimum(-5000);}
|
||||
code2 {o->maximum(5000);}
|
||||
code1 {o->minimum(-50000);}
|
||||
code2 {o->maximum(50000);}
|
||||
}
|
||||
Fl_Spinner cntTxRateCorr {
|
||||
label {TX ppm:}
|
||||
callback {progdefaults.TX_corr = (int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {330 185 61 24}
|
||||
xywh {294 185 75 24}
|
||||
code0 {o->step(1);}
|
||||
code1 {o->minimum(-5000);}
|
||||
code2 {o->maximum(5000);}
|
||||
|
@ -609,51 +610,94 @@ progdefaults.changed = true;}
|
|||
xywh {0 50 400 170} color 51 selection_color 51
|
||||
} {
|
||||
Fl_Group {} {open
|
||||
xywh {5 60 390 135} box ENGRAVED_FRAME
|
||||
xywh {1 60 398 155} box ENGRAVED_FRAME
|
||||
} {
|
||||
Fl_Light_Button btnCWrcvTrack {
|
||||
label {Rx Track}
|
||||
callback {progdefaults.CWtrack = o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {15 160 85 20} value 1 selection_color 2
|
||||
code0 {o->value(progdefaults.CWtrack);}
|
||||
}
|
||||
Fl_Progress prgsCWrcvWPM {
|
||||
xywh {100 68 280 20} color 8 selection_color 110 align 0
|
||||
}
|
||||
Fl_Value_Slider sldrCWxmtWPM {
|
||||
label TxWPM
|
||||
callback {progdefaults.CWspeed = (int)o->value();
|
||||
progdefaults.changed = true;} selected
|
||||
xywh {65 98 315 20} type {Horz Knob} color 215 align 4 minimum 5 maximum 100 step 1 value 20 textsize 14
|
||||
code0 {o->value(progdefaults.CWspeed);}
|
||||
}
|
||||
Fl_Value_Output valCWrcvWPM {
|
||||
label RxWPM
|
||||
callback {progdefaults.changed = true;}
|
||||
xywh {65 68 35 20} color 7
|
||||
}
|
||||
Fl_Value_Slider sldrCWbandwidth {
|
||||
label BW
|
||||
callback {progdefaults.CWbandwidth = (int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {65 128 315 20} type {Horz Knob} color 23 align 4 minimum 10 maximum 500 step 10 value 150 textsize 14
|
||||
xywh {65 65 325 20} type {Horz Knob} color 7 align 4 minimum 10 maximum 500 step 10 value 150 textsize 14
|
||||
code0 {o->value(progdefaults.CWbandwidth);}
|
||||
}
|
||||
Fl_Counter cntCWweight {
|
||||
label {Wt (%)}
|
||||
callback {progdefaults.CWweight=(int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {300 159 80 20} type Simple align 4 minimum 25 maximum 75 step 1 value 50
|
||||
code0 {o->value(progdefaults.CWweight);}
|
||||
}
|
||||
Fl_Counter cntCWrange {
|
||||
label {Rx Rng}
|
||||
label {Rx Trkg Rng}
|
||||
callback {progdefaults.CWrange = (int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {165 159 80 21} type Simple align 4 minimum 5 maximum 20 step 1 value 5
|
||||
xywh {140 89 65 20} type Simple align 4 minimum 5 maximum 25 step 1 value 10
|
||||
code0 {o->value(progdefaults.CWrange);}
|
||||
}
|
||||
Fl_Check_Button btnCWrcvTrack {
|
||||
label {Enable Rx Trkg}
|
||||
callback {progdefaults.CWtrack = o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {215 89 20 20} down_box DOWN_BOX value 1 align 8
|
||||
code0 {o->value(progdefaults.CWtrack);}
|
||||
}
|
||||
Fl_Value_Output valCWrcvWPM {
|
||||
label RxWPM
|
||||
callback {progdefaults.changed = true;}
|
||||
xywh {65 113 35 20} color 7
|
||||
}
|
||||
Fl_Progress prgsCWrcvWPM {
|
||||
xywh {100 113 290 20} color 8 selection_color 110 align 0
|
||||
}
|
||||
Fl_Value_Slider sldrCWxmtWPM {
|
||||
label TxWPM
|
||||
callback {progdefaults.CWspeed = (int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {65 135 325 20} type {Horz Knob} color 215 align 4 minimum 5 maximum 100 step 1 value 20 textsize 14
|
||||
code0 {o->value(progdefaults.CWspeed);}
|
||||
}
|
||||
Fl_Counter cntCWlowerlimit {
|
||||
label Lower
|
||||
callback {progdefaults.CWlowerlimit = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
sldrCWxmtWPM->minimum(o->value());
|
||||
sldrCWxmtWPM->value(progdefaults.CWspeed);
|
||||
sldrCWxmtWPM->redraw();
|
||||
cntCWupperlimit->minimum(o->value()+20);}
|
||||
xywh {203 160 65 20} type Simple align 4 minimum 5 maximum 20 step 5 value 10
|
||||
code0 {o->value(progdefaults.CWlowerlimit);}
|
||||
}
|
||||
Fl_Counter cntCWupperlimit {
|
||||
label Upper
|
||||
callback {progdefaults.CWupperlimit = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
sldrCWxmtWPM->maximum(o->value());
|
||||
sldrCWxmtWPM->value(progdefaults.CWspeed);
|
||||
sldrCWxmtWPM->redraw();
|
||||
cntCWlowerlimit->maximum(o->value()-20);}
|
||||
xywh {325 160 65 20} type Simple align 4 minimum 25 maximum 200 step 5 value 100
|
||||
code0 {o->value(progdefaults.CWupperlimit);}
|
||||
}
|
||||
Fl_Counter cntCWweight {
|
||||
label {Wt. %}
|
||||
callback {progdefaults.CWweight=(int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {64 185 65 20} type Simple align 4 minimum 20 maximum 80 step 1 value 50
|
||||
code0 {o->value(progdefaults.CWweight);}
|
||||
}
|
||||
Fl_Counter cntCWdash2dot {
|
||||
label {Dash/Dot}
|
||||
callback {progdefaults.CWdash2dot=o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {205 185 64 21} type Simple align 4 minimum 2.5 maximum 4 step 0.1 value 3
|
||||
code0 {o->value(progdefaults.CWdash2dot);}
|
||||
}
|
||||
Fl_Counter cntCWrisetime {
|
||||
label Edge
|
||||
callback {progdefaults.CWrisetime=o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {325 185 65 21} type Simple align 4 minimum 0 maximum 15 step 0.1 value 4
|
||||
code0 {o->value(progdefaults.CWrisetime);}
|
||||
}
|
||||
Fl_Counter cntCWdefWPM {
|
||||
label Default
|
||||
callback {progdefaults.defCWspeed = (int)o->value();
|
||||
progdefaults.changed = true;} selected
|
||||
xywh {65 160 64 21} type Simple align 4 minimum 5 maximum 200 step 1 value 18
|
||||
code0 {o->value(progdefaults.defCWspeed);}
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Group tabDomEX {
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "macros.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "cw.h"
|
||||
|
||||
#include <FL/Enumerations.H>
|
||||
#include "File_Selector.h"
|
||||
|
||||
|
@ -650,9 +652,31 @@ int TextEdit::handle_key() {
|
|||
PauseBreak = true;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (key == (FL_KP + '+')) {
|
||||
if (active_modem == cw_modem) active_modem->incWPM();
|
||||
return 1;
|
||||
}
|
||||
if (key == (FL_KP + '-')) {
|
||||
if (active_modem == cw_modem) active_modem->decWPM();
|
||||
return 1;
|
||||
}
|
||||
if (key == (FL_KP + '*')) {
|
||||
if (active_modem == cw_modem) active_modem->toggleWPM();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (key >= FL_F && key <= FL_F_Last)
|
||||
return handle_fnckey(key);
|
||||
|
||||
if (key == FL_Tab && active_modem == cw_modem) {
|
||||
while (chrptr < buff.length()) {
|
||||
attr[chrptr] = 2;
|
||||
chrptr++;
|
||||
}
|
||||
redraw();
|
||||
return 1;
|
||||
}
|
||||
|
||||
// substitute the FN # you want to map for each
|
||||
// ie: F1 ==> 1 + Fl_F
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <FL/fl_ask.H>
|
||||
#include <FL/Fl_Pixmap.H>
|
||||
#include "fl_font_browser.h"
|
||||
#include <FL/Fl_Image.H>
|
||||
|
||||
#include "version.h"
|
||||
|
@ -67,6 +66,7 @@
|
|||
#include "qrzcall.h"
|
||||
|
||||
#include "combo.h"
|
||||
#include "font_browser.h"
|
||||
|
||||
#include "status.h"
|
||||
|
||||
|
@ -683,30 +683,34 @@ void cb_mnuConfigModems(Fl_Menu_*, void*) {
|
|||
dlgConfig->show();
|
||||
}
|
||||
|
||||
void cb_FontBrowser(Fl_Font_Browser*, void* v)
|
||||
void cb_FontBrowser(Font_Browser*, void* v)
|
||||
{
|
||||
Fl_Font_Browser *ft= (Fl_Font_Browser*)v;
|
||||
Font_Browser *ft= (Font_Browser*)v;
|
||||
|
||||
Fl_Font fnt = (Fl_Font)ft->box_Example->GetFontName();
|
||||
int size = ft->box_Example->GetFontSize();
|
||||
int style = ft->box_Example->GetFontStyle();
|
||||
Fl_Font fnt = ft->fontNumber();
|
||||
int size = ft->fontSize();
|
||||
|
||||
ReceiveText->setFont((Fl_Font)(fnt + style));
|
||||
ReceiveText->setFont(fnt);
|
||||
ReceiveText->setFontSize(size);
|
||||
|
||||
TransmitText->setFont((Fl_Font)(fnt + style));
|
||||
TransmitText->setFont(fnt);
|
||||
TransmitText->setFontSize(size);
|
||||
|
||||
progdefaults.Font = (int)(fnt + style);
|
||||
progdefaults.FontSize = (int)size;
|
||||
progdefaults.Font = (int)(fnt);
|
||||
progdefaults.FontSize = size;
|
||||
// progdefaults.FontColor = (int)clr;
|
||||
|
||||
ft->hide();
|
||||
}
|
||||
|
||||
void cb_mnuConfigFonts(Fl_Menu_*, void *) {
|
||||
static Fl_Font_Browser *b = (Fl_Font_Browser *)0;
|
||||
if (!b) b = new Fl_Font_Browser;
|
||||
static Font_Browser *b = (Font_Browser *)0;
|
||||
if (!b) {
|
||||
b = new Font_Browser;
|
||||
b->fontNumber((Fl_Font)progdefaults.Font);
|
||||
b->fontSize(progdefaults.FontSize);
|
||||
// b->fontColor(progdefaults.FontColor);
|
||||
}
|
||||
b->callback((Fl_Callback*)cb_FontBrowser, (void*)(b));
|
||||
b->show();
|
||||
}
|
||||
|
@ -1248,9 +1252,12 @@ void display_metric(double metric)
|
|||
|
||||
void put_cwRcvWPM(double wpm)
|
||||
{
|
||||
if (!prgsCWrcvWPM) return;
|
||||
// if (!prgsCWrcvWPM) return;
|
||||
int U = progdefaults.CWupperlimit;
|
||||
int L = progdefaults.CWlowerlimit;
|
||||
double dWPM = 100.0*(wpm - L)/(U - L);
|
||||
Fl::lock();
|
||||
prgsCWrcvWPM->value(100.0*(wpm-CW_MIN_SPEED)/(CW_MAX_SPEED - CW_MIN_SPEED));
|
||||
prgsCWrcvWPM->value(dWPM);
|
||||
valCWrcvWPM->value((int)wpm);
|
||||
Fl::unlock();
|
||||
Fl::awake();
|
||||
|
@ -1361,6 +1368,13 @@ void put_WARNstatus(bool on)
|
|||
Fl::unlock();
|
||||
}
|
||||
|
||||
void set_CWwpm()
|
||||
{
|
||||
Fl::lock();
|
||||
sldrCWxmtWPM->value(progdefaults.CWspeed);
|
||||
Fl::unlock();
|
||||
}
|
||||
|
||||
void clear_StatusMessages()
|
||||
{
|
||||
Fl::lock();
|
||||
|
@ -1527,6 +1541,7 @@ void setMixerInput(int dev)
|
|||
mixer.SetCurrentInputSource(n);
|
||||
}
|
||||
|
||||
|
||||
void resetSoundCard(int n) {
|
||||
string scd = "/dev/dsp";
|
||||
if (n == 1) scd += '1';
|
||||
|
|
|
@ -1,451 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// fl_font_browser.cxx v 0.0.2 2005-10-17
|
||||
//
|
||||
// for the Fast Light Tool Kit (FLTK) 1.1.x .
|
||||
//
|
||||
// by Mariwan Jalal
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "fltk_kurdi@yahoo.com".
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#include "fl_font_browser.h"
|
||||
using namespace std;
|
||||
|
||||
void Fl_Font_Browser::callback(void (*cb)(Fl_Widget *, void *), void *d )
|
||||
{
|
||||
callback_ = cb;
|
||||
data_ = d;
|
||||
}
|
||||
|
||||
|
||||
// Font preview box constructor
|
||||
Fl_Font_Preview_Box::Fl_Font_Preview_Box(int x, int y, int w, int h, char*l):Fl_Widget(x, y, w, h, l)
|
||||
{
|
||||
fontName = 1; // First font in the server
|
||||
fontSize = 14; // Initianl font size
|
||||
fontStyle=0;
|
||||
box(FL_DOWN_BOX);
|
||||
color(FL_WHITE); // Background color
|
||||
}
|
||||
|
||||
// Draw method for the font preview box
|
||||
void Fl_Font_Preview_Box::draw()
|
||||
{
|
||||
draw_box();
|
||||
fl_font((Fl_Font)fontName+fontStyle, fontSize); // Select font to bo used by the widget
|
||||
fl_color(FL_BLACK);
|
||||
fl_draw(label(), x()+3, y()+3, w()-6, h()-6, align());
|
||||
}
|
||||
|
||||
// Set font name and size to be used by the box
|
||||
void Fl_Font_Preview_Box::SetFont( int fontname,int style,int fontsize)
|
||||
{
|
||||
fontName=fontname;
|
||||
fontSize=fontsize;
|
||||
fontStyle=style;
|
||||
redraw();
|
||||
}
|
||||
//Get font name ( in intiger)
|
||||
int Fl_Font_Preview_Box::GetFontName()
|
||||
{
|
||||
return fontName;
|
||||
}
|
||||
|
||||
//Get font style ( in intiger)
|
||||
int Fl_Font_Preview_Box::GetFontStyle()
|
||||
{
|
||||
return fontStyle;
|
||||
}
|
||||
// Return font size used
|
||||
int Fl_Font_Preview_Box::GetFontSize()
|
||||
{
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
// Normal Bold, Italic, or Bold italic selected
|
||||
void cb_SyleSelected (Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Fl_Font_Browser *ft=(Fl_Font_Browser*)frmWid;
|
||||
switch (ft->lst_Style->value())
|
||||
{
|
||||
case 1: //Normal
|
||||
{
|
||||
ft->box_Example->SetFont(ft->box_Example->GetFontName(),0, ft->pickedsize);
|
||||
break;
|
||||
}
|
||||
case 2: //Bold
|
||||
{
|
||||
ft->box_Example->SetFont(ft->box_Example->GetFontName(),1, ft->pickedsize);
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: //Italic
|
||||
{
|
||||
ft->box_Example->SetFont(ft->box_Example->GetFontName(),2, ft->pickedsize);
|
||||
break;
|
||||
}
|
||||
case 4: //Bold Italic
|
||||
{
|
||||
ft->box_Example->SetFont(ft->box_Example->GetFontName(),3, ft->pickedsize);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ft->txt_InputStyle->value(ft->lst_Style->text(ft->lst_Style->value()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cb_okBtn_Red(Fl_Button* o, void* v)
|
||||
{
|
||||
((Fl_Font_Browser*)(o->parent()))->cb_okBtn(o,v);
|
||||
|
||||
}
|
||||
|
||||
void Fl_Font_Browser::cb_okBtn(Fl_Button* b, void*v)
|
||||
{
|
||||
// Do any callback that is registered...
|
||||
//Fl_Font_Browser *ft=(Fl_Font_Browser*) v;
|
||||
if (callback_!=0)
|
||||
(*callback_)(this, data_);
|
||||
}
|
||||
|
||||
// Cancel button callback
|
||||
void cb_Cancel (Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Fl_Font_Browser *ft=(Fl_Font_Browser*)frmWid;
|
||||
ft->hide();
|
||||
}
|
||||
|
||||
// Font size changed callback
|
||||
void cb_FontSize_Selected (Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Fl_Font_Browser *ft=(Fl_Font_Browser*)frmWid;
|
||||
ft->pickedsize=atoi(ft->lst_Size->text(ft->lst_Size->value()));
|
||||
ft->box_Example->SetFont(ft->box_Example->GetFontName(),ft->box_Example->GetFontStyle(), ft->pickedsize);
|
||||
ft->box_Example->redraw();
|
||||
}
|
||||
|
||||
// Sorting function for Fl_browser (A -> Z)
|
||||
void ForwardSort(Fl_Browser *brows)
|
||||
{
|
||||
for ( int t=1; t<=brows->size(); t++ )
|
||||
{
|
||||
for ( int r=t+1; r<=brows->size(); r++ )
|
||||
{
|
||||
if ( strcasecmp(brows->text(t), brows->text(r)) > 0 )
|
||||
{
|
||||
brows->swap(t,r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Font Name changed callback
|
||||
void cb_FontName_Selected(Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Fl_Font_Browser *ft=(Fl_Font_Browser*)frmWid;
|
||||
int fn = ft->lst_Font->value();
|
||||
if (!fn) return;
|
||||
fn--;
|
||||
ft->lst_Size->clear();
|
||||
ft->txt_InputFont->value(ft->lst_Font->text(ft->lst_Font->value())); // show the font name in the input
|
||||
int *s;
|
||||
int t;
|
||||
int i;
|
||||
for (i=0;;i++)
|
||||
{
|
||||
const char *name = Fl::get_font_name((Fl_Font)i,&t);
|
||||
if (strcmp(name,ft->lst_Font->text(ft->lst_Font->value()))==0)
|
||||
break;
|
||||
}
|
||||
int n = Fl::get_font_sizes((Fl_Font)i, s);
|
||||
// Retrive Sizes
|
||||
if (n)
|
||||
{
|
||||
|
||||
if (s[0] == 0)
|
||||
{
|
||||
// many sizes;
|
||||
int j = 1;
|
||||
for (int i = 1; i<74 ; i++)
|
||||
{
|
||||
char buf[20];
|
||||
if (j < n && i==s[j])
|
||||
{
|
||||
sprintf(buf,"%d",i);
|
||||
j++;
|
||||
}
|
||||
else
|
||||
sprintf(buf,"%d",i);
|
||||
ft->lst_Size->add(buf);
|
||||
}
|
||||
ft->lst_Size->value( ft->pickedsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
// some sizes
|
||||
int w = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
if (s[i]<=ft->pickedsize)
|
||||
w = i;
|
||||
char buf[20];
|
||||
sprintf(buf,"%d",s[i]);
|
||||
ft->lst_Size->add(buf);
|
||||
}
|
||||
ft->lst_Size->value(w+1);
|
||||
|
||||
}
|
||||
int gg=ft->GetFontNr(ft->lst_Font->text(ft->lst_Font->value()));
|
||||
// Retrive Styles
|
||||
ft->lst_Style->clear();
|
||||
ft->lst_Style->add("Normal");
|
||||
ft->lst_Style->value(1);
|
||||
for (i=gg+1; i<gg+2;i++)
|
||||
{
|
||||
if (i >= ft->numFonts())
|
||||
break;
|
||||
const char *name = Fl::get_font_name((Fl_Font)i,&t);
|
||||
char buffer[128];
|
||||
sprintf(buffer,"%s %s",ft->lst_Font->text(ft->lst_Font->value()), "bold");
|
||||
if(strcmp(name,buffer)==0)
|
||||
{
|
||||
ft->lst_Style->add("Bold");
|
||||
}
|
||||
else
|
||||
sprintf(buffer,"%s %s",ft->lst_Font->text(ft->lst_Font->value()), "italic");
|
||||
if (strcmp(name,buffer)==0)
|
||||
ft->lst_Style->add("Italic");
|
||||
|
||||
else
|
||||
|
||||
sprintf(buffer,"%s %s",ft->lst_Font->text(ft->lst_Font->value()), "bold italic");
|
||||
if (strcmp(name,buffer)==0)
|
||||
{
|
||||
ft->lst_Style->add("Bold Italic");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ft->box_Example->SetFont(ft->GetFontNr(ft->lst_Font->text(ft->lst_Font->value())),0, ft->pickedsize);
|
||||
ft->txt_InputSize->value(ft->lst_Size->text(ft->lst_Size->value()));
|
||||
}
|
||||
}
|
||||
// Change to Upper case
|
||||
char* ToUpperCase(const char* buf)
|
||||
{
|
||||
char *buf1=new char[strlen(buf)+1];
|
||||
for (unsigned int i=0; i<strlen(buf)+1;i++)
|
||||
{
|
||||
buf1[i]=toupper(buf[i]);
|
||||
}
|
||||
return buf1;
|
||||
}
|
||||
|
||||
// Change to Lower case
|
||||
char* ToLowerCase(const char* buf)
|
||||
{
|
||||
char *buf1=new char[strlen(buf)+1];
|
||||
for (unsigned int i=0; i<strlen(buf)+1;i++)
|
||||
{
|
||||
buf1[i]=tolower(buf[i]);
|
||||
}
|
||||
return buf1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This function will find the font name written in the font text box..
|
||||
void cb_txtInputFontName(Fl_Widget*, void* frmWid)
|
||||
{
|
||||
Fl_Font_Browser *ft=(Fl_Font_Browser*)frmWid;
|
||||
ft->lst_Font->value(0); // deselect item selected before.
|
||||
for (int i=1; i<= ft->lst_Font->size();i++)// Search for the font Full name
|
||||
{
|
||||
if (strcmp(ToUpperCase(ft->lst_Font->text(i)),ToUpperCase(ft->txt_InputFont->value()))==0)
|
||||
{
|
||||
ft->lst_Font->value(i);
|
||||
ft->lst_Font->show(i);
|
||||
ft->txt_InputFont->value(ft->lst_Font->text(ft->lst_Font->value()));
|
||||
ft->lst_Font->do_callback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
ft->txt_InputFont->take_focus();//Return the focus to the widget
|
||||
}
|
||||
// This function will find the font style written in the font text box..
|
||||
void cb_txtInputFontStyle(Fl_Widget*, void* frmWid)
|
||||
{
|
||||
Fl_Font_Browser *ft=(Fl_Font_Browser*)frmWid;
|
||||
ft->lst_Style->value(0); // deselect item selected before.
|
||||
for (int i=1; i<= ft->lst_Style->size();i++)// Search for the font Full name
|
||||
{
|
||||
if (strcmp(ToUpperCase(ft->lst_Style->text(i)),ToUpperCase(ft->txt_InputStyle->value()))==0)
|
||||
{
|
||||
ft->lst_Style->value(i);
|
||||
ft->lst_Style->show(i);
|
||||
ft->txt_InputStyle->value(ft->lst_Style->text(ft->lst_Style->value()));
|
||||
ft->lst_Style->do_callback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
ft->txt_InputStyle->take_focus();//Return the focus to the widget
|
||||
}
|
||||
|
||||
// This function will find the font size written in the font text box..
|
||||
void cb_txtInputFontSize(Fl_Widget*, void* frmWid)
|
||||
{
|
||||
Fl_Font_Browser *ft=(Fl_Font_Browser*)frmWid;
|
||||
ft->lst_Size->value(0); // deselect item selected before.
|
||||
int i;
|
||||
for (i=1; i<= ft->lst_Size->size();i++)// Search for the font Full name
|
||||
{
|
||||
int g1=atoi(ft->lst_Size->text(i)); // Size list
|
||||
int g2=atoi(ft->txt_InputSize->value()); // Size enterd
|
||||
if (g1==g2)
|
||||
{
|
||||
ft->lst_Size->value(i);
|
||||
ft->lst_Size->show(i);
|
||||
ft->txt_InputSize->value(ft->lst_Size->text(ft->lst_Size->value()));
|
||||
ft->lst_Size->do_callback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i>ft->lst_Size->size()) // This means that the size enterd is not availabel
|
||||
{
|
||||
|
||||
ft->box_Example->SetFont(ft->box_Example->GetFontName(),ft->box_Example->GetFontStyle(), atoi(ft->txt_InputSize->value()));
|
||||
ft->lst_Size->deselect(0); // Deselect item previously selected
|
||||
}
|
||||
ft->txt_InputSize->take_focus(); //Return the focus to the widget
|
||||
}
|
||||
|
||||
// if everything correct should return => zero .. <zero when error occure.
|
||||
int Fl_Font_Browser::GetFontNr(const char *fontNametoNr)
|
||||
{
|
||||
int t;
|
||||
char fontNameString[255];/// this should be fixed mariwan 2005-10-07
|
||||
if ( lst_Style->value()>1) // check if the font is not bold ,italic , bold italic
|
||||
sprintf(fontNameString,"%s %s",lst_Font->text(lst_Font->value()),ToLowerCase(lst_Style->text(lst_Style->value())));
|
||||
else
|
||||
sprintf(fontNameString,"%s",lst_Font->text(lst_Font->value()));
|
||||
int i ;
|
||||
for (i=0;;i++)
|
||||
{
|
||||
const char *name = Fl::get_font_name((Fl_Font)i,&t);
|
||||
if (strcmp(name,fontNameString)==0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
Fl_Font_Browser::Fl_Font_Browser():Fl_Window(100,100,440,330,"Font Browser")
|
||||
{
|
||||
lst_Font = new Fl_Browser(10, 55, 195, 160);
|
||||
lst_Font->labelsize(12);
|
||||
lst_Font->textsize(12);
|
||||
lst_Font->callback((Fl_Callback*)cb_FontName_Selected, (void*)(lst_Font->parent()));
|
||||
lst_Font->type(FL_HOLD_BROWSER);
|
||||
|
||||
txt_InputFont = new Fl_Input(10, 30, 195, 24, "Font:");
|
||||
txt_InputFont->labelsize(12);
|
||||
txt_InputFont->textsize(12);
|
||||
txt_InputFont->align(FL_ALIGN_TOP_LEFT);
|
||||
txt_InputFont->when(FL_WHEN_ENTER_KEY);
|
||||
txt_InputFont->callback((Fl_Callback*)cb_txtInputFontName, (void*)(txt_InputFont->parent()));
|
||||
|
||||
lst_Style = new Fl_Browser(215, 55, 70, 160);
|
||||
lst_Style->labelsize(12);
|
||||
lst_Style->type(FL_HOLD_BROWSER);
|
||||
lst_Style->textsize(12);
|
||||
lst_Style->callback((Fl_Callback*)cb_SyleSelected, (void*)(lst_Style->parent()));
|
||||
|
||||
txt_InputStyle = new Fl_Input(215, 30, 70, 24, "Style:");
|
||||
txt_InputStyle->labelsize(12);
|
||||
txt_InputStyle->align(FL_ALIGN_TOP_LEFT);
|
||||
txt_InputStyle->textsize(12);
|
||||
txt_InputStyle->callback((Fl_Callback*)cb_txtInputFontStyle, (void*)(txt_InputStyle->parent()));
|
||||
|
||||
lst_Size = new Fl_Browser(295, 55, 75, 159);
|
||||
lst_Size->labelsize(12);
|
||||
lst_Size->type(FL_HOLD_BROWSER);
|
||||
lst_Size->textsize(12);
|
||||
lst_Size->callback((Fl_Callback*)cb_FontSize_Selected, (void*)(lst_Size->parent()));
|
||||
|
||||
txt_InputSize = new Fl_Input(295, 30, 75, 24, "Size:");
|
||||
txt_InputSize->labelsize(12);
|
||||
txt_InputSize->align(FL_ALIGN_TOP_LEFT);
|
||||
txt_InputSize->textsize(12);
|
||||
txt_InputSize->callback((Fl_Callback*)cb_txtInputFontSize, (void*)(txt_InputSize->parent()));
|
||||
|
||||
btn_OK =new Fl_Button(375, 30, 60, 24, "&OK");
|
||||
btn_OK->shortcut(0x8006f);
|
||||
btn_OK->labelfont(1);
|
||||
btn_OK->labelsize(14);
|
||||
btn_OK->callback((Fl_Callback*)cb_okBtn_Red );
|
||||
|
||||
btn_Cancel =new Fl_Button(375, 60, 60, 24, "Cancel");
|
||||
btn_Cancel->labelsize(14);
|
||||
btn_Cancel->callback((Fl_Callback*)cb_Cancel, (void *)(btn_Cancel->parent()));
|
||||
|
||||
box_Example = new Fl_Font_Preview_Box(5, 220, 430, 100,
|
||||
"AaBbCcDdEeFfGgHhIk\n0123456789");
|
||||
box_Example->box(FL_DOWN_BOX);
|
||||
box_Example->labelsize(12);
|
||||
box_Example->align(FL_ALIGN_WRAP|FL_ALIGN_CLIP|FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
|
||||
set_modal();
|
||||
end();
|
||||
// Initializations
|
||||
pickedsize = 14; // Font Size to be used
|
||||
//
|
||||
int k = Fl::set_fonts(0); // Nr of fonts available on the server
|
||||
numfonts = k;
|
||||
for(int i= 0; i < k; i++)
|
||||
{
|
||||
int t;
|
||||
const char *name = Fl::get_font_name((Fl_Font)i,&t);
|
||||
char buffer[128];
|
||||
|
||||
// Load the font list .. Ignore the bold and italic types of the font
|
||||
if(!((t & FL_BOLD) ||(t & FL_ITALIC)))
|
||||
{
|
||||
sprintf(buffer, "%s",name);
|
||||
lst_Font->add(buffer);
|
||||
}
|
||||
}
|
||||
// Sort the font Alphabetically
|
||||
ForwardSort(lst_Font);
|
||||
|
||||
lst_Font->value(1); // Select the first font in the list
|
||||
lst_Style->value(1);
|
||||
lst_Font->do_callback(); // Do font selected callback .. to draw the preview
|
||||
lst_Style->do_callback();
|
||||
this->callback_ = 0; // Initialize Widgets callback
|
||||
this->data_ = 0; // And the data
|
||||
}
|
|
@ -0,0 +1,204 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Font_Browser.cpp v 0.0.3 2007-04-21
|
||||
//
|
||||
// for the Fast Light Tool Kit (FLTK) 1.1.x .
|
||||
//
|
||||
// David Freese, w1hkj@w1hkj.com
|
||||
// based on similar widget by Mariwan Jalal
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "fltk_kurdi@yahoo.com".
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "font_browser.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Font Color selected
|
||||
void Font_Browser::ColorSelect()
|
||||
{
|
||||
fontcolor = fl_show_colormap( fontcolor );
|
||||
btn_Color->color( fontcolor );
|
||||
box_Example->SetFont( fontnbr, fontsize, fontcolor );
|
||||
}
|
||||
|
||||
void cb_Color_Select(Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Font_Browser *ft=(Font_Browser*)frmWid;
|
||||
ft->ColorSelect();
|
||||
}
|
||||
|
||||
// OK button pressed
|
||||
void Font_Browser::okBtn()
|
||||
{
|
||||
if (callback_!=0)
|
||||
(*callback_)(this, data_);
|
||||
}
|
||||
|
||||
void cb_okBtn(Fl_Button* o, void* v)
|
||||
{
|
||||
((Font_Browser*)(o->parent()))->okBtn();
|
||||
}
|
||||
|
||||
// Cancel button callback
|
||||
void cb_Cancel (Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Font_Browser *ft=(Font_Browser*)frmWid;
|
||||
ft->hide();
|
||||
}
|
||||
|
||||
// Font size changed callback
|
||||
void Font_Browser::FontSizeSelect()
|
||||
{
|
||||
txt_OutputSize->value(lst_Size->text( lst_Size->value() ) );
|
||||
fontsize = atoi( lst_Size->text( lst_Size->value() ) );
|
||||
box_Example->SetFont( fontnbr, fontsize, fontcolor );
|
||||
box_Example->redraw();
|
||||
}
|
||||
|
||||
void cb_FontSize_Selected (Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Font_Browser *ft=(Font_Browser*)frmWid;
|
||||
ft->FontSizeSelect();
|
||||
}
|
||||
|
||||
// Sort the font list
|
||||
void Font_Browser::FontSort()
|
||||
{
|
||||
for ( int t = 1; t <= lst_Font->size() - 1; t++ )
|
||||
for ( int r = t+1; r <= lst_Font->size(); r++ )
|
||||
if ( strcasecmp(lst_Font->text(t), lst_Font->text(r)) > 0 )
|
||||
lst_Font->swap(t,r);
|
||||
}
|
||||
|
||||
// Font Name changed callback
|
||||
void Font_Browser::FontNameSelect()
|
||||
{
|
||||
int fn = lst_Font->value();
|
||||
|
||||
if (!fn)
|
||||
return;
|
||||
|
||||
fontnbr = (Fl_Font)reinterpret_cast<int>(lst_Font->data(fn));
|
||||
|
||||
// show the font name in the input
|
||||
txt_OutputFont->value(Fl::get_font_name(fontnbr));
|
||||
|
||||
box_Example->SetFont( fontnbr, fontsize, fontcolor );
|
||||
|
||||
}
|
||||
|
||||
void cb_FontName_Selected(Fl_Widget*, void*frmWid)
|
||||
{
|
||||
Font_Browser *ft=(Font_Browser*)frmWid;
|
||||
ft->FontNameSelect();
|
||||
}
|
||||
|
||||
Font_Browser::Font_Browser(char *lbl ) :
|
||||
Fl_Window(100,100, 400, 225, lbl)
|
||||
{
|
||||
txt_OutputFont = new Fl_Output(5, 15, 280, 22, "Font:");
|
||||
txt_OutputFont->labelsize(12);
|
||||
txt_OutputFont->textsize(12);
|
||||
txt_OutputFont->align(FL_ALIGN_TOP_LEFT);
|
||||
txt_OutputFont->when(FL_WHEN_ENTER_KEY);
|
||||
|
||||
txt_OutputSize = new Fl_Output(290, 15, 50, 22, "Size:");
|
||||
txt_OutputSize->labelsize(12);
|
||||
txt_OutputSize->align(FL_ALIGN_TOP_LEFT);
|
||||
txt_OutputSize->textsize(12);
|
||||
|
||||
lst_Font = new Fl_Browser(5, 40, 280, 100);
|
||||
lst_Font->labelsize(12);
|
||||
lst_Font->textsize(12);
|
||||
lst_Font->type(FL_HOLD_BROWSER);
|
||||
lst_Font->callback( (Fl_Callback*)cb_FontName_Selected, this );
|
||||
|
||||
lst_Size = new Fl_Browser(290, 40, 50, 100);
|
||||
lst_Size->labelsize(12);
|
||||
lst_Size->type(FL_HOLD_BROWSER);
|
||||
lst_Size->textsize(12);
|
||||
lst_Size->callback( (Fl_Callback*)cb_FontSize_Selected, this );
|
||||
|
||||
btn_OK =new Fl_Button(345, 40, 50, 25, "&OK");
|
||||
btn_OK->shortcut(0x8006f);
|
||||
btn_OK->labelfont(1);
|
||||
btn_OK->labelsize(12);
|
||||
btn_OK->callback((Fl_Callback*)cb_okBtn );
|
||||
|
||||
btn_Cancel =new Fl_Button(345, 70, 50, 25, "Cancel");
|
||||
btn_Cancel->labelsize(12);
|
||||
btn_Cancel->callback((Fl_Callback*)cb_Cancel, this );
|
||||
|
||||
btn_Color = new Fl_Button(345, 100, 50, 25, "");
|
||||
btn_Color->down_box(FL_BORDER_BOX);
|
||||
btn_Color->labelsize(12);
|
||||
btn_Color->align(FL_ALIGN_TOP_LEFT);
|
||||
btn_Color->color(FL_BLACK);
|
||||
btn_Color->callback( (Fl_Callback*)cb_Color_Select, this );
|
||||
|
||||
box_Example = new Preview_Box(5, 145, 390, 75, "abcdefghijk ABCDEFGHIJK\n0 1 2 3 4 5 6 7 8 9");
|
||||
box_Example->box(FL_DOWN_BOX);
|
||||
box_Example->labelsize(12);
|
||||
box_Example->align(FL_ALIGN_WRAP|FL_ALIGN_CLIP|FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
||||
|
||||
set_modal();
|
||||
end();
|
||||
|
||||
// Initializations
|
||||
|
||||
this->callback_ = 0; // Initialize Widgets callback
|
||||
this->data_ = 0; // And the data
|
||||
|
||||
numfonts = Fl::set_fonts(0); // Nr of fonts available on the server
|
||||
|
||||
fontnbr = (Fl_Font)1;
|
||||
|
||||
string name;
|
||||
for(int i= 0; i < numfonts; i++) {
|
||||
int t;
|
||||
name = Fl::get_font_name((Fl_Font)i, &t);
|
||||
if (strcmp(name.c_str(),"system") == 0) fontnbr = (Fl_Font)i;
|
||||
if (name[0] >= 'A' && name[0] <= 'z') {
|
||||
lst_Font->add(name.c_str(), (void *)i);
|
||||
}
|
||||
}
|
||||
FontSort();
|
||||
|
||||
char buf[5];
|
||||
for (int i = 1; i < 48; i+=1) {
|
||||
sprintf(buf, "%d", i);
|
||||
lst_Size->add(buf);
|
||||
}
|
||||
|
||||
fontnbr = (Fl_Font)1;
|
||||
fontsize = 14; // Font Size to be used
|
||||
fontcolor = FL_BLACK;
|
||||
|
||||
lst_Size->value( fontsize );
|
||||
lst_Font->value((int)fontnbr);
|
||||
|
||||
FontNameSelect();
|
||||
|
||||
Fl::focus(lst_Font);
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// generated by Fast Light User Interface Designer (fluid) version 1.0107
|
||||
|
||||
#ifndef CWdialog_h
|
||||
#define CWdialog_h
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Light_Button.H>
|
||||
extern Fl_Light_Button *btnCWrcvTrack;
|
||||
extern Fl_Light_Button *btnCWxmtLock;
|
||||
#include <FL/Fl_Button.H>
|
||||
extern Fl_Button *CWDialogClose;
|
||||
#include <FL/Fl_Progress.H>
|
||||
extern Fl_Progress *prgsCWrcvWPM;
|
||||
#include <FL/Fl_Value_Slider.H>
|
||||
extern Fl_Value_Slider *sldrCWxmtWPM;
|
||||
#include <FL/Fl_Value_Output.H>
|
||||
extern Fl_Value_Output *valCWrcvWPM;
|
||||
extern Fl_Value_Slider *sldrCWbandwidth;
|
||||
Fl_Double_Window* CW_dialog();
|
||||
void openCWDialog();
|
||||
void createCWDialog();
|
||||
#endif
|
|
@ -77,16 +77,21 @@ extern Fl_Check_Button *btnsendid;
|
|||
extern Fl_Group *tabModems;
|
||||
extern Fl_Tabs *tabsModems;
|
||||
extern Fl_Group *tabCW;
|
||||
extern Fl_Light_Button *btnCWrcvTrack;
|
||||
extern Fl_Value_Slider *sldrCWbandwidth;
|
||||
#include <FL/Fl_Counter.H>
|
||||
extern Fl_Counter *cntCWrange;
|
||||
extern Fl_Check_Button *btnCWrcvTrack;
|
||||
#include <FL/Fl_Value_Output.H>
|
||||
extern Fl_Value_Output *valCWrcvWPM;
|
||||
#include <FL/Fl_Progress.H>
|
||||
extern Fl_Progress *prgsCWrcvWPM;
|
||||
extern Fl_Value_Slider *sldrCWxmtWPM;
|
||||
#include <FL/Fl_Value_Output.H>
|
||||
extern Fl_Value_Output *valCWrcvWPM;
|
||||
extern Fl_Value_Slider *sldrCWbandwidth;
|
||||
#include <FL/Fl_Counter.H>
|
||||
extern Fl_Counter *cntCWlowerlimit;
|
||||
extern Fl_Counter *cntCWupperlimit;
|
||||
extern Fl_Counter *cntCWweight;
|
||||
extern Fl_Counter *cntCWrange;
|
||||
extern Fl_Counter *cntCWdash2dot;
|
||||
extern Fl_Counter *cntCWrisetime;
|
||||
extern Fl_Counter *cntCWdefWPM;
|
||||
extern Fl_Group *tabDomEX;
|
||||
extern Fl_Input *txtSecondary;
|
||||
extern Fl_Button *btnRestartDomEX;
|
||||
|
|
|
@ -51,7 +51,8 @@ struct datambr {
|
|||
};
|
||||
|
||||
struct retvals {
|
||||
Fl_Output * Inp;
|
||||
// Fl_Output * Inp;
|
||||
Fl_Input *Inp;
|
||||
void * retval;
|
||||
int * idx;};
|
||||
|
||||
|
@ -86,7 +87,8 @@ class Fl_ComboBox : public Fl_Group {
|
|||
|
||||
protected:
|
||||
Fl_Button *Btn;
|
||||
Fl_Output *Output;
|
||||
// Fl_Output *Output;
|
||||
Fl_Input *Output;
|
||||
Fl_PopBrowser *Brwsr;
|
||||
datambr **datalist;
|
||||
int listsize;
|
||||
|
@ -117,6 +119,7 @@ class Fl_ComboBox : public Fl_Group {
|
|||
void *data ();
|
||||
void textfont (int);
|
||||
void textsize (uchar);
|
||||
void readonly();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
// generated by Fast Light User Interface Designer (fluid) version 1.0107
|
||||
|
||||
#ifndef Config_h
|
||||
#define Config_h
|
||||
#include <FL/Fl.H>
|
||||
#include "globals.h"
|
||||
#include "modem.h"
|
||||
#include "configuration.h"
|
||||
extern Fl_Double_Window *dlgConfig;
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Tabs.H>
|
||||
extern Fl_Tabs *tabsConfigure;
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
extern Fl_Input *inpMyCallsign;
|
||||
extern Fl_Input *inpMyName;
|
||||
extern Fl_Input *inpMyQth;
|
||||
extern Fl_Input *inpMyLocator;
|
||||
#include <FL/Fl_Round_Button.H>
|
||||
extern Fl_Round_Button *btnPTT[5];
|
||||
extern Fl_Round_Button *btnRTSDTR[4];
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
extern Fl_Check_Button *chkPTT_reverse;
|
||||
#include <FL/Fl_Choice.H>
|
||||
extern Fl_Choice *mnuHamlibRig;
|
||||
#include <FL/Fl_Button.H>
|
||||
extern Fl_Button *btnInit_Interface;
|
||||
extern Fl_Tabs *tabsModems;
|
||||
extern Fl_Group *tabRTTY;
|
||||
extern Fl_Choice *selShift;
|
||||
extern Fl_Choice *selBaud;
|
||||
extern Fl_Choice *selBits;
|
||||
extern Fl_Choice *selParity;
|
||||
extern Fl_Choice *selStopBits;
|
||||
extern Fl_Check_Button *chkReverse;
|
||||
extern Fl_Check_Button *chkMsbFirst;
|
||||
extern Fl_Button *btnRestartRtty;
|
||||
extern Fl_Choice *mnuOlivia_Tones;
|
||||
extern Fl_Choice *mnuOlivia_Bandwidth;
|
||||
extern Fl_Button *btnRestartOlivia;
|
||||
extern Fl_Choice *mnuMT63_Bandwidth;
|
||||
extern Fl_Choice *mnuMT63_Interleave;
|
||||
extern Fl_Button *btnRestart_MT63;
|
||||
#include <FL/Fl_Value_Slider.H>
|
||||
extern Fl_Button *btnRestartFeld;
|
||||
#include <FL/Fl_Return_Button.H>
|
||||
extern Fl_Return_Button *btnCloseConfig;
|
||||
#include <FL/Fl_Counter.H>
|
||||
extern Fl_Counter *cntrTxOffset;
|
||||
Fl_Double_Window* ConfigureDialog();
|
||||
void openConfig();
|
||||
void closeDialog();
|
||||
void createConfig();
|
||||
#endif
|
|
@ -44,9 +44,15 @@ struct configuration {
|
|||
bool useCWkeylineDTR; // use DTR for CW
|
||||
int CWweight;
|
||||
int CWspeed;
|
||||
int defCWspeed;
|
||||
int CWbandwidth;
|
||||
int CWtrack;
|
||||
int CWrange;
|
||||
int CWlowerlimit;
|
||||
int CWupperlimit;
|
||||
double CWrisetime;
|
||||
double CWdash2dot;
|
||||
|
||||
// FELD-HELL
|
||||
bool FELD_IDLE;
|
||||
// OLIVIA
|
||||
|
@ -115,8 +121,7 @@ struct configuration {
|
|||
bool LineIn;
|
||||
bool EnableMixer;
|
||||
double PCMvolume;
|
||||
bool MicMute;
|
||||
bool LineMute;
|
||||
bool MuteInput;
|
||||
|
||||
// waterfall palette
|
||||
RGBint cfgpal[9];
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
// Copyright (C) 2006
|
||||
// Dave Freese, W1HKJ
|
||||
//
|
||||
// This file is part of fldigi. Adapted from code contained in gmfsk source code
|
||||
// distribution.
|
||||
// This file is part of fldigi. Adapted in part from code contained in
|
||||
// gmfsk source code distribution.
|
||||
// gmfsk Copyright (C) 2001, 2002, 2003
|
||||
// Tomi Manninen (oh2bns@sral.fi)
|
||||
// Copyright (C) 2004
|
||||
|
@ -36,16 +36,16 @@
|
|||
|
||||
#define CWSampleRate 8000
|
||||
#define CWMaxSymLen 4096
|
||||
#define KNUM 128
|
||||
|
||||
// decimation ratio for the receiver
|
||||
//1024 // length of FIR filter
|
||||
#define DEC_RATIO 8
|
||||
#define CW_FIRLEN 128
|
||||
//#define CW_FIRLEN 256
|
||||
//#define CW_FIRLEN 512
|
||||
// Limits on values of CW send and timing parameters
|
||||
#define CW_MIN_SPEED 5 // Lowest WPM allowed
|
||||
#define CW_MAX_SPEED 100 // Highest WPM allowed
|
||||
//#define CW_MIN_SPEED 5 // Lowest WPM allowed
|
||||
//#define CW_MAX_SPEED 100 // Highest WPM allowed
|
||||
|
||||
// CW function return status codes.
|
||||
#define CW_SUCCESS 0
|
||||
|
@ -62,9 +62,6 @@
|
|||
|
||||
#define INITIAL_SEND_SPEED 18 // Initial send speed in WPM
|
||||
#define INITIAL_RECEIVE_SPEED 18 // Initial receive speed in WPM
|
||||
//#define INITIAL_GAP 0 // Initial fransworth gap setting
|
||||
//#define INITIAL_TOLERANCE 60 // Initial tolerance setting
|
||||
//#define INITIAL_ADAPTIVE TRUE // Initial adaptive receive setting
|
||||
|
||||
// Initial adaptive speed threshold
|
||||
#define INITIAL_THRESHOLD ((DOT_MAGIC / INITIAL_RECEIVE_SPEED) * 2)
|
||||
|
@ -105,7 +102,6 @@ protected:
|
|||
double scopedata[CWMaxSymLen];
|
||||
int pipeptr;
|
||||
int pipesize;
|
||||
|
||||
|
||||
// user configurable data - local copy passed in from gui
|
||||
int cw_speed;
|
||||
|
@ -113,6 +109,7 @@ protected:
|
|||
int cw_squelch;
|
||||
int cw_send_speed; // Initially 18 WPM
|
||||
int cw_receive_speed; // Initially 18 WPM
|
||||
bool usedefaultWPM; // use default WPM
|
||||
|
||||
int cw_upper_limit;
|
||||
int cw_lower_limit;
|
||||
|
@ -121,10 +118,13 @@ protected:
|
|||
int cw_in_sync; // Synchronization flag
|
||||
|
||||
// Sending parameters:
|
||||
long int cw_send_dot_length; // Length of a send Dot, in Usec
|
||||
long int cw_send_dash_length; // Length of a send Dash, in Usec
|
||||
long int cw_send_dot_length; // Length of a send Dot, in Usec
|
||||
long int cw_send_dash_length; // Length of a send Dash, in Usec
|
||||
int lastsym; // last symbol sent
|
||||
|
||||
double risetime; // leading/trailing edge rise time (msec)
|
||||
int knum; // number of samples on edges
|
||||
// double *keyshape; // array defining leading edge
|
||||
|
||||
// Receiving parameters:
|
||||
long int cw_receive_dot_length; // Length of a receive Dot, in Usec
|
||||
long int cw_receive_dash_length; // Length of a receive Dash, in Usec
|
||||
|
@ -139,30 +139,22 @@ protected:
|
|||
long int cw_adaptive_receive_threshold; // 2-dot threshold for adaptive speed
|
||||
|
||||
// Receive adaptive speed tracking.
|
||||
#define AVERAGE_ARRAY_LENGTH 10 // Keep 10 dot/dash lengths
|
||||
// long int cw_dot_tracking_array[AVERAGE_ARRAY_LENGTH];
|
||||
// long int cw_dash_tracking_array[AVERAGE_ARRAY_LENGTH];
|
||||
// Dot and dash length arrays
|
||||
// long int cw_dt_dot_index;
|
||||
// long int cw_dt_dash_index; // Circular indexes into the arrays
|
||||
double dot_tracking;
|
||||
double dash_tracking;
|
||||
|
||||
inline double nco(double freq);
|
||||
void update_syncscope();
|
||||
void update_Status();
|
||||
void sync_parameters();
|
||||
int handle_event(int cw_event, char **c);
|
||||
int usec_diff(unsigned int earlier, unsigned int later);
|
||||
void send_symbol(int symbol);
|
||||
void send_ch(int c);
|
||||
// unsigned long tx_lookup(int c);
|
||||
bool tables_init();
|
||||
unsigned int tokenize_representation(char *representation);
|
||||
void update_tracking(int dot, int dash);
|
||||
|
||||
// void cw_keyline(int);
|
||||
// void cw_keyup();
|
||||
// void cw_keydown();
|
||||
void makeshape();
|
||||
|
||||
public:
|
||||
cw();
|
||||
|
@ -173,6 +165,9 @@ public:
|
|||
void restart() {};
|
||||
int rx_process(double *buf, int len);
|
||||
int tx_process();
|
||||
void incWPM();
|
||||
void decWPM();
|
||||
void toggleWPM();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// fl_digi.h
|
||||
// fl_digi.h
|
||||
//
|
||||
// Copyright (C) 2006
|
||||
// Dave Freese, W1HKJ
|
||||
//
|
||||
// This file is part of fldigi.
|
||||
// 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
|
||||
|
@ -21,18 +21,18 @@
|
|||
// along with fldigi; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifndef fl_digi_h
|
||||
|
||||
#define fl_digi_h
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Menu_Bar.H>
|
||||
|
||||
#ifndef fl_digi_h
|
||||
|
||||
#define fl_digi_h
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Menu_Bar.H>
|
||||
#include <FL/Fl_Pack.H>
|
||||
#include <FL/Fl_Text_Buffer.H>
|
||||
#include <FL/Fl_Text_Display.H>
|
||||
#include <FL/Fl_Text_Editor.H>
|
||||
#include <FL/Fl_Text_Buffer.H>
|
||||
#include <FL/Fl_Text_Display.H>
|
||||
#include <FL/Fl_Text_Editor.H>
|
||||
#include <FL/Fl_Browser.H>
|
||||
#include <FL/Fl_Slider.H>
|
||||
#include <FL/Fl_Progress.H>
|
||||
|
@ -43,12 +43,12 @@
|
|||
#include "waterfall.h"
|
||||
#include "digiscope.h"
|
||||
#include "globals.h"
|
||||
#include "mixer.h"
|
||||
|
||||
extern Fl_Double_Window *fl_digi_main;
|
||||
extern cMixer mixer;
|
||||
#include "mixer.h"
|
||||
|
||||
extern TextView *ReceiveText;
|
||||
extern Fl_Double_Window *fl_digi_main;
|
||||
extern cMixer mixer;
|
||||
|
||||
extern TextView *ReceiveText;
|
||||
extern TextEdit *TransmitText;
|
||||
extern Fl_Text_Buffer *rcvBuffer;
|
||||
extern Fl_Text_Buffer *xmtBuffer;
|
||||
|
@ -77,15 +77,15 @@ extern Fl_Slider *valRcvMixer;
|
|||
extern Fl_Slider *valXmtMixer;
|
||||
|
||||
extern bool altMacros;
|
||||
|
||||
//extern Fl_Browser *ReceiveText;
|
||||
//extern Fl_Browser *TransmitText;
|
||||
|
||||
//extern Fl_Browser *ReceiveText;
|
||||
//extern Fl_Browser *TransmitText;
|
||||
|
||||
extern waterfall *wf;
|
||||
extern Digiscope *digiscope;
|
||||
|
||||
|
||||
extern void create_fl_digi_main();
|
||||
|
||||
extern void create_fl_digi_main();
|
||||
extern Fl_Menu_Item menu_[];
|
||||
extern void activate_rig_menu_item(bool b);
|
||||
|
||||
|
@ -97,8 +97,9 @@ extern void set_scope(double *data, int len, bool autoscale = true);
|
|||
extern void set_phase(double phase, bool highlight);
|
||||
extern void set_rtty(double, double, double);
|
||||
extern void set_video(double *, int);
|
||||
extern void put_rx_char(unsigned int data);
|
||||
extern void put_sec_char( char chr );
|
||||
extern void set_CWwpm();
|
||||
extern void put_rx_char(unsigned int data);
|
||||
extern void put_sec_char( char chr );
|
||||
extern void put_status(char *msg);
|
||||
extern void put_Status2(char *msg);
|
||||
extern void put_Status1(char *msg);
|
||||
|
@ -106,7 +107,7 @@ extern void put_WARNstatus(bool);
|
|||
extern void clear_StatusMessages();
|
||||
extern void put_MODEstatus(trx_mode mode);
|
||||
extern void put_rx_data(int *data, int len);
|
||||
extern char get_tx_char();
|
||||
extern char get_tx_char();
|
||||
extern int get_secondary_char();
|
||||
extern void put_echo_char(unsigned int data);
|
||||
extern void resetRTTY();
|
||||
|
@ -153,4 +154,4 @@ extern void initTHROBX4();
|
|||
extern void initWWV();
|
||||
extern void initANALYSIS();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// fl_font_browser.h v 0.0.1 2005-10-17
|
||||
//
|
||||
// for the Fast Light Tool Kit (FLTK) 1.1.x .
|
||||
//
|
||||
// by Mariwan Jalal
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "fltk_kurdi@yahoo.com".
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef fontbrowser2_h
|
||||
#define fontbrowser2_h
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Browser.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/fl_show_colormap.H>
|
||||
#include <iostream>
|
||||
// Preview box for showing font
|
||||
class Fl_Font_Preview_Box : public Fl_Widget
|
||||
{
|
||||
private:
|
||||
void draw();
|
||||
int fontName;
|
||||
int fontSize;
|
||||
int fontStyle;
|
||||
public:
|
||||
void SetFont( int fontname,int fontsyle,int fontsize);
|
||||
Fl_Font_Preview_Box(int x, int y , int w, int h, char *l );
|
||||
int GetFontName();
|
||||
int GetFontSize();
|
||||
int GetFontStyle();
|
||||
int GetFontStrickTrhough();
|
||||
int GetFontUnderline();
|
||||
};
|
||||
// Font browser widget
|
||||
class Fl_Font_Browser : public Fl_Window {
|
||||
private:
|
||||
void (*callback_)(Fl_Widget*, void *);
|
||||
void *data_;
|
||||
public:
|
||||
void cb_okBtn(Fl_Button*, void*);
|
||||
int numfonts;
|
||||
|
||||
public:
|
||||
void callback(void (*cb)(Fl_Widget *, void *), void *d = 0);
|
||||
|
||||
public:
|
||||
Fl_Font_Browser();
|
||||
int GetFontNr(const char *fontNametoNr);
|
||||
int numFonts() { return numfonts;}
|
||||
|
||||
public:
|
||||
int pickedsize ;
|
||||
Fl_Browser *lst_Font;
|
||||
Fl_Input *txt_InputFont;
|
||||
Fl_Browser *lst_Style;
|
||||
Fl_Input *txt_InputStyle;
|
||||
Fl_Browser *lst_Size;
|
||||
Fl_Input *txt_InputSize;
|
||||
Fl_Button *btn_OK;
|
||||
Fl_Button *btn_Cancel;
|
||||
Fl_Font_Preview_Box *box_Example;
|
||||
};
|
||||
#endif
|
|
@ -0,0 +1,144 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Font_Browser.h v 0.0.1 2005-10-17
|
||||
//
|
||||
// for the Fast Light Tool Kit (FLTK) 1.1.x .
|
||||
//
|
||||
// David Freese, w1hkj@w1hkj.com
|
||||
// based on similar widget by Mariwan Jalal
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "fltk_kurdi@yahoo.com".
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef FONTBROWSER_H
|
||||
#define FONTBROWSER_H
|
||||
|
||||
#include <FL/Fl.H>
|
||||
#include <FL/Fl_Double_Window.H>
|
||||
#include <FL/Fl_Browser.H>
|
||||
#include <FL/Fl_Input.H>
|
||||
#include <FL/Fl_Output.H>
|
||||
#include <FL/Fl_Button.H>
|
||||
#include <FL/Fl_Box.H>
|
||||
#include <FL/Fl_Group.H>
|
||||
#include <FL/Fl_Check_Button.H>
|
||||
#include <FL/fl_draw.H>
|
||||
#include <FL/fl_show_colormap.h>
|
||||
#include <iostream>
|
||||
|
||||
// Preview box for showing font
|
||||
class Preview_Box : public Fl_Widget
|
||||
{
|
||||
private:
|
||||
int fontName;
|
||||
int fontSize;
|
||||
Fl_Color fontColor;
|
||||
|
||||
void draw() {
|
||||
draw_box();
|
||||
fl_font((Fl_Font)fontName, fontSize);
|
||||
fl_color(fontColor);
|
||||
fl_draw(label(), x()+3, y()+3, w()-6, h()-6, align());
|
||||
}
|
||||
public:
|
||||
Preview_Box(int x, int y, int w, int h, char* l) : Fl_Widget(x, y, w, h, l)
|
||||
{
|
||||
fontName = 1;
|
||||
fontSize = 14;
|
||||
box(FL_DOWN_BOX);
|
||||
color(FL_WHITE);
|
||||
fontColor = FL_BLACK;
|
||||
}
|
||||
void SetFont( int fontname, int fontsize, Fl_Color c)
|
||||
{
|
||||
fontName = fontname;
|
||||
fontSize = fontsize;
|
||||
fontColor = c;
|
||||
redraw();
|
||||
}
|
||||
};
|
||||
|
||||
// Font browser widget
|
||||
class Font_Browser : public Fl_Window {
|
||||
private:
|
||||
int numfonts;
|
||||
Fl_Font fontnbr;
|
||||
int fontsize;
|
||||
Fl_Color fontcolor;
|
||||
void *data_;
|
||||
|
||||
Fl_Browser *lst_Font;
|
||||
Fl_Output *txt_OutputFont;
|
||||
Fl_Browser *lst_Size;
|
||||
Fl_Output *txt_OutputSize;
|
||||
Fl_Button *btn_OK;
|
||||
Fl_Button *btn_Cancel;
|
||||
Fl_Button *btn_Color;
|
||||
Preview_Box *box_Example;
|
||||
|
||||
void FontSort();
|
||||
void (*callback_)(Fl_Widget*, void *);
|
||||
|
||||
public:
|
||||
Font_Browser(char *lbl = "Font Browser");
|
||||
void callback(void (*cb)(Fl_Widget *, void *), void *d = 0) {
|
||||
callback_ = cb;
|
||||
data_ = d;
|
||||
}
|
||||
void FontNameSelect();
|
||||
void FontSizeSelect();
|
||||
void ColorSelect();
|
||||
void okBtn();
|
||||
|
||||
int numFonts() { return numfonts; }
|
||||
|
||||
void fontNumber(Fl_Font n) {
|
||||
fontnbr = n;
|
||||
lst_Font->value(1);
|
||||
for ( int i = 1; i <= lst_Font->size() - 1; i++ ) {
|
||||
if ((Fl_Font)reinterpret_cast<int>(lst_Font->data(i)) == n) {
|
||||
lst_Font->value(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
FontNameSelect();
|
||||
};
|
||||
Fl_Font fontNumber() { return fontnbr; }
|
||||
|
||||
void fontSize(int s) {
|
||||
fontsize = s;
|
||||
lst_Size->value(fontsize);
|
||||
FontSizeSelect();
|
||||
}
|
||||
int fontSize() { return fontsize; }
|
||||
|
||||
void fontColor(Fl_Color c) {
|
||||
fontcolor = c;
|
||||
btn_Color->color( fontcolor );
|
||||
box_Example->SetFont( fontnbr, fontsize, fontcolor );
|
||||
}
|
||||
Fl_Color fontColor() { return fontcolor; };
|
||||
|
||||
const char *fontName() { return txt_OutputFont->value(); }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -2017,7 +2017,8 @@ template <class Type=float>
|
|||
Bandwidth=1000;
|
||||
Reverse=0;
|
||||
SampleRate=8000;
|
||||
OutputSampleRate=8000; }
|
||||
OutputSampleRate=8000;
|
||||
}
|
||||
|
||||
// preset internal arrays according to primary paramaters
|
||||
int Preset(void)
|
||||
|
@ -2321,7 +2322,8 @@ template <class Type=float>
|
|||
SyncIntegLen=4;
|
||||
SyncThreshold=3.1;
|
||||
SampleRate=8000;
|
||||
InputSampleRate=8000.0; }
|
||||
InputSampleRate=8000.0;
|
||||
}
|
||||
|
||||
// resize internal arrays according the parameters
|
||||
int Preset(void)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _MAIN_H
|
||||
#define _MAIN_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
|
@ -27,7 +27,9 @@ extern Fl_Thread trx_thread;
|
|||
extern state_t trx_state;
|
||||
extern modem *active_modem;
|
||||
extern string HomeDir;
|
||||
extern string PskMailDir;
|
||||
extern string xmlfname;
|
||||
extern bool gmfskmail;
|
||||
|
||||
extern std::string scDevice;
|
||||
extern PTT *push2talk;
|
||||
|
@ -44,4 +46,4 @@ extern char pskmail_get_char();
|
|||
extern void pskmail_loop(void *);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -41,6 +41,9 @@ private:
|
|||
int devmask;
|
||||
int outmask;
|
||||
int recsrc;
|
||||
int recmask0;
|
||||
int devmask0;
|
||||
int recsrc0;
|
||||
int num_out;
|
||||
int outs[SOUND_MIXER_NRDEVICES];
|
||||
int num_rec;
|
||||
|
@ -48,9 +51,13 @@ private:
|
|||
|
||||
// values on init for restoration
|
||||
int inpsrc0;
|
||||
double inplevel0;
|
||||
double linelevel0;
|
||||
// double lineplaythrough0;
|
||||
double miclevel0;
|
||||
// double micplaythrough0;
|
||||
double pcmlevel0;
|
||||
double vollevel0;
|
||||
// double playthrough0;
|
||||
|
||||
int NumMixers;
|
||||
int NumDevice;
|
||||
|
@ -61,6 +68,9 @@ private:
|
|||
void findNumMixers();
|
||||
double ChannelVolume(int);
|
||||
|
||||
void initValues();
|
||||
void restoreValues();
|
||||
|
||||
public:
|
||||
cMixer();
|
||||
~cMixer();
|
||||
|
@ -88,8 +98,9 @@ public:
|
|||
void InputVolume( double volume );
|
||||
int GetCurrentInputSource();
|
||||
void SetCurrentInputSource( int i );
|
||||
double GetPlaythrough();
|
||||
void SetPlaythrough( double volume );
|
||||
// double GetPlaythrough();
|
||||
// void SetPlaythrough( double volume );
|
||||
// void SetMuteInput(bool);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include "waterfall.h"
|
||||
#include "ScopeDialog.h"
|
||||
#include "fl_digi.h"
|
||||
#include "CWdialog.h"
|
||||
#include "globals.h"
|
||||
#include "fl_digi.h"
|
||||
|
||||
|
@ -127,8 +126,9 @@ public:
|
|||
double get_cwXmtWPM();
|
||||
void set_cwXmtWPM(double);
|
||||
double get_cwRcvWPM();
|
||||
// void set_cwBandwidth(double);
|
||||
// double get_cwBandwidth();
|
||||
virtual void incWPM() {};
|
||||
virtual void decWPM() {};
|
||||
virtual void toggleWPM() {};
|
||||
};
|
||||
|
||||
extern modem *cw_modem;
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
|
||||
#include "samplerate/samplerate.h"
|
||||
|
||||
#define maxsc 32000.0
|
||||
#define MAXSC 32767.0;
|
||||
#define maxsc 32000.0
|
||||
//#define maxsc 16384.0
|
||||
#define SCBLOCKSIZE 512
|
||||
|
||||
#define SND_BUF_LEN 65536
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "sound.h"
|
||||
#include "waterfall.h"
|
||||
#include "ScopeDialog.h"
|
||||
#include "CWdialog.h"
|
||||
#include "globals.h"
|
||||
#include "fl_digi.h"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef _VERSION_H
|
||||
#define _VERSION_H
|
||||
|
||||
#define FLDIGI_VERSION "1.33"
|
||||
#define FLDIGI_VERSION "1.34"
|
||||
|
||||
#endif
|
||||
|
|
120
src/main.cxx
120
src/main.cxx
|
@ -1,29 +1,29 @@
|
|||
//
|
||||
// Digital Modem Program for the Fast Light Toolkit
|
||||
//
|
||||
// Copyright W1HKJ, Dave Freese 2006
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "w1hkj@w1hkj.com".
|
||||
//
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
//
|
||||
// Digital Modem Program for the Fast Light Toolkit
|
||||
//
|
||||
// Copyright W1HKJ, Dave Freese 2006
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Library General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library 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
|
||||
// Library General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Library General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
// USA.
|
||||
//
|
||||
// Please report all bugs and problems to "w1hkj@w1hkj.com".
|
||||
//
|
||||
#include <FL/Fl_Shared_Image.H>
|
||||
#include "main.h"
|
||||
#include "waterfall.h"
|
||||
#include "fft.h"
|
||||
#include "fft.h"
|
||||
#include "sound.h"
|
||||
#include "complex.h"
|
||||
#include "fl_digi.h"
|
||||
|
@ -48,9 +48,14 @@ using namespace std;
|
|||
|
||||
string scDevice = "/dev/dsp1";
|
||||
char szHomedir[120] = "";
|
||||
char szPskMailDir[120] = "";
|
||||
string PskMailDir;
|
||||
string PskMailFile;
|
||||
string HomeDir;
|
||||
string xmlfname;
|
||||
|
||||
bool gmfskmail = false;
|
||||
|
||||
PTT *push2talk = (PTT *)0;
|
||||
#ifndef NOHAMLIB
|
||||
Rig *xcvr = (Rig *)0;
|
||||
|
@ -64,10 +69,10 @@ FILE *client;
|
|||
bool mailserver = false, mailclient = false;
|
||||
extern void start_pskmail();
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
fl_filename_expand(szHomedir, 119, "$HOME/.fldigi/");
|
||||
if (!fl_filename_isdir(szHomedir))
|
||||
if (fl_filename_isdir(szHomedir) == 0)
|
||||
HomeDir = "./";
|
||||
else
|
||||
HomeDir = szHomedir;
|
||||
|
@ -79,15 +84,45 @@ int main(int argc, char ** argv) {
|
|||
logfile = new cLogfile(lfname);
|
||||
logfile->log_to_file_start();
|
||||
|
||||
if ((server = fopen ("PSKmailserver", "r")) != NULL) {
|
||||
mailserver = true;
|
||||
fclose (server);
|
||||
}
|
||||
if ((client = fopen ("PSKmailclient", "r")) != NULL) {
|
||||
mailclient = true;
|
||||
fclose (client);
|
||||
}
|
||||
fl_filename_expand(szPskMailDir, 119, "$HOME/pskmail.files/");
|
||||
PskMailDir = szPskMailDir;
|
||||
|
||||
PskMailFile = PskMailDir;
|
||||
PskMailFile += "PSKmailserver";
|
||||
ifstream testFile;
|
||||
testFile.open(PskMailFile.c_str());
|
||||
if (testFile.is_open()) {
|
||||
mailserver = true;
|
||||
testFile.close();
|
||||
} else {
|
||||
PskMailFile = PskMailDir;
|
||||
PskMailFile += "PSKmailclient";
|
||||
testFile.open(PskMailFile.c_str());
|
||||
if (testFile.is_open()) {
|
||||
mailclient = true;
|
||||
testFile.close();
|
||||
} else {
|
||||
PskMailDir = "./";
|
||||
PskMailFile = PskMailDir;
|
||||
PskMailFile += "PSKmailserver";
|
||||
testFile.open(PskMailFile.c_str());
|
||||
if (testFile.is_open()) {
|
||||
mailserver = true;
|
||||
testFile.close();
|
||||
gmfskmail = true;
|
||||
} else {
|
||||
PskMailFile = PskMailDir;
|
||||
PskMailFile += "PSKmailclient";
|
||||
testFile.open(PskMailFile.c_str());
|
||||
if (testFile.is_open()) {
|
||||
mailclient = true;
|
||||
testFile.close();
|
||||
gmfskmail = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Fl::lock(); // start the gui thread!!
|
||||
Fl::visual(FL_RGB); // insure 24 bit color operation
|
||||
fl_register_images();
|
||||
|
@ -111,7 +146,7 @@ int main(int argc, char ** argv) {
|
|||
if (argc == 2)
|
||||
scDevice = argv[1];
|
||||
else
|
||||
scDevice = progdefaults.SCdevice;
|
||||
scDevice = progdefaults.SCdevice;
|
||||
|
||||
trx_start(scDevice.c_str());
|
||||
|
||||
|
@ -125,8 +160,15 @@ int main(int argc, char ** argv) {
|
|||
Fl::set_fonts(0);
|
||||
|
||||
if (mailserver || mailclient) {
|
||||
std::cout << "Starting mailserver" << std::endl; fflush(stdout);
|
||||
Maillogfile = new cLogfile("gMFSK.log");
|
||||
std::cout << "Starting pskmail transport layer" << std::endl; fflush(stdout);
|
||||
string PskMailLogName = PskMailDir;
|
||||
|
||||
if (gmfskmail == false)
|
||||
PskMailLogName += "mail-io.log";
|
||||
else
|
||||
PskMailLogName += "gMFSK.log";
|
||||
|
||||
Maillogfile = new cLogfile(PskMailLogName.c_str());
|
||||
Maillogfile->log_to_file_start();
|
||||
Fl::add_timeout(10.0, pskmail_loop);
|
||||
}
|
||||
|
@ -134,5 +176,5 @@ int main(int argc, char ** argv) {
|
|||
fl_digi_main->show();
|
||||
|
||||
return Fl::run();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,14 @@ configuration progdefaults = {
|
|||
false, // bool useCWkeylineDTR;
|
||||
50, // int CWweight;
|
||||
18, // int CWspeed;
|
||||
24, // int defCWspeed;
|
||||
150, // int CWbandwidth;
|
||||
true, // int CWtrack;
|
||||
10, // int CWrange;
|
||||
5, // int CWlowerlimit;
|
||||
50, // int CWupperlimit;
|
||||
4.0, // double CWrisetime;
|
||||
3.0, // double CWdash2dot;
|
||||
|
||||
// FELD-HELL
|
||||
false, // bool FELD_IDLE;
|
||||
|
@ -117,8 +122,7 @@ configuration progdefaults = {
|
|||
false, // bool MicIn;
|
||||
true, // bool LineIn;
|
||||
false, // bool EnableMixer;
|
||||
true, // bool MicMute;
|
||||
true, // bool LineMute;
|
||||
true, // bool MuteInput;
|
||||
50.0, // double PCMvolume
|
||||
{{ 0, 0, 0},{ 0, 0, 62},{ 0, 0,126}, // default palette
|
||||
{ 0, 0,214},{145,142, 96},{181,184, 48},
|
||||
|
@ -214,9 +218,14 @@ void configuration::writeDefaultsXML()
|
|||
|
||||
writeXMLint(f, "CWWEIGHT", CWweight);
|
||||
writeXMLint(f, "CWSPEED", CWspeed);
|
||||
writeXMLint(f, "CWDEFSPEED", defCWspeed);
|
||||
writeXMLint(f, "CWBANDWIDTH", CWbandwidth);
|
||||
writeXMLint(f, "CWRANGE", CWrange);
|
||||
writeXMLint(f, "CWLOWERLIMIT", CWlowerlimit);
|
||||
writeXMLint(f, "CWUPPERLIMIT", CWupperlimit);
|
||||
writeXMLbool(f, "CWTRACK", CWtrack);
|
||||
writeXMLdbl(f, "CWRISETIME", CWrisetime);
|
||||
writeXMLdbl(f, "CWDASH2DOT", CWdash2dot);
|
||||
writeXMLint(f, "OLIVIATONES", oliviatones);
|
||||
writeXMLint(f, "OLIVIABW", oliviabw);
|
||||
writeXMLdbl(f, "DOMINOEXBW", DOMINOEX_BW);
|
||||
|
@ -264,13 +273,12 @@ void configuration::writeDefaultsXML()
|
|||
writeXMLbool(f, "MICIN", MicIn);
|
||||
writeXMLbool(f, "LINEIN", LineIn);
|
||||
writeXMLbool(f, "ENABLEMIXER", EnableMixer);
|
||||
writeXMLbool(f, "MUTEINPUT", MuteInput);
|
||||
f << "<PALETTE>\n";
|
||||
for (int i = 0; i < 9; i++)
|
||||
writeXMLtriad(f, cfgpal[i].R, cfgpal[i].G, cfgpal[i].B);
|
||||
f << "</PALETTE>\n";
|
||||
|
||||
// writeXMLbool(f, "MICMUTE", MicMute);
|
||||
// writeXMLbool(f, "LINEMUTE", LineMute);
|
||||
// writeXMLbool(f, "USEFSKKEYLINE", useFSKkeyline);
|
||||
// writeXMLbool(f, "USEFSKKEYLINEDTR", useFSKkeylineDTR);
|
||||
// writeXMLbool(f, "FSKISLSB", FSKisLSB);
|
||||
|
@ -376,6 +384,12 @@ void configuration::writeDefaults(ofstream &f)
|
|||
f << CWbandwidth << endl;
|
||||
f << CWtrack << endl;
|
||||
f << CWrange << endl;
|
||||
f << MuteInput << endl;
|
||||
f << CWlowerlimit << endl;
|
||||
f << CWupperlimit << endl;
|
||||
f << CWrisetime << endl;
|
||||
f << CWdash2dot << endl;
|
||||
f << defCWspeed << endl;
|
||||
}
|
||||
|
||||
void configuration::readDefaults(ifstream &f)
|
||||
|
@ -477,6 +491,12 @@ void configuration::readDefaults(ifstream &f)
|
|||
f >> CWbandwidth;
|
||||
f >> CWtrack;
|
||||
f >> CWrange;
|
||||
f >> MuteInput;
|
||||
f >> CWlowerlimit;
|
||||
f >> CWupperlimit;
|
||||
f >> CWrisetime;
|
||||
f >> CWdash2dot;
|
||||
f >> defCWspeed;
|
||||
}
|
||||
|
||||
void configuration::loadDefaults() {
|
||||
|
@ -659,9 +679,18 @@ int configuration::openDefaults() {
|
|||
|
||||
cntCWweight->value(CWweight);
|
||||
sldrCWxmtWPM->value(CWspeed);
|
||||
cntCWdefWPM->value(defCWspeed);
|
||||
sldrCWbandwidth->value(CWbandwidth);
|
||||
btnCWrcvTrack->value(CWtrack);
|
||||
cntCWrange->value(CWrange);
|
||||
cntCWlowerlimit->value(CWlowerlimit);
|
||||
cntCWupperlimit->value(CWupperlimit);
|
||||
cntCWlowerlimit->maximum(CWupperlimit - 20);
|
||||
cntCWupperlimit->minimum(CWlowerlimit + 20);
|
||||
cntCWrisetime->value(CWrisetime);
|
||||
cntCWdash2dot->value(CWdash2dot);
|
||||
sldrCWxmtWPM->minimum(CWlowerlimit);
|
||||
sldrCWxmtWPM->maximum(CWupperlimit);
|
||||
|
||||
selHellFont->value(feldfontnbr);
|
||||
btnFeldHellIdle->value(FELD_IDLE);
|
||||
|
|
|
@ -1,222 +0,0 @@
|
|||
//#include "macros.h"
|
||||
|
||||
//#include "main.h"
|
||||
|
||||
//#include "fl_digi.h"
|
||||
//#include "configation.h"
|
||||
//#include "Config.h"
|
||||
//#include "version.h"
|
||||
//#include "logger.h"
|
||||
|
||||
//#include <FL/Fl.H>
|
||||
//#include "File_Selector.h"
|
||||
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sys/stat.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
string mtext =
|
||||
"//fldigi macro definition file\n\
|
||||
// This file defines the macro structe(s) for the digital modem program, fldigi\n\
|
||||
// It also serves as a basis for any macros that are written by the user\n\
|
||||
//\n\
|
||||
// The top line of this file should always be the first line in every macro definition file (.mdf)\n\
|
||||
// for the fldigi program to recognize it as such.\n\
|
||||
//\n\
|
||||
// Macros are short text statements that contain imbedded references to text data used by the\n\
|
||||
// program fldigi. The imbedded references are always prefaced by the carat(^) symbol and consist\n\
|
||||
// of single letter codes. All references to the local system are in lower case and to the remote\n\
|
||||
// system or global values are in upper case.\n\
|
||||
//\n\
|
||||
//\n\
|
||||
// <CALL> remote call\n\
|
||||
// <LDT> local date time Zone\n\
|
||||
// format : %x %H:%M %Z\n\
|
||||
// where %x is preferred short form date ie: MM/DD/YY or DD/MM/YYYY etc\n\
|
||||
// %H is ho with leading 0\n\
|
||||
// %M is minute with leading 0\n\
|
||||
// %Z is abbreviated time zone ie: EDT or GMT\n\
|
||||
// <ZDT> GMT date time Zone\n\
|
||||
// format : %x %H:%M %Z\n\
|
||||
// <FREQ> my frequency\n\
|
||||
// <ID> send Mode Idenfier - waterfall script\n\
|
||||
// <LOC> remote locator\n\
|
||||
// <LOG> submit QSO data to logbook program & clear the QSO data fields\n\
|
||||
// Not constrained to a particular position in the macro.\n\
|
||||
// Action takes place when macro is expanded, so effect is seen immediately\n\
|
||||
// after executing the macro which contains this macro reference.\n\
|
||||
//\n\
|
||||
// <MODE> my mode\n\
|
||||
// <MYCALL> my call\n\
|
||||
// <MYLOC> my locator\n\
|
||||
// <MYNAME> my name\n\
|
||||
// <MYQTH> my qth\n\
|
||||
// <MYRST> my RST\n\
|
||||
// <NAME> remote name\n\
|
||||
// <QTH> remote qth\n\
|
||||
// <RST> remote RST\n\
|
||||
// <RX> retn to receive\n\
|
||||
// <TX> start transmit\n\
|
||||
// <VER> Fldigi + version\n\
|
||||
//\n\
|
||||
// Contest macro definitions:\n\
|
||||
// <CNTR> substitute the contest counter - no change in value\n\
|
||||
// <DECR> decrement the contest counter - no substitution\n\
|
||||
// <INCR> increment the contest counter - no substitution\n\
|
||||
//\n\
|
||||
// Autorepeat macro definition:\n\
|
||||
// <TIMER>NNN autorepeat this macro after NNN seconds\n\
|
||||
// NNN must be terminated by either a space ' ' or a linefeed\n\
|
||||
// it can appear anywhere in the macro defintion.\n\
|
||||
// see macro # 19 for an example of an auto-cq repeating macro\n\
|
||||
//\n\
|
||||
//\n\
|
||||
// Local references are specified ding the program configation and can be changed during \n\
|
||||
// program operation.\n\
|
||||
//\n\
|
||||
// Remote references are all part of the qso log field definitions and are routinely changed \n\
|
||||
// from contact to contact.\n\
|
||||
//\n\
|
||||
// Global references are to things like Greenwich Mean Time\n\
|
||||
//\n\
|
||||
// Each new macro begins with a macro specifier line as: /$ nn MACRONAME\n\
|
||||
// where 'nn' specifies the macro number. Macros numbered 0..9 refer to function key 1 to 10\n\
|
||||
// respectively. Macros numbered 10..19 refer to \"alt\" function keys 1 to 10. Undefined Macros\n\
|
||||
// will also contain an empty character string and thus produce no output when invoked.\n\
|
||||
// MACRONAME can be as long as you want, however only the first 8 characters will be displayed on\n\
|
||||
// the associated function key button.\n\
|
||||
//\n\
|
||||
// You can put the macro definition on multiple lines. These lines will be concatenated\n\
|
||||
// into a single line unless you put the new-line pair \"\\n\" at the end of the line\n\
|
||||
// that you want to terminate a line ding transmission.\n\
|
||||
//\n\
|
||||
// Macro definitions do not need to be in numerical order.\n\
|
||||
// Macro definitions may be skipped or you can truncate the file to less than\n\
|
||||
// the full macro set of 20.\n\
|
||||
//\n\
|
||||
// I recommend using a copy of this file suitably modified for all of yo macro\n\
|
||||
// definition files. Just fill in the appropriate fields and delete those you do not\n\
|
||||
// need for that macro set.\n\
|
||||
//\n\
|
||||
//\n\
|
||||
// Let the Macros begin!\n\
|
||||
//\n\
|
||||
";
|
||||
|
||||
static string label[20];
|
||||
static string text[20];
|
||||
|
||||
void newmacros()
|
||||
{
|
||||
label[0] = "f1 CQ";
|
||||
text[0] = "<TX>\\n\n\
|
||||
CQ CQ CQ de <MYCALL> <MYCALL> <MYCALL>\\n\n\
|
||||
CQ CQ CQ de <MYCALL> <MYCALL> <MYCALL> pse k\\n\n\
|
||||
<RX>";
|
||||
|
||||
label[1] = "f2 ANS";
|
||||
text[1] = "<TX>\\n\n\
|
||||
<CALL> <CALL> de <MYCALL> <MYCALL> <MYCALL> kn\\n\n\
|
||||
<RX>";
|
||||
|
||||
label[2] ="f3 QSO";
|
||||
text[2] = "<TX>\\n\n\
|
||||
<CALL> de <MYCALL> ";
|
||||
|
||||
label[3] = "f4 KN";
|
||||
text[3] = "\\nbtu <NAME> <CALL> de <MYCALL> k\\n\n\
|
||||
<RX>";
|
||||
|
||||
label[4] = "f5 SK";
|
||||
text[4] = "\\n\n\
|
||||
tnx fer QSO <NAME>, 73, God bless.\\n\n\
|
||||
<ZDT> <CALL> de <MYCALL> sk\\n\n\
|
||||
<RX>";
|
||||
|
||||
label[5] = "f6 Me";
|
||||
text[5] = " my name is <MYNAME> <MYNAME> ";
|
||||
|
||||
label[6] = "f7 QTH";
|
||||
text[6] = " my QTH is <MYQTH>, loc: <MYLOC> ";
|
||||
|
||||
label[7] = "f8 Brag";
|
||||
text[7] = "\\n\n\
|
||||
(( <MYCALL>, <MYNAME> Info ))\\n\n\
|
||||
Age: \\n\n\
|
||||
Rig: \\n\n\
|
||||
Pwr: \\n\n\
|
||||
Ant: \\n\n\
|
||||
OS: Linux\\n\n\
|
||||
Soft: <VER>\\n\n\
|
||||
Web: \\n\n\
|
||||
Email: \\n";
|
||||
|
||||
label[8] = "Tx";
|
||||
text[8] = "<TX>";
|
||||
|
||||
label[9] = "Rx";
|
||||
text[9] = "<RX>";
|
||||
|
||||
label[10] = "C Answer";
|
||||
text[10] = "<TX>de <MYCALL> <MYCALL><RX>\\n";
|
||||
|
||||
label[11] = "C Again";
|
||||
text[11] = "<TX><DECR><CNTR> <CNTR><INCR> QSL DE <MYCALL> K\\n\n\
|
||||
<RX>";
|
||||
|
||||
label[12] = "C Report";
|
||||
text[12] = "<TX><CALL> RR NBR <CNTR> <CNTR><INCR> TU DE <MYCALL> K\\n\n\
|
||||
<RX>";
|
||||
|
||||
label[13] = "C Incr";
|
||||
text[13] = "<INCR>";
|
||||
|
||||
label[14] = "C Decr";
|
||||
text[14] = "<DECR>";
|
||||
|
||||
label[15] = "Log QSO";
|
||||
text[15] = "<LOG>";
|
||||
|
||||
label[16] = "CW-CQ";
|
||||
text[16] = "<TX>CQ CQ CQ DE <MYCALL> <MYCALL> <MYCALL> CQ CQ CQ DE <MYCALL> K<RX>\\n";
|
||||
|
||||
label[17] = "Macro 18";
|
||||
text[17] = "";
|
||||
|
||||
label[18] = "AUTO-CQ";
|
||||
text[18] = "<TX>\\n\n\
|
||||
CQ CQ CQ de <MYCALL> <MYCALL> <MYCALL>\\n\n\
|
||||
CQ CQ CQ de <MYCALL> <MYCALL> <MYCALL> k<TIMER>15 <RX>";
|
||||
|
||||
label[19] = "CQ-ID";
|
||||
text[19] = "<TX><ID>\\n\n\
|
||||
CQ CQ CQ de <MYCALL> <MYCALL> <MYCALL>\\n\n\
|
||||
CQ CQ CQ de <MYCALL> <MYCALL> <MYCALL> pse k\\n\n\
|
||||
<RX>";
|
||||
}
|
||||
|
||||
|
||||
void createDotFldigi()
|
||||
{
|
||||
string Filename = "";//HomeDir;
|
||||
// mkdir(Filename.c_str(), O_CREAT | S_IRUSR|S_IWUSR|S_IXUSR);
|
||||
Filename.append("macros.mdf");
|
||||
ofstream mfile(Filename.c_str());
|
||||
newmacros();
|
||||
mfile << mtext;
|
||||
for (int i = 0; i < 20; i++) {
|
||||
mfile << "//\n// Macro # " << i+1 << "\n";
|
||||
mfile << "/$ " << i << " " << label[i].c_str() << "\n";
|
||||
mfile << text[i].c_str() << "\n";
|
||||
}
|
||||
mfile.close();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
createDotFldigi();
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
|
||||
#include "main.h"
|
||||
#include "configuration.h"
|
||||
|
@ -84,21 +85,55 @@ void parse_mailtext()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
size_t mailstrftime( char *s, size_t max, const char *fmt, const struct tm *tm) {
|
||||
return strftime(s, max, fmt, tm);
|
||||
}
|
||||
|
||||
void mailZDT(string &s)
|
||||
{
|
||||
char szDt[80];
|
||||
time_t tmptr;
|
||||
tm sTime;
|
||||
time (&tmptr);
|
||||
gmtime_r(&tmptr, &sTime);
|
||||
mailstrftime(szDt, 79, "%x %H:%M %Z", &sTime);
|
||||
s = szDt;
|
||||
}
|
||||
*/
|
||||
|
||||
#define TIMEOUT 180 // 3 minutes
|
||||
|
||||
void check_formail() {
|
||||
ifstream autofile("gmfsk_autofile");
|
||||
time_t start_time, prog_time;
|
||||
string sAutoFile = PskMailDir;
|
||||
if (gmfskmail == false)
|
||||
sAutoFile += "pskmail_out";
|
||||
else
|
||||
sAutoFile += "gmfsk_autofile";
|
||||
ifstream autofile(sAutoFile.c_str());
|
||||
if(autofile) {
|
||||
mailtext = "";
|
||||
time(&start_time);
|
||||
while (!autofile.eof()) {
|
||||
memset(mailline,0,1000);
|
||||
autofile.getline(mailline, 998); // leave space for "\n" and null byte
|
||||
mailtext.append(mailline);
|
||||
mailtext.append("\n");
|
||||
Fl::awake();
|
||||
time(&prog_time);
|
||||
if (prog_time - start_time > TIMEOUT) {
|
||||
std::cout << "pskmail_out failure" << std::endl;
|
||||
std::cout.flush();
|
||||
autofile.close();
|
||||
std::remove (sAutoFile.c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
autofile.close();
|
||||
std::remove ("gmfsk_autofile");
|
||||
std::remove (sAutoFile.c_str());
|
||||
|
||||
parse_mailtext();
|
||||
|
||||
if (mailtext.length() > 0) {
|
||||
if (mailserver)
|
||||
active_modem->set_freq(progdefaults.PSKsweetspot);
|
||||
|
|
|
@ -38,7 +38,7 @@ using namespace std;
|
|||
|
||||
double olivia::nco(double freq)
|
||||
{
|
||||
preamblephase += 2.0 * M_PI * freq / 8000;
|
||||
preamblephase += 2.0 * M_PI * freq / samplerate;
|
||||
|
||||
if (preamblephase > M_PI)
|
||||
preamblephase -= 2.0 * M_PI;
|
||||
|
@ -88,7 +88,7 @@ void olivia::tx_init(cSound *sc)
|
|||
void olivia::send_preamble()
|
||||
{
|
||||
double freqa, freqb;
|
||||
int i;
|
||||
int i, sr4 = samplerate / 4;
|
||||
|
||||
if (reverse) {
|
||||
freqa = txbasefreq + (bandwidth / 2.0);
|
||||
|
@ -98,25 +98,21 @@ void olivia::send_preamble()
|
|||
freqb = txbasefreq + (bandwidth / 2.0);
|
||||
}
|
||||
|
||||
for (i = 0; i < 2000; i++)
|
||||
for (i = 0; i < sr4; i++)
|
||||
outbuf[i] = nco(freqa);
|
||||
|
||||
for (i = 2000; i < 4000; i++)
|
||||
for (i = sr4; i < 2*sr4; i++)
|
||||
outbuf[i] = nco(freqb);
|
||||
|
||||
for (i = 4000; i < 6000; i++)
|
||||
for (i = 2*sr4; i < 3*sr4; i++)
|
||||
outbuf[i] = nco(freqa);
|
||||
|
||||
for (i = 6000; i < 8000; i++)
|
||||
for (i = 3*sr4; i < samplerate; i++)
|
||||
outbuf[i] = nco(freqb);
|
||||
|
||||
ModulateXmtr(outbuf, 8000);
|
||||
ModulateXmtr(outbuf, samplerate);
|
||||
}
|
||||
|
||||
void olivia::send_postamble()
|
||||
{
|
||||
double freqa, freqb;
|
||||
int i;
|
||||
int i, sr4 = samplerate / 4;
|
||||
|
||||
if (reverse) {
|
||||
freqa = txbasefreq + (bandwidth / 2.0);
|
||||
|
@ -126,19 +122,15 @@ void olivia::send_postamble()
|
|||
freqb = txbasefreq + (bandwidth / 2.0);
|
||||
}
|
||||
|
||||
for (i = 0; i < 1000; i++)
|
||||
for (i = 0; i < sr4; i++)
|
||||
outbuf[i] = nco(freqa);
|
||||
|
||||
for (i = 1000; i < 2000; i++)
|
||||
for (i = sr4; i < 2*sr4; i++)
|
||||
outbuf[i] = nco(freqb);
|
||||
|
||||
for (i = 2000; i < 3000; i++)
|
||||
for (i = 2*sr4; i < 3*sr4; i++)
|
||||
outbuf[i] = nco(freqa);
|
||||
|
||||
for (i = 3000; i < 4000; i++)
|
||||
for (i = 3*sr4; i < samplerate; i++)
|
||||
outbuf[i] = nco(freqb);
|
||||
|
||||
ModulateXmtr(outbuf, 4000);
|
||||
ModulateXmtr(outbuf, samplerate);
|
||||
}
|
||||
|
||||
void olivia::rx_init()
|
||||
|
@ -280,12 +272,13 @@ void olivia::restart()
|
|||
{
|
||||
tones = progdefaults.oliviatones;
|
||||
bw = progdefaults.oliviabw;
|
||||
samplerate = 8000;
|
||||
// samplerate = 8000;
|
||||
// samplerate = 11025;
|
||||
|
||||
Tx->Tones = 2 * (1 << tones);
|
||||
Tx->Bandwidth = 125 * (1 << bw);
|
||||
Tx->SampleRate = samplerate;
|
||||
Tx->OutputSampleRate = samplerate; //samplerate;
|
||||
Tx->SampleRate = 8000.0;//samplerate;
|
||||
Tx->OutputSampleRate = samplerate;
|
||||
txbasefreq = tx_frequency;
|
||||
|
||||
if (reverse) {
|
||||
|
@ -300,7 +293,6 @@ void olivia::restart()
|
|||
fl_message("olivia: transmitter preset failed!");
|
||||
return;
|
||||
}
|
||||
//
|
||||
|
||||
txbufferlen = Tx->MaxOutputLen;
|
||||
if (txbuffer) delete [] txbuffer;
|
||||
|
@ -311,7 +303,6 @@ void olivia::restart()
|
|||
|
||||
rxbufferlen = 0; //SCBLOCKSIZE;
|
||||
rxbuffer = 0; //new short int[rxbufferlen];
|
||||
//
|
||||
|
||||
Rx->Tones = Tx->Tones;
|
||||
Rx->Bandwidth = Tx->Bandwidth;
|
||||
|
@ -319,8 +310,8 @@ void olivia::restart()
|
|||
Rx->SyncIntegLen = sinteg;
|
||||
Rx->SyncThreshold = squelchon ? squelch : 0.0;
|
||||
|
||||
Rx->SampleRate = samplerate;
|
||||
Rx->InputSampleRate = samplerate; //samplerate;
|
||||
Rx->SampleRate = 8000.0;//samplerate;
|
||||
Rx->InputSampleRate = samplerate;
|
||||
|
||||
if (reverse) {
|
||||
Rx->FirstCarrierMultiplier = (frequency + (Rx->Bandwidth / 2)) / 500;
|
||||
|
@ -336,6 +327,8 @@ void olivia::restart()
|
|||
}
|
||||
fragmentsize = 1024;
|
||||
set_bandwidth(Tx->Bandwidth);
|
||||
|
||||
// Rx->PrintParameters();
|
||||
|
||||
put_MODEstatus(mode);
|
||||
}
|
||||
|
@ -349,16 +342,17 @@ void olivia::init()
|
|||
|
||||
olivia::olivia()
|
||||
{
|
||||
txbuffer = 0;
|
||||
txfbuffer = 0;
|
||||
rxbuffer = 0;
|
||||
// samplerate = 11025;
|
||||
samplerate = 8000;
|
||||
|
||||
Fl::lock();
|
||||
Tx = new MFSK_Transmitter< float >;
|
||||
Rx = new MFSK_Receiver< float >;
|
||||
Fl::unlock();
|
||||
|
||||
txbuffer = 0;
|
||||
txfbuffer = 0;
|
||||
rxbuffer = 0;
|
||||
samplerate = 8000;
|
||||
|
||||
mode = MODE_OLIVIA;
|
||||
wfid = new id(this);
|
||||
init();
|
||||
|
|
|
@ -823,7 +823,7 @@ void parseXML()
|
|||
|
||||
bool readRigXML()
|
||||
{
|
||||
char szLine[256];
|
||||
char szLine[256] = "";
|
||||
int lines = 0;
|
||||
|
||||
commands.clear();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "mixer.h"
|
||||
#include "configuration.h"
|
||||
|
||||
cMixer::cMixer() {
|
||||
strcpy (szDevice, "/dev/mixerX");
|
||||
|
@ -9,6 +10,7 @@ cMixer::cMixer() {
|
|||
|
||||
cMixer::~cMixer()
|
||||
{
|
||||
closeMixer();
|
||||
}
|
||||
|
||||
//=======================================
|
||||
|
@ -25,32 +27,68 @@ void cMixer::openMixer(const char *dev)
|
|||
throw MixerException(errno);
|
||||
if ((err = initMask()) != 0)
|
||||
throw MixerException(err);
|
||||
SetPlaythrough(0.0);
|
||||
}
|
||||
catch (...) {
|
||||
throw;
|
||||
}
|
||||
inpsrc0 = GetCurrentInputSource();
|
||||
inplevel0 = InputVolume();
|
||||
pcmlevel0 = PCMVolume();
|
||||
vollevel0 = OutVolume();
|
||||
// std::cout << "Input = " << inpsrc0 << ", " << GetInputSourceName(inpsrc0) << std::endl;
|
||||
// std::cout << "Input Level = " << inplevel0 << std::endl;
|
||||
// std::cout << "Pcm Level = " << pcmlevel0 << std::endl;
|
||||
// std::cout << "Output Level = " << vollevel0 << std::endl;
|
||||
initValues();
|
||||
}
|
||||
|
||||
void cMixer::closeMixer()
|
||||
{
|
||||
if (mixer_fd == -1) return;
|
||||
PCMVolume(pcmlevel0);
|
||||
OutVolume(vollevel0);
|
||||
InputVolume(inplevel0);
|
||||
SetCurrentInputSource(inpsrc0);
|
||||
restoreValues();
|
||||
close(mixer_fd);
|
||||
mixer_fd = -1;
|
||||
}
|
||||
|
||||
void cMixer::initValues()
|
||||
{
|
||||
int devnbr;
|
||||
|
||||
inpsrc0 = GetCurrentInputSource();
|
||||
|
||||
devnbr = InputSourceNbr("Line");
|
||||
SetCurrentInputSource(devnbr);
|
||||
linelevel0 = InputVolume();
|
||||
|
||||
devnbr = InputSourceNbr("Mic");
|
||||
SetCurrentInputSource(devnbr);
|
||||
miclevel0 = InputVolume();
|
||||
|
||||
pcmlevel0 = PCMVolume();
|
||||
vollevel0 = OutVolume();
|
||||
/*
|
||||
std::cout << "Sound card initial state:" << std::endl;
|
||||
std::cout << " Dev mask " << hex << devmask << std::endl;
|
||||
std::cout << " Rec mask " << hex << recmask << std::endl;
|
||||
std::cout << " Rec src " << hex << recsrc << std::endl;
|
||||
std::cout << " Current input source # " << GetInputSourceName(inpsrc0) << std::endl;
|
||||
std::cout << " Line Level = " << linelevel0 << std::endl;
|
||||
std::cout << " Mic Level = " << miclevel0 << std::endl;
|
||||
std::cout << " Pcm Level = " << pcmlevel0 << std::endl;
|
||||
std::cout << " Vol Level = " << vollevel0 << std::endl;
|
||||
*/
|
||||
}
|
||||
|
||||
void cMixer::restoreValues()
|
||||
{
|
||||
int devnbr;
|
||||
devnbr = InputSourceNbr("Line");
|
||||
SetCurrentInputSource(devnbr);
|
||||
InputVolume(linelevel0);
|
||||
|
||||
devnbr = InputSourceNbr("Mic");
|
||||
SetCurrentInputSource(devnbr);
|
||||
InputVolume(miclevel0);
|
||||
|
||||
PCMVolume(pcmlevel0);
|
||||
OutVolume(vollevel0);
|
||||
|
||||
// SetCurrentInputSource(inpsrc0);
|
||||
ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_READ_RECSRC), &recsrc0);
|
||||
}
|
||||
|
||||
void cMixer::findNumMixers()
|
||||
{
|
||||
int fd;
|
||||
|
@ -102,13 +140,16 @@ int cMixer::initMask()
|
|||
|
||||
if((ioctl(mixer_fd, MIXER_READ(SOUND_MIXER_READ_DEVMASK), &devmask)) == -1)
|
||||
return errno;
|
||||
// std::cout << "dev mask " << devmask << std::endl;
|
||||
|
||||
if((ioctl(mixer_fd, MIXER_READ(SOUND_MIXER_READ_RECMASK), &recmask)) == -1)
|
||||
return errno;
|
||||
// std::cout << "rec mask " << recmask << std::endl;
|
||||
|
||||
if ((ioctl(mixer_fd, MIXER_READ(SOUND_MIXER_READ_RECSRC), &recsrc)) == -1)
|
||||
return errno;
|
||||
// std::cout << "recsrc mask " << recsrc << std::endl;
|
||||
|
||||
devmask0 = devmask;
|
||||
recmask0 = recmask;
|
||||
recsrc0 = recsrc;
|
||||
|
||||
outmask = devmask ^ recmask;
|
||||
|
||||
|
@ -117,12 +158,9 @@ int cMixer::initMask()
|
|||
for( int i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
|
||||
if (recmask & (1 << i)) {
|
||||
recs[num_rec++] = i;
|
||||
// std::cout << "Input channel " << GetInputSourceName(i) << " is active\n";
|
||||
}
|
||||
else if (devmask & (1<<i)) {
|
||||
// if (devmask & (1<<i)) {
|
||||
outs[num_out++] = i;
|
||||
// std::cout << "Output channel " << OutputVolumeName(i) << " is available\n";
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -235,18 +273,10 @@ int cMixer::InputSourceNbr(char *source)
|
|||
|
||||
int cMixer::GetCurrentInputSource()
|
||||
{
|
||||
// int recmask;
|
||||
|
||||
if (mixer_fd == -1) return -1;
|
||||
|
||||
// if (ioctl(mixer_fd, MIXER_READ(SOUND_MIXER_READ_RECSRC), &recmask) == -1) {
|
||||
// std::cout << "Error reading Record Source\n";
|
||||
// return -1; /* none / error */
|
||||
// }
|
||||
for(int i = 0; i < num_rec; i++)
|
||||
if (recmask & (1 << (recs[i])))
|
||||
if (recsrc & (1 << (recs[i])))
|
||||
return i;
|
||||
// std::cout << "Cannot find input source\n";
|
||||
return -1; /* none */
|
||||
}
|
||||
|
||||
|
@ -264,26 +294,21 @@ void cMixer::SetCurrentInputSource( int i )
|
|||
double cMixer::InputVolume()
|
||||
{
|
||||
if (mixer_fd == -1) return 0.0;
|
||||
int i = GetCurrentInputSource();
|
||||
if (i < 0)
|
||||
return 0.0;
|
||||
// int i = GetCurrentInputSource();
|
||||
// if (i < 0)
|
||||
// return 0.0;
|
||||
return ChannelVolume(SOUND_MIXER_IGAIN);
|
||||
}
|
||||
|
||||
void cMixer::InputVolume( double volume )
|
||||
{
|
||||
int vol;
|
||||
// int i = GetCurrentInputSource();
|
||||
|
||||
// if (i < 0)
|
||||
// return;
|
||||
|
||||
vol = (int)((volume * 100.0) + 0.5);
|
||||
vol = (vol | (vol<<8));
|
||||
ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_IGAIN), &vol);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
double cMixer::GetPlaythrough()
|
||||
{
|
||||
int i = GetCurrentInputSource();
|
||||
|
@ -306,3 +331,13 @@ void cMixer::SetPlaythrough( double volume )
|
|||
ioctl(mixer_fd, MIXER_WRITE(recs[i]), &vol);
|
||||
}
|
||||
|
||||
void cMixer::SetMuteInput(bool b)
|
||||
{
|
||||
return;
|
||||
if (b == 1)
|
||||
SetPlaythrough(0.0);
|
||||
else
|
||||
SetPlaythrough(playthrough0);
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
@ -242,7 +242,7 @@ int cSound::Read(double *buffer, int buffersize)
|
|||
numread = Read(cbuff, buffersize * 2);
|
||||
for (int i = 0; i < buffersize; i++)
|
||||
src_buffer[i] =
|
||||
buffer[i] = ibuff[i] / maxsc;
|
||||
buffer[i] = ibuff[i] / MAXSC;
|
||||
|
||||
if (rxppm != progdefaults.RX_corr) {
|
||||
rxppm = progdefaults.RX_corr;
|
||||
|
|
|
@ -193,7 +193,8 @@ void modem::ModulateXmtr(double *buffer, int len)
|
|||
scard->write_samples(buffer, len);
|
||||
if (progdefaults.viewXmtSignal)
|
||||
for (int i = 0; i < len; i++) {
|
||||
scdata[scptr++] = buffer[i] * 0.1;
|
||||
scdata[scptr] = buffer[i] * 0.1;
|
||||
scptr++;
|
||||
if (scptr == 512) {
|
||||
wf->sig_data(scdata, 512);
|
||||
scptr = 0;
|
||||
|
|
Ładowanie…
Reference in New Issue