Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorNotes: Implemented priority control
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 29 Aug 2017 18:31:52 +0000 (19:31 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 29 Aug 2017 18:31:52 +0000 (19:31 +0100)
source/AppXestiaAddrBk.cpp
source/AppXestiaAddrBk.h
source/contacteditor/frmContactEditorNotes.cpp
source/contacteditor/frmContactEditorNotes.h

index 7a61397..33b689a 100644 (file)
@@ -4543,67 +4543,17 @@ frmContactEditorNotesADT::frmContactEditorNotesADT( wxWindow* parent, wxWindowID
        tabGeneral->SetSizer( bSizer353 );
        tabGeneral->Layout();
        bSizer353->Fit( tabGeneral );
-       nbkNotes->AddPage( tabGeneral, wxT("General"), true );
+       nbkNotes->AddPage( tabGeneral, wxT("General"), false );
        tabPriority = new wxPanel( nbkNotes, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
-       wxFlexGridSizer* fgSizer61;
-       fgSizer61 = new wxFlexGridSizer( 0, 2, 0, 0 );
-       fgSizer61->AddGrowableCol( 1 );
-       fgSizer61->SetFlexibleDirection( wxVERTICAL );
-       fgSizer61->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
-       
-       lblPriority = new wxStaticText( tabPriority, wxID_ANY, wxT("Priority:"), wxDefaultPosition, wxDefaultSize, 0 );
-       lblPriority->Wrap( -1 );
-       fgSizer61->Add( lblPriority, 0, wxALL, 5 );
-       
-       wxBoxSizer* bSizer2601;
-       bSizer2601 = new wxBoxSizer( wxHORIZONTAL );
-       
-       chkUsePref = new wxCheckBox( tabPriority, wxID_ANY, wxT("Use"), wxDefaultPosition, wxDefaultSize, 0 );
-       bSizer2601->Add( chkUsePref, 0, wxALL, 5 );
-       
-       wxBoxSizer* bSizer2541;
-       bSizer2541 = new wxBoxSizer( wxVERTICAL );
-       
-       wxBoxSizer* bSizer2561;
-       bSizer2561 = new wxBoxSizer( wxHORIZONTAL );
-       
-       sliPriority = new wxSlider( tabPriority, wxID_ANY, 0, 1, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
-       bSizer2561->Add( sliPriority, 1, wxALL|wxEXPAND, 5 );
-       
-       
-       bSizer2541->Add( bSizer2561, 1, wxEXPAND, 5 );
-       
-       wxBoxSizer* bSizer2551;
-       bSizer2551 = new wxBoxSizer( wxHORIZONTAL );
-       
-       lblHigh = new wxStaticText( tabPriority, wxID_ANY, wxT("High"), wxDefaultPosition, wxDefaultSize, 0 );
-       lblHigh->Wrap( -1 );
-       bSizer2551->Add( lblHigh, 0, wxALIGN_LEFT|wxALL, 5 );
-       
-       
-       bSizer2551->Add( 0, 0, 1, wxEXPAND, 5 );
-       
-       lblLow = new wxStaticText( tabPriority, wxID_ANY, wxT("Low"), wxDefaultPosition, wxDefaultSize, 0 );
-       lblLow->Wrap( -1 );
-       bSizer2551->Add( lblLow, 0, wxALIGN_RIGHT|wxALL, 5 );
-       
-       
-       bSizer2541->Add( bSizer2551, 1, wxEXPAND, 0 );
-       
-       
-       bSizer2601->Add( bSizer2541, 1, wxEXPAND, 5 );
-       
-       
-       fgSizer61->Add( bSizer2601, 1, wxEXPAND, 5 );
-       
-       
-       fgSizer61->Add( 0, 0, 1, wxEXPAND, 5 );
+       szrPriority = new wxFlexGridSizer( 1, 1, 0, 0 );
+       szrPriority->SetFlexibleDirection( wxBOTH );
+       szrPriority->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
        
        
-       tabPriority->SetSizer( fgSizer61 );
+       tabPriority->SetSizer( szrPriority );
        tabPriority->Layout();
-       fgSizer61->Fit( tabPriority );
-       nbkNotes->AddPage( tabPriority, wxT("Priority"), false );
+       szrPriority->Fit( tabPriority );
+       nbkNotes->AddPage( tabPriority, wxT("Priority"), true );
        tabLanguage = new wxPanel( nbkNotes, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
        wxFlexGridSizer* fgSizer611;
        fgSizer611 = new wxFlexGridSizer( 0, 2, 0, 0 );
@@ -4645,7 +4595,6 @@ frmContactEditorNotesADT::frmContactEditorNotesADT( wxWindow* parent, wxWindowID
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorNotesADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNotesADT::ProcessAction ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNotesADT::CloseWindow ), NULL, this );
 }
@@ -4653,7 +4602,6 @@ frmContactEditorNotesADT::frmContactEditorNotesADT( wxWindow* parent, wxWindowID
 frmContactEditorNotesADT::~frmContactEditorNotesADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorNotesADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNotesADT::ProcessAction ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorNotesADT::CloseWindow ), NULL, this );
        
index a901d85..8ae04b9 100644 (file)
@@ -1151,11 +1151,7 @@ class frmContactEditorNotesADT : public wxDialog
                wxPanel* tabGeneral;
                wxTextCtrl* txtNote;
                wxPanel* tabPriority;
-               wxStaticText* lblPriority;
-               wxCheckBox* chkUsePref;
-               wxSlider* sliPriority;
-               wxStaticText* lblHigh;
-               wxStaticText* lblLow;
+               wxFlexGridSizer* szrPriority;
                wxPanel* tabLanguage;
                wxStaticText* lblLanguage;
                wxComboBox* cmbLanguage;
@@ -1163,7 +1159,6 @@ class frmContactEditorNotesADT : public wxDialog
                wxButton* btnClose;
                
                // Virtual event handlers, overide them in your derived class
-               virtual void EnablePriority( wxCommandEvent& event ) { event.Skip(); }
                virtual void ProcessAction( wxCommandEvent& event ) { event.Skip(); }
                virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); }
                
