Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added Save function stubs for Pictures, Logos and Sounds tab.
[xestiaab/.git] / source / contacteditor / frmContactEditor-Logo.cpp
1 // frmContactEditor-Logo.cpp - frmContactEditor Logo tab subroutines.
2 //
3 // (c) 2012-2015 Xestia Software Development.
4 //
5 // This file is part of Xestia Address Book.
6 //
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
10 //
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #include "frmContactEditor.h"
20 #include "frmContactEditorPicture.h"
21 #include "../common/base64.h"
23 void frmContactEditor::LoadLogo( wxListEvent& event )
24 {
25     
26     long longSelected = -1;
27     int intSelectedData = 0;
28     
29     if (!GetSelectedItem(lboLogos,
30                          &longSelected,
31                          &intSelectedData)){
32         return;
33     }
34     
35     std::string base64dec;
36     
37     std::map<int,std::string>::iterator initier;
38     
39     initier = LogosList.find(intSelectedData);
40     
41     base64dec = base64_decode(initier->second);
42     
43     
44     wxMemoryInputStream istream(base64dec.c_str(), (size_t)base64dec.size());
45     wxImage photo;
46     //wxMemoryInputStream istream(base64dec, (size_t)base64dec.size());
47     
48     if (!photo.LoadFile(istream, wxBITMAP_TYPE_ANY)){
49         
50         return;
51         
52     }
53     
54     
55     LogoImage = (wxBitmap)photo;
56     imgLogo->SetBitmap(LogoImage);
57     
58 }
60 void frmContactEditor::AddLogo( wxCommandEvent& event )
61 {
62     int intResult = 0;
63     
64     frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
65     frameCELogo->SetEditorMode(FALSE);
66     intResult = GetLastInt(&LogosList);
67     frameCELogo->SetupPointers(&LogosList,
68                                &LogosListAltID,
69                                &LogosListPID,
70                                &LogosListType,
71                                &LogosListPicEncType,
72                                &LogosListPictureType,
73                                &LogosListTokens,
74                                &LogosListMediatype,
75                                &LogosListPref,
76                                lboLogos,
77                                (intValueSeek));
78     frameCELogo->ShowModal();
79     delete frameCELogo;
80     frameCELogo = NULL;
81 }
83 void frmContactEditor::ModifyLogo( wxCommandEvent& event )
84 {
85     long longSelected = -1;
86     int intSelectedData = 0;
87     
88     if (!GetSelectedItem(lboLogos,
89                          &longSelected,
90                          &intSelectedData)){
91         return;
92     }
93     
94     frmContactEditorPicture *frameCELogo = new frmContactEditorPicture ( this );
95     frameCELogo->SetupPointers(&LogosList,
96                                &LogosListAltID,
97                                &LogosListPID,
98                                &LogosListType,
99                                &LogosListPicEncType,
100                                &LogosListPictureType,
101                                &LogosListTokens,
102                                &LogosListMediatype,
103                                &LogosListPref,
104                                lboLogos,
105                                intSelectedData);
106     frameCELogo->SetEditorMode(TRUE);
107     frameCELogo->ShowModal();
108     delete frameCELogo;
109     frameCELogo = NULL;
112 void frmContactEditor::DeleteLogo( wxCommandEvent& event )
114     long longSelected = -1;
115     int intSelectedData = 0;
116     
117     if (!GetSelectedItem(lboLogos,
118                          &longSelected,
119                          &intSelectedData)){
120         return;
121     }
122     
123     lboLogos->DeleteItem(longSelected);
124     
125     DeleteMapData(intSelectedData,
126                   &LogosList, &LogosListAltID, &LogosListPID, &LogosListType,
127                   &LogosListPicEncType, &LogosListPictureType, &LogosListTokens,
128                   &LogosListMediatype, &LogosListPref);
129     
130     wxMemoryInputStream istream(misc_emptyimage_png, sizeof(misc_emptyimage_png));
131     wxImage misc_emptyimage_png(istream, wxBITMAP_TYPE_PNG);
132     LogoImage = (wxBitmap)misc_emptyimage_png;
133     
134     imgLogo->SetBitmap(LogoImage);
137 void frmContactEditor::SaveLogo( wxCommandEvent &event )
139         
140         return; 
141         
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