From: Steve Brokenshire Date: Fri, 10 Mar 2017 22:20:38 +0000 (+0000) Subject: frmPreferences: Double clicking an account opens the account settings X-Git-Tag: release-0.18~8 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=176323555ae58da5fec1ac843e0c613a0b9dabba;p=xestiaab%2F.git frmPreferences: Double clicking an account opens the account settings --- diff --git a/source/AppXestiaAddrBk.cpp b/source/AppXestiaAddrBk.cpp index ba93145..8ffcff5 100644 --- a/source/AppXestiaAddrBk.cpp +++ b/source/AppXestiaAddrBk.cpp @@ -547,20 +547,35 @@ frmPreferencesADT::frmPreferencesADT( wxWindow* parent, wxWindowID id, const wxS NbtPreferences = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); tabGeneral = new wxPanel( NbtPreferences, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* szrChecks; - szrChecks = new wxBoxSizer( wxVERTICAL ); + wxFlexGridSizer* szrGeneral; + szrGeneral = new wxFlexGridSizer( 2, 2, 0, 0 ); + szrGeneral->AddGrowableCol( 1 ); + szrGeneral->SetFlexibleDirection( wxBOTH ); + szrGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + bmpWindowPosition = new wxStaticBitmap( tabGeneral, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 32,32 ), 0 ); + bmpWindowPosition->SetMinSize( wxSize( 32,32 ) ); + bmpWindowPosition->SetMaxSize( wxSize( 32,32 ) ); + + szrGeneral->Add( bmpWindowPosition, 0, wxALL, 5 ); chkSaveWindowPosition = new wxCheckBox( tabGeneral, wxID_ANY, wxT("Save window position on exit"), wxDefaultPosition, wxDefaultSize, 0 ); - szrChecks->Add( chkSaveWindowPosition, 0, wxALL, 5 ); + szrGeneral->Add( chkSaveWindowPosition, 0, wxALL, 5 ); + + bmpLocalAddressBooks = new wxStaticBitmap( tabGeneral, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 32,32 ), 0 ); + bmpLocalAddressBooks->SetMinSize( wxSize( 32,32 ) ); + bmpLocalAddressBooks->SetMaxSize( wxSize( 32,32 ) ); + + szrGeneral->Add( bmpLocalAddressBooks, 0, wxALL, 5 ); chkHideLocal = new wxCheckBox( tabGeneral, wxID_ANY, wxT("Hide local address books"), wxDefaultPosition, wxDefaultSize, 0 ); - szrChecks->Add( chkHideLocal, 0, wxALL, 5 ); + szrGeneral->Add( chkHideLocal, 0, wxALL, 5 ); - tabGeneral->SetSizer( szrChecks ); + tabGeneral->SetSizer( szrGeneral ); tabGeneral->Layout(); - szrChecks->Fit( tabGeneral ); - NbtPreferences->AddPage( tabGeneral, wxT("General"), true ); + szrGeneral->Fit( tabGeneral ); + NbtPreferences->AddPage( tabGeneral, wxT("General"), false ); tabTheme = new wxPanel( NbtPreferences, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); tabTheme->Hide(); @@ -636,7 +651,7 @@ frmPreferencesADT::frmPreferencesADT( wxWindow* parent, wxWindowID id, const wxS tabAccounts->SetSizer( szrAccounts ); tabAccounts->Layout(); szrAccounts->Fit( tabAccounts ); - NbtPreferences->AddPage( tabAccounts, wxT("Accounts"), false ); + NbtPreferences->AddPage( tabAccounts, wxT("Accounts"), true ); szrTabs->Add( NbtPreferences, 1, wxALL|wxEXPAND, 5 ); @@ -678,6 +693,7 @@ frmPreferencesADT::frmPreferencesADT( wxWindow* parent, wxWindowID id, const wxS btnThemeAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::AddABAccount ), NULL, this ); btnThemeModify->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::ModifyABAccount ), NULL, this ); btnThemeDelete->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::DeleteABAccount ), NULL, this ); + lstAccounts->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( frmPreferencesADT::ModifyABAccount ), NULL, this ); lstAccounts->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( frmPreferencesADT::DisableABButtons ), NULL, this ); lstAccounts->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( frmPreferencesADT::EnableABButtons ), NULL, this ); btnAccountAdd->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::AddABAccount ), NULL, this ); @@ -696,6 +712,7 @@ frmPreferencesADT::~frmPreferencesADT() btnThemeAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::AddABAccount ), NULL, this ); btnThemeModify->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::ModifyABAccount ), NULL, this ); btnThemeDelete->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::DeleteABAccount ), NULL, this ); + lstAccounts->Disconnect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( frmPreferencesADT::ModifyABAccount ), NULL, this ); lstAccounts->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( frmPreferencesADT::DisableABButtons ), NULL, this ); lstAccounts->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( frmPreferencesADT::EnableABButtons ), NULL, this ); btnAccountAdd->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmPreferencesADT::AddABAccount ), NULL, this ); diff --git a/source/AppXestiaAddrBk.h b/source/AppXestiaAddrBk.h index cc1cb1e..753f748 100644 --- a/source/AppXestiaAddrBk.h +++ b/source/AppXestiaAddrBk.h @@ -254,7 +254,9 @@ class frmPreferencesADT : public wxDialog protected: wxNotebook* NbtPreferences; wxPanel* tabGeneral; + wxStaticBitmap* bmpWindowPosition; wxCheckBox* chkSaveWindowPosition; + wxStaticBitmap* bmpLocalAddressBooks; wxCheckBox* chkHideLocal; wxPanel* tabTheme; wxListCtrl* lstThemes; @@ -276,6 +278,7 @@ class frmPreferencesADT : public wxDialog virtual void AddABAccount( wxCommandEvent& event ) { event.Skip(); } virtual void ModifyABAccount( wxCommandEvent& event ) { event.Skip(); } virtual void DeleteABAccount( wxCommandEvent& event ) { event.Skip(); } + virtual void ModifyABAccount( wxMouseEvent& event ) { event.Skip(); } virtual void SavePreferences( wxCommandEvent& event ) { event.Skip(); } virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); } diff --git a/source/frmPreferences.cpp b/source/frmPreferences.cpp index 2b2f481..03bcd5e 100644 --- a/source/frmPreferences.cpp +++ b/source/frmPreferences.cpp @@ -145,14 +145,22 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event ) wxString AccName; wxString AccType; - wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename); + // Check if an account has been selected before continuing. - // Get the account name. - lstAccountsIndex = lstAccounts->GetNextItem(lstAccountsIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); + if (lstAccountsIndex == -1){ + + // No account has been selected so exit this subroutine. + + return; + + } + + wxFileConfig *cfgfile = new wxFileConfig("", "", AccFilename); + // Check that the account type is a supported account type. AccType = preferences->accounts.GetAccountType((int)lstAccountsIndex); @@ -164,6 +172,8 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event ) return; } + + // Get the account name. AccName = preferences->accounts.GetAccountName((int)lstAccountsIndex); @@ -192,6 +202,14 @@ void frmPreferences::ModifyABAccount( wxCommandEvent& event ) } +void frmPreferences::ModifyABAccount( wxMouseEvent& event ) +{ + + wxCommandEvent NullEvent; + ModifyABAccount(NullEvent); + +} + void frmPreferences::DeleteABAccount( wxCommandEvent& event ) { // Display a confirmation dialog to confirm deletion. diff --git a/source/frmPreferences.h b/source/frmPreferences.h index 7f7c37d..154a946 100644 --- a/source/frmPreferences.h +++ b/source/frmPreferences.h @@ -38,6 +38,7 @@ class frmPreferences : public frmPreferencesADT void DisableABButtons( wxListEvent& event ); void DeleteABAccount( wxCommandEvent& event ); void ModifyABAccount( wxCommandEvent& event ); + void ModifyABAccount( wxMouseEvent& event ); void SavePreferences( wxCommandEvent &event ); void AddABAccount( wxCommandEvent &event ); void CloseWindow( wxCommandEvent &event );