From 28310e3bd5ad978b916dd18acc22d9498e98c1d2 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 12 Nov 2009 15:14:03 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : xvaga.dll ba0 Ricompilazione Demo : [ ] Commento : Aggiunto metodo deflate ai rettangoli (c'era solo inflate) git-svn-id: svn://10.65.10.50/trunk@19616 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/xvaga.cpp | 15 +++++++++++--- xvaga/xvt.h | 3 ++- xvaga/xvtart.cpp | 53 ++++++++++++++++++++++++++++++++---------------- 3 files changed, 50 insertions(+), 21 deletions(-) diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index 7cc0fbf2f..fb2a14407 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -1942,9 +1942,9 @@ XVT_IMAGE_FORMAT xvt_image_get_format(XVT_IMAGE image) short xvt_image_get_ncolors(XVT_IMAGE image) { int n = 0; - CAST_IMAGE(image, i); - if (i != NULL && i->Ok() && i->HasPalette()) - { + if (xvt_image_get_format(image) == XVT_IMAGE_CL8) + { + CAST_IMAGE(image, i); const wxPalette& pal = i->GetPalette(); unsigned char r, g, b; for (n = 16; n < 256; n++) @@ -2421,6 +2421,15 @@ BOOLEAN xvt_rect_set_pos(RCT *rctp, PNT pos) return ok; } +void xvt_rect_deflate(RCT *rctp, short ix, short iy) +{ + if (rctp != NULL) + { + rctp->left += ix; rctp->right -= ix; + rctp->top += iy; rctp->bottom -= iy; + } +} + void xvt_rect_inflate(RCT *rctp, short ix, short iy) { if (rctp != NULL) diff --git a/xvaga/xvt.h b/xvaga/xvt.h index eff057ee9..a7e48d914 100755 --- a/xvaga/xvt.h +++ b/xvaga/xvt.h @@ -297,9 +297,11 @@ XVTDLL BOOLEAN xvt_print_restart_thread(); XVTDLL BOOLEAN xvt_print_is_pdf(const PRINT_RCD* precp); XVTDLL BOOLEAN xvt_print_pdf_version(char* version, int size); +XVTDLL void xvt_rect_deflate(RCT *rctp, short ix, short iy); XVTDLL int xvt_rect_get_height(const RCT *rctp); XVTDLL int xvt_rect_get_width(const RCT *rctp); XVTDLL BOOLEAN xvt_rect_has_point(const RCT *rctp, PNT pnt); +XVTDLL void xvt_rect_inflate(RCT *rctp, short ix, short iy); XVTDLL BOOLEAN xvt_rect_intersect(RCT *drctp, const RCT *rctp1, const RCT *rctp2); XVTDLL BOOLEAN xvt_rect_is_empty(const RCT *rctp); XVTDLL void xvt_rect_offset(RCT *rctp, short dh, short dv); @@ -307,7 +309,6 @@ XVTDLL void xvt_rect_set(RCT *rctp, short left, short top, short right, shor XVTDLL void xvt_rect_set_empty(RCT *rctp); XVTDLL void xvt_rect_set_null(RCT* rctp); XVTDLL BOOLEAN xvt_rect_set_pos(RCT *rctp, PNT pos); -XVTDLL void xvt_rect_inflate(RCT *rctp, short ix, short iy); XVTDLL void xvt_res_free_menu_tree(MENU_ITEM* tree); XVTDLL XVT_FNTID xvt_res_get_font(int rid); diff --git a/xvaga/xvtart.cpp b/xvaga/xvtart.cpp index 8e724c410..ea4f865c7 100755 --- a/xvaga/xvtart.cpp +++ b/xvaga/xvtart.cpp @@ -28,15 +28,26 @@ wxString xvtart_GetResourceName(const char* type, int rid) if ((rid == ICON_RSRC || rid == 0) && strName == "Icons") { - char name[MAX_PATH]; - if (xvt_sys_get_oem_string("Icon", "", name, sizeof(name))) + int i = 1; + switch (xvt_sys_get_os_version()) { - wxFileName fname(startup_dir + "/setup/" + name); - if (fname.FileExists()) + case XVT_WS_WIN_2000: + case XVT_WS_WIN_2003: i = 0; break; // Cerco prima l'icona a 256 colori + default : i = 1; break; // Cerco solo l'icona in RGBA + } + for (; i < 2; i++) + { + const char* const oem_var = i == 0 ? "Icon256" : "Icon"; + char name[MAX_PATH]; + if (xvt_sys_get_oem_string(oem_var, "", name, sizeof(name))) { - fname.Normalize(); - strName = fname.GetFullPath().Lower(); - return strName; + wxFileName fname(startup_dir + "/setup/" + name); + if (fname.FileExists()) + { + fname.Normalize(); + strName = fname.GetFullPath().Lower(); + return strName; + } } } } @@ -232,20 +243,28 @@ wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient wxSize TArtProvider::GetNativeSizeHint(const wxArtClient& client) { + int ix = 32, iy = 32; + if (client == wxART_FRAME_ICON) { - const int ix = wxSystemSettings::GetMetric(wxSYS_SMALLICON_X); - const int iy = wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y); - return wxSize(ix,iy); + const int x = wxSystemSettings::GetMetric(wxSYS_SMALLICON_X); + const int y = wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y); + if (x > 0 && y > 0) + { ix = x; iy = y; } + else + { ix /= 2; iy /= 2; } + } + else + { + const int x = wxSystemSettings::GetMetric(wxSYS_ICON_X); + const int y = wxSystemSettings::GetMetric(wxSYS_ICON_Y); + if (x > 0 && y > 0) + { ix = x; iy = y; } + if (client == wxART_MESSAGE_BOX) + { ix *= 2; iy *= 2; } } - - const int ix = wxSystemSettings::GetMetric(wxSYS_ICON_X); - const int iy = wxSystemSettings::GetMetric(wxSYS_ICON_Y); - - if (client == wxART_MESSAGE_BOX) - return wxSize(ix*2,iy*2); - return wxSize(ix, iy); + return wxSize(ix,iy); } wxIconBundle TArtProvider::GetIconBundle(const wxArtID& id, const wxArtClient& client)