Patch level : 10.0

Files correlati     : xvaga.dll
Ricompilazione Demo : [ ]
Commento            :
Rese uniformi fionestre di messaggio, attenzione ed errore


git-svn-id: svn://10.65.10.50/trunk@19494 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-10-22 10:02:40 +00:00
parent 8576c5520f
commit a9911d9e17
2 changed files with 37 additions and 31 deletions

View File

@ -108,8 +108,7 @@ void TMessageBox::OnTimeout(wxTimerEvent& WXUNUSED(evt))
void TMessageBox::AddButton(wxSizer* sz, int id, int WXUNUSED(ico))
{
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition,
wxSize(80, 32)), 0, wxALL, 4);
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition, wxSize(80, 32)), 0, wxALL, 4);
}
TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout)
@ -122,10 +121,12 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
sizer->Add(sz1);
wxArtID nIco = wxART_INFORMATION;
if (nStyle & wxICON_HAND) nIco = wxART_ERROR;
if (nStyle & wxICON_INFORMATION) nIco = wxART_INFORMATION;
if (nStyle & wxICON_EXCLAMATION) nIco = wxART_WARNING;
if (nStyle & wxICON_QUESTION) nIco = wxART_QUESTION;
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 & wxICON_QUESTION) nIco = wxART_QUESTION; else
if (nStyle & 0x1000) nIco = "10204";
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX, wxSize(64,64));
const int nBorder = 8;
@ -133,9 +134,9 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
wxStaticText* ss = new wxStaticText(this, wxID_ANY, wxEmptyString);
ss->Wrap(160);
ss->SetLabel(msg);
sz1->Add(ss, 0, wxALL | wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, nBorder);
sz1->Add(ss, 0, wxALL|wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, nBorder);
sizer->Add(new wxStaticLine(this), 0, wxALL | wxEXPAND, nBorder);
sizer->Add(new wxStaticLine(this), 0, wxALL|wxEXPAND, nBorder);
wxBoxSizer* sz2 = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(sz2, 0, wxALIGN_CENTER);
@ -207,7 +208,7 @@ void _AssertBox(bool test, const char* func, const char* file, int line)
wxString strMessage;
strMessage.Printf("Sorry, the application passed some invalid parameters to\nfunction %s in file %s at line %d .",
func, file, line);
_MessageBox(strMessage, wxOK|wxICON_ERROR);
xvt_dm_post_error(strMessage);
}
}
}
@ -251,12 +252,12 @@ void TPopUpBox::OnTimer(wxTimerEvent& WXUNUSED(evt))
if (msec <= 1000)
{
const int perc = msec/10;
Move(0, rctMain.GetBottom() - rctMine.height * perc / 100);
Move(rctMain.x, rctMain.GetBottom() - rctMine.height * perc / 100);
}
if (msec >= 3000 && msec <= 4000)
{
const int perc = (4000-msec)/10;
Move(0, rctMain.GetBottom() - rctMine.height * perc / 100);
Move(rctMain.x, rctMain.GetBottom() - rctMine.height * perc / 100);
}
if (msec > 4000)
EndModal(wxID_CANCEL);
@ -287,7 +288,7 @@ TPopUpBox::TPopUpBox(wxWindow* pParent, const wxString& msg, int nStyle)
m_Timer.Start(25);
}
static void _PopUpBox(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)
@ -298,7 +299,7 @@ static void _PopUpBox(const wxString& msg, int nStyle)
dlg.ShowModal();
}
else
_MessageBox(msg, nStyle|wxOK|wxCENTRE, 4);
_MessageBox(msg, nStyle|wxOK|wxCENTRE, nTimeout);
}
void xvt_sys_sorry_box(const char* func, const char* file, int line)
@ -310,7 +311,7 @@ void xvt_sys_sorry_box(const char* func, const char* file, int line)
wxString strMessage;
strMessage.Printf("Function %s in file %s at line %d\nis not implemented yet: be patient...",
func, file, line);
_PopUpBox(strMessage, wxICON_ERROR);
_PopUpBox(strMessage, 0x1000); // Smiley Icon
}
}
@ -957,7 +958,8 @@ ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char* Btn2, const char* Btn
void xvt_dm_post_error(const char *fmt)
{
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_HAND);
//_MessageBox(fmt, wxOK | wxCENTRE | wxICON_HAND);
_PopUpBox(fmt, wxICON_HAND, 0);
}
void xvt_dm_post_fatal_exit(const char *fmt)
@ -1051,12 +1053,14 @@ BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD* WXUNUSED(
void xvt_dm_post_message(const char *fmt)
{
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_INFORMATION);
//_MessageBox(fmt, wxOK | wxCENTRE | wxICON_INFORMATION);
_PopUpBox(fmt, wxICON_INFORMATION, 0);
}
void xvt_dm_post_note(const char *fmt)
{
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_EXCLAMATION);
// _MessageBox(fmt, wxOK | wxCENTRE | wxICON_EXCLAMATION);
_PopUpBox(fmt, wxICON_EXCLAMATION, 0);
}
char* xvt_dm_post_string_prompt(const char* message, char* response, int response_len)
@ -1075,7 +1079,8 @@ char* xvt_dm_post_string_prompt(const char* message, char* response, int respons
void xvt_dm_post_warning(const char *fmt)
{
_MessageBox(fmt, wxOK | wxCENTRE | wxICON_EXCLAMATION);
// _MessageBox(fmt, wxOK | wxCENTRE | wxICON_EXCLAMATION);
_PopUpBox(fmt, wxICON_EXCLAMATION, 0);
}
void xvt_dm_popup_error(const char *fmt)
@ -1882,10 +1887,12 @@ void xvt_dwin_draw_line(WINDOW win, PNT pnt)
{
CAST_TDC(win, tdc);
const wxPoint to(pnt.h, pnt.v);
wxDC& dc = tdc.GetDC();
if (tdc._pnt != to)
{
wxDC& dc = tdc.GetDC();
dc.DrawLine(tdc._pnt, to);
// dc.DrawPoint(to); // Un giorno capiro' il perche' servisse
// dc.DrawPoint(to); // Non scommentare o cancellare: Un giorno capiro' il perche' servisse
}
tdc._pnt = to;
}
@ -1970,11 +1977,9 @@ void xvt_font_deserialize(XVT_FNTID font_id, const char* buf)
void xvt_font_destroy(XVT_FNTID font_id)
{
if (font_id != NULL)
{
TFontId* fp = wxStaticCast(font_id, TFontId);
TFontId* fp = wxDynamicCast(font_id, TFontId);
if (fp != NULL)
delete fp;
}
}
BOOLEAN xvt_font_get_family(XVT_FNTID font_id, char* buf, long max_buf)

View File

@ -112,13 +112,14 @@ wxBitmap TArtProvider::CreateBitmap(const wxArtID& id, const wxArtClient& client
long tool = -1;
if (id.StartsWith(wxT("wxART")))
{
if (id == wxART_ERROR) tool = 201; else
if (id == wxART_HELP) tool = 163; else
if (id == wxART_INFORMATION) tool = 162; else
if (id == wxART_NEW) tool = 105; else
if (id == wxART_QUESTION) tool = 202; else
if (id == wxART_QUIT) tool = 114; else
if (id == wxART_WARNING) tool = 203; else
if (id == wxART_ERROR) tool = 201; else
if (id == wxART_HELP) tool = 163; else
if (id == wxART_INFORMATION) tool = 162; else
if (id == wxART_MISSING_IMAGE) tool = 100; else
if (id == wxART_NEW) tool = 105; else
if (id == wxART_QUESTION) tool = 202; else
if (id == wxART_QUIT) tool = 114; else
if (id == wxART_WARNING) tool = 203; else
;
}
else