Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Aggiunto supporto per nuovi list-box
Corretta gestione trasparenza immagini
Corretta gestione posta elettronica


git-svn-id: svn://10.65.10.50/trunk@18320 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-02-23 11:44:42 +00:00
parent ff1776e668
commit cbe639d56c
11 changed files with 154 additions and 78 deletions

View File

@ -4,7 +4,7 @@
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// Created: 2001-08-21 // Created: 2001-08-21
// RCS-ID: $Id: email.cpp,v 1.3 2009-02-08 23:36:18 alex Exp $ // RCS-ID: $Id: email.cpp,v 1.4 2009-02-23 11:44:41 guy Exp $
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -39,7 +39,7 @@
// Send a message. // Send a message.
// Specify profile, if empty use MAPI default profile // Specify profile, if empty use MAPI default profile
#ifdef __WXMSW__ #ifdef __WXMSW__
bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wxString& WXUNUSED(sendMail)) bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, bool bUI, const wxString& WXUNUSED(sendMail))
{ {
wxASSERT (message.m_to.GetCount() > 0) ; wxASSERT (message.m_to.GetCount() > 0) ;
@ -52,12 +52,7 @@ bool wxEmail::Send(wxMailMessage& message, const wxString& profileName, const wx
if (!session.Logon(profile)) if (!session.Logon(profile))
return FALSE; return FALSE;
bool Has_Valid_Address = false; return session.Send(message, bUI);
for (unsigned int i = 0; !Has_Valid_Address && i < message.m_to.GetCount(); i++)
Has_Valid_Address = !message.m_to[i].empty();
return session.Send(message, Has_Valid_Address);
} }
#elif defined(__UNIX__) #elif defined(__UNIX__)
bool bool

View File

@ -4,7 +4,7 @@
// Author: Julian Smart // Author: Julian Smart
// Modified by: // Modified by:
// Created: 2001-08-21 // Created: 2001-08-21
// RCS-ID: $Id: email.h,v 1.2 2008-03-11 15:43:15 alex Exp $ // RCS-ID: $Id: email.h,v 1.3 2009-02-23 11:44:41 guy Exp $
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -30,7 +30,7 @@ public:
// Send a message. // Send a message.
// Specify profile, or leave it to wxWidgets to find the current user name // Specify profile, or leave it to wxWidgets to find the current user name
static bool Send(wxMailMessage& message, const wxString& profileName = wxEmptyString, static bool Send(wxMailMessage& message, const wxString& profileName = wxEmptyString,
const wxString& sendMail = wxT("/usr/sbin/sendmail -t")); bool bShowUI = false, const wxString& sendMail = wxT("/usr/sbin/sendmail -t"));
protected: protected:
}; };

View File

@ -867,9 +867,8 @@ static bool IsInternetAddress(const char* filename)
return false; return false;
} }
unsigned int OsWin32_LoadIcon(const char* filename) wxIcon* OsWin32_LoadIcon(const char* filename)
{ {
unsigned int icon = 0;
int icon_number = 0; int icon_number = 0;
wxString ext; wxString ext;
@ -914,7 +913,10 @@ unsigned int OsWin32_LoadIcon(const char* filename)
const int ext_pos = key.Find(".exe"); const int ext_pos = key.Find(".exe");
if (ext_pos > 0) if (ext_pos > 0)
key.Truncate(ext_pos+4); key.Truncate(ext_pos+4);
wxIcon* ico = new wxIcon;
/*
int icon = 0;
HINSTANCE hInst = NULL; HINSTANCE hInst = NULL;
HICON hicon = ::ExtractIcon(hInst, key, icon_number); HICON hicon = ::ExtractIcon(hInst, key, icon_number);
if (hicon == NULL && icon_number != 0) if (hicon == NULL && icon_number != 0)
@ -924,8 +926,14 @@ unsigned int OsWin32_LoadIcon(const char* filename)
DWORD dwicon = DWORD((DWORD*)hicon); DWORD dwicon = DWORD((DWORD*)hicon);
icon = LOWORD(dwicon); icon = LOWORD(dwicon);
} }
ico->SetHandle(icon);
*/
wxString strFullName = key;
if (icon_number > 0)
strFullName << ";" << icon_number;
ico->LoadFile(strFullName, wxBITMAP_TYPE_ICO, 32, 32);
return icon; return ico;
} }
// action = [ open, edit, print ]; // action = [ open, edit, print ];

