From 4443fd0e346fdea4770cca961274b03147f210fe Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 13 Mar 2016 13:06:33 +0000 Subject: [PATCH] Indented code properly contacteditor/frmContactEditor-Picture.cpp --- .../frmContactEditor-Picture.cpp | 195 +++++++++--------- 1 file changed, 100 insertions(+), 95 deletions(-) diff --git a/source/contacteditor/frmContactEditor-Picture.cpp b/source/contacteditor/frmContactEditor-Picture.cpp index acefe6b..c1751ea 100644 --- a/source/contacteditor/frmContactEditor-Picture.cpp +++ b/source/contacteditor/frmContactEditor-Picture.cpp @@ -23,142 +23,147 @@ void frmContactEditor::AddPicture( wxCommandEvent& event ) { - int intResult = 0; - - frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this ); - frameCEPicture->SetEditorMode(FALSE); - intResult = GetLastInt(&ContactEditorData.PicturesList); - frameCEPicture->SetupPointers(&ContactEditorData.PicturesList, - &ContactEditorData.PicturesListAltID, - &ContactEditorData.PicturesListPID, - &ContactEditorData.PicturesListType, - &ContactEditorData.PicturesListPicEncType, - &ContactEditorData.PicturesListPictureType, - &ContactEditorData.PicturesListTokens, - &ContactEditorData.PicturesListMediatype, - &ContactEditorData.PicturesListPref, - lboPictures, - (intValueSeek), - TRUE); - frameCEPicture->ShowModal(); - delete frameCEPicture; - frameCEPicture = NULL; + + int intResult = 0; + + frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this ); + frameCEPicture->SetEditorMode(FALSE); + intResult = GetLastInt(&ContactEditorData.PicturesList); + frameCEPicture->SetupPointers(&ContactEditorData.PicturesList, + &ContactEditorData.PicturesListAltID, + &ContactEditorData.PicturesListPID, + &ContactEditorData.PicturesListType, + &ContactEditorData.PicturesListPicEncType, + &ContactEditorData.PicturesListPictureType, + &ContactEditorData.PicturesListTokens, + &ContactEditorData.PicturesListMediatype, + &ContactEditorData.PicturesListPref, + lboPictures, + (intValueSeek), + TRUE); + frameCEPicture->ShowModal(); + delete frameCEPicture; + frameCEPicture = NULL; + } void frmContactEditor::ModifyPicture( wxCommandEvent& event ) { - long longSelected = -1; - int intSelectedData = 0; + + long longSelected = -1; + int intSelectedData = 0; - if (!GetSelectedItem(lboPictures, - &longSelected, - &intSelectedData)){ - return; - } - - frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this ); - frameCEPicture->SetupPointers(&ContactEditorData.PicturesList, - &ContactEditorData.PicturesListAltID, - &ContactEditorData.PicturesListPID, - &ContactEditorData.PicturesListType, - &ContactEditorData.PicturesListPicEncType, - &ContactEditorData.PicturesListPictureType, - &ContactEditorData.PicturesListTokens, - &ContactEditorData.PicturesListMediatype, - &ContactEditorData.PicturesListPref, - lboPictures, - intSelectedData, - TRUE); - frameCEPicture->SetEditorMode(TRUE); - frameCEPicture->ShowModal(); - delete frameCEPicture; - frameCEPicture = NULL; + if (!GetSelectedItem(lboPictures, + &longSelected, + &intSelectedData)){ + return; + } + + frmContactEditorPicture *frameCEPicture = new frmContactEditorPicture ( this ); + frameCEPicture->SetupPointers(&ContactEditorData.PicturesList, + &ContactEditorData.PicturesListAltID, + &ContactEditorData.PicturesListPID, + &ContactEditorData.PicturesListType, + &ContactEditorData.PicturesListPicEncType, + &ContactEditorData.PicturesListPictureType, + &ContactEditorData.PicturesListTokens, + &ContactEditorData.PicturesListMediatype, + &ContactEditorData.PicturesListPref, + lboPictures, + intSelectedData, + TRUE); + frameCEPicture->SetEditorMode(TRUE); + frameCEPicture->ShowModal(); + delete frameCEPicture; + frameCEPicture = NULL; } void frmContactEditor::DeletePicture( wxCommandEvent& event ) { - long longSelected = -1; - int intSelectedData = 0; + + long longSelected = -1; + int intSelectedData = 0; - if (!GetSelectedItem(lboPictures, - &longSelected, - &intSelectedData)){ - return; - } + if (!GetSelectedItem(lboPictures, + &longSelected, + &intSelectedData)){ + return; + } - lboPictures->DeleteItem(longSelected); + lboPictures->DeleteItem(longSelected); - DeleteMapData(intSelectedData, - &ContactEditorData.PicturesList, &ContactEditorData.PicturesListAltID, &ContactEditorData.PicturesListPID, &ContactEditorData.PicturesListType, - &ContactEditorData.PicturesListPicEncType, &ContactEditorData.PicturesListPictureType, &ContactEditorData.PicturesListTokens, - &ContactEditorData.PicturesListMediatype, &ContactEditorData.PicturesListPref); + DeleteMapData(intSelectedData, + &ContactEditorData.PicturesList, &ContactEditorData.PicturesListAltID, &ContactEditorData.PicturesListPID, &ContactEditorData.PicturesListType, + &ContactEditorData.PicturesListPicEncType, &ContactEditorData.PicturesListPictureType, &ContactEditorData.PicturesListTokens, + &ContactEditorData.PicturesListMediatype, &ContactEditorData.PicturesListPref); - wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png)); - wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG); - PictureImage = (wxBitmap)misc_emptyimage_png; + wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png)); + wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG); + PictureImage = (wxBitmap)misc_emptyimage_png; - imgPicture->SetBitmap(PictureImage); + imgPicture->SetBitmap(PictureImage); + } void frmContactEditor::LoadPicture( wxListEvent& event ) { - long longSelected = -1; - int intSelectedData = 0; - - if (!GetSelectedItem(lboPictures, - &longSelected, - &intSelectedData)){ - return; - } + long longSelected = -1; + int intSelectedData = 0; - std::string base64dec; + if (!GetSelectedItem(lboPictures, + &longSelected, + &intSelectedData)){ + return; + } - std::map::iterator initier; - std::map::iterator pictypeiter; + std::string base64dec; + + std::map::iterator initier; + std::map::iterator pictypeiter; - initier = ContactEditorData.PicturesList.find(intSelectedData); - pictypeiter = ContactEditorData.PicturesListPictureType.find(intSelectedData); + initier = ContactEditorData.PicturesList.find(intSelectedData); + pictypeiter = ContactEditorData.PicturesListPictureType.find(intSelectedData); - base64dec = base64_decode(initier->second); + base64dec = base64_decode(initier->second); - wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size()); - wxImage photo; - //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size()); + wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size()); + wxImage photo; + //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size()); - if (pictypeiter->second == wxT("image/jpeg")){ + if (pictypeiter->second == wxT("image/jpeg")){ - if (!photo.LoadFile(istream, wxBITMAP_TYPE_JPEG)){ + if (!photo.LoadFile(istream, wxBITMAP_TYPE_JPEG)){ - return; + return; - } + } - } else if (pictypeiter->second == wxT("image/png")){ + } else if (pictypeiter->second == wxT("image/png")){ - if (!photo.LoadFile(istream, wxBITMAP_TYPE_PNG)){ + if (!photo.LoadFile(istream, wxBITMAP_TYPE_PNG)){ - return; + return; - } + } - } else if (pictypeiter->second == wxT("image/gif")){ + } else if (pictypeiter->second == wxT("image/gif")){ - if (!photo.LoadFile(istream, wxBITMAP_TYPE_GIF)){ + if (!photo.LoadFile(istream, wxBITMAP_TYPE_GIF)){ - return; + return; - } + } - } else { + } else { - return; + return; - } + } - PictureImage = (wxBitmap)photo; - imgPicture->SetBitmap(PictureImage); + PictureImage = (wxBitmap)photo; + imgPicture->SetBitmap(PictureImage); } -- 2.39.5