mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 12:18:37 -05:00
Improve active list integration/interactivity
This commit is contained in:
parent
9ffdf6808d
commit
003758b799
@ -59,6 +59,19 @@ BookmarkList BookmarkMgr::getBookmarks(std::string group, std::string folder) {
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BookmarkGroup BookmarkMgr::getGroup(std::string group) {
|
||||||
|
return bmData[group];
|
||||||
|
}
|
||||||
|
|
||||||
|
BookmarkNames BookmarkMgr::getGroups() {
|
||||||
|
BookmarkNames results;
|
||||||
|
for (BookmarkMap::iterator i = bmData.begin(); i!= bmData.end(); ++i) {
|
||||||
|
results.push_back(i->first);
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BookmarkMgr::updateActiveList() {
|
void BookmarkMgr::updateActiveList() {
|
||||||
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
|
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@ struct BookmarkEntryCompare : public std::binary_function<BookmarkEntry *,Bookma
|
|||||||
|
|
||||||
|
|
||||||
typedef std::vector<BookmarkEntry *> BookmarkList;
|
typedef std::vector<BookmarkEntry *> BookmarkList;
|
||||||
typedef std::map<std::string, std::set<BookmarkEntry *, BookmarkEntryCompare> > BookmarkMap;
|
typedef std::set<BookmarkEntry *, BookmarkEntryCompare> BookmarkGroup;
|
||||||
|
typedef std::map<std::string, BookmarkGroup > BookmarkMap;
|
||||||
|
typedef std::vector<std::string> BookmarkNames;
|
||||||
|
|
||||||
class BookmarkMgr {
|
class BookmarkMgr {
|
||||||
public:
|
public:
|
||||||
@ -41,7 +43,8 @@ public:
|
|||||||
void addBookmark(std::string group, DemodulatorInstance *demod, std::string folder = "");
|
void addBookmark(std::string group, DemodulatorInstance *demod, std::string folder = "");
|
||||||
void removeBookmark(std::string group, BookmarkEntry *be);
|
void removeBookmark(std::string group, BookmarkEntry *be);
|
||||||
BookmarkList getBookmarks(std::string group, std::string folder = "");
|
BookmarkList getBookmarks(std::string group, std::string folder = "");
|
||||||
|
BookmarkGroup getGroup(std::string group);
|
||||||
|
BookmarkNames getGroups();
|
||||||
void updateActiveList();
|
void updateActiveList();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -753,6 +753,7 @@ void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetM
|
|||||||
|
|
||||||
switch (targetMode) {
|
switch (targetMode) {
|
||||||
case FrequencyDialog::FDIALOG_TARGET_DEFAULT:
|
case FrequencyDialog::FDIALOG_TARGET_DEFAULT:
|
||||||
|
case FrequencyDialog::FDIALOG_TARGET_FREQ:
|
||||||
title = demodMgr.getActiveDemodulator()?demodTitle:freqTitle;
|
title = demodMgr.getActiveDemodulator()?demodTitle:freqTitle;
|
||||||
break;
|
break;
|
||||||
case FrequencyDialog::FDIALOG_TARGET_BANDWIDTH:
|
case FrequencyDialog::FDIALOG_TARGET_BANDWIDTH:
|
||||||
|
@ -217,6 +217,7 @@ void DemodulatorMgr::setActiveDemodulator(DemodulatorInstance *demod, bool tempo
|
|||||||
wxGetApp().getRigThread()->setFrequency(lastActiveDemodulator.load()->getFrequency(),true);
|
wxGetApp().getRigThread()->setFrequency(lastActiveDemodulator.load()->getFrequency(),true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
wxGetApp().getBookmarkMgr().updateActiveList();
|
||||||
} else {
|
} else {
|
||||||
std::lock_guard < std::recursive_mutex > lock(demods_busy);
|
std::lock_guard < std::recursive_mutex > lock(demods_busy);
|
||||||
garbageCollect();
|
garbageCollect();
|
||||||
|
@ -14,7 +14,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
|
|||||||
wxBoxSizer* bSizer1;
|
wxBoxSizer* bSizer1;
|
||||||
bSizer1 = new wxBoxSizer( wxVERTICAL );
|
bSizer1 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_treeView = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE );
|
m_treeView = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_HIDE_ROOT );
|
||||||
bSizer1->Add( m_treeView, 5, wxEXPAND, 5 );
|
bSizer1->Add( m_treeView, 5, wxEXPAND, 5 );
|
||||||
|
|
||||||
m_propPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_propPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
@ -84,6 +84,8 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
|
|||||||
m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this );
|
m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this );
|
||||||
m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this );
|
m_treeView->Connect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this );
|
||||||
m_labelText->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this );
|
m_labelText->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this );
|
||||||
|
m_frequencyVal->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickFreq ), NULL, this );
|
||||||
|
m_bandwidthVal->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickBandwidth ), NULL, this );
|
||||||
m_bookmarkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onBookmark ), NULL, this );
|
m_bookmarkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onBookmark ), NULL, this );
|
||||||
m_activateButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this );
|
m_activateButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this );
|
||||||
m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this );
|
m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this );
|
||||||
@ -101,6 +103,8 @@ BookmarkPanel::~BookmarkPanel()
|
|||||||
m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this );
|
m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGED, wxTreeEventHandler( BookmarkPanel::onTreeSelect ), NULL, this );
|
||||||
m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this );
|
m_treeView->Disconnect( wxEVT_COMMAND_TREE_SEL_CHANGING, wxTreeEventHandler( BookmarkPanel::onTreeSelectChanging ), NULL, this );
|
||||||
m_labelText->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this );
|
m_labelText->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onLabelText ), NULL, this );
|
||||||
|
m_frequencyVal->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickFreq ), NULL, this );
|
||||||
|
m_bandwidthVal->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickBandwidth ), NULL, this );
|
||||||
m_bookmarkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onBookmark ), NULL, this );
|
m_bookmarkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onBookmark ), NULL, this );
|
||||||
m_activateButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this );
|
m_activateButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this );
|
||||||
m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this );
|
m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this );
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
<property name="resize">Resizable</property>
|
<property name="resize">Resizable</property>
|
||||||
<property name="show">1</property>
|
<property name="show">1</property>
|
||||||
<property name="size"></property>
|
<property name="size"></property>
|
||||||
<property name="style">wxTR_DEFAULT_STYLE</property>
|
<property name="style">wxTR_DEFAULT_STYLE|wxTR_HIDE_ROOT</property>
|
||||||
<property name="subclass"></property>
|
<property name="subclass"></property>
|
||||||
<property name="toolbar_pane">0</property>
|
<property name="toolbar_pane">0</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
@ -597,7 +597,7 @@
|
|||||||
<event name="OnKeyUp"></event>
|
<event name="OnKeyUp"></event>
|
||||||
<event name="OnKillFocus"></event>
|
<event name="OnKillFocus"></event>
|
||||||
<event name="OnLeaveWindow"></event>
|
<event name="OnLeaveWindow"></event>
|
||||||
<event name="OnLeftDClick"></event>
|
<event name="OnLeftDClick">onDoubleClickFreq</event>
|
||||||
<event name="OnLeftDown"></event>
|
<event name="OnLeftDown"></event>
|
||||||
<event name="OnLeftUp"></event>
|
<event name="OnLeftUp"></event>
|
||||||
<event name="OnMiddleDClick"></event>
|
<event name="OnMiddleDClick"></event>
|
||||||
@ -763,7 +763,7 @@
|
|||||||
<event name="OnKeyUp"></event>
|
<event name="OnKeyUp"></event>
|
||||||
<event name="OnKillFocus"></event>
|
<event name="OnKillFocus"></event>
|
||||||
<event name="OnLeaveWindow"></event>
|
<event name="OnLeaveWindow"></event>
|
||||||
<event name="OnLeftDClick"></event>
|
<event name="OnLeftDClick">onDoubleClickBandwidth</event>
|
||||||
<event name="OnLeftDown"></event>
|
<event name="OnLeftDown"></event>
|
||||||
<event name="OnLeftUp"></event>
|
<event name="OnLeftUp"></event>
|
||||||
<event name="OnMiddleDClick"></event>
|
<event name="OnMiddleDClick"></event>
|
||||||
|
@ -58,6 +58,8 @@ class BookmarkPanel : public wxPanel
|
|||||||
virtual void onTreeSelect( wxTreeEvent& event ) { event.Skip(); }
|
virtual void onTreeSelect( wxTreeEvent& event ) { event.Skip(); }
|
||||||
virtual void onTreeSelectChanging( wxTreeEvent& event ) { event.Skip(); }
|
virtual void onTreeSelectChanging( wxTreeEvent& event ) { event.Skip(); }
|
||||||
virtual void onLabelText( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onLabelText( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void onDoubleClickFreq( wxMouseEvent& event ) { event.Skip(); }
|
||||||
|
virtual void onDoubleClickBandwidth( wxMouseEvent& event ) { event.Skip(); }
|
||||||
virtual void onBookmark( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onBookmark( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void onActivate( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onActivate( wxCommandEvent& event ) { event.Skip(); }
|
||||||
virtual void onRemove( wxCommandEvent& event ) { event.Skip(); }
|
virtual void onRemove( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
|
|
||||||
BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : BookmarkPanel(parent, id, pos, size, style) {
|
BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : BookmarkPanel(parent, id, pos, size, style) {
|
||||||
|
rootBranch = m_treeView->AddRoot("Root");
|
||||||
activeBranch = m_treeView->AddRoot("Active");
|
activeBranch = m_treeView->AppendItem(rootBranch, "Active");
|
||||||
|
bookmarkBranch = m_treeView->AppendItem(rootBranch, "Bookmarks");
|
||||||
doUpdateActive = false;
|
doUpdateActive = false;
|
||||||
activeSel = nullptr;
|
activeSel = nullptr;
|
||||||
m_updateTimer.Start(500);
|
m_updateTimer.Start(500);
|
||||||
@ -26,15 +27,28 @@ void BookmarkView::updateActiveList() {
|
|||||||
void BookmarkView::doUpdateActiveList() {
|
void BookmarkView::doUpdateActiveList() {
|
||||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||||
|
|
||||||
// DemodulatorInstance *activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
|
DemodulatorInstance *activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||||
// DemodulatorInstance *lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
// DemodulatorInstance *lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
|
||||||
activeItems.erase(activeItems.begin(),activeItems.end());
|
activeItems.erase(activeItems.begin(),activeItems.end());
|
||||||
m_treeView->DeleteChildren(activeBranch);
|
m_treeView->DeleteChildren(activeBranch);
|
||||||
|
|
||||||
|
wxTreeItemId selItem = nullptr;
|
||||||
for (auto demod_i : demods) {
|
for (auto demod_i : demods) {
|
||||||
wxTreeItemId itm = m_treeView->AppendItem(activeBranch,demod_i->getLabel());
|
wxTreeItemId itm = m_treeView->AppendItem(activeBranch,demod_i->getLabel());
|
||||||
activeItems[itm] = demod_i;
|
activeItems[itm] = demod_i;
|
||||||
|
if (activeDemodulator) {
|
||||||
|
if (activeDemodulator == demod_i) {
|
||||||
|
selItem = itm;
|
||||||
|
activeSel = demod_i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (activeSel == demod_i) {
|
||||||
|
selItem = itm;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selItem != nullptr) {
|
||||||
|
m_treeView->SelectItem(selItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_treeView->Enable();
|
m_treeView->Enable();
|
||||||
@ -134,6 +148,24 @@ void BookmarkView::onLabelText( wxCommandEvent& event ) {
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BookmarkView::onDoubleClickFreq( wxMouseEvent& event ) {
|
||||||
|
if (activeSel) {
|
||||||
|
wxGetApp().getDemodMgr().setActiveDemodulator(activeSel, false);
|
||||||
|
wxGetApp().showFrequencyInput(FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_DEFAULT);
|
||||||
|
} else {
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& event ) {
|
||||||
|
if (activeSel) {
|
||||||
|
wxGetApp().getDemodMgr().setActiveDemodulator(activeSel, false);
|
||||||
|
wxGetApp().showFrequencyInput(FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_BANDWIDTH);
|
||||||
|
} else {
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BookmarkView::onBookmark( wxCommandEvent& event ) {
|
void BookmarkView::onBookmark( wxCommandEvent& event ) {
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,16 @@ protected:
|
|||||||
void onTreeSelect( wxTreeEvent& event );
|
void onTreeSelect( wxTreeEvent& event );
|
||||||
void onTreeSelectChanging( wxTreeEvent& event );
|
void onTreeSelectChanging( wxTreeEvent& event );
|
||||||
void onLabelText( wxCommandEvent& event );
|
void onLabelText( wxCommandEvent& event );
|
||||||
|
void onDoubleClickFreq( wxMouseEvent& event );
|
||||||
|
void onDoubleClickBandwidth( wxMouseEvent& event );
|
||||||
void onBookmark( wxCommandEvent& event );
|
void onBookmark( wxCommandEvent& event );
|
||||||
void onActivate( wxCommandEvent& event );
|
void onActivate( wxCommandEvent& event );
|
||||||
void onRemove( wxCommandEvent& event );
|
void onRemove( wxCommandEvent& event );
|
||||||
|
|
||||||
bool doUpdateActive;
|
bool doUpdateActive;
|
||||||
wxTreeItemId activeBranch;
|
wxTreeItemId rootBranch, activeBranch, bookmarkBranch;
|
||||||
|
std::map<std::string, wxTreeItemId> groups;
|
||||||
|
|
||||||
std::map<wxTreeItemId, DemodulatorInstance *> activeItems;
|
std::map<wxTreeItemId, DemodulatorInstance *> activeItems;
|
||||||
DemodulatorInstance *activeSel;
|
DemodulatorInstance *activeSel;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user