From 730be22a7a22d0f52bca7de903bc52e3c0285cfc Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 24 Mar 2003 16:22:11 +0000 Subject: [PATCH] Patch level : 2.0 434 Files correlati : xvaga Ricompilazione Demo : [ ] Commento : Aggiunta scelta colori. git-svn-id: svn://10.65.10.50/trunk@10945 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/xvaga.cpp | 34 ++++++++++++++++++++++++++++++++-- xvaga/xvt.h | 2 ++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index 1796eb85e..c4552bc55 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -1,6 +1,7 @@ #include "wxinc.h" #include "wx/clipbrd.h" +#include "wx/colordlg.h" #include "wx/confbase.h" #include "wx/fileconf.h" #include "wx/fontdlg.h" @@ -1353,6 +1354,31 @@ static wxString GetMainTitle() return strTitle; } +COLOR xvt_dm_post_choose_color(WINDOW win, COLOR xc) +{ + CAST_COLOR(xc, wc); + + wxColourData cd; + cd.SetChooseFull(true); + cd.SetColour(wc); + for (int i = 0; i < 16; i++) + { + const unsigned char val = (i & 0x8) ? 255 : 127; + const unsigned char red = (i & 0x1) ? val : 0; + const unsigned char green = (i & 0x2) ? val : 0; + const unsigned char blue = (i & 0x4) ? val : 0; + wxColour col(red, green, blue); + cd.SetCustomColour(i, col); + } + + CAST_WIN(win, w); + wxColourDialog dialog(&w, &cd); + if (dialog.ShowModal() == wxID_OK) + xc = MAKE_XVT_COLOR(dialog.GetColourData().GetColour()); + + return xc; +} + ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char*Btn2, const char* Btn3, const char* fmt) { int nFlags = wxCENTRE | wxICON_QUESTION | wxYES_NO; @@ -1375,8 +1401,7 @@ void xvt_dm_post_error(const char *fmt) void xvt_dm_post_fatal_exit(const char *fmt) { - wxMessageBox(fmt, "FATAL ERROR", wxOK | wxCENTRE | wxICON_ERROR); - abort(); + wxLogFatalError(fmt); } static wxString MakeFileName(const wxChar* name, const wxChar* ext) @@ -1460,6 +1485,11 @@ char* xvt_dm_post_string_prompt(const char* message, char* response, int respons return NULL; } +void xvt_dm_post_warning(const char *fmt) +{ + wxMessageBox(fmt, GetMainTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION); +} + /////////////////////////////////////////////////////////// // Help system /////////////////////////////////////////////////////////// diff --git a/xvaga/xvt.h b/xvaga/xvt.h index 4a84705e6..d47d4ca07 100755 --- a/xvaga/xvt.h +++ b/xvaga/xvt.h @@ -55,6 +55,7 @@ void xvt_ctl_set_checked(WINDOW Win, BOOLEAN Check); void xvt_debug_printf(const char* fmt, ...); ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char*Btn2, const char* Btn3, const char* xin_buffer); +COLOR xvt_dm_post_choose_color(WINDOW win, COLOR c); // Added by guy void xvt_dm_post_error(const char *fmt); void xvt_dm_post_fatal_exit(const char *fmt); FL_STATUS xvt_dm_post_file_open(FILE_SPEC *fsp, const char *msg); @@ -64,6 +65,7 @@ void xvt_dm_post_message(const char *fmt); void xvt_dm_post_note(const char *fmt); BOOLEAN xvt_dm_post_page_setup(PRINT_RCD *precp); char* xvt_dm_post_string_prompt(const char* message, char* response, int response_len); +void xvt_dm_post_warning(const char *fmt); void xvt_dwin_clear(WINDOW win, COLOR col); void xvt_dwin_draw_arc(WINDOW Win, RCT* r, int sx, int sy, int ex, int ey);