CubicSDR/src/AppFrame.h

201 lines
5.4 KiB
C
Raw Normal View History

#pragma once
#include <wx/frame.h>
#include <wx/panel.h>
#include <wx/splitter.h>
#include <wx/sizer.h>
#include "PrimaryGLContext.h"
#include "ScopeCanvas.h"
#include "SpectrumCanvas.h"
#include "WaterfallCanvas.h"
2014-12-31 19:45:01 -05:00
#include "MeterCanvas.h"
#include "TuningCanvas.h"
2015-01-05 19:12:16 -05:00
#include "ModeSelectorCanvas.h"
#include "GainCanvas.h"
#include "FFTVisualDataThread.h"
#include "SDRDeviceInfo.h"
#include "ModemProperties.h"
//#include "UITestCanvas.h"
#include "FrequencyDialog.h"
2014-12-31 19:45:01 -05:00
#include <map>
2014-12-31 22:38:59 -05:00
#define wxID_RT_AUDIO_DEVICE 1000
#define wxID_SET_FREQ_OFFSET 2001
2015-01-10 12:27:03 -05:00
#define wxID_RESET 2002
#define wxID_SET_PPM 2003
#define wxID_SET_TIPS 2004
2016-02-15 15:07:57 -05:00
#define wxID_SET_IQSWAP 2005
#define wxID_SDR_DEVICES 2008
#define wxID_AGC_CONTROL 2009
2016-02-28 23:16:56 -05:00
#define wxID_SDR_START_STOP 2010
#define wxID_LOW_PERF 2011
#define wxID_SET_DB_OFFSET 2012
2014-11-19 17:41:49 -05:00
#define wxID_MAIN_SPLITTER 2050
#define wxID_VIS_SPLITTER 2051
2014-11-19 17:41:49 -05:00
2015-01-11 03:09:59 -05:00
#define wxID_THEME_DEFAULT 2100
#define wxID_THEME_SHARP 2101
#define wxID_THEME_BW 2102
#define wxID_THEME_RAD 2103
#define wxID_THEME_TOUCH 2104
#define wxID_THEME_HD 2105
#define wxID_THEME_RADAR 2106
#define wxID_BANDWIDTH_BASE 2150
#define wxID_BANDWIDTH_MANUAL 2200
2015-01-11 17:08:16 -05:00
2016-06-15 16:21:41 -04:00
#define wxID_DISPLAY_BASE 2250
#define wxID_SETTINGS_BASE 2300
2015-01-11 17:08:16 -05:00
2015-01-12 00:40:43 -05:00
#define wxID_DEVICE_ID 3500
2015-03-12 19:41:50 -04:00
#define wxID_AUDIO_BANDWIDTH_BASE 9000
#define wxID_AUDIO_DEVICE_MULTIPLIER 50
#ifdef USE_HAMLIB
#define wxID_RIG_TOGGLE 11900
#define wxID_RIG_PORT 11901
#define wxID_RIG_SDR_IF 11902
#define wxID_RIG_CONTROL 11903
#define wxID_RIG_FOLLOW 11904
#define wxID_RIG_CENTERLOCK 11905
#define wxID_RIG_FOLLOW_MODEM 11906
#define wxID_RIG_SERIAL_BASE 11950
#define wxID_RIG_MODEL_BASE 12000
#endif
// Define a new frame type
class AppFrame: public wxFrame {
public:
AppFrame();
~AppFrame();
2014-11-22 22:33:32 -05:00
void OnThread(wxCommandEvent& event);
void OnEventInput(wxThreadEvent& event);
void initDeviceParams(SDRDeviceInfo *devInfo);
void updateDeviceParams();
2014-11-16 16:51:45 -05:00
2015-01-09 17:17:56 -05:00
void saveSession(std::string fileName);
bool loadSession(std::string fileName);
FFTVisualDataThread *getWaterfallDataThread();
void notifyUpdateModemProperties();
void setMainWaterfallFFTSize(int fftSize);
void setScopeDeviceName(std::string deviceName);
2016-05-18 23:12:48 -04:00
void gkNudgeLeft(DemodulatorInstance *demod, int snap);
void gkNudgeRight(DemodulatorInstance *demod, int snap);
2016-02-07 18:01:11 -05:00
int OnGlobalKeyDown(wxKeyEvent &event);
int OnGlobalKeyUp(wxKeyEvent &event);
void setWaterfallLinesPerSecond(int lps);
void setSpectrumAvgSpeed(double avg);
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
void refreshGainUI();
void setViewState(long long center_freq, int bandwidth);
void setViewState(long long center_freq);
bool isUserDemodBusy();
#ifdef _WIN32
bool canFocus();
#endif
private:
void OnMenu(wxCommandEvent& event);
2015-07-15 00:32:36 -04:00
void OnClose(wxCloseEvent& event);
void OnNewWindow(wxCommandEvent& event);
void OnIdle(wxIdleEvent& event);
void OnDoubleClickSash(wxSplitterEvent& event);
void OnUnSplit(wxSplitterEvent& event);
2016-06-20 13:28:26 -04:00
ScopeCanvas *scopeCanvas;
SpectrumCanvas *spectrumCanvas;
WaterfallCanvas *waterfallCanvas;
2015-01-05 19:12:16 -05:00
ModeSelectorCanvas *demodModeSelector;
2015-11-15 13:52:54 -05:00
#ifdef ENABLE_DIGITAL_LAB
ModeSelectorCanvas *demodModeSelectorAdv;
2015-11-15 13:52:54 -05:00
#endif
SpectrumCanvas *demodSpectrumCanvas;
WaterfallCanvas *demodWaterfallCanvas;
2014-12-31 19:45:01 -05:00
MeterCanvas *demodSignalMeter;
2015-01-10 20:33:30 -05:00
MeterCanvas *demodGainMeter;
TuningCanvas *demodTuner;
// UITestCanvas *testCanvas;
MeterCanvas *spectrumAvgMeter;
MeterCanvas *waterfallSpeedMeter;
ModeSelectorCanvas *demodMuteButton, *peakHoldButton, *soloModeButton, *deltaLockButton;
GainCanvas *gainCanvas;
wxSizerItem *gainSizerItem, *gainSpacerItem;
wxSplitterWindow *mainVisSplitter, *mainSplitter;
wxBoxSizer *demodTray;
2014-12-31 19:45:01 -05:00
DemodulatorInstance *activeDemodulator;
2014-12-31 22:38:59 -05:00
std::vector<RtAudio::DeviceInfo> devices;
std::map<int,RtAudio::DeviceInfo> inputDevices;
std::map<int,RtAudio::DeviceInfo> outputDevices;
2015-03-12 19:41:50 -04:00
std::map<int, wxMenuItem *> outputDeviceMenuItems;
std::map<int, wxMenuItem *> sampleRateMenuItems;
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
std::map<int, wxMenuItem *> directSamplingMenuItems;
2015-11-02 21:04:02 -05:00
wxMenuBar *menuBar;
2016-06-20 13:28:26 -04:00
wxMenu *sampleRateMenu;
2016-06-15 16:21:41 -04:00
wxMenu *displayMenu;
wxMenuItem *agcMenuItem;
2016-02-15 15:07:57 -05:00
wxMenuItem *iqSwapMenuItem;
wxMenuItem *lowPerfMenuItem;
wxMenu *settingsMenu;
2016-06-20 13:28:26 -04:00
2015-11-03 23:44:35 -05:00
SoapySDR::ArgInfoList settingArgs;
int settingsIdMax;
std::vector<long> sampleRates;
2015-05-31 22:13:14 -04:00
2015-01-09 17:17:56 -05:00
std::string currentSessionFile;
FFTVisualDataThread *waterfallDataThread;
std::thread *t_FFTData;
SDRDeviceInfo *devInfo;
std::atomic_bool deviceChanged;
ModemProperties *modemProps;
std::atomic_bool modemPropertiesUpdated;
2016-02-09 00:10:15 -05:00
wxMenuItem *showTipMenuItem;
bool lowPerfMode;
#ifdef USE_HAMLIB
void enableRig();
void disableRig();
wxMenu *rigMenu;
wxMenuItem *rigEnableMenuItem;
wxMenuItem *rigPortMenuItem;
wxMenuItem *rigControlMenuItem;
wxMenuItem *rigFollowMenuItem;
wxMenuItem *rigCenterLockMenuItem;
wxMenuItem *rigFollowModemMenuItem;
wxMenuItem *sdrIFMenuItem;
std::map<int, wxMenuItem *> rigSerialMenuItems;
std::map<int, wxMenuItem *> rigModelMenuItems;
int rigModel;
int rigSerialRate;
long long rigSDRIF;
std::vector<int> rigSerialRates;
std::string rigPort;
int numRigs;
bool rigInit;
#endif
wxDECLARE_EVENT_TABLE();
};