mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-02 21:27:49 -04:00
Bookmark panel active list testing
This commit is contained in:
parent
488e8ed9e7
commit
f4ab6fbaad
@ -313,9 +313,9 @@ AppFrame::AppFrame() :
|
|||||||
|
|
||||||
mainVisSplitter->SplitHorizontally( spectrumPanel, waterfallPanel, 0 );
|
mainVisSplitter->SplitHorizontally( spectrumPanel, waterfallPanel, 0 );
|
||||||
|
|
||||||
bookmarkPanel = new BookmarkPanel(bookmarkSplitter, wxID_ANY, wxDefaultPosition, wxSize(120,-1));
|
bookmarkView = new BookmarkView(bookmarkSplitter, wxID_ANY, wxDefaultPosition, wxSize(120,-1));
|
||||||
|
|
||||||
bookmarkSplitter->SplitVertically( bookmarkPanel, mainVisSplitter );
|
bookmarkSplitter->SplitVertically( bookmarkView, mainVisSplitter );
|
||||||
mainSplitter->SplitHorizontally( demodPanel, bookmarkSplitter );
|
mainSplitter->SplitHorizontally( demodPanel, bookmarkSplitter );
|
||||||
|
|
||||||
vbox->Add(mainSplitter, 1, wxEXPAND | wxALL, 0);
|
vbox->Add(mainSplitter, 1, wxEXPAND | wxALL, 0);
|
||||||
@ -1836,6 +1836,10 @@ bool AppFrame::isUserDemodBusy() {
|
|||||||
wxGetApp().getDemodMgr().getLastActiveDemodulator() != wxGetApp().getDemodMgr().getActiveDemodulator());
|
wxGetApp().getDemodMgr().getLastActiveDemodulator() != wxGetApp().getDemodMgr().getActiveDemodulator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BookmarkView *AppFrame::getBookmarkView() {
|
||||||
|
return bookmarkView;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool AppFrame::canFocus() {
|
bool AppFrame::canFocus() {
|
||||||
|
@ -103,7 +103,9 @@ public:
|
|||||||
void setViewState(long long center_freq);
|
void setViewState(long long center_freq);
|
||||||
|
|
||||||
bool isUserDemodBusy();
|
bool isUserDemodBusy();
|
||||||
|
|
||||||
|
BookmarkView *getBookmarkView();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool canFocus();
|
bool canFocus();
|
||||||
#endif
|
#endif
|
||||||
@ -136,7 +138,7 @@ private:
|
|||||||
wxSizerItem *gainSizerItem, *gainSpacerItem;
|
wxSizerItem *gainSizerItem, *gainSpacerItem;
|
||||||
wxSplitterWindow *mainVisSplitter, *mainSplitter, *bookmarkSplitter;
|
wxSplitterWindow *mainVisSplitter, *mainSplitter, *bookmarkSplitter;
|
||||||
wxBoxSizer *demodTray;
|
wxBoxSizer *demodTray;
|
||||||
BookmarkPanel *bookmarkPanel;
|
BookmarkView *bookmarkView;
|
||||||
|
|
||||||
DemodulatorInstance *activeDemodulator;
|
DemodulatorInstance *activeDemodulator;
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
|
|||||||
|
|
||||||
this->SetSizer( bSizer1 );
|
this->SetSizer( bSizer1 );
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
m_updateTimer.SetOwner( this, wxID_ANY );
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
m_treeView->Connect( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeBeginLabelEdit ), NULL, this );
|
m_treeView->Connect( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeBeginLabelEdit ), NULL, this );
|
||||||
@ -86,6 +87,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
|
|||||||
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 );
|
||||||
|
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( BookmarkPanel::onUpdateTimer ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
BookmarkPanel::~BookmarkPanel()
|
BookmarkPanel::~BookmarkPanel()
|
||||||
@ -102,5 +104,6 @@ BookmarkPanel::~BookmarkPanel()
|
|||||||
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 );
|
||||||
|
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( BookmarkPanel::onUpdateTimer ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1215,6 +1215,15 @@
|
|||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="wxTimer" expanded="1">
|
||||||
|
<property name="enabled">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="name">m_updateTimer</property>
|
||||||
|
<property name="oneshot">0</property>
|
||||||
|
<property name="period">500</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<event name="OnTimer">onUpdateTimer</event>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</wxFormBuilder_Project>
|
</wxFormBuilder_Project>
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
|
#include <wx/timer.h>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -46,6 +47,7 @@ class BookmarkPanel : public wxPanel
|
|||||||
wxButton* m_bookmarkButton;
|
wxButton* m_bookmarkButton;
|
||||||
wxButton* m_activateButton;
|
wxButton* m_activateButton;
|
||||||
wxButton* m_removeButton;
|
wxButton* m_removeButton;
|
||||||
|
wxTimer m_updateTimer;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void onTreeBeginLabelEdit( wxTreeEvent& event ) { event.Skip(); }
|
virtual void onTreeBeginLabelEdit( wxTreeEvent& event ) { event.Skip(); }
|
||||||
@ -59,6 +61,7 @@ class BookmarkPanel : public wxPanel
|
|||||||
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(); }
|
||||||
|
virtual void onUpdateTimer( wxTimerEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -2,20 +2,32 @@
|
|||||||
#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) {
|
||||||
doUpdateActive = false;
|
|
||||||
|
activeBranch = m_treeView->AddRoot("Active");
|
||||||
|
doUpdateActive = true;
|
||||||
|
m_updateTimer.Start(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookmarkView::onUpdateTimer( wxTimerEvent& event ) {
|
||||||
|
if (doUpdateActive) {
|
||||||
|
doUpdateActiveList();
|
||||||
|
|
||||||
|
// doUpdateActive = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookmarkView::updateActiveList() {
|
void BookmarkView::updateActiveList() {
|
||||||
|
doUpdateActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
m_treeView->Disable();
|
|
||||||
m_treeView->DeleteAllItems();
|
|
||||||
activeItems.erase(activeItems.begin(),activeItems.end());
|
activeItems.erase(activeItems.begin(),activeItems.end());
|
||||||
|
m_treeView->DeleteChildren(activeBranch);
|
||||||
activeBranch = m_treeView->AddRoot("Active");
|
|
||||||
|
|
||||||
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());
|
||||||
@ -24,6 +36,7 @@ void BookmarkView::updateActiveList() {
|
|||||||
|
|
||||||
m_treeView->Enable();
|
m_treeView->Enable();
|
||||||
m_treeView->ExpandAll();
|
m_treeView->ExpandAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookmarkView::onTreeBeginLabelEdit( wxTreeEvent& event ) {
|
void BookmarkView::onTreeBeginLabelEdit( wxTreeEvent& event ) {
|
||||||
|
@ -11,6 +11,9 @@ public:
|
|||||||
void updateActiveList();
|
void updateActiveList();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void onUpdateTimer( wxTimerEvent& event );
|
||||||
|
void doUpdateActiveList();
|
||||||
|
|
||||||
void onTreeBeginLabelEdit( wxTreeEvent& event );
|
void onTreeBeginLabelEdit( wxTreeEvent& event );
|
||||||
void onTreeEndLabelEdit( wxTreeEvent& event );
|
void onTreeEndLabelEdit( wxTreeEvent& event );
|
||||||
void onTreeActivate( wxTreeEvent& event );
|
void onTreeActivate( wxTreeEvent& event );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user