mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 04:08:36 -05:00
More flexible bookmark buttons
This commit is contained in:
parent
53ce3b2877
commit
b89b557352
@ -61,14 +61,15 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
|
||||
fgPropSizer->Fit( m_propPanel );
|
||||
bSizer1->Add( m_propPanel, 1, wxBOTTOM|wxEXPAND|wxTOP, 5 );
|
||||
|
||||
m_bookmarkButton = new wxButton( this, wxID_ANY, wxT("Bookmark"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer1->Add( m_bookmarkButton, 0, wxEXPAND, 5 );
|
||||
m_buttonPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
wxBoxSizer* m_buttonPanelSizer;
|
||||
m_buttonPanelSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_activateButton = new wxButton( this, wxID_ANY, wxT("Activate"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer1->Add( m_activateButton, 0, wxEXPAND, 5 );
|
||||
|
||||
m_removeButton = new wxButton( this, wxID_ANY, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer1->Add( m_removeButton, 0, wxEXPAND, 5 );
|
||||
m_buttonPanel->SetSizer( m_buttonPanelSizer );
|
||||
m_buttonPanel->Layout();
|
||||
m_buttonPanelSizer->Fit( m_buttonPanel );
|
||||
bSizer1->Add( m_buttonPanel, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer1 );
|
||||
@ -93,9 +94,6 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po
|
||||
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_activateButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this );
|
||||
m_removeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this );
|
||||
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( BookmarkPanel::onUpdateTimer ) );
|
||||
}
|
||||
|
||||
@ -119,9 +117,6 @@ BookmarkPanel::~BookmarkPanel()
|
||||
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_activateButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onActivate ), NULL, this );
|
||||
m_removeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onRemove ), NULL, this );
|
||||
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( BookmarkPanel::onUpdateTimer ) );
|
||||
|
||||
}
|
||||
|
@ -189,7 +189,7 @@
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<object class="wxPanel" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -263,7 +263,7 @@
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<object class="wxFlexGridSizer" expanded="0">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
@ -449,11 +449,11 @@
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -532,11 +532,11 @@
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -615,11 +615,11 @@
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -698,11 +698,11 @@
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -781,11 +781,11 @@
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -864,11 +864,11 @@
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -953,8 +953,8 @@
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
@ -971,7 +971,6 @@
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
@ -983,7 +982,6 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Bookmark</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
@ -991,7 +989,7 @@
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bookmarkButton</property>
|
||||
<property name="name">m_buttonPanel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
@ -1001,194 +999,12 @@
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onBookmark</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Activate</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_activateButton</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onActivate</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Remove</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_removeButton</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onRemove</event>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
@ -1212,6 +1028,12 @@
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_buttonPanelSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/timer.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -44,9 +43,7 @@ class BookmarkPanel : public wxPanel
|
||||
wxStaticText* m_bandwidthVal;
|
||||
wxStaticText* m_modulationLabel;
|
||||
wxStaticText* m_modulationVal;
|
||||
wxButton* m_bookmarkButton;
|
||||
wxButton* m_activateButton;
|
||||
wxButton* m_removeButton;
|
||||
wxPanel* m_buttonPanel;
|
||||
wxTimer m_updateTimer;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
@ -67,9 +64,6 @@ class BookmarkPanel : public wxPanel
|
||||
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 onActivate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onRemove( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onUpdateTimer( wxTimerEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
@ -52,6 +52,8 @@ void BookmarkView::updateTheme() {
|
||||
wxColour btn(ThemeMgr::mgr.currentTheme->button);
|
||||
wxColour btnHl(ThemeMgr::mgr.currentTheme->buttonHighlight);
|
||||
|
||||
this->SetBackgroundColour(ThemeMgr::mgr.currentTheme->generalBackground * 4.0);
|
||||
|
||||
m_treeView->SetBackgroundColour(bgColor);
|
||||
m_treeView->SetForegroundColour(textColor);
|
||||
|
||||
@ -65,10 +67,11 @@ void BookmarkView::updateTheme() {
|
||||
m_bandwidthLabel->SetForegroundColour(textColor);
|
||||
m_modulationVal->SetForegroundColour(textColor);
|
||||
m_modulationLabel->SetForegroundColour(textColor);
|
||||
|
||||
m_bookmarkButton->SetBackgroundColour(bgColor);
|
||||
m_removeButton->SetBackgroundColour(bgColor);
|
||||
m_activateButton->SetBackgroundColour(bgColor);
|
||||
|
||||
m_buttonPanel->SetBackgroundColour(bgColor);
|
||||
for (auto p : m_buttonPanel->GetChildren()) {
|
||||
p->SetBackgroundColour(bgColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -243,7 +246,7 @@ void BookmarkView::onMenuItem(wxCommandEvent& event) {
|
||||
wxString stringVal = wxGetTextFromUser("Enter Group Name", "Add Group", "");
|
||||
if (stringVal.ToStdString() != "") {
|
||||
wxGetApp().getBookmarkMgr().getGroup(stringVal.ToStdString());
|
||||
wxGetApp().getBookmarkMgr().updateActiveList();
|
||||
wxGetApp().getBookmarkMgr().updateBookmarks();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -267,9 +270,34 @@ void BookmarkView::hideProps() {
|
||||
m_labelText->Hide();
|
||||
m_labelLabel->Hide();
|
||||
|
||||
m_bookmarkButton->Hide();
|
||||
m_activateButton->Hide();
|
||||
m_removeButton->Hide();
|
||||
m_buttonPanel->Hide();
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::clearButtons() {
|
||||
m_buttonPanel->DestroyChildren();
|
||||
m_buttonPanel->Hide();
|
||||
}
|
||||
|
||||
void BookmarkView::showButtons() {
|
||||
m_buttonPanel->Show();
|
||||
// m_buttonPanel->Layout();
|
||||
m_buttonPanel->GetSizer()->Layout();
|
||||
}
|
||||
|
||||
|
||||
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, NULL, this);
|
||||
nButton->SetBackgroundColour(ThemeMgr::mgr.currentTheme->generalBackground);
|
||||
return nButton;
|
||||
}
|
||||
|
||||
|
||||
wxButton *BookmarkView::addButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler) {
|
||||
wxButton *nButton = makeButton(parent, labelVal, handler);
|
||||
parent->GetSizer()->Add( nButton, 0, wxEXPAND);
|
||||
return nButton;
|
||||
}
|
||||
|
||||
|
||||
@ -286,7 +314,7 @@ void BookmarkView::activeSelection(DemodulatorInstance *dsel) {
|
||||
|
||||
m_frequencyVal->Show();
|
||||
m_frequencyLabel->Show();
|
||||
|
||||
|
||||
m_bandwidthVal->Show();
|
||||
m_bandwidthLabel->Show();
|
||||
|
||||
@ -296,9 +324,13 @@ void BookmarkView::activeSelection(DemodulatorInstance *dsel) {
|
||||
m_labelText->Show();
|
||||
m_labelLabel->Show();
|
||||
|
||||
m_bookmarkButton->Show();
|
||||
m_removeButton->Show();
|
||||
clearButtons();
|
||||
|
||||
addButton(m_buttonPanel, "Bookmark Active", wxCommandEventHandler( BookmarkView::onBookmarkActive ));
|
||||
addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
|
||||
|
||||
showButtons();
|
||||
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
@ -340,10 +372,13 @@ void BookmarkView::bookmarkSelection(BookmarkEntry *bmSel) {
|
||||
m_labelText->Show();
|
||||
m_labelLabel->Show();
|
||||
|
||||
m_activateButton->Show();
|
||||
m_bookmarkButton->Hide();
|
||||
m_removeButton->Show();
|
||||
clearButtons();
|
||||
|
||||
addButton(m_buttonPanel, "Activate Bookmark", wxCommandEventHandler( BookmarkView::onActivateBookmark ));
|
||||
addButton(m_buttonPanel, "Remove Bookmark", wxCommandEventHandler( BookmarkView::onRemoveBookmark ));
|
||||
|
||||
showButtons();
|
||||
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
@ -372,10 +407,13 @@ void BookmarkView::recentSelection(BookmarkEntry *bmSel) {
|
||||
m_labelText->Show();
|
||||
m_labelLabel->Show();
|
||||
|
||||
m_activateButton->Show();
|
||||
m_bookmarkButton->Show();
|
||||
m_removeButton->Hide();
|
||||
clearButtons();
|
||||
|
||||
addButton(m_buttonPanel, "Activate Recent", wxCommandEventHandler( BookmarkView::onActivateRecent ));
|
||||
addButton(m_buttonPanel, "Bookmark Recent", wxCommandEventHandler( BookmarkView::onBookmarkRecent ));
|
||||
|
||||
showButtons();
|
||||
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
@ -384,6 +422,9 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
|
||||
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
|
||||
|
||||
if (!tvi) {
|
||||
m_propPanel->Hide();
|
||||
hideProps();
|
||||
this->Layout();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -431,30 +472,46 @@ void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& event ) {
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::onBookmark( wxCommandEvent& event ) {
|
||||
void BookmarkView::onBookmarkActive( wxCommandEvent& event ) {
|
||||
if (activeSel) {
|
||||
wxGetApp().getBookmarkMgr().addBookmark("Ungrouped", activeSel);
|
||||
wxGetApp().getBookmarkMgr().updateBookmarks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::onActivate( wxCommandEvent& event ) {
|
||||
if (recentSel) {
|
||||
activateBookmark(recentSel);
|
||||
void BookmarkView::onBookmarkRecent( wxCommandEvent& event ) {
|
||||
if (bookmarkSel) {
|
||||
wxGetApp().getBookmarkMgr().removeRecent(bookmarkSel);
|
||||
wxGetApp().getBookmarkMgr().addBookmark("Ungrouped", bookmarkSel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::onRemoveActive( wxCommandEvent& event ) {
|
||||
if (activeSel != nullptr) {
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false);
|
||||
wxGetApp().removeDemodulator(activeSel);
|
||||
wxGetApp().getDemodMgr().deleteThread(activeSel);
|
||||
activeSel = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::onRemoveBookmark( wxCommandEvent& event ) {
|
||||
// todo
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::onActivateBookmark( wxCommandEvent& event ) {
|
||||
if (bookmarkSel) {
|
||||
activateBookmark(bookmarkSel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BookmarkView::onRemove( wxCommandEvent& event ) {
|
||||
if (activeSel != nullptr) {
|
||||
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr, false);
|
||||
wxGetApp().removeDemodulator(activeSel);
|
||||
wxGetApp().getDemodMgr().deleteThread(activeSel);
|
||||
activeSel = nullptr;
|
||||
void BookmarkView::onActivateRecent( wxCommandEvent& event ) {
|
||||
if (recentSel) {
|
||||
activateBookmark(recentSel);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,6 @@ protected:
|
||||
void onLabelText( wxCommandEvent& event );
|
||||
void onDoubleClickFreq( wxMouseEvent& event );
|
||||
void onDoubleClickBandwidth( wxMouseEvent& event );
|
||||
void onBookmark( wxCommandEvent& event );
|
||||
void onActivate( wxCommandEvent& event );
|
||||
void onRemove( wxCommandEvent& event );
|
||||
void onTreeBeginDrag( wxTreeEvent& event );
|
||||
void onTreeEndDrag( wxTreeEvent& event );
|
||||
void onTreeDeleteItem( wxTreeEvent& event );
|
||||
@ -70,6 +67,23 @@ protected:
|
||||
void onEnterWindow( wxMouseEvent& event );
|
||||
void onLeaveWindow( wxMouseEvent& event );
|
||||
|
||||
|
||||
void clearButtons();
|
||||
void showButtons();
|
||||
|
||||
wxButton *makeButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);
|
||||
wxButton *addButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);
|
||||
|
||||
void onBookmarkActive( wxCommandEvent& event );
|
||||
void onBookmarkRecent( wxCommandEvent& event );
|
||||
|
||||
void onRemoveActive( wxCommandEvent& event );
|
||||
void onRemoveBookmark( wxCommandEvent& event );
|
||||
|
||||
void onActivateBookmark( wxCommandEvent& event );
|
||||
void onActivateRecent( wxCommandEvent& event );
|
||||
|
||||
|
||||
std::atomic_bool mouseInView;
|
||||
|
||||
wxTreeItemId rootBranch, activeBranch, bookmarkBranch, recentBranch;
|
||||
|
Loading…
Reference in New Issue
Block a user