Active selection / removal functional

This commit is contained in:
Charles J. Cliffe 2016-09-28 20:37:39 -04:00
parent 367a723947
commit 9ffdf6808d
5 changed files with 88 additions and 13 deletions

View File

@ -24,9 +24,9 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
fgPropSizer->SetFlexibleDirection( wxBOTH );
fgPropSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( m_propPanel, wxID_ANY, wxT("Label"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgPropSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_labelLabel = new wxStaticText( m_propPanel, wxID_ANY, wxT("Label"), wxDefaultPosition, wxDefaultSize, 0 );
m_labelLabel->Wrap( -1 );
fgPropSizer->Add( m_labelLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_labelText = new wxTextCtrl( m_propPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgPropSizer->Add( m_labelText, 0, wxALL|wxEXPAND, 5 );
@ -51,9 +51,9 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
m_modulationLabel->Wrap( -1 );
fgPropSizer->Add( m_modulationLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_typeVal = new wxStaticText( m_propPanel, wxID_ANY, wxT("TypeVal"), wxDefaultPosition, wxDefaultSize, 0 );
m_typeVal->Wrap( -1 );
fgPropSizer->Add( m_typeVal, 0, wxALL, 5 );
m_modulationVal = new wxStaticText( m_propPanel, wxID_ANY, wxT("TypeVal"), wxDefaultPosition, wxDefaultSize, 0 );
m_modulationVal->Wrap( -1 );
fgPropSizer->Add( m_modulationVal, 0, wxALL, 5 );
m_propPanel->SetSizer( fgPropSizer );

View File

@ -315,7 +315,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText1</property>
<property name="name">m_labelLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -904,7 +904,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_typeVal</property>
<property name="name">m_modulationVal</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -36,14 +36,14 @@ class BookmarkPanel : public wxPanel
protected:
wxTreeCtrl* m_treeView;
wxPanel* m_propPanel;
wxStaticText* m_staticText1;
wxStaticText* m_labelLabel;
wxTextCtrl* m_labelText;
wxStaticText* m_frequencyLabel;
wxStaticText* m_frequencyVal;
wxStaticText* m_bandwidthLabel;
wxStaticText* m_bandwidthVal;
wxStaticText* m_modulationLabel;
wxStaticText* m_typeVal;
wxStaticText* m_modulationVal;
wxButton* m_bookmarkButton;
wxButton* m_activateButton;
wxButton* m_removeButton;

View File

@ -4,8 +4,11 @@
BookmarkView::BookmarkView( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) : BookmarkPanel(parent, id, pos, size, style) {
activeBranch = m_treeView->AddRoot("Active");
// doUpdateActive = true;
doUpdateActive = false;
activeSel = nullptr;
m_updateTimer.Start(500);
hideProps();
m_propPanel->Hide();
}
void BookmarkView::onUpdateTimer( wxTimerEvent& event ) {
@ -59,8 +62,68 @@ void BookmarkView::onTreeExpanded( wxTreeEvent& event ) {
event.Skip();
}
void BookmarkView::hideProps() {
m_frequencyLabel->Hide();
m_frequencyVal->Hide();
m_bandwidthLabel->Hide();
m_bandwidthVal->Hide();
m_modulationVal->Hide();
m_modulationLabel->Hide();
m_labelText->Hide();
m_labelLabel->Hide();
m_bookmarkButton->Hide();
m_activateButton->Hide();
m_removeButton->Hide();
}
void BookmarkView::activeSelection(DemodulatorInstance *dsel) {
activeSel = dsel;
m_frequencyVal->SetLabelText(frequencyToStr(dsel->getFrequency()));
m_bandwidthVal->SetLabelText(frequencyToStr(dsel->getBandwidth()));
m_modulationVal->SetLabelText(dsel->getDemodulatorType());
m_labelText->SetValue(dsel->getLabel());
hideProps();
m_frequencyVal->Show();
m_frequencyLabel->Show();
m_bandwidthVal->Show();
m_bandwidthLabel->Show();
m_modulationVal->Show();
m_modulationLabel->Show();
m_labelText->Show();
m_labelLabel->Show();
m_bookmarkButton->Show();
m_removeButton->Show();
this->Layout();
}
void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
event.Skip();
if (activeItems.find(event.GetItem()) != activeItems.end()) {
DemodulatorInstance *dsel = activeItems[event.GetItem()];
m_propPanel->Show();
activeSelection(dsel);
wxGetApp().getDemodMgr().setActiveDemodulator(activeSel, false);
} else {
activeSel = nullptr;
m_propPanel->Hide();
hideProps();
this->Layout();
wxGetApp().getDemodMgr().setActiveDemodulator(activeSel, false);
event.Skip();
}
}
void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) {
@ -80,6 +143,13 @@ void BookmarkView::onActivate( wxCommandEvent& event ) {
}
void BookmarkView::onRemove( wxCommandEvent& event ) {
event.Skip();
if (activeSel != nullptr) {
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false);
wxGetApp().removeDemodulator(activeSel);
wxGetApp().getDemodMgr().deleteThread(activeSel);
activeSel = nullptr;
} else {
event.Skip();
}
}

View File

@ -9,8 +9,12 @@ public:
BookmarkView( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1, -1 ), long style = wxTAB_TRAVERSAL );
void updateActiveList();
void activeSelection(DemodulatorInstance *dsel);
protected:
void hideProps();
void onUpdateTimer( wxTimerEvent& event );
void doUpdateActiveList();
@ -29,4 +33,5 @@ protected:
bool doUpdateActive;
wxTreeItemId activeBranch;
std::map<wxTreeItemId, DemodulatorInstance *> activeItems;
DemodulatorInstance *activeSel;
};