Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditorPicture: Implemented priority control
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 31 Aug 2017 22:00:42 +0000 (23:00 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Thu, 31 Aug 2017 22:00:42 +0000 (23:00 +0100)
source/AppXestiaAddrBk.cpp
source/AppXestiaAddrBk.h
source/contacteditor/frmContactEditorPicture.cpp
source/contacteditor/frmContactEditorPicture.h

index 7d542de..61f5000 100644 (file)
@@ -4824,80 +4824,35 @@ frmContactEditorPictureADT::frmContactEditorPictureADT( wxWindow* parent, wxWind
        
        nbkRelated = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
        tabGeneral = new wxPanel( nbkRelated, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
-       wxFlexGridSizer* fgSizer6;
-       fgSizer6 = new wxFlexGridSizer( 0, 2, 0, 0 );
-       fgSizer6->AddGrowableCol( 1 );
-       fgSizer6->SetFlexibleDirection( wxBOTH );
-       fgSizer6->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
+       szrGeneral = new wxFlexGridSizer( 3, 2, 0, 0 );
+       szrGeneral->AddGrowableCol( 1 );
+       szrGeneral->SetFlexibleDirection( wxBOTH );
+       szrGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
        
        lblPictureFile = new wxStaticText( tabGeneral, wxID_ANY, wxT("Picture File:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblPictureFile->Wrap( -1 );
-       fgSizer6->Add( lblPictureFile, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+       szrGeneral->Add( lblPictureFile, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
        
        fipPicture = new wxFilePickerCtrl( tabGeneral, wxID_ANY, wxEmptyString, wxT("Select a sound file"), wxT("*.*"), wxDefaultPosition, wxDefaultSize, wxFLP_DEFAULT_STYLE );
-       fgSizer6->Add( fipPicture, 1, wxALL|wxEXPAND, 5 );
+       szrGeneral->Add( fipPicture, 1, wxALL|wxEXPAND, 5 );
        
        lblType = new wxStaticText( tabGeneral, wxID_ANY, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
        lblType->Wrap( -1 );
-       fgSizer6->Add( lblType, 0, wxALL, 5 );
+       szrGeneral->Add( lblType, 0, wxALL, 5 );
        
        wxArrayString cmbTypeChoices;
        cmbType = new wxChoice( tabGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, cmbTypeChoices, 0 );
        cmbType->SetSelection( 0 );
-       fgSizer6->Add( cmbType, 0, wxALL, 5 );
+       szrGeneral->Add( cmbType, 0, wxALL, 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 );
-       
-       
-       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 );
+       szrGeneral->Add( lblPriority, 0, wxALL, 5 );
        
        
-       tabGeneral->SetSizer( fgSizer6 );
+       tabGeneral->SetSizer( szrGeneral );
        tabGeneral->Layout();
-       fgSizer6->Fit( tabGeneral );
+       szrGeneral->Fit( tabGeneral );
        nbkRelated->AddPage( tabGeneral, wxT("General"), false );
        
        bSizer251->Add( nbkRelated, 1, wxEXPAND | wxALL, 5 );
@@ -4921,7 +4876,6 @@ frmContactEditorPictureADT::frmContactEditorPictureADT( wxWindow* parent, wxWind
        this->Centre( wxBOTH );
        
        // Connect Events
-       chkUsePref->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorPictureADT::EnablePriority ), NULL, this );
        btnAction->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorPictureADT::ProcessData ), NULL, this );
        btnClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorPictureADT::CloseWindow ), NULL, this );
 }
@@ -4929,7 +4883,6 @@ frmContactEditorPictureADT::frmContactEditorPictureADT( wxWindow* parent, wxWind
 frmContactEditorPictureADT::~frmContactEditorPictureADT()
 {
        // Disconnect Events
-       chkUsePref->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( frmContactEditorPictureADT::EnablePriority ), NULL, this );
        btnAction->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorPictureADT::ProcessData ), NULL, this );
        btnClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( frmContactEditorPictureADT::CloseWindow ), NULL, this );
        
index 8948f83..611051c 100644 (file)
@@ -1271,27 +1271,23 @@ class frmContactEditorPictureADT : public wxDialog
        protected:
                wxNotebook* nbkRelated;
                wxPanel* tabGeneral;
+               wxFlexGridSizer* szrGeneral;
                wxStaticText* lblPictureFile;
                wxFilePickerCtrl* fipPicture;
                wxStaticText* lblType;
                wxChoice* cmbType;
                wxStaticText* lblPriority;
-               wxCheckBox* chkUsePref;
-               wxSlider* sliPriority;
-               wxStaticText* lblHigh;
-               wxStaticText* lblLow;
                wxButton* btnAction;
                wxButton* btnClose;
                
                // Virtual event handlers, overide them in your derived class
