X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fcontacteditor%2FfrmContactEditor-Events.cpp;h=df0ff62819e1f24c248936831452ae779d5d8311;hb=ee9b71949005734012f18251774807c38b989ae2;hp=39eca49c5dbe88a56ac6f865a4cce17ca0896c99;hpb=5b2b2bcea1ab1dfd2b74589573cd16ee9326c4b9;p=xestiaab%2F.git diff --git a/source/contacteditor/frmContactEditor-Events.cpp b/source/contacteditor/frmContactEditor-Events.cpp index 39eca49..df0ff62 100644 --- a/source/contacteditor/frmContactEditor-Events.cpp +++ b/source/contacteditor/frmContactEditor-Events.cpp @@ -1,91 +1,118 @@ +// frmContactEditor-Events.cpp - frmContactEditor Events subroutines. +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Address Book is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Address Book. If not, see + #include "frmContactEditor.h" bool frmContactEditor::ProcessEvent(wxEvent& event) { + + // Process the cut/copy/paste events. + + // This section has been taken from the wxWidgets sample code of richtext.cpp + // so that simple Cut/Copy/Paste code can be made. - // 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. + // 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 + 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; - } - } + 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); + 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 ){ + + // Update the window title and main window menu item + // with the new name. + + this->SetTitle(cmbDisplayAs->GetValue()); + + WindowData *WData = new WindowData; - this->SetTitle(cmbDisplayAs->GetValue()); + if (StartupEditMode == FALSE){ - WindowData *WData = new WindowData; + 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