Merge commit 'tags/v3.20.11' into update

Conflicts:
	src/Makefile.am
	src/cw_rtty/rtty.cxx
	src/dialogs/confdialog.cxx
	src/dialogs/confdialog.fl
pull/2/head
Philip Heron 2010-05-05 00:01:13 +01:00
commit 48a701eecd
99 zmienionych plików z 19020 dodań i 6839 usunięć

221
ChangeLog
Wyświetl plik

@ -1,5 +1,66 @@
2010-03-26 Stelios Bounanos <vcs@enotty.net>
2010-05-02 David Freese <w1hkj@w1hkj.com>
ff47cc4: XCVR Freq
5186a74: FLARQ 4.3.1
=Version 3.20.1=
55eec2a: MAP macro update
e17ccfb: LOCK macro
917b5bd: Freq Browser Select
4474bd4: MAP macro
2da1e55: ARQ auto file
54a0569: Freq Control Font
2010-04-22 Stelios Bounanos <vcs@enotty.net>
5b7e839: Disable sprintf re-declaration
c5f34c6: Fix compiler warnings
1733f1f: Add preliminary support for FLTK-1.3
2010-04-16 David Freese <w1hkj@w1hkj.com>
ab092a6: psk reporter mode
6c15ddd: Psk Viewer Min Width
2bc6105: Revert "SC Time Out"
2010-04-12 Stelios Bounanos <vcs@enotty.net>
5da5ba6: Update NEWS
2010-04-12 David Freese <w1hkj@w1hkj.com>
aaaec18: WARNINGS
8df121a: SC Time Out
45654ea: PSKR fec metrics
faf5e6c: Pause-Break
975f4a9: RX lowercase option
2010-04-12 Stelios Bounanos <vcs@enotty.net>
d551f2e: Disable Czech l10n
f1762d7: Fix more widget labels
4f80565: Update QSO frequency
2010-04-08 David Freese <w1hkj@w1hkj.com>
3754c63: Tx Pane Min Height
717c151: Modem Init
0469895: Contest Menu
8f76576: AFC-SQL check buttons
5dcf5cb: ADIF Export
1b5f56f: Olivia-Contestia bandwidth
0d77c1b: SSB modem
586e3d5: QPSK dcd postamble
1aae11e: RX_ONLY Modem type
d29495f: QSY Lock disable
02767b0: Contestia
c10ee73: Freq Analysis Init
2010-04-04 Stelios Bounanos <vcs@enotty.net>
391167c: Add time functions
80572f5: Improve monitoring of transmitted signal
2010-03-25 David Freese <w1hkj@w1hkj.com>
@ -513,3 +574,161 @@
4fff116: Add missing include
d1c206b: Restore MT-63 options
dfab290: Initialise pthreads/win32 in flarq
ecf1f10: Restore two channel capture
a8a734c: Fix millisleep function
2009-07-23 David Freese <w1hkj@w1hkj.com>
cf4c671: MT63 transmit bug fix
=Version 3.12=
2009-07-13 Stelios Bounanos <vcs@enotty.net>
3537f62: Add RSID notifications
2a4cd68: Improve frequency display kb entry
2009-07-11 David Freese <w1hkj@w1hkj.com>
9c291a8: Enable XMLRPC QSY capability
2009-07-06 Stelios Bounanos <vcs@enotty.net>
deea0f6: Add ITU zone to countries list
d54a2ca: Fix compilation on glibc 2.10
2009-07-02 David Freese <w1hkj@w1hkj.com>
9de9eb5: Xmlrpc mods
07a01b1: Logbook bug fix
2009-07-01 Stelios Bounanos <vcs@enotty.net>
42b638d: Fix socket fd leak
58c2f8b: Fix compilation error and warnings on 64bit archs
c07ec21: Add generic notifier
88bedac: Add dragging to table widget
757a8f8: Simplify RE classes
cbf0d87: Extend macro editor
53a2820: Improve dxcc, spot, pskrep performance
9648c30: Remove handling for REs without backref support
1b474a2: Fix config input field labels
d6d5974: Add Fl_Input2 mouse wheel handling
bf4cea4: Add automatic FText text_area resizing
e803fcd: Improve FText drag and drop
ec26eb6: Add band to RX text tooltip
8283833: Add string join and split functions
d70ea69: Print build info in crash handler
f25b5d1: Fix azimuth_long_path
d11f6fe: Add frequency display text paste support
2009-06-30 David Freese <w1hkj@w1hkj.com>
3bad2d4: xmlrpc mods
2009-06-12 Stelios Bounanos <vcs@enotty.net>
419123c: Fix text echo functions
2a83da3: Remove FText text colour adjustment
7a87b0b: Always set the FText cursor colour
2009-06-12 David Freese <w1hkj@w1hkj.com>
a8dfa58: Logbook bug fix
9b7786f: RigCAT mods
2009-06-01 Stelios Bounanos <vcs@enotty.net>
9f7b002: Fix Contest Country Files callsign lookup
2009-06-01 David Freese <w1hkj@w1hkj.com>
b539c1c: ADIF_2.2.3 compliance
8fc582e: Cut number mod for CW
2009-05-26 dave <dave@linux-dev.(none)>
7690a1c: FLARQ
2009-05-26 Stelios Bounanos <vcs@enotty.net>
d4b1a03: Merge flarq
91a1425: Move setup_nls function
9543fa7: Move make_pixmap function
ada43f4: Add new FText classes
bf6a2c3: Add thread id logging
8207c62: Prefer ALSA default devices
d04b780: Fix initial window sizes
4f90ecf: Fix format strings
2009-05-16 David Freese <w1hkj@w1hkj.com>
6b6cad9: PSK search algorithm
2009-05-12 Stelios Bounanos <vcs@enotty.net>
b95b8e1: Add win32 installer support
d626273: Fix VPATH builds
2009-05-05 David Freese <w1hkj@w1hkj.com>
b4112de: Added <RSID:on|off|t>, <AFC:on:off|t> macro tags
7ae826f: RTTY pseudo output, corrected stop bit inversion
2009-05-02 Stelios Bounanos <vcs@enotty.net>
ae5b9ca: Add more PNG text comments
974e1ec: Remove JPEG write support
44eceae: Fix xmlrpc-c m4 macro
2009-05-02 David Freese <w1hkj@w1hkj.com>
b030b4b: Fix OS dependent compile error
abc11f7: Updated memory mapped rig contol
2009-04-26 Stelios Bounanos <vcs@enotty.net>
31e1902: Add missing includes
6b2260c: Macro changes
8f37399: Fix possible trx_startup deadlock
edca452: Fix Makefile DEBUG flag
2009-04-25 David Freese <w1hkj@w1hkj.com>
affae09: CW default WPM (numeric keypad *) bug fix
2009-04-23 Stelios Bounanos <vcs@enotty.net>
f7309ef: Make the combo box popup modal
ed0ae5c: Fix OS X native file selector
88b3fd7: Fix uHRouter and parport PTT
9c63531: Fix format string
2009-04-23 David Freese <w1hkj@w1hkj.com>
8944198: CW replay bug
fc50717: CW Farnsworth timing addition
63ccc2f: MinGW serial i/o, hamlib, rigcat mods
2009-04-18 Stelios Bounanos <vcs@enotty.net>
206f815: Fix build without hamlib
2009-04-18 David Freese <w1hkj@w1hkj.com>
a9c21e5: Escape key bug fix
d2674d5: Macro <XOUT> parse error fix
2009-04-17 Stelios Bounanos <vcs@enotty.net>
9e060b8: Update version output
77bc966: Use band functions in logbook
2124791: Add functions to set the socket buffer size
4b1292c: Improve logging and error notification
d73c8fd: Add OS X and MinGW stack tracing
e192d1d: Add preliminary support for MinGW
01fd3d9: Change set_log macro
9d56656: Clean up headers
b4bf47f: Distribute cr.sh test script

12
NEWS
Wyświetl plik

@ -5,6 +5,8 @@
* Added new PSK-500 mode
* Added "robust PSK" modes: PSK-125R, PSK-250R, PSK-500R
* Added PSK63F mode, compatible with MultiPsk PSK63FEC
* Added Contestia support
* Added SSB "modem" to simplify logging of SSB QSOs
* Added MT63 modem preamble tones to aid signal acquisition
* Added selectable filter widths for Hellschreiber modes
* Added AGC and S/N detector for FM-HELL modes
@ -28,6 +30,11 @@
* Added <SRCHUP>, <SRCHDN>, <GOHOME>, <GOFREQ:nnnn> macros to search for a
signal up and down in frequency, go to the "sweet spot frequency", and
set the current modem frequency to ''nnnn''
* The <MODEM> macro syntax is now <MODEM:str>. The older <MODEM>str syntax is
still supported. Modem parameters may be specified when using the new
syntax; currently for RTTY (shift, baud, bits), Olivia (bw, tones) and
Contestia (bw, tones), e.g.: <MODEM:RTTY:170:45.45:5>, <MODEM:OLIVIA:500:16>,
<MODEM:CTSTIA:250:8>.
== User interface ==
@ -35,13 +42,14 @@
* The QSO toolbar can now be set to Contest mode, Minimal mode, Full mode,
and some combinations thereof
* The docked digiscope can be hidden and shown without a restart
* Is is now possible to select the modes for which to transmit RSID, VideoID
* It is now possible to select the modes for which to transmit RSID, VideoID
and CWID
* The Op Modes menu can now be customised
* Removed the floating rig control window
* Removed various Alt-<key> shortcuts
* Added a simple "wizard" for first-time users
* Added a waterfall-only mode; enabled with --wf-only
* Added a waterfall-only mode; enabled with --wfall-only
* Removed option to use check buttons for AFC and SQL toggles
== Other changes ==

Wyświetl plik