index ab0a64d..1bc24fc 100644 (file)
@@ -26,7 +26,8 @@ frmContactEditorNotesADT( parent )
        // Setup the editor window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
+       priorityCtrl = new XABPriorityCtrl(tabPriority);
+       szrPriority->Add(priorityCtrl, 1, wxEXPAND, 5);
        
        // Setup the language combo box.
        
@@ -44,19 +45,6 @@ frmContactEditorNotesADT( parent )
        
 }
 
-void frmContactEditorNotes::EnablePriority( wxCommandEvent& event )
-{
-       
-       // Enable/disable the priority setting.
-       
-       if (chkUsePref->IsChecked()){
-               sliPriority->Enable();
-       } else {
-               sliPriority->Disable();
-       }
-       
-}
-
 void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
 {
        
@@ -93,9 +81,9 @@ void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
                
                // Add note priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       NotesListPrefPtr->insert(std::make_pair(NotesListIndex, sliPriority->GetValue()));
+                       NotesListPrefPtr->insert(std::make_pair(NotesListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -126,9 +114,9 @@ void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
                coldata.SetText(txtNote->GetValue());
                ListCtrlIndex = NotesListCtrlPtr->InsertItem(coldata);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       NotesListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       NotesListCtrlPtr->SetItem(ListCtrlIndex, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }
                
@@ -151,9 +139,9 @@ void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
                
                NotesListPrefPtr->erase(NotesListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       NotesListPrefPtr->insert(std::make_pair(NotesListIndex, sliPriority->GetValue()));
+                       NotesListPrefPtr->insert(std::make_pair(NotesListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -189,9 +177,9 @@ void frmContactEditorNotes::ProcessAction( wxCommandEvent& event )
                
                NotesListCtrlPtr->SetItem(longSelected, 0, txtNote->GetValue());
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       NotesListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       NotesListCtrlPtr->SetItem(longSelected, 1, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
@@ -264,9 +252,8 @@ void frmContactEditorNotes::SetEditorMode(bool EditMode, SectionType SectType)
                if (intiter->first == NotesListIndex && intiter->second > 0 &&
                        intiter != NotesListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }
                
index ad7267e..3a6d6ac 100644 (file)
@@ -31,6 +31,7 @@ Subclass of frmContactEditorNotesADT, 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 frmContactEditorNotes : public frmContactEditorNotesADT
 {
        protected:
                // Handlers for frmContactEditorNotesADT events.
-               void EnablePriority( wxCommandEvent& event );
                void ProcessAction( wxCommandEvent& event );
                void CloseWindow( wxCommandEvent& event );
        public:
@@ -70,6 +70,7 @@ class frmContactEditorNotes : public frmContactEditorNotesADT
                wxListCtrl *NotesListCtrlPtr;
                int NotesListIndex;
                SectionType EditSectionType;    
+               XABPriorityCtrl *priorityCtrl = nullptr;
 };
 
 #endif // __frmContactEditorNotes__
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy