Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Splitting frmContactEditor.cpp into 15 files to make it more manageable.
[xestiaab/.git] / source / contacteditor / frmContactEditor-Logo.cpp
1 #include "frmContactEditor.h"
2 #include "frmContactEditorPicture.h"
3 #include "../common/base64.h"
5 void frmContactEditor::LoadLogo( wxListEvent& event )
6 {
7     
8     long longSelected = -1;
9     int intSelectedData = 0;
10     
11     if (!GetSelectedItem(lboLogos,
12                          &longSelected,
13                          &intSelectedData)){
14         return;
15     }
16     
17     std::string base64dec;
18     
19     std::map<int,std::string>::iterator initier;
20     
21     initier = LogosList.find(intSelectedData);
22     
23     base64dec = base64_decode(initier->second);
24     
25     
26     wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
27     wxImage photo;
28     //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
29     
30     if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
31         
32         return;
33         
34     }
35     
36     
37     LogoImage = (wxBitmap)photo;
38     imgLogo->SetBitmap(LogoImage);
39     
40 }
42 void frmContactEditor::AddLogo( wxCommandEvent& event )
43 {
44     int intResult = 0;
45     
46     frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
47     frameCELogo->SetEditorMode(FALSE);
48     intResult = GetLastInt(&LogosList);
49     frameCELogo->SetupPointers(&LogosList,
50                                &LogosListAltID,
51                                &LogosListPID,
52                                &LogosListType,
53                                &LogosListPicEncType,
54                                &LogosListPictureType,
55                                &LogosListTokens,
56                                &LogosListMediatype,
57                                &LogosListPref,
58                                lboLogos,
59                                (intValueSeek));
60     frameCELogo->ShowModal();
61     delete frameCELogo;
62     frameCELogo = NULL;
63 }
65 void frmContactEditor::ModifyLogo( wxCommandEvent& event )
66 {
67     long longSelected = -1;
68     int intSelectedData = 0;
69     
70     if (!GetSelectedItem(lboLogos,
71                          &longSelected,
72                          &intSelectedData)){
73         return;
74     }
75     
76     frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
77     frameCELogo->SetupPointers(&LogosList,
78                                &LogosListAltID,
79                                &LogosListPID,
80                                &LogosListType,
81                                &LogosListPicEncType,
82                                &LogosListPictureType,
83                                &LogosListTokens,
84                                &LogosListMediatype,
85                                &LogosListPref,
86                                lboLogos,
87                                intSelectedData);
88     frameCELogo->SetEditorMode(TRUE);
89     frameCELogo->ShowModal();
90     delete frameCELogo;
91     frameCELogo = NULL;
92 }
94 void frmContactEditor::DeleteLogo( wxCommandEvent& event )
95 {
96     long longSelected = -1;
97     int intSelectedData = 0;
98     
99     if (!GetSelectedItem(lboLogos,
100                          &longSelected,
101                          &intSelectedData)){
102         return;
103     }
104     
105     lboLogos->DeleteItem(longSelected);
106     
107     DeleteMapData(intSelectedData,
108                   &LogosList, &LogosListAltID, &LogosListPID, &LogosListType,
109                   &LogosListPicEncType, &LogosListPictureType, &LogosListTokens,
110                   &LogosListMediatype, &LogosListPref);
111     
112     wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
113     wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
114     LogoImage = (wxBitmap)misc_emptyimage_png;
115     
116     imgLogo->SetBitmap(LogoImage);
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy