Upstream version 2.05c

pull/2/head
Stelios Bounanos 2007-12-01 04:29:52 +00:00
rodzic e672295140
commit e229f2849c
64 zmienionych plików z 7314 dodań i 7242 usunięć

Wyświetl plik

@ -1,5 +1,13 @@
Change Log:
2.05 1) Converted entire make system over to the GNU autoconf / automake
format. See the INSTALL file for additional information
2) Corrected various minor bugs
3) Added mouse wheel functions when mouse is in waterfall display
a) click - toggle AFC
b) shift - alter SQL level
c) ctrl - alter PSK search range.
4) modified waterfall cursors to show the search range
2.04 1) added full waterfall video texting using FeldHell Modern-8-14 font.
1, 2, 3 or 4 characters per video line.
2) bug fix for center mouse button toggle of AFC.

290
INSTALL 100644
Wyświetl plik

@ -0,0 +1,290 @@
Installation Instructions for fldigi
************************************
To compile fldigi you will need:
* version 1.1.x of the Fast Light Tool Kit (FLTK), with its
development libraries and headers, and
* the development files for the Boost C++ library.
You should also install the libraries and headers for PortAudio, the
Portable audio I/O library, together with its C++ bindings. It is
possible (but not recommended) to compile fldigi without PortAudio;
see below.
Additional features are enabled if the corresponding libraries are
present on your system:
* Support for rig control via hamlib is enabled if the hamlib
development files are installed.
* Audio file generation, capture and playback support is enabled if
`configure' can find the sndfile library.
Once you have installed the required packages, the following commands
should be sufficient to compile fldigi and install it under /usr/local:
./configure
make
make install (you may need superuser privileges for installation)
To disable PortAudio support you will need to pass an additional option
to `configure':
./configure --without-portaudio
If your distro/arch does not support Thread Local Storage, disable
fldigi's use of TLS with the `--disable-tls' option.
Fldigi also requires the samplerate library, but has its own copy to
fall back on should it not be detected on your system. The following
message will be printed in that case:
configure: using bundled libsamplerate
If you are building packages for other users you should link fldigi
with the libsamplerate that comes with your distribution.
========== Generic installation instructions follow ==========
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

50
README
Wyświetl plik

@ -1,40 +1,18 @@
The following development libraries need to be present and installed on
your system before you compile Fldigi.
1. Fast Light Tool Kit - FLTK version 1.1.7 or greater.
* configure the compilation of Fltk as:
Fldigi is a software modem program for Amateur Radio use. It is a sound card
based program that both is used for both transmitting and receiving data in any
of the following modes:
o ./configure --enable-threads --enable-xft --enable-shared
CW speeds from 5 to 200 wpm
DominoEX 4 DominoEX 5 DominoEX 8 DominoEX 11 DominoEX 16 DominoEX 22
Feld-Hell FSK-Hell FSK-Hell 105
MFSK-8 MFSK-16 MFSK-16 pix
PSK-31 QPSK-31 PSK-63 QPSK-63
PSK-125 QPSK-125 PSK-250 QPSK-250
Throb-1 Throb-2 Throb-4 ThrobX-1 ThrobX-2 ThrobX-4
OLIVIA various tones and bandwidth
RTTY various Baud Rates, Shifts, Nbr of data bits, etc.
WWV Receive only - calibrate your sound card to WWV
Freq Anal Receive only to measure the frequency of a received carrier
o if you do not use the --enable-xft switch you will get segfaults
when selecting True Type fonts for display!!
o if you do not use the --enable-threads the application will not
compile and link
o if you do not have the jpeg, png and zlib libraries on your system
you can compile them for local use by fltk. Add the following to
the ./configure line
--enable-localjpeg
--enable-localpng
--enable-localzlib
* then simply execute make and make install (make install as super user)
2. Hamlib - The hamlib library is required if you plan to interface to
your transceiver using those common libs. You can also use the fldigi
internal RigCAT controller and avoid the use of hamlib. If you compile
for hamlib the RigCAT functionality is still compiled into fldigi.
Hamlib Library Source the latest release is 1.2.6, download this release.
Follow the instruction in the source code top directory. The library must
be installed as super user. You should compile as your normal login user.
The precompiled hamlib RPM and DEB distributions usually work OK.
3. PortAudio - you will need to build and install both libportaudio and
libportaudiocpp. See website, www.portaudio.com
4. Sndfile - you will need to build and install libsndfile. See website,
http://www.mega-nerd.com/libsndfile by Erik de Castro Lopo. Erik is also
the author of the resampling library that is used in fldigi to compensate
for the sound card offsets.

Wyświetl plik

@ -4,7 +4,7 @@
# Copyright (C) 2007 Stelios Bounanos, M0GLD (m0gld AT enotty DOT net)
AC_PREREQ(2.61)
AC_INIT([fldigi], [2.05b], [w1hkj AT w1hkj DOT com])
AC_INIT([fldigi], [2.05c], [w1hkj AT w1hkj DOT com])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall foreign 1.9.6])
AM_MAINTAINER_MODE
@ -92,7 +92,10 @@ AM_CONDITIONAL([ENABLE_DEBUG], [test "x$ac_cv_debug" = "xyes"])
AC_DEFINE([USE_TLS], [], [Defined if we are using TLS])
AC_ARG_ENABLE([tls],
AC_HELP_STRING([--disable-tls], [disable use of TLS]),
[],
[case "${enableval}" in
yes|no) ac_cv_tls="${enableval}" ;;
*) AC_MSG_ERROR([bad value "${withval}" for --disable-tls]) ;;
esac],
[ac_cv_tls=yes])
if test "x$ac_cv_tls" = "xyes"; then
AC_DEFINE(USE_TLS, 1)
@ -185,6 +188,8 @@ else
else # $ac_cv_want_sndfile is yes
if test "x$ac_cv_sndfile" = "xno"; then
AC_MSG_NOTICE([--with-sndfile was given, but test for sndfile failed])
else
AC_DEFINE(USE_SNDFILE, 1)
fi
PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.10) # for the error message
fi
@ -200,7 +205,10 @@ AC_DEFINE([USE_PORTAUDIO], [], [Set to 1 if we are using PortAudio, 0 otherwise]
AC_ARG_WITH([portaudio],
AC_HELP_STRING([--without-portaudio],
[disable support for PortAudio]),
[],
[case "${withval}" in
yes|no) ac_cv_want_portaudio="${withval}" ;;
*) AC_MSG_ERROR([bad value "${withval}" for --without-portaudio]) ;;
esac],
[ac_cv_want_portaudio=yes])
if test "x$ac_cv_want_portaudio" = "xyes"; then
PKG_CHECK_EXISTS(portaudiocpp >= 12, ac_cv_portaudio=yes, ac_cv_portaudio=no)
@ -245,6 +253,8 @@ else
else # $ac_cv_want_hamlib is yes
if test "x$ac_cv_hamlib" = "xno"; then
AC_MSG_NOTICE([--with-hamlib was given, but test for hamlib failed])
else
AC_DEFINE(USE_HAMLIB, 1)
fi
PKG_CHECK_MODULES(HAMLIB, hamlib >= 1.2.4) # for the error message
fi

Wyświetl plik

@ -1,215 +1,215 @@
#include <config.h>
#include "combo.h"
#include "combo.h"
void popbrwsr_cb (Fl_Widget *v, long d);
Fl_PopBrowser::Fl_PopBrowser (int X, int Y, int W, int H, retvals R)
: Fl_Window (X, Y, W, H, "")
{
Rvals = R;
hRow = H-9;
wRow = W;
clear_border();
box(FL_BORDER_BOX);
popbrwsr = new Fl_Select_Browser(0,0,wRow,hRow,0);
popbrwsr->callback ( (Fl_Callback*)popbrwsr_cb);
parent = 0;
end();
}
Fl_PopBrowser::~Fl_PopBrowser ()
void popbrwsr_cb (Fl_Widget *v, long d);
Fl_PopBrowser::Fl_PopBrowser (int X, int Y, int W, int H, retvals R)
: Fl_Window (X, Y, W, H, "")
{
Rvals = R;
hRow = H-9;
wRow = W;
clear_border();
box(FL_BORDER_BOX);
popbrwsr = new Fl_Select_Browser(0,0,wRow,hRow,0);
popbrwsr->callback ( (Fl_Callback*)popbrwsr_cb);
parent = 0;
end();
}
Fl_PopBrowser::~Fl_PopBrowser ()
{
if (popbrwsr) delete popbrwsr;
}
int Fl_PopBrowser::handle(int event)
{
if (popbrwsr) delete popbrwsr;
}
int Fl_PopBrowser::handle(int event)
{
if (!Fl::event_inside( child(0) ) && event == FL_PUSH) {
pophide();
return 1;
}
return Fl_Group::handle(event);
}
void Fl_PopBrowser::add(char *s, void *d)
{
popbrwsr->add(s,d);
}
void Fl_PopBrowser::clear()
{
popbrwsr->clear();
}
void Fl_PopBrowser::sort()
{
return;
}
void Fl_PopBrowser::popshow (int x, int y)
{
int nRows = popbrwsr->size();
int height = (nRows > 10 ? 10 : nRows)*hRow + 4;
if (nRows == 0) return;
popbrwsr->resize (0, 0, wRow, height);
resize (x, y, wRow, height);
// locate first occurance of Output string value in the list
// and display that if found
int i = 0;
while ( i < parent->listsize &&
strcasecmp (
parent->Output->value(),
}
return Fl_Group::handle(event);
}
void Fl_PopBrowser::add(char *s, void *d)
{
popbrwsr->add(s,d);
}
void Fl_PopBrowser::clear()
{
popbrwsr->clear();
}
void Fl_PopBrowser::sort()
{
return;
}
void Fl_PopBrowser::popshow (int x, int y)
{
int nRows = popbrwsr->size();
int height = (nRows > 10 ? 10 : nRows)*hRow + 4;
if (nRows == 0) return;
popbrwsr->resize (0, 0, wRow, height);
resize (x, y, wRow, height);
// locate first occurance of Output string value in the list
// and display that if found
int i = 0;
while ( i < parent->listsize &&
strcasecmp (
parent->Output->value(),
parent->datalist[i]->s ) != 0
) i++;
if (i > parent->listsize) i = 0;
show ();
popbrwsr->topline (i+1);
Fl::grab(this);
}
void Fl_PopBrowser::pophide ()
{
hide ();
Fl::release();
}
void Fl_PopBrowser::popbrwsr_cb_i (Fl_Widget *v, long d)
{
Fl_PopBrowser *me = (Fl_PopBrowser *)(v->parent());
) i++;
if (i > parent->listsize) i = 0;
show ();
popbrwsr->topline (i+1);
Fl::grab(this);
}
void Fl_PopBrowser::pophide ()
{
hide ();
Fl::release();
}
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_Input *tgt = me->Rvals.Inp;
// update the return values
if (tgt) {
int row = (me->popbrwsr)->value();
if (row > 0) {
tgt->value ((me->popbrwsr)->text (row));
me->Rvals.retval = (me->popbrwsr)->data (row);
*(me->Rvals.idx) = row;
}
}
me->pophide();
// user selected an item from the browser list, so execute the
// callback if one is registered.
if (me->parent)
(me->parent)->do_callback();
return;
}
void popbrwsr_cb (Fl_Widget *v, long d)
{
((Fl_PopBrowser *)(v))->popbrwsr_cb_i (v, d);
return;
}
/* XPM Select_Browser Label */
static const char *brws_12[] = {
/* width height num_colors chars_per_pixel */
" 12 12 3 1",
/* colors */
". c #000000",
"d c none",
"e c #ffffff",
/* pixels */
"dddddddddddd",
"dddddddddddd",
"dddddddddddd",
"............",
"d..........d",
"dd........dd",
"ddd......ddd",
"dddd....dddd",
"ddddd..ddddd",
"dddddddddddd",
"dddddddddddd",
"dddddddddddd",
};
void Fl_ComboBox::fl_popbrwsr(Fl_Widget *p)
{
Fl_Widget *who = this, *parent;
// compute the x,y position for the pop-up browser window
// x() and y() are locations relative to the current window
// also need to know where the root window for the application
// to compute the screen x,y position of the popup
int xpos = who->x(), ypos = who->h() + who->y();
parent = who;
while (parent) {
who = parent;
parent = parent->parent();
if (parent == 0) {
xpos += who->x();
ypos += who->y();
}
}
if (Brwsr == 0) {
Brwsr = new Fl_PopBrowser(xpos, ypos, width, height, R);
}
// pass the calling widget to the popup browser so that the
// correct callback function can be called when the user selects an item
// from the browser list
Brwsr->parent = (Fl_ComboBox *) p;
Brwsr->popshow(xpos, ypos);
return;
}
void btnComboBox_cb (Fl_Widget *v, void *d)
{
Fl_Widget *p = v->parent();
((Fl_ComboBox *)p)->fl_popbrwsr (p);
return;
}
Fl_ComboBox::Fl_ComboBox (int X,int Y,int W,int H, const char *L)
: Fl_Group (X, Y, W, H, L)
{
width = W; height = H;
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_Input (X, Y, W-18, H);
Brwsr = 0;
datalist = new datambr *[FL_COMBO_LIST_INCR];
Fl_Input *tgt = me->Rvals.Inp;
// update the return values
if (tgt) {
int row = (me->popbrwsr)->value();
if (row > 0) {
tgt->value ((me->popbrwsr)->text (row));
me->Rvals.retval = (me->popbrwsr)->data (row);
*(me->Rvals.idx) = row;
}
}
me->pophide();
// user selected an item from the browser list, so execute the
// callback if one is registered.
if (me->parent)
(me->parent)->do_callback();
return;
}
void popbrwsr_cb (Fl_Widget *v, long d)
{
((Fl_PopBrowser *)(v))->popbrwsr_cb_i (v, d);
return;
}
/* XPM Select_Browser Label */
static const char *brws_12[] = {
/* width height num_colors chars_per_pixel */
" 12 12 3 1",
/* colors */
". c #000000",
"d c none",
"e c #ffffff",
/* pixels */
"dddddddddddd",
"dddddddddddd",
"dddddddddddd",
"............",
"d..........d",
"dd........dd",
"ddd......ddd",
"dddd....dddd",
"ddddd..ddddd",
"dddddddddddd",
"dddddddddddd",
"dddddddddddd",
};
void Fl_ComboBox::fl_popbrwsr(Fl_Widget *p)
{
Fl_Widget *who = this, *parent;
// compute the x,y position for the pop-up browser window
// x() and y() are locations relative to the current window
// also need to know where the root window for the application
// to compute the screen x,y position of the popup
int xpos = who->x(), ypos = who->h() + who->y();
parent = who;
while (parent) {
who = parent;
parent = parent->parent();
if (parent == 0) {
xpos += who->x();
ypos += who->y();
}
}
if (Brwsr == 0) {
Brwsr = new Fl_PopBrowser(xpos, ypos, width, height, R);
}
// pass the calling widget to the popup browser so that the
// correct callback function can be called when the user selects an item
// from the browser list
Brwsr->parent = (Fl_ComboBox *) p;
Brwsr->popshow(xpos, ypos);
return;
}
void btnComboBox_cb (Fl_Widget *v, void *d)
{
Fl_Widget *p = v->parent();
((Fl_ComboBox *)p)->fl_popbrwsr (p);
return;
}
Fl_ComboBox::Fl_ComboBox (int X,int Y,int W,int H, const char *L)
: Fl_Group (X, Y, W, H, L)
{
width = W; height = H;
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_Input (X, Y, W-18, H);
Brwsr = 0;
datalist = new datambr *[FL_COMBO_LIST_INCR];
maxsize = FL_COMBO_LIST_INCR;
for (int i = 0; i < FL_COMBO_LIST_INCR; i++) datalist[i] = 0;
listsize = 0;
listtype = 0;
end();
R.Inp = Output;
R.retval = retdata;
R.idx = &idx;
}
void Fl_ComboBox::type (int t)
{
listtype = t;
}
for (int i = 0; i < FL_COMBO_LIST_INCR; i++) datalist[i] = 0;
listsize = 0;
listtype = 0;
end();
R.Inp = Output;
R.retval = retdata;
R.idx = &idx;
}
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
void Fl_ComboBox::value( const char *s )
// ComboBox value is contained in the Output widget
void Fl_ComboBox::value( const char *s )
{
int i;
if (listtype & FL_COMBO_UNIQUE_NOCASE == FL_COMBO_UNIQUE_NOCASE) {
for (i = 0; i < listsize; i++) {
if (strcasecmp (s, datalist[i]->s) == 0)
break;
}
} else {
for (i = 0; i < listsize; i++) {
if (strcmp (s, datalist[i]->s) == 0)
break;
}
}
int i;
if (listtype & FL_COMBO_UNIQUE_NOCASE == FL_COMBO_UNIQUE_NOCASE) {
for (i = 0; i < listsize; i++) {
if (strcasecmp (s, datalist[i]->s) == 0)
break;
}
} else {
for (i = 0; i < listsize; i++) {
if (strcmp (s, datalist[i]->s) == 0)
break;
}
}
if ( i < listsize)
Output->value(datalist[i]->s);
}
@ -219,106 +219,106 @@ void Fl_ComboBox::index(int i)
if (i >= 0 && i < listsize)
Output->value( datalist[i]->s);
}
const char *Fl_ComboBox::value()
{
return (Output->value ());
}
int Fl_ComboBox::index() {
return idx;
}
void * Fl_ComboBox::data() {
return retdata;
}
void Fl_ComboBox::add( const char *s, void * d)
{
if (Brwsr == 0) {
Brwsr = new Fl_PopBrowser(0, 0, width, height, R);
}
// test for uniqueness of entry if required
if (listtype & FL_COMBO_UNIQUE == FL_COMBO_UNIQUE) {
if (listtype & FL_COMBO_UNIQUE_NOCASE == FL_COMBO_UNIQUE_NOCASE) {
for (int i = 0; i < listsize; i++) {
if (strcasecmp (s, datalist[i]->s) == 0)
return;
}
} else {
for (int i = 0; i < listsize; i++) {
if (strcmp (s, datalist[i]->s) == 0)
return;
}
}
}
// not unique or not in list, so add this entry
datalist[listsize] = new datambr;
const char *Fl_ComboBox::value()
{
return (Output->value ());
}
int Fl_ComboBox::index() {
return idx;
}
void * Fl_ComboBox::data() {
return retdata;
}
void Fl_ComboBox::add( const char *s, void * d)
{
if (Brwsr == 0) {
Brwsr = new Fl_PopBrowser(0, 0, width, height, R);
}
// test for uniqueness of entry if required
if (listtype & FL_COMBO_UNIQUE == FL_COMBO_UNIQUE) {
if (listtype & FL_COMBO_UNIQUE_NOCASE == FL_COMBO_UNIQUE_NOCASE) {
for (int i = 0; i < listsize; i++) {
if (strcasecmp (s, datalist[i]->s) == 0)
return;
}
} else {
for (int i = 0; i < listsize; i++) {
if (strcmp (s, datalist[i]->s) == 0)
return;
}
}
}
// not unique or not in list, so add this entry
datalist[listsize] = new datambr;
datalist[listsize]->s = new char [strlen(s) + 1];
datalist[listsize]->s[0] = 0;
strcpy (datalist[listsize]->s, s);
datalist[listsize]->d = d;
Brwsr->add(datalist[listsize]->s,d);
listsize++;
if (listsize == maxsize) {
int nusize = maxsize + FL_COMBO_LIST_INCR;
datambr **temparray = new datambr *[nusize];
for (int i = 0; i < listsize; i++) temparray[i] = datalist[i];
delete [] datalist;
datalist = temparray;
maxsize = nusize;
}
}
void Fl_ComboBox::clear()
{
if (Brwsr == 0)
Brwsr = new Fl_PopBrowser(0, 0, width, height, R);
else
datalist[listsize]->s[0] = 0;
strcpy (datalist[listsize]->s, s);
datalist[listsize]->d = d;
Brwsr->add(datalist[listsize]->s,d);
listsize++;
if (listsize == maxsize) {
int nusize = maxsize + FL_COMBO_LIST_INCR;
datambr **temparray = new datambr *[nusize];
for (int i = 0; i < listsize; i++) temparray[i] = datalist[i];
delete [] datalist;
datalist = temparray;
maxsize = nusize;
}
}
void Fl_ComboBox::clear()
{
if (Brwsr == 0)
Brwsr = new Fl_PopBrowser(0, 0, width, height, R);
else
Brwsr->clear();
if (listsize == 0) return;
if (listsize == 0) return;
for (int i = 0; i < listsize; i++) {
delete [] datalist[i]->s;
delete datalist[i];
}
listsize = 0;
}
int DataCompare( const void *x1, const void *x2 )
{
int cmp;
datambr *X1, *X2;
X1 = *(datambr **)(x1);
X2 = *(datambr **)(x2);
cmp = strcasecmp (X1->s, X2->s);
if (cmp < 0)
return -1;
if (cmp > 0)
return 1;
return 0;
}
void Fl_ComboBox::sort() {
Brwsr->clear ();
qsort (&datalist[0],
listsize,
sizeof (datambr *),
DataCompare);
for (int i = 0; i < listsize; i++)
Brwsr->add (datalist[i]->s, datalist[i]->d);
}
void Fl_ComboBox::textfont (int fnt)
{
Output->textfont (fnt);
}
void Fl_ComboBox::textsize (uchar n)
{
Output->textsize (n);
}
delete [] datalist[i]->s;
delete datalist[i];
}
listsize = 0;
}
int DataCompare( const void *x1, const void *x2 )
{
int cmp;
datambr *X1, *X2;
X1 = *(datambr **)(x1);
X2 = *(datambr **)(x2);
cmp = strcasecmp (X1->s, X2->s);
if (cmp < 0)
return -1;
if (cmp > 0)
return 1;
return 0;
}
void Fl_ComboBox::sort() {
Brwsr->clear ();
qsort (&datalist[0],
listsize,
sizeof (datambr *),
DataCompare);
for (int i = 0; i < listsize; i++)
Brwsr->add (datalist[i]->s, datalist[i]->d);
}
void Fl_ComboBox::textfont (int fnt)
{
Output->textfont (fnt);
}
void Fl_ComboBox::textsize (uchar n)
{
Output->textsize (n);
}

