From dcdacb0cf7eec6a62d82be20c3ec16edbeac85ea Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 13 May 2019 20:52:36 -0400 Subject: [PATCH] Bookmark refreshing, port selection and device selector UI fixes --- src/AppFrame.cpp | 7 +- src/AppFrame.h | 1 + src/CubicSDR.cpp | 7 +- src/forms/Bookmark/BookmarkPanel.cpp | 65 +-- src/forms/Bookmark/BookmarkPanel.fbp | 518 +++----------------- src/forms/Bookmark/BookmarkPanel.h | 24 +- src/forms/Bookmark/BookmarkView.cpp | 15 +- src/forms/Dialog/PortSelectorDialog.cpp | 18 +- src/forms/Dialog/PortSelectorDialog.fbp | 1 + src/forms/Dialog/PortSelectorDialog.h | 1 + src/forms/Dialog/PortSelectorDialogBase.cpp | 2 + src/forms/Dialog/PortSelectorDialogBase.h | 1 + src/forms/SDRDevices/SDRDevices.cpp | 2 +- src/forms/SDRDevices/SDRDevices.h | 2 +- 14 files changed, 159 insertions(+), 505 deletions(-) diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index 4051537..90a10c8 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -501,8 +501,9 @@ wxMenu *AppFrame::makeRigMenu() { rigFollowModemMenuItem = pMenu->AppendCheckItem(wxID_RIG_FOLLOW_MODEM, wxT("Track Modem")); rigFollowModemMenuItem->Check(wxGetApp().getConfig()->getRigFollowModem()); - auto *rigModelMenu = new wxMenu; + rigModelMenu = new wxMenu; RigList &rl = RigThread::enumerate(); + numRigs = rl.size(); std::map mfgCount; std::map mfgMenu; @@ -1863,7 +1864,9 @@ bool AppFrame::actionOnMenuRig(wxCommandEvent &event) { bManaged = true; for (auto ri : rigModelMenuItems) { - ri.second->Check(false); + if (ri.second->IsChecked()) { + ri.second->Check(false); + } } rigModelMenuItems[rigModel]->Check(true); diff --git a/src/AppFrame.h b/src/AppFrame.h index 5270bd2..b2c7c95 100644 --- a/src/AppFrame.h +++ b/src/AppFrame.h @@ -296,6 +296,7 @@ private: std::map rigSerialMenuItems; std::map rigModelMenuItems; + wxMenu *rigModelMenu; int rigModel; int rigSerialRate; long long rigSDRIF; diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index 789f436..27dd3ca 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -589,7 +589,12 @@ void CubicSDR::deviceSelector() { return; } deviceSelectorOpen.store(true); - deviceSelectorDialog = new SDRDevicesDialog(appframe); + wxRect *winRect = getConfig()->getWindow(); + wxPoint pos(wxDefaultPosition); + if (winRect != nullptr) { + pos = wxPoint(winRect->x, winRect->y); + } + deviceSelectorDialog = new SDRDevicesDialog(appframe, pos); deviceSelectorDialog->Show(); } diff --git a/src/forms/Bookmark/BookmarkPanel.cpp b/src/forms/Bookmark/BookmarkPanel.cpp index 8c649ce..bbe874a 100644 --- a/src/forms/Bookmark/BookmarkPanel.cpp +++ b/src/forms/Bookmark/BookmarkPanel.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 8 2018) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -13,75 +13,78 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po { wxBoxSizer* bSizer1; bSizer1 = new wxBoxSizer( wxVERTICAL ); - + m_searchText = new wxTextCtrl( this, wxID_ANY, wxT("Search.."), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); bSizer1->Add( m_searchText, 0, wxALL|wxEXPAND, 5 ); - + m_clearSearchButton = new wxButton( this, wxID_ANY, wxT("Clear Search"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer1->Add( m_clearSearchButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - + bSizer1->Add( m_clearSearchButton, 0, wxALL|wxEXPAND, 5 ); + m_treeView = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_HAS_VARIABLE_ROW_HEIGHT|wxTR_HIDE_ROOT|wxTR_SINGLE ); bSizer1->Add( m_treeView, 1, wxEXPAND, 5 ); - + + m_propPanelDivider = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer1->Add( m_propPanelDivider, 0, wxEXPAND, 5 ); + m_propPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxFlexGridSizer* fgPropSizer; fgPropSizer = new wxFlexGridSizer( 0, 2, 0, 0 ); fgPropSizer->AddGrowableCol( 1 ); fgPropSizer->SetFlexibleDirection( wxBOTH ); fgPropSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + 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 ); - + fgPropSizer->Add( m_labelLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + m_labelText = new wxTextCtrl( m_propPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); fgPropSizer->Add( m_labelText, 0, wxALL|wxEXPAND, 5 ); - + m_frequencyLabel = new wxStaticText( m_propPanel, wxID_ANY, wxT("Freq"), wxDefaultPosition, wxDefaultSize, 0 ); m_frequencyLabel->Wrap( -1 ); - fgPropSizer->Add( m_frequencyLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - + fgPropSizer->Add( m_frequencyLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); + m_frequencyVal = new wxStaticText( m_propPanel, wxID_ANY, wxT("FrequencyVal"), wxDefaultPosition, wxDefaultSize, 0 ); m_frequencyVal->Wrap( -1 ); - fgPropSizer->Add( m_frequencyVal, 0, wxALL, 5 ); - + fgPropSizer->Add( m_frequencyVal, 0, wxALL|wxEXPAND, 5 ); + m_bandwidthLabel = new wxStaticText( m_propPanel, wxID_ANY, wxT("BW"), wxDefaultPosition, wxDefaultSize, 0 ); m_bandwidthLabel->Wrap( -1 ); - fgPropSizer->Add( m_bandwidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - + fgPropSizer->Add( m_bandwidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 ); + m_bandwidthVal = new wxStaticText( m_propPanel, wxID_ANY, wxT("BandwidthVal"), wxDefaultPosition, wxDefaultSize, 0 ); m_bandwidthVal->Wrap( -1 ); - fgPropSizer->Add( m_bandwidthVal, 0, wxALL, 5 ); - + fgPropSizer->Add( m_bandwidthVal, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); + m_modulationLabel = new wxStaticText( m_propPanel, wxID_ANY, wxT("Type"), wxDefaultPosition, wxDefaultSize, 0 ); m_modulationLabel->Wrap( -1 ); - fgPropSizer->Add( m_modulationLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); - + fgPropSizer->Add( m_modulationLabel, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|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 ); - - + fgPropSizer->Add( m_modulationVal, 0, wxALL|wxEXPAND, 5 ); + + m_propPanel->SetSizer( fgPropSizer ); m_propPanel->Layout(); fgPropSizer->Fit( m_propPanel ); - bSizer1->Add( m_propPanel, 0, wxALL|wxBOTTOM|wxEXPAND|wxTOP, 5 ); - + bSizer1->Add( m_propPanel, 0, wxALL|wxEXPAND, 5 ); + m_buttonPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* m_buttonPanelSizer; m_buttonPanelSizer = new wxBoxSizer( wxVERTICAL ); - - + + m_buttonPanel->SetSizer( m_buttonPanelSizer ); m_buttonPanel->Layout(); m_buttonPanelSizer->Fit( m_buttonPanel ); bSizer1->Add( m_buttonPanel, 0, wxALL|wxEXPAND, 5 ); - - + + this->SetSizer( bSizer1 ); this->Layout(); m_updateTimer.SetOwner( this, wxID_ANY ); - + // Connect Events this->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( BookmarkPanel::onEnterWindow ) ); this->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BookmarkPanel::onLeaveWindow ) ); @@ -132,5 +135,5 @@ BookmarkPanel::~BookmarkPanel() m_frequencyVal->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickFreq ), NULL, this ); m_bandwidthVal->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( BookmarkPanel::onDoubleClickBandwidth ), NULL, this ); this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( BookmarkPanel::onUpdateTimer ) ); - + } diff --git a/src/forms/Bookmark/BookmarkPanel.fbp b/src/forms/Bookmark/BookmarkPanel.fbp index 4538c02..de4f8f6 100644 --- a/src/forms/Bookmark/BookmarkPanel.fbp +++ b/src/forms/Bookmark/BookmarkPanel.fbp @@ -1,6 +1,6 @@ - + C++ @@ -49,43 +49,9 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - onEnterWindow - - - - - onLeaveWindow - - - - - - onMotion - - - - - - - - - bSizer1 @@ -153,45 +119,13 @@ - - - - - - - - - - - - - - - onSearchTextFocus - - - - - - - - - - - - - onSearchText - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + wxALL|wxEXPAND 0 1 @@ -259,37 +193,7 @@ - - - - - - onClearSearch - - - - - - - - - - - - - - - - - - - - - - - - @@ -348,62 +252,81 @@ - - - - - - - - onEnterWindow - - - - onLeaveWindow - - - - - - onMotion - - - - - - - - onTreeBeginDrag - - - onTreeEndDrag - - onTreeActivate onTreeCollapse - onTreeExpanded - onTreeItemGetTooltip onTreeItemMenu - - - onTreeSelect onTreeSelectChanging - - - 5 - wxALL|wxBOTTOM|wxEXPAND|wxTOP + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_propPanelDivider + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + + + 5 + wxALL|wxEXPAND 0 1 @@ -456,37 +379,7 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 2 wxBOTH 1 @@ -500,7 +393,7 @@ 0 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -557,36 +450,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -651,45 +514,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - onLabelText - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -746,41 +576,11 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -837,41 +637,12 @@ -1 - - - - - - - - - - - - - - onDoubleClickFreq - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT 0 1 @@ -928,41 +699,11 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL + wxEXPAND|wxLEFT|wxRIGHT 0 1 @@ -1019,41 +760,12 @@ -1 - - - - - - - - - - - - - - onDoubleClickBandwidth - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -1110,41 +822,11 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -1201,36 +883,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1291,37 +943,7 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + m_buttonPanelSizer wxVERTICAL diff --git a/src/forms/Bookmark/BookmarkPanel.h b/src/forms/Bookmark/BookmarkPanel.h index 4dcca81..235f63e 100644 --- a/src/forms/Bookmark/BookmarkPanel.h +++ b/src/forms/Bookmark/BookmarkPanel.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 8 2018) +// C++ code generated with wxFormBuilder (version Oct 26 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __BOOKMARKPANEL_H__ -#define __BOOKMARKPANEL_H__ +#pragma once #include #include @@ -21,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -32,14 +32,15 @@ /////////////////////////////////////////////////////////////////////////////// /// Class BookmarkPanel /////////////////////////////////////////////////////////////////////////////// -class BookmarkPanel : public wxPanel +class BookmarkPanel : public wxPanel { private: - + protected: wxTextCtrl* m_searchText; wxButton* m_clearSearchButton; wxTreeCtrl* m_treeView; + wxStaticLine* m_propPanelDivider; wxPanel* m_propPanel; wxStaticText* m_labelLabel; wxTextCtrl* m_labelText; @@ -51,7 +52,7 @@ class BookmarkPanel : public wxPanel wxStaticText* m_modulationVal; wxPanel* m_buttonPanel; wxTimer m_updateTimer; - + // Virtual event handlers, overide them in your derived class virtual void onEnterWindow( wxMouseEvent& event ) { event.Skip(); } virtual void onLeaveWindow( wxMouseEvent& event ) { event.Skip(); } @@ -72,13 +73,12 @@ class BookmarkPanel : public wxPanel virtual void onDoubleClickFreq( wxMouseEvent& event ) { event.Skip(); } virtual void onDoubleClickBandwidth( wxMouseEvent& event ) { event.Skip(); } virtual void onUpdateTimer( wxTimerEvent& event ) { event.Skip(); } - - + + public: - - BookmarkPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 169,471 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + BookmarkPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 169,471 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~BookmarkPanel(); - + }; -#endif //__BOOKMARKPANEL_H__ diff --git a/src/forms/Bookmark/BookmarkView.cpp b/src/forms/Bookmark/BookmarkView.cpp index f9fba3f..4b2d8ab 100644 --- a/src/forms/Bookmark/BookmarkView.cpp +++ b/src/forms/Bookmark/BookmarkView.cpp @@ -25,7 +25,7 @@ #define BOOKMARK_VIEW_STR_RENAME_GROUP "Rename Group" -BookmarkViewVisualDragItem::BookmarkViewVisualDragItem(wxString labelValue) : wxDialog(NULL, wxID_ANY, L"", wxPoint(20,20), wxSize(-1,-1), wxSTAY_ON_TOP | wxALL ) { +BookmarkViewVisualDragItem::BookmarkViewVisualDragItem(wxString labelValue) : wxDialog(NULL, wxID_ANY, L"", wxPoint(20,20), wxSize(-1,-1), wxFRAME_TOOL_WINDOW | wxNO_BORDER | wxSTAY_ON_TOP | wxALL ) { wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL); wxStaticText *label = new wxStaticText( this, wxID_ANY, labelValue, wxDefaultPosition, wxDefaultSize, wxEXPAND ); @@ -403,7 +403,6 @@ void BookmarkView::doUpdateActiveList() { if (nextDemod != nullptr && nextDemod == demod_i) { selItem = itm; - wxGetApp().getDemodMgr().setActiveDemodulator(nextDemod, false); nextDemod = nullptr; } else if (!selItem && activeExpandState && lastActiveDemodulator && lastActiveDemodulator == demod_i) { selItem = itm; @@ -528,6 +527,7 @@ void BookmarkView::onTreeActivate( wxTreeEvent& event ) { if (!tvi->demod->isActive()) { wxGetApp().setFrequency(tvi->demod->getFrequency()); nextDemod = tvi->demod; + wxGetApp().getDemodMgr().setActiveDemodulator(nextDemod, false); } } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) { @@ -659,13 +659,15 @@ void BookmarkView::hideProps() { m_labelText->Hide(); m_labelLabel->Hide(); - + + m_propPanelDivider->Hide(); m_propPanel->Hide(); m_buttonPanel->Hide(); } void BookmarkView::showProps() { + m_propPanelDivider->Show(); m_propPanel->Show(); m_propPanel->GetSizer()->Layout(); } @@ -886,8 +888,9 @@ void BookmarkView::activateBookmark(BookmarkEntryPtr bmEnt) { } nextDemod = matchingDemod; - - wxGetApp().getBookmarkMgr().updateActiveList(); + wxGetApp().getDemodMgr().setActiveDemodulator(nextDemod, false); + + //wxGetApp().getBookmarkMgr().updateActiveList(); } @@ -1504,7 +1507,7 @@ void BookmarkView::onMotion( wxMouseEvent& event ) { wxPoint pos = ClientToScreen(event.GetPosition()); - pos += wxPoint(30,-10); + pos += wxPoint(15,-5); if (visualDragItem != nullptr) { visualDragItem->SetPosition(pos); diff --git a/src/forms/Dialog/PortSelectorDialog.cpp b/src/forms/Dialog/PortSelectorDialog.cpp index 73cad81..2642110 100644 --- a/src/forms/Dialog/PortSelectorDialog.cpp +++ b/src/forms/Dialog/PortSelectorDialog.cpp @@ -7,13 +7,20 @@ PortSelectorDialog::PortSelectorDialog( wxWindow* parent, wxWindowID id, std::st comEnumerate(); int nPorts = comGetNoPorts(); - + + if (!defaultPort.empty()) { + m_portList->Append(defaultPort); + } + for (int i = 0; i < nPorts; i++) { #ifdef WIN32 - m_portList->Append(comGetPortName(i)); + string portName(comGetPortName(i)); #else - m_portList->Append(comGetInternalName(i)); + string portName(comGetInternalName(i)); #endif + if (portName != defaultPort) { + m_portList->Append(portName); + } } comTerminate(); @@ -37,3 +44,8 @@ void PortSelectorDialog::onCancelButton( wxCommandEvent& /* event */ ) { void PortSelectorDialog::onOKButton( wxCommandEvent& /* event */ ) { wxGetApp().getAppFrame()->setRigControlPort(m_portSelection->GetValue().ToStdString()); } + + +void PortSelectorDialog::onClose(wxCloseEvent & /* event */) { + wxGetApp().getAppFrame()->dismissRigControlPortDialog(); +} diff --git a/src/forms/Dialog/PortSelectorDialog.fbp b/src/forms/Dialog/PortSelectorDialog.fbp index 19f26a4..f99a3e1 100644 --- a/src/forms/Dialog/PortSelectorDialog.fbp +++ b/src/forms/Dialog/PortSelectorDialog.fbp @@ -53,6 +53,7 @@ + onClose dlgSizer diff --git a/src/forms/Dialog/PortSelectorDialog.h b/src/forms/Dialog/PortSelectorDialog.h index 92687d1..8e18606 100644 --- a/src/forms/Dialog/PortSelectorDialog.h +++ b/src/forms/Dialog/PortSelectorDialog.h @@ -8,4 +8,5 @@ protected: void onListSelect( wxCommandEvent& event ); void onCancelButton( wxCommandEvent& event ); void onOKButton( wxCommandEvent& event ); + void onClose( wxCloseEvent& event ); }; diff --git a/src/forms/Dialog/PortSelectorDialogBase.cpp b/src/forms/Dialog/PortSelectorDialogBase.cpp index ac63ada..f7e24b2 100644 --- a/src/forms/Dialog/PortSelectorDialogBase.cpp +++ b/src/forms/Dialog/PortSelectorDialogBase.cpp @@ -59,6 +59,7 @@ PortSelectorDialogBase::PortSelectorDialogBase( wxWindow* parent, wxWindowID id, this->Centre( wxBOTH ); // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PortSelectorDialogBase::onClose ) ); m_portList->Connect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( PortSelectorDialogBase::onListSelect ), NULL, this ); m_cancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PortSelectorDialogBase::onCancelButton ), NULL, this ); m_okButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PortSelectorDialogBase::onOKButton ), NULL, this ); @@ -67,6 +68,7 @@ PortSelectorDialogBase::PortSelectorDialogBase( wxWindow* parent, wxWindowID id, PortSelectorDialogBase::~PortSelectorDialogBase() { // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PortSelectorDialogBase::onClose ) ); m_portList->Disconnect( wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler( PortSelectorDialogBase::onListSelect ), NULL, this ); m_cancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PortSelectorDialogBase::onCancelButton ), NULL, this ); m_okButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PortSelectorDialogBase::onOKButton ), NULL, this ); diff --git a/src/forms/Dialog/PortSelectorDialogBase.h b/src/forms/Dialog/PortSelectorDialogBase.h index 4841b7d..2c9df81 100644 --- a/src/forms/Dialog/PortSelectorDialogBase.h +++ b/src/forms/Dialog/PortSelectorDialogBase.h @@ -43,6 +43,7 @@ class PortSelectorDialogBase : public wxDialog wxButton* m_okButton; // Virtual event handlers, overide them in your derived class + virtual void onClose( wxCloseEvent& event ) { event.Skip(); } virtual void onListSelect( wxCommandEvent& event ) { event.Skip(); } virtual void onCancelButton( wxCommandEvent& event ) { event.Skip(); } virtual void onOKButton( wxCommandEvent& event ) { event.Skip(); } diff --git a/src/forms/SDRDevices/SDRDevices.cpp b/src/forms/SDRDevices/SDRDevices.cpp index 92efc26..1ad0068 100644 --- a/src/forms/SDRDevices/SDRDevices.cpp +++ b/src/forms/SDRDevices/SDRDevices.cpp @@ -14,7 +14,7 @@ #include "CubicSDR.xpm" #endif -SDRDevicesDialog::SDRDevicesDialog( wxWindow* parent ): devFrame( parent, wxID_ANY, wxT(CUBICSDR_INSTALL_NAME " :: SDR Devices")) { +SDRDevicesDialog::SDRDevicesDialog( wxWindow* parent, const wxPoint &pos): devFrame( parent, wxID_ANY, wxT(CUBICSDR_INSTALL_NAME " :: SDR Devices"), pos) { refresh = true; failed = false; m_refreshButton->Disable(); diff --git a/src/forms/SDRDevices/SDRDevices.h b/src/forms/SDRDevices/SDRDevices.h index 5349868..d0d4174 100644 --- a/src/forms/SDRDevices/SDRDevices.h +++ b/src/forms/SDRDevices/SDRDevices.h @@ -13,7 +13,7 @@ class SDRDevicesDialog: public devFrame { public: - SDRDevicesDialog( wxWindow* parent ); + SDRDevicesDialog( wxWindow* parent, const wxPoint &wxPos = wxDefaultPosition); void OnClose( wxCloseEvent& event ); void OnDeleteItem( wxTreeEvent& event );