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<int,std::string>::iterator initier;
- std::map<int,wxString>::iterator pictypeiter;
+ std::string base64dec;
+
+ std::map<int,std::string>::iterator initier;
+ std::map<int,wxString>::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);
}