Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Indented code properly contacteditor/frmContactEditor-Events.cpp
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 13 Mar 2016 15:56:54 +0000 (15:56 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 13 Mar 2016 15:56:54 +0000 (15:56 +0000)
source/contacteditor/frmContactEditor-Events.cpp

index b8f47df..62f8a55 100644 (file)
 bool frmContactEditor::ProcessEvent(wxEvent& event)
 {
     
-    // This section has been taken from the wxWidgets sample code of richtext.cpp
-    // so that simple Cut/Copy/Paste code can be made.
-    
-    // As this code comes from the samples of the wxWidgets library, this is licenced
-    // under the wxWindows Library Licence and is compatable with the LGPL and is
-    // compatable with Xestia Address Book's licence.
-    
-    if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent)))
-    {
-        // Problem: we can get infinite recursion because the events
-        // climb back up to this frame, and repeat.
-        // Assume that command events don't cause another command event
-        // to be called, so we can rely on inCommand not being overwritten
+       // This section has been taken from the wxWidgets sample code of richtext.cpp
+       // so that simple Cut/Copy/Paste code can be made.
+    
+       // As this code comes from the samples of the wxWidgets library, this is licenced
+       // under the wxWindows Library Licence and is compatable with the LGPL and is
+       // compatable with Xestia Address Book's licence.
+    
+       if (event.IsCommandEvent() && !event.IsKindOf(CLASSINFO(wxChildFocusEvent))){
+               // Problem: we can get infinite recursion because the events
+               // climb back up to this frame, and repeat.
+               // Assume that command events don't cause another command event
+               // to be called, so we can rely on inCommand not being overwritten
         
-        static int s_eventType = 0;
-        static wxWindowID s_id = 0;
+               static int s_eventType = 0;
+               static wxWindowID s_id = 0;
         
-        if (s_id != event.GetId() && s_eventType != event.GetEventType())
-        {
-            s_eventType = event.GetEventType();
-            s_id = event.GetId();
+               if (s_id != event.GetId() && s_eventType != event.GetEventType()){
+                       
+                       s_eventType = event.GetEventType();
+                       s_id = event.GetId();
             
-            wxWindow* focusWin = wxFindFocusDescendant(this);
-            if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event))
-            {
-                //s_command = NULL;
-                s_eventType = 0;
-                s_id = 0;
-                return true;
-            }
-            s_eventType = 0;
-            s_id = 0;
-        }
-        else
-        {
-            return false;
-        }
-    }
-    
-    return wxFrame::ProcessEvent(event);
+                       wxWindow* focusWin = wxFindFocusDescendant(this);
+                       if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)){
+                               //s_command = NULL;
+                               s_eventType = 0;
+                               s_id = 0;
+                               return true;
+                       }
+                       s_eventType = 0;
+                       s_id = 0;
+                       
+               } else {
+               
+                       return false;
+                       
+               }
+       }
+    
+       return wxFrame::ProcessEvent(event);
+       
 }
 
 void frmContactEditor::UpdateDisplayAs( wxCommandEvent &event ){
     
-    // Generate a drop down list of common names to use for the display as drop down box.
+       // Generate a drop down list of common names to use for the display as drop down box.
     
-    wxString SetValue = cmbDisplayAs->GetValue();
+       wxString SetValue = cmbDisplayAs->GetValue();
     
-    cmbDisplayAs->Clear();
-    cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
-    if (!txtOtherNames->GetValue().IsEmpty()){
+       cmbDisplayAs->Clear();
+       cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
+       if (!txtOtherNames->GetValue().IsEmpty()){
         
-        cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());    
+               cmbDisplayAs->Append(txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue()  + wxT(" ") + txtForename->GetValue());     
         
-    }
-    cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue());        
-    if (!txtOtherNames->GetValue().IsEmpty()){
+       }
+       cmbDisplayAs->Append(txtSurname->GetValue() + wxT(", ") + txtForename->GetValue());
+       if (!txtOtherNames->GetValue().IsEmpty()){
         
-        cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
+               cmbDisplayAs->Append(txtForename->GetValue() + wxT(", ") + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtOtherNames->GetValue());
         
-    }
-    if (!txtTitle->GetValue().IsEmpty()){
-        cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
-    }
+       }
+       if (!txtTitle->GetValue().IsEmpty()){
+               cmbDisplayAs->Append(txtTitle->GetValue() + wxT(" ") + txtForename->GetValue() + wxT(" ") + txtSurname->GetValue());
+       }
+       cmbDisplayAs->SetValue(SetValue);
     
-    cmbDisplayAs->SetValue(SetValue);
-    
-    this->SetTitle(cmbDisplayAs->GetValue());
+       this->SetTitle(cmbDisplayAs->GetValue());
     
 }
 
 void frmContactEditor::UpdateName( wxCommandEvent &event ){
     
-    this->SetTitle(cmbDisplayAs->GetValue());
+       this->SetTitle(cmbDisplayAs->GetValue());
     
-    WindowData *WData = new WindowData;
+       WindowData *WData = new WindowData;
     
-    if (StartupEditMode == FALSE){
+       if (StartupEditMode == FALSE){
     
-       WData->DataType = 1;
-       WData->WindowPointer = this;
-       WData->WindowID = ContactEditorUID;
+               WData->DataType = 1;
+               WData->WindowPointer = this;
+               WData->WindowID = ContactEditorUID;
     
-       wxCommandEvent editevent(WINDOW_EDIT);
-       editevent.SetClientData(WData);
-       wxPostEvent(GetParent(), editevent);
+               wxCommandEvent editevent(WINDOW_EDIT);
+               editevent.SetClientData(WData);
+               wxPostEvent(GetParent(), editevent);
     
-    }
+       }
     
 }
\ No newline at end of file
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