From 76db3d7ee9939904c8a275fc6f7f62c75bc3fb80 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 13 Mar 2016 11:14:39 +0000 Subject: [PATCH] Indented code properly in frmContactEditor --- source/contacteditor/frmContactEditor.cpp | 546 +++++++++++----------- 1 file changed, 273 insertions(+), 273 deletions(-) diff --git a/source/contacteditor/frmContactEditor.cpp b/source/contacteditor/frmContactEditor.cpp index ad79abc..22de535 100644 --- a/source/contacteditor/frmContactEditor.cpp +++ b/source/contacteditor/frmContactEditor.cpp @@ -78,117 +78,118 @@ frmContactEditor::frmContactEditor( wxWindow* parent ) : frmContactEditorADT( parent ) { - boolContactModified = FALSE; - wxDateTime NoDate; - dapAnniversary->SetValue(NoDate); - dapBirthday->SetValue(NoDate); - tabMembers->Hide(); - - // Setup the buttons. - - wxMemoryInputStream istream(buttons_play_png, sizeof(buttons_play_png)); - wxImage button_play_pngi(istream, wxBITMAP_TYPE_PNG); - wxBitmap playiconbmp(button_play_pngi, -1); - btnPlay->SetBitmapLabel(playiconbmp); - - wxMemoryInputStream istream2(buttons_stop_png, sizeof(buttons_stop_png)); - wxImage button_stop_pngi(istream2, wxBITMAP_TYPE_PNG); - wxBitmap stopiconbmp(button_stop_pngi, -1); - btnStop->SetBitmapLabel(stopiconbmp); - btnStop->Disable(); - FMTimer.SetupPointers(this); - //wxIcon contacticon; - //contacticon.CopyFromBitmap(contacticonbmp); - - nbkContact->SetSelection(0); + + boolContactModified = FALSE; + wxDateTime NoDate; + dapAnniversary->SetValue(NoDate); + dapBirthday->SetValue(NoDate); + tabMembers->Hide(); + + // Setup the buttons. + + wxMemoryInputStream istream(buttons_play_png, sizeof(buttons_play_png)); + wxImage button_play_pngi(istream, wxBITMAP_TYPE_PNG); + wxBitmap playiconbmp(button_play_pngi, -1); + btnPlay->SetBitmapLabel(playiconbmp); + + wxMemoryInputStream istream2(buttons_stop_png, sizeof(buttons_stop_png)); + wxImage button_stop_pngi(istream2, wxBITMAP_TYPE_PNG); + wxBitmap stopiconbmp(button_stop_pngi, -1); + btnStop->SetBitmapLabel(stopiconbmp); + btnStop->Disable(); + FMTimer.SetupPointers(this); + //wxIcon contacticon; + //contacticon.CopyFromBitmap(contacticonbmp); + + nbkContact->SetSelection(0); } void frmContactEditor::CloseContact( wxCommandEvent& event ) { - Close(); + Close(); } void frmContactEditor::CloseWindow( wxCloseEvent& event ) { - // TODO: Check if any changes have been made, - // ask if the changes should be made, process - // action based on question and then close. + // TODO: Check if any changes have been made, + // ask if the changes should be made, process + // action based on question and then close. - 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 delevent(WINDOW_CLOSE); - delevent.SetClientData(WData); - wxPostEvent(GetParent(), delevent); + wxCommandEvent delevent(WINDOW_CLOSE); + delevent.SetClientData(WData); + wxPostEvent(GetParent(), delevent); - } + } - Destroy(); + Destroy(); } void frmContactEditor::CutText( wxCommandEvent& event ) { - // This function left empty for future implementation. + // This function left empty for future implementation. } void frmContactEditor::CopyText( wxCommandEvent& event ) { - // This function left empty for future implementation. + // This function left empty for future implementation. } void frmContactEditor::PasteText( wxCommandEvent& event ) { - // This function left empty for future implementation. + // This function left empty for future implementation. } void frmContactEditor::SetupContact( wxString AccountName ) { - wxSContactAccount = AccountName; + wxSContactAccount = AccountName; } int frmContactEditor::GetLastInt(std::map *MapData){ - /* - int intResult = 0; + /* + int intResult = 0; - std::map::iterator iwxsit; + std::map::iterator iwxsit; - for( iwxsit=(*MapData).begin(); iwxsit != (*MapData).end(); iwxsit++){ - intResult = (*iwxsit).first; - } + for( iwxsit=(*MapData).begin(); iwxsit != (*MapData).end(); iwxsit++){ + intResult = (*iwxsit).first; + } - return intResult; - */ + return intResult; + */ - intValueSeek++; - return intValueSeek; + intValueSeek++; + return intValueSeek; } int frmContactEditor::GetLastInt(std::map *MapData){ - /* int intResult = 0; + /* int intResult = 0; - std::map::iterator iwxsit; + std::map::iterator iwxsit; - for( iwxsit=(*MapData).begin(); iwxsit != (*MapData).end(); iwxsit++){ - intResult = (*iwxsit).first; - }*/ + for( iwxsit=(*MapData).begin(); iwxsit != (*MapData).end(); iwxsit++){ + intResult = (*iwxsit).first; + }*/ - intValueSeek++; - return intValueSeek; + intValueSeek++; + return intValueSeek; } @@ -196,244 +197,243 @@ bool frmContactEditor::GetSelectedItem(wxListCtrl *ListCtrlPtr, long *longSelected, int *intSelectedData){ - *longSelected = -1; - *intSelectedData = 0; + *longSelected = -1; + *intSelectedData = 0; - *longSelected = ListCtrlPtr->GetNextItem(*longSelected, - wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); + *longSelected = ListCtrlPtr->GetNextItem(*longSelected, + wxLIST_NEXT_ALL, + wxLIST_STATE_SELECTED); - *intSelectedData = (int)ListCtrlPtr->GetItemData(*longSelected); + *intSelectedData = (int)ListCtrlPtr->GetItemData(*longSelected); - if (*longSelected == -1){ - return FALSE; - } - else { - return TRUE; - } + if (*longSelected == -1){ + return FALSE; + } else { + return TRUE; + } } void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map* MapData){ - MapData->erase(IndexNum); + MapData->erase(IndexNum); } void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map* MapData){ - MapData->erase(IndexNum); + MapData->erase(IndexNum); } void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map* MapData){ - MapData->erase(IndexNum); + MapData->erase(IndexNum); } void frmContactEditor::DeleteMapDataProcess(int IndexNum, std::map* MapData){ - MapData->erase(IndexNum); + MapData->erase(IndexNum); } void frmContactEditor::ProcessSaveDataProc( wxString PropName, std::map* MapData){ - int intIterVal = (*iterDataPtr)->first; + int intIterVal = (*iterDataPtr)->first; - std::map::iterator intIter; + std::map::iterator intIter; - intIter = MapData->find(intIterVal); + intIter = MapData->find(intIterVal); - int intPropValue; + int intPropValue; - if (intIter->first == intIterVal){ + if (intIter->first == intIterVal){ - intPropValue = intIter->second; + intPropValue = intIter->second; - if (intPropValue){ + if (intPropValue){ - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } + } - strPropertyPtr->Append(PropName + wxT("=") + wxString::Format(wxT("%i"), intPropValue)); + strPropertyPtr->Append(PropName + wxT("=") + wxString::Format(wxT("%i"), intPropValue)); - *boolExtraPtr = TRUE; + *boolExtraPtr = TRUE; - } + } - } + } } void frmContactEditor::ProcessSaveDataProc( wxString PropName, std::map* MapData){ - int intIterVal; + int intIterVal; - intIterVal = (*iterDataPtr)->first; + intIterVal = (*iterDataPtr)->first; - std::map::iterator strIter; + std::map::iterator strIter; - strIter = MapData->find(intIterVal); + strIter = MapData->find(intIterVal); - if (strIter == MapData->end()){ + if (strIter == MapData->end()){ - return; + return; - } + } - wxString strPropValue; + wxString strPropValue; - if (strIter->first == intIterVal){ + if (strIter->first == intIterVal){ - strPropValue = strIter->second; + strPropValue = strIter->second; - if (!strPropValue.IsEmpty() && PropName.IsEmpty()){ + if (!strPropValue.IsEmpty() && PropName.IsEmpty()){ - strPropValue.Trim(); - strPropValue.Trim(); + strPropValue.Trim(); + strPropValue.Trim(); - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } + } - strPropertyPtr->Append(strPropValue); + strPropertyPtr->Append(strPropValue); - *boolExtraPtr = TRUE; + *boolExtraPtr = TRUE; - return; + return; - } + } - if (!strPropValue.IsEmpty()){ + if (!strPropValue.IsEmpty()){ - strPropValue.Trim(); - strPropValue.Trim(); + strPropValue.Trim(); + strPropValue.Trim(); - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } + } - // Look for semi-colon in property name and if there is then - // quote the value. + // Look for semi-colon in property name and if there is then + // quote the value. - if (PropName != wxT("TYPE")){ + if (PropName != wxT("TYPE")){ - EscapeString(&strPropValue, FALSE); + EscapeString(&strPropValue, FALSE); - } + } - if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND && - strPropValue.find(wxT(",")) == wxNOT_FOUND){ + if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND && + strPropValue.find(wxT(",")) == wxNOT_FOUND){ - strPropertyPtr->Append(PropName + wxT("=") + strPropValue); + strPropertyPtr->Append(PropName + wxT("=") + strPropValue); - } else { + } else { - strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\"")); + strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\"")); - } + } - *boolExtraPtr = TRUE; + *boolExtraPtr = TRUE; - } + } - } + } } void frmContactEditor::ProcessSaveDataStrProc( wxString PropName, std::map* MapData){ - int intIterVal = (*iterDataStringPtr)->first; + int intIterVal = (*iterDataStringPtr)->first; - //std::map::iterator strIter; + //std::map::iterator strIter; - std::map::iterator stdstrIter; + std::map::iterator stdstrIter; - stdstrIter = MapData->find(intIterVal); - - if (stdstrIter->first == intIterVal){ + stdstrIter = MapData->find(intIterVal); + + if (stdstrIter->first == intIterVal){ - wxString strPropValue(stdstrIter->second.c_str(), wxConvUTF8); + wxString strPropValue(stdstrIter->second.c_str(), wxConvUTF8); - if (!strPropValue.IsEmpty() && PropName.IsEmpty()){ + if (!strPropValue.IsEmpty() && PropName.IsEmpty()){ - strPropValue.Trim(); - strPropValue.Trim(); + strPropValue.Trim(); + strPropValue.Trim(); - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } + } - strPropertyPtr->Append(strPropValue); + strPropertyPtr->Append(strPropValue); - *boolExtraPtr = TRUE; + *boolExtraPtr = TRUE; - return; + return; - } + } - if (!strPropValue.IsEmpty()){ + if (!strPropValue.IsEmpty()){ - strPropValue.Trim(); - strPropValue.Trim(); + strPropValue.Trim(); + strPropValue.Trim(); - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } + } - // Look for semi-colon in property name and if there is then - // quote the value. + // Look for semi-colon in property name and if there is then + // quote the value. - if (PropName != wxT("TYPE")){ + if (PropName != wxT("TYPE")){ - EscapeString(&strPropValue, FALSE); + EscapeString(&strPropValue, FALSE); - } + } - if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND && - strPropValue.find(wxT(",")) == wxNOT_FOUND){ + if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND && + strPropValue.find(wxT(",")) == wxNOT_FOUND){ - strPropertyPtr->Append(PropName + wxT("=") + strPropValue); + strPropertyPtr->Append(PropName + wxT("=") + strPropValue); - } else { + } else { - strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\"")); + strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\"")); - } + } - *boolExtraPtr = TRUE; + *boolExtraPtr = TRUE; - } + } - } + } } @@ -441,216 +441,216 @@ void frmContactEditor::ProcessSaveDataStrProc( wxString PropName, void frmContactEditor::ProcessSaveDataStrProc( wxString PropName, std::map* MapData){ - int intIterVal = (*iterDataStringPtr)->first; + int intIterVal = (*iterDataStringPtr)->first; - std::map::iterator intIter; + std::map::iterator intIter; - intIter = MapData->find(intIterVal); + intIter = MapData->find(intIterVal); - int intPropValue; + int intPropValue; - if (intIter->first == intIterVal){ + if (intIter->first == intIterVal){ - intPropValue = intIter->second; + intPropValue = intIter->second; - if (intPropValue){ + if (intPropValue){ - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } + } - strPropertyPtr->Append(PropName + wxT("=") + wxString::Format(wxT("%i"), intPropValue)); + strPropertyPtr->Append(PropName + wxT("=") + wxString::Format(wxT("%i"), intPropValue)); - *boolExtraPtr = TRUE; + *boolExtraPtr = TRUE; - } + } - } + } } void frmContactEditor::ProcessSaveDataStrProc( wxString PropName, std::map* MapData){ - int intIterVal; + int intIterVal; - intIterVal = (*iterDataStringPtr)->first; + intIterVal = (*iterDataStringPtr)->first; - std::map::iterator strIter; + std::map::iterator strIter; - strIter = MapData->find(intIterVal); + strIter = MapData->find(intIterVal); - wxString strPropValue; + wxString strPropValue; - if (strIter->first == intIterVal){ + if (strIter->first == intIterVal){ - strPropValue = strIter->second; + strPropValue = strIter->second; - if (!strPropValue.IsEmpty() && PropName.IsEmpty()){ + if (!strPropValue.IsEmpty() && PropName.IsEmpty()){ - strPropValue.Trim(); - strPropValue.Trim(); + strPropValue.Trim(); + strPropValue.Trim(); - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } - - strPropertyPtr->Append(strPropValue); + } - *boolExtraPtr = TRUE; + strPropertyPtr->Append(strPropValue); - return; + *boolExtraPtr = TRUE; + + return; - } + } - if (!strPropValue.IsEmpty()){ + if (!strPropValue.IsEmpty()){ - strPropValue.Trim(); - strPropValue.Trim(); + strPropValue.Trim(); + strPropValue.Trim(); - if (*boolAdditionalPtr == TRUE){ + if (*boolAdditionalPtr == TRUE){ - strPropertyPtr->Append(wxT(";")); + strPropertyPtr->Append(wxT(";")); - } else { + } else { - *boolAdditionalPtr = TRUE; + *boolAdditionalPtr = TRUE; - } + } - // Look for semi-colon in property name and if there is then - // quote the value. + // Look for semi-colon in property name and if there is then + // quote the value. - if (PropName != wxT("TYPE")){ + if (PropName != wxT("TYPE")){ - EscapeString(&strPropValue, FALSE); + EscapeString(&strPropValue, FALSE); - } + } - if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND && - strPropValue.find(wxT(",")) == wxNOT_FOUND){ + if (strPropValue.find(wxT(";")) == wxNOT_FOUND && strPropValue.find(wxT(":")) == wxNOT_FOUND && + strPropValue.find(wxT(",")) == wxNOT_FOUND){ - strPropertyPtr->Append(PropName + wxT("=") + strPropValue); + strPropertyPtr->Append(PropName + wxT("=") + strPropValue); - } else { + } else { - strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\"")); + strPropertyPtr->Append(PropName + wxT("=\"") + strPropValue + wxT("\"")); - } + } - *boolExtraPtr = TRUE; + *boolExtraPtr = TRUE; - } + } - } + } } void frmContactEditor::ProcessCaptureStringsProc(wxString *strCapture){ - CaptureString(strCapture, FALSE); + CaptureString(strCapture, FALSE); } void frmContactEditor::ResetSaveProcessData(){ - strValue.Clear(); - strValue2.Clear(); - strValue3.Clear(); + strValue.Clear(); + strValue2.Clear(); + strValue3.Clear(); - boolValue = FALSE; - boolValue2 = FALSE; - intValue2 = 0; - intValue = 0; + boolValue = FALSE; + boolValue2 = FALSE; + intValue2 = 0; + intValue = 0; } void frmContactEditor::SetupPointers(frmActivityMgr *ActMgr, wxETagProcessTimer *ETagProc, frmMain *MainPtrInc){ - ActMgrPtr = ActMgr; - ETagTmrPtr = ETagProc; - MainPtr = MainPtrInc; + ActMgrPtr = ActMgr; + ETagTmrPtr = ETagProc; + MainPtr = MainPtrInc; } void frmContactEditor::ContactFileChanged( wxCommandEvent &event ){ - // Stop the timer. + // Stop the timer. - FMTimer.Stop(); + FMTimer.Stop(); - // Check if a dialog is already open. + // Check if a dialog is already open. - if (DialogOpen == TRUE){ + if (DialogOpen == TRUE){ - FMTimer.Start(1000, FALSE); - return; + FMTimer.Start(1000, FALSE); + return; - } + } - // Bring up a Yes/No modal dialog asking if the changed file should be reloaded. + // Bring up a Yes/No modal dialog asking if the changed file should be reloaded. - int QuestionResponse; + int QuestionResponse; - QuestionResponse = wxMessageBox(_("This contact has changed. Saving the contact may overwrite or lose any changes done by that change. Do you want to reload the contact with the changes made?"), _("Contact information has changed"), wxYES_NO, this); + QuestionResponse = wxMessageBox(_("This contact has changed. Saving the contact may overwrite or lose any changes done by that change. Do you want to reload the contact with the changes made?"), _("Contact information has changed"), wxYES_NO, this); - if (QuestionResponse == wxYES){ + if (QuestionResponse == wxYES){ - // Reload the contact. - wxString wxSReloadContactName = wxSContactFilename; - ClearContact(); - LoadContact(wxSReloadContactName); + // Reload the contact. + wxString wxSReloadContactName = wxSContactFilename; + ClearContact(); + LoadContact(wxSReloadContactName); - } else { + } else { - // Do nothing other than update the timestamp so this message - // doesn't appear until the next time it changes. + // Do nothing other than update the timestamp so this message + // doesn't appear until the next time it changes. - FMTimer.UpdateTimestamp(); + FMTimer.UpdateTimestamp(); - } + } - // Start the timer. + // Start the timer. - FMTimer.Start(); + FMTimer.Start(); } void frmContactEditor::UpdateMembersTab( wxCommandEvent &event ){ - if (cmbType->GetCurrentSelection() == 2){ + if (cmbType->GetCurrentSelection() == 2){ - tabMembers->Show(); + tabMembers->Show(); - } else { + } else { - tabMembers->Hide(); + tabMembers->Hide(); - } + } } void frmContactEditor::SetUID(int UID){ - ContactEditorUID = UID; + ContactEditorUID = UID; } void frmContactEditor::SetMode(bool StartupEditModeIn){ - StartupEditMode = StartupEditModeIn; + StartupEditMode = StartupEditModeIn; } \ No newline at end of file -- 2.39.5