Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Coretta gestione maiuscole dei nomi delle icone


git-svn-id: svn://10.65.10.50/trunk@19500 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-10-22 16:06:48 +00:00
parent d77efa3d27
commit 109c64286f
4 changed files with 89 additions and 41 deletions

View File

@ -221,19 +221,21 @@ class TPopUpBox : public wxDialog
{
DECLARE_EVENT_TABLE();
wxTimer m_Timer;
int m_nStep;
int m_nStep, m_nTimeout;
protected:
void OnTimer(wxTimerEvent& evt);
void OnChar(wxKeyEvent& evt);
void OnClick(wxMouseEvent& evt);
public:
TPopUpBox(wxWindow* pParent, const wxString& msg, int nStyle);
TPopUpBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout);
};
BEGIN_EVENT_TABLE(TPopUpBox, wxDialog)
EVT_TIMER(wxID_ANY, TPopUpBox::OnTimer)
EVT_CHAR(TPopUpBox::OnChar)
EVT_LEFT_DOWN(TPopUpBox::OnClick)
END_EVENT_TABLE()
void TPopUpBox::OnChar(wxKeyEvent& WXUNUSED(evt))
@ -242,6 +244,13 @@ void TPopUpBox::OnChar(wxKeyEvent& WXUNUSED(evt))
EndModal(wxID_CANCEL);
}
void TPopUpBox::OnClick(wxMouseEvent& WXUNUSED(evt))
{
if (IsShown())
EndModal(wxID_CANCEL);
}
void TPopUpBox::OnTimer(wxTimerEvent& WXUNUSED(evt))
{
if (IsShown())
@ -249,32 +258,36 @@ void TPopUpBox::OnTimer(wxTimerEvent& WXUNUSED(evt))
const wxRect rctMain = GetParent()->GetRect();
const wxRect rctMine = GetRect();
const int msec = (m_nStep++)*m_Timer.GetInterval();
if (msec <= 1000)
if (msec <= m_nTimeout/4)
{
const int perc = msec/10;
Move(rctMain.x, rctMain.GetBottom() - rctMine.height * perc / 100);
const double perc = double(msec)/(m_nTimeout/4);
Move(rctMain.x, rctMain.GetBottom() - rctMine.height * perc);
}
if (msec >= 3000 && msec <= 4000)
if (msec >= 3*m_nTimeout/4 && msec <= m_nTimeout)
{
const int perc = (4000-msec)/10;
Move(rctMain.x, rctMain.GetBottom() - rctMine.height * perc / 100);
const double perc = double(m_nTimeout-msec)/(m_nTimeout/4);
Move(rctMain.x, rctMain.GetBottom() - rctMine.height * perc);
}
if (msec > 4000)
if (msec > m_nTimeout)
{
m_Timer.Stop();
EndModal(wxID_CANCEL);
}
}
}
TPopUpBox::TPopUpBox(wxWindow* pParent, const wxString& msg, int nStyle)
TPopUpBox::TPopUpBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout)
: wxDialog(pParent, wxID_ANY, wxEmptyString, wxPoint(0,2024), wxDefaultSize, wxBORDER_SIMPLE),
m_Timer(this), m_nStep(0)
m_nTimeout(nTimeout*1000), m_Timer(this), m_nStep(0)
{
wxBoxSizer* sz = new wxBoxSizer(wxHORIZONTAL);
wxArtID nIco = wxART_ERROR;
if (nStyle & wxICON_HAND) nIco = wxART_ERROR;
if (nStyle & wxICON_INFORMATION) nIco = wxART_INFORMATION;
if (nStyle & wxICON_EXCLAMATION) nIco = wxART_WARNING;
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX, wxSize(64,64));
if (nStyle & wxICON_HAND) nIco = wxART_ERROR; else
if (nStyle & wxICON_INFORMATION) nIco = wxART_INFORMATION; else
if (nStyle & wxICON_EXCLAMATION) nIco = wxART_WARNING; else
if (nStyle & 0x1000) nIco = "10204";
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX);
wxStaticBitmap* bmp = new wxStaticBitmap(this, wxID_ANY, img);
sz->Add(bmp, 0, wxALL, 8);
@ -291,11 +304,11 @@ TPopUpBox::TPopUpBox(wxWindow* pParent, const wxString& msg, int nStyle)
static void _PopUpBox(const wxString& msg, int nStyle, int nTimeout = 4)
{
const int oem = xvt_sys_get_oem_int("OEM", -1);
if (oem == 0)
wxWindow* pFrame = wxTheApp->GetTopWindow();
if (oem == 0 && pFrame != NULL)
{
wxWindow* pFrame = wxTheApp->GetTopWindow();
xvt_sys_beep(nStyle & wxICON_ERROR ? 2 : 1);
TPopUpBox dlg(pFrame, msg, nStyle);
TPopUpBox dlg(pFrame, msg, nStyle, nTimeout <= 0 ? 4 : nTimeout);
dlg.ShowModal();
}
else
@ -328,19 +341,6 @@ void xvt_sys_deprecated_box(const char* func, const char* file, int line)
}
}
static bool RectIntersect(const wxRect &rect1, const wxRect &rect2)
{
if (rect1.GetRight() < rect2.GetLeft())
return false;
if (rect2.GetRight() < rect1.GetLeft())
return false;
if (rect1.GetBottom() < rect2.GetTop())
return false;
if (rect2.GetBottom() < rect1.GetTop())
return false;
return true;
}
///////////////////////////////////////////////////////////
// Font cache
///////////////////////////////////////////////////////////
@ -1490,6 +1490,24 @@ void xvt_dwin_draw_icon(WINDOW win, int x, int y, int rid)
}
}
void xvt_dwin_draw_icon_rect(WINDOW win, RCT* rct, int rid)
{
const int w = xvt_rect_get_width(rct);
const int h = xvt_rect_get_height(rct);
const int s = min(w/16*16, h/16*16);
if (s > 0)
{
const wxIcon ico = xvtart_GetIconResource(rid, NULL, s);
if (ico.IsOk())
{
CAST_DC(win, dc);
dc.DrawIcon(ico, rct->left+(w-s)/2, rct->top+(h-s)/2);
}
}
}
static wxRect ComputeRect(const wxRect& rct, int h, int v, int k)
{
const int sx = rct.x + h * rct.width / k;
@ -1768,7 +1786,7 @@ BOOLEAN xvt_dwin_is_update_needed(WINDOW win, const RCT* rctp)
CAST_WIN(win, w); // child windows and TASK_WIN
const wxRect rect1 = NormalizeRCT(rctp);
const wxRect rect2 = w.GetUpdateClientRect();
return RectIntersect(rect1, rect2);
return rect1.Intersects(rect2);
}
return FALSE;
}
@ -2975,20 +2993,25 @@ BOOLEAN xvt_rect_intersect(RCT *drctp, const RCT *rctp1, const RCT *rctp2)
{
const wxRect rect1 = NormalizeRCT(rctp1);
const wxRect rect2 = NormalizeRCT(rctp2);
const BOOLEAN yes = RectIntersect(rect1, rect2);
const BOOLEAN yes = rect1.Intersects(rect2);
if (drctp)
{
if (yes)
{
/*
drctp->left = max(rect1.x, rect2.x);
drctp->top = max(rect1.y, rect2.y);
drctp->right = min(rect1.GetRight(), rect2.GetRight())+1;
drctp->bottom = min(rect1.GetBottom(), rect2.GetBottom())+1;
*/
const wxRect rect0 = rect1.Intersect(rect2);
xvt_rect_set(drctp, rect0.x, rect0.y, rect0.GetRight(), rect0.GetBottom());
}
else
{
drctp->left = drctp->right = rect1.x;
drctp->top = drctp->bottom = rect1.y;
// drctp->left = drctp->right = rect1.x;
// drctp->top = drctp->bottom = rect1.y;
xvt_rect_set_null(drctp);
}
}
return yes;

View File

@ -102,6 +102,7 @@ XVTDLL BOOLEAN xvt_dongle_sl_write_block(unsigned short reg, unsigned short size
XVTDLL void xvt_dwin_clear(WINDOW win, COLOR col);
XVTDLL void xvt_dwin_draw_arc(WINDOW win, const RCT* r, int sx, int sy, int ex, int ey);
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

View File

@ -59,9 +59,9 @@ wxString xvtart_GetResourceName(const char* type, int rid)
strName += val;
}
wxFileName fname(strName.Lower());
wxFileName fname(strName);
fname.Normalize();
strName = fname.GetFullPath();
strName = fname.GetFullPath().Lower();
}
else
strName.Empty();
@ -193,6 +193,20 @@ wxIconBundle TArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient
}
#endif
wxLog::EnableLogging(bLog);
for (wxCoord s = 16; s <= 48; s += 16)
{
const wxIcon smico = ib.GetIcon(s);
if (smico.GetWidth() != s)
{
wxBitmap bmpbig(ib.GetIcon());
wxImage img = bmpbig.ConvertToImage();
img.Rescale(s, s, wxIMAGE_QUALITY_HIGH);
wxBitmap bmpsmall(img);
wxIcon icosmall; icosmall.CopyFromBitmap(bmpsmall);
ib.AddIcon(icosmall);
}
}
}
#ifdef __WXMSW__
else
@ -247,8 +261,20 @@ wxIconBundle TArtProvider::GetIconBundle(const wxArtID& id, const wxArtClient& c
wxIcon TArtProvider::GetIcon(const wxArtID& id, const wxArtClient& client, const wxSize& size)
{
const wxIconBundle bundle = GetIconBundle(id, client);
return bundle.GetIcon(size == wxDefaultSize ? GetNativeSizeHint(client) : size);
wxIconBundle bundle = GetIconBundle(id, client);
const wxSize sz = size == wxDefaultSize ? GetNativeSizeHint(client) : size;
wxIcon ico = bundle.GetIcon(sz);
if (sz.x != ico.GetWidth()) // Should never happen :-)
{
wxBitmap bmpbig(bundle.GetIcon());
wxImage img = bmpbig.ConvertToImage();
img.Rescale(sz.x, sz.y, wxIMAGE_QUALITY_HIGH);
wxBitmap bmpsmall(img);
wxIcon icosmall; icosmall.CopyFromBitmap(bmpsmall);
ico = icosmall;
bundle.AddIcon(ico);
}
return ico;
}
// Metodo fichissimo per assegnare un identificatore univoco alle icone chiamate per nome del file.*
@ -277,7 +303,6 @@ const wxBitmap xvtart_GetToolResource(int nIcon, int nDesiredSize)
return wxArtProvider::GetBitmap(id, wxART_TOOLBAR, wxSize(nDesiredSize, nDesiredSize));
}
const wxIcon xvtart_GetIconResource(int nIcon, const char* client, const int size)
{
wxASSERT(_TheArtProvider != NULL);

View File

@ -2139,7 +2139,6 @@ void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on)
}
}
// Funzione di utilita' un po' fuori posto (per poter accedere alla _GetToolResource)
void xvt_dwin_draw_tool(WINDOW win, int x, int y, int rid, int size)
{
const wxBitmap bmp = xvtart_GetToolResource(rid, size);