Patch level : 2.0 230 e passa

Files correlati     : xvaga
Ricompilazione Demo : [ ]
Commento            :

Aggiunto supporto per le varie MessageBox


git-svn-id: svn://10.65.10.50/trunk@10933 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-03-20 10:30:21 +00:00
parent 3b64a2e5fe
commit bce0bb3fcc
2 changed files with 88 additions and 41 deletions

View File

@ -748,8 +748,11 @@ void TwxWindow::OnChar(wxKeyEvent& event)
k = toupper(k);
else
{
event.Skip();
return;
if (strchr("+-", k) == NULL) // Aggiungere qui vari testi eventuali
{
event.Skip();
return;
}
}
}
e.v.chr.ch = k;
@ -1155,7 +1158,6 @@ void xvt_app_create(int argc, char **argv, unsigned long flags,
Title[0] = "&File";
Menus[0] = new wxMenu;
Menus[0]->Append(M_FILE_NEW, "Scelta &Ditta...");
Menus[0]->Append(M_FILE_REVERT, "Impostazione &Parametri...");
Menus[0]->AppendSeparator();
Menus[0]->Append(M_FILE_PG_SETUP, "&Impostazione Stampante...");
Menus[0]->Append(M_FILE_PRINT, "&Stampa");
@ -1336,50 +1338,87 @@ void xvt_debug_printf(const char* fmt, ...)
// Common dialogs
///////////////////////////////////////////////////////////
ASK_RESPONSE xvt_dm_post_ask(const char* Btn1, const char*Btn2, const char* Btn3, const char* xin_buffer)
{
SORRY_BOX();
return RESP_DEFAULT;
static wxString GetMainTitle()
{
wxString strTitle;
if (_task_win != NULL)
{
strTitle = _task_win->GetTitle();
const int space = strTitle.Find(" -");
if (space > 0)
strTitle = strTitle.Left(space);
}
else
strTitle = "CAMPO";
return strTitle;
}
void xvt_dm_post_error(char *fmt)
{ wxLogError(fmt); }
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;
if (Btn3 == NULL)
{
if (stricmp(Btn1, "no") == 0)
nFlags |= wxNO_DEFAULT;
}
else
nFlags |= wxCANCEL;
int answer = wxMessageBox(fmt, GetMainTitle(), nFlags);
return answer == wxYES ? RESP_DEFAULT : (answer == wxNO ? RESP_2 : RESP_3);
}
void xvt_dm_post_fatal_exit(char *fmt)
{ wxLogFatalError(fmt); }
void xvt_dm_post_error(const char *fmt)
{
wxMessageBox(fmt, GetMainTitle(), wxOK | wxCENTRE | wxICON_ERROR);
}
void xvt_dm_post_fatal_exit(const char *fmt)
{
wxMessageBox(fmt, GetMainTitle(), wxOK | wxCENTRE | wxICON_ERROR);
}
static wxString MakeFileName(const wxChar* name, const wxChar* ext)
{
wxString f = name;
if (ext && *ext)
{
if (*ext != '.')
f += '.';
f += ext;
}
return f;
}
static FL_STATUS xvt_dm_post_file_ask(FILE_SPEC *fsp, const char *msg, int flags)
{
wxString path = fsp->dir.path;
wxString name = MakeFileName(fsp->name, fsp->type);
wxString extension = fsp->type;
wxString mask = MakeFileName("*", fsp->type);
wxString selectedname = wxFileSelector(msg, path, name, extension , mask, flags);
if (selectedname.IsEmpty())
return FL_CANCEL;
wxFileName::SplitPath(selectedname, &path, &name, &extension);
strcpy(fsp->dir.path, path);
strcpy(fsp->name, MakeFileName(name, extension));
strcpy(fsp->type, extension);
return FL_OK;
}
FL_STATUS xvt_dm_post_file_open(FILE_SPEC *fsp, const char *msg)
{
const int flags = wxOPEN | wxHIDE_READONLY | wxFILE_MUST_EXIST;
wxString path = fsp->dir.path;
wxString name = fsp->name;
wxString extension = fsp->type;
wxString selectedname = wxFileSelector(msg, path, name, extension , "*.*", flags);
if (selectedname.IsEmpty())
return FL_CANCEL;
wxSplitPath(selectedname, &path, &name, &extension);
strcpy(fsp->dir.path, path);
strcpy(fsp->name, name);
strcpy(fsp->type, extension);
return FL_OK;
return xvt_dm_post_file_ask(fsp, msg, flags);
}
FL_STATUS xvt_dm_post_file_save(FILE_SPEC *fsp, const char *msg)
{
const int flags = wxSAVE | wxHIDE_READONLY;
wxString path = fsp->dir.path;
wxString name = fsp->name;
wxString extension = fsp->type;
wxString selectedname = wxFileSelector(msg, path, name, extension , "*.*", flags);
if (selectedname.IsEmpty())
return FL_CANCEL;
wxSplitPath(selectedname, &path, &name, &extension);
strcpy(fsp->dir.path, path);
strcpy(fsp->name, name);
strcpy(fsp->type, extension);
return FL_OK;
return xvt_dm_post_file_ask(fsp, msg, flags);
}
BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, unsigned long reserved)
@ -1402,8 +1441,15 @@ BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, un
return ok;
}
void xvt_dm_post_note(char *fmt)
{ wxLogMessage(fmt); }
void xvt_dm_post_message(const char *fmt)
{
wxMessageBox(fmt, GetMainTitle(), wxOK | wxCENTRE | wxICON_INFORMATION);
}
void xvt_dm_post_note(const char *fmt)
{
wxMessageBox(fmt, GetMainTitle(), wxOK | wxCENTRE | wxICON_EXCLAMATION);
}
char* xvt_dm_post_string_prompt(const char* message, char* response, int response_len)
{
@ -2797,7 +2843,7 @@ MENU_ITEM* xvt_res_get_menu(int rid)
if (rid >= 10000 && rid < 10100)
{
wxSplitPath(wxGetApp().argv[0], NULL, &strName, NULL);
wxFileName::SplitPath(wxGetApp().argv[0], NULL, &strName, NULL);
strName.MakeUpper();
strName = wxString::Format("/Menu_%s-%X", strName.Left(3), (rid-1)%16);
}

View File

@ -55,12 +55,13 @@ 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);
void xvt_dm_post_error(char *fmt);
void xvt_dm_post_fatal_exit(char *fmt);
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);
FL_STATUS xvt_dm_post_file_save(FILE_SPEC *fsp, const char *msg);
BOOLEAN xvt_dm_post_font_sel(WINDOW win, XVT_FNTID font_id, PRINT_RCD *precp, unsigned long reserved);
void xvt_dm_post_note(char *fmt);
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);