-               virtual void EnablePriority( wxCommandEvent& event ) { event.Skip(); }
                virtual void ProcessData( wxCommandEvent& event ) { event.Skip(); }
                virtual void CloseWindow( wxCommandEvent& event ) { event.Skip(); }
                
        
        public:
                
-               frmContactEditorPictureADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Picture Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,247 ), long style = wxDEFAULT_DIALOG_STYLE ); 
+               frmContactEditorPictureADT( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Picture Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 381,264 ), long style = wxDEFAULT_DIALOG_STYLE ); 
                ~frmContactEditorPictureADT();
        
 };
index 0be5931..e28b271 100644 (file)
@@ -37,7 +37,8 @@ frmContactEditorPictureADT( parent )
        // Setup the window.
        
        EditorMode = FALSE;
-       sliPriority->Disable();
+       priorityCtrl = new XABPriorityCtrl(tabGeneral);
+       szrGeneral->Add(priorityCtrl, 1, wxEXPAND, 5);
        
        cmbType->Append(wxT(""));
        cmbType->Append(_("Home"));
@@ -45,18 +46,6 @@ frmContactEditorPictureADT( parent )
        
 }
 
-void frmContactEditorPicture::EnablePriority( wxCommandEvent& event )
-{
-       
-       // Enable/disable the priority.
-       
-       if (chkUsePref->IsChecked()){
-               sliPriority->Enable();
-       } else {
-               sliPriority->Disable();
-       }
-}
-
 void frmContactEditorPicture::ProcessData( wxCommandEvent& event )
 {
        
@@ -171,9 +160,9 @@ void frmContactEditorPicture::ProcessData( wxCommandEvent& event )
                
                // Setup Organisation Priority.
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       PictureListPrefPtr->insert(std::make_pair(PictureListIndex, sliPriority->GetValue()));
+                       PictureListPrefPtr->insert(std::make_pair(PictureListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -222,9 +211,9 @@ void frmContactEditorPicture::ProcessData( wxCommandEvent& event )
                
                }               
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       PictureListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       PictureListCtrlPtr->SetItem(ListCtrlIndex, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                }
                
@@ -257,9 +246,9 @@ void frmContactEditorPicture::ProcessData( wxCommandEvent& event )
                
                PictureListPrefPtr->erase(PictureListIndex);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       PictureListPrefPtr->insert(std::make_pair(PictureListIndex, sliPriority->GetValue()));
+                       PictureListPrefPtr->insert(std::make_pair(PictureListIndex, priorityCtrl->GetValue()));
                
                } else {
                
@@ -288,9 +277,9 @@ void frmContactEditorPicture::ProcessData( wxCommandEvent& event )
                
                PictureListCtrlPtr->SetItem(longSelected, 1, strValue);
                
-               if (chkUsePref->IsChecked()){
+               if (priorityCtrl->IsPriorityChecked()){
                
-                       PictureListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), sliPriority->GetValue()));
+                       PictureListCtrlPtr->SetItem(longSelected, 2, wxString::Format(wxT("%i"), priorityCtrl->GetValue()));
                
                } else {
                
@@ -372,9 +361,8 @@ void frmContactEditorPicture::SetEditorMode(bool EditMode)
                if (intiter->first == PictureListIndex && intiter->second > 0 &&
                        intiter != PictureListPrefPtr->end()){
                
-                       sliPriority->SetValue(intiter->second);
-                       sliPriority->Enable();
-                       chkUsePref->SetValue(TRUE);
+                       priorityCtrl->SetValue(intiter->second);
+                       priorityCtrl->EnablePriority(true);
                
                }       
                
index 46a8b8c..e28939d 100644 (file)
@@ -28,6 +28,7 @@ Subclass of frmContactEditorPictureADT, which is generated by wxFormBuilder.
 #include <string>
 #include "../AppXestiaAddrBk.h"
 #include "../enums.h"
+#include "../widgets/XABPriorityCtrl.h"
 
 //// end generated include
 
@@ -36,7 +37,6 @@ class frmContactEditorPicture : public frmContactEditorPictureADT
 {
        protected:
                // Handlers for frmContactEditorPictureADT events.
-               void EnablePriority( wxCommandEvent& event );
                void ProcessData( wxCommandEvent& event );
                void CloseWindow( wxCommandEvent& event );
        public:
@@ -71,7 +71,7 @@ class frmContactEditorPicture : public frmContactEditorPictureADT
                wxListCtrl *PictureListCtrlPtr;
                int PictureListIndex = 0;
                SectionType EditSectionType;
-       
+               XABPriorityCtrl *priorityCtrl = nullptr;
 };
 
 #endif // __frmContactEditorPicture__
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