@ -9,10 +9,10 @@ dnl major and minor must be integers; patch may
dnl contain other characters or be empty
m4_define(FLDIGI_MAJOR, [3])
m4_define(FLDIGI_MINOR, [20])
m4_define(FLDIGI_PATCH, [.0b9])
m4_define(FLDIGI_PATCH, [.1])
m4_define(FLARQ_MAJOR, [4])
m4_define(FLARQ_MINOR, [3])
m4_define(FLARQ_PATCH, [.0b1])
m4_define(FLARQ_PATCH, [.1])
AC_INIT([dl-fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[]FLDIGI_PATCH, [fldigi-devel@lists.berlios.de])

Wyświetl plik

@ -22,15 +22,20 @@ AC_DEFUN([AC_FLDIGI_FLTK], [
if test $? -ne 0; then
AC_MSG_ERROR([$FLTK_CONFIG failed])
fi
if test "x$FLTK_API_VERSION" = "x1.1"; then
if test -n "$(expr $FLTK_API_VERSION : '1\.1[3]')"; then
HAVE_FLTK_API_VERSION=yes
fi
FLDIGI_FLTK_API_MAJOR=${FLTK_API_VERSION%%.*}
FLDIGI_FLTK_API_MINOR=${FLTK_API_VERSION#*.}; FLDIGI_FLTK_API_MINOR=${FLDIGI_FLTK_API_MINOR%%.*}
if test "${HAVE_FLTK_API_VERSION}" = "no"; then
AC_MSG_ERROR([
*** The version of FLTK found on your system provides API version $FLTK_API_VERSION.
*** To build $PACKAGE you need a FLTK version that provides API 1.1.
*** To build $PACKAGE you need a FLTK version that provides API 1.1, 1.2 or 1.3.
])
fi
if test $FLDIGI_FLTK_API_MINOR -gt 1; then
AC_MSG_WARN([$PACKAGE_TARNAME may not work with FLTK $FLTK_API_VERSION])
fi
FLTK_CFLAGS=`$FLTK_CONFIG --cxxflags`
if test "x$ac_cv_static" != "xyes"; then
FLTK_LIBS=`$FLTK_CONFIG --ldflags --use-images`
@ -43,6 +48,8 @@ AC_DEFUN([AC_FLDIGI_FLTK], [
AC_SUBST([FLTK_CFLAGS])
AC_SUBST([FLTK_LIBS])
AC_DEFINE_UNQUOTED([FLTK_BUILD_VERSION], ["`$FLTK_CONFIG --version`"], [FLTK version])
AC_DEFINE_UNQUOTED([FLDIGI_FLTK_API_MAJOR], [$FLDIGI_FLTK_API_MAJOR], [FLTK API major version])
AC_DEFINE_UNQUOTED([FLDIGI_FLTK_API_MINOR], [$FLDIGI_FLTK_API_MINOR], [FLTK API minor version])
AC_ARG_VAR([FLUID], [Fast Light User-Interface Designer])
AC_CHECK_PROG([FLUID], [fluid], [fluid])

Wyświetl plik

@ -1 +1 @@
cs fr
fr

Wyświetl plik

@ -244,6 +244,7 @@ dl_fldigi_SOURCES += \
cw_rtty/cw.cxx \
cw_rtty/morse.cxx \
cw_rtty/rtty.cxx \
contestia/contestia.cxx \
dialogs/colorsfonts.cxx \
dialogs/confdialog.cxx \
dialogs/fl_digi.cxx \
@ -271,6 +272,7 @@ dl_fldigi_SOURCES += \
include/FTextView.h \
include/FTextRXTX.h \
include/fileselect.h \
include/Fl_Text_Buffer_mod.H \
include/Fl_Text_Display_mod.H \
include/Fl_Text_Editor_mod.H \
include/Fl_Tile_Check.h \
@ -282,6 +284,7 @@ dl_fldigi_SOURCES += \
include/combo.h \
include/complex.h \
include/configuration.h \
include/contestia.h \
include/cw.h \
include/debug.h \
include/digiscope.h \
@ -370,6 +373,7 @@ dl_fldigi_SOURCES += \
include/soundconf.h \
include/spot.h \
include/ssdv_rx.h \
include/ssb.h \
include/stacktrace.h \
include/status.h \
include/strutil.h \
@ -471,6 +475,7 @@ dl_fldigi_SOURCES += \
spot/spot.cxx \
ssdv/ssdv_rx.cxx \
ssdv/rs8decode.c \
ssb/ssb.cxx \
throb/throb.cxx \
trx/modem.cxx \
trx/trx.cxx \
@ -480,6 +485,7 @@ dl_fldigi_SOURCES += \
waterfall/waterfall.cxx \
widgets/FTextView.cxx \
widgets/FTextRXTX.cxx \
widgets/Fl_Text_Buffer_mod.cxx \
widgets/Fl_Text_Display_mod.cxx \
widgets/Fl_Text_Editor_mod.cxx \
widgets/Fl_Tile_Check.cxx \
@ -517,6 +523,12 @@ EXTRA_dl_fldigi_SOURCES += \
feld/FeldStyl-14.cxx \
feld/FeldVert-14.cxx \
feld/FeldWide-14.cxx \
include/Fl_Text_Buffer_mod_1_1.H \
include/Fl_Text_Buffer_mod_1_3.H \
include/Fl_Text_Display_mod_1_1.H \
include/Fl_Text_Display_mod_1_3.H \
include/Fl_Text_Editor_mod_1_1.H \
include/Fl_Text_Editor_mod_1_3.H \
mfsk/mfsk-pic.cxx \
mt63/alias_1k.dat \
mt63/alias_2k.dat \
@ -525,7 +537,14 @@ EXTRA_dl_fldigi_SOURCES += \
mt63/alias_k5.dat \
mt63/mt63intl.dat \
trx/tune.cxx \
dialogs/guide.cxx
dialogs/guide.cxx \
widgets/Fl_Text_Buffer_mod_1_1.cxx \
widgets/Fl_Text_Buffer_mod_1_3.cxx \
widgets/Fl_Text_Display_mod_1_1.cxx \
widgets/Fl_Text_Display_mod_1_3.cxx \
widgets/Fl_Text_Editor_mod_1_1.cxx \
widgets/Fl_Text_Editor_mod_1_3.cxx
flarq_SOURCES += \
dialogs/font_browser.cxx \
@ -575,6 +594,7 @@ flarq_SOURCES += \
misc/re.cxx \
misc/socket.cxx \
misc/util.cxx \
widgets/Fl_Text_Buffer_mod.cxx \
widgets/Fl_Text_Display_mod.cxx \
widgets/Fl_Text_Editor_mod.cxx \
widgets/FTextView.cxx

Wyświetl plik

@ -0,0 +1,371 @@
// ----------------------------------------------------------------------------
// contestia.cxx -- CONTESTIA modem
//
// Copyright (C) 2006-2010
// Dave Freese, W1HKJ
//
// This file is part of fldigi. Adapted from code contained in gmfsk source code
// distribution.
// Copyright (C) 2005
// Tomi Manninen (oh2bns@sral.fi)
//
// This file is part of fldigi.
//
// Fldigi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Fldigi 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with fldigi. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#include <config.h>
#include <FL/Fl.H>
#include "contestia.h"
#include "modem.h"
#include "fl_digi.h"
#include "misc.h"
#include "confdialog.h"
#include "status.h"
#include "debug.h"
LOG_FILE_SOURCE(debug::LOG_MODEM);
using namespace std;
double contestia::nco(double freq)
{
preamblephase += 2.0 * M_PI * freq / samplerate;
if (preamblephase > M_PI)
preamblephase -= 2.0 * M_PI;
return cos(preamblephase);
}
void contestia::tx_init(SoundBase *sc)
{
unsigned char c;
scard = sc;
phaseacc = 0;
prevsymbol = complex (1.0, 0.0);
preamble = 32;
shreg = 0;
preamblesent = 0;
postamblesent = 0;
txbasefreq = get_txfreq_woffset();
Rx->Flush();
while (Rx->GetChar(c) > 0)
put_rx_char(c);
if (reverse) {
Tx->FirstCarrierMultiplier = (txbasefreq + (Tx->Bandwidth / 2)) / 500;
Tx->Reverse = 1;
} else {
Tx->FirstCarrierMultiplier = (txbasefreq - (Tx->Bandwidth / 2)) / 500;
Tx->Reverse = 0;
}
videoText();
Tx->Preset();
Tx->Start();
escape = 0;
}
void contestia::send_tones()
{
if (tone_midfreq != txbasefreq || tone_bw != bandwidth) {
double freqa, freqb;
tone_bw = bandwidth;
tone_midfreq = txbasefreq;
if (reverse) {
freqa = tone_midfreq + (tone_bw / 2.0);
freqb = tone_midfreq - (tone_bw / 2.0);
} else {
freqa = tone_midfreq - (tone_bw / 2.0);
freqb = tone_midfreq + (tone_bw / 2.0);
}
preamblephase = 0;
for (int i = 0; i < SR4; i++)
tonebuff[2*SR4 + i] = tonebuff[i] = nco(freqa) * ampshape[i];
preamblephase = 0;
for (int i = 0; i < SR4; i++)
tonebuff[3*SR4 + i] = tonebuff[SR4 + i] = nco(freqb) * ampshape[i];
}
for (int j = 0; j < TONE_DURATION; j += SCBLOCKSIZE)
ModulateXmtr(&tonebuff[j], SCBLOCKSIZE);
}
void contestia::rx_init()
{
Rx->Reset();
escape = 0;
}
int contestia::unescape(int c)
{
if (progdefaults.contestia8bit == 0)
return c;
if (escape) {
escape = 0;
return c + 128;
}
if (c == 127) {
escape = 1;
return -1;
}
return c;
}
int contestia::tx_process()
{
int c, len;//, i;
unsigned char ch;
if (tones != progdefaults.contestiatones ||
bw != progdefaults.contestiabw ||
smargin != progdefaults.contestiasmargin ||
sinteg != progdefaults.contestiasinteg )
restart();
if (preamblesent != 1) {
send_tones();
preamblesent = 1;
// Olivia Transmitter class requires at least character
Tx->PutChar(0);
}
// The encoder works with BitsPerSymbol length blocks. If the
// modem already has that many characters buffered, don't try
// to read any more. If stopflag is set, we will always read
// whatever there is.
if (stopflag || (Tx->GetReadReady() < Tx->BitsPerSymbol)) {
if (!stopflag && (c = get_tx_char()) == 0x03)
stopflag = true;
if (stopflag)
Tx->Stop();
else {
/* Replace un-representable characters with a dot */
if (c == -1)
c = 0;
if (c > (progdefaults.contestia8bit ? 255 : 127))
c = '.';
if (c > 127) {
c &= 127;
Tx->PutChar(127);
}
Tx->PutChar(c);
}
}
if (Tx->GetChar(ch) > 0)
if ((c = unescape(ch)) != -1)
put_echo_char(progdefaults.rx_lowercase ? tolower(c) : toupper(c));
if ((len = Tx->Output(txfbuffer)) > 0)
ModulateXmtr(txfbuffer, len);
if (stopflag && Tx->DoPostambleYet() == 1 && postamblesent != 1) {
postamblesent = 1;
send_tones();
}
if (!Tx->Running()) {
cwid();
stopflag = false;
return -1;
}
return 0;
}
int contestia::rx_process(const double *buf, int len)
{
int c;
unsigned char ch = 0;
static double snr = 1e-3;
static char msg1[20];
static char msg2[20];
if (tones != progdefaults.contestiatones ||
bw != progdefaults.contestiabw ||
smargin != progdefaults.contestiasmargin ||
sinteg != progdefaults.contestiasinteg )
restart();
if ((lastfreq != frequency || Rx->Reverse) && !reverse) {
Rx->FirstCarrierMultiplier = (frequency - (Rx->Bandwidth / 2)) / 500;
Rx->Reverse = 0;
lastfreq = frequency;
Rx->Preset();
}
else if ((lastfreq != frequency || !Rx->Reverse) && reverse) {
Rx->FirstCarrierMultiplier = (frequency + (Rx->Bandwidth / 2)) / 500;
Rx->Reverse = 1;
lastfreq = frequency;
Rx->Preset();
}
Rx->SyncThreshold = progStatus.sqlonoff ?
clamp(progStatus.sldrSquelchValue / 5.0 + 3.0, 3.0, 90.0) : 3.0;
Rx->Process(buf, len);
sp = 0;
for (int i = frequency - Rx->Bandwidth/2; i < frequency - 1 + Rx->Bandwidth/2; i++)
if (wf->Pwr(i) > sp)
sp = wf->Pwr(i);
np = wf->Pwr(frequency + Rx->Bandwidth/2 + 2*Rx->Bandwidth/Rx->Tones);
if (np == 0) np = sp + 1e-8;
sigpwr = decayavg( sigpwr, sp, 10);
noisepwr = decayavg( noisepwr, np, 50);
snr = CLAMP(sigpwr / noisepwr, 0.001, 100000);
metric = clamp( 5.0 * (Rx->SignalToNoiseRatio() - 3.0), 0, 100);
display_metric(metric);
bool gotchar = false;
while (Rx->GetChar(ch) > 0) {
if ((c = unescape(ch)) != -1 && c > 7) {
put_rx_char(progdefaults.rx_lowercase ? tolower(c) : c);
gotchar = true;
}
}
if (gotchar) {
snprintf(msg1, sizeof(msg1), "s/n: %4.1f dB", 10*log10(snr) - 20);
put_Status1(msg1, 5, STATUS_CLEAR);
snprintf(msg2, sizeof(msg2), "f/o %+4.1f Hz", Rx->FrequencyOffset());
put_Status2(msg2, 5, STATUS_CLEAR);
}
return 0;
}
void contestia::restart()
{
tones = progdefaults.contestiatones;
bw = progdefaults.contestiabw;
smargin = progdefaults.contestiasmargin;
sinteg = progdefaults.contestiasinteg;
samplerate = 8000;
bandwidth = 125 * (1 << bw);
Tx->Tones = 2 * (1 << tones);
Tx->Bandwidth = bandwidth;
Tx->SampleRate = samplerate;
Tx->OutputSampleRate = samplerate;
txbasefreq = get_txfreq_woffset();
Tx->bContestia = true;
if (reverse) {
Tx->FirstCarrierMultiplier = (txbasefreq + (Tx->Bandwidth / 2)) / 500;
Tx->Reverse = 1;
} else {
Tx->FirstCarrierMultiplier = (txbasefreq - (Tx->Bandwidth / 2)) / 500;
Tx->Reverse = 0;
}
if (Tx->Preset() < 0) {
LOG_ERROR("contestia: transmitter preset failed!");
return;
}
txbufferlen = Tx->MaxOutputLen;
if (txfbuffer) delete [] txfbuffer;
txfbuffer = new double[txbufferlen];
Rx->Tones = Tx->Tones;
Rx->Bandwidth = bandwidth;
Rx->SyncMargin = smargin;
Rx->SyncIntegLen = sinteg;
Rx->SyncThreshold = progStatus.sqlonoff ?
clamp(progStatus.sldrSquelchValue / 5.0 + 3.0, 0, 90.0) : 0.0;
Rx->SampleRate = samplerate;
Rx->InputSampleRate = samplerate;
Rx->bContestia = true;
if (reverse) {
Rx->FirstCarrierMultiplier = (frequency + (Rx->Bandwidth / 2)) / 500;
Rx->Reverse = 1;
} else {
Rx->FirstCarrierMultiplier = (frequency - (Rx->Bandwidth /2)) / 500;
Rx->Reverse = 0;
}
if (Rx->Preset() < 0) {
LOG_ERROR("contestia: receiver preset failed!");
return;
}
fragmentsize = 1024;
set_bandwidth(Tx->Bandwidth - Tx->Bandwidth / Tx->Tones);
put_MODEstatus("%s %" PRIuSZ "/%" PRIuSZ "", get_mode_name(), Tx->Tones, Tx->Bandwidth);
metric = 0;
sigpwr = 1e-10; noisepwr = 1e-8;
LOG_INFO("\nContestia Rx parameters:\n%s", Rx->PrintParameters());
}
void contestia::init()
{
restart();
modem::init();
set_scope_mode(Digiscope::BLANK);
}
contestia::contestia()
{
cap |= CAP_REV;
txfbuffer = 0;
samplerate = 8000;
Tx = new MFSK_Transmitter< double >;
Rx = new MFSK_Receiver< double >;
Tx->bContestia = true;
Rx->bContestia = true;
mode = MODE_CONTESTIA;
lastfreq = 0;
for (int i = 0; i < SR4; i++) ampshape[i] = 1.0;
for (int i = 0; i < SR4 / 8; i++)
ampshape[i] = ampshape[SR4 - 1 - i] = 0.5 * (1.0 - cos(M_PI * i / (SR4/8)));
for (int i = 0; i < TONE_DURATION; i++) tonebuff[i] = 0;
tone_bw = -1;
tone_midfreq = -1;
}
contestia::~contestia()
{
if (Tx) delete Tx;
if (Rx) delete Rx;
if (txfbuffer) delete [] txfbuffer;
}

Wyświetl plik

@ -66,7 +66,20 @@ void cw::rx_init()
void cw::init()
{
modem::init();
bool wfrev = wf->Reverse();
bool wfsb = wf->USB();
reverse = wfrev ^ !wfsb;
if (progdefaults.StartAtSweetSpot)
set_freq(progdefaults.CWsweetspot);
else if (progStatus.carrier != 0) {
set_freq(progStatus.carrier);
#if !BENCHMARK_MODE
progStatus.carrier = 0;
#endif
} else
set_freq(wf->Carrier());
trackingfilter->reset();
cw_adaptive_receive_threshold = (long int)trackingfilter->run(2 * cw_send_dot_length);
put_cwRcvWPM(cw_send_speed);
@ -347,7 +360,7 @@ int cw::rx_process(const double *buf, int len)
}
if (handle_event(CW_QUERY_EVENT, &c) == CW_SUCCESS) {
while (*c)
put_rx_char(*c++);
put_rx_char(progdefaults.rx_lowercase ? tolower(*c++) : *c++);
update_syncscope();
// display_metric(metric);
}
@ -782,7 +795,7 @@ void cw::send_ch(int ch)
flen -= symbollen;
}
if (flen) send_symbol(0, flen);
put_echo_char(ch);
put_echo_char(progdefaults.rx_lowercase ? tolower(ch) : ch);
return;
}

Wyświetl plik

@ -116,7 +116,20 @@ void rtty::rx_init()
void rtty::init()
{
modem::init();
bool wfrev = wf->Reverse();
bool wfsb = wf->USB();
reverse = wfrev ^ !wfsb;
if (progdefaults.StartAtSweetSpot)
set_freq(progdefaults.RTTYsweetspot);
else if (progStatus.carrier != 0) {
set_freq(progStatus.carrier);
#if !BENCHMARK_MODE
progStatus.carrier = 0;
#endif
} else
set_freq(wf->Carrier());
rx_init();
put_MODEstatus(mode);
snprintf(msg1, sizeof(msg1), "%-4.1f / %-4.0f", rtty_baud, rtty_shift);
@ -215,7 +228,7 @@ void rtty::restart()
rtty::rtty(trx_mode tty_mode)
{
cap = CAP_AFC | CAP_REV;
cap |= CAP_AFC | CAP_REV;
mode = tty_mode;
@ -389,11 +402,13 @@ bool rtty::rx(bool bit)
if (bit) {
if ((metric >= progStatus.sldrSquelchValue && progStatus.sqlonoff)|| !progStatus.sqlonoff) {
c = decode_char();
if ( c != 0 ) put_rx_char(c);
/* lb = estimated bytes lost */
lb = (lost - bytelen / 2) / bytelen;
put_rx_ssdv(c, lb);
if ( c != 0 )
put_rx_char(progdefaults.rx_lowercase ? tolower(c) : c);
}
flag = true;
lost = 0;
@ -711,7 +726,7 @@ void rtty::send_char(int c)
else
c = figures[c];
if (c)
put_echo_char(c);
put_echo_char(progdefaults.rx_lowercase ? tolower(c) : c);
}
}

Wyświetl plik

@ -293,6 +293,7 @@ Fl_Double_Window* createViewer(void)
cols[0] = labelwidth[progdefaults.VIEWERlabeltype];
int viewerwidth = (progStatus.VIEWERnchars * cwidth) + cols[0] + sbarwidth + border;
int minwidth = (30 * cwidth) + cols[0] + sbarwidth + border;
int viewerheight = 40 + cheight * progdefaults.VIEWERchannels;
int pad = border/2;
@ -305,7 +306,7 @@ Fl_Double_Window* createViewer(void)
// search field
const char* label = _("Find: ");
fl_font(FL_HELVETICA, FL_NORMAL_SIZE);
inpSeek = new Fl_Input2(2 * border + fl_width(label), border, 200, g->h(), label);
inpSeek = new Fl_Input2(static_cast<int>(2 * border + fl_width(label)), border, 200, g->h(), label);
inpSeek->callback((Fl_Callback*)cb_Seek);
inpSeek->when(FL_WHEN_CHANGED);
inpSeek->textfont(FL_COURIER);
@ -356,7 +357,7 @@ Fl_Double_Window* createViewer(void)
w->end();
w->callback((Fl_Callback*)cb_btnCloseViewer);
w->resizable(brwsViewer);
w->size_range(w->w(), w->h() - brwsViewer->h() + 20);
w->size_range(minwidth, w->h() - brwsViewer->h() + 20);
w->xclass(PACKAGE_NAME);
return w;
@ -384,12 +385,12 @@ void viewer_redraw()
brwsViewer->column_widths(cols);
}
void viewaddchr(int ch, int freq, char c)
void viewaddchr(int ch, int freq, char c, int md)
{
if (!dlgViewer) return;
if (progStatus.spot_recv)
spot_recv(c, ch, freq);
spot_recv(c, ch, freq, md);
if (rfc != wf->rfcarrier() || usb != wf->USB()) viewer_redraw();

Wyświetl plik

@ -92,6 +92,23 @@ void cbViewerFontBrowser(Fl_Widget*, void*) {
font_browser->hide();
}
void cbFreqControlFontBrowser(Fl_Widget*, void*) {
Fl_Font fnt = font_browser->fontNumber();
progdefaults.FreqControlFontnbr = fnt;
progdefaults.changed = true;
FDdisplay->labelfont(progdefaults.FreqControlFontnbr);
FDdisplay->redraw();
qsoFreqDisp1->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp2->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp3->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp1->redraw();
qsoFreqDisp2->redraw();
qsoFreqDisp3->redraw();
font_browser->hide();
}
Fl_Double_Window *dlgColorFont=(Fl_Double_Window *)0;
Fl_Button *btnClrFntClose=(Fl_Button *)0;
@ -104,6 +121,18 @@ Fl_Tabs *tabsColors=(Fl_Tabs *)0;
Fl_Box *FDdisplay=(Fl_Box *)0;
Fl_Button *btn_freq_control_font=(Fl_Button *)0;
static void cb_btn_freq_control_font(Fl_Button*, void*) {
font_browser->fontNumber(progdefaults.FreqControlFontnbr);
font_browser->fontSize(14);
font_browser->fontColor(FL_FOREGROUND_COLOR);
font_browser->fontFilter(Font_Browser::FIXED_WIDTH);
font_browser->fontFilter(Font_Browser::ALL_TYPES);
font_browser->callback(cbFreqControlFontBrowser);
font_browser->show();
}
Fl_Button *btnBackgroundColor=(Fl_Button *)0;
static void cb_btnBackgroundColor(Fl_Button*, void*) {
@ -723,21 +752,25 @@ Fl_Double_Window* make_colorsfonts() {
} // Fl_Button* btnClrFntClose
{ tabsColors = new Fl_Tabs(0, 5, 375, 185);
{ Fl_Group* o = new Fl_Group(5, 30, 365, 150, _("Freq Disp"));
{ Fl_Box* o = FDdisplay = new Fl_Box(100, 45, 45, 67, _("8"));
{ Fl_Box* o = FDdisplay = new Fl_Box(65, 43, 235, 45, _("14070.150"));
FDdisplay->box(FL_DOWN_BOX);
FDdisplay->color((Fl_Color)55);
FDdisplay->labelfont(4);
FDdisplay->labelsize(48);
FDdisplay->labelsize(40);
o->color(fl_rgb_color(progdefaults.FDbackground.R,progdefaults.FDbackground.G,progdefaults.FDbackground.B));
o->labelcolor(fl_rgb_color(progdefaults.FDforeground.R,progdefaults.FDforeground.G,progdefaults.FDforeground.B));
o->labelfont(progdefaults.FreqControlFontnbr);
} // Fl_Box* FDdisplay
{ btnBackgroundColor = new Fl_Button(165, 45, 100, 30, _("Background"));
{ btn_freq_control_font = new Fl_Button(144, 96, 87, 24, _("Font"));
btn_freq_control_font->callback((Fl_Callback*)cb_btn_freq_control_font);
} // Fl_Button* btn_freq_control_font
{ btnBackgroundColor = new Fl_Button(35, 131, 87, 24, _("Bg Color"));
btnBackgroundColor->callback((Fl_Callback*)cb_btnBackgroundColor);
} // Fl_Button* btnBackgroundColor
{ btnForegroundColor = new Fl_Button(165, 85, 100, 30, _("Foreground"));
{ btnForegroundColor = new Fl_Button(144, 131, 87, 24, _("Digit Color"));
btnForegroundColor->callback((Fl_Callback*)cb_btnForegroundColor);
} // Fl_Button* btnForegroundColor
{ btnFD_SystemColor = new Fl_Button(165, 125, 100, 30, _("System"));
{ btnFD_SystemColor = new Fl_Button(259, 131, 87, 24, _("Sys Colors"));
btnFD_SystemColor->callback((Fl_Callback*)cb_btnFD_SystemColor);
} // Fl_Button* btnFD_SystemColor
o->end();

Wyświetl plik

@ -114,11 +114,29 @@ Function {cbViewerFontBrowser(Fl_Widget*, void*)} {open return_type void
font_browser->hide();} {}
}
Function {cbFreqControlFontBrowser(Fl_Widget*, void*)} {open return_type void
} {
code {Fl_Font fnt = font_browser->fontNumber();
progdefaults.FreqControlFontnbr = fnt;
progdefaults.changed = true;
FDdisplay->labelfont(progdefaults.FreqControlFontnbr);
FDdisplay->redraw();
qsoFreqDisp1->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp2->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp3->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp1->redraw();
qsoFreqDisp2->redraw();
qsoFreqDisp3->redraw();
font_browser->hide();} {}
}
Function {make_colorsfonts()} {open
} {
code {font_browser = new Font_Browser;} {}
Fl_Window dlgColorFont {
label {Colors and Fonts} open selected
label {Colors and Fonts} open
xywh {496 125 375 220} type Double
code0 {dlgColorFont->xclass(PACKAGE_TARNAME);} visible
} {
@ -135,13 +153,25 @@ Function {make_colorsfonts()} {open
xywh {5 30 365 150}
} {
Fl_Box FDdisplay {
label 8
xywh {100 45 45 67} box DOWN_BOX color 55 labelfont 4 labelsize 48
label {14070.150} selected
xywh {65 43 235 45} box DOWN_BOX color 55 labelfont 4 labelsize 40
code0 {o->color(fl_rgb_color(progdefaults.FDbackground.R,progdefaults.FDbackground.G,progdefaults.FDbackground.B));}
code1 {o->labelcolor(fl_rgb_color(progdefaults.FDforeground.R,progdefaults.FDforeground.G,progdefaults.FDforeground.B));}
code2 {o->labelfont(progdefaults.FreqControlFontnbr);}
}
Fl_Button btn_freq_control_font {
label Font
callback {font_browser->fontNumber(progdefaults.FreqControlFontnbr);
font_browser->fontSize(14);
font_browser->fontColor(FL_FOREGROUND_COLOR);
font_browser->fontFilter(Font_Browser::FIXED_WIDTH);
font_browser->fontFilter(Font_Browser::ALL_TYPES);
font_browser->callback(cbFreqControlFontBrowser);
font_browser->show();}
xywh {144 96 87 24}
}
Fl_Button btnBackgroundColor {
label Background
label {Bg Color}
callback {uchar r, g, b;
r = progdefaults.FDbackground.R;
g = progdefaults.FDbackground.G;
@ -169,10 +199,10 @@ Function {make_colorsfonts()} {open
}
progdefaults.changed = true;}
xywh {165 45 100 30}
xywh {35 131 87 24}
}
Fl_Button btnForegroundColor {
label Foreground
label {Digit Color}
callback {uchar r, g, b;
r = progdefaults.FDforeground.R;
g = progdefaults.FDforeground.G;
@ -200,10 +230,10 @@ Function {make_colorsfonts()} {open
}
progdefaults.changed = true;}
xywh {165 85 100 30}
xywh {144 131 87 24}
}
Fl_Button btnFD_SystemColor {
label System
label {Sys Colors}
callback {uchar r, g, b;
Fl_Color clr = FL_BACKGROUND2_COLOR;
@ -237,7 +267,7 @@ Function {make_colorsfonts()} {open
}
progdefaults.changed = true;}
xywh {165 125 100 30}
xywh {259 131 87 24}
}
}
Fl_Group {} {

Wyświetl plik

@ -466,12 +466,10 @@ progdefaults.changed = true;
WF_UI();
}
Fl_Group *tabWfallRestart=(Fl_Group *)0;
Fl_Check_Button *btn_rx_lowercase=(Fl_Check_Button *)0;
Fl_Check_Button *btnCheckButtons=(Fl_Check_Button *)0;
static void cb_btnCheckButtons(Fl_Check_Button* o, void*) {
progdefaults.useCheckButtons = o->value();
static void cb_btn_rx_lowercase(Fl_Check_Button* o, void*) {
progdefaults.rx_lowercase = o->value();
progdefaults.changed = true;
}
@ -1091,6 +1089,49 @@ static void cb_btnOlivia_8bit(Fl_Check_Button* o, void*) {
progdefaults.changed = true;
}
Fl_Group *tabContestia=(Fl_Group *)0;
Fl_Choice *mnuContestia_Bandwidth=(Fl_Choice *)0;
static void cb_mnuContestia_Bandwidth(Fl_Choice* o, void*) {
progdefaults.contestiabw = o->value();
set_contestia_default_integ();
resetOLIVIA();
progdefaults.changed = true;
}
Fl_Choice *mnuContestia_Tones=(Fl_Choice *)0;
static void cb_mnuContestia_Tones(Fl_Choice* o, void*) {
progdefaults.contestiatones = o->value();
set_contestia_default_integ();
resetCONTESTIA();
progdefaults.changed = true;
}
Fl_Counter2 *cntContestia_smargin=(Fl_Counter2 *)0;
static void cb_cntContestia_smargin(Fl_Counter2* o, void*) {
progdefaults.contestiasmargin = (int)(o->value());
resetCONTESTIA();
progdefaults.changed = true;
}
Fl_Counter2 *cntContestia_sinteg=(Fl_Counter2 *)0;
static void cb_cntContestia_sinteg(Fl_Counter2* o, void*) {
progdefaults.contestiasinteg = (int)(o->value());
resetCONTESTIA();
progdefaults.changed = true;
}
Fl_Check_Button *btnContestia_8bit=(Fl_Check_Button *)0;
static void cb_btnContestia_8bit(Fl_Check_Button* o, void*) {
progdefaults.contestia8bit = o->value();
progdefaults.changed = true;
}
Fl_Group *tabPSK=(Fl_Group *)0;
Fl_Tabs *tabsPSK=(Fl_Tabs *)0;
@ -2583,6 +2624,8 @@ static const char szParity[] = "none|even|odd|zero|one";
static const char szStopBits[] = "1|1.5|2";
static const char szOliviaTones[] = "2|4|8|16|32|64|128|256";
static const char szOliviaBandwidth[] = "125|250|500|1000|2000";
static const char szContestiaTones[] = "2|4|8|16|32|64|128|256";
static const char szContestiaBandwidth[] = "125|250|500|1000|2000";
static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600|115200|230400|460800";
{ Fl_Double_Window* o = new Fl_Double_Window(500, 400, _("Fldigi configuration"));
w = o;
@ -2590,9 +2633,9 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
o->selection_color((Fl_Color)51);
o->labelsize(18);
o->align(FL_ALIGN_CLIP|FL_ALIGN_INSIDE);
{ tabsConfigure = new Fl_Tabs(-3, 0, 503, 375);
tabsConfigure->color(FL_LIGHT1);
tabsConfigure->selection_color(FL_LIGHT1);
{ tabsConfigure = new Fl_Tabs(-3, 0, 500, 372);
tabsConfigure->color((Fl_Color)FL_LIGHT1);
tabsConfigure->selection_color((Fl_Color)FL_LIGHT1);
{ tabOperator = new Fl_Group(0, 25, 500, 345, _("Operator"));
tabOperator->tooltip(_("Operator information"));
tabOperator->labelsize(12);
@ -2717,13 +2760,11 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
} // Fl_Input* MyRadio
tabOperator->end();
} // Fl_Group* tabOperator
{ tabUI = new Fl_Group(-3, 25, 503, 345, _("UI"));
tabUI->labelsize(12);
{ tabUI = new Fl_Group(0, 25, 500, 345, _("UI"));
tabUI->hide();
{ tabsUI = new Fl_Tabs(-3, 25, 503, 345);
tabsUI->selection_color(FL_LIGHT1);
{ tabUserInterface = new Fl_Group(0, 50, 500, 320, _("General"));
tabUserInterface->hide();
{ Fl_Group* o = new Fl_Group(5, 60, 490, 301);
o->box(FL_ENGRAVED_FRAME);
{ Fl_Check_Button* o = btnShowTooltips = new Fl_Check_Button(15, 70, 120, 20, _("Show tooltips"));
@ -2986,7 +3027,8 @@ ab and newline are automatically included."));
} // Fl_Group* o
tabContest->end();
} // Fl_Group* tabContest
{ tabWF_UI = new Fl_Group(0, 50, 500, 320, _("Oper\' Controls"));
{ tabWF_UI = new Fl_Group(0, 50, 500, 320, _("Operator Controls"));
tabWF_UI->hide();
{ Fl_Box* o = new Fl_Box(31, 65, 446, 25, _("Enable check box to show each respective operator control"));
o->box(FL_FLAT_BOX);
o->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
@ -3065,22 +3107,15 @@ ab and newline are automatically included."));
} // Fl_Button* btn_wf_disable_all
tabWF_UI->end();
} // Fl_Group* tabWF_UI
{ tabWfallRestart = new Fl_Group(0, 50, 500, 320, _("Restart"));
tabWfallRestart->hide();
{ Fl_Group* o = new Fl_Group(5, 63, 490, 70, _("Changes take effect on next program startup"));
o->tooltip(_("Show me more or less waterfall"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP|FL_ALIGN_INSIDE);
{ Fl_Check_Button* o = btnCheckButtons = new Fl_Check_Button(52, 93, 275, 20, _("Use check buttons for AFC and SQL"));
btnCheckButtons->tooltip(_("Check buttons or default lighted switch"));
btnCheckButtons->down_box(FL_DOWN_BOX);
btnCheckButtons->callback((Fl_Callback*)cb_btnCheckButtons);
o->value(progdefaults.useCheckButtons);
} // Fl_Check_Button* btnCheckButtons
o->end();
} // Fl_Group* o
tabWfallRestart->end();
} // Fl_Group* tabWfallRestart
{ Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("Rx Text"));
o->hide();
{ Fl_Check_Button* o = btn_rx_lowercase = new Fl_Check_Button(25, 75, 389, 15, _("print CW / RTTY / THROB / CONTESTIA in lowercase"));
btn_rx_lowercase->down_box(FL_DOWN_BOX);
btn_rx_lowercase->callback((Fl_Callback*)cb_btn_rx_lowercase);
o->value(progdefaults.rx_lowercase);
} // Fl_Check_Button* btn_rx_lowercase
o->end();
} // Fl_Group* o
tabsUI->end();
} // Fl_Tabs* tabsUI
tabUI->end();
@ -3092,6 +3127,7 @@ ab and newline are automatically included."));
tabsWaterfall->color(FL_LIGHT1);
tabsWaterfall->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("Display"));
o->hide();
{ Fl_Group* o = new Fl_Group(5, 60, 490, 162, _("Colors and cursors"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
@ -3107,6 +3143,7 @@ ab and newline are automatically included."));
WF_Palette->align(FL_ALIGN_TOP_LEFT);
WF_Palette->when(FL_WHEN_RELEASE);
o->label(progdefaults.PaletteName.c_str());
o->labelsize(FL_NORMAL_SIZE);
} // colorbox* WF_Palette
{ btnColor[0] = new Fl_Button(15, 128, 20, 24);
btnColor[0]->tooltip(_("Change color"));
@ -3234,7 +3271,7 @@ ab and newline are automatically included."));
valTxMonitorLevel->align(FL_ALIGN_TOP);
valTxMonitorLevel->when(FL_WHEN_CHANGED);
o->value(progdefaults.TxMonitorLevel);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* valTxMonitorLevel
o->end();
} // Fl_Group* o
@ -3352,7 +3389,6 @@ an merging"));
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("Mouse"));
o->hide();
{ Fl_Group* o = new Fl_Group(5, 62, 490, 170);
o->box(FL_ENGRAVED_FRAME);
{ Fl_Check_Button* o = btnWaterfallHistoryDefault = new Fl_Check_Button(15, 76, 340, 20, _("Left or right click always replays audio history"));
@ -3401,10 +3437,9 @@ an merging"));
tabWaterfall->end();
} // Fl_Group* tabWaterfall
{ tabModems = new Fl_Group(0, 25, 500, 345, _("Modems"));
tabModems->labelsize(12);
tabModems->hide();
{ tabsModems = new Fl_Tabs(0, 25, 500, 345);
tabsModems->selection_color(FL_LIGHT1);
{ tabsModems = new Fl_Tabs(0, 25, 501, 345);
tabsModems->selection_color((Fl_Color)FL_LIGHT1);
tabsModems->align(FL_ALIGN_TOP_RIGHT);
{ tabCW = new Fl_Group(0, 50, 500, 320, _("CW"));
tabCW->hide();
@ -3434,7 +3469,7 @@ an merging"));
sldrCWbandwidth->align(FL_ALIGN_RIGHT);
sldrCWbandwidth->when(FL_WHEN_CHANGED);
o->value(progdefaults.CWbandwidth);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* sldrCWbandwidth
{ Fl_Check_Button* o = btnCWrcvTrack = new Fl_Check_Button(40, 150, 80, 20, _("Tracking"));
btnCWrcvTrack->tooltip(_("Automatic Rx speed tracking"));
@ -3500,7 +3535,7 @@ an merging"));
sldrCWxmtWPM->align(FL_ALIGN_RIGHT);
sldrCWxmtWPM->when(FL_WHEN_CHANGED);
o->value(progdefaults.CWspeed);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* sldrCWxmtWPM
{ Fl_Counter2* o = cntCWdefWPM = new Fl_Counter2(40, 281, 64, 20, _("Default"));
cntCWdefWPM->tooltip(_("The default CW speed"));
@ -3565,7 +3600,7 @@ an merging"));
sldrCWfarnsworth->align(FL_ALIGN_RIGHT);
sldrCWfarnsworth->when(FL_WHEN_CHANGED);
o->value(progdefaults.CWfarnsworth);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* sldrCWfarnsworth
{ Fl_Check_Button* o = btnCWusefarnsworth = new Fl_Check_Button(40, 312, 180, 15, _("Use Farnsworth timing"));
btnCWusefarnsworth->down_box(FL_DOWN_BOX);
@ -3726,7 +3761,7 @@ an merging"));
} // Fl_Tabs* tabsCW
tabCW->end();
} // Fl_Group* tabCW
{ tabDomEX = new Fl_Group(0, 50, 500, 320, _("DominoEX"));
{ tabDomEX = new Fl_Group(0, 50, 500, 320, _("DomEX"));
tabDomEX->hide();
{ Fl_Group* o = new Fl_Group(5, 60, 490, 180);
o->box(FL_ENGRAVED_FRAME);
@ -3792,7 +3827,7 @@ an merging"));
valDomCWI->align(FL_ALIGN_TOP);
valDomCWI->when(FL_WHEN_CHANGED);
o->value(progdefaults.DomCWI);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* valDomCWI
{ Fl_Counter2* o = valDominoEX_PATHS = new Fl_Counter2(339, 194, 63, 20, _("Paths (hidden)"));
valDominoEX_PATHS->type(1);
@ -3887,7 +3922,7 @@ an merging"));
sldrHellBW->align(FL_ALIGN_TOP_LEFT);
sldrHellBW->when(FL_WHEN_CHANGED);
o->value(progdefaults.HELL_BW);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* sldrHellBW
{ Fl_Check_Button* o = btnFeldHellIdle = new Fl_Check_Button(15, 177, 230, 20, _("Transmit periods (.) when idle"));
btnFeldHellIdle->tooltip(_("Transmits a diddle dot when no keyboard activity"));
@ -4035,7 +4070,80 @@ an merging"));
} // Fl_Group* o
tabOlivia->end();
} // Fl_Group* tabOlivia
{ tabPSK = new Fl_Group(0, 50, 500, 320, _("PSK"));
{ tabContestia = new Fl_Group(0, 50, 500, 320, _("Contestia"));
tabContestia->hide();
{ Fl_Group* o = new Fl_Group(5, 60, 490, 200);
o->box(FL_ENGRAVED_FRAME);
{ Fl_Choice* o = mnuContestia_Bandwidth = new Fl_Choice(60, 80, 85, 20, _("Bandwidth"));
mnuContestia_Bandwidth->tooltip(_("Select bandwidth"));
mnuContestia_Bandwidth->down_box(FL_BORDER_BOX);
mnuContestia_Bandwidth->callback((Fl_Callback*)cb_mnuContestia_Bandwidth);
mnuContestia_Bandwidth->align(FL_ALIGN_RIGHT);
o->add(szContestiaBandwidth);
o->value(2);
} // Fl_Choice* mnuContestia_Bandwidth
{ Fl_Choice* o = mnuContestia_Tones = new Fl_Choice(321, 80, 70, 20, _("Tones"));
mnuContestia_Tones->tooltip(_("Select number of tones"));
mnuContestia_Tones->down_box(FL_BORDER_BOX);
mnuContestia_Tones->callback((Fl_Callback*)cb_mnuContestia_Tones);
mnuContestia_Tones->align(FL_ALIGN_RIGHT);
o->add(szContestiaTones);
o->value(2);
} // Fl_Choice* mnuContestia_Tones
{ Fl_Group* o = new Fl_Group(60, 119, 379, 100, _("Receive synchronizer"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ Fl_Counter2* o = cntContestia_smargin = new Fl_Counter2(80, 150, 70, 20, _("Tune margin (tone frequency spacing)"));
cntContestia_smargin->tooltip(_("Change ONLY to experiment"));
cntContestia_smargin->type(1);
cntContestia_smargin->box(FL_UP_BOX);
cntContestia_smargin->color((Fl_Color)FL_BACKGROUND_COLOR);
cntContestia_smargin->selection_color((Fl_Color)FL_INACTIVE_COLOR);
cntContestia_smargin->labeltype(FL_NORMAL_LABEL);
cntContestia_smargin->labelfont(0);
cntContestia_smargin->labelsize(14);
cntContestia_smargin->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
cntContestia_smargin->minimum(2);
cntContestia_smargin->maximum(128);
cntContestia_smargin->step(1);
cntContestia_smargin->value(8);
cntContestia_smargin->callback((Fl_Callback*)cb_cntContestia_smargin);
cntContestia_smargin->align(FL_ALIGN_RIGHT);
cntContestia_smargin->when(FL_WHEN_CHANGED);
o->labelsize(FL_NORMAL_SIZE);
} // Fl_Counter2* cntContestia_smargin
{ Fl_Counter2* o = cntContestia_sinteg = new Fl_Counter2(80, 180, 70, 20, _("Integration period (FEC blocks)"));
cntContestia_sinteg->tooltip(_("Change ONLY to experiment"));
cntContestia_sinteg->type(1);
cntContestia_sinteg->box(FL_UP_BOX);
cntContestia_sinteg->color((Fl_Color)FL_BACKGROUND_COLOR);
cntContestia_sinteg->selection_color((Fl_Color)FL_INACTIVE_COLOR);
cntContestia_sinteg->labeltype(FL_NORMAL_LABEL);
cntContestia_sinteg->labelfont(0);
cntContestia_sinteg->labelsize(14);
cntContestia_sinteg->labelcolor((Fl_Color)FL_FOREGROUND_COLOR);
cntContestia_sinteg->minimum(2);
cntContestia_sinteg->maximum(128);
cntContestia_sinteg->step(1);
cntContestia_sinteg->value(4);
cntContestia_sinteg->callback((Fl_Callback*)cb_cntContestia_sinteg);
cntContestia_sinteg->align(FL_ALIGN_RIGHT);
cntContestia_sinteg->when(FL_WHEN_CHANGED);
o->labelsize(FL_NORMAL_SIZE);
} // Fl_Counter2* cntContestia_sinteg
o->end();
} // Fl_Group* o
{ btnContestia_8bit = new Fl_Check_Button(60, 229, 200, 20, _("8-bit extended characters"));
btnContestia_8bit->tooltip(_("Enable this for Latin-1 accented characters"));
btnContestia_8bit->down_box(FL_DOWN_BOX);
btnContestia_8bit->callback((Fl_Callback*)cb_btnContestia_8bit);
btnContestia_8bit->hide();
} // Fl_Check_Button* btnContestia_8bit
o->end();
} // Fl_Group* o
tabContestia->end();
} // Fl_Group* tabContestia
{ tabPSK = new Fl_Group(0, 50, 517, 320, _("PSK"));
tabPSK->hide();
{ tabsPSK = new Fl_Tabs(0, 50, 500, 320);
tabsPSK->selection_color(FL_LIGHT1);
@ -4262,7 +4370,7 @@ an merging"));
btnCRCRLF->when(FL_WHEN_RELEASE_ALWAYS);
o->value(progdefaults.rtty_crcrlf);
} // Fl_Check_Button* btnCRCRLF
{ cntrAUTOCRLF = new Fl_Counter2(335, 118, 65, 20, _("characters"));
{ Fl_Counter2* o = cntrAUTOCRLF = new Fl_Counter2(335, 118, 65, 20, _("characters"));
cntrAUTOCRLF->tooltip(_("Set page width"));
cntrAUTOCRLF->type(1);
cntrAUTOCRLF->box(FL_UP_BOX);
@ -4279,6 +4387,7 @@ an merging"));
cntrAUTOCRLF->callback((Fl_Callback*)cb_cntrAUTOCRLF);
cntrAUTOCRLF->align(FL_ALIGN_RIGHT);
cntrAUTOCRLF->when(FL_WHEN_CHANGED);
o->labelsize(FL_NORMAL_SIZE);
} // Fl_Counter2* cntrAUTOCRLF
{ Fl_Box* o = new Fl_Box(265, 118, 60, 20, _("after:"));
o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
@ -4347,7 +4456,7 @@ an merging"));
sldrRTTYbandwidth->align(FL_ALIGN_TOP_LEFT);
sldrRTTYbandwidth->when(FL_WHEN_CHANGED);
o->value(progdefaults.RTTY_BW);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* sldrRTTYbandwidth
{ Fl_Counter2* o = selCustomShift = new Fl_Counter2(15, 100, 100, 20, _("Custom shift"));
selCustomShift->tooltip(_("Input carrier shift"));
@ -4432,7 +4541,7 @@ an merging"));
valThorCWI->align(FL_ALIGN_TOP);
valThorCWI->when(FL_WHEN_CHANGED);
o->value(progdefaults.ThorCWI);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* valThorCWI
{ Fl_Counter2* o = valTHOR_PATHS = new Fl_Counter2(353, 193, 75, 21, _("Paths (hidden)"));
valTHOR_PATHS->type(1);
@ -5167,7 +5276,7 @@ ll with your audio device."));
valPCMvolume->callback((Fl_Callback*)cb_valPCMvolume);
valPCMvolume->align(FL_ALIGN_RIGHT);
valPCMvolume->when(FL_WHEN_CHANGED);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* valPCMvolume
o->end();
} // Fl_Group* o
@ -5236,7 +5345,7 @@ ll with your audio device."));
sldrVideowidth->when(FL_WHEN_CHANGED);
o->value(progdefaults.videowidth);
if (progdefaults.ID_SMALL) o->deactivate();
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* sldrVideowidth
{ bVideoIDModes = new Fl_Button(365, 67, 120, 20, _("Video ID modes"));
bVideoIDModes->callback((Fl_Callback*)cb_bVideoIDModes);
@ -5271,7 +5380,7 @@ ll with your audio device."));
sldrCWIDwpm->align(FL_ALIGN_TOP);
sldrCWIDwpm->when(FL_WHEN_CHANGED);
o->value(progdefaults.CWIDwpm);
o->labelsize(FL_NORMAL_SIZE);
o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);
} // Fl_Value_Slider2* sldrCWIDwpm
{ bCWIDModes = new Fl_Button(365, 185, 120, 20, _("CW ID modes"));
bCWIDModes->callback((Fl_Callback*)cb_bCWIDModes);

Wyświetl plik

@ -89,6 +89,8 @@ static const char szParity[] = "none|even|odd|zero|one";
static const char szStopBits[] = "1|1.5|2";
static const char szOliviaTones[] = "2|4|8|16|32|64|128|256";
static const char szOliviaBandwidth[] = "125|250|500|1000|2000";
static const char szContestiaTones[] = "2|4|8|16|32|64|128|256";
static const char szContestiaBandwidth[] = "125|250|500|1000|2000";
static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600|115200|230400|460800";} {}
code {} {}
Fl_Window {} {
@ -96,12 +98,12 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
xywh {832 622 500 400} type Double color 45 selection_color 51 labelsize 18 align 80 visible
} {
Fl_Tabs tabsConfigure {open
xywh {-3 0 503 375} color 50 selection_color 50
xywh {-3 0 500 372} color 50 selection_color 50
} {
Fl_Group tabOperator {
label Operator
callback {progdefaults.changed = true;} open
tooltip {Operator information} xywh {0 25 500 345} labelsize 12 when 1 hide
callback {progdefaults.changed = true;} selected
tooltip {Operator information} xywh {0 25 500 345} when 1
} {
Fl_Group {} {
label Station open
@ -202,14 +204,14 @@ progdefaults.changed = true;}
}
Fl_Group tabUI {
label UI open
xywh {-3 25 503 345} labelsize 12 hide
xywh {0 25 500 345} hide
} {
Fl_Tabs tabsUI {open
xywh {-3 25 503 345} selection_color 50
} {
Fl_Group tabUserInterface {
label General open
xywh {0 50 500 320} hide
label General
xywh {0 50 500 320}
} {
Fl_Group {} {open
xywh {5 60 490 301} box ENGRAVED_FRAME
@ -324,7 +326,7 @@ progdefaults.changed = true;}
}
}
Fl_Group tabContest {
label Contest open
label Contest
xywh {0 50 500 320} hide
} {
Fl_Group {} {
@ -464,8 +466,8 @@ progdefaults.changed = true;}
}
}
Fl_Group tabWF_UI {
label {Oper' Controls} open
xywh {0 50 500 320}
label {Operator Controls}
xywh {0 50 500 320} hide
} {
Fl_Box {} {
label {Enable check box to show each respective operator control}
@ -598,35 +600,30 @@ WF_UI();}
xywh {301 321 88 20}
}
}
Fl_Group tabWfallRestart {
label Restart open
Fl_Group {} {
label {Rx Text} open
xywh {0 50 500 320} hide
} {
Fl_Group {} {
label {Changes take effect on next program startup} open
tooltip {Show me more or less waterfall} xywh {5 63 490 70} box ENGRAVED_FRAME align 17
} {
Fl_Check_Button btnCheckButtons {
label {Use check buttons for AFC and SQL}
callback {progdefaults.useCheckButtons = o->value();
Fl_Check_Button btn_rx_lowercase {
label {print CW / RTTY / THROB / CONTESTIA in lowercase}
callback {progdefaults.rx_lowercase = o->value();
progdefaults.changed = true;}
tooltip {Check buttons or default lighted switch} xywh {52 93 275 20} down_box DOWN_BOX
code0 {o->value(progdefaults.useCheckButtons);}
}
xywh {25 75 389 15} down_box DOWN_BOX
code0 {o->value(progdefaults.rx_lowercase);}
}
}
}
}
Fl_Group tabWaterfall {
label Waterfall open
xywh {0 25 500 347} labelsize 12 hide
label Waterfall
xywh {0 25 500 347} hide
} {
Fl_Tabs tabsWaterfall {open
xywh {0 25 500 347} color 50 selection_color 50
} {
Fl_Group {} {
label Display open
xywh {0 50 500 320}
xywh {0 50 500 320} hide
} {
Fl_Group {} {
label {Colors and cursors} open
@ -637,6 +634,7 @@ progdefaults.changed = true;}
xywh {15 98 260 24} box DOWN_BOX color 0 labelsize 12 align 5
code0 {\#include "colorbox.h"}
code1 {o->label(progdefaults.PaletteName.c_str());}
code2 {o->labelsize(FL_NORMAL_SIZE);}
class colorbox
}
Fl_Button {btnColor[0]} {
@ -803,7 +801,7 @@ progdefaults.changed = true;}
progdefaults.changed = true;}
tooltip {Set level for good viewing} xywh {270 315 200 20} type Horizontal align 1 step 0.05 value 0.5 textsize 14
code0 {o->value(progdefaults.TxMonitorLevel);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
}
@ -880,7 +878,7 @@ progdefaults.changed = true;}
}
Fl_Group {} {
label Mouse open
xywh {0 50 500 320} hide
xywh {0 50 500 320}
} {
Fl_Group {} {open
xywh {5 62 490 170} box ENGRAVED_FRAME
@ -930,11 +928,11 @@ behaves inside the waterfall} xywh {15 196 150 22} down_box BORDER_BOX align 8
}
}
Fl_Group tabModems {
label Modems open
xywh {0 25 500 345} labelsize 12 hide
label Modems
xywh {0 25 500 345} hide
} {
Fl_Tabs tabsModems {open
xywh {0 25 500 345} selection_color 50 align 9
xywh {0 25 501 345} selection_color 50 align 9
} {
Fl_Group tabCW {
label CW open
@ -957,7 +955,7 @@ behaves inside the waterfall} xywh {15 196 150 22} down_box BORDER_BOX align 8
progdefaults.changed = true;}
tooltip {CW dsp filter bandwidth} xywh {40 115 290 20} type Horizontal align 8 minimum 10 maximum 500 step 10 value 150 textsize 14
code0 {o->value(progdefaults.CWbandwidth);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Check_Button btnCWrcvTrack {
@ -1003,7 +1001,7 @@ progdefaults.changed = true;
sync_cw_parameters();}
tooltip {My transmit CW WPM} xywh {20 240 400 20} type Horizontal align 8 minimum 5 maximum 100 step 1 value 20 textsize 14
code0 {o->value(progdefaults.CWspeed);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Counter cntCWdefWPM {
@ -1047,7 +1045,7 @@ cntCW_WPM->maximum(progdefaults.CWupperlimit);}
progdefaults.changed = true;}
tooltip {My transmit CW WPM} xywh {20 335 400 20} type Horizontal align 8 minimum 5 maximum 100 step 1 value 20 textsize 14
code0 {o->value(progdefaults.CWfarnsworth);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Check_Button btnCWusefarnsworth {
@ -1163,7 +1161,7 @@ progdefaults.changed = true;}
}
}
Fl_Group tabDomEX {
label DominoEX open
label DomEX open
xywh {0 50 500 320} hide
} {
Fl_Group {} {open
@ -1208,7 +1206,7 @@ progdefaults.changed = true;}
progdefaults.changed = true;}
tooltip {CWI detection and suppression} xywh {15 207 260 20} type Horizontal align 1 textsize 14
code0 {o->value(progdefaults.DomCWI);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Counter valDominoEX_PATHS {
@ -1276,7 +1274,7 @@ progdefaults.changed = true;} open
callback {progdefaults.HELL_BW = sldrHellBW->value();}
tooltip {Adjust the DSP bandwidth} xywh {206 147 246 20} type Horizontal align 5 minimum 10 maximum 2400 step 5 value 400 textsize 14
code0 {o->value(progdefaults.HELL_BW);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Check_Button btnFeldHellIdle {
@ -1422,6 +1420,64 @@ progdefaults.changed = true;}
}
}
}
Fl_Group tabContestia {
label Contestia open
xywh {0 50 500 320} hide
} {
Fl_Group {} {open
xywh {5 60 490 200} box ENGRAVED_FRAME
} {
Fl_Choice mnuContestia_Bandwidth {
label Bandwidth
callback {progdefaults.contestiabw = o->value();
set_contestia_default_integ();
resetOLIVIA();
progdefaults.changed = true;} open
tooltip {Select bandwidth} xywh {60 80 85 20} down_box BORDER_BOX align 8
code0 {o->add(szContestiaBandwidth);}
code1 {o->value(2);}
} {}
Fl_Choice mnuContestia_Tones {
label Tones
callback {progdefaults.contestiatones = o->value();
set_contestia_default_integ();
resetCONTESTIA();
progdefaults.changed = true;} open
tooltip {Select number of tones} xywh {321 80 70 20} down_box BORDER_BOX align 8
code0 {o->add(szContestiaTones);}
code1 {o->value(2);}
} {}
Fl_Group {} {
label {Receive synchronizer} open
xywh {60 119 379 100} box ENGRAVED_FRAME align 21
} {
Fl_Counter cntContestia_smargin {
label {Tune margin (tone frequency spacing)}
callback {progdefaults.contestiasmargin = (int)(o->value());
resetCONTESTIA();
progdefaults.changed = true;}
tooltip {Change ONLY to experiment} xywh {80 150 70 20} type Simple align 8 minimum 2 maximum 128 step 1 value 8
code0 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Counter2
}
Fl_Counter cntContestia_sinteg {
label {Integration period (FEC blocks)}
callback {progdefaults.contestiasinteg = (int)(o->value());
resetCONTESTIA();
progdefaults.changed = true;}
tooltip {Change ONLY to experiment} xywh {80 180 70 20} type Simple align 8 minimum 2 maximum 128 step 1 value 4
code0 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Counter2
}
}
Fl_Check_Button btnContestia_8bit {
label {8-bit extended characters}
callback {progdefaults.contestia8bit = o->value();
progdefaults.changed = true;}
tooltip {Enable this for Latin-1 accented characters} xywh {60 229 200 20} down_box DOWN_BOX hide
}
}
}
Fl_Group tabPSK {
label PSK open
xywh {0 50 500 320} hide
@ -1630,6 +1686,7 @@ progdefaults.changed = true;}
callback {progdefaults.rtty_autocount = (int)o->value();
progdefaults.changed = true;}
tooltip {Set page width} xywh {335 118 65 20} type Simple align 8 minimum 68 maximum 80 step 1 value 72
code0 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Counter2
}
Fl_Box {} {
@ -1695,7 +1752,7 @@ progdefaults.changed = true;}
callback {progdefaults.RTTY_BW = o->value();}
tooltip {Adjust the DSP bandwidth} xywh {100 325 300 20} type Horizontal align 5 minimum 5 maximum 200 step 1 value 25 textsize 14
code0 {o->value(progdefaults.RTTY_BW);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Counter selCustomShift {
@ -1749,7 +1806,7 @@ progdefaults.changed = true;}
progdefaults.changed = true;}
tooltip {CWI detection and suppression} xywh {15 194 260 20} type Horizontal align 1 textsize 14
code0 {o->value(progdefaults.ThorCWI);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Counter valTHOR_PATHS {
@ -1767,8 +1824,8 @@ progdefaults.changed = true;}
}
}
Fl_Group tabRig {
label Rig open
tooltip {Transceiver control} xywh {0 25 500 345} labelsize 12 hide
label Rig
tooltip {Transceiver control} xywh {0 25 500 345} hide
} {
Fl_Tabs tabsRig {open
xywh {0 25 500 345} selection_color 50
@ -2346,8 +2403,8 @@ progdefaults.changed = true;}
}
}
Fl_Group tabSoundCard {
label Audio open
tooltip {Audio devices} xywh {0 25 500 345} labelsize 12 hide
label Audio
tooltip {Audio devices} xywh {0 25 500 345} hide
} {
Fl_Tabs tabsSoundCard {open
xywh {0 25 500 345} selection_color 50
@ -2588,7 +2645,7 @@ progdefaults.changed = true;}
progdefaults.changed = true;}
tooltip {Set the sound card PCM level} xywh {15 167 340 20} type Horizontal selection_color 15 align 8 value 0.8 textsize 14
code0 {extern void setPCMvolume(double);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
}
@ -2596,8 +2653,8 @@ progdefaults.changed = true;}
}
}
Fl_Group tabID {
label ID open
xywh {0 25 500 345} labelsize 12 hide
label ID
xywh {0 25 500 345} hide
} {
Fl_Group {} {
label {Video Preamble ID} open
@ -2645,7 +2702,7 @@ progdefaults.changed = true;}
tooltip {Set the number of characters per row} xywh {365 127 120 20} type Horizontal align 4 minimum 1 maximum 4 step 1 value 1 textsize 14
code0 {o->value(progdefaults.videowidth);}
code1 {if (progdefaults.ID_SMALL) o->deactivate();}
code2 {o->labelsize(FL_NORMAL_SIZE);}
code2 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Button bVideoIDModes {
@ -2674,7 +2731,7 @@ progdefaults.changed = true;}
progdefaults.changed = true;}
tooltip {Send at this WPM} xywh {165 185 180 20} type Horizontal align 1 minimum 15 maximum 40 step 1 value 18 textsize 14
code0 {o->value(progdefaults.CWIDwpm);}
code1 {o->labelsize(FL_NORMAL_SIZE);}
code1 {o->labelsize(FL_NORMAL_SIZE); o->textsize(FL_NORMAL_SIZE);}
class Fl_Value_Slider2
}
Fl_Button bCWIDModes {
@ -2761,8 +2818,8 @@ progdefaults.changed = true;}
}
}
Fl_Group tabMisc {
label Misc open
xywh {0 25 500 345} labelsize 12 hide
label Misc
xywh {0 25 500 345} hide
} {
Fl_Tabs tabsMisc {open
xywh {0 25 500 345} selection_color 50
@ -3058,8 +3115,8 @@ progdefaults.changed = true;}
}
}
Fl_Group tabQRZ {
label {Callsign DB} open
tooltip {Callsign database} xywh {0 25 500 345} labelsize 12 hide
label {Callsign DB}
tooltip {Callsign database} xywh {0 25 500 345} hide
} {
Fl_Group {} {
label CDROM open

Wyświetl plik

@ -38,6 +38,7 @@
#include <cstdlib>
#include <cstdarg>
#include <string>
#include <fstream>
#include <algorithm>
#include <map>
#include <dirent.h>
@ -77,12 +78,14 @@
#include "mt63.h"
#include "rtty.h"
#include "olivia.h"
#include "contestia.h"
#include "thor.h"
#include "dominoex.h"
#include "feld.h"
#include "throb.h"
#include "wwv.h"
#include "analysis.h"
#include "ssb.h"
#include "ascii.h"
#include "globals.h"
@ -157,8 +160,6 @@ int leftof(Fl_Widget* w);
int above(Fl_Widget* w);
int below(Fl_Widget* w);
//bool useCheckButtons;
Fl_Group *mnuFrame;
Fl_Menu_Bar *mnu;
@ -387,6 +388,16 @@ void cb_oliviaD(Fl_Widget *w, void *arg);
void cb_oliviaE(Fl_Widget *w, void *arg);
void cb_oliviaCustom(Fl_Widget *w, void *arg);
void cb_contestiaA(Fl_Widget *w, void *arg);
void cb_contestiaB(Fl_Widget *w, void *arg);
void cb_contestiaC(Fl_Widget *w, void *arg);
void cb_contestiaD(Fl_Widget *w, void *arg);
void cb_contestiaE(Fl_Widget *w, void *arg);
void cb_contestiaF(Fl_Widget *w, void *arg);
void cb_contestiaG(Fl_Widget *w, void *arg);
void cb_contestiaH(Fl_Widget *w, void *arg);
void cb_contestiaCustom(Fl_Widget *w, void *arg);
void cb_rtty45(Fl_Widget *w, void *arg);
void cb_rtty50(Fl_Widget *w, void *arg);
void cb_rttyHAB50(Fl_Widget *w, void *arg);
@ -492,6 +503,19 @@ Fl_Menu_Item quick_change_olivia[] = {
{ 0 }
};
Fl_Menu_Item quick_change_contestia[] = {
{ "4/250", 0, cb_contestiaA, (void *)MODE_CONTESTIA },
{ "8/250", 0, cb_contestiaB, (void *)MODE_CONTESTIA },
{ "4/500", 0, cb_contestiaC, (void *)MODE_CONTESTIA },
{ "8/500", 0, cb_contestiaD, (void *)MODE_CONTESTIA },
{ "16/500", 0, cb_contestiaE, (void *)MODE_CONTESTIA },
{ "8/1000", 0, cb_contestiaF, (void *)MODE_CONTESTIA },
{ "16/1000", 0, cb_contestiaG, (void *)MODE_CONTESTIA },
{ "32/1000", 0, cb_contestiaH, (void *)MODE_CONTESTIA },
{ _("Custom..."), 0, cb_contestiaCustom, (void *)MODE_CONTESTIA },
{ 0 }
};
Fl_Menu_Item quick_change_rtty[] = {
{ "RTTY-45", 0, cb_rtty45, (void *)MODE_RTTY },
{ "RTTY-50", 0, cb_rtty50, (void *)MODE_RTTY },
@ -506,6 +530,7 @@ inline int minmax(int val, int min, int max)
return val > min ? val : min;
}
// Olivia
void set_olivia_default_integ()
{
int tones = progdefaults.oliviatones;
@ -578,6 +603,105 @@ void cb_oliviaCustom(Fl_Widget *w, void *arg)
cb_init_mode(w, arg);
}
// Contestia
void set_contestia_default_integ()
{
int tones = progdefaults.contestiatones;
int bw = progdefaults.contestiabw;
if (tones < 1) tones = 1;
int depth = minmax( (8 * (1 << bw)) / (1 << tones), 4, 4 * (1 << bw));
progdefaults.contestiasinteg = depth;
cntContestia_sinteg->value(depth);
}
void set_contestia_tab_widgets()
{
mnuContestia_Bandwidth->value(progdefaults.contestiabw);
mnuContestia_Tones->value(progdefaults.contestiatones);
set_contestia_default_integ();
}
void cb_contestiaA(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 1;
progdefaults.contestiabw = 1;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaB(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 2;
progdefaults.contestiabw = 1;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaC(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 1;
progdefaults.contestiabw = 2;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaD(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 2;
progdefaults.contestiabw = 2;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaE(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 3;
progdefaults.contestiabw = 2;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaF(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 2;
progdefaults.contestiabw = 3;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaG(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 3;
progdefaults.contestiabw = 3;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaH(Fl_Widget *w, void *arg)
{
progdefaults.contestiatones = 4;
progdefaults.contestiabw = 3;
set_contestia_tab_widgets();
cb_init_mode(w, arg);
}
void cb_contestiaCustom(Fl_Widget *w, void *arg)
{
modem_config_tab = tabContestia;
tabsConfigure->value(tabModems);
tabsModems->value(modem_config_tab);
#if USE_HAMLIB
hamlib_restore_defaults();
#endif
rigCAT_restore_defaults();;
dlgConfig->show();
cb_init_mode(w, arg);
}
//
void set_rtty_tab_widgets()
{
progdefaults.rtty_parity = 0;
@ -857,6 +981,13 @@ void init_modem(trx_mode mode, int freq)
quick_change = quick_change_olivia;
break;
case MODE_CONTESTIA:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new contestia, freq);
modem_config_tab = tabContestia;
quick_change = quick_change_contestia;
break;
case MODE_RTTY:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new rtty(mode), freq);
@ -881,6 +1012,11 @@ void init_modem(trx_mode mode, int freq)
*mode_info[mode].modem = new anal, freq);
break;
case MODE_SSB:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new ssb, freq);
break;
default:
LOG_ERROR("Unknown mode: %" PRIdPTR, mode);
return init_modem(MODE_PSK31, freq);
@ -1519,7 +1655,7 @@ void cb_ShowNBEMS(Fl_Widget*, void*)
void cbTune(Fl_Widget *w, void *) {
Fl_Button *b = (Fl_Button *)w;
if (active_modem == wwv_modem || active_modem == anal_modem) {
if (!(active_modem->get_cap() & modem::CAP_TX)) {
b->value(0);
return;
}
@ -1869,6 +2005,7 @@ void qsoClear_cb(Fl_Widget *b, void *)
if (clearlog) {
clearQSO();
}
clear_Lookup();
restoreFocus();
}
@ -2121,6 +2258,7 @@ bool clean_exit(void) {
#define OPMODES_FEWER _("Show fewer modes")
#define OPMODES_ALL _("Show all modes")
#define OLIVIA_MLABEL "Olivia"
#define CONTESTIA_MLABEL "Contestia"
#define RTTY_MLABEL "RTTY"
#define VIEW_MLABEL _("&View")
#define MFSK_IMAGE_MLABEL _("&MFSK image")
@ -2349,6 +2487,18 @@ Fl_Menu_Item menu_[] = {
{ mode_info[MODE_CW].name, 0, cb_init_mode, (void *)MODE_CW, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ CONTESTIA_MLABEL, 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{ "4/250", 0, cb_contestiaA, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "8/250", 0, cb_contestiaB, (void *)MODE_CONTESTIA, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ "4/500", 0, cb_contestiaC, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "8/500", 0, cb_contestiaD, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "16/500", 0, cb_contestiaE, (void *)MODE_CONTESTIA, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ "8/1000", 0, cb_contestiaF, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "16/1000", 0, cb_contestiaG, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "32/1000", 0, cb_contestiaH, (void *)MODE_CONTESTIA, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ _("Custom..."), 0, cb_contestiaCustom, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{"DominoEX", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX4].name, 0, cb_init_mode, (void *)MODE_DOMINOEX4, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX5].name, 0, cb_init_mode, (void *)MODE_DOMINOEX5, 0, FL_NORMAL_LABEL, 0, 14, 0},
@ -2442,7 +2592,7 @@ Fl_Menu_Item menu_[] = {
{ mode_info[MODE_THROBX4].name, 0, cb_init_mode, (void *)MODE_THROBX4, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{"NBEMS modes", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{"NBEMS modes", 0, 0, 0, FL_SUBMENU | FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX11].name, 0, cb_init_mode, (void *)MODE_DOMINOEX11, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX22].name, 0, cb_init_mode, (void *)MODE_DOMINOEX22, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_MFSK16].name, 0, cb_init_mode, (void *)MODE_MFSK16, 0, FL_NORMAL_LABEL, 0, 14, 0},
@ -2451,6 +2601,8 @@ Fl_Menu_Item menu_[] = {
{ mode_info[MODE_PSK250].name, 0, cb_init_mode, (void *)MODE_PSK250, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{ mode_info[MODE_SSB].name, 0, cb_init_mode, (void *)MODE_SSB, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_WWV].name, 0, cb_init_mode, (void *)MODE_WWV, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_ANALYSIS].name, 0, cb_init_mode, (void *)MODE_ANALYSIS, 0, FL_NORMAL_LABEL, 0, 14, 0},
@ -2588,6 +2740,10 @@ static void cb_opmode_show(Fl_Widget* w, void*)
getMenuItem("Olivia")->show();
else
getMenuItem("Olivia")->hide();
if (progdefaults.visible_modes.test(MODE_CONTESTIA))
getMenuItem("Contestia")->show();
else
getMenuItem("Contestia")->hide();
if (progdefaults.visible_modes.test(MODE_RTTY))
getMenuItem("RTTY")->show();
else
@ -3043,7 +3199,7 @@ void create_fl_digi_main_primary() {
qsoFreqDisp1->color(FL_BACKGROUND_COLOR);
qsoFreqDisp1->selection_color(FL_BACKGROUND_COLOR);
qsoFreqDisp1->labeltype(FL_NORMAL_LABEL);
qsoFreqDisp1->labelfont(0);
qsoFreqDisp1->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp1->labelsize(12);
qsoFreqDisp1->labelcolor(FL_FOREGROUND_COLOR);
qsoFreqDisp1->align(FL_ALIGN_CENTER);
@ -3056,7 +3212,7 @@ void create_fl_digi_main_primary() {
fl_rgb_color( progdefaults.FDbackground.R,
progdefaults.FDbackground.G,
progdefaults.FDbackground.B));
qsoFreqDisp1->value(145580000);
qsoFreqDisp1->value(0);
Y = Hmenu + 2 * (Hentry + pad);
@ -3349,6 +3505,7 @@ void create_fl_digi_main_primary() {
qsoFreqDisp2->align(FL_ALIGN_CENTER);
qsoFreqDisp2->when(FL_WHEN_RELEASE);
qsoFreqDisp2->callback(qso_movFreq);
qsoFreqDisp2->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp2->SetONOFFCOLOR(
fl_rgb_color( progdefaults.FDforeground.R,
progdefaults.FDforeground.G,
@ -3356,7 +3513,7 @@ void create_fl_digi_main_primary() {
fl_rgb_color( progdefaults.FDbackground.R,
progdefaults.FDbackground.G,
progdefaults.FDbackground.B));
qsoFreqDisp2->value(145580000);
qsoFreqDisp2->value(0);
qso_opPICK2 = new Fl_Button(
rightof(qsoFreqDisp2), y,
@ -3389,7 +3546,7 @@ void create_fl_digi_main_primary() {
const char *label2 = _("On");
btnTimeOn2 = new Fl_Button(
pad + rightof(qsoSave2), y,
fl_width(label2), h, label2);
static_cast<int>(fl_width(label2)), h, label2);
btnTimeOn2->tooltip(_("Press to update"));
btnTimeOn2->box(FL_NO_BOX);
btnTimeOn2->callback(cb_btnTimeOn);
@ -3401,7 +3558,7 @@ void create_fl_digi_main_primary() {
const char *label3 = _("Off");
Fl_Box *bx3 = new Fl_Box(pad + rightof(inpTimeOn2), y,
fl_width(label3), h, label3);
static_cast<int>(fl_width(label3)), h, label3);
inpTimeOff2 = new Fl_Input2(
pad + bx3->x() + bx3->w(), y,
w_inpTime2, h, "");
@ -3410,7 +3567,7 @@ void create_fl_digi_main_primary() {
const char *label4 = _("Call");
Fl_Box *bx4 = new Fl_Box(pad + rightof(inpTimeOff2), y,
fl_width(label4), h, label4);
static_cast<int>(fl_width(label4)), h, label4);
inpCall2 = new Fl_Input2(
pad + bx4->x() + bx4->w(), y,
w_inpCall2, h, "");
@ -3418,7 +3575,7 @@ void create_fl_digi_main_primary() {
const char *label6 = _("In");
Fl_Box *bx6 = new Fl_Box(pad + rightof(inpCall2), y,
fl_width(label6), h, label6);
static_cast<int>(fl_width(label6)), h, label6);
inpRstIn2 = new Fl_Input2(
pad + bx6->x() + bx6->w(), y,
w_inpRstIn2, h, "");
@ -3426,7 +3583,7 @@ void create_fl_digi_main_primary() {
const char *label7 = _("Out");
Fl_Box *bx7 = new Fl_Box(pad + rightof(inpRstIn2), y,
fl_width(label7), h, label7);
static_cast<int>(fl_width(label7)), h, label7);
inpRstOut2 = new Fl_Input2(
pad + bx7->x() + bx7->w(), y,
w_inpRstOut2, h, "");
@ -3434,7 +3591,7 @@ void create_fl_digi_main_primary() {
const char *label5 = _("Nm");//_("Name");
Fl_Box *bx5 = new Fl_Box(pad + rightof(inpRstOut2), y,
fl_width(label5), h, label5);
static_cast<int>(fl_width(label5)), h, label5);
int xn = pad + bx5->x() + bx5->w();
inpName2 = new Fl_Input2(
xn, y,
@ -3460,6 +3617,7 @@ void create_fl_digi_main_primary() {
qsoFreqDisp3->align(FL_ALIGN_CENTER);
qsoFreqDisp3->when(FL_WHEN_RELEASE);
qsoFreqDisp3->callback(qso_movFreq);
qsoFreqDisp3->font(progdefaults.FreqControlFontnbr);
qsoFreqDisp3->SetONOFFCOLOR(
fl_rgb_color( progdefaults.FDforeground.R,
progdefaults.FDforeground.G,
@ -3467,7 +3625,7 @@ void create_fl_digi_main_primary() {
fl_rgb_color( progdefaults.FDbackground.R,
progdefaults.FDbackground.G,
progdefaults.FDbackground.B));
qsoFreqDisp3->value(145580000);
qsoFreqDisp3->value(0);
qso_opPICK3 = new Fl_Button(
rightof(qsoFreqDisp3), y,
@ -3499,12 +3657,12 @@ void create_fl_digi_main_primary() {
const char *label7a = _("Ex");
const char *xData = "00000";
const char *xCall = "WW8WWW/WWWW";
int wData = fl_width(xData);
int wCall = fl_width(xCall);
int wData = static_cast<int>(fl_width(xData));
int wCall = static_cast<int>(fl_width(xCall));
Fl_Box *bx4a = new Fl_Box(
pad + rightof(qsoSave3), y,
fl_width(label4a), h, label4a);
static_cast<int>(fl_width(label4a)), h, label4a);
inpCall3 = new Fl_Input2(
pad + bx4a->x() + bx4a->w(), y,
wCall, h, "");
@ -3513,22 +3671,22 @@ void create_fl_digi_main_primary() {
Fl_Box *bx7a = new Fl_Box(
rightof(inpCall3), y,
fl_width(label7a), h, label7a);
static_cast<int>(fl_width(label7a)), h, label7a);
bx7a->align(FL_ALIGN_INSIDE);
inpXchgIn2 = new Fl_Input2(
rightof(bx7a), y,
progStatus.mainW
static_cast<int>(progStatus.mainW
- rightof(bx7a) - pad
- fl_width(label6a) - wData - pad
- fl_width(label5a) - wData - pad
- fl_width(label2a) - wData - pad
- fl_width(label3a) - wData - pad,
- fl_width(label3a) - wData - pad),
h, "");
inpXchgIn2->tooltip(_("Contest exchange in"));
Fl_Box *bx6a = new Fl_Box(
rightof(inpXchgIn2), y,
fl_width(label6a), h, label6a);
static_cast<int>(fl_width(label6a)), h, label6a);
bx6a->align(FL_ALIGN_INSIDE);
inpSerNo2 = new Fl_Input2(
rightof(bx6a) + pad, y,
@ -3537,7 +3695,7 @@ void create_fl_digi_main_primary() {
Fl_Box *bx5a = new Fl_Box(
rightof(inpSerNo2), y,
fl_width(label5a), h, label5a);
static_cast<int>(fl_width(label5a)), h, label5a);
bx5a->align(FL_ALIGN_INSIDE);
outSerNo2 = new Fl_Input2(
rightof(bx5a) + pad, y,
@ -3547,7 +3705,7 @@ void create_fl_digi_main_primary() {
btnTimeOn3 = new Fl_Button(
rightof(outSerNo2), y,
fl_width(label2a), h, label2a);
static_cast<int>(fl_width(label2a)), h, label2a);
btnTimeOn3->tooltip(_("Press to update"));
btnTimeOn3->box(FL_NO_BOX);
btnTimeOn3->callback(cb_btnTimeOn);
@ -3558,7 +3716,7 @@ void create_fl_digi_main_primary() {
inpTimeOn3->type(FL_INT_INPUT);
Fl_Box *bx3a = new Fl_Box(pad + rightof(inpTimeOn3), y,
fl_width(label3a), h, label3a);
static_cast<int>(fl_width(label3a)), h, label3a);
inpTimeOff3 = new Fl_Input2(
bx3a->x() + bx3a->w() + pad, y,
wData, h, "");
@ -3648,7 +3806,7 @@ void create_fl_digi_main_primary() {
TransmitText->setFontColor(progdefaults.SKIPcolor, FTextBase::SKIP);
TransmitText->setFontColor(progdefaults.ALTRcolor, FTextBase::ALTR);
Fl_Box *minbox = new Fl_Box(sw,Y + 66, progStatus.mainW-sw, Htext - 66 - 32);
Fl_Box *minbox = new Fl_Box(sw,Y + 66, progStatus.mainW-sw, Htext - 66 - 66);
minbox->hide();
TiledGroup->resizable(minbox);
@ -3779,27 +3937,17 @@ void create_fl_digi_main_primary() {
#ifdef __APPLE__
sql_width -= 15; // leave room for resize handle
#endif
if (progdefaults.useCheckButtons) {
btnAFC = new Fl_Check_Button(
progStatus.mainW - bwSqlOnOff - bwAfcOnOff,
Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
bwAfcOnOff, Hstatus, "AFC");
btnSQL = new Fl_Check_Button(
progStatus.mainW - bwSqlOnOff,
Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
sql_width, Hstatus, "SQL");
} else {
btnAFC = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff - bwAfcOnOff,
Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
bwAfcOnOff, Hstatus, "AFC");
btnAFC->selection_color(progdefaults.AfcColor);
btnSQL = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff,
Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
sql_width, Hstatus, "SQL");
btnSQL->selection_color(progdefaults.Sql1Color);
}
btnAFC = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff - bwAfcOnOff,
Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
bwAfcOnOff, Hstatus, "AFC");
btnAFC->selection_color(progdefaults.AfcColor);
btnSQL = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff,
Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
sql_width, Hstatus, "SQL");
btnSQL->selection_color(progdefaults.Sql1Color);
btnAFC->callback(cbAFC, 0);
btnAFC->value(1);
btnAFC->tooltip(_("Automatic Frequency Control"));
@ -3925,6 +4073,18 @@ Fl_Menu_Item alt_menu_[] = {
{ mode_info[MODE_CW].name, 0, cb_init_mode, (void *)MODE_CW, 0, FL_NORMAL_LABEL, 0, 14, 0},
{"Contestia", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{ "4/250", 0, cb_contestiaA, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "8/250", 0, cb_contestiaB, (void *)MODE_CONTESTIA, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ "4/500", 0, cb_contestiaC, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "8/500", 0, cb_contestiaD, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "16/500", 0, cb_contestiaE, (void *)MODE_CONTESTIA, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ "8/1000", 0, cb_contestiaF, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "16/1000", 0, cb_contestiaG, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ "32/1000", 0, cb_contestiaH, (void *)MODE_CONTESTIA, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ _("Custom..."), 0, cb_contestiaCustom, (void *)MODE_CONTESTIA, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{"DominoEX", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX4].name, 0, cb_init_mode, (void *)MODE_DOMINOEX4, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX5].name, 0, cb_init_mode, (void *)MODE_DOMINOEX5, 0, FL_NORMAL_LABEL, 0, 14, 0},
@ -4009,7 +4169,7 @@ Fl_Menu_Item alt_menu_[] = {
{ mode_info[MODE_THROBX4].name, 0, cb_init_mode, (void *)MODE_THROBX4, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{"NBEMS modes", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{"NBEMS modes", 0, 0, 0, FL_SUBMENU | FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX11].name, 0, cb_init_mode, (void *)MODE_DOMINOEX11, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_DOMINOEX22].name, 0, cb_init_mode, (void *)MODE_DOMINOEX22, FL_MENU_DIVIDER, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_MFSK16].name, 0, cb_init_mode, (void *)MODE_MFSK16, 0, FL_NORMAL_LABEL, 0, 14, 0},
@ -4018,6 +4178,8 @@ Fl_Menu_Item alt_menu_[] = {
{ mode_info[MODE_PSK250].name, 0, cb_init_mode, (void *)MODE_PSK250, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{ mode_info[MODE_SSB].name, 0, cb_init_mode, (void *)MODE_SSB, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_WWV].name, 0, cb_init_mode, (void *)MODE_WWV, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_ANALYSIS].name, 0, cb_init_mode, (void *)MODE_ANALYSIS, 0, FL_NORMAL_LABEL, 0, 14, 0},
@ -4384,27 +4546,16 @@ void create_fl_digi_main_WF_only() {
#ifdef __APPLE__
sql_width -= 15; // leave room for resize handle
#endif
if (progdefaults.useCheckButtons) {
btnAFC = new Fl_Check_Button(
progStatus.mainW - bwSqlOnOff - bwAfcOnOff,
Y,
bwAfcOnOff, Hstatus, "AFC");
btnSQL = new Fl_Check_Button(
progStatus.mainW - bwSqlOnOff,
Y,
sql_width, Hstatus, "SQL");
} else {
btnAFC = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff - bwAfcOnOff,
Y,
bwAfcOnOff, Hstatus, "AFC");
btnAFC->selection_color(progdefaults.AfcColor);
btnSQL = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff,
Y,
sql_width, Hstatus, "SQL");
btnSQL->selection_color(progdefaults.Sql1Color);
}
btnAFC = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff - bwAfcOnOff,
Y,
bwAfcOnOff, Hstatus, "AFC");
btnAFC->selection_color(progdefaults.AfcColor);
btnSQL = new Fl_Light_Button(
progStatus.mainW - bwSqlOnOff,
Y,
sql_width, Hstatus, "SQL");
btnSQL->selection_color(progdefaults.Sql1Color);
btnAFC->callback(cbAFC, 0);
btnAFC->value(1);
btnAFC->tooltip(_("Automatic Frequency Control"));
@ -5282,6 +5433,11 @@ void resetOLIVIA() {
trx_start_modem(active_modem);
}
void resetCONTESTIA() {
if (active_modem->get_mode() == MODE_CONTESTIA)
trx_start_modem(active_modem);
}
void resetTHOR() {
trx_mode md = active_modem->get_mode();
if (md == MODE_THOR4 || md == MODE_THOR5 || md == MODE_THOR8 ||
@ -5423,6 +5579,8 @@ void setReverse(int rev) {
void start_tx()
{
if (!(active_modem->get_cap() & modem::CAP_TX))
return;
trx_transmit();
REQ(&waterfall::set_XmtRcvBtn, wf, true);
}
@ -5566,6 +5724,7 @@ void spot_selection_color()
btnAutoSpot->redraw();
}
// Olivia
void set_olivia_bw(int bw)
{
int i;
@ -5596,6 +5755,38 @@ void set_olivia_tones(int tones)
progdefaults.changed = changed;
}
//Contestia
void set_contestia_bw(int bw)
{
int i;
if (bw == 125)
i = 0;
else if (bw == 250)
i = 1;
else if (bw == 500)
i = 2;
else if (bw == 1000)
i = 3;
else
i = 4;
bool changed = progdefaults.changed;
mnuContestia_Bandwidth->value(i);
mnuContestia_Bandwidth->do_callback();
progdefaults.changed = changed;
}
void set_contestia_tones(int tones)
{
unsigned i = 0;
while (tones >>= 1)
i++;
bool changed = progdefaults.changed;
mnuContestia_Tones->value(i - 1);
mnuContestia_Tones->do_callback();
progdefaults.changed = changed;
}
void set_rtty_shift(int shift)
{
if (shift < selCustomShift->minimum() || shift > selCustomShift->maximum())

Wyświetl plik

@ -71,7 +71,7 @@ void Font_Browser::fb_callback(Fl_Widget* w, void* arg)
else {
if (w == fb->lst_Size)
fb->txt_Size->value(strtol(fb->lst_Size->text(fb->lst_Size->value()), NULL, 10));
fb->fontsize = fb->txt_Size->value();
fb->fontsize = static_cast<int>(fb->txt_Size->value());
}
fb->box_Example->SetFont(fb->fontnbr, fb->fontsize, fb->fontcolor);
}

Wyświetl plik

@ -1676,7 +1676,7 @@ numeric keypad's 0-9 the sequence will be discarded.</p></div>\n\
<div id=\"footer\">\n\
<div id=\"footer-text\">\n\
Version 3.11<br />\n\
Last updated 2009-10-17 07:11:38 CDT\n\
Last updated 2010-05-02 05:49:46 CDT\n\
</div>\n\
<div id=\"footer-badges\">\n\
<a href=\"http://validator.w3.org/check?uri=referer\">\n\

Wyświetl plik

@ -170,7 +170,7 @@ Fl_Double_Window* make_notify_window() {
{ mnuNotifyDupWhich = new Fl_Choice(33, 367, 120, 20, _("in:"));
mnuNotifyDupWhich->down_box(FL_BORDER_BOX);
} // Fl_Choice* mnuNotifyDupWhich
{ cntNotifyDupTime = new Fl_Spinner2(77, 397, 60, 20, _("Time (s):"));
{ Fl_Spinner2* o = cntNotifyDupTime = new Fl_Spinner2(77, 397, 60, 20, _("Time (s):"));
cntNotifyDupTime->box(FL_NO_BOX);
cntNotifyDupTime->color((Fl_Color)FL_BACKGROUND_COLOR);
cntNotifyDupTime->selection_color((Fl_Color)FL_BACKGROUND_COLOR);
@ -183,6 +183,7 @@ Fl_Double_Window* make_notify_window() {
cntNotifyDupTime->value(600);
cntNotifyDupTime->align(FL_ALIGN_LEFT);
cntNotifyDupTime->when(FL_WHEN_RELEASE);
o->labelsize(FL_NORMAL_SIZE);
} // Fl_Spinner2* cntNotifyDupTime
{ chkNotifyDupBand = new Fl_Check_Button(12, 427, 65, 20, _("Band"));
chkNotifyDupBand->down_box(FL_DOWN_BOX);
@ -195,7 +196,7 @@ Fl_Double_Window* make_notify_window() {
{ grpNotifyAction = new Fl_Group(222, 2, 276, 394, _("Action"));
grpNotifyAction->box(FL_ENGRAVED_FRAME);
grpNotifyAction->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ cntNotifyActionLimit = new Fl_Spinner2(343, 31, 52, 20, _("Trigger limit (s):"));
{ Fl_Spinner2* o = cntNotifyActionLimit = new Fl_Spinner2(343, 31, 52, 20, _("Trigger limit (s):"));
cntNotifyActionLimit->tooltip(_("Minimum time between events"));
cntNotifyActionLimit->box(FL_NO_BOX);
cntNotifyActionLimit->color((Fl_Color)FL_BACKGROUND_COLOR);
@ -208,6 +209,7 @@ Fl_Double_Window* make_notify_window() {
cntNotifyActionLimit->maximum(3600);
cntNotifyActionLimit->align(FL_ALIGN_LEFT);
cntNotifyActionLimit->when(FL_WHEN_RELEASE);
o->labelsize(FL_NORMAL_SIZE);
} // Fl_Spinner2* cntNotifyActionLimit
{ Fl_Input2* o = inpNotifyActionDialog = new Fl_Input2(232, 78, 218, 60, _("Show alert window:"));
inpNotifyActionDialog->type(4);
@ -225,7 +227,7 @@ Fl_Double_Window* make_notify_window() {
{ btnNotifyActionDialogDefault = new Fl_Button(460, 96, 28, 23);
btnNotifyActionDialogDefault->tooltip(_("Insert default text"));
} // Fl_Button* btnNotifyActionDialogDefault
{ cntNotifyActionDialogTimeout = new Fl_Spinner2(383, 148, 52, 20, _("Hide window after (s):"));
{ Fl_Spinner2* o = cntNotifyActionDialogTimeout = new Fl_Spinner2(383, 148, 52, 20, _("Hide window after (s):"));
cntNotifyActionDialogTimeout->box(FL_NO_BOX);
cntNotifyActionDialogTimeout->color((Fl_Color)FL_BACKGROUND_COLOR);
cntNotifyActionDialogTimeout->selection_color((Fl_Color)FL_BACKGROUND_COLOR);
@ -238,6 +240,7 @@ Fl_Double_Window* make_notify_window() {
cntNotifyActionDialogTimeout->value(5);
cntNotifyActionDialogTimeout->align(FL_ALIGN_LEFT);
cntNotifyActionDialogTimeout->when(FL_WHEN_RELEASE);
o->labelsize(FL_NORMAL_SIZE);
} // Fl_Spinner2* cntNotifyActionDialogTimeout
{ Fl_Input2* o = inpNotifyActionRXMarker = new Fl_Input2(232, 195, 218, 60, _("Append to RX text:"));
inpNotifyActionRXMarker->type(4);

Wyświetl plik

@ -103,6 +103,7 @@ chkNotifyFilterCall->value(0);}
Fl_Spinner cntNotifyDupTime {
label {Time (s):}
xywh {77 397 60 20} minimum 0 maximum 97200 value 600
code0 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Spinner2
}
Fl_Check_Button chkNotifyDupBand {
@ -121,6 +122,7 @@ chkNotifyFilterCall->value(0);}
Fl_Spinner cntNotifyActionLimit {
label {Trigger limit (s):}
tooltip {Minimum time between events} xywh {343 31 52 20} minimum 0 maximum 3600 value 1
code0 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Spinner2
}
Fl_Input inpNotifyActionDialog {
@ -135,6 +137,7 @@ chkNotifyFilterCall->value(0);}
Fl_Spinner cntNotifyActionDialogTimeout {
label {Hide window after (s):}
xywh {383 148 52 20} minimum 0 maximum 3600 value 5
code0 {o->labelsize(FL_NORMAL_SIZE);}
class Fl_Spinner2
}
Fl_Input inpNotifyActionRXMarker {

Wyświetl plik

@ -204,7 +204,7 @@ dominoex::~dominoex()
dominoex::dominoex(trx_mode md)
{
cap = CAP_REV;
cap |= CAP_REV;
mode = md;

Wyświetl plik

@ -103,7 +103,7 @@ feld::feld(trx_mode m)
mode = m;
samplerate = FeldSampleRate;
cap = CAP_BW;
cap |= CAP_BW;
switch (mode) {
// Amplitude modulation modes
@ -153,7 +153,7 @@ feld::feld(trx_mode m)
hell_bandwidth = 122.5;
phi2freq = samplerate / M_PI / (hell_bandwidth / 2.0);
filter_bandwidth = progdefaults.HELL_BW_FSK;
cap = CAP_REV;
cap |= CAP_REV;
break;
case MODE_FSKH105:
feldcolumnrate = 17.5;
@ -164,7 +164,7 @@ feld::feld(trx_mode m)
hell_bandwidth = 55;
phi2freq = samplerate / M_PI / (hell_bandwidth / 2.0);
filter_bandwidth = progdefaults.HELL_BW_FSK105;
cap = CAP_REV;
cap |= CAP_REV;
break;
case MODE_HELL80:
feldcolumnrate = 35;
@ -175,7 +175,7 @@ feld::feld(trx_mode m)
hell_bandwidth = 300;
phi2freq = samplerate / M_PI / (hell_bandwidth / 2.0);
filter_bandwidth = progdefaults.HELL_BW_HELL80;
cap = CAP_REV;
cap |= CAP_REV;
break;
default :
feldcolumnrate = 17.5;
@ -194,7 +194,7 @@ feld::feld(trx_mode m)
bpfilt = new fftfilt(0, lp, 1024);
bbfilt = new Cmovavg(8);
average = new Cmovavg( 500 / downsampleinc);
average = new Cmovavg( static_cast<int>(500 / downsampleinc));
minmaxfilt = new Cmovavg(120);

Wyświetl plik

@ -42,6 +42,8 @@ using namespace std;
const struct mode_info_t mode_info[NUM_MODES] = {
{ MODE_CW, &cw_modem, "CW", "CW", "CW", "CW" },
{ MODE_CONTESTIA, &contestia_modem, "CTSTIA", "Contestia", "", "CONTESTIA" },
{ MODE_DOMINOEX4, &dominoex4_modem, "DomEX4", "DominoEX 4", "DOMINOEX4", "DOMINO" },
{ MODE_DOMINOEX5, &dominoex5_modem, "DomEX5", "DominoEX 5", "DOMINOEX5", "DOMINO" },
{ MODE_DOMINOEX8, &dominoex8_modem, "DomEX8", "DominoEX 8", "DOMINOEX8", "DOMINO" },
@ -106,8 +108,8 @@ const struct mode_info_t mode_info[NUM_MODES] = {
{ MODE_THROBX2, &throbx2_modem, "THRBX2", "ThrobX 2", "", "THRBX" },
{ MODE_THROBX4, &throbx4_modem, "THRBX4", "ThrobX 4", "", "THRBX" },
{ MODE_SSB, &ssb_modem, "SSB", "SSB", "", "SSB" },
{ MODE_WWV, &wwv_modem, "WWV", "WWV", "", "" },
{ MODE_ANALYSIS, &anal_modem, "ANALYSIS", "Freq Analysis", "", "" }
};

Wyświetl plik

@ -56,7 +56,7 @@ protected:
enum {
RX_MENU_QRZ_THIS, RX_MENU_CALL, RX_MENU_NAME, RX_MENU_QTH,
RX_MENU_STATE, RX_MENU_PROVINCE,RX_MENU_COUNTRY, RX_MENU_LOC,
RX_MENU_RST_IN, RX_MENU_SERIAL, RX_MENU_XCHG,
RX_MENU_RST_IN, RX_MENU_XCHG, RX_MENU_SERIAL,
RX_MENU_DIV, RX_MENU_COPY, RX_MENU_CLEAR, RX_MENU_SELECT_ALL,
RX_MENU_SAVE, RX_MENU_WRAP, RX_MENU_QUICK_ENTRY, RX_MENU_SCROLL_HINTS
};

Wyświetl plik

@ -92,8 +92,8 @@ private:
protected:
enum { FTEXT_DEF = 'A' };
enum set_style_op_e { SET_FONT = 1 << 0, SET_SIZE = 1 << 1, SET_COLOR = 1 << 2 };
Fl_Text_Buffer *tbuf; ///< text buffer
Fl_Text_Buffer *sbuf; ///< style buffer
Fl_Text_Buffer_mod *tbuf; ///< text buffer
Fl_Text_Buffer_mod *sbuf; ///< style buffer
Fl_Text_Display_mod::Style_Table_Entry styles[NATTR];
Fl_Menu_Item *context_menu;
int popx, popy;

Wyświetl plik

@ -0,0 +1,7 @@
#include <config.h>
#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR < 3
# include "Fl_Text_Buffer_mod_1_1.H"
#elif FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 3
# include "Fl_Text_Buffer_mod_1_3.H"
#endif

Wyświetl plik

@ -0,0 +1,263 @@
//
// "$Id: Fl_Text_Buffer.H 6010 2008-01-04 20:31:52Z matt $"
//
// Header file for Fl_Text_Buffer class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#ifndef FL_TEXT_BUFFER_H
#define FL_TEXT_BUFFER_H
/* Maximum length in characters of a tab or control character expansion
of a single buffer character */
#define FL_TEXT_MAX_EXP_CHAR_LEN 20
#include <FL/Fl_Export.H>
class FL_EXPORT Fl_Text_Selection {
friend class Fl_Text_Buffer_mod;
public:
void set(int start, int end);
void set_rectangular(int start, int end, int rectStart, int rectEnd);
void update(int pos, int nDeleted, int nInserted);
char rectangular() { return mRectangular; }
int start() { return mStart; }
int end() { return mEnd; }
int rect_start() { return mRectStart; }
int rect_end() { return mRectEnd; }
char selected() { return mSelected; }
void selected(char b) { mSelected = b; }
int includes(int pos, int lineStartPos, int dispIndex);
int position(int* start, int* end);
int position(int* start, int* end, int* isRect, int* rectStart, int* rectEnd);
protected:
char mSelected;
char mRectangular;
int mStart;
int mEnd;
int mRectStart;
int mRectEnd;
};
typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
class FL_EXPORT Fl_Text_Buffer_mod {
public:
Fl_Text_Buffer_mod(int requestedSize = 0);
~Fl_Text_Buffer_mod();
int length() { return mLength; }
char* text();
void text(const char* text);
char* text_range(int start, int end);
char character(int pos);
char* text_in_rectangle(int start, int end, int rectStart, int rectEnd);
void insert(int pos, const char* text);
void append(const char* t) { insert(length(), t); }
void remove(int start, int end);
void replace(int start, int end, const char *text);
void copy(Fl_Text_Buffer_mod* fromBuf, int fromStart, int fromEnd, int toPos);
int undo(int *cp=0);
void canUndo(char flag=1);
int insertfile(const char *file, int pos, int buflen = 128*1024);
int appendfile(const char *file, int buflen = 128*1024)
{ return insertfile(file, length(), buflen); }
int loadfile(const char *file, int buflen = 128*1024)
{ select(0, length()); remove_selection(); return appendfile(file, buflen); }
int outputfile(const char *file, int start, int end, int buflen = 128*1024);
int savefile(const char *file, int buflen = 128*1024)
{ return outputfile(file, 0, length(), buflen); }
void insert_column(int column, int startPos, const char* text,
int* charsInserted, int* charsDeleted);
void replace_rectangular(int start, int end, int rectStart, int rectEnd,
const char* text);
void overlay_rectangular(int startPos, int rectStart, int rectEnd,
const char* text, int* charsInserted,
int* charsDeleted);
void remove_rectangular(int start, int end, int rectStart, int rectEnd);
void clear_rectangular(int start, int end, int rectStart, int rectEnd);
int tab_distance() { return mTabDist; }
void tab_distance(int tabDist);
void select(int start, int end);
int selected() { return mPrimary.selected(); }
void unselect();
void select_rectangular(int start, int end, int rectStart, int rectEnd);
int selection_position(int* start, int* end);
int selection_position(int* start, int* end, int* isRect, int* rectStart,
int* rectEnd);
char* selection_text();
void remove_selection();
void replace_selection(const char* text);
void secondary_select(int start, int end);
int secondary_selected() { return mSecondary.selected(); }
void secondary_unselect();
void secondary_select_rectangular(int start, int end, int rectStart,
int rectEnd);
int secondary_selection_position(int* start, int* end);
int secondary_selection_position(int* start, int* end, int* isRect,
int* rectStart, int* rectEnd);
char* secondary_selection_text();
void remove_secondary_selection();
void replace_secondary_selection(const char* text);
void highlight(int start, int end);
int highlight() { return mHighlight.selected(); }
void unhighlight();
void highlight_rectangular(int start, int end, int rectStart, int rectEnd);
int highlight_position(int* start, int* end);
int highlight_position(int* start, int* end, int* isRect, int* rectStart,
int* rectEnd);
char* highlight_text();
void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg);
void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg);
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
char* line_text(int pos);
int line_start(int pos);
int line_end(int pos);
int word_start(int pos);
int word_end(int pos);
int expand_character(int pos, int indent, char *outStr);
static int expand_character(char c, int indent, char* outStr, int tabDist,
char nullSubsChar);
static int character_width(char c, int indent, int tabDist, char nullSubsChar);
int count_displayed_characters(int lineStartPos, int targetPos);
int skip_displayed_characters(int lineStartPos, int nChars);
int count_lines(int startPos, int endPos);
int skip_lines(int startPos, int nLines);
int rewind_lines(int startPos, int nLines);
int findchar_forward(int startPos, char searchChar, int* foundPos);
int findchar_backward(int startPos, char searchChar, int* foundPos);
int findchars_forward(int startPos, const char* searchChars, int* foundPos);
int findchars_backward(int startPos, const char* searchChars, int* foundPos);
int search_forward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0);
int search_backward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0);
int substitute_null_characters(char* string, int length);
void unsubstitute_null_characters(char* string);
char null_substitution_character() { return mNullSubsChar; }
Fl_Text_Selection* primary_selection() { return &mPrimary; }
Fl_Text_Selection* secondary_selection() { return &mSecondary; }
Fl_Text_Selection* highlight_selection() { return &mHighlight; }
protected:
void call_modify_callbacks(int pos, int nDeleted, int nInserted,
int nRestyled, const char* deletedText);
void call_predelete_callbacks(int pos, int nDeleted);
int insert_(int pos, const char* text);
void remove_(int start, int end);
void remove_rectangular_(int start, int end, int rectStart, int rectEnd,
int* replaceLen, int* endPos);
void insert_column_(int column, int startPos, const char* insText,
int* nDeleted, int* nInserted, int* endPos);
void overlay_rectangular_(int startPos, int rectStart, int rectEnd,
const char* insText, int* nDeleted,
int* nInserted, int* endPos);
void redisplay_selection(Fl_Text_Selection* oldSelection,
Fl_Text_Selection* newSelection);
void move_gap(int pos);
void reallocate_with_gap(int newGapStart, int newGapLen);
char* selection_text_(Fl_Text_Selection* sel);
void remove_selection_(Fl_Text_Selection* sel);
void replace_selection_(Fl_Text_Selection* sel, const char* text);
void rectangular_selection_boundaries(int lineStartPos, int rectStart,
int rectEnd, int* selStart,
int* selEnd);
void update_selections(int pos, int nDeleted, int nInserted);
Fl_Text_Selection mPrimary; /* highlighted areas */
Fl_Text_Selection mSecondary;
Fl_Text_Selection mHighlight;
int mLength; /* length of the text in the buffer (the length
of the buffer itself must be calculated:
gapEnd - gapStart + length) */
char* mBuf; /* allocated memory where the text is stored */
int mGapStart; /* points to the first character of the gap */
int mGapEnd; /* points to the first char after the gap */
// The hardware tab distance used by all displays for this buffer,
// and used in computing offsets for rectangular selection operations.
int mTabDist; /* equiv. number of characters in a tab */
int mUseTabs; /* True if buffer routines are allowed to use
tabs for padding in rectangular operations */
int mNModifyProcs; /* number of modify-redisplay procs attached */
Fl_Text_Modify_Cb* /* procedures to call when buffer is */
mNodifyProcs; /* modified to redisplay contents */
void** mCbArgs; /* caller arguments for modifyProcs above */
int mNPredeleteProcs; /* number of pre-delete procs attached */
Fl_Text_Predelete_Cb* /* procedure to call before text is deleted */
mPredeleteProcs; /* from the buffer; at most one is supported. */
void **mPredeleteCbArgs; /* caller argument for pre-delete proc above */
int mCursorPosHint; /* hint for reasonable cursor position after
a buffer modification operation */
char mNullSubsChar; /* NEdit is based on C null-terminated strings,
so ascii-nul characters must be substituted
with something else. This is the else, but
of course, things get quite messy when you
use it */
char mCanUndo; /* if this buffer is used for attributes, it must
not do any undo calls */
};
#endif
//
// End of "$Id: Fl_Text_Buffer.H 6010 2008-01-04 20:31:52Z matt $".
//

Wyświetl plik

@ -0,0 +1,984 @@
//
// "$Id: Fl_Text_Buffer.H 7462 2010-04-06 23:00:56Z matt $"
//
// Header file for Fl_Text_Buffer class.
//
// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
/* \file
Fl_Text_Buffer, Fl_Text_Selection widget . */
#ifndef FL_TEXT_BUFFER_H
#define FL_TEXT_BUFFER_H
/*
Suggested UTF-8 terminology for this file:
?? "length" is the number of characters in a string
?? "size" is the number of bytes
?? "index" is the position in a string in number of characters
?? "offset" is the position in a strin in bytes (and must be kept on a charater boundary)
(there seems to be no standard in Uncode documents, howevere "length" is commonly
referencing the number of bytes. Maybe "bytes" and "glyphs" would be the most
obvious way to describe sizes?)
"character size" is the size of a UTF-8 character in bytes
"character width" is the width of a Unicode character in pixels
"column" was orginally defined as a character offset from the left margin. It was
identical to the byte offset. In UTF-8, we have neither a byte offset nor
truly fixed width fonts. Column could be a pixel value multiplied with
an average character width (which is a bearable approximation).
*/
/* Maximum length in characters of a tab or control character expansion
of a single buffer character */
#define FL_TEXT_MAX_EXP_CHAR_LEN 20
#include <FL/Fl_Export.H>
/**
\class Fl_Text_Selection
\brief This is an internal class for Fl_Text_Buffer to manage text selections.
This class works correctly with utf-8 strings assuming that the parameters
for all calls are on character boundaries.
*/
class FL_EXPORT Fl_Text_Selection {
friend class Fl_Text_Buffer_mod;
public:
/**
\brief Set the selection range.
\param start byte offset to first selected character
\param end byte offset pointing after last selected character
*/
void set(int start, int end);
/**
\brief Set a regtangular selection range.
\param start byte offset to first selected character
\param end byte offset pointing after last selected character
\param rectStart first selected column
\param rectEnd last selected column +1
*/
void set_rectangular(int start, int end, int rectStart, int rectEnd);
/**
\brief Updates a selection afer text was modified.
Updates an individual selection for changes in the corresponding text
\param pos byte offset into text buffer at which the change occured
\param nDeleted number of bytes deleted from the buffer
\param nInserted number of bytes inserted into the buffer
*/
void update(int pos, int nDeleted, int nInserted);
/**
\brief Returns true if the selection is rectangular.
\return flag
*/
char rectangular() const { return mRectangular; }
/**
\brief Return the byte offset to the first selected character.
\return byte offset
*/
int start() const { return mStart; }
/**
\brief Return the byte ofsset to the character after the last selected character.
\return byte offset
*/
int end() const { return mEnd; }
/**
\brief Return the first column of the rectangular selection.
\return first column of rectangular selection
*/
int rect_start() const { return mRectStart; }
/**
\brief Return the last column of the rectangular selection + 1.
\return last column of rectangular selection +1
*/
int rect_end() const { return mRectEnd; }
/**
\brief Returns true if any text is selected.
\return a non-zero number if any text has been selected, or 0
if no text is selected.
*/
char selected() const { return mSelected; }
/**
\brief Modify the 'selected' flag.
\param b new flag
*/
void selected(char b) { mSelected = b; }
/**
Return true if position \p pos with indentation \p dispIndex is in
the Fl_Text_Selection.
*/
int includes(int pos, int lineStartPos, int dispIndex) const;
/**
\brief Return the positions of this selection.
\param start retrun byte offset to first selected character
\param end retrun byte offset pointing after last selected character
\return true if selected
*/
int position(int* start, int* end) const;
/**
\brief Return the positions of this rectangular selection.
\param start return byte offset to first selected character
\param end return byte offset pointing after last selected character
\param isRect return if the selection is rectangular
\param rectStart return first selected column
\param rectEnd return last selected column +1
\return true if selected
*/
int position(int* start, int* end, int* isRect, int* rectStart, int* rectEnd) const;
protected:
char mSelected; ///< this flag is set if any text is selected
char mRectangular; ///< this flag is set if the selection is rectangular
int mStart; ///< byte offset to the first selected character
int mEnd; ///< byte offset to the character after the last selected character
int mRectStart; ///< first selected column (see "column")
int mRectEnd; ///< last selected column +1 (see "column")
};
typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
/**
\brief This class manages unicode displayed in one or more Fl_Text_Display widgets.
The Fl_Text_Buffer class is used by the Fl_Text_Display
and Fl_Text_Editor to manage complex text data and is based upon the
excellent NEdit text editor engine - see http://www.nedit.org/.
\todo unicode check
*/
class FL_EXPORT Fl_Text_Buffer_mod {
public:
/**
Create an empty text buffer of a pre-determined size.
\param requestedSize use this to avoid unnecessary re-allocation
if you know exactly how much the buffer will need to hold
\param preferredGapSize Initial size for the buffer gap (empty space
in the buffer where text might be inserted
if the user is typing sequential chars)
*/
Fl_Text_Buffer_mod(int requestedSize = 0, int preferredGapSize = 1024);
/**
Frees a text buffer
*/
~Fl_Text_Buffer_mod();
/**
\brief Returns the number of bytes in the buffer.
\return size of text in bytes
*/
int length() const { return mLength; }
/**
\brief Get a copy of the entire contents of the text buffer.
Memory is allocated to contain the returned string, which the caller
must free.
\return newly allocated text buffer - must be free'd
*/
char* text() const;
/**
Replaces the entire contents of the text buffer
\todo unicode check
*/
void text(const char* text);
/**
\brief Get a copy of a part of the text buffer.
Return a copy of the text between \p start and \p end character positions
from text buffer \p buf. Positions start at 0, and the range does not
include the character pointed to by \p end.
When you are done with the text, free it using the free() function.
\param start byte offset to first character
\param end byte offset after last character in range
\return newly allocated text buffer - must be free'd
*/
char* text_range(int start, int end) const;
/**
Returns the character at the specified position pos in the buffer.
Positions start at 0
\param pos byte offset into buffer
\return Unicode UCS-4 encoded character
*/
unsigned int character(int pos) const;
/**
Returns the text from the given rectangle. When you are done
with the text, free it using the free() function.
\todo unicode check
*/
char* text_in_rectangle(int start, int end, int rectStart, int rectEnd) const;
/**
Inserts null-terminated string \p text at position \p pos.
\param pos insertion position as byte offset (must be utf-8 character aligned)
\param text utf-8 encoded and nul terminated text
*/
void insert(int pos, const char* text);
/**
Appends the text string to the end of the buffer.
\todo unicode check
*/
void append(const char* t) { insert(length(), t); }
/**
Deletes a range of characters in the buffer.
\param start byte offset to first character to be removed
\param end byte offset to charcatre after last character to be removed
*/
void remove(int start, int end);
/**
Deletes the characters between \p start and \p end, and inserts the null-terminated string \p text in their place in the buffer.
\param start byte offset to first character to be removed and new insert position
\param end byte offset to charcatre after last character to be removed
\param text utf-8 encoded and nul terminated text
*/
void replace(int start, int end, const char *text);
/**
Copies text from one buffer to this one; fromBuf may
be the same as this.
\todo unicode check
*/
void copy(Fl_Text_Buffer_mod* fromBuf, int fromStart, int fromEnd, int toPos);
/**
Undo text modification according to the undo variables or insert text
from the undo buffer
\todo unicode check
*/
int undo(int *cp=0);
/**
Lets the undo system know if we can undo changes
*/
void canUndo(char flag=1);
/**
Inserts a file at the specified position. Returns 0 on success,
non-zero on error (strerror() contains reason). 1 indicates open
for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
\todo unicode check
*/
int insertfile(const char *file, int pos, int buflen = 128*1024);
/**
Appends the named file to the end of the buffer. Returns 0 on
success, non-zero on error (strerror() contains reason). 1 indicates
open for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
\todo unicode check
*/
int appendfile(const char *file, int buflen = 128*1024)
{ return insertfile(file, length(), buflen); }
/**
Loads a text file into the buffer
\todo unicode check
*/
int loadfile(const char *file, int buflen = 128*1024)
{ select(0, length()); remove_selection(); return appendfile(file, buflen); }
/**
Writes the specified portions of the file to a file. Returns 0 on success, non-zero
on error (strerror() contains reason). 1 indicates open for write failed
(no data saved). 2 indicates error occurred while writing data
(data was partially saved).
\todo unicode check
*/
int outputfile(const char *file, int start, int end, int buflen = 128*1024);
/**
Saves a text file from the current buffer
\todo unicode check
*/
int savefile(const char *file, int buflen = 128*1024)
{ return outputfile(file, 0, length(), buflen); }
/**
Insert \p s columnwise into buffer starting at displayed character
position \p column on the line beginning at \p startPos. Opens a rectangular
space the width and height of \p s, by moving all text to the right of
\p column right. If \p charsInserted and \p charsDeleted are not NULL, the
number of characters inserted and deleted in the operation (beginning
at \p startPos) are returned in these arguments.
\todo unicode check
*/
void insert_column(int column, int startPos, const char* text,
int* charsInserted, int* charsDeleted);
/**
Replaces a rectangular area in the buffer, given by \p start, \p end,
\p rectStart, and \p rectEnd, with \p text. If \p text is vertically
longer than the rectangle, add extra lines to make room for it.
\todo unicode check
*/
void replace_rectangular(int start, int end, int rectStart, int rectEnd,
const char* text);
/**
Overlay \p text between displayed character positions \p rectStart and
\p rectEnd on the line beginning at \p startPos. If \p charsInserted and
\p charsDeleted are not NULL, the number of characters inserted and deleted
in the operation (beginning at \p startPos) are returned in these arguments.
\todo unicode check
*/
void overlay_rectangular(int startPos, int rectStart, int rectEnd,
const char* text, int* charsInserted,
int* charsDeleted);
/**
Removes a rectangular swath of characters between character positions start
and end and horizontal displayed-character offsets rectStart and rectEnd.
\todo unicode check
*/
void remove_rectangular(int start, int end, int rectStart, int rectEnd);
/**
Clears text in the specified area.
It clears a rectangular "hole" out of the buffer between character positions
start and end and horizontal displayed-character offsets rectStart and
rectEnd.
\todo unicode check
*/
void clear_rectangular(int start, int end, int rectStart, int rectEnd);
/**
Gets the tab width.
\todo unicode check
*/
int tab_distance() const { return mTabDist; }
/**
Set the hardware tab distance (width) used by all displays for this buffer,
and used in computing offsets for rectangular selection operations.
\todo unicode check
*/
void tab_distance(int tabDist);
/**
Selects a range of characters in the buffer.
\todo unicode check
*/
void select(int start, int end);
/**
Returns a non 0 value if text has been selected, 0 otherwise
*/
int selected() const { return mPrimary.selected(); }
/**
Cancels any previous selection on the primary text selection object
\todo unicode check
*/
void unselect();
/**
Achieves a rectangular selection on the primary text selection object
\todo unicode check
*/
void select_rectangular(int start, int end, int rectStart, int rectEnd);
/**
Gets the selection position
\todo unicode check
*/
int selection_position(int* start, int* end);
/**
Gets the selection position, and rectangular selection info
\todo unicode check
*/
int selection_position(int* start, int* end, int* isRect, int* rectStart,
int* rectEnd);
/**
Returns the currently selected text. When you are done with
the text, free it using the free() function.
\todo unicode check
*/
char* selection_text();
/**
Removes the text in the primary selection.
\todo unicode check
*/
void remove_selection();
/**
Replaces the text in the primary selection.
\todo unicode check
*/
void replace_selection(const char* text);
/**
Selects a range of characters in the secondary selection.
\todo unicode check
*/
void secondary_select(int start, int end);
/**
Returns a non 0 value if text has been selected in the secondary
text selection, 0 otherwise
*/
int secondary_selected() { return mSecondary.selected(); }
/**
Clears any selection in the secondary text selection object.
\todo unicode check
*/
void secondary_unselect();
/**
Achieves a rectangular selection on the secondary text selection object
\todo unicode check
*/
void secondary_select_rectangular(int start, int end, int rectStart,
int rectEnd);
/**
Returns the current selection in the secondary text selection object.
\todo unicode check
*/
int secondary_selection_position(int* start, int* end);
/**
Returns the current selection in the secondary text selection object.
\todo unicode check
*/
int secondary_selection_position(int* start, int* end, int* isRect,
int* rectStart, int* rectEnd);
/**
Returns the text in the secondary selection. When you are
done with the text, free it using the free() function.
\todo unicode check
*/
char* secondary_selection_text();
/**
Removes the text from the buffer corresponding to the secondary text selection object.
\todo unicode check
*/
void remove_secondary_selection();
/**
Replaces the text from the buffer corresponding to the secondary
text selection object with the new string \p text.
\todo unicode check
*/
void replace_secondary_selection(const char* text);
/**
Highlights the specified text within the buffer.
\todo unicode check
*/
void highlight(int start, int end);
/**
Returns the highlighted text. When you are done with the
text, free it using the free() function.
*/
int highlight() { return mHighlight.selected(); }
/**
Unhighlights text in the buffer.
\todo unicode check
*/
void unhighlight();
/**
Highlights a rectangular selection in the buffer
\todo unicode check
*/
void highlight_rectangular(int start, int end, int rectStart, int rectEnd);
/**
Highlights the specified text between \p start and \p end within the buffer.
\todo unicode check
*/
int highlight_position(int* start, int* end);
/**
Highlights the specified rectangle of text within the buffer.
\todo unicode check
*/
int highlight_position(int* start, int* end, int* isRect, int* rectStart,
int* rectEnd);
/**
Returns the highlighted text. When you are done with the
text, free it using the free() function.
\todo unicode check
*/
char* highlight_text();
/**
Adds a callback function that is called whenever the text buffer is
modified. The callback function is declared as follows:
\code
typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
\endcode
\todo unicode check
*/
void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
/**
Removes a modify callback.
\todo unicode check
*/
void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
/**
Calls all modify callbacks that have been registered using
the add_modify_callback()
method.
\todo unicode check
*/
void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
/**
Adds a callback routine to be called before text is deleted from the buffer.
\todo unicode check
*/
void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg);
/**
Removes a callback routine \p bufPreDeleteCB associated with argument \p cbArg
to be called before text is deleted from the buffer.
\todo unicode check
*/
void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg);
/**
Calls the stored pre-delete callback procedure(s) for this buffer to update
the changed area(s) on the screen and any other listeners.
\todo unicode check
*/
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
/**
Returns the text from the entire line containing the specified
character position. When you are done with the text, free it
using the free() function.
\todo unicode check
*/
char* line_text(int pos) const;
/**
Returns the position of the start of the line containing position \p pos.
\todo unicode check
*/
int line_start(int pos) const;
/**
Finds and returns the position of the end of the line containing position \p pos
(which is either a pointer to the newline character ending the line,
or a pointer to one character beyond the end of the buffer)
\todo unicode check
*/
int line_end(int pos) const;
/**
Returns the position corresponding to the start of the word
\todo unicode check
*/
int word_start(int pos) const;
/**
Returns the position corresponding to the end of the word.
\todo unicode check
*/
int word_end(int pos) const;
/**
Expands the given character to a displayable format. Tabs and
other control characters are given special treatment.
Get a character from the text buffer expanded into its screen
representation (which may be several characters for a tab or a
control code). Returns the number of characters written to \p outStr.
\p indent is the number of characters from the start of the line
for figuring tabs. Output string is guranteed to be shorter or
equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
\todo unicode check
*/
int expand_character(int pos, int indent, char *outStr) const;
/**
Expand a single character \p c from the text buffer into it's displayable
screen representation (which may be several characters for a tab or a
control code). Returns the number of characters added to \p outStr.
\p indent is the number of characters from the start of the line
for figuring tabs of length \p tabDist. Output string is guaranteed
to be shorter or equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
Tabs and other control characters are given special treatment.
\param src address of utf-8 text
\param indent
\param[out] outStr write substitution here
\param tabDist
\return number of byte in substitution
*/
static int expand_character(const char *src, int indent, char* outStr, int tabDist);
/**
Return the length in displayed characters of character \p c expanded
for display (as discussed above in expand_character() ).
\param src address of utf-8 text
\param indent
\param tabDist
\return number of byte in substitution
*/
static int character_width(const char *src, int indent, int tabDist);
/**
Count the number of displayed characters between buffer position
\p lineStartPos and \p targetPos. (displayed characters are the characters
shown on the screen to represent characters in the buffer, where tabs and
control characters are expanded)
\todo unicode check
*/
int count_displayed_characters(int lineStartPos, int targetPos) const;
/**
Count forward from buffer position \p startPos in displayed characters
(displayed characters are the characters shown on the screen to represent
characters in the buffer, where tabs and control characters are expanded)
\param lineStartPos byte offset into buffer
\param nChars number of bytes that are sent to the display
\return byte offset in input after all output bytes are sent
\todo unicode check
*/
int skip_displayed_characters(int lineStartPos, int nChars);
/**
Counts the number of newlines between \p startPos and \p endPos in buffer.
The character at position \p endPos is not counted.
\todo unicode check
*/
int count_lines(int startPos, int endPos) const;
/**
Finds the first character of the line \p nLines forward from \p startPos
in the buffer and returns its position
\todo unicode check
*/
int skip_lines(int startPos, int nLines);
/**
Finds and returns the position of the first character of the line \p nLines backwards
from \p startPos (not counting the character pointed to by \p startpos if
that is a newline) in the buffer. \p nLines == 0 means find the beginning of the line
\todo unicode check
*/
int rewind_lines(int startPos, int nLines);
/**
Finds the next occurrence of the specified character.
Search forwards in buffer for character \p searchChar, starting
with the character \p startPos, and returning the result in \p foundPos
returns 1 if found, 0 if not. (The difference between this and
BufSearchForward is that it's optimized for single characters. The
overall performance of the text widget is dependent on its ability to
count lines quickly, hence searching for a single character: newline)
\todo unicode check
*/
int findchar_forward(int startPos, char searchChar, int* foundPos) const;
/**
Search backwards in buffer \p buf for character \p searchChar, starting
with the character BEFORE \p startPos, returning the result in \p foundPos
returns 1 if found, 0 if not. (The difference between this and
BufSearchBackward is that it's optimized for single characters. The
overall performance of the text widget is dependent on its ability to
count lines quickly, hence searching for a single character: newline)
\todo unicode check
*/
int findchar_backward(int startPos, char searchChar, int* foundPos) const;
/**
Finds the next occurrence of the specified characters.
Search forwards in buffer for characters in \p searchChars, starting
with the character \p startPos, and returning the result in \p foundPos
returns 1 if found, 0 if not.
\todo unicode check
*/
int findchars_forward(int startPos, const char* searchChars, int* foundPos) const;
/**
Finds the previous occurrence of the specified characters.
Search backwards in buffer for characters in \p searchChars, starting
with the character BEFORE \p startPos, returning the result in \p foundPos
returns 1 if found, 0 if not.
\todo unicode check
*/
int findchars_backward(int startPos, const char* searchChars, int* foundPos) const;
/**
Search forwards in buffer for string \p searchString, starting with the
character \p startPos, and returning the result in \p foundPos
returns 1 if found, 0 if not.
\todo unicode check
*/
int search_forward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0) const;
/**
Search backwards in buffer for string <i>searchCharssearchString</i>, starting with the
character BEFORE \p startPos, returning the result in \p foundPos
returns 1 if found, 0 if not.
\todo unicode check
*/
int search_backward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0) const;
/**
Returns the primary selection.
*/
const Fl_Text_Selection* primary_selection() const { return &mPrimary; }
/**
Returns the primary selection.
*/
Fl_Text_Selection* primary_selection() { return &mPrimary; }
/**
Returns the secondary selection.
*/
const Fl_Text_Selection* secondary_selection() const { return &mSecondary; }
/**
Returns the current highlight selection.
*/
const Fl_Text_Selection* highlight_selection() const { return &mHighlight; }
protected:
/**
Calls the stored modify callback procedure(s) for this buffer to update the
changed area(s) on the screen and any other listeners.
\todo unicode check
*/
void call_modify_callbacks(int pos, int nDeleted, int nInserted,
int nRestyled, const char* deletedText) const;
/**
Calls the stored pre-delete callback procedure(s) for this buffer to update
the changed area(s) on the screen and any other listeners.
\todo unicode check
*/
void call_predelete_callbacks(int pos, int nDeleted) const;
/**
Internal (non-redisplaying) version of BufInsert. Returns the length of
text inserted (this is just strlen(\p text), however this calculation can be
expensive and the length will be required by any caller who will continue
on to call redisplay). \p pos must be contiguous with the existing text in
the buffer (i.e. not past the end).
\todo unicode check
*/
int insert_(int pos, const char* text);
/**
Internal (non-redisplaying) version of BufRemove. Removes the contents
of the buffer between start and end (and moves the gap to the site of
the delete).
\todo unicode check
*/
void remove_(int start, int end);
/**
Deletes a rectangle of text without calling the modify callbacks. Returns
the number of characters replacing those between \p start and \p end. Note that
in some pathological cases, deleting can actually increase the size of
the buffer because of tab expansions. \p endPos returns the buffer position
of the point in the last line where the text was removed (as a hint for
routines which need to position the cursor after a delete operation)
\todo unicode check
*/
void remove_rectangular_(int start, int end, int rectStart, int rectEnd,
int* replaceLen, int* endPos);
/**
Inserts a column of text without calling the modify callbacks. Note that
in some pathological cases, inserting can actually decrease the size of
the buffer because of spaces being coalesced into tabs. \p nDeleted and
\p nInserted return the number of characters deleted and inserted beginning
at the start of the line containing \p startPos. \p endPos returns buffer
position of the lower left edge of the inserted column (as a hint for
routines which need to set a cursor position).
\todo unicode check
*/
void insert_column_(int column, int startPos, const char* insText,
int* nDeleted, int* nInserted, int* endPos);
/**
Overlay a rectangular area of text without calling the modify callbacks.
\p nDeleted and \p nInserted return the number of characters deleted and
inserted beginning at the start of the line containing \p startPos.
\p endPos returns buffer position of the lower left edge of the inserted
column (as a hint for routines which need to set a cursor position).
\todo unicode check
*/
void overlay_rectangular_(int startPos, int rectStart, int rectEnd,
const char* insText, int* nDeleted,
int* nInserted, int* endPos);
/**
Calls the stored redisplay procedure(s) for this buffer to update the
screen for a change in a selection.
\todo unicode check
*/
void redisplay_selection(Fl_Text_Selection* oldSelection,
Fl_Text_Selection* newSelection) const;
/**
\todo unicode check
*/
void move_gap(int pos);
/**
Reallocates the text storage in the buffer to have a gap starting at \p newGapStart
and a gap size of \p newGapLen, preserving the buffer's current contents.
\todo unicode check
*/
void reallocate_with_gap(int newGapStart, int newGapLen);
char* selection_text_(Fl_Text_Selection* sel) const;
/**
Removes the text from the buffer corresponding to \p sel.
\todo unicode check
*/
void remove_selection_(Fl_Text_Selection* sel);
/**
Replaces the \p text in selection \p sel.
\todo unicode check
*/
void replace_selection_(Fl_Text_Selection* sel, const char* text);
/**
Finds the first and last character position in a line within a rectangular
selection (for copying). Includes tabs which cross rectStart, but not
control characters which do so. Leaves off tabs which cross rectEnd.
Technically, the calling routine should convert tab characters which
cross the right boundary of the selection to spaces which line up with
the edge of the selection. Unfortunately, the additional memory
management required in the parent routine to allow for the changes
in string size is not worth all the extra work just for a couple of
shifted characters, so if a tab protrudes, just lop it off and hope
that there are other characters in the selection to establish the right
margin for subsequent columnar pastes of this data.
\todo unicode check
*/
void rectangular_selection_boundaries(int lineStartPos, int rectStart,
int rectEnd, int* selStart,
int* selEnd) const;
/**
Updates all of the selections in the buffer for changes in the buffer's text
\todo unicode check
*/
void update_selections(int pos, int nDeleted, int nInserted);
/**
Convert a byte offset in buffer into a memory address.
*/
const char *address(int pos) const
{ return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; }
/**
Convert a byte offset in buffer into a memory address.
*/
char *address(int pos)
{ return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; }
Fl_Text_Selection mPrimary; /**< highlighted areas */
Fl_Text_Selection mSecondary; /**< highlighted areas */
Fl_Text_Selection mHighlight; /**< highlighted areas */
int mLength; /**< length of the text in the buffer (the length
of the buffer itself must be calculated:
gapEnd - gapStart + length) */
char* mBuf; /**< allocated memory where the text is stored */
int mGapStart; /**< points to the first character of the gap */
int mGapEnd; /**< points to the first char after the gap */
// The hardware tab distance used by all displays for this buffer,
// and used in computing offsets for rectangular selection operations.
int mTabDist; /**< equiv. number of characters in a tab */
int mUseTabs; /**< True if buffer routines are allowed to use
tabs for padding in rectangular operations */
int mNModifyProcs; /**< number of modify-redisplay procs attached */
Fl_Text_Modify_Cb* /**< procedures to call when buffer is */
mModifyProcs; /**< modified to redisplay contents */
void** mCbArgs; /**< caller arguments for modifyProcs above */
int mNPredeleteProcs; /**< number of pre-delete procs attached */
Fl_Text_Predelete_Cb* /**< procedure to call before text is deleted */
mPredeleteProcs; /**< from the buffer; at most one is supported. */
void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */
int mCursorPosHint; /**< hint for reasonable cursor position after
a buffer modification operation */
char mCanUndo; /**< if this buffer is used for attributes, it must
not do any undo calls */
int mPreferredGapSize; /**< the default allocation for the text gap is 1024
bytes and should only be increased if frequent
and large changes in buffer size are expected */
};
#endif
//
// End of "$Id: Fl_Text_Buffer.H 7462 2010-04-06 23:00:56Z matt $".
//

Wyświetl plik

@ -1,304 +1,7 @@
//
// "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $"
//
// Header file for Fl_Text_Display class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#ifndef FL_TEXT_DISPLAY_MOD_H
#define FL_TEXT_DISPLAY_MOD_H
#include <FL/fl_draw.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Scrollbar.H>
#include <FL/Fl_Text_Buffer.H>
class Fl_Text_Display_mod: public Fl_Group {
public:
enum {
NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR,
BLOCK_CURSOR, HEAVY_CURSOR
};
enum {
CURSOR_POS, CHARACTER_POS
};
// drag types- they match Fl::event_clicks() so that single clicking to
// start a collection selects by character, double clicking selects by
// word and triple clicking selects by line.
enum {
DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2
};
friend void fl_text_drag_me(int pos, Fl_Text_Display_mod* d);
typedef void (*Unfinished_Style_Cb)(int, void *);
// style attributes - currently not implemented!
enum {
ATTR_NONE = 0,
ATTR_UNDERLINE = 1,
ATTR_HIDDEN = 2
};
struct Style_Table_Entry {
Fl_Color color;
Fl_Font font;
int size;
unsigned attr;
};
Fl_Text_Display_mod(int X, int Y, int W, int H, const char *l = 0);
~Fl_Text_Display_mod();
virtual int handle(int e);
void buffer(Fl_Text_Buffer* buf);
void buffer(Fl_Text_Buffer& buf) { buffer(&buf); }
Fl_Text_Buffer* buffer() { return mBuffer; }
void redisplay_range(int start, int end);
void scroll(int topLineNum, int horizOffset);
void insert(const char* text);
void overstrike(const char* text);
void insert_position(int newPos);
int insert_position() { return mCursorPos; }
int in_selection(int x, int y);
void show_insert_position();
int move_right();
int move_left();
int move_up();
int move_down();
int count_lines(int start, int end, bool start_pos_is_line_start);
int line_start(int pos);
int line_end(int pos, bool start_pos_is_line_start);
int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
int rewind_lines(int startPos, int nLines);
void next_word(void);
void previous_word(void);
void show_cursor(int b = 1);
void hide_cursor() { show_cursor(0); }
void cursor_style(int style);
Fl_Color cursor_color() const {return mCursor_color;}
void cursor_color(Fl_Color n) {mCursor_color = n;}
int scrollbar_width() { return scrollbar_width_; }
Fl_Align scrollbar_align() { return scrollbar_align_; }
void scrollbar_width(int W) { scrollbar_width_ = W; }
void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
int word_start(int pos) { return buffer()->word_start(pos); }
int word_end(int pos) { return buffer()->word_end(pos); }
void highlight_data(Fl_Text_Buffer *styleBuffer,
const Style_Table_Entry *styleTable,
int nStyles, char unfinishedStyle,
Unfinished_Style_Cb unfinishedHighlightCB,
void *cbArg);
int position_style(int lineStartPos, int lineLen, int lineIndex,
int dispIndex);
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font f) {textfont_ = f;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned n) {textcolor_ = n;}
int wrapped_column(int row, int column);
int wrapped_row(int row);
void wrap_mode(int wrap, int wrap_margin);
virtual void resize(int X, int Y, int W, int H);
protected:
// Most (all?) of this stuff should only be called from resize() or
// draw().
// Anything with "vline" indicates thats it deals with currently
// visible lines.
virtual void draw();
void draw_text(int X, int Y, int W, int H);
void draw_range(int start, int end);
void draw_cursor(int, int);
void draw_string(int style, int x, int y, int toX, const char *string,
int nChars);
void draw_vline(int visLineNum, int leftClip, int rightClip,
int leftCharIndex, int rightCharIndex);
void draw_line_numbers(bool clearAll);
void clear_rect(int style, int x, int y, int width, int height);
void display_insert();
void offset_line_starts(int newTopLineNum);
void calc_line_starts(int startLine, int endLine);
void update_line_starts(int pos, int charsInserted, int charsDeleted,
int linesInserted, int linesDeleted, int *scrolled);
void calc_last_char();
int position_to_line( int pos, int* lineNum );
int string_width(const char* string, int length, int style);
static void scroll_timer_cb(void*);
static void buffer_predelete_cb(int pos, int nDeleted, void* cbArg);
static void buffer_modified_cb(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
static void h_scrollbar_cb(Fl_Scrollbar* w, Fl_Text_Display_mod* d);
static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display_mod* d);
void update_v_scrollbar();
void update_h_scrollbar();
int measure_vline(int visLineNum);
int longest_vline();
int empty_vlines();
int vline_length(int visLineNum);
int xy_to_position(int x, int y, int PosType = CHARACTER_POS);
void xy_to_rowcol(int x, int y, int* row, int* column,
int PosType = CHARACTER_POS);
int position_to_xy(int pos, int* x, int* y);
void maintain_absolute_top_line_number(int state);
int get_absolute_top_line_number();
void absolute_top_line_number(int oldFirstChar);
int maintaining_absolute_top_line_number();
void reset_absolute_top_line_number();
int position_to_linecol(int pos, int* lineNum, int* column);
void scroll_(int topLineNum, int horizOffset);
void extend_range_for_styles(int* start, int* end);
void find_wrap_range(const char *deletedText, int pos, int nInserted,
int nDeleted, int *modRangeStart, int *modRangeEnd,
int *linesInserted, int *linesDeleted);
void measure_deleted_lines(int pos, int nDeleted);
void wrapped_line_counter(Fl_Text_Buffer *buf, int startPos, int maxPos,
int maxLines, bool startPosIsLineStart,
int styleBufOffset, int *retPos, int *retLines,
int *retLineStart, int *retLineEnd,
bool countLastLineMissingNewLine = true);
void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd,
int *nextLineStart);
int measure_proportional_character(char c, int colNum, int pos);
int wrap_uses_character(int lineEndPos);
int range_touches_selection(Fl_Text_Selection *sel, int rangeStart,
int rangeEnd);
static const int DEFAULT_TOP_MARGIN;
static const int DEFAULT_BOTTOM_MARGIN;
static const int DEFAULT_LEFT_MARGIN;
static const int DEFAULT_RIGHT_MARGIN;
int TOP_MARGIN, BOTTOM_MARGIN, LEFT_MARGIN, RIGHT_MARGIN;
int damage_range1_start, damage_range1_end;
int damage_range2_start, damage_range2_end;
int mCursorPos;
int mCursorOn;
int mCursorOldY; /* Y pos. of cursor for blanking */
int mCursorToHint; /* Tells the buffer modified callback
where to move the cursor, to reduce
the number of redraw calls */
int mCursorStyle; /* One of enum cursorStyles above */
int mCursorPreferredCol; /* Column for vert. cursor movement */
int mNVisibleLines; /* # of visible (displayed) lines */
int mNBufferLines; /* # of newlines in the buffer */
Fl_Text_Buffer* mBuffer; /* Contains text to be displayed */
Fl_Text_Buffer* mStyleBuffer; /* Optional parallel buffer containing
color and font information */
int mFirstChar, mLastChar; /* Buffer positions of first and last
displayed character (lastChar points
either to a newline or one character
beyond the end of the buffer) */
int mContinuousWrap; /* Wrap long lines when displaying */
int mWrapMargin; /* Margin in # of char positions for
wrapping in continuousWrap mode */
int* mLineStarts;
int mTopLineNum; /* Line number of top displayed line
of file (first line of file is 1) */
int mAbsTopLineNum; /* In continuous wrap mode, the line
number of the top line if the text
were not wrapped (note that this is
only maintained as needed). */
int mNeedAbsTopLineNum; /* Externally settable flag to continue
maintaining absTopLineNum even if
it isn't needed for line # display */
int mHorizOffset; /* Horizontal scroll pos. in pixels */
int mTopLineNumHint; /* Line number of top displayed line
of file (first line of file is 1) */
int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
int mNStyles; /* Number of entries in styleTable */
const Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
coloring/syntax-highlighting */
char mUnfinishedStyle; /* Style buffer entry which triggers
on-the-fly reparsing of region */
Unfinished_Style_Cb mUnfinishedHighlightCB; /* Callback to parse "unfinished" */
/* regions */
void* mHighlightCBArg; /* Arg to unfinishedHighlightCB */
int mMaxsize;
int mFixedFontWidth; /* Font width if all current fonts are
fixed and match in width, else -1 */
int mSuppressResync; /* Suppress resynchronization of line
starts during buffer updates */
int mNLinesDeleted; /* Number of lines deleted during
buffer modification (only used
when resynchronization is suppressed) */
int mModifyingTabDistance; /* Whether tab distance is being
modified */
Fl_Color mCursor_color;
Fl_Scrollbar* mHScrollBar;
Fl_Scrollbar* mVScrollBar;
int scrollbar_width_;
Fl_Align scrollbar_align_;
int dragPos, dragType, dragging;
int display_insert_position_hint;
struct { int x, y, w, h; } text_area;
Fl_Font textfont_;
uchar textsize_;
unsigned textcolor_;
// The following are not presently used from the original NEdit code,
// but are being put here so that future versions of Fl_Text_Display
// can implement line numbers without breaking binary compatibility.
int mLineNumLeft, mLineNumWidth;
/* Line number margin and width */
};
#include <config.h>
#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR < 3
# include "Fl_Text_Display_mod_1_1.H"
#elif FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 3
# include "Fl_Text_Display_mod_1_3.H"
#endif
//
// End of "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $".
//

Wyświetl plik

@ -0,0 +1,304 @@
//
// "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $"
//
// Header file for Fl_Text_Display class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#ifndef FL_TEXT_DISPLAY_MOD_H
#define FL_TEXT_DISPLAY_MOD_H
#include <FL/fl_draw.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Scrollbar.H>
#include "Fl_Text_Buffer_mod.H"
class Fl_Text_Display_mod: public Fl_Group {
public:
enum {
NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR,
BLOCK_CURSOR, HEAVY_CURSOR
};
enum {
CURSOR_POS, CHARACTER_POS
};
// drag types- they match Fl::event_clicks() so that single clicking to
// start a collection selects by character, double clicking selects by
// word and triple clicking selects by line.
enum {
DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2
};
friend void fl_text_drag_me(int pos, Fl_Text_Display_mod* d);
typedef void (*Unfinished_Style_Cb)(int, void *);
// style attributes - currently not implemented!
enum {
ATTR_NONE = 0,
ATTR_UNDERLINE = 1,
ATTR_HIDDEN = 2
};
struct Style_Table_Entry {
Fl_Color color;
Fl_Font font;
int size;
unsigned attr;
};
Fl_Text_Display_mod(int X, int Y, int W, int H, const char *l = 0);
~Fl_Text_Display_mod();
virtual int handle(int e);
void buffer(Fl_Text_Buffer_mod* buf);
void buffer(Fl_Text_Buffer_mod& buf) { buffer(&buf); }
Fl_Text_Buffer_mod* buffer() { return mBuffer; }
void redisplay_range(int start, int end);
void scroll(int topLineNum, int horizOffset);
void insert(const char* text);
void overstrike(const char* text);
void insert_position(int newPos);
int insert_position() { return mCursorPos; }
int in_selection(int x, int y);
void show_insert_position();
int move_right();
int move_left();
int move_up();
int move_down();
int count_lines(int start, int end, bool start_pos_is_line_start);
int line_start(int pos);
int line_end(int pos, bool start_pos_is_line_start);
int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
int rewind_lines(int startPos, int nLines);
void next_word(void);
void previous_word(void);
void show_cursor(int b = 1);
void hide_cursor() { show_cursor(0); }
void cursor_style(int style);
Fl_Color cursor_color() const {return mCursor_color;}
void cursor_color(Fl_Color n) {mCursor_color = n;}
int scrollbar_width() { return scrollbar_width_; }
Fl_Align scrollbar_align() { return scrollbar_align_; }
void scrollbar_width(int W) { scrollbar_width_ = W; }
void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
int word_start(int pos) { return buffer()->word_start(pos); }
int word_end(int pos) { return buffer()->word_end(pos); }
void highlight_data(Fl_Text_Buffer_mod *styleBuffer,
const Style_Table_Entry *styleTable,
int nStyles, char unfinishedStyle,
Unfinished_Style_Cb unfinishedHighlightCB,
void *cbArg);
int position_style(int lineStartPos, int lineLen, int lineIndex,
int dispIndex);
Fl_Font textfont() const {return textfont_;}
void textfont(Fl_Font f) {textfont_ = f;}
uchar textsize() const {return textsize_;}
void textsize(uchar s) {textsize_ = s;}
Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
void textcolor(unsigned n) {textcolor_ = n;}
int wrapped_column(int row, int column);
int wrapped_row(int row);
void wrap_mode(int wrap, int wrap_margin);
virtual void resize(int X, int Y, int W, int H);
protected:
// Most (all?) of this stuff should only be called from resize() or
// draw().
// Anything with "vline" indicates thats it deals with currently
// visible lines.
virtual void draw();
void draw_text(int X, int Y, int W, int H);
void draw_range(int start, int end);
void draw_cursor(int, int);
void draw_string(int style, int x, int y, int toX, const char *string,
int nChars);
void draw_vline(int visLineNum, int leftClip, int rightClip,
int leftCharIndex, int rightCharIndex);
void draw_line_numbers(bool clearAll);
void clear_rect(int style, int x, int y, int width, int height);
void display_insert();
void offset_line_starts(int newTopLineNum);
void calc_line_starts(int startLine, int endLine);
void update_line_starts(int pos, int charsInserted, int charsDeleted,
int linesInserted, int linesDeleted, int *scrolled);
void calc_last_char();
int position_to_line( int pos, int* lineNum );
int string_width(const char* string, int length, int style);
static void scroll_timer_cb(void*);
static void buffer_predelete_cb(int pos, int nDeleted, void* cbArg);
static void buffer_modified_cb(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
static void h_scrollbar_cb(Fl_Scrollbar* w, Fl_Text_Display_mod* d);
static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display_mod* d);
void update_v_scrollbar();
void update_h_scrollbar();
int measure_vline(int visLineNum);
int longest_vline();
int empty_vlines();
int vline_length(int visLineNum);
int xy_to_position(int x, int y, int PosType = CHARACTER_POS);
void xy_to_rowcol(int x, int y, int* row, int* column,
int PosType = CHARACTER_POS);
int position_to_xy(int pos, int* x, int* y);
void maintain_absolute_top_line_number(int state);
int get_absolute_top_line_number();
void absolute_top_line_number(int oldFirstChar);
int maintaining_absolute_top_line_number();
void reset_absolute_top_line_number();
int position_to_linecol(int pos, int* lineNum, int* column);
void scroll_(int topLineNum, int horizOffset);
void extend_range_for_styles(int* start, int* end);
void find_wrap_range(const char *deletedText, int pos, int nInserted,
int nDeleted, int *modRangeStart, int *modRangeEnd,
int *linesInserted, int *linesDeleted);
void measure_deleted_lines(int pos, int nDeleted);
void wrapped_line_counter(Fl_Text_Buffer_mod *buf, int startPos, int maxPos,
int maxLines, bool startPosIsLineStart,
int styleBufOffset, int *retPos, int *retLines,
int *retLineStart, int *retLineEnd,
bool countLastLineMissingNewLine = true);
void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd,
int *nextLineStart);
int measure_proportional_character(char c, int colNum, int pos);
int wrap_uses_character(int lineEndPos);
int range_touches_selection(Fl_Text_Selection *sel, int rangeStart,
int rangeEnd);
static const int DEFAULT_TOP_MARGIN;
static const int DEFAULT_BOTTOM_MARGIN;
static const int DEFAULT_LEFT_MARGIN;
static const int DEFAULT_RIGHT_MARGIN;
int TOP_MARGIN, BOTTOM_MARGIN, LEFT_MARGIN, RIGHT_MARGIN;
int damage_range1_start, damage_range1_end;
int damage_range2_start, damage_range2_end;
int mCursorPos;
int mCursorOn;
int mCursorOldY; /* Y pos. of cursor for blanking */
int mCursorToHint; /* Tells the buffer modified callback
where to move the cursor, to reduce
the number of redraw calls */
int mCursorStyle; /* One of enum cursorStyles above */
int mCursorPreferredCol; /* Column for vert. cursor movement */
int mNVisibleLines; /* # of visible (displayed) lines */
int mNBufferLines; /* # of newlines in the buffer */
Fl_Text_Buffer_mod* mBuffer; /* Contains text to be displayed */
Fl_Text_Buffer_mod* mStyleBuffer; /* Optional parallel buffer containing
color and font information */
int mFirstChar, mLastChar; /* Buffer positions of first and last
displayed character (lastChar points
either to a newline or one character
beyond the end of the buffer) */
int mContinuousWrap; /* Wrap long lines when displaying */
int mWrapMargin; /* Margin in # of char positions for
wrapping in continuousWrap mode */
int* mLineStarts;
int mTopLineNum; /* Line number of top displayed line
of file (first line of file is 1) */
int mAbsTopLineNum; /* In continuous wrap mode, the line
number of the top line if the text
were not wrapped (note that this is
only maintained as needed). */
int mNeedAbsTopLineNum; /* Externally settable flag to continue
maintaining absTopLineNum even if
it isn't needed for line # display */
int mHorizOffset; /* Horizontal scroll pos. in pixels */
int mTopLineNumHint; /* Line number of top displayed line
of file (first line of file is 1) */
int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
int mNStyles; /* Number of entries in styleTable */
const Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
coloring/syntax-highlighting */
char mUnfinishedStyle; /* Style buffer entry which triggers
on-the-fly reparsing of region */
Unfinished_Style_Cb mUnfinishedHighlightCB; /* Callback to parse "unfinished" */
/* regions */
void* mHighlightCBArg; /* Arg to unfinishedHighlightCB */
int mMaxsize;
int mFixedFontWidth; /* Font width if all current fonts are
fixed and match in width, else -1 */
int mSuppressResync; /* Suppress resynchronization of line
starts during buffer updates */
int mNLinesDeleted; /* Number of lines deleted during
buffer modification (only used
when resynchronization is suppressed) */
int mModifyingTabDistance; /* Whether tab distance is being
modified */
Fl_Color mCursor_color;
Fl_Scrollbar* mHScrollBar;
Fl_Scrollbar* mVScrollBar;
int scrollbar_width_;
Fl_Align scrollbar_align_;
int dragPos, dragType, dragging;
int display_insert_position_hint;
struct { int x, y, w, h; } text_area;
Fl_Font textfont_;
uchar textsize_;
unsigned textcolor_;
// The following are not presently used from the original NEdit code,
// but are being put here so that future versions of Fl_Text_Display
// can implement line numbers without breaking binary compatibility.
int mLineNumLeft, mLineNumWidth;
/* Line number margin and width */
};
#endif
//
// End of "$Id: Fl_Text_Display.H 4502 2005-08-10 23:11:51Z matt $".
//

Wyświetl plik

@ -0,0 +1,350 @@
//
// "$Id: Fl_Text_Display.H 6902 2009-09-27 11:06:56Z matt $"
//
// Header file for Fl_Text_Display class.
//
// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
/* \file
Fl_Text_Display widget . */
#ifndef FL_TEXT_DISPLAY_H
#define FL_TEXT_DISPLAY_H
#include <FL/fl_draw.H>
#include <FL/Fl_Group.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Scrollbar.H>
#include "Fl_Text_Buffer_mod.H"
/**
This is the FLTK text display widget. It allows the user to
view multiple lines of text and supports highlighting and
scrolling. The buffer that is displayed in the widget is managed
by the Fl_Text_Buffer
class.
*/
class FL_EXPORT Fl_Text_Display_mod: public Fl_Group {
public:
/** text display cursor shapes enumeration */
enum {
NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR,
BLOCK_CURSOR, HEAVY_CURSOR
};
enum {
CURSOR_POS, CHARACTER_POS
};
/** drag types- they match Fl::event_clicks() so that single clicking to
start a collection selects by character, double clicking selects by
word and triple clicking selects by line.
*/
enum {
DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2
};
friend void fl_text_drag_me(int pos, Fl_Text_Display_mod* d);
typedef void (*Unfinished_Style_Cb)(int, void *);
/** style attributes - currently not implemented! */
enum {
ATTR_NONE = 0,
ATTR_UNDERLINE = 1,
ATTR_HIDDEN = 2
};
/** This structure associates the color,font,size of a string to draw
with an attribute mask matching attr */
struct Style_Table_Entry {
Fl_Color color;
Fl_Font font;
int size;
unsigned attr;
};
Fl_Text_Display_mod(int X, int Y, int W, int H, const char *l = 0);
~Fl_Text_Display_mod();
virtual int handle(int e);
void buffer(Fl_Text_Buffer_mod* buf);
/**
Sets or gets the current text buffer associated with the text widget.
Multiple text widgets can be associated with the same text buffer.
*/
void buffer(Fl_Text_Buffer_mod& buf) { buffer(&buf); }
/**
Gets the current text buffer associated with the text widget.
Multiple text widgets can be associated with the same text buffer.
*/
Fl_Text_Buffer_mod* buffer() const { return mBuffer; }
void redisplay_range(int start, int end);
void scroll(int topLineNum, int horizOffset);
void insert(const char* text);
void overstrike(const char* text);
void insert_position(int newPos);
/** Gets the position of the text insertion cursor for text display */
int insert_position() const { return mCursorPos; }
int in_selection(int x, int y) const;
void show_insert_position();
int move_right();
int move_left();
int move_up();
int move_down();
int count_lines(int start, int end, bool start_pos_is_line_start) const;
int line_start(int pos) const;
int line_end(int pos, bool start_pos_is_line_start) const;
int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
int rewind_lines(int startPos, int nLines);
void next_word(void);
void previous_word(void);
void show_cursor(int b = 1);
/** Hides the text cursor */
void hide_cursor() { show_cursor(0); }
void cursor_style(int style);
/** Sets or gets the text cursor color. */
Fl_Color cursor_color() const {return mCursor_color;}
/** Sets or gets the text cursor color. */
void cursor_color(Fl_Color n) {mCursor_color = n;}
/** Sets or gets the width/height of the scrollbars. */
int scrollbar_width() const { return scrollbar_width_; }
/** Sets or gets the width/height of the scrollbars. */
void scrollbar_width(int W) { scrollbar_width_ = W; }
/** Gets the scrollbar alignment type */
Fl_Align scrollbar_align() const { return scrollbar_align_; }
/** Sets the scrollbar alignment type */
void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
/** Moves the insert position to the beginning of the current word. */
int word_start(int pos) const { return buffer()->word_start(pos); }
/** Moves the insert position to the end of the current word. */
int word_end(int pos) const { return buffer()->word_end(pos); }
void highlight_data(Fl_Text_Buffer_mod *styleBuffer,
const Style_Table_Entry *styleTable,
int nStyles, char unfinishedStyle,
Unfinished_Style_Cb unfinishedHighlightCB,
void *cbArg);
int position_style(int lineStartPos, int lineLen, int lineIndex,
int dispIndex) const;
/** \todo FIXME : get set methods pointing on shortcut_
have no effects as shortcut_ is unused in this class and derived! */
int shortcut() const {return shortcut_;}
/** \todo FIXME : get set methods pointing on shortcut_
have no effects as shortcut_ is unused in this class and derived! */
void shortcut(int s) {shortcut_ = s;}
/** Gets the default font used when drawing text in the widget. */
Fl_Font textfont() const {return textfont_;}
/** Sets the default font used when drawing text in the widget. */
void textfont(Fl_Font s) {textfont_ = s;}
/** Gets the default size of text in the widget. */
Fl_Fontsize textsize() const {return textsize_;}
/** Sets the default size of text in the widget. */
void textsize(Fl_Fontsize s) {textsize_ = s;}
/** Gets the default color of text in the widget. */
Fl_Color textcolor() const {return textcolor_;}
/** Sets the default color of text in the widget. */
void textcolor(Fl_Color n) {textcolor_ = n;}
int wrapped_column(int row, int column) const;
int wrapped_row(int row) const;
void wrap_mode(int wrap, int wrap_margin);
virtual void resize(int X, int Y, int W, int H);
protected:
// Most (all?) of this stuff should only be called from resize() or
// draw().
// Anything with "vline" indicates thats it deals with currently
// visible lines.
virtual void draw();
void draw_text(int X, int Y, int W, int H);
void draw_range(int start, int end);
void draw_cursor(int, int);
void draw_string(int style, int x, int y, int toX, const char *string,
int nChars);
void draw_vline(int visLineNum, int leftClip, int rightClip,
int leftCharIndex, int rightCharIndex);
void draw_line_numbers(bool clearAll);
void clear_rect(int style, int x, int y, int width, int height);
void display_insert();
void offset_line_starts(int newTopLineNum);
void calc_line_starts(int startLine, int endLine);
void update_line_starts(int pos, int charsInserted, int charsDeleted,
int linesInserted, int linesDeleted, int *scrolled);
void calc_last_char();
int position_to_line( int pos, int* lineNum ) const;
int string_width(const char* string, int length, int style) const;
static void scroll_timer_cb(void*);
static void buffer_predelete_cb(int pos, int nDeleted, void* cbArg);
static void buffer_modified_cb(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
static void h_scrollbar_cb(Fl_Scrollbar* w, Fl_Text_Display_mod* d);
static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display_mod* d);
void update_v_scrollbar();
void update_h_scrollbar();
int measure_vline(int visLineNum) const;
int longest_vline() const;
int empty_vlines() const;
int vline_length(int visLineNum) const;
int xy_to_position(int x, int y, int PosType = CHARACTER_POS) const;
void xy_to_rowcol(int x, int y, int* row, int* column,
int PosType = CHARACTER_POS) const;
int position_to_xy(int pos, int* x, int* y) const;
void maintain_absolute_top_line_number(int state);
int get_absolute_top_line_number() const;
void absolute_top_line_number(int oldFirstChar);
int maintaining_absolute_top_line_number() const;
void reset_absolute_top_line_number();
int position_to_linecol(int pos, int* lineNum, int* column) const;
void scroll_(int topLineNum, int horizOffset);
void extend_range_for_styles(int* start, int* end);
void find_wrap_range(const char *deletedText, int pos, int nInserted,
int nDeleted, int *modRangeStart, int *modRangeEnd,
int *linesInserted, int *linesDeleted);
void measure_deleted_lines(int pos, int nDeleted);
void wrapped_line_counter(Fl_Text_Buffer_mod *buf, int startPos, int maxPos,
int maxLines, bool startPosIsLineStart,
int styleBufOffset, int *retPos, int *retLines,
int *retLineStart, int *retLineEnd,
bool countLastLineMissingNewLine = true) const;
void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd,
int *nextLineStart) const;
int measure_proportional_character(char c, int colNum, int pos) const;
int wrap_uses_character(int lineEndPos) const;
int range_touches_selection(const Fl_Text_Selection *sel, int rangeStart,
int rangeEnd) const;
#ifndef FL_DOXYGEN
static const int DEFAULT_TOP_MARGIN;
static const int DEFAULT_BOTTOM_MARGIN;
static const int DEFAULT_LEFT_MARGIN;
static const int DEFAULT_RIGHT_MARGIN;
int TOP_MARGIN, BOTTOM_MARGIN, LEFT_MARGIN, RIGHT_MARGIN;
int damage_range1_start, damage_range1_end;
int damage_range2_start, damage_range2_end;
int mCursorPos;
int mCursorOn;
int mCursorOldY; /* Y pos. of cursor for blanking */
int mCursorToHint; /* Tells the buffer modified callback
where to move the cursor, to reduce
the number of redraw calls */
int mCursorStyle; /* One of enum cursorStyles above */
int mCursorPreferredCol; /* Column for vert. cursor movement */
int mNVisibleLines; /* # of visible (displayed) lines */
int mNBufferLines; /* # of newlines in the buffer */
Fl_Text_Buffer_mod* mBuffer; /* Contains text to be displayed */
Fl_Text_Buffer_mod* mStyleBuffer; /* Optional parallel buffer containing
color and font information */
int mFirstChar, mLastChar; /* Buffer positions of first and last
displayed character (lastChar points
either to a newline or one character
beyond the end of the buffer) */
int mContinuousWrap; /* Wrap long lines when displaying */
int mWrapMargin; /* Margin in # of char positions for
wrapping in continuousWrap mode */
int* mLineStarts;
int mTopLineNum; /* Line number of top displayed line
of file (first line of file is 1) */
int mAbsTopLineNum; /* In continuous wrap mode, the line
number of the top line if the text
were not wrapped (note that this is
only maintained as needed). */
int mNeedAbsTopLineNum; /* Externally settable flag to continue
maintaining absTopLineNum even if
it isn't needed for line # display */
int mHorizOffset; /* Horizontal scroll pos. in pixels */
int mTopLineNumHint; /* Line number of top displayed line
of file (first line of file is 1) */
int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
int mNStyles; /* Number of entries in styleTable */
const Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
coloring/syntax-highlighting */
char mUnfinishedStyle; /* Style buffer entry which triggers
on-the-fly reparsing of region */
Unfinished_Style_Cb mUnfinishedHighlightCB; /* Callback to parse "unfinished" */
/* regions */
void* mHighlightCBArg; /* Arg to unfinishedHighlightCB */
int mMaxsize;
int mFixedFontWidth; /* Font width if all current fonts are
fixed and match in width, else -1 */
int mSuppressResync; /* Suppress resynchronization of line
starts during buffer updates */
int mNLinesDeleted; /* Number of lines deleted during
buffer modification (only used
when resynchronization is suppressed) */
int mModifyingTabDistance; /* Whether tab distance is being
modified */
Fl_Color mCursor_color;
Fl_Scrollbar* mHScrollBar;
Fl_Scrollbar* mVScrollBar;
int scrollbar_width_;
Fl_Align scrollbar_align_;
int dragPos, dragType, dragging;
int display_insert_position_hint;
struct { int x, y, w, h; } text_area;
int shortcut_;
Fl_Font textfont_;
Fl_Fontsize textsize_;
Fl_Color textcolor_;
// The following are not presently used from the original NEdit code,
// but are being put here so that future versions of Fl_Text_Display
// can implement line numbers without breaking binary compatibility.
int mLineNumLeft, mLineNumWidth;
/* Line number margin and width */
#endif
};
#endif
//
// End of "$Id: Fl_Text_Display.H 6902 2009-09-27 11:06:56Z matt $".
//

Wyświetl plik

@ -1,110 +1,7 @@
//
// "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $"
//
// Header file for Fl_Text_Editor class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#ifndef FL_TEXT_EDITOR_MOD_H
#define FL_TEXT_EDITOR_MOD_H
#include "Fl_Text_Display_mod.H"
// key will match in any state
#define FL_TEXT_EDITOR_ANY_STATE (-1L)
class Fl_Text_Editor_mod : public Fl_Text_Display_mod {
public:
typedef int (*Key_Func)(int key, Fl_Text_Editor_mod* editor);
struct Key_Binding {
int key;
int state;
Key_Func function;
Key_Binding* next;
};
Fl_Text_Editor_mod(int X, int Y, int W, int H, const char* l = 0);
~Fl_Text_Editor_mod() { remove_all_key_bindings(); }
virtual int handle(int e);
void insert_mode(int b) { insert_mode_ = b; }
int insert_mode() { return insert_mode_; }
void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
void add_key_binding(int key, int state, Key_Func f)
{ add_key_binding(key, state, f, &key_bindings); }
void remove_key_binding(int key, int state, Key_Binding** list);
void remove_key_binding(int key, int state)
{ remove_key_binding(key, state, &key_bindings); }
void remove_all_key_bindings(Key_Binding** list);
void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
void add_default_key_bindings(Key_Binding** list);
Key_Func bound_key_function(int key, int state, Key_Binding* list);
Key_Func bound_key_function(int key, int state)
{ return bound_key_function(key, state, key_bindings); }
void default_key_function(Key_Func f) { default_key_function_ = f; }
// functions for the built in default bindings
static int kf_default(int c, Fl_Text_Editor_mod* e);
static int kf_ignore(int c, Fl_Text_Editor_mod* e);
static int kf_backspace(int c, Fl_Text_Editor_mod* e);
static int kf_enter(int c, Fl_Text_Editor_mod* e);
static int kf_move(int c, Fl_Text_Editor_mod* e);
static int kf_shift_move(int c, Fl_Text_Editor_mod* e);
static int kf_ctrl_move(int c, Fl_Text_Editor_mod* e);
static int kf_c_s_move(int c, Fl_Text_Editor_mod* e);
static int kf_home(int, Fl_Text_Editor_mod* e);
static int kf_end(int c, Fl_Text_Editor_mod* e);
static int kf_left(int c, Fl_Text_Editor_mod* e);
static int kf_up(int c, Fl_Text_Editor_mod* e);
static int kf_right(int c, Fl_Text_Editor_mod* e);
static int kf_down(int c, Fl_Text_Editor_mod* e);
static int kf_page_up(int c, Fl_Text_Editor_mod* e);
static int kf_page_down(int c, Fl_Text_Editor_mod* e);
static int kf_insert(int c, Fl_Text_Editor_mod* e);
static int kf_delete(int c, Fl_Text_Editor_mod* e);
static int kf_copy(int c, Fl_Text_Editor_mod* e);
static int kf_cut(int c, Fl_Text_Editor_mod* e);
static int kf_paste(int c, Fl_Text_Editor_mod* e);
static int kf_select_all(int c, Fl_Text_Editor_mod* e);
static int kf_undo(int c, Fl_Text_Editor_mod* e);
protected:
int handle_key();
void maybe_do_callback();
int insert_mode_;
Key_Binding* key_bindings;
static Key_Binding* global_key_bindings;
Key_Func default_key_function_;
};
#include <config.h>
#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR < 3
# include "Fl_Text_Editor_mod_1_1.H"
#elif FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 3
# include "Fl_Text_Editor_mod_1_3.H"
#endif
//
// End of "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $".
//

Wyświetl plik

@ -0,0 +1,110 @@
//
// "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $"
//
// Header file for Fl_Text_Editor class.
//
// Copyright 2001-2005 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#ifndef FL_TEXT_EDITOR_MOD_H
#define FL_TEXT_EDITOR_MOD_H
#include "Fl_Text_Display_mod.H"
// key will match in any state
#define FL_TEXT_EDITOR_ANY_STATE (-1L)
class Fl_Text_Editor_mod : public Fl_Text_Display_mod {
public:
typedef int (*Key_Func)(int key, Fl_Text_Editor_mod* editor);
struct Key_Binding {
int key;
int state;
Key_Func function;
Key_Binding* next;
};
Fl_Text_Editor_mod(int X, int Y, int W, int H, const char* l = 0);
~Fl_Text_Editor_mod() { remove_all_key_bindings(); }
virtual int handle(int e);
void insert_mode(int b) { insert_mode_ = b; }
int insert_mode() { return insert_mode_; }
void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
void add_key_binding(int key, int state, Key_Func f)
{ add_key_binding(key, state, f, &key_bindings); }
void remove_key_binding(int key, int state, Key_Binding** list);
void remove_key_binding(int key, int state)
{ remove_key_binding(key, state, &key_bindings); }
void remove_all_key_bindings(Key_Binding** list);
void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
void add_default_key_bindings(Key_Binding** list);
Key_Func bound_key_function(int key, int state, Key_Binding* list);
Key_Func bound_key_function(int key, int state)
{ return bound_key_function(key, state, key_bindings); }
void default_key_function(Key_Func f) { default_key_function_ = f; }
// functions for the built in default bindings
static int kf_default(int c, Fl_Text_Editor_mod* e);
static int kf_ignore(int c, Fl_Text_Editor_mod* e);
static int kf_backspace(int c, Fl_Text_Editor_mod* e);
static int kf_enter(int c, Fl_Text_Editor_mod* e);
static int kf_move(int c, Fl_Text_Editor_mod* e);
static int kf_shift_move(int c, Fl_Text_Editor_mod* e);
static int kf_ctrl_move(int c, Fl_Text_Editor_mod* e);
static int kf_c_s_move(int c, Fl_Text_Editor_mod* e);
static int kf_home(int, Fl_Text_Editor_mod* e);
static int kf_end(int c, Fl_Text_Editor_mod* e);
static int kf_left(int c, Fl_Text_Editor_mod* e);
static int kf_up(int c, Fl_Text_Editor_mod* e);
static int kf_right(int c, Fl_Text_Editor_mod* e);
static int kf_down(int c, Fl_Text_Editor_mod* e);
static int kf_page_up(int c, Fl_Text_Editor_mod* e);
static int kf_page_down(int c, Fl_Text_Editor_mod* e);
static int kf_insert(int c, Fl_Text_Editor_mod* e);
static int kf_delete(int c, Fl_Text_Editor_mod* e);
static int kf_copy(int c, Fl_Text_Editor_mod* e);
static int kf_cut(int c, Fl_Text_Editor_mod* e);
static int kf_paste(int c, Fl_Text_Editor_mod* e);
static int kf_select_all(int c, Fl_Text_Editor_mod* e);
static int kf_undo(int c, Fl_Text_Editor_mod* e);
protected:
int handle_key();
void maybe_do_callback();
int insert_mode_;
Key_Binding* key_bindings;
static Key_Binding* global_key_bindings;
Key_Func default_key_function_;
};
#endif
//
// End of "$Id: Fl_Text_Editor.H 4288 2005-04-16 00:13:17Z mike $".
//

Wyświetl plik

@ -0,0 +1,141 @@
//
// "$Id: Fl_Text_Editor.H 6893 2009-09-20 19:24:24Z greg.ercolano $"
//
// Header file for Fl_Text_Editor class.
//
// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
/* \file
Fl_Text_Editor widget . */
#ifndef FL_TEXT_EDITOR_H
#define FL_TEXT_EDITOR_H
#include "Fl_Text_Display_mod.H"
// key will match in any state
#define FL_TEXT_EDITOR_ANY_STATE (-1L)
/**
This is the FLTK text editor widget. It allows the user to
edit multiple lines of text and supports highlighting and
scrolling. The buffer that is displayed in the widget is managed
by the Fl_Text_Buffer
class.
*/
class FL_EXPORT Fl_Text_Editor_mod : public Fl_Text_Display_mod {
public:
/** Key function binding callback type */
typedef int (*Key_Func)(int key, Fl_Text_Editor_mod* editor);
/** Simple linked list associating a key/state to a function */
struct Key_Binding {
int key; ///< the key pressed
int state; ///< the state of key modifiers
Key_Func function; ///< associated function
Key_Binding* next; ///< next key binding in the list
};
Fl_Text_Editor_mod(int X, int Y, int W, int H, const char* l = 0);
~Fl_Text_Editor_mod() { remove_all_key_bindings(); }
virtual int handle(int e);
/**
Sets the current insert mode; if non-zero, new text
is inserted before the current cursor position. Otherwise, new
text replaces text at the current cursor position.
*/
void insert_mode(int b) { insert_mode_ = b; }
/**
Gets the current insert mode; if non-zero, new text
is inserted before the current cursor position. Otherwise, new
text replaces text at the current cursor position.
*/
int insert_mode() { return insert_mode_; }
void add_key_binding(int key, int state, Key_Func f, Key_Binding** list);
/** Adds a key of state "state" with the function "function" */
void add_key_binding(int key, int state, Key_Func f)
{ add_key_binding(key, state, f, &key_bindings); }
void remove_key_binding(int key, int state, Key_Binding** list);
/** Removes the key binding associated with the key "key" of state "state". */
void remove_key_binding(int key, int state)
{ remove_key_binding(key, state, &key_bindings); }
void remove_all_key_bindings(Key_Binding** list);
/** Removes all of the key bindings associated with the text editor or list. */
void remove_all_key_bindings() { remove_all_key_bindings(&key_bindings); }
void add_default_key_bindings(Key_Binding** list);
Key_Func bound_key_function(int key, int state, Key_Binding* list);
/** Returns the function associated with a key binding. */
Key_Func bound_key_function(int key, int state)
{ return bound_key_function(key, state, key_bindings); }
/** Sets the default key function for unassigned keys. */
void default_key_function(Key_Func f) { default_key_function_ = f; }
// functions for the built in default bindings
static int kf_default(int c, Fl_Text_Editor_mod* e);
static int kf_ignore(int c, Fl_Text_Editor_mod* e);
static int kf_backspace(int c, Fl_Text_Editor_mod* e);
static int kf_enter(int c, Fl_Text_Editor_mod* e);
static int kf_move(int c, Fl_Text_Editor_mod* e);
static int kf_shift_move(int c, Fl_Text_Editor_mod* e);
static int kf_ctrl_move(int c, Fl_Text_Editor_mod* e);
static int kf_c_s_move(int c, Fl_Text_Editor_mod* e);
static int kf_meta_move(int c, Fl_Text_Editor_mod* e);
static int kf_m_s_move(int c, Fl_Text_Editor_mod* e);
static int kf_home(int, Fl_Text_Editor_mod* e);
static int kf_end(int c, Fl_Text_Editor_mod* e);
static int kf_left(int c, Fl_Text_Editor_mod* e);
static int kf_up(int c, Fl_Text_Editor_mod* e);
static int kf_right(int c, Fl_Text_Editor_mod* e);
static int kf_down(int c, Fl_Text_Editor_mod* e);
static int kf_page_up(int c, Fl_Text_Editor_mod* e);
static int kf_page_down(int c, Fl_Text_Editor_mod* e);
static int kf_insert(int c, Fl_Text_Editor_mod* e);
static int kf_delete(int c, Fl_Text_Editor_mod* e);
static int kf_copy(int c, Fl_Text_Editor_mod* e);
static int kf_cut(int c, Fl_Text_Editor_mod* e);
static int kf_paste(int c, Fl_Text_Editor_mod* e);
static int kf_select_all(int c, Fl_Text_Editor_mod* e);
static int kf_undo(int c, Fl_Text_Editor_mod* e);
protected:
int handle_key();
void maybe_do_callback();
#ifndef FL_DOXYGEN
int insert_mode_;
Key_Binding* key_bindings;
static Key_Binding* global_key_bindings;
Key_Func default_key_function_;
#endif
};
#endif
//
// End of "$Id: Fl_Text_Editor.H 6893 2009-09-20 19:24:24Z greg.ercolano $".
//

Wyświetl plik

@ -55,6 +55,7 @@ public:
void updatevalue();
void value(long lv);
long value(){return val;};
void font(Fl_Font n);
void SetONCOLOR (uchar r, uchar g, uchar b);
void SetOFFCOLOR (uchar r, uchar g, uchar b);
void GetONCOLOR (uchar &r, uchar &g, uchar &b) {
@ -73,6 +74,7 @@ private:
static const char *Label[];
int mult[MAX_DIGITS];
Fl_Box *decbx;
Fl_Font font_number;
Fl_Color OFFCOLOR;
Fl_Color ONCOLOR;
Fl_Color SELCOLOR;

Wyświetl plik

@ -20,7 +20,7 @@ extern Fl_Double_Window *dlgViewer;
extern Fl_Double_Window* createViewer();
extern void openViewer();
extern void viewaddchr(int ch, int freq, char c);
extern void viewaddchr(int ch, int freq, char c, int md);
extern void initViewer();
extern void viewclearchannel(int ch);
extern void viewer_paste_freq(int freq);

Wyświetl plik

@ -24,7 +24,7 @@
#define _anal_H
#include <string>
#include <fstream>
#include <ctime>
#include "complex.h"
#include "filters.h"
@ -47,29 +47,33 @@ private:
fftfilt *bpfilt;
Cmovavg *ffilt;
Cmovavg *favg;
mbuffer<double, analMaxSymLen, 2> pipe;
int pipeptr;
double prevsymbol;
complex prevsmpl;
int symbollen;
int restart_count;
double fout_1;
double fout_2;
long wf_freq;
struct timespec start_time;
double sum;
void clear_syncscope();
inline complex mixer(complex in);
int rx(bool bit);
double nco(double freq);
void writeFile();
std::ofstream analysisFile;
std::string analysisFilename;
public:
anal();
~anal();

Wyświetl plik

@ -7,6 +7,7 @@
void selectColorsFonts();
void cbWaterfallFontBrowser(Fl_Widget*, void*);
void cbViewerFontBrowser(Fl_Widget*, void*);
void cbFreqControlFontBrowser(Fl_Widget*, void*);
#include <FL/Fl_Double_Window.H>
extern Fl_Double_Window *dlgColorFont;
#include <FL/Fl_Button.H>
@ -16,6 +17,7 @@ extern Fl_Tabs *tabsColors;
#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
extern Fl_Box *FDdisplay;
extern Fl_Button *btn_freq_control_font;
extern Fl_Button *btnBackgroundColor;
extern Fl_Button *btnForegroundColor;
extern Fl_Button *btnFD_SystemColor;

Wyświetl plik

@ -82,8 +82,7 @@ extern Fl_Check_Button *btnWF_UIqsy;
extern Fl_Check_Button *btnWF_UIxmtlock;
extern Fl_Button *btn_wf_enable_all;
extern Fl_Button *btn_wf_disable_all;
extern Fl_Group *tabWfallRestart;
extern Fl_Check_Button *btnCheckButtons;
extern Fl_Check_Button *btn_rx_lowercase;
extern Fl_Group *tabWaterfall;
extern Fl_Tabs *tabsWaterfall;
#include "colorbox.h"
@ -171,6 +170,12 @@ extern Fl_Choice *mnuOlivia_Tones;
extern Fl_Counter2 *cntOlivia_smargin;
extern Fl_Counter2 *cntOlivia_sinteg;
extern Fl_Check_Button *btnOlivia_8bit;
extern Fl_Group *tabContestia;
extern Fl_Choice *mnuContestia_Bandwidth;
extern Fl_Choice *mnuContestia_Tones;
extern Fl_Counter2 *cntContestia_smargin;
extern Fl_Counter2 *cntContestia_sinteg;
extern Fl_Check_Button *btnContestia_8bit;
extern Fl_Group *tabPSK;
extern Fl_Tabs *tabsPSK;
extern Fl_Counter2 *cntSearchRange;

Wyświetl plik

@ -181,6 +181,9 @@
" 2: signal search; 3: change squelch level; 4: change modem carrier;\n" \
" 5: change modem; 6: scroll visible area. The default is 4.", \
waterfall::WF_CARRIER) \
ELEM_(bool, rx_lowercase, "RX_LOWERCASE", \
"Print Rx in lowercase for CW, RTTY, CONTESTIA and THROB", \
false) \
/* PSK, filter can be 0, 1, 2, 3 or 4 */ \
ELEM_(int, PSK_filter, "PSKFILTER", \
"Not configurable; must always be 0", \
@ -399,6 +402,24 @@
ELEM_(bool, olivia8bit, "OLIVIA8BIT", \
"8-bit extended characters", \
false) \
/* CONTESTIA */ \
ELEM_(int, contestiatones, "CONTESTIATONES", \
"Number of tones. Values are as follows:\n" \
" 0: 2; 1: 4; 2: 8; 3: 16; 4: 32; 5: 64; 6: 128; 7: 256", \
2) /* 8 */ \
ELEM_(int, contestiabw, "CONTESTIABW", \
"Bandwidth (Hz). Values are as follows:\n" \
" 0: 125; 1: 250; 2: 500; 3: 1000; 4: 2000.", \
2) /* 500 */ \
ELEM_(int, contestiasmargin, "CONTESTIASMARGIN", \
"Tune margin (tone frequency spacing)", \
8) \
ELEM_(int, contestiasinteg, "CONTESTIASINTEG", \
"Integration period (FEC blocks)", \
4) \
ELEM_(bool, contestia8bit, "CONTESTIA8BIT", \
"8-bit extended characters", \
false) \
/* THOR */ \
ELEM_(double, THOR_BW, "THORBW", \
"Filter bandwidth factor (bandwidth relative to signal width)", \
@ -525,9 +546,6 @@
ELEM_(bool, tooltips, "TOOLTIPS", \
"Show tooltips", \
true) \
ELEM_(bool, useCheckButtons, "USECHECKBUTTONS", \
"Use check buttons for AFC and SQL", \
false) \
ELEM_(bool, NagMe, "NAGME", \
"Prompt to save log", \
false) \
@ -983,6 +1001,12 @@
ELEM_(int, WaterfallFontsize, "WATERFALLFONTSIZE", \
"Waterfall font size", \
12) \
ELEM_(std::string, FreqControlFontName, "FREQCONTROLFONTNAME", \
"Frequency Control font name", \
"") \
ELEM_(Fl_Font, FreqControlFontnbr, "FREQCONTROLFONTNBR", \
"Frequency Control font number", \
FL_COURIER) \
ELEM_(std::string, ui_scheme, "UISCHEME", \
"FLTK UI scheme (none or base, gtk+, plastic)", \
"gtk+") \

Wyświetl plik

@ -0,0 +1,86 @@
// ----------------------------------------------------------------------------
// contestia.h
//
// Copyright (C) 2006-2010
// Dave Freese, W1HKJ
//
// This file is part of fldigi.
//
// Fldigi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Fldigi 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with fldigi. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef _CONTESTIA_H
#define _CONTESTIA_H
#include "modem.h"
#include "jalocha/pj_mfsk.h"
#include "sound.h"
#define TONE_DURATION (SCBLOCKSIZE * 16)
#define SR4 ((TONE_DURATION) / 4)
class contestia : public modem {
private:
MFSK_Transmitter < double >*Tx;
MFSK_Receiver < double >*Rx;
double *txfbuffer;
int txbufferlen;
double phaseacc;
complex prevsymbol;
int preamble;
unsigned int shreg;
double np;
double sp;
double sigpwr;
double noisepwr;
int escape;
int smargin;
int sinteg;
int tones;
int bw;
double tone_bw;
int preamblesent;
int postamblesent;
double preamblephase;
double txbasefreq;
double tone_midfreq;
double lastfreq;
double ampshape[SR4];
double tonebuff[TONE_DURATION];
double nco(double freq);
void send_tones();
public:
contestia();
~contestia();
void init();
void rx_init();
void tx_init(SoundBase *sc);
void restart();
int rx_process(const double *buf, int len);
int tx_process();
int unescape(int c);
};
#endif

Wyświetl plik

@ -111,8 +111,8 @@ extern Fl_Button *qso_btnClearList;
extern Fl_Value_Slider2 *valRcvMixer;
extern Fl_Value_Slider2 *valXmtMixer;
extern Fl_Button *btnAFC;
extern Fl_Button *btnSQL;
extern Fl_Button *btnAFC;
extern Fl_Button *btnSQL;
extern Fl_Light_Button *btnRSID;
extern Fl_Light_Button *btnTxRSID;
extern Fl_Light_Button *btnTune;
@ -132,7 +132,6 @@ extern Fl_Input2 *habCustom;
extern Fl_Input2 *habChecksum;
//
extern bool withnoise;
extern bool useCheckButtons;
extern int altMacros;
extern waterfall *wf;
@ -208,6 +207,7 @@ extern int get_secondary_char();
extern void put_echo_char(unsigned int data);
extern void resetRTTY();
extern void resetOLIVIA();
extern void resetCONTESTIA();
extern void resetTHOR();
extern void resetDOMEX();
extern void resetSoundCard();
@ -235,6 +235,9 @@ extern void set_rtty_tab_widgets();
extern void set_olivia_tab_widgets();
extern void set_olivia_default_integ();
extern void set_contestia_tab_widgets();
extern void set_contestia_default_integ();
extern void startMacroTimer();
extern void stopMacroTimer();
extern void cb_ResetSerNbr();
@ -254,6 +257,10 @@ void note_qrg(bool no_dup = true, const char* prefix = " ", const char* suffix =
void set_olivia_bw(int bw);
void set_olivia_tones(int tones);
void set_contestia_bw(int bw);
void set_contestia_tones(int tones);
void set_rtty_shift(int shift);
void set_rtty_baud(float baud);
void set_rtty_bits(int bits);

Wyświetl plik

@ -51,6 +51,8 @@ enum {
MODE_CW,
MODE_CONTESTIA,
MODE_DOMINOEX4,
MODE_DOMINOEX5,
MODE_DOMINOEX8,
@ -128,6 +130,7 @@ enum {
MODE_THROB_FIRST = MODE_THROB1,
MODE_THROB_LAST = MODE_THROBX4,
MODE_SSB,
MODE_WWV,
MODE_ANALYSIS,

0
src/include/jalocha/pj_cmpx.h 100755 → 100644
Wyświetl plik

0
src/include/jalocha/pj_fft.h 100755 → 100644
Wyświetl plik

0
src/include/jalocha/pj_fht.h 100755 → 100644
Wyświetl plik

0
src/include/jalocha/pj_fifo.h 100755 → 100644
Wyświetl plik

0
src/include/jalocha/pj_gray.h 100755 → 100644
Wyświetl plik

0
src/include/jalocha/pj_lowpass3.h 100755 → 100644
Wyświetl plik

4620
src/include/jalocha/pj_mfsk.h 100755 → 100644

Plik diff jest za duży Load Diff

0
src/include/jalocha/pj_struc.h 100755 → 100644
Wyświetl plik

Wyświetl plik

@ -1,6 +1,20 @@
#ifndef LOOKUPCALL_H
#define LOOKUPCALL_H
#include <cstring>
extern std::string lookup_latd;
extern std::string lookup_lond;
extern std::string lookup_addr1;
extern std::string lookup_addr2;
extern std::string lookup_qth;
extern std::string lookup_state;
extern std::string lookup_province;
extern std::string lookup_zip;
extern std::string lookup_country;
extern void clear_Lookup();
extern void CALLSIGNquery();
enum qrz_query_t { QRZ_EXIT = -1, QRZNONE, QRZNET, QRZCD, HAMCALLNET, QRZHTML, HAMCALLHTML };

Wyświetl plik

@ -123,7 +123,9 @@ public:
unsigned get_cap(void) { return cap; }
enum { CAP_AFC = 1 << 0, CAP_AFC_SR = 1 << 1, CAP_REV = 1 << 2,
CAP_IMG = 1 << 3, CAP_BW = 1 << 4 };
CAP_IMG = 1 << 3, CAP_BW = 1 << 4, CAP_RX = 1 << 5,
CAP_TX = 1 << 6
};
// for CW modem use only
bool get_cwTrack();
@ -231,6 +233,7 @@ extern modem *psk500r_modem;
extern modem *rtty_modem;
extern modem *olivia_modem;
extern modem *contestia_modem;
extern modem *thor4_modem;
extern modem *thor5_modem;
@ -256,6 +259,7 @@ extern modem *throbx4_modem;
extern modem *wwv_modem;
extern modem *anal_modem;
extern modem *ssb_modem;
#endif

Wyświetl plik

@ -89,12 +89,12 @@ private:
interleave *Rxinlv;
interleave *Rxinlv2;
interleave *Txinlv;
unsigned int bitshreg;
unsigned int bitshreg;
int rxbitstate;
//PSKR modes - Soft decoding
unsigned char symbolpair[2];
int fecmet;
int fecmet2;
double fecmet;
double fecmet2;
double phase;
double freqerr;
@ -102,15 +102,15 @@ private:
double bitclk;
double syncbuf[16];
double scope_pipe[2*PipeLen];//[PipeLen];
unsigned int pipeptr;
unsigned int dcdshreg;
unsigned int pipeptr;
unsigned int dcdshreg;
//PSKR modes - 2nd stream
unsigned int dcdshreg2;
int dcd;
int dcdbits;
int dcdbits;
complex quality;
int acquire;
int acquire;
viewpsk* pskviewer;
pskeval* evalpsk;

Wyświetl plik

@ -35,7 +35,7 @@ typedef void (*spot_recv_cb_t)(trx_mode mode, int afreq, const char* str, const
typedef void (*spot_log_cb_t)(const char* call, const char* loc, long long freq,
trx_mode mode, time_t rtime, void* data);
void spot_recv(char c, int decoder = -1, int afreq = 0);
void spot_recv(char c, int decoder = -1, int afreq = 0, int md = 0);
void spot_log(const char* callsign, const char* locator = "", long long freq = 0LL,
trx_mode mode = NUM_MODES, time_t rtime = -1L);
void spot_manual(const char* callsign, const char* locator = "",

43
src/include/ssb.h 100644
Wyświetl plik

@ -0,0 +1,43 @@
// ----------------------------------------------------------------------------
// ssb.h -- ssb modem
//
// Copyright (C) 2010
// Dave Freese, W1HKJ
//
// This file is part of fldigi.
//
// Fldigi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Fldigi 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with fldigi. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#ifndef _SSB_H
#define _SSB_H
#include "modem.h"
#define ssb_SampleRate 8000
class ssb : public modem
{
public:
ssb();
~ssb();
void init();
void rx_init();
void tx_init(SoundBase *sc);
void restart();
int rx_process(const double *buf, int len);
int tx_process();
};
#endif

Wyświetl plik

@ -11,8 +11,6 @@
#if !HAVE_CLOCK_GETTIME
enum clockid_t { CLOCK_REALTIME, CLOCK_MONOTONIC };
int clock_gettime(clockid_t clock_id, struct timespec* tp);
#elif !defined(CLOCK_MONOTONIC) // cygwin 1.5
# define CLOCK_MONOTONIC CLOCK_REALTIME
#endif
struct timespec operator+(const struct timespec &t0, const double &t);

Wyświetl plik

@ -177,7 +177,7 @@ const char* str2hex(const unsigned* str, size_t len);
const char* uint2bin(unsigned u, size_t len);
#if !defined(NDEBUG) && defined(deprecated__) && defined(__GNUC__) && !defined(__MINGW32__)
#if 0 && !defined(NDEBUG) && defined(deprecated__) && defined(__GNUC__) && !defined(__MINGW32__)
#include <stdio.h>
#include <string.h>
deprecated__ typeof(sprintf) sprintf;

Wyświetl plik

@ -166,7 +166,7 @@ btnSelectFreq->value(1);
btnSelectBand->value(1);
btnSelectMode->value(1);
btnSelectQSOdate->value(1);
btnSelectTimeON->value(0);
btnSelectTimeON->value(1);
btnSelectTimeOFF->value(1);
btnSelectQth->value(0);
btnSelectLOC->value(1);
@ -405,6 +405,7 @@ void create_logbook_dialogs() {
} // Fl_Check_Button* btnSelectQSOdate
{ btnSelectTimeON = new Fl_Check_Button(412, 142, 70, 15, _("Time ON"));
btnSelectTimeON->down_box(FL_DOWN_BOX);
btnSelectTimeON->value(1);
} // Fl_Check_Button* btnSelectTimeON
{ btnSelectTimeOFF = new Fl_Check_Button(412, 162, 70, 15, _("Time OFF"));
btnSelectTimeOFF->down_box(FL_DOWN_BOX);

Wyświetl plik

@ -1,5 +1,5 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0109
version 1.0110
i18n_type 1
i18n_include "gettext.h"
i18n_function _
@ -20,7 +20,7 @@ Function {create_logbook_dialogs()} {open return_type void
} {
Fl_Window wExport {
label {Export Setup} open
xywh {537 92 655 365} type Double hide modal
xywh {506 538 655 365} type Double modal visible
} {
Fl_Group {} {
label {Select Records to Export} open
@ -52,7 +52,7 @@ Export_log();}
xywh {405 340 100 20}
}
Fl_Group {} {
label {Select Fields to Export}
label {Select Fields to Export} open
xywh {392 4 258 330} box ENGRAVED_FRAME align 21
} {
Fl_Button btnClearAllFields {
@ -143,8 +143,8 @@ btnSelectNotes->value(1);}
xywh {412 122 70 15} down_box DOWN_BOX value 1
}
Fl_Check_Button btnSelectTimeON {
label {Time ON}
xywh {412 142 70 15} down_box DOWN_BOX
label {Time ON} selected
xywh {412 142 70 15} down_box DOWN_BOX value 1
}
Fl_Check_Button btnSelectTimeOFF {
label {Time OFF}
@ -238,7 +238,7 @@ btnSelectFreq->value(1);
btnSelectBand->value(1);
btnSelectMode->value(1);
btnSelectQSOdate->value(1);
btnSelectTimeON->value(0);
btnSelectTimeON->value(1);
btnSelectTimeOFF->value(1);
btnSelectQth->value(0);
btnSelectLOC->value(1);
@ -262,10 +262,10 @@ btnSelectTX_pwr->value(0);}
}
}
Fl_Window dlgLogbook {
label Logbook open
label Logbook
xywh {540 120 570 350} type Double color 47 resizable visible
} {
Fl_Group editGroup {open selected
Fl_Group editGroup {open
xywh {2 2 565 228} box ENGRAVED_FRAME color 52
} {
Fl_Input inpDate_log {

Wyświetl plik

@ -180,6 +180,7 @@ void set_platform_ui(void);
double speed_test(int converter, unsigned repeat);
static void setup_signal_handlers(void);
static void checkdirectories(void);
static void arg_error(const char* name, const char* arg, bool missing) noreturn__;
// TODO: find out why fldigi crashes on OS X if the wizard window is
@ -248,6 +249,8 @@ int main(int argc, char ** argv)
main_window_title = PACKAGE_TARNAME;
checkdirectories();
check_nbems_dirs();
try {
debug::start(string(HomeDir).append("status_log.txt").c_str());
time_t t = time(NULL);

Wyświetl plik

@ -129,7 +129,7 @@ mfsk::~mfsk()
mfsk::mfsk(trx_mode mfsk_mode) : modem()
{
cap = CAP_AFC | CAP_REV;
cap |= CAP_AFC | CAP_REV;
double bw, cf, flo, fhi;
mode = mfsk_mode;

Wyświetl plik

@ -412,9 +412,10 @@ bool WRAP_auto_arqRx()
LOG_DEBUG("%s", arqtext.c_str());
start_tx();
txstring.clear();
return true;
}
}
return true;
return false;
}
//-----------------------------------------------------------------------------
@ -582,9 +583,11 @@ bool Socket_arqRx()
start_tx();
}
txstring.clear();
cmdstring.clear();
return true;
}
cmdstring.clear();
return true;
return false;
}
catch (const SocketException& e) {
arq_stop();

Wyświetl plik

@ -81,7 +81,7 @@ const char *szBands[] = {
"1830", "3580", "7030", "7070", "10138",
"14070", "18100", "21070", "21080", "24920", "28070", "28120", 0};
#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 1
// Define stream I/O operators for non-builtin types.
// Right now we have: Fl_Color, Fl_Font, RGB, and RGBI
ostream& operator<<(ostream& out, const Fl_Color& c)
@ -106,6 +106,7 @@ istream& operator>>(istream& in, Fl_Font& f)
f = static_cast<Fl_Font>(i);
return in;
}
#endif
ostream& operator<<(ostream& out, const RGB& rgb)
{
return out << (int)rgb.R << ' ' << (int)rgb.G << ' ' << (int)rgb.B;
@ -416,6 +417,13 @@ void configuration::loadDefaults()
cntOlivia_sinteg->value(oliviasinteg);
btnOlivia_8bit->value(olivia8bit);
// CONTESTIA
mnuContestia_Tones->value(contestiatones);
mnuContestia_Bandwidth->value(contestiabw);
cntContestia_smargin->value(contestiasmargin);
cntContestia_sinteg->value(contestiasinteg);
btnContestia_8bit->value(contestia8bit);
chkDominoEX_FEC->value(DOMINOEX_FEC);
btnmt63_interleave->value(mt63_interleave == 64);
@ -441,6 +449,7 @@ void configuration::saveDefaults()
TxFontName = Fl::get_font_name(TxFontnbr);
WaterfallFontName = Fl::get_font_name(WaterfallFontnbr);
ViewerFontName = Fl::get_font_name(ViewerFontnbr);
FreqControlFontName = Fl::get_font_name(FreqControlFontnbr);
writeDefaultsXML();
changed = false;
@ -975,5 +984,7 @@ void configuration::initFonts(void)
WaterfallFontnbr = font_number(WaterfallFontName.c_str());
if (!ViewerFontName.empty())
ViewerFontnbr = font_number(ViewerFontName.c_str());
if (!FreqControlFontName.empty())
FreqControlFontnbr = font_number(FreqControlFontName.c_str());
}

Wyświetl plik

@ -193,6 +193,7 @@ bool parseSessionKey(const string& sessionpage)
bool parse_xml(const string& xmlpage)
{
//printf("%s\n", xmlpage.c_str());
IrrXMLReader* xml = createIrrXMLReader(new IIrrXMLStringReader(xmlpage));
// If we got any result back, clear the session key so that it will be
@ -204,20 +205,7 @@ bool parse_xml(const string& xmlpage)
qrzerror.clear();
clear_Lookup();
}
// strings for storing the data we want to get out of the file
string call,
fname,
name,
addr1,
addr2,
state,
zip,
country,
latd,
lond,
grid,
dob;
TAG tag = QRZ_IGNORE;
// parse the file until end reached
@ -230,7 +218,6 @@ bool parse_xml(const string& xmlpage)
case QRZ_IGNORE:
break;
case QRZ_CALL:
call = xml->getNodeData();
break;
case QRZ_FNAME:
lookup_fname = xml->getNodeData();
@ -239,8 +226,13 @@ bool parse_xml(const string& xmlpage)
lookup_name = xml->getNodeData();
break;
case QRZ_ADDR1:
{
lookup_addr1 = xml->getNodeData();
size_t apt = lookup_addr1.find("#");
if (apt != string::npos)
lookup_addr1.erase(apt, lookup_addr1.length() - apt);
break;
}
case QRZ_ADDR2:
lookup_addr2 = xml->getNodeData();
break;
@ -293,8 +285,8 @@ bool parse_xml(const string& xmlpage)
else if (!strcmp("state", nodeName)) tag = QRZ_STATE;
else if (!strcmp("zip", nodeName)) tag = QRZ_ZIP;
else if (!strcmp("country", nodeName)) tag = QRZ_COUNTRY;
else if (!strcmp("latd", nodeName)) tag = QRZ_LATD;
else if (!strcmp("lond", nodeName)) tag = QRZ_LOND;
else if (!strcmp("lat", nodeName)) tag = QRZ_LATD;
else if (!strcmp("lon", nodeName)) tag = QRZ_LOND;
else if (!strcmp("grid", nodeName)) tag = QRZ_GRID;
else if (!strcmp("dob", nodeName)) tag = QRZ_DOB;
else if (!strcmp("Alert", nodeName)) tag = QRZ_ALERT;

Wyświetl plik

@ -56,7 +56,7 @@ Fl_Button *btnMacroEditCancel = (Fl_Button *)0;
Fl_Button *btnInsertMacro = (Fl_Button *)0;
Fl_Input2 *macrotext = (Fl_Input2 *)0;
Fl_Input2 *labeltext = (Fl_Input2 *)0;
static int widths[] = {110, 0};
static int widths[] = {130, 0};
Fl_Hold_Browser *macroDefs=(Fl_Hold_Browser *)0;
@ -86,7 +86,9 @@ void loadBrowser(Fl_Widget *widget) {
w->add(_("<NAME>\tother name"));
w->add(_("<QTH>\tother QTH"));
w->add(_("<RST>\tother RST"));
w->add(_("<MAPIT>\tmap on google"));
w->add(_("<MAPIT:adr/lat/loc>\tmap by value"));
w->add(LINE_SEP);
w->add(_("<CLRRX>\tclear RX pane"));
@ -149,12 +151,23 @@ void loadBrowser(Fl_Widget *widget) {
w->add(_("<MACROS:>\tchange macro defs file"));
w->add(LINE_SEP);
assert(MODE_OLIVIA < MODE_RTTY);
assert(MODE_CONTESTIA < MODE_OLIVIA);
char s[256];
for (trx_mode i = 0; i <= MODE_OLIVIA; i++) {
for (trx_mode i = 0; i <= MODE_CONTESTIA; i++) {
snprintf(s, sizeof(s), "<MODEM:%s>", mode_info[i].sname);
w->add(s);
}
// add some Contestia macros
const char* contestia[] = { "250:8", "500:8", "500:16", "1000:8", "1000:16" };
for (size_t i = 0; i < sizeof(contestia)/sizeof(*contestia); i++) {
snprintf(s, sizeof(s), "<MODEM:%s:%s>", mode_info[MODE_CONTESTIA].sname, contestia[i]);
w->add(s);
}
for (trx_mode i = MODE_CONTESTIA + 1; i <= MODE_OLIVIA; i++) {
snprintf(s, sizeof(s), "<MODEM:%s>", mode_info[i].sname);
w->add(s);
}
assert(MODE_OLIVIA < MODE_RTTY);
// add some Olivia macros
const char* olivia[] = { "250:8", "500:8", "500:16", "1000:8", "1000:32" };
for (size_t i = 0; i < sizeof(olivia)/sizeof(*olivia); i++) {

Wyświetl plik

@ -128,6 +128,7 @@ void pSRCHUP(string&, size_t&);
void pSRCHDN(string&, size_t&);
void pGOHOME(string&, size_t&);
void pGOFREQ(string&, size_t&);
void pMAPIT(string&, size_t&);
//void pMACROS(string &, size_t &);
@ -191,6 +192,8 @@ MTAGS mtags[] = {
{"<SRCHDN>", pSRCHDN},
{"<GOHOME>", pGOHOME},
{"<GOFREQ:", pGOFREQ},
{"<MAPIT:", pMAPIT},
{"<MAPIT>", pMAPIT},
{0, 0}
};
@ -673,6 +676,12 @@ void pMODEM(string &s, size_t &i)
if (args.at(2) != DBL_MIN)
set_rtty_bits((int)args[2]);
break;
case MODE_CONTESTIA: // bandwidth, tones
if (args.at(0) != DBL_MIN)
set_contestia_bw((int)args[0]);
if (args.at(1) != DBL_MIN)
set_contestia_tones((int)args[1]);
break;
case MODE_OLIVIA: // bandwidth, tones
if (args.at(0) != DBL_MIN)
set_olivia_bw((int)args[0]);
@ -723,6 +732,7 @@ void pLOCK(string &s, size_t &i)
wf->xmtlock->value(!wf->xmtlock->value());
wf->xmtlock->damage();
wf->xmtlock->do_callback();
}
s.replace(i, endbracket - i + 1, "");
}
@ -986,6 +996,71 @@ void pEXEC(string& s, size_t& i)
}
#endif // !__MINGW32__
void MAPIT(int how)
{
float lat = 0, lon = 0;
string sCALL = inpCall->value();
string sLOC = inpLoc->value();
string url = "http://maps.google.com/maps?q=";
// if (lookup_addr1.empty() && lookup_addr2.empty() &&
// lookup_state.empty() && lookup_country.empty()) {
if (how > 1 && !lookup_country.empty()) {
url.append(lookup_addr1).append(",").append(lookup_addr2).append(",");
url.append(lookup_state).append(",").append(lookup_country);
} else {
if (how > 0 && (!lookup_latd.empty() && !lookup_lond.empty())) {
url.append(lookup_latd).append(",");
url.append(lookup_lond);
} else {
if (sLOC.empty()) return;
if (sLOC.length() < 4) return;
if (sLOC.length() < 6) sLOC.append("aa");
for (size_t i = 0; i < 6; i++) sLOC[i] = toupper(sLOC[i]);
if (sLOC[0] -'A' > 17 || sLOC[4] - 'A' > 23 ||
sLOC[1] -'A' > 17 || sLOC[5] - 'A' > 23 ||
!isdigit(sLOC[2]) || !isdigit(sLOC[3])) return;
lon = -180.0 +
(sLOC[0] - 'A') * 20 +
(sLOC[2] - '0') * 2 +
(sLOC[4] - 'A' + 0.5) / 12;
lat = -90.0 +
(sLOC[1] - 'A') * 10 +
(sLOC[3] - '0') +
(sLOC[5] - 'A' + 0.5) / 24;
char sdata[20];
snprintf(sdata, sizeof(sdata),"%10.6f", lat);
url.append(sdata).append(",");
snprintf(sdata, sizeof(sdata),"%10.6f", lon);
url.append(sdata);
}
}
if (!sCALL.empty()) url.append("(").append(sCALL).append(")");
else url.append("(nocall)");
url.append("&t=p&z=10");
cb_mnuVisitURL(NULL, (void*)url.c_str());
}
void pMAPIT(string &s, size_t &i)
{
size_t endbracket = s.find('>',i);
string sVal = s.substr(i + 7, endbracket - i - 7);
if (sVal.length() > 0) {
if (sVal.compare(0,3,"adr") == 0)
REQ(MAPIT,2);
else if (sVal.compare(0,6,"latlon") == 0)
REQ(MAPIT,1);
else if (sVal.compare(0,3,"loc") == 0)
REQ(MAPIT,0);
else
REQ(MAPIT,2);
} else
REQ(MAPIT,2);
s.erase(i, s.find('>', i) + 1 - i);
expand = false;
}
void pSTOP(string &s, size_t &i)
{
s.erase(i, s.find('>', i) + 1 - i);

Wyświetl plik

@ -395,7 +395,7 @@ void Wizard::create_wizard(void)
b->callback(wizard_cb, this);
set_icon_label(b);
b->align(buttons[i].align | FL_ALIGN_INSIDE);
b->size(fl_width(get_icon_label_text(b)) + icon_pad * 2, b->h());
b->size(static_cast<int>(fl_width(get_icon_label_text(b)) + icon_pad * 2), b->h());
}
set_active(prev, false);
done->hide();

Wyświetl plik

@ -79,7 +79,7 @@ status progStatus = {
560, // int rigW
80, // int rigH
1000, // int carrier;
3580000, // int noCATfreq;
0, // int noCATfreq;
"USB", // string noCATmode;
"3000", // string noCATwidth;
1, // int mag;
@ -87,7 +87,7 @@ status progStatus = {
NORMAL, // WFdisp::WFspeed
-20, // reflevel
-70, // ampspan
40, // uint VIEWERnchars
30, // uint VIEWERnchars
50, // uint VIEWERxpos
50, // uint VIEWERypos
false, // bool VIEWERvisible

Wyświetl plik

@ -34,12 +34,24 @@
# include <errno.h>
int clock_gettime(clockid_t clock_id, struct timespec* tp)
{
struct timeval t;
if (gettimeofday(&t, NULL) != 0)
if (clock_id == CLOCK_REALTIME) {
struct timeval t;
if (unlikely(gettimeofday(&t, NULL) != 0))
return -1;
tp->tv_sec = t.tv_sec;
tp->tv_nsec = t.tv_usec * 1000;
}
#ifdef __WOE32__
else if (clock_id == CLOCK_MONOTONIC) {
int32_t msec = GetTickCount();
tp->tv_sec = msec / 1000;
tp->tv_nsec = (msec % 1000) * 1000000;
}
#endif
else {
errno = EINVAL;
return -1;
tp->tv_sec = t.tv_sec;
tp->tv_nsec = t.tv_usec * 1000;
}
return 0;
}

Wyświetl plik

@ -2173,7 +2173,7 @@ public:
try {
params->verifyEnd(2);
Fl_Text_Buffer* tbuf = ReceiveText->buffer();
Fl_Text_Buffer_mod* tbuf = ReceiveText->buffer();
int len = tbuf->length();
int start = params->getInt(0, 0, len - 1);
int n = params->getInt(1, -1, len - start);

Wyświetl plik

@ -159,10 +159,11 @@ int olivia::tx_process()
// to read any more. If stopflag is set, we will always read
// whatever there is.
if (stopflag || (Tx->GetReadReady() < Tx->BitsPerSymbol)) {
if ((c = get_tx_char()) == 0x03 || stopflag ) {
if (!stopflag && (c = get_tx_char()) == 0x03)
stopflag = true;
if (stopflag)
Tx->Stop();
} else {
else {
/* Replace un-representable characters with a dot */
if (c == -1)
c = 0;
@ -190,6 +191,7 @@ int olivia::tx_process()
if (!Tx->Running()) {
cwid();
stopflag = false;
return -1;
}
@ -232,7 +234,7 @@ int olivia::rx_process(const double *buf, int len)
for (int i = frequency - Rx->Bandwidth/2; i < frequency - 1 + Rx->Bandwidth/2; i++)
if (wf->Pwr(i) > sp)
sp = wf->Pwr(i);
np = wf->Pwr(frequency + Rx->Bandwidth/2 + 2*Rx->Bandwidth/Rx->Tones);
np = wf->Pwr(static_cast<int>(frequency + Rx->Bandwidth/2 + 2*Rx->Bandwidth/Rx->Tones));
if (np == 0) np = sp + 1e-8;
sigpwr = decayavg( sigpwr, sp, 10);
noisepwr = decayavg( noisepwr, np, 50);
@ -266,9 +268,10 @@ void olivia::restart()
sinteg = progdefaults.oliviasinteg;
samplerate = 8000;
bandwidth = 125 * (1 << bw);
Tx->Tones = 2 * (1 << tones);
Tx->Bandwidth = 125 * (1 << bw);
Tx->Bandwidth = bandwidth;
Tx->SampleRate = samplerate;
Tx->OutputSampleRate = samplerate;
txbasefreq = get_txfreq_woffset();
@ -292,7 +295,7 @@ void olivia::restart()
txfbuffer = new double[txbufferlen];
Rx->Tones = Tx->Tones;
Rx->Bandwidth = Tx->Bandwidth;
Rx->Bandwidth = bandwidth;
Rx->SyncMargin = smargin;
Rx->SyncIntegLen = sinteg;
Rx->SyncThreshold = progStatus.sqlonoff ?
@ -320,19 +323,19 @@ void olivia::restart()
metric = 0;
sigpwr = 1e-10; noisepwr = 1e-8;
// Rx->PrintParameters();
LOG_INFO("\nOlivia Rx parameters:\n%s", Rx->PrintParameters());
}
void olivia::init()
{
modem::init();
restart();
modem::init();
set_scope_mode(Digiscope::BLANK);
}
olivia::olivia()
{
cap = CAP_REV;
cap |= CAP_REV;
txfbuffer = 0;
samplerate = 8000;

Wyświetl plik

@ -113,6 +113,7 @@ void psk::rx_init()
afcmetric = 0.0;
// interleaver, split incoming bit stream into two, one late by one bit
rxbitstate = 0;
fecmet = fecmet2 = 0;
}
@ -125,8 +126,8 @@ void psk::restart()
void psk::init()
{
modem::init();
restart();
modem::init();
set_scope_mode(Digiscope::PHASE);
initSN_IMD();
snratio = 1.0;
@ -160,7 +161,7 @@ psk::~psk()
psk::psk(trx_mode pskmode) : modem()
{
cap = CAP_AFC | CAP_AFC_SR;
cap |= CAP_AFC | CAP_AFC_SR;
mode = pskmode;
@ -1018,20 +1019,20 @@ void psk::tx_char(unsigned char c)
void psk::tx_flush()
{
if (_pskr) {
for (int i = 0; i < dcdbits; i++)
tx_bit(0);
}
// QPSK - flush the encoder
if (_qpsk) {
for (int i = 0; i < dcdbits; i++)
tx_bit(0);
// FEC : replace unmodulated carrier by an encoded sequence of zeros
} else if (_pskr) {
for (int i = 0; i < dcdbits; i++)
tx_bit(0);
} else {
// Standard BPSK postamble
// DCD off sequence (unmodulated carrier)
for (int i = 0; i < dcdbits; i++)
tx_symbol(2);
}
// Standard BPSK postamble
// DCD off sequence (unmodulated carrier)
for (int i = 0; i < dcdbits; i++)
tx_symbol(2);
}
// Necessary to clear the interleaver before we start sending

Wyświetl plik

@ -151,7 +151,7 @@ void viewpsk::rx_bit(int ch, int bit)
shreg[ch] = 0;
if (c == '\n' || c == '\r') c = ' ';
if (isprint(c)) {
REQ(&viewaddchr, ch, (int)frequency[ch], c);
REQ(&viewaddchr, ch, (int)frequency[ch], c, viewmode);
timeout[ch] = now + progdefaults.VIEWERtimeout;
}
}

Wyświetl plik

@ -79,6 +79,7 @@ void cbSelectDigit (Fl_Widget *btn, void * nbr)
cFreqControl::cFreqControl(int x, int y, int w, int h, const char *lbl):
Fl_Group(x,y,w,h,"") {
font_number = FL_COURIER;
ONCOLOR = FL_YELLOW;
OFFCOLOR = FL_BLACK;
SELCOLOR = fl_rgb_color(100, 100, 100);
@ -106,20 +107,20 @@ cFreqControl::cFreqControl(int x, int y, int w, int h, const char *lbl):
fcHeight-4,
" ");
Digit[n]->box(FL_FLAT_BOX);
Digit[n]->labelfont(FL_COURIER);
Digit[n]->labelfont(font_number);
Digit[n]->labelcolor(ONCOLOR);
Digit[n]->color(OFFCOLOR, SELCOLOR);
Digit[n]->labelsize(fcHeight);
Digit[n]->labelsize(fcHeight-4);
Digit[n]->callback(cbSelectDigit, (void *) n);
mult[n] = max;
max *= 10;
}
decbx = new Fl_Box(fcFirst + (nD - 3) * fcWidth + 2, fcTop + 2, pw, fcHeight-4,".");
decbx->box(FL_FLAT_BOX);
decbx->labelfont(FL_COURIER);
decbx->labelfont(font_number);
decbx->labelcolor(ONCOLOR);
decbx->color(OFFCOLOR);
decbx->labelsize(fcHeight);
decbx->labelsize(fcHeight-4);
cbFunc = NULL;
maxVal = max * 10 - 1;
@ -202,6 +203,15 @@ void cFreqControl::SetOFFCOLOR (uchar r, uchar g, uchar b)
damage();
}
void cFreqControl::font(Fl_Font fnt)
{
font_number = fnt;
for (int n = 0; n < nD; n++)
Digit[n]->labelfont(fnt);
decbx->labelfont(fnt);
damage();
}
static void blink_point(Fl_Widget* w)
{
w->label(*w->label() ? "" : ".");

Wyświetl plik

@ -179,17 +179,17 @@ void hamlib_init_defaults()
{
progdefaults.HamRigModel = hamlib_get_rig_model(cboHamlibRig->index());
progdefaults.HamRigDevice = inpRIGdev->value();
progdefaults.HamlibRetries = cntHamlibRetries->value();
progdefaults.HamlibTimeout = cntHamlibTimeout->value();
progdefaults.HamlibWriteDelay = cntHamlibWriteDelay->value();
progdefaults.HamlibWait = cntHamlibWait->value();
progdefaults.HamlibRetries = static_cast<int>(cntHamlibRetries->value());
progdefaults.HamlibTimeout = static_cast<int>(cntHamlibTimeout->value());
progdefaults.HamlibWriteDelay = static_cast<int>(cntHamlibWriteDelay->value());
progdefaults.HamlibWait = static_cast<int>(cntHamlibWait->value());
progdefaults.HamlibCMDptt = btnHamlibCMDptt->value();
progdefaults.HamlibDTRplus = btnHamlibDTRplus->value();
progdefaults.HamlibRTSCTSflow = chkHamlibRTSCTSflow->value();
progdefaults.HamlibRTSplus = chkHamlibRTSplus->value();
progdefaults.HamlibXONXOFFflow = chkHamlibXONXOFFflow->value();
progdefaults.HamlibSideband = mnuSideband->value();
progdefaults.HamRigStopbits = valHamRigStopbits->value();
progdefaults.HamRigStopbits = static_cast<int>(valHamRigStopbits->value());
progdefaults.HamRigBaudrate = mnuBaudRate->value();
progdefaults.HamlibCMDptt = btnHamlibCMDptt->value();
progdefaults.HamConfig = inpHamlibConfig->value();

Wyświetl plik

@ -1001,15 +1001,15 @@ void rigCAT_init_defaults()
{
progdefaults.XmlRigDevice = inpXmlRigDevice->value();
progdefaults.XmlRigBaudrate = mnuXmlRigBaudrate->value();
progdefaults.RigCatStopbits = valRigCatStopbits->value();
progdefaults.RigCatStopbits = static_cast<int>(valRigCatStopbits->value());
progdefaults.RigCatRTSplus = btnRigCatRTSplus->value();
progdefaults.RigCatDTRplus = btnRigCatDTRplus->value();
progdefaults.RigCatRTSptt = btnRigCatRTSptt->value();
progdefaults.RigCatDTRptt = btnRigCatDTRptt->value();
progdefaults.RigCatRTSCTSflow = chkRigCatRTSCTSflow->value();
progdefaults.RigCatRetries = cntRigCatRetries->value();
progdefaults.RigCatTimeout = cntRigCatTimeout->value();
progdefaults.RigCatWait = cntRigCatWait->value();
progdefaults.RigCatRetries = static_cast<int>(cntRigCatRetries->value());
progdefaults.RigCatTimeout = static_cast<int>(cntRigCatTimeout->value());
progdefaults.RigCatWait = static_cast<int>(cntRigCatWait->value());
progdefaults.RigCatECHO = btnRigCatEcho->value();
progdefaults.RigCatCMDptt = btnRigCatCMDptt->value();
}
@ -1199,7 +1199,7 @@ static void *rigCAT_loop(void *args)
sMode = rigCAT_getmode();
pthread_mutex_unlock(&rigCAT_mutex);
if ((freq > 0) && (freq != llFreq)) {
if ((freq >= 0) && (freq != llFreq)) {
llFreq = freq;
show_frequency(freq);
wf->rfcarrier(freq);

Wyświetl plik

@ -392,7 +392,9 @@ void qso_selectFreq()
}
// transceiver frequency
if (freqlist[n].rfcarrier > 0) {
qsoFreqDisp->value(freqlist[n].rfcarrier);
qsoFreqDisp1->value(freqlist[n].rfcarrier);
qsoFreqDisp2->value(freqlist[n].rfcarrier);
qsoFreqDisp3->value(freqlist[n].rfcarrier);
sendFreq(freqlist[n].rfcarrier);
}
// modem type & audio sub carrier
@ -479,7 +481,7 @@ bool init_NoRig_RigDialog()
clearList();
buildlist();
windowTitle = _("Rig Not Specified");
windowTitle = _("Enter Xcvr Freq");
setTitle();
return true;

Wyświetl plik

@ -120,15 +120,15 @@ LOG_FILE_SOURCE(debug::LOG_MODEM);
ELEM_(47, THROBX_2, MODE_THROBX2) \
ELEM_(146, THROBX_4, MODE_THROBX4) \
\
ELEM_(49, CONTESTIA_8_250, NUM_MODES) \
ELEM_(50, CONTESTIA_16_500, NUM_MODES) \
ELEM_(51, CONTESTIA_32_1000, NUM_MODES) \
ELEM_(52, CONTESTIA_8_500, NUM_MODES) \
ELEM_(53, CONTESTIA_16_1000, NUM_MODES) \
ELEM_(54, CONTESTIA_4_500, NUM_MODES) \
ELEM_(55, CONTESTIA_4_250, NUM_MODES) \
ELEM_(117, CONTESTIA_8_1000, NUM_MODES) \
ELEM_(169, CONTESTIA_8_125, NUM_MODES) \
ELEM_(49, CONTESTIA_8_250, MODE_CONTESTIA) \
ELEM_(50, CONTESTIA_16_500, MODE_CONTESTIA) \
ELEM_(51, CONTESTIA_32_1000, MODE_CONTESTIA) \
ELEM_(52, CONTESTIA_8_500, MODE_CONTESTIA) \
ELEM_(53, CONTESTIA_16_1000, MODE_CONTESTIA) \
ELEM_(54, CONTESTIA_4_500, MODE_CONTESTIA) \
ELEM_(55, CONTESTIA_4_250, MODE_CONTESTIA) \
ELEM_(117, CONTESTIA_8_1000, MODE_CONTESTIA) \
ELEM_(169, CONTESTIA_8_125, MODE_CONTESTIA) \
\
ELEM_(56, VOICE, NUM_MODES) \
\
@ -571,6 +571,52 @@ void cRsId::apply(int iSymbol, int iBin)
progdefaults.oliviabw = 0;
REQ(&set_olivia_tab_widgets);
break;
// contestia parameters
case RSID_CONTESTIA_8_125:
progdefaults.contestiatones = 2;
progdefaults.contestiabw = 0;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_4_250:
progdefaults.contestiatones = 1;
progdefaults.contestiabw = 1;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_8_250:
progdefaults.contestiatones = 2;
progdefaults.contestiabw = 1;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_4_500:
progdefaults.contestiatones = 1;
progdefaults.contestiabw = 2;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_8_500:
progdefaults.contestiatones = 2;
progdefaults.contestiabw = 2;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_16_500:
progdefaults.contestiatones = 3;
progdefaults.contestiabw = 2;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_8_1000:
progdefaults.contestiatones = 2;
progdefaults.contestiabw = 3;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_16_1000:
progdefaults.contestiatones = 3;
progdefaults.contestiabw = 3;
REQ(&set_contestia_tab_widgets);
break;
case RSID_CONTESTIA_32_1000:
progdefaults.contestiatones = 4;
progdefaults.contestiabw = 3;
REQ(&set_contestia_tab_widgets);
break;
// mt63
case RSID_MT63_500_LG: case RSID_MT63_1000_LG: case RSID_MT63_2000_LG:
progdefaults.mt63_interleave = 64;
@ -749,6 +795,29 @@ void cRsId::send(bool preRSID)
rmode = RSID_OLIVIA_16_500;
break;
case MODE_CONTESTIA:
if (progdefaults.contestiatones == 2 && progdefaults.contestiabw == 1)
rmode = RSID_CONTESTIA_8_250;
else if (progdefaults.contestiatones == 3 && progdefaults.contestiabw == 2)
rmode = RSID_CONTESTIA_16_500;
else if (progdefaults.contestiatones == 4 && progdefaults.contestiabw == 3)
rmode = RSID_CONTESTIA_32_1000;
else if (progdefaults.contestiatones == 2 && progdefaults.contestiabw == 2)
rmode = RSID_CONTESTIA_8_500;
else if (progdefaults.contestiatones == 3 && progdefaults.contestiabw == 3)
rmode = RSID_CONTESTIA_16_1000;
else if (progdefaults.contestiatones == 1 && progdefaults.contestiabw == 2)
rmode = RSID_CONTESTIA_4_500;
else if (progdefaults.contestiatones == 1 && progdefaults.contestiabw == 1)
rmode = RSID_CONTESTIA_4_250;
else if (progdefaults.contestiatones == 2 && progdefaults.contestiabw == 3)
rmode = RSID_CONTESTIA_8_1000;
else if (progdefaults.contestiatones == 2 && progdefaults.contestiabw == 0)
rmode = RSID_CONTESTIA_8_125;
else
rmode = RSID_CONTESTIA_16_500;
break;
case MODE_DOMINOEX4:
if (progdefaults.DOMINOEX_FEC)
rmode = RSID_DOMINOEX_4_FEC;

Wyświetl plik

@ -467,8 +467,8 @@ static void notify_gui_to_event(notify_t& n)
n.action.rx_marker = inpNotifyActionRXMarker->value();
n.action.macro = inpNotifyActionMacro->value();
n.action.program = inpNotifyActionProgram->value();
n.action.trigger_limit = cntNotifyActionLimit->value();
n.action.alert_timeout = cntNotifyActionDialogTimeout->value();
n.action.trigger_limit = static_cast<time_t>(cntNotifyActionLimit->value());
n.action.alert_timeout = static_cast<time_t>(cntNotifyActionDialogTimeout->value());
// filter
if (chkNotifyFilterCall->value()) {
@ -491,7 +491,7 @@ static void notify_gui_to_event(notify_t& n)
// dup
n.dup_ignore = chkNotifyDupIgnore->value();
n.dup_ref = mnuNotifyDupWhich->value();
n.dup.when = cntNotifyDupTime->value();
n.dup.when = static_cast<time_t>(cntNotifyDupTime->value());
n.dup.band = chkNotifyDupBand->value() ? NUM_BANDS : static_cast<band_t>(0);
n.dup.mode = chkNotifyDupMode->value() ? NUM_MODES : static_cast<trx_mode>(0);
}

Wyświetl plik

@ -66,15 +66,19 @@ static tr1::unordered_map<int, string> buffers;
static cblist_t cblist;
static rcblist_t rcblist;
void spot_recv(char c, int decoder, int afreq)
void spot_recv(char c, int decoder, int afreq, int md)
{
static trx_mode last_mode = NUM_MODES + 1;
if (decoder == -1) // mode without multiple decoders
if (decoder == -1) { // mode without multiple decoders
decoder = active_modem->get_mode();
if (last_mode != active_modem->get_mode()) {
if (last_mode != active_modem->get_mode()) {
buffers.clear();
last_mode = active_modem->get_mode();
}
} else if (last_mode != md) {
buffers.clear();
last_mode = active_modem->get_mode();
last_mode = md;
}
if (afreq == 0)
afreq = active_modem->get_freq();

81
src/ssb/ssb.cxx 100644
Wyświetl plik

@ -0,0 +1,81 @@
// ----------------------------------------------------------------------------
// ssb.cxx -- ssb modem
//
// Copyright (C) 2010
// Dave Freese, W1HKJ
//
// This file is part of fldigi.
//
// Fldigi is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Fldigi 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with fldigi. If not, see <http://www.gnu.org/licenses/>.
// ----------------------------------------------------------------------------
#include <config.h>
#include "ssb.h"
#include "modem.h"
#include "digiscope.h"
#include "fl_digi.h"
#include "debug.h"
#define ssb_bw 4
void ssb::tx_init(SoundBase *sc)
{
}
void ssb::rx_init()
{
put_MODEstatus(mode);
}
void ssb::init()
{
modem::init();
rx_init();
set_scope_mode(Digiscope::BLANK);
}
ssb::~ssb()
{
}
void ssb::restart()
{
set_bandwidth(ssb_bw);
}
ssb::ssb()
{
mode = MODE_SSB;
samplerate = 8000;
cap &= ~CAP_TX;
restart();
}
// dummy process
int ssb::rx_process(const double *buf, int len)
{
return 0;
}
//=====================================================================
// ssb transmit
// dummy process
//=====================================================================
int ssb::tx_process()
{
return -1;
}

Wyświetl plik

@ -151,7 +151,7 @@ thor::~thor()
thor::thor(trx_mode md)
{
cap = CAP_REV;
cap |= CAP_REV;
mode = md;

Wyświetl plik

@ -119,7 +119,7 @@ void throb::reset_syms() //call when switching from TX to RX or vice versa
throb::throb(trx_mode throb_mode) : modem()
{
cap = CAP_AFC | CAP_REV;
cap |= CAP_AFC | CAP_REV;
double bw;
double *fp = 0;
@ -342,7 +342,7 @@ int throb::findtones(complex *word, int &tone1, int &tone2)
void throb::show_char(int c) {
if (metric > progStatus.sldrSquelchValue || progStatus.sqlonoff == false)
put_rx_char(c);
put_rx_char(progdefaults.rx_lowercase ? tolower(c) : c);
}
void throb::decodechar(int tone1, int tone2)
@ -706,7 +706,7 @@ int throb::tx_process()
}
send(sym);
put_echo_char(c);
put_echo_char(progdefaults.rx_lowercase ? tolower(c) : c);
return 0;
}

Wyświetl plik

@ -85,6 +85,7 @@ modem *psk250r_modem = 0;
modem *psk500r_modem = 0;
modem *olivia_modem = 0;
modem *contestia_modem = 0;
modem *rtty_modem = 0;
@ -112,6 +113,7 @@ modem *throbx4_modem = 0;
modem *wwv_modem = 0;
modem *anal_modem = 0;
modem *ssb_modem = 0;
trx_mode modem::get_mode()
{
@ -127,13 +129,14 @@ modem::modem()
bool wfsb = wf->USB();
reverse = wfrev ^ !wfsb;
historyON = false;
cap = 0;
cap = CAP_RX | CAP_TX;
PTTphaseacc = 0.0;
frequency = 1000.0;
s2n_ncount = s2n_sum = s2n_sum2 = s2n_metric = 0.0;
s2n_valid = false;
}
// modem types CW and RTTY do not use the base init()
void modem::init()
{
bool wfrev = wf->Reverse();
@ -141,14 +144,7 @@ void modem::init()
reverse = wfrev ^ !wfsb;
if (progdefaults.StartAtSweetSpot) {
// if (active_modem == cw_modem)
if (this == cw_modem)
set_freq(progdefaults.CWsweetspot);
// else if (active_modem == rtty_modem)
else if (this == rtty_modem)
set_freq(progdefaults.RTTYsweetspot);
else
set_freq(progdefaults.PSKsweetspot);
set_freq(progdefaults.PSKsweetspot);
} else if (progStatus.carrier != 0) {
set_freq(progStatus.carrier);
#if !BENCHMARK_MODE
@ -183,7 +179,9 @@ bool modem::freqlocked()
double modem::get_txfreq(void)
{
if (mailserver && progdefaults.PSKmailSweetSpot)
if (unlikely(!(cap & CAP_TX)))
return 0;
else if (mailserver && progdefaults.PSKmailSweetSpot)
return progdefaults.PSKsweetspot;
return tx_frequency;
}

Wyświetl plik

@ -71,6 +71,7 @@
#include "gettext.h"
#include "rtty.h"
#include "flslider2.h"
#include "debug.h"
using namespace std;
@ -206,7 +207,7 @@ inline void WFdisp::makeMarker_(int width, const RGB* color, int freq, const RGB
if (active_modem->get_mode() == MODE_RTTY) {
// rtty has two bandwidth indicators on the waterfall
// upper and lower frequency
int shift = (progdefaults.rtty_shift >= 0 ?
int shift = static_cast<int>(progdefaults.rtty_shift >= 0 ?
_SHIFT[progdefaults.rtty_shift] : progdefaults.rtty_custom_shift);
int bw_limit_hi = (int)(shift / 2 + progdefaults.RTTY_BW / 2.0);
int bw_limit_lo = (int)(shift / 2 - progdefaults.RTTY_BW / 2.0);
@ -285,10 +286,11 @@ void WFdisp::makeMarker()
makeMarker_(marker_width, &RGBmarker, carrierfreq, clrMin, clrM, clrMax);
if (unlikely(active_modem->freqlocked())) {
int txfreq = active_modem->get_txfreq();
int txfreq = static_cast<int>(active_modem->get_txfreq());
adjust_color_inv(RGBmarker.R, RGBmarker.G, RGBmarker.B, FL_BLACK, FL_RED);
makeMarker_(bandwidth / 2.0 + 1, &RGBmarker, txfreq,
clrMin, clrMin + (int)((double)txfreq + 0.5), clrMax);
makeMarker_( static_cast<int>(bandwidth / 2.0 + 1),
&RGBmarker, txfreq,
clrMin, clrMin + (int)((double)txfreq + 0.5), clrMax);
}
if (!wantcursor) return;
@ -545,27 +547,29 @@ void WFdisp::redrawCursor()
// cursormoved = true;
}
void WFdisp::sig_data( double *sig, int len, int sr ) {
void WFdisp::sig_data( double *sig, int len, int sr )
{
if (wfspeed == PAUSE)
return;
goto update_freq;
//if sound card sampling rate changed reset the waterfall buffer
// if sound card sampling rate changed reset the waterfall buffer
if (srate != sr) {
srate = sr;
memset (circbuff, 0, FFT_LEN * 2 * sizeof(double));
ptrCB = 0;
}
overload = false;
double overval, peak = 0.0;
for (int i = 0; i < len; i++) {
overval = fabs(circbuff[ptrCB] = sig[i]);
ptrCB = (ptrCB + 1) % (FFT_LEN *2);
if (overval > peak) peak = overval;
{
overload = false;
double overval, peak = 0.0;
for (int i = 0; i < len; i++) {
overval = fabs(circbuff[ptrCB] = sig[i]);
ptrCB = (ptrCB + 1) % (FFT_LEN *2);
if (overval > peak) peak = overval;
}
peakaudio = 0.1 * peak + 0.9 * peakaudio;
}
peakaudio = 0.1 * peak + 0.9 * peakaudio;
if (mode == SCOPE)
process_analog(circbuff, FFT_LEN * 2);
else
@ -573,10 +577,8 @@ void WFdisp::sig_data( double *sig, int len, int sr ) {
put_WARNstatus(peakaudio);
update_freq:
static char szFrequency[14];
// if (usebands)
// rfc = (long long)(atof(cboBand->value()) * 1000.0);
if (rfc != 0) { // use a boolean for the waterfall
if (usb)
dfreq = rfc + active_modem->get_txfreq();
@ -587,11 +589,7 @@ void WFdisp::sig_data( double *sig, int len, int sr ) {
dfreq = active_modem->get_txfreq();
snprintf(szFrequency, sizeof(szFrequency), "%-.0f", dfreq);
}
FL_LOCK_D();
inpFreq->value(szFrequency);
FL_UNLOCK_D();
return;
}
@ -694,7 +692,7 @@ int WFdisp::wfmag() {
void WFdisp::drawScale() {
int fw = 60, xchar;
int fw = 60, xoff;
static char szFreq[20];
double fr;
uchar *pixmap;
@ -729,16 +727,16 @@ void WFdisp::drawScale() {
snprintf(szFreq, sizeof(szFreq), "%7.1f", fr);
fw = (int)fl_width(szFreq);
if (progdefaults.wf_audioscale)
xchar = (int) (( (1000.0/step) * i - fw) / 2.0 - offset /step );
xoff = (int) (( (1000.0/step) * i - fw) / 2.0 - offset /step );
else if (usb)
xchar = (int) ( ( (1000.0/step) * i - fw) / 2.0 -
xoff = (int) ( ( (1000.0/step) * i - fw) / 2.0 -
(offset + rfc % 500) /step );
else
xchar = (int) ( ( (1000.0/step) * i - fw) / 2.0 -
xoff = (int) ( ( (1000.0/step) * i - fw) / 2.0 -
(offset + 500 - rfc % 500) /step );
if (xchar > 0 && xchar < w() - fw)
fl_draw(szFreq, x() + xchar, y() + 10 );
if (xchar > w() - fw) break;
if (xoff > 0 && xoff < w() - fw)
fl_draw(szFreq, x() + xoff, y() + 10 );
if (xoff > w() - fw) break;
}
}
@ -1107,6 +1105,9 @@ void qsy_cb(Fl_Widget *w, void *v)
static vector<qrg_mode_t> qsy_stack;
qrg_mode_t m;
wf->xmtlock->value(0);
wf->xmtlock->do_callback();
if (Fl::event_button() != FL_RIGHT_MOUSE) {
// store
m.rfcarrier = wf->rfcarrier();
@ -1171,6 +1172,11 @@ void xmtrcv_cb(Fl_Widget *w, void *vi)
Fl_Light_Button *b = (Fl_Light_Button *)w;
int v = b->value();
FL_UNLOCK_D();
if (!(active_modem->get_cap() & modem::CAP_TX)) {
b->value(0);
restoreFocus();
return;
}
if (v == 1) {
stopMacroTimer();
active_modem->set_stopflag(false);

Wyświetl plik

@ -1198,7 +1198,7 @@ void MVScrollbar::draw(void)
// Convert stored scrollbar values to vertical positions and draw
// lines inside the widget if they don't overlap with the knob area.
for (vector<mark_t>::const_iterator i = marks.begin(); i != marks.end(); ++i) {
ypos = w() + H * i->pos / maximum();
ypos = static_cast<int>(w() + H * i->pos / maximum());
// Don't draw over slider knob
if ((ypos > slider_y && ypos < slider_y + slider_h) ||
(ypos < slider_y + slider_h && ypos > slider_y))

Wyświetl plik

@ -67,12 +67,12 @@ FTextBase::FTextBase(int x, int y, int w, int h, const char *l)
textsize(FL_NORMAL_SIZE);
textcolor(FL_FOREGROUND_COLOR);
tbuf = new Fl_Text_Buffer;
sbuf = new Fl_Text_Buffer;
tbuf = new Fl_Text_Buffer_mod;
sbuf = new Fl_Text_Buffer_mod;
cursor_style(Fl_Text_Editor_mod::NORMAL_CURSOR);
buffer(tbuf);
highlight_data(sbuf, styles, NATTR, FTEXT_DEF, 0, 0);
cursor_style(Fl_Text_Editor_mod::NORMAL_CURSOR);
wrap_mode(wrap, wrap_col);

Wyświetl plik

@ -0,0 +1,7 @@
#include <config.h>
#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR < 3
# include "Fl_Text_Buffer_mod_1_1.cxx"
#elif FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 3
# include "Fl_Text_Buffer_mod_1_3.cxx"
#endif

Wyświetl plik

@ -1,494 +1,7 @@
//
// "$Id: Fl_Text_Editor.cxx 5671 2007-02-08 07:58:47Z matt $"
//
// Copyright 2001-2006 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include "flstring.h"
#include <ctype.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "Fl_Text_Editor_mod.H"
#include <FL/fl_ask.H>
Fl_Text_Editor_mod::Fl_Text_Editor_mod(int X, int Y, int W, int H, const char* l)
: Fl_Text_Display_mod(X, Y, W, H, l) {
mCursorOn = 1;
insert_mode_ = 1;
key_bindings = 0;
// handle the default key bindings
add_default_key_bindings(&key_bindings);
// handle everything else
default_key_function(kf_default);
}
Fl_Text_Editor_mod::Key_Binding* Fl_Text_Editor_mod::global_key_bindings = 0;
// These are the default key bindings every widget should start with
static struct {
int key;
int state;
Fl_Text_Editor_mod::Key_Func func;
} default_key_bindings[] = {
{ FL_Escape, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_ignore },
{ FL_Enter, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_enter },
{ FL_KP_Enter, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_enter },
{ FL_BackSpace, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_backspace },
{ FL_Insert, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_insert },
{ FL_Delete, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_delete },
{ FL_Home, 0, Fl_Text_Editor_mod::kf_move },
{ FL_End, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Left, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Up, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Right, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Down, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Page_Up, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Page_Down, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Home, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_End, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Left, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Up, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Right, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Down, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Page_Up, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Page_Down, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Home, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_End, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Left, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Up, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Right, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Down, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Page_Up, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Page_Down, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Home, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_End, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Left, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Up, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Right, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Down, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Page_Up, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Page_Down, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
//{ FL_Clear, 0, Fl_Text_Editor_mod::delete_to_eol },
{ 'z', FL_CTRL, Fl_Text_Editor_mod::kf_undo },
{ '/', FL_CTRL, Fl_Text_Editor_mod::kf_undo },
{ 'x', FL_CTRL, Fl_Text_Editor_mod::kf_cut },
{ FL_Delete, FL_SHIFT, Fl_Text_Editor_mod::kf_cut },
{ 'c', FL_CTRL, Fl_Text_Editor_mod::kf_copy },
{ FL_Insert, FL_CTRL, Fl_Text_Editor_mod::kf_copy },
{ 'v', FL_CTRL, Fl_Text_Editor_mod::kf_paste },
{ FL_Insert, FL_SHIFT, Fl_Text_Editor_mod::kf_paste },
{ 'a', FL_CTRL, Fl_Text_Editor_mod::kf_select_all },
#ifdef __APPLE__
// Define CMD+key accelerators...
{ 'z', FL_COMMAND, Fl_Text_Editor_mod::kf_undo },
{ 'x', FL_COMMAND, Fl_Text_Editor_mod::kf_cut },
{ 'c', FL_COMMAND, Fl_Text_Editor_mod::kf_copy },
{ 'v', FL_COMMAND, Fl_Text_Editor_mod::kf_paste },
{ 'a', FL_COMMAND, Fl_Text_Editor_mod::kf_select_all },
#endif // __APPLE__
{ 0, 0, 0 }
};
void Fl_Text_Editor_mod::add_default_key_bindings(Key_Binding** list) {
for (int i = 0; default_key_bindings[i].key; i++) {
add_key_binding(default_key_bindings[i].key,
default_key_bindings[i].state,
default_key_bindings[i].func,
list);
}
}
Fl_Text_Editor_mod::Key_Func
Fl_Text_Editor_mod::bound_key_function(int key, int state, Key_Binding* list) {
Key_Binding* cur;
for (cur = list; cur; cur = cur->next)
if (cur->key == key)
if (cur->state == FL_TEXT_EDITOR_ANY_STATE || cur->state == state)
break;
if (!cur) return 0;
return cur->function;
}
void
Fl_Text_Editor_mod::remove_all_key_bindings(Key_Binding** list) {
Key_Binding *cur, *next;
for (cur = *list; cur; cur = next) {
next = cur->next;
delete cur;
}
*list = 0;
}
void
Fl_Text_Editor_mod::remove_key_binding(int key, int state, Key_Binding** list) {
Key_Binding *cur, *last = 0;
for (cur = *list; cur; last = cur, cur = cur->next)
if (cur->key == key && cur->state == state) break;
if (!cur) return;
if (last) last->next = cur->next;
else *list = cur->next;
delete cur;
}
void
Fl_Text_Editor_mod::add_key_binding(int key, int state, Key_Func function,
Key_Binding** list) {
Key_Binding* kb = new Key_Binding;
kb->key = key;
kb->state = state;
kb->function = function;
kb->next = *list;
*list = kb;
}
////////////////////////////////////////////////////////////////
#define NORMAL_INPUT_MOVE 0
static void kill_selection(Fl_Text_Editor_mod* e) {
if (e->buffer()->selected()) {
e->insert_position(e->buffer()->primary_selection()->start());
e->buffer()->remove_selection();
}
}
int Fl_Text_Editor_mod::kf_default(int c, Fl_Text_Editor_mod* e) {
if (!c || (!isprint(c) && c != '\t')) return 0;
char s[2] = "\0";
s[0] = (char)c;
kill_selection(e);
if (e->insert_mode()) e->insert(s);
else e->overstrike(s);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_ignore(int, Fl_Text_Editor_mod*) {
return 0; // don't handle
}
int Fl_Text_Editor_mod::kf_backspace(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected() && e->move_left())
e->buffer()->select(e->insert_position(), e->insert_position()+1);
kill_selection(e);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_enter(int, Fl_Text_Editor_mod* e) {
kill_selection(e);
e->insert("\n");
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
extern void fl_text_drag_me(int pos, Fl_Text_Display_mod* d);
int Fl_Text_Editor_mod::kf_move(int c, Fl_Text_Editor_mod* e) {
int i;
int selected = e->buffer()->selected();
if (!selected)
e->dragPos = e->insert_position();
e->buffer()->unselect();
switch (c) {
case FL_Home:
e->insert_position(e->buffer()->line_start(e->insert_position()));
break;
case FL_End:
e->insert_position(e->buffer()->line_end(e->insert_position()));
break;
case FL_Left:
e->move_left();
break;
case FL_Right:
e->move_right();
break;
case FL_Up:
e->move_up();
break;
case FL_Down:
e->move_down();
break;
case FL_Page_Up:
for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_up();
break;
case FL_Page_Down:
for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_down();
break;
}
e->show_insert_position();
return 1;
}
int Fl_Text_Editor_mod::kf_shift_move(int c, Fl_Text_Editor_mod* e) {
kf_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
int Fl_Text_Editor_mod::kf_ctrl_move(int c, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected())
e->dragPos = e->insert_position();
if (c != FL_Up && c != FL_Down) {
e->buffer()->unselect();
e->show_insert_position();
}
switch (c) {
case FL_Home:
e->insert_position(0);
e->scroll(0, 0);
break;
case FL_End:
e->insert_position(e->buffer()->length());
e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
break;
case FL_Left:
e->previous_word();
break;
case FL_Right:
e->next_word();
break;
case FL_Up:
e->scroll(e->mTopLineNum-1, e->mHorizOffset);
break;
case FL_Down:
e->scroll(e->mTopLineNum+1, e->mHorizOffset);
break;
case FL_Page_Up:
e->insert_position(e->mLineStarts[0]);
break;
case FL_Page_Down:
e->insert_position(e->mLineStarts[e->mNVisibleLines-2]);
break;
}
return 1;
}
int Fl_Text_Editor_mod::kf_c_s_move(int c, Fl_Text_Editor_mod* e) {
kf_ctrl_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
int Fl_Text_Editor_mod::kf_home(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Home, e);
}
int Fl_Text_Editor_mod::kf_end(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_End, e);
}
int Fl_Text_Editor_mod::kf_left(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Left, e);
}
int Fl_Text_Editor_mod::kf_up(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Up, e);
}
int Fl_Text_Editor_mod::kf_right(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Right, e);
}
int Fl_Text_Editor_mod::kf_down(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Down, e);
}
int Fl_Text_Editor_mod::kf_page_up(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Page_Up, e);
}
int Fl_Text_Editor_mod::kf_page_down(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Page_Down, e);
}
int Fl_Text_Editor_mod::kf_insert(int, Fl_Text_Editor_mod* e) {
e->insert_mode(e->insert_mode() ? 0 : 1);
return 1;
}
int Fl_Text_Editor_mod::kf_delete(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected())
e->buffer()->select(e->insert_position(), e->insert_position()+1);
kill_selection(e);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_copy(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected()) return 1;
const char *copy = e->buffer()->selection_text();
if (*copy) Fl::copy(copy, strlen(copy), 1);
free((void*)copy);
e->show_insert_position();
return 1;
}
int Fl_Text_Editor_mod::kf_cut(int c, Fl_Text_Editor_mod* e) {
kf_copy(c, e);
kill_selection(e);
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_paste(int, Fl_Text_Editor_mod* e) {
kill_selection(e);
Fl::paste(*e, 1);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_select_all(int, Fl_Text_Editor_mod* e) {
e->buffer()->select(0, e->buffer()->length());
return 1;
}
int Fl_Text_Editor_mod::kf_undo(int , Fl_Text_Editor_mod* e) {
e->buffer()->unselect();
int crsr;
int ret = e->buffer()->undo(&crsr);
e->insert_position(crsr);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return ret;
}
int Fl_Text_Editor_mod::handle_key() {
// Call FLTK's rules to try to turn this into a printing character.
// This uses the right-hand ctrl key as a "compose prefix" and returns
// the changes that should be made to the text, as a number of
// bytes to delete and a string to insert:
int del;
if (Fl::compose(del)) {
if (del) buffer()->select(insert_position()-del, insert_position());
kill_selection(this);
if (Fl::event_length()) {
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
}
show_insert_position();
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
int key = Fl::event_key(), state = Fl::event_state(), c = Fl::event_text()[0];
state &= FL_SHIFT|FL_CTRL|FL_ALT|FL_META; // only care about these states
Key_Func f;
f = bound_key_function(key, state, global_key_bindings);
if (!f) f = bound_key_function(key, state, key_bindings);
if (f) return f(key, this);
if (default_key_function_ && !state) return default_key_function_(c, this);
return 0;
}
void Fl_Text_Editor_mod::maybe_do_callback() {
// printf("Fl_Text_Editor_mod::maybe_do_callback()\n");
// printf("changed()=%d, when()=%x\n", changed(), when());
if (changed() || (when()&FL_WHEN_NOT_CHANGED)) do_callback();
}
int Fl_Text_Editor_mod::handle(int event) {
if (!buffer()) return 0;
switch (event) {
case FL_FOCUS:
show_cursor(mCursorOn); // redraws the cursor
if (buffer()->selected()) redraw(); // Redraw selections...
Fl::focus(this);
return 1;
case FL_UNFOCUS:
show_cursor(mCursorOn); // redraws the cursor
if (buffer()->selected()) redraw(); // Redraw selections...
case FL_HIDE:
if (when() & FL_WHEN_RELEASE) maybe_do_callback();
return 1;
case FL_KEYBOARD:
if (active_r() && window() && this == Fl::belowmouse())
window()->cursor(FL_CURSOR_NONE);
return handle_key();
case FL_PASTE:
if (!Fl::event_text()) {
fl_beep();
return 1;
}
buffer()->remove_selection();
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
show_insert_position();
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
case FL_ENTER:
// MRS: WIN32 only? Need to test!
// case FL_MOVE:
show_cursor(mCursorOn);
return 1;
case FL_PUSH:
if (Fl::event_button() == 2) {
// don't let the text_display see this event
if (Fl_Group::handle(event)) return 1;
dragType = -1;
Fl::paste(*this, 0);
Fl::focus(this);
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
break;
}
return Fl_Text_Display_mod::handle(event);
}
//
// End of "$Id: Fl_Text_Editor.cxx 5671 2007-02-08 07:58:47Z matt $".
//
#if FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR < 3
# include "Fl_Text_Editor_mod_1_1.cxx"
#elif FLDIGI_FLTK_API_MAJOR == 1 && FLDIGI_FLTK_API_MINOR == 3
# include "Fl_Text_Editor_mod_1_3.cxx"
#endif

Wyświetl plik

@ -0,0 +1,494 @@
//
// "$Id: Fl_Text_Editor.cxx 5671 2007-02-08 07:58:47Z matt $"
//
// Copyright 2001-2006 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include "flstring.h"
#include <ctype.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "Fl_Text_Editor_mod.H"
#include <FL/fl_ask.H>
Fl_Text_Editor_mod::Fl_Text_Editor_mod(int X, int Y, int W, int H, const char* l)
: Fl_Text_Display_mod(X, Y, W, H, l) {
mCursorOn = 1;
insert_mode_ = 1;
key_bindings = 0;
// handle the default key bindings
add_default_key_bindings(&key_bindings);
// handle everything else
default_key_function(kf_default);
}
Fl_Text_Editor_mod::Key_Binding* Fl_Text_Editor_mod::global_key_bindings = 0;
// These are the default key bindings every widget should start with
static struct {
int key;
int state;
Fl_Text_Editor_mod::Key_Func func;
} default_key_bindings[] = {
{ FL_Escape, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_ignore },
{ FL_Enter, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_enter },
{ FL_KP_Enter, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_enter },
{ FL_BackSpace, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_backspace },
{ FL_Insert, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_insert },
{ FL_Delete, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_delete },
{ FL_Home, 0, Fl_Text_Editor_mod::kf_move },
{ FL_End, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Left, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Up, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Right, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Down, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Page_Up, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Page_Down, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Home, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_End, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Left, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Up, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Right, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Down, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Page_Up, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Page_Down, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Home, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_End, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Left, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Up, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Right, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Down, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Page_Up, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Page_Down, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Home, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_End, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Left, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Up, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Right, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Down, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Page_Up, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Page_Down, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
//{ FL_Clear, 0, Fl_Text_Editor_mod::delete_to_eol },
{ 'z', FL_CTRL, Fl_Text_Editor_mod::kf_undo },
{ '/', FL_CTRL, Fl_Text_Editor_mod::kf_undo },
{ 'x', FL_CTRL, Fl_Text_Editor_mod::kf_cut },
{ FL_Delete, FL_SHIFT, Fl_Text_Editor_mod::kf_cut },
{ 'c', FL_CTRL, Fl_Text_Editor_mod::kf_copy },
{ FL_Insert, FL_CTRL, Fl_Text_Editor_mod::kf_copy },
{ 'v', FL_CTRL, Fl_Text_Editor_mod::kf_paste },
{ FL_Insert, FL_SHIFT, Fl_Text_Editor_mod::kf_paste },
{ 'a', FL_CTRL, Fl_Text_Editor_mod::kf_select_all },
#ifdef __APPLE__
// Define CMD+key accelerators...
{ 'z', FL_COMMAND, Fl_Text_Editor_mod::kf_undo },
{ 'x', FL_COMMAND, Fl_Text_Editor_mod::kf_cut },
{ 'c', FL_COMMAND, Fl_Text_Editor_mod::kf_copy },
{ 'v', FL_COMMAND, Fl_Text_Editor_mod::kf_paste },
{ 'a', FL_COMMAND, Fl_Text_Editor_mod::kf_select_all },
#endif // __APPLE__
{ 0, 0, 0 }
};
void Fl_Text_Editor_mod::add_default_key_bindings(Key_Binding** list) {
for (int i = 0; default_key_bindings[i].key; i++) {
add_key_binding(default_key_bindings[i].key,
default_key_bindings[i].state,
default_key_bindings[i].func,
list);
}
}
Fl_Text_Editor_mod::Key_Func
Fl_Text_Editor_mod::bound_key_function(int key, int state, Key_Binding* list) {
Key_Binding* cur;
for (cur = list; cur; cur = cur->next)
if (cur->key == key)
if (cur->state == FL_TEXT_EDITOR_ANY_STATE || cur->state == state)
break;
if (!cur) return 0;
return cur->function;
}
void
Fl_Text_Editor_mod::remove_all_key_bindings(Key_Binding** list) {
Key_Binding *cur, *next;
for (cur = *list; cur; cur = next) {
next = cur->next;
delete cur;
}
*list = 0;
}
void
Fl_Text_Editor_mod::remove_key_binding(int key, int state, Key_Binding** list) {
Key_Binding *cur, *last = 0;
for (cur = *list; cur; last = cur, cur = cur->next)
if (cur->key == key && cur->state == state) break;
if (!cur) return;
if (last) last->next = cur->next;
else *list = cur->next;
delete cur;
}
void
Fl_Text_Editor_mod::add_key_binding(int key, int state, Key_Func function,
Key_Binding** list) {
Key_Binding* kb = new Key_Binding;
kb->key = key;
kb->state = state;
kb->function = function;
kb->next = *list;
*list = kb;
}
////////////////////////////////////////////////////////////////
#define NORMAL_INPUT_MOVE 0
static void kill_selection(Fl_Text_Editor_mod* e) {
if (e->buffer()->selected()) {
e->insert_position(e->buffer()->primary_selection()->start());
e->buffer()->remove_selection();
}
}
int Fl_Text_Editor_mod::kf_default(int c, Fl_Text_Editor_mod* e) {
if (!c || (!isprint(c) && c != '\t')) return 0;
char s[2] = "\0";
s[0] = (char)c;
kill_selection(e);
if (e->insert_mode()) e->insert(s);
else e->overstrike(s);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_ignore(int, Fl_Text_Editor_mod*) {
return 0; // don't handle
}
int Fl_Text_Editor_mod::kf_backspace(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected() && e->move_left())
e->buffer()->select(e->insert_position(), e->insert_position()+1);
kill_selection(e);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_enter(int, Fl_Text_Editor_mod* e) {
kill_selection(e);
e->insert("\n");
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
extern void fl_text_drag_me(int pos, Fl_Text_Display_mod* d);
int Fl_Text_Editor_mod::kf_move(int c, Fl_Text_Editor_mod* e) {
int i;
int selected = e->buffer()->selected();
if (!selected)
e->dragPos = e->insert_position();
e->buffer()->unselect();
switch (c) {
case FL_Home:
e->insert_position(e->buffer()->line_start(e->insert_position()));
break;
case FL_End:
e->insert_position(e->buffer()->line_end(e->insert_position()));
break;
case FL_Left:
e->move_left();
break;
case FL_Right:
e->move_right();
break;
case FL_Up:
e->move_up();
break;
case FL_Down:
e->move_down();
break;
case FL_Page_Up:
for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_up();
break;
case FL_Page_Down:
for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_down();
break;
}
e->show_insert_position();
return 1;
}
int Fl_Text_Editor_mod::kf_shift_move(int c, Fl_Text_Editor_mod* e) {
kf_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
int Fl_Text_Editor_mod::kf_ctrl_move(int c, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected())
e->dragPos = e->insert_position();
if (c != FL_Up && c != FL_Down) {
e->buffer()->unselect();
e->show_insert_position();
}
switch (c) {
case FL_Home:
e->insert_position(0);
e->scroll(0, 0);
break;
case FL_End:
e->insert_position(e->buffer()->length());
e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
break;
case FL_Left:
e->previous_word();
break;
case FL_Right:
e->next_word();
break;
case FL_Up:
e->scroll(e->mTopLineNum-1, e->mHorizOffset);
break;
case FL_Down:
e->scroll(e->mTopLineNum+1, e->mHorizOffset);
break;
case FL_Page_Up:
e->insert_position(e->mLineStarts[0]);
break;
case FL_Page_Down:
e->insert_position(e->mLineStarts[e->mNVisibleLines-2]);
break;
}
return 1;
}
int Fl_Text_Editor_mod::kf_c_s_move(int c, Fl_Text_Editor_mod* e) {
kf_ctrl_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
int Fl_Text_Editor_mod::kf_home(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Home, e);
}
int Fl_Text_Editor_mod::kf_end(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_End, e);
}
int Fl_Text_Editor_mod::kf_left(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Left, e);
}
int Fl_Text_Editor_mod::kf_up(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Up, e);
}
int Fl_Text_Editor_mod::kf_right(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Right, e);
}
int Fl_Text_Editor_mod::kf_down(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Down, e);
}
int Fl_Text_Editor_mod::kf_page_up(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Page_Up, e);
}
int Fl_Text_Editor_mod::kf_page_down(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Page_Down, e);
}
int Fl_Text_Editor_mod::kf_insert(int, Fl_Text_Editor_mod* e) {
e->insert_mode(e->insert_mode() ? 0 : 1);
return 1;
}
int Fl_Text_Editor_mod::kf_delete(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected())
e->buffer()->select(e->insert_position(), e->insert_position()+1);
kill_selection(e);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_copy(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected()) return 1;
const char *copy = e->buffer()->selection_text();
if (*copy) Fl::copy(copy, strlen(copy), 1);
free((void*)copy);
e->show_insert_position();
return 1;
}
int Fl_Text_Editor_mod::kf_cut(int c, Fl_Text_Editor_mod* e) {
kf_copy(c, e);
kill_selection(e);
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_paste(int, Fl_Text_Editor_mod* e) {
kill_selection(e);
Fl::paste(*e, 1);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
int Fl_Text_Editor_mod::kf_select_all(int, Fl_Text_Editor_mod* e) {
e->buffer()->select(0, e->buffer()->length());
return 1;
}
int Fl_Text_Editor_mod::kf_undo(int , Fl_Text_Editor_mod* e) {
e->buffer()->unselect();
int crsr;
int ret = e->buffer()->undo(&crsr);
e->insert_position(crsr);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return ret;
}
int Fl_Text_Editor_mod::handle_key() {
// Call FLTK's rules to try to turn this into a printing character.
// This uses the right-hand ctrl key as a "compose prefix" and returns
// the changes that should be made to the text, as a number of
// bytes to delete and a string to insert:
int del;
if (Fl::compose(del)) {
if (del) buffer()->select(insert_position()-del, insert_position());
kill_selection(this);
if (Fl::event_length()) {
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
}
show_insert_position();
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
int key = Fl::event_key(), state = Fl::event_state(), c = Fl::event_text()[0];
state &= FL_SHIFT|FL_CTRL|FL_ALT|FL_META; // only care about these states
Key_Func f;
f = bound_key_function(key, state, global_key_bindings);
if (!f) f = bound_key_function(key, state, key_bindings);
if (f) return f(key, this);
if (default_key_function_ && !state) return default_key_function_(c, this);
return 0;
}
void Fl_Text_Editor_mod::maybe_do_callback() {
// printf("Fl_Text_Editor_mod::maybe_do_callback()\n");
// printf("changed()=%d, when()=%x\n", changed(), when());
if (changed() || (when()&FL_WHEN_NOT_CHANGED)) do_callback();
}
int Fl_Text_Editor_mod::handle(int event) {
if (!buffer()) return 0;
switch (event) {
case FL_FOCUS:
show_cursor(mCursorOn); // redraws the cursor
if (buffer()->selected()) redraw(); // Redraw selections...
Fl::focus(this);
return 1;
case FL_UNFOCUS:
show_cursor(mCursorOn); // redraws the cursor
if (buffer()->selected()) redraw(); // Redraw selections...
case FL_HIDE:
if (when() & FL_WHEN_RELEASE) maybe_do_callback();
return 1;
case FL_KEYBOARD:
if (active_r() && window() && this == Fl::belowmouse())
window()->cursor(FL_CURSOR_NONE);
return handle_key();
case FL_PASTE:
if (!Fl::event_text()) {
fl_beep();
return 1;
}
buffer()->remove_selection();
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
show_insert_position();
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
case FL_ENTER:
// MRS: WIN32 only? Need to test!
// case FL_MOVE:
show_cursor(mCursorOn);
return 1;
case FL_PUSH:
if (Fl::event_button() == 2) {
// don't let the text_display see this event
if (Fl_Group::handle(event)) return 1;
dragType = -1;
Fl::paste(*this, 0);
Fl::focus(this);
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
break;
}
return Fl_Text_Display_mod::handle(event);
}
//
// End of "$Id: Fl_Text_Editor.cxx 5671 2007-02-08 07:58:47Z matt $".
//

Wyświetl plik

@ -0,0 +1,620 @@
//
// "$Id: Fl_Text_Editor.cxx 7462 2010-04-06 23:00:56Z matt $"
//
// Copyright 2001-2009 by Bill Spitzak and others.
// Original code Copyright Mark Edel. Permission to distribute under
// the LGPL for the FLTK library granted by Mark Edel.
//
// 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
//
#include <stdio.h>
#include <stdlib.h>
#include "flstring.h"
#include <ctype.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "Fl_Text_Editor_mod.H"
#include <FL/fl_ask.H>
/* Keyboard Control Matrix
key\modifier plain Ctrl Alt Meta
left 1/1 13/9 0/13 0/9
right 2/2 14/10 0/14 0/10
up 3/19 21/7 0/15 0/17
down 4/20 22/8 0/16 0/18
home 9/5 17/0 0/0 0/0
end 10/6 18/0 0/0 0/0
page up 11/7 23/0 0/11 0/0
page down 12/8 24/0 0/12 0/0
(FLTK action / OS X action)
(adding the shift key extends the selection, all other combinations are no-op)
0: no-op
1: move cursor to the left, at line beginning wrap to end of prev line, at doc start no-op
2: move cursor to the right, at line end move to beginning of the next line, at doc end no-op
3: move cursor up, at doc top no-op
4: move cursor down, at doc bottom no-op
5: scroll display to top of text (cursor unchanged)
6: scroll display to end of text (cursor unchanged)
7: scroll text down one page (cursor unchanged)
8: scroll text up one page (cursor unchanged)
9: move cursor to beginning of line
10: move cursor to end of line
11: move cursor up one page and scroll down
12: move cursor down one page and scroll up
13: move to the beginning of the word or the previous word
14: move to the end of the word or the next word
15: if start of line: start of prev line, else start of this line
16: if end of line: end of next line, else end of this line
17: move cursor to the beginning of the document
18: move cursor to the end of the document
19: move cursor up, at doc top: home, at doc start: no-op)
20: move cursor down, at doc bot: end, at doc end: no-op)
21: scroll text down one line (cursor unchanged)
22: scroll text up one line (cursor unchanged)
23: move cursor to the beginning of the top of the screen
24: move cursor to the beginning of the bottom of the window
*/
/** The constructor creates a new text editor widget.*/
Fl_Text_Editor_mod::Fl_Text_Editor_mod(int X, int Y, int W, int H, const char* l)
: Fl_Text_Display_mod(X, Y, W, H, l) {
mCursorOn = 1;
insert_mode_ = 1;
key_bindings = 0;
// handle the default key bindings
add_default_key_bindings(&key_bindings);
// handle everything else
default_key_function(kf_default);
}
#ifndef FL_DOXYGEN
Fl_Text_Editor_mod::Key_Binding* Fl_Text_Editor_mod::global_key_bindings = 0;
#endif
// These are the default key bindings every widget should start with
static struct {
int key;
int state;
Fl_Text_Editor_mod::Key_Func func;
} default_key_bindings[] = {
{ FL_Escape, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_ignore },
{ FL_Enter, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_enter },
{ FL_KP_Enter, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_enter },
{ FL_BackSpace, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_backspace },
{ FL_Insert, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_insert },
{ FL_Delete, FL_TEXT_EDITOR_ANY_STATE, Fl_Text_Editor_mod::kf_delete },
{ FL_Home, 0, Fl_Text_Editor_mod::kf_move },
{ FL_End, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Left, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Up, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Right, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Down, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Page_Up, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Page_Down, 0, Fl_Text_Editor_mod::kf_move },
{ FL_Home, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_End, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Left, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Up, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Right, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Down, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Page_Up, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Page_Down, FL_SHIFT, Fl_Text_Editor_mod::kf_shift_move },
{ FL_Home, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_End, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Left, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Up, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Right, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Down, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Page_Up, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Page_Down, FL_CTRL, Fl_Text_Editor_mod::kf_ctrl_move },
{ FL_Home, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_End, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Left, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Up, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Right, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Down, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Page_Up, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
{ FL_Page_Down, FL_CTRL|FL_SHIFT, Fl_Text_Editor_mod::kf_c_s_move },
//{ FL_Clear, 0, Fl_Text_Editor_mod::delete_to_eol },
{ 'z', FL_CTRL, Fl_Text_Editor_mod::kf_undo },
{ '/', FL_CTRL, Fl_Text_Editor_mod::kf_undo },
{ 'x', FL_CTRL, Fl_Text_Editor_mod::kf_cut },
{ FL_Delete, FL_SHIFT, Fl_Text_Editor_mod::kf_cut },
{ 'c', FL_CTRL, Fl_Text_Editor_mod::kf_copy },
{ FL_Insert, FL_CTRL, Fl_Text_Editor_mod::kf_copy },
{ 'v', FL_CTRL, Fl_Text_Editor_mod::kf_paste },
{ FL_Insert, FL_SHIFT, Fl_Text_Editor_mod::kf_paste },
{ 'a', FL_CTRL, Fl_Text_Editor_mod::kf_select_all },
#ifdef __APPLE__
// Define CMD+key accelerators...
{ 'z', FL_COMMAND, Fl_Text_Editor_mod::kf_undo },
{ 'x', FL_COMMAND, Fl_Text_Editor_mod::kf_cut },
{ 'c', FL_COMMAND, Fl_Text_Editor_mod::kf_copy },
{ 'v', FL_COMMAND, Fl_Text_Editor_mod::kf_paste },
{ 'a', FL_COMMAND, Fl_Text_Editor_mod::kf_select_all },
{ FL_Left, FL_COMMAND, Fl_Text_Editor_mod::kf_meta_move },
{ FL_Right, FL_COMMAND, Fl_Text_Editor_mod::kf_meta_move },
{ FL_Up, FL_COMMAND, Fl_Text_Editor_mod::kf_meta_move },
{ FL_Down, FL_COMMAND, Fl_Text_Editor_mod::kf_meta_move },
{ FL_Left, FL_COMMAND|FL_SHIFT, Fl_Text_Editor_mod::kf_m_s_move },
{ FL_Right, FL_COMMAND|FL_SHIFT, Fl_Text_Editor_mod::kf_m_s_move },
{ FL_Up, FL_COMMAND|FL_SHIFT, Fl_Text_Editor_mod::kf_m_s_move },
{ FL_Down, FL_COMMAND|FL_SHIFT, Fl_Text_Editor_mod::kf_m_s_move },
#endif // __APPLE__
{ 0, 0, 0 }
};
/** Adds all of the default editor key bindings to the specified key binding list.*/
void Fl_Text_Editor_mod::add_default_key_bindings(Key_Binding** list) {
for (int i = 0; default_key_bindings[i].key; i++) {
add_key_binding(default_key_bindings[i].key,
default_key_bindings[i].state,
default_key_bindings[i].func,
list);
}
}
/** Returns the function associated with a key binding.*/
Fl_Text_Editor_mod::Key_Func Fl_Text_Editor_mod::bound_key_function(int key, int state, Key_Binding* list) {
Key_Binding* cur;
for (cur = list; cur; cur = cur->next)
if (cur->key == key)
if (cur->state == FL_TEXT_EDITOR_ANY_STATE || cur->state == state)
break;
if (!cur) return 0;
return cur->function;
}
/** Removes all of the key bindings associated with the text editor or list.*/
void Fl_Text_Editor_mod::remove_all_key_bindings(Key_Binding** list) {
Key_Binding *cur, *next;
for (cur = *list; cur; cur = next) {
next = cur->next;
delete cur;
}
*list = 0;
}
/** Removes the key binding associated with the key "key" of state "state" */
void Fl_Text_Editor_mod::remove_key_binding(int key, int state, Key_Binding** list) {
Key_Binding *cur, *last = 0;
for (cur = *list; cur; last = cur, cur = cur->next)
if (cur->key == key && cur->state == state) break;
if (!cur) return;
if (last) last->next = cur->next;
else *list = cur->next;
delete cur;
}
/** Adds a key of state "state" with the function "function" */
void Fl_Text_Editor_mod::add_key_binding(int key, int state, Key_Func function,
Key_Binding** list) {
Key_Binding* kb = new Key_Binding;
kb->key = key;
kb->state = state;
kb->function = function;
kb->next = *list;
*list = kb;
}
////////////////////////////////////////////////////////////////
#define NORMAL_INPUT_MOVE 0
static void kill_selection(Fl_Text_Editor_mod* e) {
if (e->buffer()->selected()) {
e->insert_position(e->buffer()->primary_selection()->start());
e->buffer()->remove_selection();
}
}
/** Inserts the text associated with the key */
int Fl_Text_Editor_mod::kf_default(int c, Fl_Text_Editor_mod* e) {
if (!c || (!isprint(c) && c != '\t')) return 0;
char s[2] = "\0";
s[0] = (char)c;
kill_selection(e);
if (e->insert_mode()) e->insert(s);
else e->overstrike(s);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
/** Ignores the keypress */
int Fl_Text_Editor_mod::kf_ignore(int, Fl_Text_Editor_mod*) {
return 0; // don't handle
}
/** Does a backspace in the current buffer.*/
int Fl_Text_Editor_mod::kf_backspace(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected() && e->move_left()) {
int l = 1;
// FIXME: character is ucs-4
char c = e->buffer()->character(e->insert_position());
if (c & 0x80 && c & 0x40) {
l = fl_utf8len(c);
}
e->buffer()->select(e->insert_position(), e->insert_position()+l);
}
kill_selection(e);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
/** Inserts a newline at the current cursor position */
int Fl_Text_Editor_mod::kf_enter(int, Fl_Text_Editor_mod* e) {
kill_selection(e);
e->insert("\n");
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
extern void fl_text_drag_me(int pos, Fl_Text_Display_mod* d);
/** Moves the text cursor in the direction indicated by key c.*/
int Fl_Text_Editor_mod::kf_move(int c, Fl_Text_Editor_mod* e) {
int i;
int selected = e->buffer()->selected();
if (!selected)
e->dragPos = e->insert_position();
e->buffer()->unselect();
switch (c) {
case FL_Home:
e->insert_position(e->buffer()->line_start(e->insert_position()));
break;
case FL_End:
e->insert_position(e->buffer()->line_end(e->insert_position()));
break;
case FL_Left:
e->move_left();
break;
case FL_Right:
e->move_right();
break;
case FL_Up:
e->move_up();
break;
case FL_Down:
e->move_down();
break;
case FL_Page_Up:
for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_up();
break;
case FL_Page_Down:
for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_down();
break;
}
e->show_insert_position();
return 1;
}
/** Extends the current selection in the direction of key c.*/
int Fl_Text_Editor_mod::kf_shift_move(int c, Fl_Text_Editor_mod* e) {
kf_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
/** Moves the current text cursor in the direction indicated by control key */
int Fl_Text_Editor_mod::kf_ctrl_move(int c, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected())
e->dragPos = e->insert_position();
if (c != FL_Up && c != FL_Down) {
e->buffer()->unselect();
e->show_insert_position();
}
switch (c) {
case FL_Home:
e->insert_position(0);
e->scroll(0, 0);
break;
case FL_End:
e->insert_position(e->buffer()->length());
e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
break;
case FL_Left:
e->previous_word();
break;
case FL_Right:
e->next_word();
break;
case FL_Up:
e->scroll(e->mTopLineNum-1, e->mHorizOffset);
break;
case FL_Down:
e->scroll(e->mTopLineNum+1, e->mHorizOffset);
break;
case FL_Page_Up:
e->insert_position(e->mLineStarts[0]);
break;
case FL_Page_Down:
e->insert_position(e->mLineStarts[e->mNVisibleLines-2]);
break;
}
return 1;
}
/** Moves the current text cursor in the direction indicated by meta key */
int Fl_Text_Editor_mod::kf_meta_move(int c, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected())
e->dragPos = e->insert_position();
if (c != FL_Up && c != FL_Down) {
e->buffer()->unselect();
e->show_insert_position();
}
switch (c) {
case FL_Up: // top of buffer
e->insert_position(0);
e->scroll(0, 0);
break;
case FL_Down: // end of buffer
e->insert_position(e->buffer()->length());
e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
break;
case FL_Left: // beginning of line
kf_move(FL_Home, e);
break;
case FL_Right: // end of line
kf_move(FL_End, e);
break;
}
return 1;
}
/** Extends the current selection in the direction indicated by meta key c. */
int Fl_Text_Editor_mod::kf_m_s_move(int c, Fl_Text_Editor_mod* e) {
kf_meta_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
/** Extends the current selection in the direction indicated by control key c. */
int Fl_Text_Editor_mod::kf_c_s_move(int c, Fl_Text_Editor_mod* e) {
kf_ctrl_move(c, e);
fl_text_drag_me(e->insert_position(), e);
return 1;
}
/** Moves the text cursor to the beginning of the current line.*/
int Fl_Text_Editor_mod::kf_home(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Home, e);
}
/** Moves the text cursor to the end of the current line.*/
int Fl_Text_Editor_mod::kf_end(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_End, e);
}
/** Moves the text cursor one character to the left.*/
int Fl_Text_Editor_mod::kf_left(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Left, e);
}
/** Moves the text cursor one line up.*/
int Fl_Text_Editor_mod::kf_up(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Up, e);
}
/** Moves the text cursor one character to the right.*/
int Fl_Text_Editor_mod::kf_right(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Right, e);
}
/** Moves the text cursor one line down.*/
int Fl_Text_Editor_mod::kf_down(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Down, e);
}
/** Moves the text cursor up one page.*/
int Fl_Text_Editor_mod::kf_page_up(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Page_Up, e);
}
/** Moves the text cursor down one page.*/
int Fl_Text_Editor_mod::kf_page_down(int, Fl_Text_Editor_mod* e) {
return kf_move(FL_Page_Down, e);
}
/** Toggles the insert mode in the text editor.*/
int Fl_Text_Editor_mod::kf_insert(int, Fl_Text_Editor_mod* e) {
e->insert_mode(e->insert_mode() ? 0 : 1);
return 1;
}
/** Does a delete of selected text or the current character in the current buffer.*/
int Fl_Text_Editor_mod::kf_delete(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected()) {
int l = 1;
// FIXME: character is ucs-4
char c = e->buffer()->character(e->insert_position());
if (c & 0x80 && c & 0x40) {
l = fl_utf8len(c);
}
e->buffer()->select(e->insert_position(), e->insert_position()+l);
}
kill_selection(e);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
/** Does a copy of selected text or the current character in the current buffer.*/
int Fl_Text_Editor_mod::kf_copy(int, Fl_Text_Editor_mod* e) {
if (!e->buffer()->selected()) return 1;
const char *copy = e->buffer()->selection_text();
if (*copy) Fl::copy(copy, strlen(copy), 1);
free((void*)copy);
e->show_insert_position();
return 1;
}
/** Does a cut of selected text in the current buffer.*/
int Fl_Text_Editor_mod::kf_cut(int c, Fl_Text_Editor_mod* e) {
kf_copy(c, e);
kill_selection(e);
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
/** Does a paste of selected text in the current buffer.*/
int Fl_Text_Editor_mod::kf_paste(int, Fl_Text_Editor_mod* e) {
kill_selection(e);
Fl::paste(*e, 1);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return 1;
}
/** Selects all text in the current buffer.*/
int Fl_Text_Editor_mod::kf_select_all(int, Fl_Text_Editor_mod* e) {
e->buffer()->select(0, e->buffer()->length());
return 1;
}
/** Undo last edit in the current buffer. Also deselect previous selection. */
int Fl_Text_Editor_mod::kf_undo(int , Fl_Text_Editor_mod* e) {
e->buffer()->unselect();
int crsr;
int ret = e->buffer()->undo(&crsr);
e->insert_position(crsr);
e->show_insert_position();
e->set_changed();
if (e->when()&FL_WHEN_CHANGED) e->do_callback();
return ret;
}
/** Handles a key press in the editor */
int Fl_Text_Editor_mod::handle_key() {
// Call FLTK's rules to try to turn this into a printing character.
// This uses the right-hand ctrl key as a "compose prefix" and returns
// the changes that should be made to the text, as a number of
// bytes to delete and a string to insert:
int del = 0;
if (Fl::compose(del)) {
if (del) buffer()->select(insert_position()-del, insert_position());
kill_selection(this);
if (Fl::event_length()) {
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
}
show_insert_position();
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
int key = Fl::event_key(), state = Fl::event_state(), c = Fl::event_text()[0];
state &= FL_SHIFT|FL_CTRL|FL_ALT|FL_META; // only care about these states
Key_Func f;
f = bound_key_function(key, state, global_key_bindings);
if (!f) f = bound_key_function(key, state, key_bindings);
if (f) return f(key, this);
if (default_key_function_ && !state) return default_key_function_(c, this);
return 0;
}
/** does or does not a callback according to changed() and when() settings */
void Fl_Text_Editor_mod::maybe_do_callback() {
// printf("Fl_Text_Editor_mod::maybe_do_callback()\n");
// printf("changed()=%d, when()=%x\n", changed(), when());
if (changed() || (when()&FL_WHEN_NOT_CHANGED)) do_callback();
}
int Fl_Text_Editor_mod::handle(int event) {
if (!buffer()) return 0;
switch (event) {
case FL_FOCUS:
show_cursor(mCursorOn); // redraws the cursor
if (buffer()->selected()) redraw(); // Redraw selections...
Fl::focus(this);
return 1;
case FL_UNFOCUS:
show_cursor(mCursorOn); // redraws the cursor
if (buffer()->selected()) redraw(); // Redraw selections...
case FL_HIDE:
if (when() & FL_WHEN_RELEASE) maybe_do_callback();
return 1;
case FL_KEYBOARD:
if (active_r() && window() && this == Fl::belowmouse())
window()->cursor(FL_CURSOR_NONE);
return handle_key();
case FL_PASTE:
if (!Fl::event_text()) {
fl_beep();
return 1;
}
buffer()->remove_selection();
if (insert_mode()) insert(Fl::event_text());
else overstrike(Fl::event_text());
show_insert_position();
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
case FL_ENTER:
// MRS: WIN32 only? Need to test!
// case FL_MOVE:
show_cursor(mCursorOn);
return 1;
case FL_PUSH:
if (Fl::event_button() == 2) {
// don't let the text_display see this event
if (Fl_Group::handle(event)) return 1;
dragType = -1;
Fl::paste(*this, 0);
Fl::focus(this);
set_changed();
if (when()&FL_WHEN_CHANGED) do_callback();
return 1;
}
break;
case FL_SHORTCUT:
if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut()))
return 0;
if (Fl::visible_focus() && handle(FL_FOCUS)) {
Fl::focus(this);
return 1;
}
break;
}
return Fl_Text_Display_mod::handle(event);
}
//
// End of "$Id: Fl_Text_Editor.cxx 7462 2010-04-06 23:00:56Z matt $".
//

Wyświetl plik

@ -36,7 +36,7 @@ inline static int handle_scroll(Fl_Valuator* w, int event)
if (!dynamic_cast<Fl_Value_Input*>(w) && !dynamic_cast<Fl_Counter*>(w) &&
!(w->type() & FL_HOR_SLIDER))
d = -d;
w->value(w->clamp(w->increment(w->value(), -d)));
w->value(w->clamp(w->increment(w->value(), static_cast<int>(-d))));
w->do_callback();
}
return 1;

Wyświetl plik

@ -22,10 +22,9 @@
#include <config.h>
#include <iosfwd>
#include <fstream>
#include <string>
#include <cstdio>
#include <ctime>
#include "analysis.h"
#include "modem.h"
@ -37,6 +36,9 @@
#include "main.h"
#include "fl_digi.h"
#include "timeops.h"
#include "debug.h"
using namespace std;
#define anal_BW 4
@ -70,24 +72,49 @@ anal::~anal()
void anal::restart()
{
double fhi;
double flo;
symbollen = analMaxSymLen;
set_bandwidth(anal_BW);
fhi = anal_BW * 1.1 / samplerate;
flo = 0.0;
if (bpfilt)
double fhi = anal_BW * 1.1 / samplerate;
double flo = 0.0;
if (bpfilt)
bpfilt->create_filter(flo, fhi);
else
bpfilt = new fftfilt(flo, fhi, 2048);
symbollen = analMaxSymLen;
set_bandwidth(anal_BW);
ffilt->setLength(4000); // average over last 1/2 second of samples
favg->setLength(120); // average over last minute of samples
sum = 0.0;
fout_1 = fout_2 = 0.0;
restart_count = 64;
wf_freq = frequency;
if (clock_gettime(CLOCK_REALTIME, &start_time) == -1) {
LOG_PERROR("clock_gettime");
abort();
}
struct tm tm;
gmtime_r(&start_time.tv_sec, &tm);
FILE* out = fopen(analysisFilename.c_str(), "a");
if (unlikely(!out)) {
LOG_PERROR("fopen");
goto ret;
}
fprintf(out, "Time,Clock,Track,Freq\n"
",,,,rf track frequency: %" PRIdMAX " %s\n"
",,,,audio track frequency: %.0f\n"
",,,,%02d-%02d-%02d\n",
(intmax_t)wf->rfcarrier(), (wf->USB() ? "USB" : "LSB"),
frequency, tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
fclose(out);
ret:
if (clock_gettime(CLOCK_MONOTONIC, &start_time) == -1) {
LOG_PERROR("clock_gettime");
abort();
}
}
anal::anal()
@ -104,8 +131,9 @@ anal::anal()
analysisFilename = HomeDir;
analysisFilename.append("freqanalysis.csv");
pipeptr = 0;
cap &= ~CAP_TX;
restart();
}
@ -132,9 +160,31 @@ complex anal::mixer(complex in)
void anal::writeFile()
{
analysisFile.open(analysisFilename.c_str(), ios::app);
analysisFile << wf->rfcarrier() << ", " << frequency << ", " << fout_2 << endl;
analysisFile.close();
struct timespec elapsed, now;
// calculate elapsed time using the monotonic clock
if (clock_gettime(CLOCK_MONOTONIC, &now) == -1) {
LOG_PERROR("clock_gettime");
abort();
}
elapsed = now - start_time;
// calculate wall clock time using the realtime clock
if (clock_gettime(CLOCK_REALTIME, &now) == -1) {
LOG_PERROR("clock_gettime");
abort();
}
struct tm tm;
gmtime_r(&now.tv_sec, &tm);
FILE* out = fopen(analysisFilename.c_str(), "a");
if (unlikely(!out)) {
LOG_PERROR("fopen");
return;
}
fprintf(out, "%02d:%02d:%02d, %" PRIdMAX ".%03" PRIdMAX ", %f, %12.4f\n",
tm.tm_hour, tm.tm_min, tm.tm_sec, (intmax_t)elapsed.tv_sec,
(intmax_t)(elapsed.tv_nsec / 1000000), fout_2,
(wf->rfcarrier() + (wf->USB() ? 1.0 : -1.0) * (frequency + fout_2)));
fclose(out);
}
int anal::rx_process(const double *buf, int len)
@ -144,6 +194,8 @@ int anal::rx_process(const double *buf, int len)
int n;
static int dspcnt = symbollen;
if (wf_freq != frequency) restart();
while (len-- > 0) {
// create analytic signal from sound card input samples
z.re = z.im = *buf++;
@ -152,32 +204,36 @@ int anal::rx_process(const double *buf, int len)
z = mixer(z);
// low pass filter using Windowed Sinc - Overlap-Add convolution filter
n = bpfilt->run(z, &zp);
for (int i = 0; i < n; i++) {
if (n) for (int i = 0; i < n; i++) {
// measure phase difference between successive samples to determine
// the frequency of the baseband signal (+anal_baud or -anal_baud)
// see class complex definiton for operator %
fin = (prevsmpl % zp[i]).arg() * samplerate / TWOPI;
prevsmpl = zp[i];
if (restart_count) restart_count--;
else {
// filter using moving average filter
fout_1 = ffilt->run(fin);
fout_1 = ffilt->run(fin);
// the values in the pipe are +/- 2 Hz ==> +/- 1.0
pipe[pipeptr] = fout_1 / 4;
pipeptr = (pipeptr + 1) % symbollen;
dspcnt--;
if (dspcnt == 0) {
set_scope(pipe, symbollen, false);
pipe.next(); // change buffers
pipe[pipeptr] = fout_1 / 4;
pipeptr = (pipeptr + 1) % symbollen;
dspcnt--;
if (dspcnt == 0) {
set_scope(pipe, symbollen, false);
pipe.next(); // change buffers
// filter using second moving average filter & display the result
fout_2 = favg->run(fout_1);
if (wf->USB())
snprintf(msg1, sizeof(msg1), "Freq: %12.2f", wf->rfcarrier() + frequency + fout_2 );
else
snprintf(msg1, sizeof(msg1), "Freq: %12.2f", wf->rfcarrier() - frequency - fout_2 );
put_status(msg1);
writeFile();
fout_2 = favg->run(fout_1);
if (wf->USB())
snprintf(msg1, sizeof(msg1), "Freq: %12.2f", wf->rfcarrier() + frequency + fout_2 );
else
snprintf(msg1, sizeof(msg1), "Freq: %12.2f", wf->rfcarrier() - frequency - fout_2 );
put_status(msg1);
writeFile();
// reset the display counter & the pipe pointer
dspcnt = symbollen;
pipeptr = 0;
dspcnt = symbollen;
pipeptr = 0;
}
}
}
}

Wyświetl plik

@ -88,6 +88,7 @@ wwv::wwv() : modem()
vidfilter = new Cmovavg(16);
cap &= ~CAP_TX;
}