View File

@ -8,7 +8,7 @@ void OsWin32_DrawDottedRect(WXHDC hDC, int left, int top, int right, int bottom)
wxString OsWin32_File2App(const char* filename); wxString OsWin32_File2App(const char* filename);
bool OsWin32_GotoUrl(const char* url, const char* action); bool OsWin32_GotoUrl(const char* url, const char* action);
unsigned int OsWin32_LoadIcon(const char* file); wxIcon* OsWin32_LoadIcon(const char* file);
int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count); int OsWin32_EnumerateFamilies(WXHDC hDC, char** families, int max_count);
int OsWin32_EnumerateSizes(WXHDC hDC, const char* name, long* sizes, short* scalable, int max_count); int OsWin32_EnumerateSizes(WXHDC hDC, const char* name, long* sizes, short* scalable, int max_count);

View File

@ -4,7 +4,7 @@
// Author: PJ Naughter <pjna@naughter.com> // Author: PJ Naughter <pjna@naughter.com>
// Modified by: Julian Smart // Modified by: Julian Smart
// Created: 2001-08-21 // Created: 2001-08-21
// RCS-ID: $Id: smapi.cpp,v 1.2 2008-03-11 15:43:15 alex Exp $ // RCS-ID: $Id: smapi.cpp,v 1.3 2009-02-23 11:44:41 guy Exp $
// Copyright: (c) PJ Naughter // Copyright: (c) PJ Naughter
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -281,7 +281,7 @@ bool wxMapiSession::Resolve(const wxString& sName, void* lppRecip1)
return (nError == SUCCESS_SUCCESS); return (nError == SUCCESS_SUCCESS);
} }
bool wxMapiSession::Send(wxMailMessage& message, bool hide_ui) bool wxMapiSession::Send(wxMailMessage& message, bool show_ui)
{ {
wxASSERT(MapiInstalled()); //MAPI must be installed wxASSERT(MapiInstalled()); //MAPI must be installed
wxASSERT(m_data->m_lpfnMAPISendMail); //Function pointer must be valid wxASSERT(m_data->m_lpfnMAPISendMail); //Function pointer must be valid
@ -453,7 +453,7 @@ bool wxMapiSession::Send(wxMailMessage& message, bool hide_ui)
} }
//Do the actual send using MAPISendMail //Do the actual send using MAPISendMail
ULONG nError = m_data->m_lpfnMAPISendMail(m_data->m_hSession, 0, &mapiMessage, hide_ui ? 0 : MAPI_DIALOG, 0); ULONG nError = m_data->m_lpfnMAPISendMail(m_data->m_hSession, 0, &mapiMessage, show_ui ? MAPI_DIALOG : 0, 0);
if (nError == SUCCESS_SUCCESS) if (nError == SUCCESS_SUCCESS)
{ {
bSuccess = TRUE; bSuccess = TRUE;

View File

@ -4,7 +4,7 @@
// Author: PJ Naughter <pjna@naughter.com> // Author: PJ Naughter <pjna@naughter.com>
// Modified by: Julian Smart // Modified by: Julian Smart
// Created: 2001-08-21 // Created: 2001-08-21
// RCS-ID: $Id: smapi.h,v 1.2 2008-03-11 15:43:15 alex Exp $ // RCS-ID: $Id: smapi.h,v 1.3 2009-02-23 11:44:41 guy Exp $
// Copyright: (c) PJ Naughter // Copyright: (c) PJ Naughter
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -30,7 +30,7 @@ public:
bool Logoff(); bool Logoff();
//Send a message //Send a message
bool Send(wxMailMessage& message, bool hide_ui); bool Send(wxMailMessage& message, bool show_ui);
//General MAPI support //General MAPI support
bool MapiInstalled() const; bool MapiInstalled() const;

View File

@ -1137,9 +1137,12 @@ IMPLEMENT_DYNAMIC_CLASS(TXVT_IMAGE, wxImage);
#define CAST_TIMAGE(xvtimg, img) TXVT_IMAGE* img = wxDynamicCast(xvtimg, TXVT_IMAGE); #define CAST_TIMAGE(xvtimg, img) TXVT_IMAGE* img = wxDynamicCast(xvtimg, TXVT_IMAGE);
#define CAST_IMAGE(xvtimg, img) const wxImage* img = wxDynamicCast(xvtimg, wxImage); #define CAST_IMAGE(xvtimg, img) const wxImage* img = wxDynamicCast(xvtimg, wxImage);
// Chissa' perche' non esiste la GetRGB
COLOR TXVT_IMAGE::GetPixel(int x, int y) const COLOR TXVT_IMAGE::GetPixel(int x, int y) const
{ {
// Chissa' perche' non esiste la GetRGB if (IsTransparent(x, y))
return XVT_MAKE_COLOR(GetMaskRed(), GetMaskGreen(), GetMaskBlue());
const long pos = XYToIndex(x, y) * 3; const long pos = XYToIndex(x, y) * 3;
unsigned char* data = GetData() + pos; unsigned char* data = GetData() + pos;
return XVT_MAKE_COLOR(data[0], data[1], data[2]); return XVT_MAKE_COLOR(data[0], data[1], data[2]);
@ -2416,6 +2419,8 @@ BOOLEAN xvt_fsys_set_dir(const DIRECTORY *dirp)
// Images // Images
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
inline bool XVT_SAME_COLOR(COLOR col1, COLOR col2) { return (col1 & 0x00FFFFFF) == (col2 & 0x00FFFFFF); }
XVT_IMAGE xvt_image_capture(WINDOW win, const RCT* src) XVT_IMAGE xvt_image_capture(WINDOW win, const RCT* src)
{ {
wxRect r; wxRect r;
@ -2573,13 +2578,13 @@ void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color)
wxImage& bmp = i->Image(); // Set dirty! wxImage& bmp = i->Image(); // Set dirty!
unsigned char ri, gi, bi; const COLOR old_trans = XVT_MAKE_COLOR(bmp.GetMaskRed(), bmp.GetMaskGreen(), bmp.GetMaskBlue());
bmp.GetOrFindMaskColour(&ri,&gi, &bi); const int idx = xvt_image_find_clut_index(image, old_trans);
const int idx = xvt_image_find_clut_index(image, XVT_MAKE_COLOR(ri, gi, bi));
if (idx == index) if (idx == index)
bmp.SetMaskColour(c.Red(), c.Green(), c.Blue()); bmp.SetMaskColour(c.Red(), c.Green(), c.Blue());
const wxPalette& pal = bmp.GetPalette(); const wxPalette& pal = bmp.GetPalette();
unsigned char ri, gi, bi;
pal.GetRGB(index, &ri, &gi, &bi); pal.GetRGB(index, &ri, &gi, &bi);
const COLOR old_color = XVT_MAKE_COLOR(ri, gi, bi); const COLOR old_color = XVT_MAKE_COLOR(ri, gi, bi);
@ -2588,12 +2593,54 @@ void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color)
for (int y = 0; y < h; y++) for (int x = 0; x < w; x++) for (int y = 0; y < h; y++) for (int x = 0; x < w; x++)
{ {
const COLOR rgb = i->GetPixel(x, y); const COLOR rgb = i->GetPixel(x, y);
if (rgb == old_color) if (XVT_SAME_COLOR(rgb, old_color))
i->SetPixel(x, y, color); i->SetPixel(x, y, color);
} }
} }
} }
void xvt_image_replace_color(XVT_IMAGE image, COLOR old_color, COLOR new_color)
{
CAST_TIMAGE(image, i);
if (i != NULL && i->Ok())
{
if (i->HasPalette())
{
int index = -1;
while (true)
{
const int idx = xvt_image_find_clut_index(image, old_color);
if (idx > index)
{
xvt_image_set_clut(image, idx, new_color);
index = idx;
}
else
break;
}
}
else
{
wxImage& bmp = i->Image(); // Set dirty!
const COLOR old_trans = XVT_MAKE_COLOR(bmp.GetMaskRed(), bmp.GetMaskGreen(), bmp.GetMaskBlue());
const int w = bmp.GetWidth();
const int h = bmp.GetHeight();
for (int y = 0; y < h; y++) for (int x = 0; x < w; x++)
{
const COLOR rgb = i->GetPixel(x, y);
if (XVT_SAME_COLOR(rgb, old_color))
i->SetPixel(x, y, new_color);
}
// Imposto la nuova trasparenza se cambiata
if (XVT_SAME_COLOR(old_trans, old_color))
bmp.SetMaskColour(XVT_COLOR_GET_RED(new_color), XVT_COLOR_GET_GREEN(new_color), XVT_COLOR_GET_BLUE(new_color));
}
}
}
void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors) void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors)
{ {
// SORRY_BOX(); // SORRY_BOX();
@ -2832,7 +2879,7 @@ void xvt_menu_set_tree(WINDOW win, MENU_ITEM* tree)
void xvt_menu_update(WINDOW /*win*/) void xvt_menu_update(WINDOW /*win*/)
{ {
wxMenuBar* bar = _task_win->GetMenuBar(); wxMenuBar* bar = _task_win != NULL ? _task_win->GetMenuBar() : NULL;
if (bar) if (bar)
bar->Refresh(); bar->Refresh();
} }
@ -2981,10 +3028,18 @@ XVT_FNTID xvt_res_get_font(int rid)
XVT_IMAGE xvt_res_get_icon(int rid) XVT_IMAGE xvt_res_get_icon(int rid)
{ {
const wxString strFileName = _GetResourceName("Icon", rid); const wxIcon& icon = _GetIconResource(rid);
const bool ok = !strFileName.IsEmpty(); int w = icon.GetWidth(); if (w <= 0) w = 32;
XVT_ASSERT(ok); int h = icon.GetHeight(); if (h <= 0) h = 32;
return ok ? xvt_image_read(strFileName) : NULL; wxBitmap bmp(w, h, icon.GetDepth());
{
wxMemoryDC dc(bmp);
dc.DrawIcon(icon, 0, 0);
}
XVT_IMAGE_FORMAT xif = bmp.GetDepth()>8 ? XVT_IMAGE_RGB : XVT_IMAGE_CL8;
XVT_IMAGE img = xvt_image_create(xif, w, h, 0);
((TXVT_IMAGE*)img)->Image() = bmp.ConvertToImage();
return img;
} }
XVT_IMAGE xvt_res_get_image(int rid) XVT_IMAGE xvt_res_get_image(int rid)
@ -3817,12 +3872,7 @@ unsigned int xvt_sys_load_icon(const char* file)
else else
{ {
#ifdef WIN32 #ifdef WIN32
WXHICON hicon = (WXHICON)OsWin32_LoadIcon(file); icon = OsWin32_LoadIcon(file);
if (hicon)
{
icon = new wxIcon;
icon->SetHICON(hicon);
}
#else #else
icon = new wxIcon; icon = new wxIcon;
#endif #endif
@ -3916,14 +3966,14 @@ void xvt_sys_sleep(unsigned long msec)
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// XVT system calls (added by Alex) // XVT system calls
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
XVTDLL BOOLEAN xvt_sys_get_env(const char* varname, char* value, int max_size) XVTDLL BOOLEAN xvt_sys_get_env(const char* varname, char* value, int max_size)
{ {
const wxString strName(varname); const wxString strName(varname);
wxString strValue; wxString strValue;
const BOOLEAN ok = wxGetEnv(strName, &strValue); const bool ok = wxGetEnv(strName, &strValue);
if (ok) if (ok)
wxStrncpy(value, strValue, max_size); wxStrncpy(value, strValue, max_size);
return ok; return ok;
@ -4313,8 +4363,11 @@ void xvt_vobj_maximize(WINDOW win)
else else
{ {
CAST_WIN(win, w); CAST_WIN(win, w);
wxWindow* parent = w.GetParent();
if (parent == NULL)
parent = _task_win;
int width, height; int width, height;
_task_win->GetClientSize(&width, &height); parent->GetClientSize(&width, &height);
w.SetSize(0, 0, width, height); w.SetSize(0, 0, width, height);
} }
} }

View File

@ -207,6 +207,7 @@ XVTDLL short xvt_image_get_ncolors(XVT_IMAGE image);
XVTDLL COLOR xvt_image_get_pixel(XVT_IMAGE image, short x, short y); XVTDLL COLOR xvt_image_get_pixel(XVT_IMAGE image, short x, short y);
XVTDLL XVT_IMAGE xvt_image_read(const char *filenamep); XVTDLL XVT_IMAGE xvt_image_read(const char *filenamep);
XVTDLL XVT_IMAGE xvt_image_read_bmp(const char *filenamep); XVTDLL XVT_IMAGE xvt_image_read_bmp(const char *filenamep);
XVTDLL void xvt_image_replace_color(XVT_IMAGE image, COLOR old_color, COLOR new_color);
XVTDLL void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color); XVTDLL void xvt_image_set_clut(XVT_IMAGE image, short index, COLOR color);
XVTDLL void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors); XVTDLL void xvt_image_set_ncolors(XVT_IMAGE image, short ncolors);
XVTDLL void xvt_image_set_pixel(XVT_IMAGE image, short x, short y, COLOR color); XVTDLL void xvt_image_set_pixel(XVT_IMAGE image, short x, short y, COLOR color);

View File

@ -12,12 +12,23 @@
// Utility functions // Utility functions
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
static wxBitmap Image2Bitmap(XVT_IMAGE image, BOOLEAN trans) static wxBitmap Image2Bitmap(XVT_IMAGE image, int maxx, int maxy, BOOLEAN trans)
{ {
if (image == NULL) if (image == NULL)
return wxNullBitmap; return wxNullBitmap;
wxImage& img = *(wxImage*)image; wxImage& img = *(wxImage*)image;
int w = img.GetWidth(), h = img.GetHeight();
if (w > maxx || h > maxy)
{
const double mx = (maxx / 4) * 4, my = (maxy / 4) * 4;
const double rx = mx / w, ry = my / h;
const double r = rx < ry ? rx : ry;
w = int(w * r); h = int(h * r);
img.Rescale(w, h, wxIMAGE_QUALITY_HIGH);
}
if (trans && !img.HasMask()) if (trans && !img.HasMask())
{ {
const int r = img.GetRed(0,0); const int r = img.GetRed(0,0);
@ -217,7 +228,8 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
case WC_HSCROLL: /* horizontal scrollbar control */ case WC_HSCROLL: /* horizontal scrollbar control */
case WC_VSCROLL: /* vertical scrollbar control */ case WC_VSCROLL: /* vertical scrollbar control */
{ {
const long style = win_def_p->wtype == WC_HSCROLL ? wxSB_HORIZONTAL : wxSB_VERTICAL; long style = win_def_p->wtype == WC_HSCROLL ? wxSB_HORIZONTAL : wxSB_VERTICAL;
style |= wxCLIP_SIBLINGS;
TwxScrollBar* sb = new TwxScrollBar(pParent, id, rct.GetPosition(), rct.GetSize(), style); TwxScrollBar* sb = new TwxScrollBar(pParent, id, rct.GetPosition(), rct.GetSize(), style);
win = (WINDOW)sb; win = (WINDOW)sb;
} }
@ -242,19 +254,15 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
{ {
wxButton* pb = NULL; wxButton* pb = NULL;
if (win_def_p->text && *win_def_p->text) // Bottone normale con label if (win_def_p->text && *win_def_p->text) // Bottone normale con label
{
pb = new wxButton(pParent, id, win_def_p->text, rct.GetPosition(), rct.GetSize()); pb = new wxButton(pParent, id, win_def_p->text, rct.GetPosition(), rct.GetSize());
}
else else
{ // Bottone figo con immagini
pb = new wxBitmapButton(pParent, id, wxNullBitmap, rct.GetPosition(), rct.GetSize()); pb = new wxBitmapButton(pParent, id, wxNullBitmap, rct.GetPosition(), rct.GetSize());
}
win = (WINDOW)pb; win = (WINDOW)pb;
} }
break; break;
case WC_CHECKBOX: /* check box */ case WC_CHECKBOX: /* check box */
{ {
long style = wxCHK_2STATE; long style = wxCHK_2STATE | wxCLIP_SIBLINGS;
if (win_def_p->wtype == CTL_FLAG_RIGHT_JUST) if (win_def_p->wtype == CTL_FLAG_RIGHT_JUST)
style |= wxALIGN_RIGHT; style |= wxALIGN_RIGHT;
wxCheckBox* cb = new wxCheckBox(pParent, id, win_def_p->text, wxCheckBox* cb = new wxCheckBox(pParent, id, win_def_p->text,
@ -264,7 +272,7 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
break; break;
case WC_RADIOBUTTON: /* radio button */ case WC_RADIOBUTTON: /* radio button */
{ {
long style = wxRB_SINGLE | wxCLIP_SIBLINGS; const long style = wxRB_SINGLE | wxCLIP_SIBLINGS;
wxRadioButton* rb = new wxRadioButton(pParent, id, win_def_p->text, wxRadioButton* rb = new wxRadioButton(pParent, id, win_def_p->text,
rct.GetPosition(), rct.GetSize(), style); rct.GetPosition(), rct.GetSize(), style);
win = (WINDOW)rb; win = (WINDOW)rb;
@ -403,7 +411,8 @@ void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
wxBitmapButton* pb = wxDynamicCast((wxObject*)win, wxBitmapButton); wxBitmapButton* pb = wxDynamicCast((wxObject*)win, wxBitmapButton);
if (pb != NULL) if (pb != NULL)
{ {
wxBitmap bmpUp(Image2Bitmap(up, TRUE)); int mx, my; pb->GetSize(&mx, &my);
wxBitmap bmpUp(Image2Bitmap(up, mx, my, TRUE));
if (bmpUp.Ok()) if (bmpUp.Ok())
{ {
pb->SetBitmapLabel(bmpUp); pb->SetBitmapLabel(bmpUp);
@ -413,7 +422,7 @@ void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down)
} }
if (down != NULL) if (down != NULL)
{ {
wxBitmap bmpDown(Image2Bitmap(down, TRUE)); wxBitmap bmpDown(Image2Bitmap(down, mx, my, TRUE));
if (bmpDown.Ok()) if (bmpDown.Ok())
pb->SetBitmapSelected(bmpDown); pb->SetBitmapSelected(bmpDown);
} }
@ -647,13 +656,9 @@ void TwxNoteBook::OnPageChanged(wxAuiNotebookEvent& evt)
short TwxNoteBook::AddTab(wxWindow* pPage, const wxString text, XVT_IMAGE xvt_img, short idx) short TwxNoteBook::AddTab(wxWindow* pPage, const wxString text, XVT_IMAGE xvt_img, short idx)
{ {
wxBitmap bmp; wxBitmap bmp;
if (xvt_img != NULL) if (xvt_img != NULL)
{ bmp = Image2Bitmap(xvt_img, BOOK_ICO_SIZE, BOOK_ICO_SIZE, TRUE);
wxImage& img = *wxStaticCast(xvt_img, wxImage);
img.Rescale(BOOK_ICO_SIZE, BOOK_ICO_SIZE, wxIMAGE_QUALITY_HIGH);
bmp = Image2Bitmap(xvt_img, true);
}
if (idx < 0 || idx >= (int)GetPageCount()) if (idx < 0 || idx >= (int)GetPageCount())
{ {
AddPage(pPage, text, false, bmp); AddPage(pPage, text, false, bmp);
@ -1701,7 +1706,7 @@ void TwxPopUp::OnKeyDown(wxKeyEvent& evt)
} }
TwxPopUp::TwxPopUp(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size) TwxPopUp::TwxPopUp(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size)
: wxVListBox(parent, id, pos, size, wxBORDER|wxPOPUP_WINDOW|wxCLIP_SIBLINGS), : wxVListBox(parent, id, pos, size, wxBORDER|wxCLIP_SIBLINGS),
m_nHovering(wxNOT_FOUND) m_nHovering(wxNOT_FOUND)
{ {
m_clrFore = wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT); m_clrFore = wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT);
@ -1788,13 +1793,15 @@ MENU_TAG xvt_list_popup(WINDOW parent_win, const RCT* ownrct, const MENU_ITEM* m
} }
if (sel >= 0) if (sel >= 0)
lb->SetSelection(sel); lb->SetSelection(sel);
lb->Show(); lb->Show();
lb->SetFocus(); lb->SetFocus();
while (lb->IsShown()) while (lb->IsShown())
{ {
wxApp* a = wxTheApp; // Memorizzo il risultato di wxGetInstance wxApp* a = wxTheApp; // Memorizzo il risultato di wxGetInstance
while (a->Pending()) while (a->Pending())
a->Dispatch(); a->Dispatch();
lb->Raise();
wxMilliSleep(50);
} }
sel = lb->GetSelection(); sel = lb->GetSelection();
delete lb; delete lb;

View File

@ -831,7 +831,6 @@ BOOLEAN xvt_print_restart_thread()
return TRUE; return TRUE;
} }
BOOLEAN xvt_print_open_page(PRINT_RCD* precp) BOOLEAN xvt_print_open_page(PRINT_RCD* precp)
{ {
BOOLEAN ok = m_PrintoutCache.Printing(); BOOLEAN ok = m_PrintoutCache.Printing();

View File

@ -1,38 +1,51 @@
#include "wxinc.h" #include "wxinc.h"
#include "xvt.h" #include "xvt.h"
#include <wx/tokenzr.h>
#include "msg.h" #include "msg.h"
#include "email.h" #include "email.h"
#include <wx/tokenzr.h>
BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn, BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
const char* subject, const char* msg, const char* subject, const char* msg,
const char* attach, BOOLEAN ui) const char* attach, BOOLEAN ui)
{ {
xvt_fsys_save_dir();
wxStringTokenizer tokTo(to, _T(";")); wxStringTokenizer tokTo(to, _T(";"));
wxStringTokenizer tokAttach(attach, _T(";")); wxMailMessage Msg(subject, tokTo.GetNextToken(), msg);
wxMailMessage Msg(subject, tokTo.GetNextToken(), msg, wxEmptyString, tokAttach.GetNextToken());
while (tokTo.HasMoreTokens()) while (tokTo.HasMoreTokens())
Msg.AddTo(tokTo.GetNextToken()); Msg.AddTo(tokTo.GetNextToken());
if (Msg.m_to[0].IsEmpty())
{
Msg.m_to[0] = " "; // Il destinatario "" fa piantare MAPI con errore 25
ui = TRUE; // Forza user interface in assenza di recipient
}
while (tokAttach.HasMoreTokens()) if (attach && *attach)
Msg.AddAttachment(tokAttach.GetNextToken()); {
wxStringTokenizer tokAttach(attach, _T(";"));
while (tokAttach.HasMoreTokens())
Msg.AddAttachment(tokAttach.GetNextToken());
}
wxStringTokenizer Tok(cc, _T(";")); if (cc && *cc)
{
wxStringTokenizer Tok(cc, _T(";"));
while (Tok.HasMoreTokens())
Msg.AddCc(Tok.GetNextToken());
}
while (Tok.HasMoreTokens()) if (ccn && *ccn)
Msg.AddCc(Tok.GetNextToken()); {
wxStringTokenizer Tok(ccn, _T(";"));
Tok.SetString(ccn, _T(";")); while (Tok.HasMoreTokens())
Msg.AddBcc(Tok.GetNextToken());
}
xvt_fsys_save_dir();
wxEmail Mail;
BOOLEAN ok = Mail.Send(Msg, wxEmptyString, ui != 0);
xvt_fsys_restore_dir();
while (Tok.HasMoreTokens()) return ok;
Msg.AddBcc(Tok.GetNextToken());
wxEmail Mail;
BOOLEAN ok = Mail.Send(Msg);
xvt_fsys_restore_dir();
return ok;
} }