diff --git a/xvaga/oswin32.cpp b/xvaga/oswin32.cpp index 627ee827c..1b5b5c8f9 100755 --- a/xvaga/oswin32.cpp +++ b/xvaga/oswin32.cpp @@ -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 { diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index c1fd7f350..cfd3a97d1 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -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) { diff --git a/xvaga/xvt.h b/xvaga/xvt.h index 3f0e6f82d..eb9d1ffbe 100755 --- a/xvaga/xvt.h +++ b/xvaga/xvt.h @@ -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 diff --git a/xvaga/xvtctl.cpp b/xvaga/xvtctl.cpp index ef9564354..60179ddbe 100755 --- a/xvaga/xvtctl.cpp +++ b/xvaga/xvtctl.cpp @@ -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; } diff --git a/xvaga/xvtextra.cpp b/xvaga/xvtextra.cpp index 4965d0bad..ed6c42915 100755 --- a/xvaga/xvtextra.cpp +++ b/xvaga/xvtextra.cpp @@ -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)