From: Steve Brokenshire Date: Mon, 28 Aug 2017 17:25:28 +0000 (+0100) Subject: frmContactEditorNickname: Implemented priority control X-Git-Tag: release-0.20~36 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=1e038086c27e3da18da6ebfa1bb3d3acf5d0f0d7;p=xestiaab%2F.git frmContactEditorNickname: Implemented priority control --- diff --git a/source/AppXestiaAddrBk.cpp b/source/AppXestiaAddrBk.cpp index 3e55af5..47e88df 100644 --- a/source/AppXestiaAddrBk.cpp +++ b/source/AppXestiaAddrBk.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 13 2016) +// C++ code generated with wxFormBuilder (version Dec 21 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -4243,71 +4243,26 @@ frmContactEditorNicknameADT::frmContactEditorNicknameADT( wxWindow* parent, wxWi nbkAddress = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); tabGeneral = new wxPanel( nbkAddress, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxFlexGridSizer* fgSizer6; - fgSizer6 = new wxFlexGridSizer( 0, 2, 0, 0 ); - fgSizer6->AddGrowableCol( 1 ); - fgSizer6->SetFlexibleDirection( wxVERTICAL ); - fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + szrGeneral = new wxFlexGridSizer( 2, 2, 0, 0 ); + szrGeneral->AddGrowableCol( 1 ); + szrGeneral->SetFlexibleDirection( wxBOTH ); + szrGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); lblNickname = new wxStaticText( tabGeneral, wxID_ANY, wxT("Nickname:"), wxDefaultPosition, wxDefaultSize, 0 ); lblNickname->Wrap( -1 ); - fgSizer6->Add( lblNickname, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + szrGeneral->Add( lblNickname, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); txtNickname = new wxTextCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizer6->Add( txtNickname, 0, wxALL|wxEXPAND, 5 ); + szrGeneral->Add( txtNickname, 0, wxALL|wxEXPAND, 5 ); lblPriority = new wxStaticText( tabGeneral, wxID_ANY, wxT("Priority:"), wxDefaultPosition, wxDefaultSize, 0 ); lblPriority->Wrap( -1 ); - fgSizer6->Add( lblPriority, 0, wxALL, 5 ); - - wxBoxSizer* bSizer260; - bSizer260 = new wxBoxSizer( wxHORIZONTAL ); - - chkUsePref = new wxCheckBox( tabGeneral, wxID_ANY, wxT("Use"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer260->Add( chkUsePref, 0, wxALL, 5 ); - - wxBoxSizer* bSizer254; - bSizer254 = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bSizer256; - bSizer256 = new wxBoxSizer( wxHORIZONTAL ); - - sliPriority = new wxSlider( tabGeneral, wxID_ANY, 0, 1, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS ); - bSizer256->Add( sliPriority, 1, wxALL|wxEXPAND, 5 ); - - - bSizer254->Add( bSizer256, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizer255; - bSizer255 = new wxBoxSizer( wxHORIZONTAL ); - - lblHigh = new wxStaticText( tabGeneral, wxID_ANY, wxT("High"), wxDefaultPosition, wxDefaultSize, 0 ); - lblHigh->Wrap( -1 ); - bSizer255->Add( lblHigh, 0, wxALIGN_LEFT|wxALL, 5 ); + szrGeneral->Add( lblPriority, 0, wxALL, 5 ); - bSizer255->Add( 0, 0, 1, wxEXPAND, 5 ); - - lblLow = new wxStaticText( tabGeneral, wxID_ANY, wxT("Low"), wxDefaultPosition, wxDefaultSize, 0 ); - lblLow->Wrap( -1 ); - bSizer255->Add( lblLow, 0, wxALIGN_RIGHT|wxALL, 5 ); - - - bSizer254->Add( bSizer255, 1, wxEXPAND, 0 ); - - - bSizer260->Add( bSizer254, 1, wxEXPAND, 5 ); - - - fgSizer6->Add( bSizer260, 1, wxEXPAND, 5 ); - - - fgSizer6->Add( 0, 0, 1, wxEXPAND, 5 ); - - - tabGeneral->SetSizer( fgSizer6 ); + tabGeneral->SetSizer( szrGeneral ); tabGeneral->Layout(); - fgSizer6->Fit( tabGeneral ); + szrGeneral->Fit( tabGeneral ); nbkAddress->AddPage( tabGeneral, wxT("General"), true ); tabOther = new wxPanel( nbkAddress, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxFlexGridSizer* fgSizer61; @@ -4351,7 +4306,6 @@ frmContactEditorNicknameADT::frmContactEditorNicknameADT( wxWindow* parent, wxWi // Connect Events this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( frmContactEditorNicknameADT::InitAddressEditor ) ); - chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorNicknameADT::EnablePriority ), NULL, this ); btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNicknameADT::ProcessData ), NULL, this ); btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNicknameADT::CloseWindow ), NULL, this ); } @@ -4360,7 +4314,6 @@ frmContactEditorNicknameADT::~frmContactEditorNicknameADT() { // Disconnect Events this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( frmContactEditorNicknameADT::InitAddressEditor ) ); - chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorNicknameADT::EnablePriority ), NULL, this ); btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNicknameADT::ProcessData ), NULL, this ); btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNicknameADT::CloseWindow ), NULL, this ); diff --git a/source/AppXestiaAddrBk.h b/source/AppXestiaAddrBk.h index 2d8c1e1..c20329d 100644 --- a/source/AppXestiaAddrBk.h +++ b/source/AppXestiaAddrBk.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 13 2016) +// C++ code generated with wxFormBuilder (version Dec 21 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -1027,13 +1027,10 @@ class frmContactEditorNicknameADT : public wxDialog protected: wxNotebook* nbkAddress; wxPanel* tabGeneral; + wxFlexGridSizer* szrGeneral; wxStaticText* lblNickname; wxTextCtrl* txtNickname; wxStaticText* lblPriority; - wxCheckBox* chkUsePref; - wxSlider* sliPriority; - wxStaticText* lblHigh; - wxStaticText* lblLow; wxPanel* tabOther; wxStaticText* lblLanguage; wxComboBox* cmbLanguage; @@ -1042,7 +1039,6 @@ class frmContactEditorNicknameADT : public wxDialog // Virtual event handlers, overide them in your derived class virtual void InitAddressEditor( wxInitDialogEvent& event ) { event.Skip(); } - virtual void EnablePriority( wxCommandEvent& event ) { event.Skip(); } virtual void ProcessData( wxCommandEvent& event ) { event.Skip(); } virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); } diff --git a/source/contacteditor/frmContactEditorNickname.cpp b/source/contacteditor/frmContactEditorNickname.cpp index c67302c..68e64ef 100644 --- a/source/contacteditor/frmContactEditorNickname.cpp +++ b/source/contacteditor/frmContactEditorNickname.cpp @@ -35,6 +35,9 @@ frmContactEditorNicknameADT( parent ) cmbLanguage->Append(LanguageList); + priorityCtrl = new XABPriorityCtrl(tabGeneral); + szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5); + } void frmContactEditorNickname::InitAddressEditor( wxInitDialogEvent& event ) @@ -42,19 +45,6 @@ void frmContactEditorNickname::InitAddressEditor( wxInitDialogEvent& event ) // Do nothing with this subroutine for the time being. } -void frmContactEditorNickname::EnablePriority( wxCommandEvent& event ) -{ - - // Enable/disable the priority. - - if (chkUsePref->IsChecked()){ - sliPriority->Enable(); - } else { - sliPriority->Disable(); - } - -} - void frmContactEditorNickname::ProcessData( wxCommandEvent& event ) { @@ -94,15 +84,15 @@ void frmContactEditorNickname::ProcessData( wxCommandEvent& event ) // Add nickname priority. - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - NicknamesListPrefPtr->insert(std::make_pair(NicknamesListIndex, sliPriority->GetValue())); + NicknamesListPrefPtr->insert(std::make_pair(NicknamesListIndex, priorityCtrl->GetValue())); } else { NicknamesListPrefPtr->insert(std::make_pair(NicknamesListIndex, 0)); - } + } // Add the data to the form. @@ -113,9 +103,9 @@ void frmContactEditorNickname::ProcessData( wxCommandEvent& event ) coldata.SetText(txtNickname->GetValue()); ListCtrlIndex = NicknamesListCtrlPtr->InsertItem(coldata); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - NicknamesListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), sliPriority->GetValue())); + NicknamesListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue())); } @@ -134,9 +124,9 @@ void frmContactEditorNickname::ProcessData( wxCommandEvent& event ) NicknamesListPrefPtr->erase(NicknamesListIndex); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - NicknamesListPrefPtr->insert(std::make_pair(NicknamesListIndex, sliPriority->GetValue())); + NicknamesListPrefPtr->insert(std::make_pair(NicknamesListIndex, priorityCtrl->GetValue())); } else { @@ -157,15 +147,15 @@ void frmContactEditorNickname::ProcessData( wxCommandEvent& event ) NicknamesListCtrlPtr->SetItem(longSelected, 0, txtNickname->GetValue()); - if (chkUsePref->IsChecked()){ + if (priorityCtrl->IsPriorityChecked()){ - NicknamesListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), sliPriority->GetValue())); + NicknamesListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue())); } else { NicknamesListCtrlPtr->SetItem(longSelected, 1, wxT("")); - } + } this->Close(); @@ -238,9 +228,8 @@ void frmContactEditorNickname::SetEditorMode(bool EditMode, SectionType SectType if (intiter->first == NicknamesListIndex && intiter->second > 0 && intiter != NicknamesListPrefPtr->end()){ - sliPriority->SetValue(intiter->second); - sliPriority->Enable(); - chkUsePref->SetValue(TRUE); + priorityCtrl->SetValue(intiter->second); + priorityCtrl->EnablePriority(true); } diff --git a/source/contacteditor/frmContactEditorNickname.h b/source/contacteditor/frmContactEditorNickname.h index e14699c..e40663e 100644 --- a/source/contacteditor/frmContactEditorNickname.h +++ b/source/contacteditor/frmContactEditorNickname.h @@ -30,6 +30,7 @@ Subclass of frmContactEditorNicknameADT, which is generated by wxFormBuilder. #include "../enums.h" #include "../common/textprocessing.h" #include "../common/languages.h" +#include "../widgets/XABPriorityCtrl.h" //// end generated include @@ -39,7 +40,6 @@ class frmContactEditorNickname : public frmContactEditorNicknameADT protected: // Handlers for frmContactEditorNicknameADT events. void InitAddressEditor( wxInitDialogEvent& event ); - void EnablePriority( wxCommandEvent& event ); void ProcessData( wxCommandEvent& event ); void CloseWindow( wxCommandEvent& event ); public: @@ -68,6 +68,7 @@ class frmContactEditorNickname : public frmContactEditorNicknameADT wxListCtrl *NicknamesListCtrlPtr; int NicknamesListIndex; SectionType EditSectionType; + XABPriorityCtrl *priorityCtrl = nullptr; };