void frmContactEditor::LoadLogo( wxListEvent& event )
{
- long longSelected = -1;
- int intSelectedData = 0;
+ long longSelected = -1;
+ int intSelectedData = 0;
- if (!GetSelectedItem(lboLogos,
- &longSelected,
- &intSelectedData)){
- return;
- }
+ if (!GetSelectedItem(lboLogos,
+ &longSelected,
+ &intSelectedData)){
+ return;
+ }
- std::string base64dec;
+ std::string base64dec;
- std::map<int,std::string>::iterator initier;
- std::map<int,wxString>::iterator pictypeiter;
+ std::map<int,std::string>::iterator initier;
+ std::map<int,wxString>::iterator pictypeiter;
- initier = ContactEditorData.LogosList.find(intSelectedData);
- pictypeiter = ContactEditorData.LogosListPictureType.find(intSelectedData);
+ initier = ContactEditorData.LogosList.find(intSelectedData);
+ pictypeiter = ContactEditorData.LogosListPictureType.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;
- }
+ }
- LogoImage = (wxBitmap)photo;
- imgLogo->SetBitmap(LogoImage);
+ LogoImage = (wxBitmap)photo;
+ imgLogo->SetBitmap(LogoImage);
}
void frmContactEditor::AddLogo( wxCommandEvent& event )
{
- int intResult = 0;
-
- frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
- frameCELogo->SetEditorMode(FALSE);
- intResult = GetLastInt(&ContactEditorData.LogosList);
- frameCELogo->SetupPointers(&ContactEditorData.LogosList,
- &ContactEditorData.LogosListAltID,
- &ContactEditorData.LogosListPID,
- &ContactEditorData.LogosListType,
- &ContactEditorData.LogosListPicEncType,
- &ContactEditorData.LogosListPictureType,
- &ContactEditorData.LogosListTokens,
- &ContactEditorData.LogosListMediatype,
- &ContactEditorData.LogosListPref,
- lboLogos,
- (intValueSeek),
- FALSE);
- frameCELogo->ShowModal();
- delete frameCELogo;
- frameCELogo = NULL;
+ int intResult = 0;
+
+ frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
+ frameCELogo->SetEditorMode(FALSE);
+ intResult = GetLastInt(&ContactEditorData.LogosList);
+ frameCELogo->SetupPointers(&ContactEditorData.LogosList,
+ &ContactEditorData.LogosListAltID,
+ &ContactEditorData.LogosListPID,
+ &ContactEditorData.LogosListType,
+ &ContactEditorData.LogosListPicEncType,
+ &ContactEditorData.LogosListPictureType,
+ &ContactEditorData.LogosListTokens,
+ &ContactEditorData.LogosListMediatype,
+ &ContactEditorData.LogosListPref,
+ lboLogos,
+ (intValueSeek),
+ FALSE);
+ frameCELogo->ShowModal();
+ delete frameCELogo;
+ frameCELogo = NULL;
+
}
void frmContactEditor::ModifyLogo( wxCommandEvent& event )
{
- long longSelected = -1;
- int intSelectedData = 0;
+
+ long longSelected = -1;
+ int intSelectedData = 0;
- if (!GetSelectedItem(lboLogos,
- &longSelected,
- &intSelectedData)){
- return;
- }
-
- frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
- frameCELogo->SetupPointers(&ContactEditorData.LogosList,
- &ContactEditorData.LogosListAltID,
- &ContactEditorData.LogosListPID,
- &ContactEditorData.LogosListType,
- &ContactEditorData.LogosListPicEncType,
- &ContactEditorData.LogosListPictureType,
- &ContactEditorData.LogosListTokens,
- &ContactEditorData.LogosListMediatype,
- &ContactEditorData.LogosListPref,
- lboLogos,
- intSelectedData,
- FALSE);
- frameCELogo->SetEditorMode(TRUE);
- frameCELogo->ShowModal();
- delete frameCELogo;
- frameCELogo = NULL;
+ if (!GetSelectedItem(lboLogos,
+ &longSelected,
+ &intSelectedData)){
+ return;
+ }
+
+ frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
+ frameCELogo->SetupPointers(&ContactEditorData.LogosList,
+ &ContactEditorData.LogosListAltID,
+ &ContactEditorData.LogosListPID,
+ &ContactEditorData.LogosListType,
+ &ContactEditorData.LogosListPicEncType,
+ &ContactEditorData.LogosListPictureType,
+ &ContactEditorData.LogosListTokens,
+ &ContactEditorData.LogosListMediatype,
+ &ContactEditorData.LogosListPref,
+ lboLogos,
+ intSelectedData,
+ FALSE);
+ frameCELogo->SetEditorMode(TRUE);
+ frameCELogo->ShowModal();
+ delete frameCELogo;
+ frameCELogo = NULL;
+
}
void frmContactEditor::DeleteLogo( wxCommandEvent& event )
{
- long longSelected = -1;
- int intSelectedData = 0;
+
+ long longSelected = -1;
+ int intSelectedData = 0;
- if (!GetSelectedItem(lboLogos,
- &longSelected,
- &intSelectedData)){
- return;
- }
+ if (!GetSelectedItem(lboLogos,
+ &longSelected,
+ &intSelectedData)){
+ return;
+ }
- lboLogos->DeleteItem(longSelected);
+ lboLogos->DeleteItem(longSelected);
- DeleteMapData(intSelectedData,
- &ContactEditorData.LogosList, &ContactEditorData.LogosListAltID, &ContactEditorData.LogosListPID, &ContactEditorData.LogosListType,
- &ContactEditorData.LogosListPicEncType, &ContactEditorData.LogosListPictureType, &ContactEditorData.LogosListTokens,
- &ContactEditorData.LogosListMediatype, &ContactEditorData.LogosListPref);
+ DeleteMapData(intSelectedData,
+ &ContactEditorData.LogosList, &ContactEditorData.LogosListAltID, &ContactEditorData.LogosListPID, &ContactEditorData.LogosListType,
+ &ContactEditorData.LogosListPicEncType, &ContactEditorData.LogosListPictureType, &ContactEditorData.LogosListTokens,
+ &ContactEditorData.LogosListMediatype, &ContactEditorData.LogosListPref);
- wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
- wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
- LogoImage = (wxBitmap)misc_emptyimage_png;
+ wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
+ wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
+ LogoImage = (wxBitmap)misc_emptyimage_png;
- imgLogo->SetBitmap(LogoImage);
+ imgLogo->SetBitmap(LogoImage);
+
}
void frmContactEditor::SaveLogo( wxCommandEvent &event )