Wyświetl plik

@ -65,7 +65,6 @@ void rtty::init()
{
modem::init();
rx_init();
clear_StatusMessages();
put_MODEstatus(mode);
sprintf(msg1,"Shft %-4.0f", rtty_shift);
put_Status1(msg1);

Wyświetl plik

@ -553,6 +553,7 @@ static void cb_btnAudioIO(Fl_Round_Button* o, void*) {
o->value(1);
menuOSSDev->activate();
menuPADev->deactivate();
menuSampleRate->deactivate();
scDevice = menuOSSDev->value();
progdefaults.btnAudioIOis = 0;
progdefaults.changed = true;
@ -566,6 +567,7 @@ static void cb_btnAudioIO1(Fl_Round_Button* o, void*) {
o->value(1);
menuPADev->activate();
menuOSSDev->deactivate();
menuSampleRate->activate();
scDevice = menuPADev->value();
progdefaults.btnAudioIOis = 1;
progdefaults.changed = true;
@ -588,6 +590,14 @@ resetSoundCard();
progdefaults.changed = true;
}
Fl_Choice *menuSampleRate=(Fl_Choice *)0;
static void cb_menuSampleRate(Fl_Choice* o, void*) {
progdefaults.sample_rate = o->value() ? strtol(o->mvalue()->text, 0, 10) : 0;
resetSoundCard();
progdefaults.changed = true;
}
Fl_Group *tabMixer=(Fl_Group *)0;
Fl_Light_Button *btnLineIn=(Fl_Light_Button *)0;
@ -1464,19 +1474,19 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
{ Fl_Group* o = tabAudio = new Fl_Group(0, 50, 400, 170, "Audio");
o->color((Fl_Color)51);
o->selection_color((Fl_Color)51);
{ Fl_Spinner* o = cntRxRateCorr = new Fl_Spinner(299, 161, 75, 24, "RX ppm:");
{ Fl_Spinner* o = cntRxRateCorr = new Fl_Spinner(300, 160, 75, 24, "RX ppm:");
o->callback((Fl_Callback*)cb_cntRxRateCorr);
o->step(1);
o->minimum(-50000);
o->maximum(50000);
}
{ Fl_Spinner* o = cntTxRateCorr = new Fl_Spinner(299, 190, 75, 24, "TX ppm:");
{ Fl_Spinner* o = cntTxRateCorr = new Fl_Spinner(300, 130, 75, 24, "TX ppm:");
o->callback((Fl_Callback*)cb_cntTxRateCorr);
o->step(1);
o->minimum(-50000);
o->maximum(50000);
}
{ Fl_Spinner* o = cntTxOffset = new Fl_Spinner(177, 190, 45, 24, "Tx offset:");
{ Fl_Spinner* o = cntTxOffset = new Fl_Spinner(330, 190, 45, 24, "Tx offset:");
o->callback((Fl_Callback*)cb_cntTxOffset);
o->value(progdefaults.TxOffset);
o->step(1);
@ -1508,6 +1518,12 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
o->align(FL_ALIGN_RIGHT);
o->value(progdefaults.PAdevice.c_str());
}
{ Fl_Choice* o = menuSampleRate = new Fl_Choice(5, 190, 85, 25, "Sample rate");
o->down_box(FL_BORDER_BOX);
o->callback((Fl_Callback*)cb_menuSampleRate);
o->align(FL_ALIGN_RIGHT);
o->menu(sample_rate_menu);
}
o->end();
}
{ Fl_Group* o = tabMixer = new Fl_Group(0, 50, 400, 170, "Mixer");

Wyświetl plik

@ -634,7 +634,7 @@ progdefaults.changed = true;}
label {RX ppm:}
callback {progdefaults.RX_corr = (int)o->value();
progdefaults.changed = true;}
xywh {299 161 75 24}
xywh {300 160 75 24}
code0 {o->step(1);}
code1 {o->minimum(-50000);}
code2 {o->maximum(50000);}
@ -643,7 +643,7 @@ progdefaults.changed = true;}
label {TX ppm:}
callback {progdefaults.TX_corr = (int)o->value();
progdefaults.changed = true;}
xywh {299 190 75 24}
xywh {300 130 75 24}
code0 {o->step(1);}
code1 {o->minimum(-50000);}
code2 {o->maximum(50000);}
@ -652,7 +652,7 @@ progdefaults.changed = true;}
label {Tx offset:}
callback {progdefaults.TxOffset = (int)o->value();
progdefaults.changed = true;}
xywh {177 190 45 24}
xywh {330 190 45 24}
code0 {o->value(progdefaults.TxOffset);}
code1 {o->step(1);}
code2 {o->minimum(-50);}
@ -668,6 +668,7 @@ progdefaults.changed = true;}
o->value(1);
menuOSSDev->activate();
menuPADev->deactivate();
menuSampleRate->deactivate();
scDevice = menuOSSDev->value();
progdefaults.btnAudioIOis = 0;
progdefaults.changed = true;
@ -680,6 +681,7 @@ resetSoundCard();}
o->value(1);
menuPADev->activate();
menuOSSDev->deactivate();
menuSampleRate->activate();
scDevice = menuPADev->value();
progdefaults.btnAudioIOis = 1;
progdefaults.changed = true;
@ -703,6 +705,15 @@ progdefaults.changed = true;} open
xywh {155 90 110 25} align 8
code0 {o->value(progdefaults.PAdevice.c_str());}
} {}
Fl_Choice menuSampleRate {
label {Sample rate}
callback {progdefaults.sample_rate = o->value() ? strtol(o->mvalue()->text, 0, 10) : 0;
resetSoundCard();
progdefaults.changed = true;} open selected
xywh {5 190 85 25} down_box BORDER_BOX align 8
code0 {extern Fl_Menu_Item sample_rate_menu[];}
code1 {o->menu(sample_rate_menu);}
} {}
}
Fl_Group tabMixer {
label Mixer open

Wyświetl plik

@ -147,6 +147,59 @@ int HNOM = DEFAULT_HNOM;
int WNOM = DEFAULT_WNOM;
void cb_init_mode(Fl_Widget *, void *arg);
Fl_Widget *modem_config_tab;
Fl_Menu_Item *quick_change;
Fl_Menu_Item quick_change_psk[] = {
{ mode_info[MODE_BPSK31].name, 0, cb_init_mode, (void *)MODE_BPSK31 },
{ mode_info[MODE_PSK63].name, 0, cb_init_mode, (void *)MODE_PSK63 },
{ mode_info[MODE_PSK125].name, 0, cb_init_mode, (void *)MODE_PSK125 },
{ mode_info[MODE_PSK250].name, 0, cb_init_mode, (void *)MODE_PSK250 },
{ 0 }
};
Fl_Menu_Item quick_change_qpsk[] = {
{ mode_info[MODE_QPSK31].name, 0, cb_init_mode, (void *)MODE_QPSK31 },
{ mode_info[MODE_QPSK63].name, 0, cb_init_mode, (void *)MODE_QPSK63 },
{ mode_info[MODE_QPSK125].name, 0, cb_init_mode, (void *)MODE_QPSK125 },
{ mode_info[MODE_QPSK250].name, 0, cb_init_mode, (void *)MODE_QPSK250 },
{ 0 }
};
Fl_Menu_Item quick_change_mfsk[] = {
{ mode_info[MODE_MFSK8].name, 0, cb_init_mode, (void *)MODE_MFSK8 },
{ mode_info[MODE_MFSK16].name, 0, cb_init_mode, (void *)MODE_MFSK16 },
{ 0 }
};
Fl_Menu_Item quick_change_domino[] = {
{ mode_info[MODE_DOMINOEX4].name, 0, cb_init_mode, (void *)MODE_DOMINOEX4 },
{ mode_info[MODE_DOMINOEX5].name, 0, cb_init_mode, (void *)MODE_DOMINOEX5 },
{ mode_info[MODE_DOMINOEX8].name, 0, cb_init_mode, (void *)MODE_DOMINOEX8 },
{ mode_info[MODE_DOMINOEX11].name, 0, cb_init_mode, (void *)MODE_DOMINOEX11 },
{ mode_info[MODE_DOMINOEX16].name, 0, cb_init_mode, (void *)MODE_DOMINOEX16 },
{ mode_info[MODE_DOMINOEX22].name, 0, cb_init_mode, (void *)MODE_DOMINOEX22 },
{ 0 }
};
Fl_Menu_Item quick_change_feld[] = {
{ mode_info[MODE_FELDHELL].name, 0, cb_init_mode, (void *)MODE_FELDHELL },
{ mode_info[MODE_FSKHELL].name, 0, cb_init_mode, (void *)MODE_FSKHELL },
{ mode_info[MODE_FSKH105].name, 0, cb_init_mode, (void *)MODE_FSKH105 },
{ 0 }
};
Fl_Menu_Item quick_change_throb[] = {
{ mode_info[MODE_THROB1].name, 0, cb_init_mode, (void *)MODE_THROB1 },
{ mode_info[MODE_THROB2].name, 0, cb_init_mode, (void *)MODE_THROB2 },
{ mode_info[MODE_THROB4].name, 0, cb_init_mode, (void *)MODE_THROB4 },
{ mode_info[MODE_THROBX1].name, 0, cb_init_mode, (void *)MODE_THROBX1 },
{ mode_info[MODE_THROBX2].name, 0, cb_init_mode, (void *)MODE_THROBX2 },
{ mode_info[MODE_THROBX4].name, 0, cb_init_mode, (void *)MODE_THROBX4 },
{ 0 }
};
void startup_modem(modem *m)
{
trx_start_modem(m);
@ -244,408 +297,106 @@ void cb_wMain( Fl_Widget *, void * )
clean_exit();
}
void initMFSK8()
void init_modem(trx_mode mode)
{
clear_StatusMessages();
if (!mfsk8_modem)
mfsk8_modem = new mfsk(MODE_MFSK8);
startup_modem (mfsk8_modem);
progStatus.saveModeState(MODE_MFSK8);
}
quick_change = 0;
modem_config_tab = tabsModems->child(0);
void cb_mnuMFSK8(Fl_Menu_*, void*) {
initMFSK8();
}
switch (mode) {
case MODE_MFSK16: case MODE_MFSK8:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new mfsk(mode));
quick_change = quick_change_mfsk;
break;
void initMFSK16()
{
clear_StatusMessages();
if (!mfsk16_modem)
mfsk16_modem = new mfsk(MODE_MFSK16);
startup_modem (mfsk16_modem);
progStatus.saveModeState(MODE_MFSK16);
}
case MODE_OLIVIA:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new olivia);
modem_config_tab = tabOlivia;
break;
void cb_mnuMFSK16(Fl_Menu_*, void*) {
initMFSK16();
}
case MODE_RTTY:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new rtty(mode));
modem_config_tab = tabRTTY;
break;
void initPSK31()
{
clear_StatusMessages();
if (!psk31_modem)
psk31_modem = new psk(MODE_BPSK31);
startup_modem (psk31_modem);
progStatus.saveModeState(MODE_BPSK31);
}
case MODE_THROB1: case MODE_THROB2: case MODE_THROB4:
case MODE_THROBX1: case MODE_THROBX2: case MODE_THROBX4:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new throb(mode));
quick_change = quick_change_throb;
break;
void cb_mnuPSK31(Fl_Menu_*, void*) {
initPSK31();
}
case MODE_BPSK31: case MODE_PSK63: case MODE_PSK125: case MODE_PSK250:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new psk(mode));
quick_change = quick_change_psk;
modem_config_tab = tabPSK;
break;
case MODE_QPSK31: case MODE_QPSK63: case MODE_QPSK125: case MODE_QPSK250:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new psk(mode));
quick_change = quick_change_qpsk;
modem_config_tab = tabPSK;
break;
void initPSK63()
{
clear_StatusMessages();
if(!psk63_modem)
psk63_modem = new psk(MODE_PSK63);
startup_modem (psk63_modem);
progStatus.saveModeState(MODE_PSK63);
}
case MODE_FELDHELL: case MODE_FSKHELL: case MODE_FSKH105:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new feld(mode));
quick_change = quick_change_feld;
modem_config_tab = tabFeld;
break;
void cb_mnuPSK63(Fl_Menu_*, void*) {
initPSK63();
}
case MODE_CW:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem : new cw);
modem_config_tab = tabCW;
break;
void initPSK125()
{
clear_StatusMessages();
if(!psk125_modem)
psk125_modem = new psk(MODE_PSK125);
startup_modem (psk125_modem);
progStatus.saveModeState(MODE_PSK125);
}
case MODE_DOMINOEX4: case MODE_DOMINOEX5: case MODE_DOMINOEX8:
case MODE_DOMINOEX11: case MODE_DOMINOEX16: case MODE_DOMINOEX22:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new dominoex(mode));
quick_change = quick_change_domino;
modem_config_tab = tabDomEX;
break;
void cb_mnuPSK125(Fl_Menu_*, void*) {
initPSK125();
}
case MODE_WWV:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new wwv);
break;
void initPSK250()
{
clear_StatusMessages();
if(!psk250_modem)
psk250_modem = new psk(MODE_PSK250);
startup_modem (psk250_modem);
progStatus.saveModeState(MODE_PSK250);
}
case MODE_ANALYSIS:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new anal);
break;
void cb_mnuPSK250(Fl_Menu_*, void*) {
initPSK250();
}
void initQPSK31()
{
clear_StatusMessages();
if (!qpsk31_modem)
qpsk31_modem = new psk(MODE_QPSK31);
startup_modem (qpsk31_modem);
progStatus.saveModeState(MODE_QPSK31);
}
void cb_mnuQPSK31(Fl_Menu_*, void*) {
initQPSK31();
}
void initQPSK63()
{
clear_StatusMessages();
if (!qpsk63_modem)
qpsk63_modem = new psk(MODE_QPSK63);
startup_modem (qpsk63_modem);
progStatus.saveModeState(MODE_QPSK63);
}
void cb_mnuQPSK63(Fl_Menu_*, void*) {
initQPSK63();
}
void initQPSK125()
{
clear_StatusMessages();
if (!qpsk125_modem)
qpsk125_modem = new psk(MODE_QPSK125);
startup_modem (qpsk125_modem);
progStatus.saveModeState(MODE_QPSK125);
}
void cb_mnuQPSK125(Fl_Menu_*, void*) {
initQPSK125();
}
void initQPSK250()
{
clear_StatusMessages();
if (!qpsk250_modem)
qpsk250_modem = new psk(MODE_QPSK250);
startup_modem (qpsk250_modem);
progStatus.saveModeState(MODE_QPSK250);
}
void cb_mnuQPSK250(Fl_Menu_*, void*) {
initQPSK250();
}
void initCW()
{
clear_StatusMessages();
if (!cw_modem)
cw_modem = new cw();
startup_modem (cw_modem);
progStatus.saveModeState(MODE_CW);
}
void cb_mnuCW(Fl_Menu_*, void*) {
initCW();
}
void initRTTY()
{
clear_StatusMessages();
if (!rtty_modem)
rtty_modem = new rtty(MODE_RTTY);
startup_modem (rtty_modem);
progStatus.saveModeState(MODE_RTTY);
}
void cb_mnuRTTY(Fl_Menu_*, void*) {
initRTTY();
}
void initOLIVIA()
{
clear_StatusMessages();
if (!olivia_modem)
olivia_modem = new olivia();
startup_modem (olivia_modem);
progStatus.saveModeState(MODE_OLIVIA);
}
void cb_mnuOlivia(Fl_Menu_*, void*) {
initOLIVIA();
}
void initDOMINOEX4()
{
clear_StatusMessages();
if (!dominoex4_modem) {
dominoex4_modem = new dominoex(MODE_DOMINOEX4);
default:
cerr << "Unknown mode: " << mode << '\n';
return init_modem(MODE_BPSK31);
}
startup_modem (dominoex4_modem);
progStatus.saveModeState(MODE_DOMINOEX4);
}
void cb_mnuDOMINOEX4(Fl_Menu_ *, void *) {
initDOMINOEX4();
}
void initDOMINOEX5()
{
clear_StatusMessages();
if (!dominoex5_modem) {
dominoex5_modem = new dominoex(MODE_DOMINOEX5);
}
startup_modem (dominoex5_modem);
progStatus.saveModeState(MODE_DOMINOEX5);
progStatus.saveModeState(mode);
}
void cb_mnuDOMINOEX5(Fl_Menu_ *, void *) {
initDOMINOEX5();
}
void initDOMINOEX8()
void init_modem_sync(trx_mode m)
{
clear_StatusMessages();
if (!dominoex8_modem)
dominoex8_modem = new dominoex(MODE_DOMINOEX8);
startup_modem (dominoex8_modem);
progStatus.saveModeState(MODE_DOMINOEX8);
#ifndef NDEBUG
if (GET_THREAD_ID() == TRX_TID)
cerr << "trx thread called init_modem_sync!\n";
#endif
wait_modem_ready_prep();
init_modem(m);
wait_modem_ready_cmpl();
}
void cb_mnuDOMINOEX8(Fl_Menu_ *, void *) {
initDOMINOEX8();
}
void initDOMINOEX11()
void cb_init_mode(Fl_Widget *, void *mode)
{
clear_StatusMessages();
if (!dominoex11_modem)
dominoex11_modem = new dominoex(MODE_DOMINOEX11);
startup_modem (dominoex11_modem);
progStatus.saveModeState(MODE_DOMINOEX11);
init_modem(reinterpret_cast<trx_mode>(mode));
}
void cb_mnuDOMINOEX11(Fl_Menu_ *, void *) {
initDOMINOEX11();
}
void initDOMINOEX16()
{
clear_StatusMessages();
if (!dominoex16_modem)
dominoex16_modem = new dominoex(MODE_DOMINOEX16);
startup_modem (dominoex16_modem);
progStatus.saveModeState(MODE_DOMINOEX16);
}
void cb_mnuDOMINOEX16(Fl_Menu_ *, void *) {
initDOMINOEX16();
}
void initDOMINOEX22()
{
clear_StatusMessages();
if (!dominoex22_modem)
dominoex22_modem = new dominoex(MODE_DOMINOEX22);
startup_modem (dominoex22_modem);
progStatus.saveModeState(MODE_DOMINOEX22);
}
void cb_mnuDOMINOEX22(Fl_Menu_ *, void *) {
initDOMINOEX22();
}
void initFELDHELL()
{
clear_StatusMessages();
FHdisp->clear();
if (!feld_modem)
feld_modem = new feld(MODE_FELDHELL);
startup_modem (feld_modem);
progStatus.saveModeState(MODE_FELDHELL);
}
void cb_mnuFELDHELL(Fl_Menu_ *, void *) {
initFELDHELL();
}
void initFSKHELL()
{
clear_StatusMessages();
FHdisp->clear();
if (!feld_FMmodem)
feld_FMmodem = new feld(MODE_FSKHELL);
startup_modem (feld_FMmodem);
progStatus.saveModeState(MODE_FSKHELL);
}
void cb_mnuFSKHELL(Fl_Menu_ *, void *) {
initFSKHELL();
}
void initFSKHELL105()
{
clear_StatusMessages();
FHdisp->clear();
if (!feld_FM105modem)
feld_FM105modem = new feld(MODE_FSKH105);
startup_modem (feld_FM105modem);
progStatus.saveModeState(MODE_FSKH105);
}
void cb_mnuFSKHELL105(Fl_Menu_ *, void *) {
initFSKHELL105();
}
//void cb_mnuCMTHELL(Fl_Menu_ *, void *) {
// clear_StatusMessages();
// FHdisp->clear();
// if (!feld_CMTmodem)
// feld_CMTmodem = new feld(MODE_FMCMT);
// startup_modem (feld_CMTmodem);
//}
void initTHROB1()
{
clear_StatusMessages();
if (!throb1_modem)
throb1_modem = new throb(MODE_THROB1);
startup_modem (throb1_modem);
progStatus.saveModeState(MODE_THROB1);
}
void cb_mnuTHROB1(Fl_Menu_ *, void *) {
initTHROB1();
}
void initTHROB2()
{
clear_StatusMessages();
if (!throb2_modem)
throb2_modem = new throb(MODE_THROB2);
startup_modem (throb2_modem);
progStatus.saveModeState(MODE_THROB2);
}
void cb_mnuTHROB2(Fl_Menu_ *, void *) {
initTHROB2();
}
void initTHROB4()
{
clear_StatusMessages();
if (!throb4_modem)
throb4_modem = new throb(MODE_THROB4);
startup_modem (throb4_modem);
progStatus.saveModeState(MODE_THROB4);
}
void cb_mnuTHROB4(Fl_Menu_ *, void *) {
initTHROB4();
}
void initTHROBX1()
{
clear_StatusMessages();
if (!throbx1_modem)
throbx1_modem = new throb(MODE_THROBX1);
startup_modem (throbx1_modem);
progStatus.saveModeState(MODE_THROBX1);
}
void cb_mnuTHROBX1(Fl_Menu_ *, void *) {
initTHROBX1();
}
void initTHROBX2()
{
clear_StatusMessages();
if (!throbx2_modem)
throbx2_modem = new throb(MODE_THROBX2);
startup_modem (throbx2_modem);
progStatus.saveModeState(MODE_THROBX2);
}
void cb_mnuTHROBX2(Fl_Menu_ *, void *) {
initTHROBX2();
}
void initTHROBX4()
{
clear_StatusMessages();
if (!throbx4_modem)
throbx4_modem = new throb(MODE_THROBX4);
startup_modem (throbx4_modem);
progStatus.saveModeState(MODE_THROBX4);
}
void cb_mnuTHROBX4(Fl_Menu_ *, void *) {
initTHROBX4();
}
void initWWV()
{
clear_StatusMessages();
if (!wwv_modem)
wwv_modem = new wwv();
startup_modem (wwv_modem);
progStatus.saveModeState(MODE_WWV);
}
void cb_mnuWWV(Fl_Menu_ *, void *) {
initWWV();
}
void initANALYSIS()
{
clear_StatusMessages();
if (!anal_modem)
anal_modem = new anal();
startup_modem (anal_modem);
progStatus.saveModeState(MODE_ANALYSIS);
}
void cb_mnuANALYSIS(Fl_Menu_ *, void *) {
initANALYSIS();
}
void restoreFocus()
{
@ -912,175 +663,22 @@ void cb_QRZ(Fl_Widget *b, void *)
QRZquery();
}
void status_btn_right_click()
void status_cb(Fl_Widget *b, void *arg)
{
progdefaults.loadDefaults();
tabsConfigure->value(tabModems);
switch (active_modem->get_mode()) {
case MODE_CW : tabsModems->value(tabCW); break;
case MODE_OLIVIA : tabsModems->value(tabOlivia); break;
case MODE_RTTY: tabsModems->value(tabRTTY); break;
case MODE_FELDHELL :
case MODE_FSKHELL :
case MODE_FSKH105 : tabsModems->value(tabFeld); break;
case MODE_DOMINOEX4 :
case MODE_DOMINOEX5 :
case MODE_DOMINOEX8 :
case MODE_DOMINOEX11 :
case MODE_DOMINOEX16 :
case MODE_DOMINOEX22 : tabsModems->value(tabDomEX); break;
case MODE_BPSK31 :
case MODE_QPSK31 :
case MODE_PSK63 :
case MODE_QPSK63 :
case MODE_PSK125 :
case MODE_QPSK125 :
case MODE_PSK250 :
case MODE_QPSK250 :
tabsModems->value(tabPSK); break;
case MODE_MFSK16:
case MODE_MFSK8:
case MODE_THROB1 :
case MODE_THROB2 :
case MODE_THROB4 :
case MODE_THROBX1 :
case MODE_THROBX2 :
case MODE_THROBX4 :
default :
tabsModems->value(tabCW);
}
dlgConfig->show();
}
Fl_Menu_Item quick_change_psk[] = {
{"psk 31", 0, (Fl_Callback*)cb_mnuPSK31 },
{"psk 63", 0, (Fl_Callback*)cb_mnuPSK63 },
{"psk 125", 0, (Fl_Callback*)cb_mnuPSK125 },
{"psk 250", 0, (Fl_Callback*)cb_mnuPSK250 },
{"No change", 0, 0 },
{ 0 }
};
Fl_Menu_Item quick_change_qpsk[] = {
{"qpsk 31", 0, (Fl_Callback*)cb_mnuQPSK31 },
{"qpsk 63", 0, (Fl_Callback*)cb_mnuQPSK63 },
{"qpsk 125", 0, (Fl_Callback*)cb_mnuQPSK125 },
{"qpsk 250", 0, (Fl_Callback*)cb_mnuQPSK250, 0, FL_MENU_DIVIDER },
{"No change", 0, 0 },
{ 0 }
};
Fl_Menu_Item quick_change_mfsk[] = {
{"mfsk 8", 0, (Fl_Callback*)cb_mnuMFSK8 },
{"mfsk 16", 0, (Fl_Callback*)cb_mnuMFSK16, 0, FL_MENU_DIVIDER },
{"No change", 0, 0 },
{ 0 }
};
Fl_Menu_Item quick_change_domino[] = {
{"dominoex 4", 0, (Fl_Callback*)cb_mnuDOMINOEX4 },
{"dominoex 5", 0, (Fl_Callback*)cb_mnuDOMINOEX5 },
{"dominoex 8", 0, (Fl_Callback*)cb_mnuDOMINOEX8 },
{"dominoex 11", 0, (Fl_Callback*)cb_mnuDOMINOEX11 },
{"dominoex 16", 0, (Fl_Callback*)cb_mnuDOMINOEX16 },
{"dominoex 22", 0, (Fl_Callback*)cb_mnuDOMINOEX22, 0, FL_MENU_DIVIDER },
{"No change", 0, 0 },
{ 0 }
};
Fl_Menu_Item quick_change_feld[] = {
{"Feld-Hell", 0, (Fl_Callback*)cb_mnuFELDHELL, },
{"FSK-Hell", 0, (Fl_Callback*)cb_mnuFSKHELL },
{"FSK-Hell-105", 0, (Fl_Callback*)cb_mnuFSKHELL105, 0, FL_MENU_DIVIDER },
{"No change", 0, 0 },
{ 0 }
};
Fl_Menu_Item quick_change_throb[] = {
{"Throb 1", 0, (Fl_Callback*)cb_mnuTHROB1 },
{"Throb 2", 0, (Fl_Callback*)cb_mnuTHROB2 },
{"Throb 4", 0, (Fl_Callback*)cb_mnuTHROB4 },
{"ThrobX 1", 0, (Fl_Callback*)cb_mnuTHROBX1 },
{"ThrobX 2", 0, (Fl_Callback*)cb_mnuTHROBX2 },
{"ThrobX 4", 0, (Fl_Callback*)cb_mnuTHROBX4, 0, FL_MENU_DIVIDER },
{"No change", 0, 0 },
{ 0 }
};
void status_btn_left_click()
{
int xpos = Fl::event_x();
int ypos = Fl::event_y();
const Fl_Menu_Item * m;
switch (active_modem->get_mode()) {
case MODE_BPSK31:
case MODE_PSK63 :
case MODE_PSK125 :
case MODE_PSK250 :
m = quick_change_psk->popup(xpos, ypos, 0, 0, 0);
if (!m) break;
if (m->callback_ == 0) break;
m->callback_(0,0);
break;
case MODE_QPSK31 :
case MODE_QPSK63 :
case MODE_QPSK125 :
case MODE_QPSK250 :
m = quick_change_qpsk->popup(xpos, ypos, 0, 0, 0);
if (!m) break;
if (m->callback_ == 0) break;
m->callback_(0,0);
break;
case MODE_MFSK16:
case MODE_MFSK8:
m = quick_change_mfsk->popup(xpos, ypos, 0, 0, 0);
if (!m) break;
if (m->callback_ == 0) break;
m->callback_(0,0);
break;
case MODE_DOMINOEX4 :
case MODE_DOMINOEX5 :
case MODE_DOMINOEX8 :
case MODE_DOMINOEX11 :
case MODE_DOMINOEX16 :
case MODE_DOMINOEX22 :
m = quick_change_domino->popup(xpos, ypos, 0, 0, 0);
if (!m) break;
if (m->callback_ == 0) break;
m->callback_(0,0);
break;
case MODE_FELDHELL :
case MODE_FSKHELL :
case MODE_FSKH105 :
m = quick_change_feld->popup(xpos, ypos, 0, 0, 0);
if (!m) break;
if (m->callback_ == 0) break;
m->callback_(0,0);
break;
case MODE_THROB1 :
case MODE_THROB2 :
case MODE_THROB4 :
case MODE_THROBX1 :
case MODE_THROBX2 :
case MODE_THROBX4 :
m = quick_change_throb->popup(xpos, ypos, 0, 0, 0);
if (!m) break;
if (m->callback_ == 0) break;
m->callback_(0,0);
break;
default :
status_btn_right_click();
}
}
void status_cb(Fl_Widget *b, void *)
{
int btn = Fl::event_key();
if (btn == FL_Button+1)
status_btn_left_click();
else if (btn == FL_Button+3)
status_btn_right_click();
if (Fl::event_button() == FL_RIGHT_MOUSE) {
tabsConfigure->value(tabModems);
tabsModems->value(modem_config_tab);
dlgConfig->show();
}
else {
if (!quick_change)
return;
const Fl_Menu_Item *m;
m = quick_change->popup(Fl::event_x(),
Fl::event_y(), 0, 0, 0);
if (m && m->callback_)
m->do_callback(0);
}
}
void cb_cboBand(Fl_Widget *w, void *d)
@ -1185,47 +783,58 @@ Fl_Menu_Item menu_[] = {
{"E&xit", 0, (Fl_Callback*)cb_E, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 4
{0,0,0,0,0,0,0,0,0}, // 5
{"Op &Mode", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 6
{"CW", 0, (Fl_Callback*)cb_mnuCW, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 7
{ mode_info[MODE_CW].name, 0, cb_init_mode, (void *)MODE_CW, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 7
{"DominoEX", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 8
{"dominoex 4", 0, (Fl_Callback*)cb_mnuDOMINOEX4, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 9
{"dominoex 5", 0, (Fl_Callback*)cb_mnuDOMINOEX5, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 10
{"dominoex 8", 0, (Fl_Callback*)cb_mnuDOMINOEX8, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 11
{"dominoex 11", 0, (Fl_Callback*)cb_mnuDOMINOEX11, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 12
{"dominoex 16", 0, (Fl_Callback*)cb_mnuDOMINOEX16, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 13
{"dominoex 22", 0, (Fl_Callback*)cb_mnuDOMINOEX22, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 14
{ mode_info[MODE_DOMINOEX4].name, 0, cb_init_mode, (void *)MODE_DOMINOEX4, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 9
{ mode_info[MODE_DOMINOEX5].name, 0, cb_init_mode, (void *)MODE_DOMINOEX5, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 10
{ mode_info[MODE_DOMINOEX8].name, 0, cb_init_mode, (void *)MODE_DOMINOEX8, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 11
{ mode_info[MODE_DOMINOEX11].name, 0, cb_init_mode, (void *)MODE_DOMINOEX11, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 12
{ mode_info[MODE_DOMINOEX16].name, 0, cb_init_mode, (void *)MODE_DOMINOEX16, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 13
{ mode_info[MODE_DOMINOEX22].name, 0, cb_init_mode, (void *)MODE_DOMINOEX22, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 14
{0,0,0,0,0,0,0,0,0}, // 15
{"Hell", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 16
{"Feld-Hell", 0, (Fl_Callback*)cb_mnuFELDHELL, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 17
{"FSK-Hell", 0, (Fl_Callback*)cb_mnuFSKHELL, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 18
{"FSK-Hell-105", 0, (Fl_Callback*)cb_mnuFSKHELL105, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 19
{ mode_info[MODE_FELDHELL].name, 0, cb_init_mode, (void *)MODE_FELDHELL, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 17
{ mode_info[MODE_FSKHELL].name, 0, cb_init_mode, (void *)MODE_FSKHELL, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 18
{ mode_info[MODE_FSKH105].name, 0, cb_init_mode, (void *)MODE_FSKH105, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 19
{0,0,0,0,0,0,0,0,0}, // 20
{"MFSK", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 21
{"mfsk 8", 0, (Fl_Callback*)cb_mnuMFSK8, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 22
{"mfsk 16", 0, (Fl_Callback*)cb_mnuMFSK16, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 23
{ mode_info[MODE_MFSK8].name, 0, cb_init_mode, (void *)MODE_MFSK8, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 22
{ mode_info[MODE_MFSK16].name, 0, cb_init_mode, (void *)MODE_MFSK16, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 23
{0,0,0,0,0,0,0,0,0}, // 24
{"Psk", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 25
{"psk 31", 0, (Fl_Callback*)cb_mnuPSK31, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 26
{"qpsk 31", 0, (Fl_Callback*)cb_mnuQPSK31, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 27
{"psk 63", 0, (Fl_Callback*)cb_mnuPSK63, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 28
{"qpsk 63", 0, (Fl_Callback*)cb_mnuQPSK63, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 29
{"psk 125", 0, (Fl_Callback*)cb_mnuPSK125, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 30
{"qpsk 125", 0, (Fl_Callback*)cb_mnuQPSK125, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 31
{"psk 250", 0, (Fl_Callback*)cb_mnuPSK250, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 32
{"qpsk 250", 0, (Fl_Callback*)cb_mnuQPSK250, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 33
{"PSK", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 25
{ mode_info[MODE_BPSK31].name, 0, cb_init_mode, (void *)MODE_BPSK31, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 26
{ mode_info[MODE_QPSK31].name, 0, cb_init_mode, (void *)MODE_QPSK31, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 27
{ mode_info[MODE_PSK63].name, 0, cb_init_mode, (void *)MODE_PSK63, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 28
{ mode_info[MODE_QPSK63].name, 0, cb_init_mode, (void *)MODE_QPSK63, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 29
{ mode_info[MODE_PSK125].name, 0, cb_init_mode, (void *)MODE_PSK125, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 30
{ mode_info[MODE_QPSK125].name, 0, cb_init_mode, (void *)MODE_QPSK125, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 31
{ mode_info[MODE_PSK250].name, 0, cb_init_mode, (void *)MODE_PSK250, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 32
{ mode_info[MODE_QPSK250].name, 0, cb_init_mode, (void *)MODE_QPSK250, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 33
{0,0,0,0,0,0,0,0,0}, // 34
{"Olivia", 0, (Fl_Callback*)cb_mnuOlivia, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 35
{"rtty", 0, (Fl_Callback*)cb_mnuRTTY, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 36
{ mode_info[MODE_OLIVIA].name, 0, cb_init_mode, (void *)MODE_OLIVIA, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 35
{ mode_info[MODE_RTTY].name, 0, cb_init_mode, (void *)MODE_RTTY, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 36
{"Throb", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 37
{"Throb 1", 0, (Fl_Callback*)cb_mnuTHROB1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 38
{"Throb 2", 0, (Fl_Callback*)cb_mnuTHROB2, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 39
{"Throb 4", 0, (Fl_Callback*)cb_mnuTHROB4, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 40
{"ThrobX 1", 0, (Fl_Callback*)cb_mnuTHROBX1, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 41
{"ThrobX 2", 0, (Fl_Callback*)cb_mnuTHROBX2, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 42
{"ThrobX 4", 0, (Fl_Callback*)cb_mnuTHROBX4, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 43
{ mode_info[MODE_THROB1].name, 0, cb_init_mode, (void *)MODE_THROB1, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 38
{ mode_info[MODE_THROB2].name, 0, cb_init_mode, (void *)MODE_THROB2, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 39
{ mode_info[MODE_THROB4].name, 0, cb_init_mode, (void *)MODE_THROB4, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 40
{ mode_info[MODE_THROBX1].name, 0, cb_init_mode, (void *)MODE_THROBX1, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 41
{ mode_info[MODE_THROBX2].name, 0, cb_init_mode, (void *)MODE_THROBX2, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 42
{ mode_info[MODE_THROBX4].name, 0, cb_init_mode, (void *)MODE_THROBX4, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 43
{0,0,0,0,0,0,0,0,0}, // 44
{"WWV", 0, (Fl_Callback*)cb_mnuWWV, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 45
{"Freq Analysis", 0, (Fl_Callback*)cb_mnuANALYSIS, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 46
{ mode_info[MODE_WWV].name, 0, cb_init_mode, (void *)MODE_WWV, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 45
{ mode_info[MODE_ANALYSIS].name, 0, cb_init_mode, (void *)MODE_ANALYSIS, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 46
{0,0,0,0,0,0,0,0,0}, // 47
{"Configure", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 48
{"Defaults", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0}, // 49
{"Fonts", 0, (Fl_Callback*)cb_mnuConfigFonts, 0, 0, FL_NORMAL_LABEL, 0, 14, 0}, // 50
@ -1259,6 +868,13 @@ Fl_Menu_Item menu_[] = {
Fl_Menu_Bar *mnu;
Fl_Menu_Item sample_rate_menu[] = {
{ "Auto" }, { "8000" }, { "9600" }, { "11025" }, { "12000" },
{ "16000" }, { "22050" }, { "24000" }, { "32000" }, { "44100" },
{ "48000" }, { "88200" }, { "96000" }, { "192000" },
{ 0 }
};
void activate_rig_menu_item(bool b)
{
if (b) {
@ -1483,6 +1099,7 @@ void create_fl_digi_main() {
MODEstatus->color(FL_BACKGROUND2_COLOR);
MODEstatus->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
MODEstatus->callback(status_cb, (void *)0);
MODEstatus->when(FL_WHEN_CHANGED);
MODEstatus->tooltip("Left clk - change mode\nRight clk - Modem Tab");
Status1 = new Fl_Box(Wmode,Hmenu+Hrcvtxt+Hxmttxt+Hwfall, Ws2n, Hstatus, "");
Status1->box(FL_DOWN_BOX);
@ -1749,7 +1366,7 @@ void clear_StatusMessages()
void put_MODEstatus(trx_mode mode)
{
FL_LOCK_D();
QUEUE(CMP_CB(&Fl_Button::label, MODEstatus, mode_names[mode])); //MODEstatus->label(mode_names[mode]);
QUEUE(CMP_CB(&Fl_Button::label, MODEstatus, mode_info[mode].sname)); //MODEstatus->label(mode_names[mode]);
FL_UNLOCK_D();
FL_AWAKE_D();
}

Wyświetl plik

@ -1,207 +1,207 @@
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// 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".
//
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// 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 <config.h>
#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<long>(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(const 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 = FL_NORMAL_SIZE; // Font Size to be used
fontcolor = FL_BLACK;
lst_Size->value( fontsize );
lst_Font->value((int)fontnbr);
FontNameSelect();
Fl::focus(lst_Font);
xclass(PACKAGE_NAME);
}
#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<long>(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(const 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 = FL_NORMAL_SIZE; // Font Size to be used
fontcolor = FL_BLACK;
lst_Size->value( fontsize );
lst_Font->value((int)fontnbr);
FontNameSelect();
Fl::focus(lst_Font);
xclass(PACKAGE_NAME);
}

Wyświetl plik

@ -62,7 +62,6 @@ void dominoex::rx_init()
counter = 0;
phaseacc = 0.0;
freqerr = 0.0;
clear_StatusMessages();
put_MODEstatus(mode);
put_sec_char(0);
}

Wyświetl plik

@ -26,40 +26,7 @@
#include <config.h>
#include "globals.h"
const char *mode_names[] = {
"MFSK16",
"MFSK-8",
"OLIVIA",
"RTTY",
"THROB1",
"THROB2",
"THROB4",
"THRBX1",
"THRBX2",
"THRBX4",
"BPSK31",
"QPSK31",
"PSK-63",
"QPSK63",
"PSK125",
"QPSK-125",
"PSK-250",
"QPSK-250",
"MT63",
"FELDHELL",
"FSK-HELL",
"FSK-H105",
"CW",
"DomEX4",
"DomEX5",
"DomEX8",
"DomX11",
"DomX16",
"DomX22",
"WWV",
"ANALYSIS"
};
#include "modem.h"
const char *state_names[] = {
"PAUSED",
@ -70,3 +37,51 @@ const char *state_names[] = {
"FLUSHING"
};
// Elements are in enum trx_mode order. Mode name video-id uses the
// first string (sname), so its length should be a multiple of 2.
const struct mode_info_t mode_info[NUM_MODES] = {
{ MODE_MFSK16, &mfsk16_modem, "MFSK16", "MFSK-16", "MFSK8" },
{ MODE_MFSK8, &mfsk8_modem, "MFSK-8", "MFSK-8", "MFSK16" },
{ MODE_OLIVIA, &olivia_modem, "OLIVIA", "Olivia", "" },
{ MODE_RTTY, &rtty_modem, "RTTY", "RTTY", "RTTY" },
{ MODE_THROB1, &throb1_modem, "THROB1", "Throb 1", "" },
{ MODE_THROB2, &throb2_modem, "THROB2", "Throb 2", "" },
{ MODE_THROB4, &throb4_modem, "THROB4", "Throb 4", "" },
{ MODE_THROBX1, &throbx1_modem, "THRBX1", "ThrobX 1", "" },
{ MODE_THROBX2, &throbx2_modem, "THRBX2", "ThrobX 2", "" },
{ MODE_THROBX4, &throbx4_modem, "THRBX4", "ThrobX 4", "" },
{ MODE_BPSK31, &psk31_modem, "BPSK31", "BPSK-31", "PSK31" },
{ MODE_QPSK31, &qpsk31_modem, "QPSK31", "QPSK-31", "QPSK31" },
{ MODE_PSK63, &psk63_modem, "PSK-63", "BPSK-63", "PSK63" },
{ MODE_QPSK63, &qpsk63_modem, "QPSK63", "QPSK-63", "QPSK63" },
{ MODE_PSK125, &psk125_modem, "PSK125", "BPSK-125", "PSK125" },
{ MODE_QPSK125, &qpsk125_modem, "QPSK-125", "QPSK-125", "QPSK125" },
{ MODE_PSK250, &psk250_modem, "PSK-250", "BPSK-250", "PSK250" },
{ MODE_QPSK250, &qpsk250_modem, "QPSK-250", "QPSK-250", "QPSK250" },
{ MODE_MT63, 0, "MT63", "MT-63", "" },
{ MODE_FELDHELL, &feld_modem, "FELDHELL", "Feld Hell", "" },
{ MODE_FSKHELL, &feld_FMmodem, "FSK-HELL", "FSK Hell", "" },
{ MODE_FSKH105, &feld_FM105modem, "FSK-H105", "FSK Hell-105", "" },
{ MODE_CW, &cw_modem, "CW", "CW", "CW" },
{ MODE_DOMINOEX4, &dominoex4_modem, "DomEX4", "DominoEX 4", "DOMINOEX4" },
{ MODE_DOMINOEX5, &dominoex5_modem, "DomEX5", "DominoEX 5", "DOMINOEX5" },
{ MODE_DOMINOEX8, &dominoex8_modem, "DomEX8", "DominoEX 8", "DOMINOEX8" },
{ MODE_DOMINOEX11, &dominoex11_modem, "DomX11", "DominoEX 11", "DOMINOEX11" },
{ MODE_DOMINOEX16, &dominoex16_modem, "DomX16", "DominoEX 16", "DOMINOEX16" },
{ MODE_DOMINOEX22, &dominoex22_modem, "DomX22", "DominoEX 22", "DOMINOEX22" },
{ MODE_WWV, &wwv_modem, "WWV", "WWV", "" },
{ MODE_ANALYSIS, &anal_modem, "ANALYSIS", "Freq Analysis", "" }
};

Wyświetl plik

@ -87,6 +87,8 @@ extern Fl_Round_Button *btnAudioIO[2];
#include <FL/Fl_Input_Choice.H>
extern Fl_Input_Choice *menuOSSDev;
extern Fl_Input_Choice *menuPADev;
extern Fl_Menu_Item sample_rate_menu[];
extern Fl_Choice *menuSampleRate;
extern Fl_Group *tabMixer;
#include <FL/Fl_Light_Button.H>
extern void setMixerInput(int);

Wyświetl plik

@ -1,16 +1,16 @@
#ifndef DIGI_TYPES_H
#define DIGI_TYPES_H
typedef char CHAR; // 8 bits -127 to 127
typedef unsigned char UCHAR; // 8 bits 0 to 255
typedef int INT; // 16 or 32 bits
typedef unsigned int UINT; // 16 or 32 bits
typedef short int INT16; // 16 bits, -32767 to 32767
typedef unsigned short int UINT16; // 16 bits, 0 to 65535
typedef long int INT32; // 32 bits -2,147,483,647 to 2,147,483,647
typedef unsigned long int UINT32; // 32 bits 0 to 4,294,967,295
typedef float FLOAT; // 32 bits, 6 digits of precision
typedef double DOUBLE; // 64 bits, 10 digits of precision
typedef long double LDOUBLE;// 80 bits, 10 digits of precision
#ifndef DIGI_TYPES_H
#define DIGI_TYPES_H
typedef char CHAR; // 8 bits -127 to 127
typedef unsigned char UCHAR; // 8 bits 0 to 255
typedef int INT; // 16 or 32 bits
typedef unsigned int UINT; // 16 or 32 bits
typedef short int INT16; // 16 bits, -32767 to 32767
typedef unsigned short int UINT16; // 16 bits, 0 to 65535
typedef long int INT32; // 32 bits -2,147,483,647 to 2,147,483,647
typedef unsigned long int UINT32; // 32 bits 0 to 4,294,967,295
typedef float FLOAT; // 32 bits, 6 digits of precision
typedef double DOUBLE; // 64 bits, 10 digits of precision
typedef long double LDOUBLE;// 80 bits, 10 digits of precision
#endif

Wyświetl plik

@ -44,7 +44,7 @@
#include <FL/Fl_Widget.H>
#include <FL/Fl_Repeat_Button.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Box.H>
#include <FL/Enumerations.H>
#ifdef MAX_DIGITS
@ -71,21 +71,21 @@ public:
void SetONOFFCOLOR( Fl_Color, Fl_Color);
void setCallBack (int (*cbf)() ){ cbFunc = cbf;};
private:
Fl_Button *Digit[MAX_DIGITS];
Fl_Button *Digit[MAX_DIGITS];
static const char *Label[];
int mult[MAX_DIGITS];
Fl_Box *decbx;
Fl_Color OFFCOLOR;
Fl_Color ONCOLOR;
Fl_Color SELCOLOR;
Fl_Color SELCOLOR;
Fl_Color ILLUMCOLOR;
int nD;
int nD;
int active;
long maxVal;
long minVal;
void DecFreq(int n);
void IncFreq(int n);
int (*cbFunc)();
void IncFreq(int n);
int (*cbFunc)();
protected:
long val;
};

Wyświetl plik

@ -26,7 +26,7 @@
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

Wyświetl plik

@ -130,6 +130,7 @@ struct configuration {
string SCdevice;
string OSSdevice;
string PAdevice;
int sample_rate;
int RX_corr;
int TX_corr;
int TxOffset;

Wyświetl plik

@ -16,16 +16,16 @@
// fft algorithims in the public domain. Thank you Takuya Ooura!
//===========================================================================
#ifndef FFT_H
#define FFT_H
#ifndef FFT_H
#define FFT_H
#include <math.h>
#include <stdio.h>
#include "complex.h"
#include "misc.h"
enum fftPrefilter {FFT_NONE, FFT_HAMMING, FFT_HANNING, FFT_BLACKMAN, FFT_TRIANGULAR};
enum fftPrefilter {FFT_NONE, FFT_HAMMING, FFT_HANNING, FFT_BLACKMAN, FFT_TRIANGULAR};
class Cfft {
private:
double xi;

Wyświetl plik

@ -138,36 +138,7 @@ extern void setSqlOnOff(bool b);
extern bool QueryAfcOnOff();
extern bool QuerySqlOnOff();
extern void initCW();
extern void initMFSK8();
extern void initMFSK16();
extern void initPSK31();
extern void initPSK63();
extern void initPSK125();
extern void initPSK250();
extern void initQPSK31();
extern void initQPSK63();
extern void initQPSK125();
extern void initQPSK250();
extern void initRTTY();
extern void initOLIVIA();
extern void initDOMINOEX4();
extern void initDOMINOEX5();
extern void initDOMINOEX8();
extern void initDOMINOEX11();
extern void initDOMINOEX16();
extern void initDOMINOEX22();
extern void initFELDHELL();
extern void initFSKHELL();
extern void initFSKHELL105();
extern void initTHROB1();
extern void initTHROB2();
extern void initTHROB4();
extern void initTHROBX1();
extern void initTHROBX2();
extern void initTHROBX4();
extern void initWWV();
extern void initANALYSIS();
extern void init_modem(trx_mode mode);
extern void init_modem_sync(trx_mode mode);
#endif

Wyświetl plik

@ -63,6 +63,7 @@ extern int WNOM;
#define bwRate 45
#define bwXmtLock 45
#define bwRev 45
#define bwMem 45
#define bwXmtRcv 45
#define wSpace 2

Wyświetl plik

@ -1,144 +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, const char* l) : Fl_Widget(x, y, w, h, l)
{
fontName = 1;
fontSize = FL_NORMAL_SIZE;
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(const 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<long>(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
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// 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, const char* l) : Fl_Widget(x, y, w, h, l)
{
fontName = 1;
fontSize = FL_NORMAL_SIZE;
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(const 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<long>(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

Wyświetl plik

@ -26,10 +26,23 @@
#ifndef _GLOBALS_H
#define _GLOBALS_H
extern const char *mode_names[];
enum state_t {
STATE_PAUSE = 0,
STATE_RX,
STATE_TX,
STATE_RESTART,
STATE_TUNE,
STATE_ABORT,
STATE_FLUSH,
STATE_NOOP,
STATE_EXIT,
STATE_ENDED,
STATE_IDLE,
STATE_NEW_MODEM
};
extern const char *state_names[];
enum trx_mode {
enum {
MODE_MFSK16 = 0,
MODE_MFSK8,
MODE_OLIVIA,
@ -53,30 +66,27 @@ enum trx_mode {
MODE_FSKHELL,
MODE_FSKH105,
MODE_CW,
MODE_DOMINOEX4,
MODE_DOMINOEX4,
MODE_DOMINOEX5,
MODE_DOMINOEX8,
MODE_DOMINOEX11,
MODE_DOMINOEX16,
MODE_DOMINOEX22,
MODE_DOMINOEX8,
MODE_DOMINOEX11,
MODE_DOMINOEX16,
MODE_DOMINOEX22,
MODE_WWV,
MODE_ANALYSIS
MODE_ANALYSIS,
NUM_MODES
};
typedef int trx_mode;
struct mode_info_t {
trx_mode mode;
class modem **modem;
const char *sname;
const char *name;
const char *pskmail_name;
};
enum state_t {
STATE_PAUSE = 0,
STATE_RX,
STATE_TX,
STATE_RESTART,
STATE_TUNE,
STATE_ABORT,
STATE_FLUSH,
STATE_NOOP,
STATE_EXIT,
STATE_ENDED,
STATE_IDLE,
STATE_NEW_MODEM
};
extern const struct mode_info_t mode_info[NUM_MODES];
#endif

Wyświetl plik

@ -3,7 +3,7 @@
#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

Wyświetl plik

@ -1,26 +1,26 @@
//
// logger.h Remote Log Interface for fldigi
//
// Copyright W1HKJ, Dave Freese 2006
//
// This library is free software; you can RGBredistribute 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".
//
// logger.h Remote Log Interface for fldigi
//
// Copyright W1HKJ, Dave Freese 2006
//
// This library is free software; you can RGBredistribute 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".
//
#ifndef _LOGGER_H
#define _LOGGER_H

Wyświetl plik

@ -21,11 +21,6 @@
#include "rigclass.h"
#endif
extern Fl_Mutex trx_mutex;
extern Fl_Cond trx_cond;
extern Fl_Thread trx_thread;
extern state_t trx_state;
extern modem *active_modem;
extern string HomeDir;
extern string xmlfname;

Wyświetl plik

@ -82,15 +82,15 @@ inline double hanning(double x)
return 0.5 - 0.5 * cos(2 * M_PI * x);
}
// Rectangular - no pre filtering of data array
// Rectangular - no pre filtering of data array
void RectWindow(double *array, int n);
// Hamming - used by gmfsk
// Hamming - used by gmfsk
void HammingWindow(double *array, int n);
// Hanning - used by winpsk
// Hanning - used by winpsk
void HanningWindow(double *array, int n);
// Best lob suppression - least in band ripple
void BlackmanWindow(double *array, int n);
// Simple about effective as Hamming or Hanning
// Simple about effective as Hamming or Hanning
void TriangularWindow(double *array, int n);
#endif

Wyświetl plik

@ -94,7 +94,7 @@ public:
// void set_mode(trx_mode);
trx_mode get_mode();
const char *get_mode_name() { return mode_names[get_mode()];}
const char *get_mode_name() { return mode_info[get_mode()].sname;}
void set_state(state_t);
void set_state_wait(state_t);
state_t get_state();

Wyświetl plik

@ -29,7 +29,7 @@
#include <stdio.h>
#include <string.h>
#include <FL/Fl.H>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>

Wyświetl plik

@ -185,6 +185,7 @@ public:
#endif
static void execute(int fd, void *arg);
void flush(void);
size_t nprio(void) { return fifo->queues(); }
void drop(size_t pri) { fifo->drop(pri); }
@ -235,6 +236,9 @@ extern qrunner *cbq[NUM_QRUNNER_THREADS];
do { \
if (GET_THREAD_ID() != FLMAIN_TID) \
cbq[GET_THREAD_ID()]->request_sync(nop()); \
else \
for (int i = 0; i < NUM_QRUNNER_THREADS; i++) \
cbq[i]->flush(); \
} while (0)

Wyświetl plik

@ -1,240 +1,240 @@
#ifndef QRZHEADER
#ifndef QRZHEADER
// To include the email code remove the comment specifier from the following line
#define HAVE_EMAIL
// QRZ CDROM data structures
/*
** Index Header Block Definition (Version 2)
** (applies to all QRZ CDROMS from Version 2 onward)
**
** This block is located at the start of each index
*/
typedef struct {
char dataname[16]; /* Name of the data file */
char bytesperkey[8]; /* Data Bytes per Index Item */
char numkeys[8]; /* Number of items in this index */
char keylen[8]; /* Length of each key item in bytes */
char version[8]; /* Database Version ID */
} index_header;
/*
Index Usage
The name index is set to a maximum of 16 characters with longer names
being truncated. Names are stored in last-first format with a space
between the names. The city/state index uses 12 characters per entry,
the callsign index 6 characters and the zip code index 5 characters.
The data which follows the header is simply a long list of single field
records. The records are tightly packed on 'bytesperkey' boundaries
without separators. There is no guarantee of a null terminator on any
index record entry.
When the program qrz.exe is run it first searches for a drive
containing the base directory \CALLBK . Next, it loads all four index
files (callbkc.idx, callbkn.idx, callbks.idx and callbkz.idx) into
tables in memory. These tables were kept small so as not to place an
undue RAM requirement on the user's system.
Next, when a user specifies a field and key to search, the program
searches the relevant index table and returns the closest match lower
(or equal to) the supplied key. The table position of this key is then
taken and multiplied by the 'bytesperkey' value to arrive at a database
file offset. This offset is then used to perform the first and only
seek into the database. Once on position within the file, a sequential
search is performed to return the match. The search terminates at the
next index key value if the field is not found.
The database files all have the same format. The records each consist
of comma separated fields which end with a single newline '\n' (ASCII
0xa) character. Blank fields are simply stored as a comma. Every
record has the same number of commas in it. Actual comma's in the data
field are stored as a semi-colon ';' which should be replaced by a
comma in the user's output formatting routine.
Example:
AA7BQ ,LLOYD,,FRED L,,53340,90009,00009,8215 E WOOD DR,SCOTTSDALE,AZ,
85260,E,KJ6RK,A
The callsign database is sorted by SUFFIX, AREA, PREFIX.
For example, the following order would be observed:
QE24AA
...
ZZ99ZZ
...
A 0A
...
AA0AAA
...
ZZ9ZZZ
This ordering also pertains to the index file since it is just a snaphot of
every nth record in the database.
*/
/*
** Standard Record Field Offsets
*/
#define QRZLIB_CALL 0
#define QRZLIB_LNAME 1
#define QRZLIB_JR 2
#define QRZLIB_FNAME 3
#define QRZLIB_MI 4
#define QRZLIB_DOB 5
#define QRZLIB_EFDATE 6
#define QRZLIB_EXPDATE 7
#define QRZLIB_MAIL_STR 8
#define QRZLIB_MAIL_CITY 9
#define QRZLIB_MAIL_ST 10
#define QRZLIB_MAIL_ZIP 11
#define QRZLIB_CLASS 12
#define QRZLIB_P_CALL 13
#define QRZLIB_P_CLASS 14
/*
The fields JR and MI were obsoleted by the FCC in July 1994.
The callsign fields are arranged in a strict "ccdccc" columnar format
where 'c' represents a letter and 'd' a digit. Callsigns which do not
conform to the "ccdccc" format are space filled in the relevant
positions. This field is rearranged to the proper layout by the user
program's output formatting routines.
All dates are stored in 5 character Julian format, e.g. 93003 equals
January 3, 1993. Dates before 1900 or after year 2000 must be
determined by their context usage. In other words, if the resultant
age does not make sense, then it's wrong. For example, all licenses
expire in the future so 02 is 2002. Birthdays are more difficult
but most can be determined to be greater than 10 years old. This is
not a perfect method, but it does yield satisfactory results.
Some folks may notice that the database no longer contains station
location information. This information is no longer supplied nor
available from the FCC since it is no longer a part of their record
keeping (See the May 1993 QST for more info).
Cross Reference Information
Callsigns in the database are now cross-referenced to both the current
and the previous call sign for each entry in which they are available.
A cross reference record takes the form of 'old,new' with no other
information in the record. A record can be identified as a cross
reference either one of two ways:
First, if the record length is less than 15 characters, then
it is a cross reference record.
Secondly, if the record contains only one comma "," , then
it is a cross reference record.
It is not necessary to test for both cases, either will do.
When a cross reference record is encountered, you must fetch the second
field and restart the search to return the primary reference.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
extern char *Composite( char * );
class QRZ
{
private:
char criteria;
index_header idxhdr;
char *data;
char *index;
char *top;
FILE *idxfile;
long idxsize;
FILE *datafile;
long dataoffset;
long databytesread;
char *dfptr;
char *endofline;
char *idxptr;
int found;
char recbuffer[512];
unsigned int datarecsize;
long numkeys;
int keylen;
void OpenQRZFiles( const char * );
int FindCallsign( char * );
int FindName( char * );
int FindState( char * );
int FindZip( char * );
int ReadDataBlock( long );
// QRZ CDROM data structures
/*
** Index Header Block Definition (Version 2)
** (applies to all QRZ CDROMS from Version 2 onward)
**
** This block is located at the start of each index
*/
typedef struct {
char dataname[16]; /* Name of the data file */
char bytesperkey[8]; /* Data Bytes per Index Item */
char numkeys[8]; /* Number of items in this index */
char keylen[8]; /* Length of each key item in bytes */
char version[8]; /* Database Version ID */
} index_header;
/*
Index Usage
The name index is set to a maximum of 16 characters with longer names
being truncated. Names are stored in last-first format with a space
between the names. The city/state index uses 12 characters per entry,
the callsign index 6 characters and the zip code index 5 characters.
The data which follows the header is simply a long list of single field
records. The records are tightly packed on 'bytesperkey' boundaries
without separators. There is no guarantee of a null terminator on any
index record entry.
When the program qrz.exe is run it first searches for a drive
containing the base directory \CALLBK . Next, it loads all four index
files (callbkc.idx, callbkn.idx, callbks.idx and callbkz.idx) into
tables in memory. These tables were kept small so as not to place an
undue RAM requirement on the user's system.
Next, when a user specifies a field and key to search, the program
searches the relevant index table and returns the closest match lower
(or equal to) the supplied key. The table position of this key is then
taken and multiplied by the 'bytesperkey' value to arrive at a database
file offset. This offset is then used to perform the first and only
seek into the database. Once on position within the file, a sequential
search is performed to return the match. The search terminates at the
next index key value if the field is not found.
The database files all have the same format. The records each consist
of comma separated fields which end with a single newline '\n' (ASCII
0xa) character. Blank fields are simply stored as a comma. Every
record has the same number of commas in it. Actual comma's in the data
field are stored as a semi-colon ';' which should be replaced by a
comma in the user's output formatting routine.
Example:
AA7BQ ,LLOYD,,FRED L,,53340,90009,00009,8215 E WOOD DR,SCOTTSDALE,AZ,
85260,E,KJ6RK,A
The callsign database is sorted by SUFFIX, AREA, PREFIX.
For example, the following order would be observed:
QE24AA
...
ZZ99ZZ
...
A 0A
...
AA0AAA
...
ZZ9ZZZ
This ordering also pertains to the index file since it is just a snaphot of
every nth record in the database.
*/
/*
** Standard Record Field Offsets
*/
#define QRZLIB_CALL 0
#define QRZLIB_LNAME 1
#define QRZLIB_JR 2
#define QRZLIB_FNAME 3
#define QRZLIB_MI 4
#define QRZLIB_DOB 5
#define QRZLIB_EFDATE 6
#define QRZLIB_EXPDATE 7
#define QRZLIB_MAIL_STR 8
#define QRZLIB_MAIL_CITY 9
#define QRZLIB_MAIL_ST 10
#define QRZLIB_MAIL_ZIP 11
#define QRZLIB_CLASS 12
#define QRZLIB_P_CALL 13
#define QRZLIB_P_CLASS 14
/*
The fields JR and MI were obsoleted by the FCC in July 1994.
The callsign fields are arranged in a strict "ccdccc" columnar format
where 'c' represents a letter and 'd' a digit. Callsigns which do not
conform to the "ccdccc" format are space filled in the relevant
positions. This field is rearranged to the proper layout by the user
program's output formatting routines.
All dates are stored in 5 character Julian format, e.g. 93003 equals
January 3, 1993. Dates before 1900 or after year 2000 must be
determined by their context usage. In other words, if the resultant
age does not make sense, then it's wrong. For example, all licenses
expire in the future so 02 is 2002. Birthdays are more difficult
but most can be determined to be greater than 10 years old. This is
not a perfect method, but it does yield satisfactory results.
Some folks may notice that the database no longer contains station
location information. This information is no longer supplied nor
available from the FCC since it is no longer a part of their record
keeping (See the May 1993 QST for more info).
Cross Reference Information
Callsigns in the database are now cross-referenced to both the current
and the previous call sign for each entry in which they are available.
A cross reference record takes the form of 'old,new' with no other
information in the record. A record can be identified as a cross
reference either one of two ways:
First, if the record length is less than 15 characters, then
it is a cross reference record.
Secondly, if the record contains only one comma "," , then
it is a cross reference record.
It is not necessary to test for both cases, either will do.
When a cross reference record is encountered, you must fetch the second
field and restart the search to return the primary reference.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
extern char *Composite( char * );
class QRZ
{
private:
char criteria;
index_header idxhdr;
char *data;
char *index;
char *top;
FILE *idxfile;
long idxsize;
FILE *datafile;
long dataoffset;
long databytesread;
char *dfptr;
char *endofline;
char *idxptr;
int found;
char recbuffer[512];
unsigned int datarecsize;
long numkeys;
int keylen;
void OpenQRZFiles( const char * );
int FindCallsign( char * );
int FindName( char * );
int FindState( char * );
int FindZip( char * );
int ReadDataBlock( long );
int nextrec();
bool hasImage;
const char *Qcall;
const char *Qlname;
const char *Qfname;
const char *Qdob;
const char *Qefdate;
const char *Qexpdate;
const char *Qmail_str;
const char *Qmail_city;
const char *Qmail_st;
const char *Qmail_zip;
const char *Qopclass;
const char *Qp_call;
const char *Qimagefname;
const char *Qp_class;
bool hasImage;
const char *Qcall;
const char *Qlname;
const char *Qfname;
const char *Qdob;
const char *Qefdate;
const char *Qexpdate;
const char *Qmail_str;
const char *Qmail_city;
const char *Qmail_st;
const char *Qmail_zip;
const char *Qopclass;
const char *Qp_call;
const char *Qimagefname;
const char *Qp_class;
int QRZvalid;
public:
QRZ( const char * );
QRZ( const char *, char );
~QRZ();
int CallComp( char *, char * );
int CompState( const char *, const char *, const char * );
int getQRZvalid();
int FindRecord( char * );
int NextRecord();
int ReadRec();
int GetCount( char * );
char *GetCall();
const char *GetLname();
const char *GetFname();
const char *GetDOB();
const char *GetEFdate();
const char *GetEXPdate();
const char *GetStreet();
const char *GetCity();
const char *GetState();
const char *GetZIP();
const char *GetOPclass();
const char *GetPriorCall();
const char *GetPriorClass();
const char *GetImageFileName();
char *CSV_Record();
char *Fmt_Record();
public:
QRZ( const char * );
QRZ( const char *, char );
~QRZ();
int CallComp( char *, char * );
int CompState( const char *, const char *, const char * );
int getQRZvalid();
int FindRecord( char * );
int NextRecord();
int ReadRec();
int GetCount( char * );
char *GetCall();
const char *GetLname();
const char *GetFname();
const char *GetDOB();
const char *GetEFdate();
const char *GetEXPdate();
const char *GetStreet();
const char *GetCity();
const char *GetState();
const char *GetZIP();
const char *GetOPclass();
const char *GetPriorCall();
const char *GetPriorClass();
const char *GetImageFileName();
char *CSV_Record();
char *Fmt_Record();
bool ImageExists();
const char *ImageFileName() {return Qimagefname;};
};
const char *ImageFileName() {return Qimagefname;};
};
extern void SetQRZdirectory(char *dir);
extern int filename_expand(char *to,int tolen, const char *from);
#define QRZHEADER
#endif
#define QRZHEADER
#endif

Wyświetl plik

@ -24,7 +24,7 @@
#ifndef _RASTER_H
#define _RASTER_H
#include <FL/Fl.H>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Widget.H>
#include <FL/fl_draw.H>

Wyświetl plik

@ -1,9 +1,9 @@
// SerialComm.h: interface for the Cserial class.
//
//////////////////////////////////////////////////////////////////////
#ifndef SERIALCOMMH
#define SERIALCOMMH
// SerialComm.h: interface for the Cserial class.
//
//////////////////////////////////////////////////////////////////////
#ifndef SERIALCOMMH
#define SERIALCOMMH
#include <sys/types.h>
#include <sys/stat.h>
@ -19,17 +19,17 @@
using namespace std;
#define bzero(b,len) memset(b,0,(size_t)(len))
class Cserial {
public:
Cserial();
~Cserial();
//Methods
class Cserial {
public:
Cserial();
~Cserial();
//Methods
bool OpenPort();
bool IsOpen() { return fd < 0 ? 0 : 1; };
void ClosePort();
void ClosePort();
void Device (string dev) { device = dev;};
string Device() { return device;};
@ -63,9 +63,9 @@ public:
int WriteBuffer(unsigned char *str, int nbr);
void FlushBuffer();
private:
//Members
private:
//Members
string device;
int fd;
int baud;
@ -82,6 +82,6 @@ private:
char bfr[2048];
//Methods
bool IOselect();
};
#endif
};
#endif

Wyświetl plik

@ -69,11 +69,12 @@ class SndException : public std::exception
public:
SndException() { *szError = 0; error = 0; }
SndException(int e) {
snprintf(szError, sizeof(szError) - 1, "Error: %d, %s", e, strerror(e));
snprintf(szError, sizeof(szError), "Error: %d, %s", e, strerror(e));
error = e;
}
SndException(const char *s) {
snprintf(szError, sizeof(szError) - 1, "Error: %s", s);
strncpy(szError, s, sizeof(szError));
szError[sizeof(szError) - 1] = '\0';
error = 1;
}
const char *what(void) const throw() { return szError; }
@ -195,7 +196,7 @@ private:
void resample(int mode, float *buf, int count, int max = 0);
void init_stream(void);
void adjust_stream(void);
double get_best_srate(void);
double find_srate(void);
static unsigned ceil2(unsigned n);
static unsigned floor2(unsigned n);
@ -215,7 +216,6 @@ private:
double req_sample_rate;
double dev_sample_rate;
float *fbuf;
static double std_sample_rates[];
};
#endif // USE_PORTAUDIO

Wyświetl plik

@ -9,8 +9,6 @@
#include "main.h"
#include "globals.h"
using namespace std;
struct status {
int lastmode;
int mainX;

Wyświetl plik

@ -1,99 +1,100 @@
//
// "$Id: threads.h 4748 2006-01-15 02:26:54Z mike $"
//
// Simple threading API for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2006 by Bill Spitzak and others.
//
// 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 on the following page:
//
// http://www.fltk.org/str.php
//
// Inline classes to provide portable support for threads and mutexes.
//
// FLTK does not use this (it has an internal mutex implementation
// that is used if Fl::lock() is called). This header file's only
// purpose is so we can write portable demo programs. It may be useful
// or an inspiration to people who want to try writing multithreaded
// programs themselves.
//
// FLTK has no multithreaded support unless the main thread calls Fl::lock().
// This main thread is the only thread allowed to call Fl::run() or Fl::wait().
// From then on FLTK will be locked except when the main thread is actually
// waiting for events from the user. Other threads must call Fl::lock() and
// Fl::unlock() to surround calls to FLTK (such as to change widgets or
// redraw them).
#ifndef Threads_H
# define Threads_H
#ifndef WIN32
// Use POSIX threading...
# include <pthread.h>
typedef pthread_t Fl_Thread;
typedef pthread_mutex_t Fl_Mutex;
typedef pthread_cond_t Fl_Cond;
extern int fl_create_thread(Fl_Thread & t, void *(*f)(void *), void* p);
extern int fl_mutex_init(Fl_Mutex * m);
extern int fl_cond_init(Fl_Cond * c);
extern int fl_cond_wait(Fl_Cond *c, Fl_Mutex *m);
extern int fl_cond_signal(Fl_Cond *c);
extern int fl_lock(Fl_Mutex *m);
extern int fl_unlock(Fl_Mutex *m);
extern int fl_join(Fl_Thread t);
#else
# include <windows.h>
# include <process.h>
typedef unsigned long Fl_Thread;
extern int fl_create_thread(Fl_Thread * t, void *(*f) (void *), void* p);
# endif // !WIN32
// we have 4 threads, only 3 of which will use qrunner
enum { UNKNOWN_TID = -1, TRX_TID, QRZ_TID, RIGCTL_TID, FLMAIN_TID,
NUM_THREADS, NUM_QRUNNER_THREADS = NUM_THREADS - 1 };
#if USE_TLS
extern __thread int thread_id_;
# define CREATE_THREAD_ID() thread_id_ = UNKNOWN_TID
# define SET_THREAD_ID(x) thread_id_ = (x)
# define GET_THREAD_ID() thread_id_
#else
# ifdef WIN32 // assume no pthreads support
# error need TLS support
# endif
extern pthread_key_t thread_id_;
# define CREATE_THREAD_ID() pthread_key_create(&thread_id_, 0);
# define SET_THREAD_ID(x) pthread_setspecific(thread_id_, (void *)(x))
# define GET_THREAD_ID() (int)pthread_getspecific(thread_id_)
#endif // USE_TLS
#include "fl_lock.h"
#endif // !Threads_h
//
// End of "$Id: threads.h 4748 2006-01-15 02:26:54Z mike $".
//
//
// "$Id: threads.h 4748 2006-01-15 02:26:54Z mike $"
//
// Simple threading API for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2006 by Bill Spitzak and others.
//
// 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 on the following page:
//
// http://www.fltk.org/str.php
//
// Inline classes to provide portable support for threads and mutexes.
//
// FLTK does not use this (it has an internal mutex implementation
// that is used if Fl::lock() is called). This header file's only
// purpose is so we can write portable demo programs. It may be useful
// or an inspiration to people who want to try writing multithreaded
// programs themselves.
//
// FLTK has no multithreaded support unless the main thread calls Fl::lock().
// This main thread is the only thread allowed to call Fl::run() or Fl::wait().
// From then on FLTK will be locked except when the main thread is actually
// waiting for events from the user. Other threads must call Fl::lock() and
// Fl::unlock() to surround calls to FLTK (such as to change widgets or
// redraw them).
#ifndef Threads_H
# define Threads_H
#ifndef WIN32
// Use POSIX threading...
# include <pthread.h>
typedef pthread_t Fl_Thread;
typedef pthread_mutex_t Fl_Mutex;
typedef pthread_cond_t Fl_Cond;
extern int fl_create_thread(Fl_Thread & t, void *(*f)(void *), void* p);
extern int fl_mutex_init(Fl_Mutex * m);
extern int fl_cond_init(Fl_Cond * c);
extern int fl_cond_wait(Fl_Cond *c, Fl_Mutex *m);
extern int fl_cond_signal(Fl_Cond *c);
extern int fl_cond_bcast(Fl_Cond *c);
extern int fl_lock(Fl_Mutex *m);
extern int fl_unlock(Fl_Mutex *m);
extern int fl_join(Fl_Thread t);
#else
# include <windows.h>
# include <process.h>
typedef unsigned long Fl_Thread;
extern int fl_create_thread(Fl_Thread * t, void *(*f) (void *), void* p);
# endif // !WIN32
// we have 4 threads, only 3 of which will use qrunner
enum { UNKNOWN_TID = -1, TRX_TID, QRZ_TID, RIGCTL_TID, FLMAIN_TID,
NUM_THREADS, NUM_QRUNNER_THREADS = NUM_THREADS - 1 };
#if USE_TLS
extern __thread int thread_id_;
# define CREATE_THREAD_ID() thread_id_ = UNKNOWN_TID
# define SET_THREAD_ID(x) thread_id_ = (x)
# define GET_THREAD_ID() thread_id_
#else
# ifdef WIN32 // assume no pthreads support
# error need TLS support
# endif
extern pthread_key_t thread_id_;
# define CREATE_THREAD_ID() pthread_key_create(&thread_id_, 0);
# define SET_THREAD_ID(x) pthread_setspecific(thread_id_, (void *)(x))
# define GET_THREAD_ID() (int)pthread_getspecific(thread_id_)
#endif // USE_TLS
#include "fl_lock.h"
#endif // !Threads_h
//
// End of "$Id: threads.h 4748 2006-01-15 02:26:54Z mike $".
//

Wyświetl plik

@ -42,6 +42,15 @@ extern void trx_close();
extern void trx_reset(const char *scdev);
extern void trx_start_macro_timer();
extern void wait_modem_ready_prep(void);
extern void wait_modem_ready_cmpl(void);
extern void signal_modem_ready(void);
extern Fl_Mutex trx_mutex;
extern Fl_Thread trx_thread;
extern state_t trx_state;
extern modem *active_modem;
extern cSound *scard;
#endif

Wyświetl plik

@ -29,12 +29,14 @@
#include "complex.h"
#include "fft.h"
#include "sound.h"
#include "globals.h"
#include <FL/Fl.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Repeat_Button.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
@ -97,6 +99,12 @@ enum WFmode {
enum WFspeed {FAST = 1, NORMAL = 2, SLOW = 8};
//enum WFspeed {NORMAL = 2, SLOW = 8};
struct qrg_mode_t {
long long rfcarrier;
int carrier;
trx_mode mode;
};
class WFdisp : public Fl_Widget {
public:
@ -255,6 +263,7 @@ private:
double *pwr;
Cfft *wfft;
int checkMag();
void checkWidth();
void initMarkers();
@ -292,6 +301,7 @@ class waterfall: public Fl_Group {
friend void ampspan_cb(Fl_Widget *w, void *v);
friend void qsy_cb(Fl_Widget *w, void *v);
friend void rate_cb(Fl_Widget *w, void *v);
friend void btnMem_cb(Fl_Widget *w, void *v);
public:
waterfall(int x, int y, int w, int h, char *lbl= 0);
~waterfall(){};
@ -372,6 +382,8 @@ private:
Fl_Button *wfrate;
Fl_Light_Button *xmtrcv;
Fl_Light_Button *xmtlock;
Fl_Button *btnMem;
Fl_Menu_Button *mbtnMem;
int buttonrow;
bool reverse;
};

Wyświetl plik

@ -1,139 +1,139 @@
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
#ifndef __FAST_A_TO_F_H_INCLUDED__
#define __FAST_A_TO_F_H_INCLUDED__
#include <stdlib.h>
#include <math.h>
namespace irr
{
namespace core
{
const float fast_atof_table[] = {
0.f,
0.1f,
0.01f,
0.001f,
0.0001f,
0.00001f,
0.000001f,
0.0000001f,
0.00000001f,
0.000000001f,
0.0000000001f,
0.00000000001f,
0.000000000001f,
0.0000000000001f,
0.00000000000001f,
0.000000000000001f
};
//! Provides a fast function for converting a string into a float,
//! about 6 times faster than atof in win32.
// If you find any bugs, please send them to me, niko (at) irrlicht3d.org.
inline char* fast_atof_move(char* c, float& out)
{
bool inv = false;
char *t;
float f;
if (*c=='-')
{
c++;
inv = true;
}
f = (float)strtol(c, &t, 10);
c = t;
if (*c == '.')
{
c++;
float pl = (float)strtol(c, &t, 10);
pl *= fast_atof_table[t-c];
f += pl;
c = t;
if (*c == 'e')
{
++c;
float exp = (float)strtol(c, &t, 10);
f *= (float)pow(10.0f, exp);
c = t;
}
}
if (inv)
f *= -1.0f;
out = f;
return c;
}
//! Provides a fast function for converting a string into a float,
//! about 6 times faster than atof in win32.
// If you find any bugs, please send them to me, niko (at) irrlicht3d.org.
inline const char* fast_atof_move_const(const char* c, float& out)
{
bool inv = false;
char *t;
float f;
if (*c=='-')
{
c++;
inv = true;
}
f = (float)strtol(c, &t, 10);
c = t;
if (*c == '.')
{
c++;
float pl = (float)strtol(c, &t, 10);
pl *= fast_atof_table[t-c];
f += pl;
c = t;
if (*c == 'e')
{
++c;
f32 exp = (f32)strtol(c, &t, 10);
f *= (f32)powf(10.0f, exp);
c = t;
}
}
if (inv)
f *= -1.0f;
out = f;
return c;
}
inline float fast_atof(const char* c)
{
float ret;
fast_atof_move_const(c, ret);
return ret;
}
} // end namespace core
}// end namespace irr
#endif
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
#ifndef __FAST_A_TO_F_H_INCLUDED__
#define __FAST_A_TO_F_H_INCLUDED__
#include <stdlib.h>
#include <math.h>
namespace irr
{
namespace core
{
const float fast_atof_table[] = {
0.f,
0.1f,
0.01f,
0.001f,
0.0001f,
0.00001f,
0.000001f,
0.0000001f,
0.00000001f,
0.000000001f,
0.0000000001f,
0.00000000001f,
0.000000000001f,
0.0000000000001f,
0.00000000000001f,
0.000000000000001f
};
//! Provides a fast function for converting a string into a float,
//! about 6 times faster than atof in win32.
// If you find any bugs, please send them to me, niko (at) irrlicht3d.org.
inline char* fast_atof_move(char* c, float& out)
{
bool inv = false;
char *t;
float f;
if (*c=='-')
{
c++;
inv = true;
}
f = (float)strtol(c, &t, 10);
c = t;
if (*c == '.')
{
c++;
float pl = (float)strtol(c, &t, 10);
pl *= fast_atof_table[t-c];
f += pl;
c = t;
if (*c == 'e')
{
++c;
float exp = (float)strtol(c, &t, 10);
f *= (float)pow(10.0f, exp);
c = t;
}
}
if (inv)
f *= -1.0f;
out = f;
return c;
}
//! Provides a fast function for converting a string into a float,
//! about 6 times faster than atof in win32.
// If you find any bugs, please send them to me, niko (at) irrlicht3d.org.
inline const char* fast_atof_move_const(const char* c, float& out)
{
bool inv = false;
char *t;
float f;
if (*c=='-')
{
c++;
inv = true;
}
f = (float)strtol(c, &t, 10);
c = t;
if (*c == '.')
{
c++;
float pl = (float)strtol(c, &t, 10);
pl *= fast_atof_table[t-c];
f += pl;
c = t;
if (*c == 'e')
{
++c;
f32 exp = (f32)strtol(c, &t, 10);
f *= (f32)powf(10.0f, exp);
c = t;
}
}
if (inv)
f *= -1.0f;
out = f;
return c;
}
inline float fast_atof(const char* c)
{
float ret;
fast_atof_move_const(c, ret);
return ret;
}
} // end namespace core
}// end namespace irr
#endif

Wyświetl plik

@ -1,73 +1,73 @@
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_HEAPSORT_H_INCLUDED__
#define __IRR_HEAPSORT_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace core
{
//! Sinks an element into the heap.
template<class T>
inline void heapsink(T*array, s32 element, s32 max)
{
while ((element<<1) < max) // there is a left child
{
s32 j = (element<<1);
if (j+1 < max && array[j] < array[j+1])
j = j+1; // take right child
if (array[element] < array[j])
{
T t = array[j]; // swap elements
array[j] = array[element];
array[element] = t;
element = j;
}
else
return;
}
}
//! Sorts an array with size 'size' using heapsort.
template<class T>
inline void heapsort(T* array_, s32 size)
{
// for heapsink we pretent this is not c++, where
// arrays start with index 0. So we decrease the array pointer,
// the maximum always +2 and the element always +1
T* virtualArray = array_ - 1;
s32 virtualSize = size + 2;
s32 i;
// build heap
for (i=((size-1)/2); i>=0; --i)
heapsink(virtualArray, i+1, virtualSize-1);
// sort array
for (i=size-1; i>=0; --i)
{
T t = array_[0];
array_[0] = array_[i];
array_[i] = t;
heapsink(virtualArray, 1, i + 1);
}
}
} // end namespace core
} // end namespace irr
#endif
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_HEAPSORT_H_INCLUDED__
#define __IRR_HEAPSORT_H_INCLUDED__
#include "irrTypes.h"
namespace irr
{
namespace core
{
//! Sinks an element into the heap.
template<class T>
inline void heapsink(T*array, s32 element, s32 max)
{
while ((element<<1) < max) // there is a left child
{
s32 j = (element<<1);
if (j+1 < max && array[j] < array[j+1])
j = j+1; // take right child
if (array[element] < array[j])
{
T t = array[j]; // swap elements
array[j] = array[element];
array[element] = t;
element = j;
}
else
return;
}
}
//! Sorts an array with size 'size' using heapsort.
template<class T>
inline void heapsort(T* array_, s32 size)
{
// for heapsink we pretent this is not c++, where
// arrays start with index 0. So we decrease the array pointer,
// the maximum always +2 and the element always +1
T* virtualArray = array_ - 1;
s32 virtualSize = size + 2;
s32 i;
// build heap
for (i=((size-1)/2); i>=0; --i)
heapsink(virtualArray, i+1, virtualSize-1);
// sort array
for (i=size-1; i>=0; --i)
{
T t = array_[0];
array_[0] = array_[i];
array_[i] = t;
heapsink(virtualArray, 1, i + 1);
}
}
} // end namespace core
} // end namespace irr
#endif

Wyświetl plik

@ -1,444 +1,444 @@
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
#ifndef __IRR_ARRAY_H_INCLUDED__
#define __IRR_ARRAY_H_INCLUDED__
#include "irrTypes.h"
#include "heapsort.h"
namespace irr
{
namespace core
{
//! Self reallocating template array (like stl vector) with additional features.
/** Some features are: Heap sorting, binary search methods, easier debugging.
*/
template <class T>
class array
{
public:
array()
: data(0), allocated(0), used(0),
free_when_destroyed(true), is_sorted(true)
{
}
//! Constructs a array and allocates an initial chunk of memory.
//! \param start_count: Amount of elements to allocate.
array(u32 start_count)
: data(0), used(0), allocated(0),
free_when_destroyed(true), is_sorted(true)
{
reallocate(start_count);
}
//! Copy constructor
array(const array<T>& other)
: data(0)
{
*this = other;
}
//! Destructor. Frees allocated memory, if set_free_when_destroyed
//! was not set to false by the user before.
~array()
{
if (free_when_destroyed)
delete [] data;
}
//! Reallocates the array, make it bigger or smaller.
//! \param new_size: New size of array.
void reallocate(u32 new_size)
{
T* old_data = data;
data = new T[new_size];
allocated = new_size;
s32 end = used < new_size ? used : new_size;
for (s32 i=0; i<end; ++i)
data[i] = old_data[i];
if (allocated < used)
used = allocated;
delete [] old_data;
}
//! Adds an element at back of array. If the array is to small to
//! add this new element, the array is made bigger.
//! \param element: Element to add at the back of the array.
void push_back(const T& element)
{
if (used + 1 > allocated)
{
// reallocate(used * 2 +1);
// this doesn't work if the element is in the same array. So
// we'll copy the element first to be sure we'll get no data
// corruption
T e;
e = element; // copy element
reallocate(used * 2 +1); // increase data block
data[used++] = e; // push_back
is_sorted = false;
return;
}
data[used++] = element;
is_sorted = false;
}
//! Adds an element at the front of the array. If the array is to small to
//! add this new element, the array is made bigger. Please note that this
//! is slow, because the whole array needs to be copied for this.
//! \param element: Element to add at the back of the array.
void push_front(const T& element)
{
if (used + 1 > allocated)
reallocate(used * 2 +1);
for (int i=(int)used; i>0; --i)
data[i] = data[i-1];
data[0] = element;
is_sorted = false;
++used;
}
//! Insert item into array at specified position. Please use this
//! only if you know what you are doing (possible performance loss).
//! The preferred method of adding elements should be push_back().
//! \param element: Element to be inserted
//! \param index: Where position to insert the new element.
void insert(const T& element, u32 index=0)
{
_IRR_DEBUG_BREAK_IF(index>used) // access violation
if (used + 1 > allocated)
reallocate(used * 2 +1);
for (u32 i=used++; i>index; i--)
data[i] = data[i-1];
data[index] = element;
is_sorted = false;
}
//! Clears the array and deletes all allocated memory.
void clear()
{
delete [] data;
data = 0;
used = 0;
allocated = 0;
is_sorted = true;
}
//! Sets pointer to new array, using this as new workspace.
//! \param newPointer: Pointer to new array of elements.
//! \param size: Size of the new array.
void set_pointer(T* newPointer, u32 size)
{
delete [] data;
data = newPointer;
allocated = size;
used = size;
is_sorted = false;
}
//! Sets if the array should delete the memory it used.
//! \param f: If true, the array frees the allocated memory in its
//! destructor, otherwise not. The default is true.
void set_free_when_destroyed(bool f)
{
free_when_destroyed = f;
}
//! Sets the size of the array.
//! \param usedNow: Amount of elements now used.
void set_used(u32 usedNow)
{
if (allocated < usedNow)
reallocate(usedNow);
used = usedNow;
}
//! Assignement operator
void operator=(const array<T>& other)
{
if (data)
delete [] data;
//if (allocated < other.allocated)
if (other.allocated == 0)
data = 0;
else
data = new T[other.allocated];
used = other.used;
free_when_destroyed = other.free_when_destroyed;
is_sorted = other.is_sorted;
allocated = other.allocated;
for (u32 i=0; i<other.used; ++i)
data[i] = other.data[i];
}
//! Direct access operator
T& operator [](u32 index)
{
_IRR_DEBUG_BREAK_IF(index>=used) // access violation
return data[index];
}
//! Direct access operator
const T& operator [](u32 index) const
{
_IRR_DEBUG_BREAK_IF(index>=used) // access violation
return data[index];
}
//! Gets last frame
const T& getLast() const
{
_IRR_DEBUG_BREAK_IF(!used) // access violation
return data[used-1];
}
//! Gets last frame
T& getLast()
{
_IRR_DEBUG_BREAK_IF(!used) // access violation
return data[used-1];
}
//! Returns a pointer to the array.
//! \return Pointer to the array.
T* pointer()
{
return data;
}
//! Returns a const pointer to the array.
//! \return Pointer to the array.
const T* const_pointer() const
{
return data;
}
//! Returns size of used array.
//! \return Size of elements in the array.
u32 size() const
{
return used;
}
//! Returns amount memory allocated.
//! \return Returns amount of memory allocated. The amount of bytes
//! allocated would be allocated_size() * sizeof(ElementsUsed);
u32 allocated_size() const
{
return allocated;
}
//! Returns true if array is empty
//! \return True if the array is empty, false if not.
bool empty() const
{
return used == 0;
}
//! Sorts the array using heapsort. There is no additional memory waste and
//! the algorithm performs (O) n log n in worst case.
void sort()
{
if (is_sorted || used<2)
return;
heapsort(data, used);
is_sorted = true;
}
//! Performs a binary search for an element, returns -1 if not found.
//! The array will be sorted before the binary search if it is not
//! already sorted.
//! \param element: Element to search for.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 binary_search(const T& element)
{
return binary_search(element, 0, used-1);
}
//! Performs a binary search for an element, returns -1 if not found.
//! The array will be sorted before the binary search if it is not
//! already sorted.
//! \param element: Element to search for.
//! \param left: First left index
//! \param right: Last right index.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 binary_search(const T& element, s32 left, s32 right)
{
if (!used)
return -1;
sort();
s32 m;
do
{
m = (left+right)>>1;
if (element < data[m])
right = m - 1;
else
left = m + 1;
} while((element < data[m] || data[m] < element) && left<=right);
// this last line equals to:
// " while((element != array[m]) && left<=right);"
// but we only want to use the '<' operator.
// the same in next line, it is "(element == array[m])"
if (!(element < data[m]) && !(data[m] < element))
return m;
return -1;
}
//! Finds an element in linear time, which is very slow. Use
//! binary_search for faster finding. Only works if =operator is implemented.
//! \param element: Element to search for.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 linear_search(T& element)
{
for (u32 i=0; i<used; ++i)
if (!(element < data[i]) && !(data[i] < element))
return (s32)i;
return -1;
}
//! Finds an element in linear time, which is very slow. Use
//! binary_search for faster finding. Only works if =operator is implemented.
//! \param element: Element to search for.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 linear_reverse_search(T& element)
{
for (s32 i=used-1; i>=0; --i)
if (data[i] == element)
return (s32)i;
return -1;
}
//! Erases an element from the array. May be slow, because all elements
//! following after the erased element have to be copied.
//! \param index: Index of element to be erased.
void erase(u32 index)
{
_IRR_DEBUG_BREAK_IF(index>=used || index<0) // access violation
for (u32 i=index+1; i<used; ++i)
data[i-1] = data[i];
--used;
}
//! Erases some elements from the array. may be slow, because all elements
//! following after the erased element have to be copied.
//! \param index: Index of the first element to be erased.
//! \param count: Amount of elements to be erased.
void erase(u32 index, s32 count)
{
_IRR_DEBUG_BREAK_IF(index>=used || index<0 || count<1 || index+count>used) // access violation
for (u32 i=index+count; i<used; ++i)
data[i-count] = data[i];
used-= count;
}
//! Sets if the array is sorted
void set_sorted(bool _is_sorted)
{
is_sorted = _is_sorted;
}
private:
T* data;
u32 allocated;
u32 used;
bool free_when_destroyed;
bool is_sorted;
};
} // end namespace core
} // end namespace irr
#endif
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and irrXML.h
#ifndef __IRR_ARRAY_H_INCLUDED__
#define __IRR_ARRAY_H_INCLUDED__
#include "irrTypes.h"
#include "heapsort.h"
namespace irr
{
namespace core
{
//! Self reallocating template array (like stl vector) with additional features.
/** Some features are: Heap sorting, binary search methods, easier debugging.
*/
template <class T>
class array
{
public:
array()
: data(0), allocated(0), used(0),
free_when_destroyed(true), is_sorted(true)
{
}
//! Constructs a array and allocates an initial chunk of memory.
//! \param start_count: Amount of elements to allocate.
array(u32 start_count)
: data(0), used(0), allocated(0),
free_when_destroyed(true), is_sorted(true)
{
reallocate(start_count);
}
//! Copy constructor
array(const array<T>& other)
: data(0)
{
*this = other;
}
//! Destructor. Frees allocated memory, if set_free_when_destroyed
//! was not set to false by the user before.
~array()
{
if (free_when_destroyed)
delete [] data;
}
//! Reallocates the array, make it bigger or smaller.
//! \param new_size: New size of array.
void reallocate(u32 new_size)
{
T* old_data = data;
data = new T[new_size];
allocated = new_size;
s32 end = used < new_size ? used : new_size;
for (s32 i=0; i<end; ++i)
data[i] = old_data[i];
if (allocated < used)
used = allocated;
delete [] old_data;
}
//! Adds an element at back of array. If the array is to small to
//! add this new element, the array is made bigger.
//! \param element: Element to add at the back of the array.
void push_back(const T& element)
{
if (used + 1 > allocated)
{
// reallocate(used * 2 +1);
// this doesn't work if the element is in the same array. So
// we'll copy the element first to be sure we'll get no data
// corruption
T e;
e = element; // copy element
reallocate(used * 2 +1); // increase data block
data[used++] = e; // push_back
is_sorted = false;
return;
}
data[used++] = element;
is_sorted = false;
}
//! Adds an element at the front of the array. If the array is to small to
//! add this new element, the array is made bigger. Please note that this
//! is slow, because the whole array needs to be copied for this.
//! \param element: Element to add at the back of the array.
void push_front(const T& element)
{
if (used + 1 > allocated)
reallocate(used * 2 +1);
for (int i=(int)used; i>0; --i)
data[i] = data[i-1];
data[0] = element;
is_sorted = false;
++used;
}
//! Insert item into array at specified position. Please use this
//! only if you know what you are doing (possible performance loss).
//! The preferred method of adding elements should be push_back().
//! \param element: Element to be inserted
//! \param index: Where position to insert the new element.
void insert(const T& element, u32 index=0)
{
_IRR_DEBUG_BREAK_IF(index>used) // access violation
if (used + 1 > allocated)
reallocate(used * 2 +1);
for (u32 i=used++; i>index; i--)
data[i] = data[i-1];
data[index] = element;
is_sorted = false;
}
//! Clears the array and deletes all allocated memory.
void clear()
{
delete [] data;
data = 0;
used = 0;
allocated = 0;
is_sorted = true;
}
//! Sets pointer to new array, using this as new workspace.
//! \param newPointer: Pointer to new array of elements.
//! \param size: Size of the new array.
void set_pointer(T* newPointer, u32 size)
{
delete [] data;
data = newPointer;
allocated = size;
used = size;
is_sorted = false;
}
//! Sets if the array should delete the memory it used.
//! \param f: If true, the array frees the allocated memory in its
//! destructor, otherwise not. The default is true.
void set_free_when_destroyed(bool f)
{
free_when_destroyed = f;
}
//! Sets the size of the array.
//! \param usedNow: Amount of elements now used.
void set_used(u32 usedNow)
{
if (allocated < usedNow)
reallocate(usedNow);
used = usedNow;
}
//! Assignement operator
void operator=(const array<T>& other)
{
if (data)
delete [] data;
//if (allocated < other.allocated)
if (other.allocated == 0)
data = 0;
else
data = new T[other.allocated];
used = other.used;
free_when_destroyed = other.free_when_destroyed;
is_sorted = other.is_sorted;
allocated = other.allocated;
for (u32 i=0; i<other.used; ++i)
data[i] = other.data[i];
}
//! Direct access operator
T& operator [](u32 index)
{
_IRR_DEBUG_BREAK_IF(index>=used) // access violation
return data[index];
}
//! Direct access operator
const T& operator [](u32 index) const
{
_IRR_DEBUG_BREAK_IF(index>=used) // access violation
return data[index];
}
//! Gets last frame
const T& getLast() const
{
_IRR_DEBUG_BREAK_IF(!used) // access violation
return data[used-1];
}
//! Gets last frame
T& getLast()
{
_IRR_DEBUG_BREAK_IF(!used) // access violation
return data[used-1];
}
//! Returns a pointer to the array.
//! \return Pointer to the array.
T* pointer()
{
return data;
}
//! Returns a const pointer to the array.
//! \return Pointer to the array.
const T* const_pointer() const
{
return data;
}
//! Returns size of used array.
//! \return Size of elements in the array.
u32 size() const
{
return used;
}
//! Returns amount memory allocated.
//! \return Returns amount of memory allocated. The amount of bytes
//! allocated would be allocated_size() * sizeof(ElementsUsed);
u32 allocated_size() const
{
return allocated;
}
//! Returns true if array is empty
//! \return True if the array is empty, false if not.
bool empty() const
{
return used == 0;
}
//! Sorts the array using heapsort. There is no additional memory waste and
//! the algorithm performs (O) n log n in worst case.
void sort()
{
if (is_sorted || used<2)
return;
heapsort(data, used);
is_sorted = true;
}
//! Performs a binary search for an element, returns -1 if not found.
//! The array will be sorted before the binary search if it is not
//! already sorted.
//! \param element: Element to search for.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 binary_search(const T& element)
{
return binary_search(element, 0, used-1);
}
//! Performs a binary search for an element, returns -1 if not found.
//! The array will be sorted before the binary search if it is not
//! already sorted.
//! \param element: Element to search for.
//! \param left: First left index
//! \param right: Last right index.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 binary_search(const T& element, s32 left, s32 right)
{
if (!used)
return -1;
sort();
s32 m;
do
{
m = (left+right)>>1;
if (element < data[m])
right = m - 1;
else
left = m + 1;
} while((element < data[m] || data[m] < element) && left<=right);
// this last line equals to:
// " while((element != array[m]) && left<=right);"
// but we only want to use the '<' operator.
// the same in next line, it is "(element == array[m])"
if (!(element < data[m]) && !(data[m] < element))
return m;
return -1;
}
//! Finds an element in linear time, which is very slow. Use
//! binary_search for faster finding. Only works if =operator is implemented.
//! \param element: Element to search for.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 linear_search(T& element)
{
for (u32 i=0; i<used; ++i)
if (!(element < data[i]) && !(data[i] < element))
return (s32)i;
return -1;
}
//! Finds an element in linear time, which is very slow. Use
//! binary_search for faster finding. Only works if =operator is implemented.
//! \param element: Element to search for.
//! \return Returns position of the searched element if it was found,
//! otherwise -1 is returned.
s32 linear_reverse_search(T& element)
{
for (s32 i=used-1; i>=0; --i)
if (data[i] == element)
return (s32)i;
return -1;
}
//! Erases an element from the array. May be slow, because all elements
//! following after the erased element have to be copied.
//! \param index: Index of element to be erased.
void erase(u32 index)
{
_IRR_DEBUG_BREAK_IF(index>=used || index<0) // access violation
for (u32 i=index+1; i<used; ++i)
data[i-1] = data[i];
--used;
}
//! Erases some elements from the array. may be slow, because all elements
//! following after the erased element have to be copied.
//! \param index: Index of the first element to be erased.
//! \param count: Amount of elements to be erased.
void erase(u32 index, s32 count)
{
_IRR_DEBUG_BREAK_IF(index>=used || index<0 || count<1 || index+count>used) // access violation
for (u32 i=index+count; i<used; ++i)
data[i-count] = data[i];
used-= count;
}
//! Sets if the array is sorted
void set_sorted(bool _is_sorted)
{
is_sorted = _is_sorted;
}
private:
T* data;
u32 allocated;
u32 used;
bool free_when_destroyed;
bool is_sorted;
};
} // end namespace core
} // end namespace irr
#endif

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,101 +1,101 @@
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_TYPES_H_INCLUDED__
#define __IRR_TYPES_H_INCLUDED__
namespace irr
{
//! 8 bit unsigned variable.
/** This is a typedef for unsigned char, it ensures portability of the engine. */
typedef unsigned char u8;
//! 8 bit signed variable.
/** This is a typedef for signed char, it ensures portability of the engine. */
typedef signed char s8;
//! 8 bit character variable.
/** This is a typedef for char, it ensures portability of the engine. */
typedef char c8;
//! 16 bit unsigned variable.
/** This is a typedef for unsigned short, it ensures portability of the engine. */
typedef unsigned short u16;
//! 16 bit signed variable.
/** This is a typedef for signed short, it ensures portability of the engine. */
typedef signed short s16;
//! 32 bit unsigned variable.
/** This is a typedef for unsigned int, it ensures portability of the engine. */
typedef unsigned int u32;
//! 32 bit signed variable.
/** This is a typedef for signed int, it ensures portability of the engine. */
typedef signed int s32;
// 64 bit signed variable.
// This is a typedef for __int64, it ensures portability of the engine.
// This type is currently not used by the engine and not supported by compilers
// other than Microsoft Compilers, so it is outcommented.
//typedef __int64 s64;
//! 32 bit floating point variable.
/** This is a typedef for float, it ensures portability of the engine. */
typedef float f32;
//! 64 bit floating point variable.
/** This is a typedef for double, it ensures portability of the engine. */
typedef double f64;
} // end namespace
// define the wchar_t type if not already built in.
#ifdef _MSC_VER
#ifndef _WCHAR_T_DEFINED
//! A 16 bit wide character type.
/**
Defines the wchar_t-type.
In VS6, its not possible to tell
the standard compiler to treat wchar_t as a built-in type, and
sometimes we just don't want to include the huge stdlib.h or wchar.h,
so we'll use this.
*/
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif // wchar is not defined
#endif // microsoft compiler
//! define a break macro for debugging only in Win32 mode.
#if defined(WIN32) && defined(_MSC_VER) && defined(_DEBUG)
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
#else
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ )
#endif
//! Defines a small statement to work around a microsoft compiler bug.
/** The microsft compiler 7.0 - 7.1 has a bug:
When you call unmanaged code that returns a bool type value of false from managed code,
the return value may appear as true. See
http://support.microsoft.com/default.aspx?kbid=823071 for details.
Compiler version defines: VC6.0 : 1200, VC7.0 : 1300, VC7.1 : 1310, VC8.0 : 1400*/
#if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER > 1299) && (_MSC_VER < 1400)
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX __asm mov eax,100
#else
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
#endif // _IRR_MANAGED_MARSHALLING_BUGFIX
#endif // __IRR_TYPES_H_INCLUDED__
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_TYPES_H_INCLUDED__
#define __IRR_TYPES_H_INCLUDED__
namespace irr
{
//! 8 bit unsigned variable.
/** This is a typedef for unsigned char, it ensures portability of the engine. */
typedef unsigned char u8;
//! 8 bit signed variable.
/** This is a typedef for signed char, it ensures portability of the engine. */
typedef signed char s8;
//! 8 bit character variable.
/** This is a typedef for char, it ensures portability of the engine. */
typedef char c8;
//! 16 bit unsigned variable.
/** This is a typedef for unsigned short, it ensures portability of the engine. */
typedef unsigned short u16;
//! 16 bit signed variable.
/** This is a typedef for signed short, it ensures portability of the engine. */
typedef signed short s16;
//! 32 bit unsigned variable.
/** This is a typedef for unsigned int, it ensures portability of the engine. */
typedef unsigned int u32;
//! 32 bit signed variable.
/** This is a typedef for signed int, it ensures portability of the engine. */
typedef signed int s32;
// 64 bit signed variable.
// This is a typedef for __int64, it ensures portability of the engine.
// This type is currently not used by the engine and not supported by compilers
// other than Microsoft Compilers, so it is outcommented.
//typedef __int64 s64;
//! 32 bit floating point variable.
/** This is a typedef for float, it ensures portability of the engine. */
typedef float f32;
//! 64 bit floating point variable.
/** This is a typedef for double, it ensures portability of the engine. */
typedef double f64;
} // end namespace
// define the wchar_t type if not already built in.
#ifdef _MSC_VER
#ifndef _WCHAR_T_DEFINED
//! A 16 bit wide character type.
/**
Defines the wchar_t-type.
In VS6, its not possible to tell
the standard compiler to treat wchar_t as a built-in type, and
sometimes we just don't want to include the huge stdlib.h or wchar.h,
so we'll use this.
*/
typedef unsigned short wchar_t;
#define _WCHAR_T_DEFINED
#endif // wchar is not defined
#endif // microsoft compiler
//! define a break macro for debugging only in Win32 mode.
#if defined(WIN32) && defined(_MSC_VER) && defined(_DEBUG)
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ ) if (_CONDITION_) {_asm int 3}
#else
#define _IRR_DEBUG_BREAK_IF( _CONDITION_ )
#endif
//! Defines a small statement to work around a microsoft compiler bug.
/** The microsft compiler 7.0 - 7.1 has a bug:
When you call unmanaged code that returns a bool type value of false from managed code,
the return value may appear as true. See
http://support.microsoft.com/default.aspx?kbid=823071 for details.
Compiler version defines: VC6.0 : 1200, VC7.0 : 1300, VC7.1 : 1310, VC8.0 : 1400*/
#if defined(WIN32) && defined(_MSC_VER) && (_MSC_VER > 1299) && (_MSC_VER < 1400)
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX __asm mov eax,100
#else
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
#endif // _IRR_MANAGED_MARSHALLING_BUGFIX
#endif // __IRR_TYPES_H_INCLUDED__

Wyświetl plik

@ -1,147 +1,147 @@
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
#include "irrXML.h"
#include "irrString.h"
#include "irrArray.h"
#include "fast_atof.h"
#include "CXMLReaderImpl.h"
namespace irr
{
namespace io
{
//! Implementation of the file read callback for ordinary files
class CFileReadCallBack : public IFileReadCallBack
{
public:
//! construct from filename
CFileReadCallBack(const char* filename)
: File(0), Size(0), Close(true)
{
// open file
File = fopen(filename, "rb");
if (File)
getFileSize();
}
//! construct from FILE pointer
CFileReadCallBack(FILE* file)
: File(file), Size(0), Close(false)
{
if (File)
getFileSize();
}
//! destructor
virtual ~CFileReadCallBack()
{
if (Close && File)
fclose(File);
}
//! Reads an amount of bytes from the file.
virtual int read(void* buffer, int sizeToRead)
{
if (!File)
return 0;
return (int)fread(buffer, 1, sizeToRead, File);
}
//! Returns size of file in bytes
virtual int getSize()
{
return Size;
}
private:
//! retrieves the file size of the open file
void getFileSize()
{
fseek(File, 0, SEEK_END);
Size = ftell(File);
fseek(File, 0, SEEK_SET);
}
FILE* File;
int Size;
bool Close;
}; // end class CFileReadCallBack
// FACTORY FUNCTIONS:
//! Creates an instance of an UFT-8 or ASCII character xml parser.
IrrXMLReader* createIrrXMLReader(const char* filename)
{
return new CXMLReaderImpl<char, IXMLBase>(new CFileReadCallBack(filename));
}
//! Creates an instance of an UFT-8 or ASCII character xml parser.
IrrXMLReader* createIrrXMLReader(FILE* file)
{
return new CXMLReaderImpl<char, IXMLBase>(new CFileReadCallBack(file));
}
//! Creates an instance of an UFT-8 or ASCII character xml parser.
IrrXMLReader* createIrrXMLReader(IFileReadCallBack* callback)
{
return new CXMLReaderImpl<char, IXMLBase>(callback, false);
}
//! Creates an instance of an UTF-16 xml parser.
IrrXMLReaderUTF16* createIrrXMLReaderUTF16(const char* filename)
{
return new CXMLReaderImpl<char16, IXMLBase>(new CFileReadCallBack(filename));
}
//! Creates an instance of an UTF-16 xml parser.
IrrXMLReaderUTF16* createIrrXMLReaderUTF16(FILE* file)
{
return new CXMLReaderImpl<char16, IXMLBase>(new CFileReadCallBack(file));
}
//! Creates an instance of an UTF-16 xml parser.
IrrXMLReaderUTF16* createIrrXMLReaderUTF16(IFileReadCallBack* callback)
{
return new CXMLReaderImpl<char16, IXMLBase>(callback, false);
}
//! Creates an instance of an UTF-32 xml parser.
IrrXMLReaderUTF32* createIrrXMLReaderUTF32(const char* filename)
{
return new CXMLReaderImpl<char32, IXMLBase>(new CFileReadCallBack(filename));
}
//! Creates an instance of an UTF-32 xml parser.
IrrXMLReaderUTF32* createIrrXMLReaderUTF32(FILE* file)
{
return new CXMLReaderImpl<char32, IXMLBase>(new CFileReadCallBack(file));
}
//! Creates an instance of an UTF-32 xml parser.
IrrXMLReaderUTF32* createIrrXMLReaderUTF32(IFileReadCallBack* callback)
{
return new CXMLReaderImpl<char32, IXMLBase>(callback, false);
}
} // end namespace io
} // end namespace irr
// Copyright (C) 2002-2005 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
#include "irrXML.h"
#include "irrString.h"
#include "irrArray.h"
#include "fast_atof.h"
#include "CXMLReaderImpl.h"
namespace irr
{
namespace io
{
//! Implementation of the file read callback for ordinary files
class CFileReadCallBack : public IFileReadCallBack
{
public:
//! construct from filename
CFileReadCallBack(const char* filename)
: File(0), Size(0), Close(true)
{
// open file
File = fopen(filename, "rb");
if (File)
getFileSize();
}
//! construct from FILE pointer
CFileReadCallBack(FILE* file)
: File(file), Size(0), Close(false)
{
if (File)
getFileSize();
}
//! destructor
virtual ~CFileReadCallBack()
{
if (Close && File)
fclose(File);
}
//! Reads an amount of bytes from the file.
virtual int read(void* buffer, int sizeToRead)
{
if (!File)
return 0;
return (int)fread(buffer, 1, sizeToRead, File);
}
//! Returns size of file in bytes
virtual int getSize()
{
return Size;
}
private:
//! retrieves the file size of the open file
void getFileSize()
{
fseek(File, 0, SEEK_END);
Size = ftell(File);
fseek(File, 0, SEEK_SET);
}
FILE* File;
int Size;
bool Close;
}; // end class CFileReadCallBack
// FACTORY FUNCTIONS:
//! Creates an instance of an UFT-8 or ASCII character xml parser.
IrrXMLReader* createIrrXMLReader(const char* filename)
{
return new CXMLReaderImpl<char, IXMLBase>(new CFileReadCallBack(filename));
}
//! Creates an instance of an UFT-8 or ASCII character xml parser.
IrrXMLReader* createIrrXMLReader(FILE* file)
{
return new CXMLReaderImpl<char, IXMLBase>(new CFileReadCallBack(file));
}
//! Creates an instance of an UFT-8 or ASCII character xml parser.
IrrXMLReader* createIrrXMLReader(IFileReadCallBack* callback)
{
return new CXMLReaderImpl<char, IXMLBase>(callback, false);
}
//! Creates an instance of an UTF-16 xml parser.
IrrXMLReaderUTF16* createIrrXMLReaderUTF16(const char* filename)
{
return new CXMLReaderImpl<char16, IXMLBase>(new CFileReadCallBack(filename));
}
//! Creates an instance of an UTF-16 xml parser.
IrrXMLReaderUTF16* createIrrXMLReaderUTF16(FILE* file)
{
return new CXMLReaderImpl<char16, IXMLBase>(new CFileReadCallBack(file));
}
//! Creates an instance of an UTF-16 xml parser.
IrrXMLReaderUTF16* createIrrXMLReaderUTF16(IFileReadCallBack* callback)
{
return new CXMLReaderImpl<char16, IXMLBase>(callback, false);
}
//! Creates an instance of an UTF-32 xml parser.
IrrXMLReaderUTF32* createIrrXMLReaderUTF32(const char* filename)
{
return new CXMLReaderImpl<char32, IXMLBase>(new CFileReadCallBack(filename));
}
//! Creates an instance of an UTF-32 xml parser.
IrrXMLReaderUTF32* createIrrXMLReaderUTF32(FILE* file)
{
return new CXMLReaderImpl<char32, IXMLBase>(new CFileReadCallBack(file));
}
//! Creates an instance of an UTF-32 xml parser.
IrrXMLReaderUTF32* createIrrXMLReaderUTF32(IFileReadCallBack* callback)
{
return new CXMLReaderImpl<char32, IXMLBase>(callback, false);
}
} // end namespace io
} // end namespace irr

Plik diff jest za duży Load Diff

Wyświetl plik

@ -150,7 +150,7 @@ int submit_log(void)
sprintf(adifdate,"%04d%02d%02d", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
strftime(logtime, sizeof(logtime), "%H%M", tm);
string mode = mode_names[active_modem->get_mode()];
const char *mode = mode_info[active_modem->get_mode()].sname;
sprintf(strFreqMhz,"%-12f", wf->dFreq()/1.0e6);
@ -171,7 +171,7 @@ int submit_log(void)
log_msg = log_msg + "mhz:" + strFreqMhz + LOG_MSEPARATOR;
putadif(12, strFreqMhz);
log_msg = log_msg + "mode:" + mode + LOG_MSEPARATOR;
putadif(14, mode.c_str());
putadif(14, mode);
log_msg = log_msg + "tx:" + inpRstOut->value() + LOG_MSEPARATOR;
putadif(24, inpRstOut->value());
log_msg = log_msg + "rx:" + inpRstIn->value() + LOG_MSEPARATOR;

Wyświetl plik

@ -69,7 +69,6 @@ using namespace std;
string scDevice = "/dev/dsp1";
bool pa_allow_full_duplex = false;
int pa_frames_per_buffer = 0;
double pa_sample_rate = 0;
char szHomedir[120] = "";
char szPskMailDir[120] = "";
@ -232,6 +231,7 @@ int main(int argc, char ** argv)
btnAudioIO[1]->value(0);
menuOSSDev->activate();
menuPADev->deactivate();
menuSampleRate->deactivate();
} else {
scDevice = progdefaults.PAdevice;
btnAudioIO[0]->value(0);
@ -299,13 +299,6 @@ void generate_option_help(void) {
<< setw(width) << setiosflags(ios::left)
<< "" << "The default is: " << progdefaults.tx_msgid
<< " or 0x" << hex << progdefaults.tx_msgid << dec << '\n'
#if USE_PORTAUDIO
<< setw(width) << setiosflags(ios::left)
<< " --sample-rate SAMPLE_RATE"
<< "Force the PortAudio stream to be opened\n"
<< setw(width) << setiosflags(ios::left)
<< "" << "with a sample rate of SAMPLE_RATE Hz\n"
#endif
<< setw(width) << setiosflags(ios::left)
<< " --version" << "Print version information\n"
@ -540,7 +533,8 @@ int parse_args(int argc, char **argv, int& idx)
idx += 2;
return 2;
case OPT_SAMPLE_RATE:
pa_sample_rate = strtod(optarg, 0);
cerr << "The --sample-rate switch is deprecated and will be removed in a future release\n";
progdefaults.sample_rate = strtol(optarg, 0, 10);
idx += 2;
return 2;
#endif // USE_PORTAUDIO

Wyświetl plik

@ -27,7 +27,7 @@
#include <config.h>
#include "ascii.h"
const char *ascii[256] = {
"", "", "", "",
"", "", "", "",

Wyświetl plik

@ -134,6 +134,7 @@ configuration progdefaults = {
"", // string SCdevice;
"", // string OSSdevice;
"", // string PAdevice;
0, // int sample_rate;
0, // int RX_corr;
0, // int TX_corr;
0, // int TxOffset;
@ -215,7 +216,7 @@ enum TAG { \
PTTDEV,
SECONDARYTEXT,
AUDIOIO, SCDEVICE, OSSDEVICE, PADEVICE,
RXCORR, TXCORR, TXOFFSET,
SAMPLERATE, RXCORR, TXCORR, TXOFFSET,
USELEADINGZEROS, CONTESTSTART, CONTESTDIGITS,
USETIMER, MACRONUMBER, TIMEOUT,
MXDEVICE, RCVMIXER, XMTMIXER, PCMVOLUME,
@ -380,6 +381,7 @@ void configuration::writeDefaultsXML()
writeXMLstr(f, "SCDEVICE", SCdevice);
writeXMLstr(f, "OSSDEVICE", OSSdevice);
writeXMLstr(f, "PADEVICE", PAdevice);
writeXMLint(f, "SAMPLERATE", sample_rate);
writeXMLint(f, "RXCORR", RX_corr);
writeXMLint(f, "TXCORR", TX_corr);
writeXMLint(f, "TXOFFSET", TxOffset);
@ -716,6 +718,9 @@ bool configuration::readDefaultsXML()
case PADEVICE :
PAdevice = xml->getNodeData();
break;
case SAMPLERATE :
sample_rate = atoi(xml->getNodeData());
break;
case RXCORR :
RX_corr = atoi(xml->getNodeData());
break;
@ -906,6 +911,7 @@ bool configuration::readDefaultsXML()
else if (!strcmp("SCDEVICE", nodeName)) tag = SCDEVICE;
else if (!strcmp("OSSDEVICE", nodeName)) tag = OSSDEVICE;
else if (!strcmp("PADEVICE", nodeName)) tag = PADEVICE;
else if (!strcmp("SAMPLERATE", nodeName)) tag = SAMPLERATE;
else if (!strcmp("RXCORR", nodeName)) tag = RXCORR;
else if (!strcmp("TXCORR", nodeName)) tag = TXCORR;
else if (!strcmp("TXOFFSET", nodeName)) tag = TXOFFSET;
@ -1223,6 +1229,14 @@ int configuration::openDefaults() {
resetMixerControls();
menuMix->value(MXdevice.c_str());
if (sample_rate) {
char s[6+1];
snprintf(s, sizeof(s), "%d", sample_rate);
menuSampleRate->value(menuSampleRate->find_item(s));
}
else
menuSampleRate->value(0);
cntRxRateCorr->value(RX_corr);
cntTxRateCorr->value(TX_corr);
cntTxOffset->value(TxOffset);

Wyświetl plik

@ -144,49 +144,49 @@ unsigned char graydecode(unsigned char data)
// ----------------------------------------------------------------------------
void MilliSleep(long msecs) {
#ifdef WIN32
void MilliSleep(long msecs) {
#ifdef WIN32
struct timespec tv;
tv.tv_sec = 0;
tv.tv_nsec = msecs * 1000000L;
nanosleep(&tv, NULL);
#else
struct timeval tv;
tv.tv_sec = 0;
#else
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = msecs * 1000L;
select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv);
#endif
select (0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &tv);
#endif
}
// Rectangular - no pre filtering of data array
// Rectangular - no pre filtering of data array
void RectWindow(double *array, int n) {
for (int i = 0; i < n; i++)
array[i] = 1.0;
}
// Hamming - used by gmfsk
for (int i = 0; i < n; i++)
array[i] = 1.0;
}
// Hamming - used by gmfsk
void HammingWindow(double *array, int n) {
double pwr = 0.0;
for (int i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
array[i] = hamming((double)i/(double)n);
pwr += array[i] * array[i];
}
pwr = sqrt((double)n/pwr);
for (int i = 0; i < n; i++)
array[i] *= pwr;
}
// Hanning - used by winpsk
}
// Hanning - used by winpsk
void HanningWindow(double *array, int n) {
double pwr = 0.0;
for (int i = 0; i < n; i++) {
for (int i = 0; i < n; i++) {
array[i] = hanning((double)i/(double)n);
pwr += array[i] * array[i];
}
pwr = sqrt((double)n/pwr);
for (int i = 0; i < n; i++)
array[i] *= pwr;
}
array[i] *= pwr;
}
// Best lob suppression - least in band ripple
void BlackmanWindow(double *array, int n) {
@ -197,10 +197,10 @@ void BlackmanWindow(double *array, int n) {
}
pwr = sqrt((double)n/pwr);
for (int i = 0; i < n; i++)
array[i] *= pwr;
array[i] *= pwr;
}
// Simple about effective as Hamming or Hanning
// Simple about effective as Hamming or Hanning
void TriangularWindow(double *array, int n) {
double pwr = 0.0;
for (int i = 0; i < n; i++) array[i] = 1.0;
@ -211,6 +211,6 @@ void TriangularWindow(double *array, int n) {
for (int i = 0; i < n; i++) pwr += array[i] * array[i];
pwr = sqrt((double)n/pwr);
for (int i = 0; i < n; i++)
array[i] *= pwr;
array[i] *= pwr;
}

Wyświetl plik

@ -24,48 +24,18 @@ bool pskmail_text_available = false;
void ParseMode(string src)
{
if (src.find("QPSK31") != string::npos)
initQPSK31();
else if (src.find("QPSK63") != string::npos)
initQPSK63();
else if (src.find("QPSK125") != string::npos)
initQPSK125();
else if (src.find("PSK31") != string::npos)
initPSK31();
else if (src.find("PSK63") != string::npos)
initPSK63();
else if (src.find("PSK125") != string::npos)
initPSK125();
else if (src.find("PSK250") != string::npos)
initPSK250();
else if (src.find("DOMINOEX4") != string::npos)
initDOMINOEX4();
else if (src.find("DOMINOEX5") != string::npos)
initDOMINOEX5();
else if (src.find("DOMINOEX8") != string::npos)
initDOMINOEX8();
else if (src.find("DOMINOEX11") != string::npos)
initDOMINOEX11();
else if (src.find("DOMINOEX16") != string::npos)
initDOMINOEX16();
else if (src.find("DOMINOEX22") != string::npos)
initDOMINOEX22();
else if (src.find("MFSK8") != string::npos)
initMFSK8();
else if (src.find("MFSK16") != string::npos)
initMFSK16();
else if (src.find("RTTY") != string::npos)
initRTTY();
else if (src.find("CW") != string::npos)
initCW();
else if (src.find("PTTTUNE") != string::npos)
{
int msecs = 100;
if (src.length() > 7)
sscanf( src.substr(7, src.length() - 7).c_str(), "%d", &msecs);
push2talk->set(true);
MilliSleep(msecs);
push2talk->set(false);
for (size_t i = 0; i < sizeof(mode_info)/sizeof(mode_info[0]); ++i) {
if (src.find(mode_info[i].pskmail_name) != string::npos)
init_modem(mode_info[i].mode);
else if (src.find("PTTTUNE") != string::npos) {
int msecs = 100;
if (src.length() > 7)
sscanf( src.substr(7, src.length() - 7).c_str(), "%d", &msecs);
push2talk->set(true);
MilliSleep(msecs);
push2talk->set(false);
}
break;
}
}

Plik diff jest za duży Load Diff

Wyświetl plik

@ -112,40 +112,7 @@ void status::initLastState()
progdefaults.wfRefLevel = reflevel;
progdefaults.wfAmpSpan = ampspan;
}
trx_mode m = (trx_mode) lastmode;
switch (m) {
case MODE_CW : initCW(); break;
case MODE_MFSK8 : initMFSK8(); break;
case MODE_MFSK16 : initMFSK16(); break;
case MODE_PSK63 : initPSK63(); break;
case MODE_PSK125 : initPSK125(); break;
case MODE_PSK250 : initPSK250(); break;
case MODE_QPSK31 : initQPSK31(); break;
case MODE_QPSK63 : initQPSK63(); break;
case MODE_QPSK125 : initQPSK125(); break;
case MODE_QPSK250 : initQPSK250(); break;
case MODE_RTTY : initRTTY(); break;
case MODE_OLIVIA : initOLIVIA(); break;
case MODE_DOMINOEX4 : initDOMINOEX4(); break;
case MODE_DOMINOEX5 : initDOMINOEX5(); break;
case MODE_DOMINOEX8 : initDOMINOEX8(); break;
case MODE_DOMINOEX11 : initDOMINOEX11(); break;
case MODE_DOMINOEX16 : initDOMINOEX16(); break;
case MODE_DOMINOEX22 : initDOMINOEX22(); break;
case MODE_FELDHELL : initFELDHELL(); break;
case MODE_FSKHELL : initFSKHELL(); break;
case MODE_FSKH105 : initFSKHELL105(); break;
case MODE_THROB1 : initTHROB1(); break;
case MODE_THROB2 : initTHROB2(); break;
case MODE_THROB4 : initTHROB4(); break;
case MODE_THROBX1 : initTHROBX1(); break;
case MODE_THROBX2 : initTHROBX2(); break;
case MODE_THROBX4 : initTHROBX4(); break;
case MODE_WWV : initWWV(); break;
case MODE_ANALYSIS: initANALYSIS(); break;
case MODE_BPSK31 :
default: initPSK31();
}
init_modem((trx_mode)lastmode);
while (!active_modem) MilliSleep(100);

Wyświetl plik

@ -1,46 +1,46 @@
//
// "$Id: threads.cxx 4748 2006-01-15 02:26:54Z mike $"
//
// Simple threading API for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2006 by Bill Spitzak and others.
//
// 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 on the following page:
//
// http://www.fltk.org/str.php
//
// FLTK has no multithreaded support unless the main thread calls Fl::lock().
// This main thread is the only thread allowed to call Fl::run() or Fl::wait().
// From then on FLTK will be locked except when the main thread is actually
// waiting for events from the user. Other threads must call Fl::lock() and
// Fl::unlock() to surround calls to FLTK (such as to change widgets or
// redraw them).
//
// "$Id: threads.cxx 4748 2006-01-15 02:26:54Z mike $"
//
// Simple threading API for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2006 by Bill Spitzak and others.
//
// 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 on the following page:
//
// http://www.fltk.org/str.php
//
// FLTK has no multithreaded support unless the main thread calls Fl::lock().
// This main thread is the only thread allowed to call Fl::run() or Fl::wait().
// From then on FLTK will be locked except when the main thread is actually
// waiting for events from the user. Other threads must call Fl::lock() and
// Fl::unlock() to surround calls to FLTK (such as to change widgets or
// redraw them).
#include <config.h>
#include "threads.h"
#ifndef WIN32
// Use POSIX threading...
int fl_create_thread(Fl_Thread & t, void *(*f) (void *), void* p) {
return pthread_create((pthread_t*)&t, NULL, f, p);
#ifndef WIN32
// Use POSIX threading...
int fl_create_thread(Fl_Thread & t, void *(*f) (void *), void* p) {
return pthread_create((pthread_t*)&t, NULL, f, p);
}
int fl_mutex_init(Fl_Mutex * m) {
@ -57,7 +57,11 @@ int fl_cond_wait(Fl_Cond *c, Fl_Mutex *m) {
int fl_cond_signal(Fl_Cond *c) {
return pthread_cond_signal( (pthread_cond_t *) c);
}
}
int fl_cond_bcast(Fl_Cond *c) {
return pthread_cond_broadcast( (pthread_cond_t *) c);
}
int fl_lock(Fl_Mutex *m) {
return pthread_mutex_lock((pthread_mutex_t*)m);
@ -70,14 +74,14 @@ int fl_unlock(Fl_Mutex *m) {
int fl_join (Fl_Thread t) {
return pthread_join ((pthread_t) t, 0);
}
#else
static int fl_create_thread(Fl_Thread * t, void *(*f) (void *), void* p) {
return t = (Fl_Thread)_beginthread((void( __cdecl * )( void * ))f, 0, p);
}
# endif // !WIN32
#else
static int fl_create_thread(Fl_Thread * t, void *(*f) (void *), void* p) {
return t = (Fl_Thread)_beginthread((void( __cdecl * )( void * ))f, 0, p);
}
# endif // !WIN32
#if USE_TLS
__thread int thread_id_;

Wyświetl plik

@ -67,7 +67,7 @@ void qrunner::detach(void)
void qrunner::execute(int fd, void *arg)
{
qrunner *qr = static_cast<qrunner *>(arg);
qrunner *qr = reinterpret_cast<qrunner *>(arg);
char c;
while (qr->fifo->execute()) {
@ -75,3 +75,12 @@ void qrunner::execute(int fd, void *arg)
throw qexception(errno);
}
}
void qrunner::flush(void)
{
char c;
while (fifo->execute()) {
if (unlikely(read(pfd[0], &c, 1) == -1 /*&& errno != EWOULDBLOCK*/))
throw qexception(errno);
}
}

Wyświetl plik

@ -19,7 +19,7 @@
#include "rigMEM.h"
#include "fl_digi.h"
#include "main.h"
#include "main.h"
/* ---------------------------------------------------------------------- */

Wyświetl plik

@ -3,46 +3,46 @@
// Serial i/o class
//
// copyright Dave Freese 2006, w1hkj@w1hkj.com
//
//
//-----------------------------------------------------------------------------
#include <config.h>
#include "serial.h"
#include "serial.h"
Cserial::Cserial() {
device = "/dev/ttyS0";
baud = 1200;
baud = 1200;
timeout = 50; //msec
retries = 5;
rts = dtr = false;
rtsptt = dtrptt = false;
rtscts = false;
status = 0;
fd = -1;
}
Cserial::~Cserial() {
ClosePort();
}
///////////////////////////////////////////////////////
// Function name : Cserial::OpenPort
// Description : Opens the port specified by strPortName
// Return type : BOOL
// Argument : c_string strPortName
///////////////////////////////////////////////////////
fd = -1;
}
Cserial::~Cserial() {
ClosePort();
}
///////////////////////////////////////////////////////
// Function name : Cserial::OpenPort
// Description : Opens the port specified by strPortName
// Return type : BOOL
// Argument : c_string strPortName
///////////////////////////////////////////////////////
bool Cserial::OpenPort() {
if ((fd = open( device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY)) < 0)
return false;
// save current port settings
tcflush (fd, TCIFLUSH);
if ((fd = open( device.c_str(), O_RDWR | O_NOCTTY | O_NDELAY)) < 0)
return false;
// save current port settings
tcflush (fd, TCIFLUSH);
tcgetattr (fd, &oldtio);
newtio = oldtio;
newtio = oldtio;
newtio.c_cflag &= ~CSIZE;
newtio.c_cflag |= CS8 | CLOCAL | CREAD;
newtio.c_cflag &= ~CSIZE;
newtio.c_cflag |= CS8 | CLOCAL | CREAD;
newtio.c_cflag &= ~PARENB;
@ -54,7 +54,7 @@ bool Cserial::OpenPort() {
if (rtscts)
newtio.c_cflag |= CRTSCTS;
else
newtio.c_cflag &= ~CRTSCTS;
newtio.c_cflag &= ~CRTSCTS;
newtio.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
newtio.c_oflag &= ~OPOST;
@ -111,10 +111,10 @@ bool Cserial::OpenPort() {
status &= ~TIOCM_RTS; // clear the RTS bit
}
ioctl(fd, TIOCMSET, &status);
return true;
}
return true;
}
///////////////////////////////////////////////////////
// Function name : Cserial::setPTT
// Return type : void
@ -152,84 +152,84 @@ void Cserial::SetPTT(bool b)
}
ioctl(fd, TIOCMSET, &status);
}
///////////////////////////////////////////////////////
// Function name : Cserial::ClosePort
// Description : Closes the Port
// Return type : void
///////////////////////////////////////////////////////
void Cserial::ClosePort()
{
if (fd < 0) return;
tcsetattr (fd, TCSANOW, &oldtio);
close(fd);
return;
}
bool Cserial::IOselect ()
{
fd_set rfds;
struct timeval tv;
int retval;
FD_ZERO (&rfds);
FD_SET (fd, &rfds);
tv.tv_sec = timeout/1000;
tv.tv_usec = (timeout % 1000) * 1000;
retval = select (FD_SETSIZE, &rfds, (fd_set *)0, (fd_set *)0, &tv);
if (retval <= 0) // no response from serial port or error returned
return false;
return true;
}
///////////////////////////////////////////////////////
// Function name : Cserial::ReadBuffer
// Description : Reads upto nchars from the selected port
// Return type : # characters received
// Argument : pointer to buffer; # chars to read
///////////////////////////////////////////////////////
int Cserial::ReadBuffer (unsigned char *buf, int nchars)
{
int retnum, nread = 0;
while (nchars > 0) {
if (!IOselect()) {
return nread;
}
retnum = read (fd, (char *)(buf + nread), nchars);
if (retnum < 0)
return 0;//nread;
///////////////////////////////////////////////////////
// Function name : Cserial::ClosePort
// Description : Closes the Port
// Return type : void
///////////////////////////////////////////////////////
void Cserial::ClosePort()
{
if (fd < 0) return;
tcsetattr (fd, TCSANOW, &oldtio);
close(fd);
return;
}
bool Cserial::IOselect ()
{
fd_set rfds;
struct timeval tv;
int retval;
FD_ZERO (&rfds);
FD_SET (fd, &rfds);
tv.tv_sec = timeout/1000;
tv.tv_usec = (timeout % 1000) * 1000;
retval = select (FD_SETSIZE, &rfds, (fd_set *)0, (fd_set *)0, &tv);
if (retval <= 0) // no response from serial port or error returned
return false;
return true;
}
///////////////////////////////////////////////////////
// Function name : Cserial::ReadBuffer
// Description : Reads upto nchars from the selected port
// Return type : # characters received
// Argument : pointer to buffer; # chars to read
///////////////////////////////////////////////////////
int Cserial::ReadBuffer (unsigned char *buf, int nchars)
{
int retnum, nread = 0;
while (nchars > 0) {
if (!IOselect()) {
return nread;
}
retnum = read (fd, (char *)(buf + nread), nchars);
if (retnum < 0)
return 0;//nread;
if (retnum == 0)
return nread;
nread += retnum;
nchars -= retnum;
}
return nread;
}
///////////////////////////////////////////////////////
// Function name : Cserial::WriteBuffer
// Description : Writes a string to the selected port
// Return type : BOOL
// Argument : BYTE by
///////////////////////////////////////////////////////
int Cserial::WriteBuffer(unsigned char *buff, int n)
{
if (fd < 0)
return 0;
int ret = write (fd, buff, n);
return ret;
}
///////////////////////////////////////////////////////
// Function name : Cserial::FlushBuffer
// Description : flushes the pending rx chars
// Return type : void
///////////////////////////////////////////////////////
void Cserial::FlushBuffer()
return nread;
nread += retnum;
nchars -= retnum;
}
return nread;
}
///////////////////////////////////////////////////////
// Function name : Cserial::WriteBuffer
// Description : Writes a string to the selected port
// Return type : BOOL
// Argument : BYTE by
///////////////////////////////////////////////////////
int Cserial::WriteBuffer(unsigned char *buff, int n)
{
if (fd < 0)
return;
tcflush (fd, TCIFLUSH);
}
return 0;
int ret = write (fd, buff, n);
return ret;
}
///////////////////////////////////////////////////////
// Function name : Cserial::FlushBuffer
// Description : flushes the pending rx chars
// Return type : void
///////////////////////////////////////////////////////
void Cserial::FlushBuffer()
{
if (fd < 0)
return;
tcflush (fd, TCIFLUSH);
}

Wyświetl plik

@ -718,10 +718,20 @@ int cSoundPA::Open(int mode, int freq)
<< " <-> " << req_sample_rate << endl;
#endif
stream.open(stream_params);
stream.start();
try {
stream.open(stream_params);
stream.start();
}
catch (const exception& e) {
cerr << e.what() << endl;
try {
stream.close();
}
catch (...) { }
throw SndException(e.what());
}
return 0;
return 0;
}
void cSoundPA::Close(void)
@ -944,7 +954,7 @@ void cSoundPA::init_stream(void)
stream_params.setInputParameters(in_params);
stream_params.setOutputParameters(out_params);
dev_sample_rate = get_best_srate();
dev_sample_rate = find_srate();
stream_params.setSampleRate(dev_sample_rate);
max_frames_per_buffer = ceil2(MIN(SND_BUF_LEN, (unsigned)(SCBLOCKSIZE *
@ -983,34 +993,26 @@ void cSoundPA::adjust_stream(void)
stream.start();
}
double cSoundPA::std_sample_rates[] = { -1, 8000, 9600, 11025, 12000,
16000, 22050, 24000, 32000,
44100, 48000, 88200, 96000 };
// Return the hardware-supported sample rate that is closest to the one
// requested by the modem. This needs to be a little smarter; atm it simply
// goes through the array, and may even try the same rate twice.
double cSoundPA::get_best_srate(void)
// Determine the sample rate that we will use. We try the modem's rate
// first and fall back to the device's default rate. If there is a user
// setting we just return that without making any checks.
double cSoundPA::find_srate(void)
{
extern double pa_sample_rate;
if (pa_sample_rate)
return pa_sample_rate;
if (progdefaults.sample_rate)
return progdefaults.sample_rate;
int asize = sizeof(std_sample_rates) / sizeof(std_sample_rates[0]);
std_sample_rates[0] = req_sample_rate;
for (int i = 0; i < asize; i++) {
double srates[] = { req_sample_rate, idev->defaultSampleRate() };
for (unsigned i = 0; i < sizeof(srates)/sizeof(srates[0]); i++) {
portaudio::StreamParameters sp(in_params, out_params,
std_sample_rates[i],
0, paNoFlag);
srates[i], 0, paNoFlag);
#ifndef NDEBUG
cerr << "PA_debug: trying " << std_sample_rates[i] << " Hz" << endl;
cerr << "PA_debug: trying " << srates[i] << " Hz" << endl;
#endif
if (sp.isSupported())
return sp.sampleRate();
}
throw SndException("Could not find a supported sample rate. Sound device busy?");
throw SndException("No supported sample rate found. Sound device busy?");
return -1;
}

Wyświetl plik

@ -241,9 +241,9 @@ void modem::videoText()
progdefaults.macrotextid = false;
}
if (progdefaults.sendid == true) {
wfid_text(mode_names[mode]);
wfid_text(mode_info[mode].sname);
} else if (progdefaults.macroid == true) {
wfid_text(mode_names[mode]);
wfid_text(mode_info[mode].sname);
progdefaults.macroid = false;
}
}

Wyświetl plik

@ -56,6 +56,7 @@ void trx_tune_loop();
Fl_Mutex trx_mutex = PTHREAD_MUTEX_INITIALIZER;
Fl_Mutex trx_cond_mutex = PTHREAD_MUTEX_INITIALIZER;
Fl_Cond trx_cond = PTHREAD_COND_INITIALIZER;
Fl_Thread trx_thread;
state_t trx_state;
@ -90,7 +91,8 @@ void trx_trx_receive_loop()
try {
scard->Open(O_RDONLY, active_modem->get_samplerate());
}
catch (SndException e) {
catch (const SndException& e) {
put_status(e.what(), 1);
MilliSleep(10);
return;
}
@ -123,7 +125,8 @@ void trx_trx_transmit_loop()
try {
scard->Open(O_WRONLY, active_modem->get_samplerate());
}
catch (SndException e) {
catch (const SndException& e) {
put_status(e.what(), 1);
MilliSleep(10);
return;
}
@ -158,7 +161,8 @@ void trx_tune_loop()
try {
scard->Open(O_WRONLY, active_modem->get_samplerate());
}
catch (SndException e) {
catch (const SndException& e) {
put_status(e.what(), 1);
MilliSleep(10);
return;
}
@ -225,7 +229,8 @@ void trx_start_modem_loop()
active_modem = trx_m;
active_modem->init();
trx_state = STATE_RX;
QUEUE_SYNC(CMP_CB(&waterfall::opmode, wf)); //wf->opmode();
signal_modem_ready();
QUEUE(CMP_CB(&waterfall::opmode, wf)); //wf->opmode();
}
void trx_start_modem(modem *m)
@ -333,5 +338,37 @@ void trx_close() {
//---------------------------------------------------------------------
void wait_modem_ready_prep(void)
{
#ifndef NDEBUG
if (GET_THREAD_ID() == TRX_TID)
cerr << "trx thread called wait_modem_ready_prep!\n";
#endif
fl_lock(&trx_cond_mutex);
}
void wait_modem_ready_cmpl(void)
{
#ifndef NDEBUG
if (GET_THREAD_ID() == TRX_TID)
cerr << "trx thread called wait_modem_ready_cmpl!\n";
#endif
fl_cond_wait(&trx_cond, &trx_cond_mutex);
fl_unlock(&trx_cond_mutex);
}
void signal_modem_ready(void)
{
#ifndef NDEBUG
if (GET_THREAD_ID() != TRX_TID)
cerr << "thread " << GET_THREAD_ID()
<< " called signal_modem_ready!\n";
#endif
fl_lock(&trx_cond_mutex);
fl_cond_bcast(&trx_cond);
fl_unlock(&trx_cond_mutex);
}

Wyświetl plik

@ -158,8 +158,8 @@ void Raster::draw()
{
if ((damage() & FL_DAMAGE_USER2)) {
draw_box();
fl_draw_image_mono(
vidbuf,
fl_draw_image_mono(
vidbuf,
x() + 2, y() + 2,
width, height,
1, width );
@ -172,11 +172,11 @@ void Raster::draw()
numcols = 0;
} else {
draw_box();
fl_draw_image_mono(
vidbuf,
fl_draw_image_mono(
vidbuf,
x() + 2, y() + 2,
width, height,
1, width );
}
}
}

Wyświetl plik

@ -76,6 +76,9 @@ FTextBase::FTextBase(int x, int y, int w, int h, const char *l)
int FTextBase::handle(int event)
{
if (event == FL_MOUSEWHEEL && !Fl::event_inside(this))
return 1;
if (!adjusted_colours && event == FL_SHOW) {
adjust_colours();
adjusted_colours = true;

Wyświetl plik

@ -45,7 +45,6 @@ void anal::init()
{
modem::init();
rx_init();
clear_StatusMessages();
digiscope->mode(Digiscope::RTTY);
}
@ -76,7 +75,7 @@ void anal::restart()
sum = 0.0;
fout_1 = fout_2 = 0.0;
put_MODEstatus(mode);
put_MODEstatus(mode);
}
anal::anal()
@ -176,7 +175,7 @@ int anal::rx_process(const double *buf, int len)
//=====================================================================
// anal transmit
//=====================================================================
int anal::tx_process()
{
return -1;