mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-15 12:18:38 -04:00
Merge remote-tracking branch 'origin/master' into firpbch2_mode
This commit is contained in:
+11
-9
@@ -2970,26 +2970,28 @@ void AppFrame::toggleAllActiveDemodRecording() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto activeDemods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
// All demods, irrespective of their active state:
|
||||
// recording will start eventually when a demod come in range.
|
||||
auto allDemods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
|
||||
//by default, do a false => true for all:
|
||||
bool stateToSet = true;
|
||||
|
||||
for (auto i : activeDemods) {
|
||||
if (i->isActive() && i->isRecording()) {
|
||||
for (auto i : allDemods) {
|
||||
if (i->isRecording()) {
|
||||
stateToSet = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto i : activeDemods) {
|
||||
if (i->isActive() && i->isRecording() != stateToSet) {
|
||||
i->setRecording(stateToSet);
|
||||
}
|
||||
for (auto i : allDemods) {
|
||||
|
||||
i->setRecording(stateToSet);
|
||||
}
|
||||
//this effectively refresh the BookmarkView buttons, including Recording buttons.
|
||||
wxGetApp().getBookmarkMgr().updateActiveList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AppFrame::setWaterfallLinesPerSecond(int lps) {
|
||||
waterfallSpeedMeter->setUserInputValue(sqrt(lps));
|
||||
}
|
||||
|
||||
@@ -553,10 +553,10 @@ bool DemodulatorInstance::isRecording()
|
||||
|
||||
void DemodulatorInstance::setRecording(bool recording_in)
|
||||
{
|
||||
if (!recording.load() && recording_in) {
|
||||
if (recording_in) {
|
||||
startRecording();
|
||||
}
|
||||
else if (recording.load() && !recording_in) {
|
||||
else {
|
||||
stopRecording();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void BookmarkView::onUpdateTimer( wxTimerEvent& /* event */ ) {
|
||||
}
|
||||
}
|
||||
|
||||
bool BookmarkView::skipUserEvents() {
|
||||
bool BookmarkView::skipEvents() {
|
||||
|
||||
return !this->IsShown() || doUpdateActive || doUpdateBookmarks;
|
||||
}
|
||||
@@ -511,6 +511,9 @@ void BookmarkView::doUpdateActiveList() {
|
||||
m_treeView->SelectItem(selItem);
|
||||
}
|
||||
|
||||
// Add an extra refresh, that rebuilds the buttons from sratch.
|
||||
activeSelection(lastActiveDemodulator);
|
||||
|
||||
delete prevSelCopy;
|
||||
}
|
||||
|
||||
@@ -543,10 +546,6 @@ void BookmarkView::onTreeActivate( wxTreeEvent& event ) {
|
||||
|
||||
void BookmarkView::onTreeCollapse( wxTreeEvent& event ) {
|
||||
|
||||
if (skipUserEvents()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool searchState = (searchKeywords.size() != 0);
|
||||
|
||||
if (searchState) {
|
||||
@@ -577,10 +576,6 @@ void BookmarkView::onTreeCollapse( wxTreeEvent& event ) {
|
||||
|
||||
void BookmarkView::onTreeExpanded( wxTreeEvent& event ) {
|
||||
|
||||
if (skipUserEvents()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool searchState = (searchKeywords.size() != 0);
|
||||
|
||||
if (searchState) {
|
||||
@@ -697,14 +692,6 @@ void BookmarkView::refreshLayout() {
|
||||
wxButton *BookmarkView::makeButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler) {
|
||||
wxButton *nButton = new wxButton( m_buttonPanel, wxID_ANY, labelVal);
|
||||
nButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, handler, nullptr, this);
|
||||
|
||||
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
|
||||
// wxColour fgColor(ThemeMgr::mgr.currentTheme->button);
|
||||
//Force white color:
|
||||
wxColour textColorWhite(RGBA4f(255,255,255));
|
||||
|
||||
nButton->SetBackgroundColour(bgColor);
|
||||
nButton->SetForegroundColour(textColorWhite);
|
||||
|
||||
return nButton;
|
||||
}
|
||||
@@ -816,9 +803,17 @@ void BookmarkView::onBookmarkChoice( wxCommandEvent & /* event */ ) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
|
||||
|
||||
|
||||
if (dsel == nullptr) {
|
||||
hideProps();
|
||||
clearButtons();
|
||||
showProps();
|
||||
showButtons();
|
||||
refreshLayout();
|
||||
return;
|
||||
}
|
||||
|
||||
m_frequencyVal->SetLabelText(frequencyToStr(dsel->getFrequency()));
|
||||
m_bandwidthVal->SetLabelText(frequencyToStr(dsel->getBandwidth()));
|
||||
m_modulationVal->SetLabelText(dsel->getDemodulatorType());
|
||||
@@ -842,14 +837,12 @@ void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
|
||||
|
||||
addBookmarkChoice(m_buttonPanel);
|
||||
|
||||
if (dsel->isActive()) {
|
||||
if (!(dsel->isRecording())) {
|
||||
addButton(m_buttonPanel, "Start Recording", wxCommandEventHandler(BookmarkView::onStartRecording));
|
||||
} else {
|
||||
addButton(m_buttonPanel, "Stop Recording", wxCommandEventHandler(BookmarkView::onStopRecording));
|
||||
}
|
||||
}
|
||||
|
||||
if (!(dsel->isRecording())) {
|
||||
addButton(m_buttonPanel, "Start Recording", wxCommandEventHandler(BookmarkView::onStartRecording));
|
||||
} else {
|
||||
addButton(m_buttonPanel, "Stop Recording", wxCommandEventHandler(BookmarkView::onStopRecording));
|
||||
}
|
||||
|
||||
addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
|
||||
|
||||
showProps();
|
||||
@@ -1074,6 +1067,10 @@ void BookmarkView::activeBranchSelection() {
|
||||
|
||||
void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
|
||||
|
||||
if (skipEvents()) {
|
||||
return;
|
||||
}
|
||||
|
||||
wxTreeItemId itm = event.GetItem();
|
||||
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm));
|
||||
|
||||
@@ -1119,10 +1116,6 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
|
||||
|
||||
void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) {
|
||||
|
||||
if (skipUserEvents()) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@@ -1203,6 +1196,7 @@ void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) {
|
||||
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
|
||||
if (!curSel->demod->isRecording() && wxGetApp().getConfig()->verifyRecordingPath()) {
|
||||
curSel->demod->setRecording(true);
|
||||
|
||||
wxGetApp().getBookmarkMgr().updateActiveList();
|
||||
}
|
||||
}
|
||||
@@ -1216,6 +1210,7 @@ void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) {
|
||||
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
|
||||
if (curSel->demod->isRecording()) {
|
||||
curSel->demod->setRecording(false);
|
||||
|
||||
wxGetApp().getBookmarkMgr().updateActiveList();
|
||||
}
|
||||
}
|
||||
@@ -1481,10 +1476,6 @@ void BookmarkView::onTreeEndDrag( wxTreeEvent& event ) {
|
||||
|
||||
|
||||
void BookmarkView::onTreeItemGetTooltip( wxTreeEvent& event ) {
|
||||
|
||||
if (skipUserEvents()) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@@ -162,8 +162,8 @@ protected:
|
||||
void onActivateRange( wxCommandEvent& event );
|
||||
void onUpdateRange( wxCommandEvent& event );
|
||||
|
||||
bool skipUserEvents();
|
||||
|
||||
bool skipEvents();
|
||||
|
||||
TreeViewItem *itemToTVI(wxTreeItemId item);
|
||||
|
||||
void SetTreeItemData(const wxTreeItemId& item, wxTreeItemData *data);
|
||||
@@ -201,4 +201,5 @@ protected:
|
||||
std::vector<std::wstring> searchKeywords;
|
||||
|
||||
void setStatusText(std::string statusText);
|
||||
|
||||
};
|
||||
|
||||
@@ -361,7 +361,7 @@ void SDRDevicesDialog::OnUseSelected( wxMouseEvent& event) {
|
||||
wxPGProperty *prop = runtimeProps[arg.key];
|
||||
|
||||
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
|
||||
settingArgs[arg.key] = arg.options[prop->GetChoiceSelection()];
|
||||
settingArgs[arg.key] = getSelectedChoiceOption(prop, arg);
|
||||
} else if (arg.type == SoapySDR::ArgInfo::BOOL) {
|
||||
settingArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false";
|
||||
} else {
|
||||
@@ -378,7 +378,7 @@ void SDRDevicesDialog::OnUseSelected( wxMouseEvent& event) {
|
||||
wxPGProperty *prop = streamProps[arg.key];
|
||||
|
||||
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
|
||||
streamArgs[arg.key] = arg.options[prop->GetChoiceSelection()];
|
||||
streamArgs[arg.key] = getSelectedChoiceOption(prop, arg);
|
||||
} else if (arg.type == SoapySDR::ArgInfo::BOOL) {
|
||||
streamArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false";
|
||||
} else {
|
||||
@@ -491,6 +491,27 @@ void SDRDevicesDialog::OnRefreshDevices( wxMouseEvent& /* event */) {
|
||||
doRefreshDevices();
|
||||
}
|
||||
|
||||
std::string SDRDevicesDialog::getSelectedChoiceOption(wxPGProperty* prop, const SoapySDR::ArgInfo& arg) {
|
||||
|
||||
std::string optionName = "";
|
||||
|
||||
int choiceIndex = prop->GetChoiceSelection();
|
||||
|
||||
if (arg.options.size() > 0) {
|
||||
|
||||
if (choiceIndex >= 0 && choiceIndex < arg.options.size()) {
|
||||
//normal selection
|
||||
optionName = arg.options[choiceIndex];
|
||||
} else {
|
||||
//choose the first one of the list:
|
||||
optionName = arg.options[0];
|
||||
prop->SetChoiceSelection(0);
|
||||
}
|
||||
}
|
||||
|
||||
return optionName;
|
||||
}
|
||||
|
||||
void SDRDevicesDialog::OnPropGridChanged( wxPropertyGridEvent& event ) {
|
||||
|
||||
if (event.GetProperty() == devSettings["name"]) {
|
||||
@@ -557,7 +578,7 @@ void SDRDevicesDialog::OnPropGridChanged( wxPropertyGridEvent& event ) {
|
||||
std::string settingValue = prop->GetValueAsString().ToStdString();
|
||||
SoapySDR::ArgInfo arg = runtimeArgs[rtp->first];
|
||||
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
|
||||
settingValue = arg.options[prop->GetChoiceSelection()];
|
||||
settingValue = getSelectedChoiceOption(prop, arg);
|
||||
} else if (arg.type == SoapySDR::ArgInfo::BOOL) {
|
||||
settingValue = (prop->GetValueAsString()=="True")?"true":"false";
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,10 @@ private:
|
||||
SDRDeviceInfo *getSelectedDevice(wxTreeItemId selId);
|
||||
wxPGProperty *addArgInfoProperty(wxPropertyGrid *pg, SoapySDR::ArgInfo arg);
|
||||
|
||||
//
|
||||
std::string getSelectedChoiceOption(wxPGProperty* prop, const SoapySDR::ArgInfo& arg);
|
||||
|
||||
|
||||
bool refresh, failed;
|
||||
std::map<std::string, std::vector<SDRDeviceInfo *>* > devs;
|
||||
std::vector<SDRDeviceInfo *>::iterator devs_i;
|
||||
|
||||
Reference in New Issue
Block a user