Migliorata gestione stampa immagini trasparenti

git-svn-id: svn://10.65.10.50/branches/R_10_00@22912 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2013-12-13 09:44:16 +00:00
parent 201a3466f2
commit 5def25b304
5 changed files with 70 additions and 8 deletions

View File

@ -984,6 +984,13 @@ bool OsWin32_GotoUrl(const char* url, const char* action)
}
ok = true;
}
} else
if (wxStrstr(url, ".jar"))
{
wxString args; args << "-jar " << url;
HINSTANCE hinst = ::ShellExecute(NULL, NULL, "java.exe", args, NULL, SW_HIDE); // Hide java console
DWORD winst = DWORD((DWORD*)hinst); // Tutto 'sto giro per evitare un warning
ok = UINT(winst) > 32;
}
else
{

View File

@ -59,7 +59,14 @@ wxLocale* _locale = NULL;
static XVT_ERRMSG_HANDLER _error_handler = NULL;
const wxString& _GetAppTitle()
{ return _appl_name; }
{
if (_appl_name.IsEmpty())
{
const wxFileName fn = __argv[0];
_appl_name << "CAMPO: " << fn.GetName();
}
return _appl_name;
}
void _AssertBox(bool test, const char* func, const char* file, int line)
{

View File

@ -116,7 +116,7 @@ XVTDLL void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid);
XVTDLL void xvt_dwin_draw_icon_rect(WINDOW win, RCT* rct, int rid);
XVTDLL void xvt_dwin_draw_gradient_circular(WINDOW win, const RCT* r, COLOR col1, COLOR col2, const PNT* center); // Added by AGA
XVTDLL void xvt_dwin_draw_gradient_linear(WINDOW win, const RCT* r, COLOR col1, COLOR col2, int angle); // Added by AGA
XVTDLL void xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, RCT* dest); // Added by AGA
XVTDLL void xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, const RCT* dest); // Added by AGA
XVTDLL void xvt_dwin_draw_image(WINDOW win, XVT_IMAGE image, const RCT* dest, const RCT* source);
XVTDLL void xvt_dwin_draw_line(WINDOW win, PNT pnt);
XVTDLL void xvt_dwin_draw_oval(WINDOW Win, const RCT* r);
@ -188,7 +188,7 @@ XVTDLL BOOLEAN xvt_fsys_parse_pathname (const char *mbs, char *volname, char *d
XVTDLL void xvt_fsys_restore_dir();
XVTDLL void xvt_fsys_save_dir();
XVTDLL BOOLEAN xvt_fsys_set_dir(const DIRECTORY* dirp);
XVTDLL long xvt_fsys_get_file_attr(const FILE_SPEC *fs, long attr); // Place older
XVTDLL long xvt_fsys_get_file_attr(const FILE_SPEC *fs, long attr);
XVTDLL BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest);
// Added by Guy

View File

@ -2354,6 +2354,7 @@ WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom, lon
wxWindow* pParent = wxStaticCast((wxObject*)parent, wxWindow);
TwxToolBar* tb = new TwxToolBar(pParent, cid, ptPos, wxDefaultSize, nStyle);
tb->SetToolBitmapSize(wxSize(nIcoSize, nIcoSize));
return (WINDOW)tb;
}

View File

@ -473,12 +473,59 @@ BOOLEAN xvt_dm_post_page_setup(PRINT_RCD* precp)
return ok;
}
void xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, RCT* dest)
static wxBitmap& GetCachedBitmap(const wxString& strName, const wxRect& dst)
{
wxASSERT(win == PRINTER_WIN);
const wxRect dst = RCT2Rect(dest);
TwxPDFDC& dc = *wxStaticCast(&GetTDCMapper().GetDC(win), TwxPDFDC);
dc.DrawImage(name, dst);
static wxString _strName;
static wxRect _dst;
static wxBitmap _bmp;
if (strName != _strName || dst.GetSize() != _dst.GetSize())
{
wxImage img;
if (img.LoadFile(strName))
{
if (img.HasAlpha() || img.HasMask())
img.Rescale(dst.width, dst.height, wxIMAGE_QUALITY_NORMAL);
else
img.Rescale(dst.width, dst.height, wxIMAGE_QUALITY_HIGH);
_bmp = wxBitmap(img);
_strName = strName;
_dst = dst;
}
else
{
_bmp = wxNullBitmap;
_strName = "";
_dst.width = _dst.height = 0;
}
}
return _bmp;
}
void xvt_dwin_draw_image_on_pdf(WINDOW win, const char* name, const RCT* dest)
{
const wxRect dst = RCT2Rect(dest);
wxDC& dc = GetTDCMapper().GetDC(win);
if (win == PRINTER_WIN)
{
TwxPDFDC* pPDF = wxDynamicCast(&dc, TwxPDFDC);
if (pPDF != NULL)
{
pPDF->DrawImage(name, dst);
return;
}
}
wxString strName(name); strName.MakeLower();
wxBitmap& bmp = GetCachedBitmap(strName, dst);
if (bmp.IsOk())
{
//wxIcon ico; ico.CopyFromBitmap(bmp);
//dc.DrawIcon(ico, dst.x, dst.y);
wxMemoryDC mem(bmp);
dc.Blit(dst.x, dst.y, dst.width, dst.height, &mem, 0, 0, wxCOPY, true);
}
}
long xvt_fmap_get_family_sizes(PRINT_RCD *precp, char *family, long *size_array, BOOLEAN *scalable, long max_sizes)