Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Migliorata gestione finestre di richiesta


git-svn-id: svn://10.65.10.50/branches/R_10_00@22475 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-11-04 15:36:22 +00:00
parent 5ca90964fd
commit 3015907da9
6 changed files with 135 additions and 100 deletions

View File

@ -986,7 +986,7 @@ bool OsWin32_GotoUrl(const char* url, const char* action)
#ifdef SPEECH_API
#include "\Programmi\Microsoft Speech SDK 5.1\Include\sapi.h"
#include <sapi.h>
static ISpVoice* m_pVoice = NULL;

View File

@ -38,17 +38,13 @@ bool OsWin32_SL_Logout() ;
bool OsWin32_SL_ReadBlock(unsigned short reg, unsigned short size, unsigned short* data);
bool OsWin32_SL_WriteBlock(unsigned short reg, unsigned short size, const unsigned short* data);
/*
void OsWin32_SpoolNewLine(unsigned int hdc);
bool OsWin32_IsGenericTextOnly(void* devmode);
*/
int OsWin32_GetSessionId();
bool OsWin32_IsWindowsServer();
//#define SPEECH_API 1
#ifdef SPEECH_API
bool OsWin32_InitializeSpeech();
bool OsWin32_Speak(const char* text, bool async);
void OsWin32_DeinitializeSpeech();
bool OsWin32_InitializeSpeech();
bool OsWin32_Speak(const char* text, bool async);
void OsWin32_DeinitializeSpeech();
#endif

View File

@ -104,10 +104,6 @@ XVTDLL void xvt_app_pre_create(void)
else
wxSystemOptions::SetOption(wxT("msw.remap"), 0);
#endif
#ifdef SPEECH_API
xvt_dm_enable_speech(0xFF);
#endif
}
void xvt_app_create(int WXUNUSED(argc), char** WXUNUSED(argv), unsigned long WXUNUSED(flags),
@ -222,9 +218,7 @@ void xvt_app_destroy(void)
if (_task_win != NULL)
_task_win->Destroy();
#ifdef SPEECH_API
xvt_dm_enable_speech(0x00);
#endif
xvt_dm_speech_enable(0x00);
xvt_sign_stop();
@ -1926,13 +1920,13 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest)
ftp.SetPassive(xvt_sys_ftp_passive_mode(orig_url.GetServer()));
}
wxInputStream * input = orig_url.GetInputStream();
if (input == NULL)
input = new wxFileInputStream(orig);
wxURL dest_url(dest);
wxOutputStream* output = NULL;
wxString scheme = dest_url.GetScheme();
const wxString scheme = dest_url.GetScheme();
if (input == NULL)
input = new wxFileInputStream(orig);
if (scheme == "ftp")
{
wxFTP ftp;
@ -1950,43 +1944,16 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest)
}
ftp.SetPassive(xvt_sys_ftp_passive_mode(strHost));
if (ftp.Connect(strHost))
if (ftp.SetBinary())
if (ftp.ChDir(fnDir))
output = ftp.GetOutputStream(fnName);
if (ftp.Connect(strHost) && ftp.SetBinary() && ftp.ChDir(fnDir))
output = ftp.GetOutputStream(fnName);
}
else
{
if (scheme == "http")
return false;
/* {
const wxString strHost = dest_url.GetServer();
const wxString strUser = dest_url.GetUser();
const wxString strPwd = dest_url.GetPassword();
const wxFileName fnPath = dest_url.GetPath();
wxHTTP http;
if (!strUser.IsEmpty())
{
http.SetUser(strUser);
http.SetPassword(strPwd);
}
http.SetHeader(_T("Content-type"), _T("application/x-www-form-urlencoded")); //remember to define “Content-type: application/x-www-form-urlencoded”, or remote server cant get your posted data.
wxString PostData("postdata=");
PostData << fnPath.GetFullPath();
http.SetPostBuffer(PostData); //its the data to be posted
bool httpok = false;
if (http.Connect(strHost))
{
wxInputStream *httpStream = http.GetInputStream(_T("/getfile.php"));
httpok = http.GetError() == wxPROTO_NOERR;
wxDELETE(httpStream);
}
return httpok;
} */
else
output = new wxFileOutputStream(dest);
}
BOOLEAN ok = FALSE;
if (input != NULL && output != NULL)
@ -4587,6 +4554,8 @@ BOOLEAN statbar_destroy(WINDOW win)
pStatusBar->Destroy();
}
return pStatusBar != NULL;
}

View File

@ -529,6 +529,7 @@ XVTDLL void xvt_treelist_suspend(WINDOW win);
XVTDLL BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
const char* subject, const char* msg, const char* attach, short flags); // 0x1=UI; 0x2=Receipt
XVTDLL BOOLEAN xvt_mail_installed();
XVTDLL void xvt_btn_set_images(WINDOW win, XVT_IMAGE up, XVT_IMAGE down);
XVTDLL int xvt_net_get_status();

View File

@ -5,6 +5,7 @@
#include <wx/artprov.h>
#include <wx/calctrl.h>
#include <wx/clipbrd.h>
#include <wx/colordlg.h>
#include <wx/fontdlg.h>
#include <wx/wxhtml.h>
@ -15,6 +16,25 @@
#include "oswin32.h"
#endif
///////////////////////////////////////////////////////////
// TwxHtmlWindow
///////////////////////////////////////////////////////////
class TwxHtmlWindow : public wxHtmlWindow
{
protected:
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
};
void TwxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
{
const wxString href = link.GetHref();
if (href.StartsWith("mailto:"))
xvt_mail_send(href.AfterFirst(':'), NULL, NULL, _GetAppTitle(), ToText(), NULL, 1);
else
wxHtmlWindow::OnLinkClicked(link);
}
///////////////////////////////////////////////////////////
// TMessageBox
///////////////////////////////////////////////////////////
@ -29,6 +49,8 @@ protected:
void AddButton(wxSizer* sz, wxWindowID id);
DECLARE_EVENT_TABLE()
wxString GetMessage() const;
public:
TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout = 0);
};
@ -38,6 +60,21 @@ BEGIN_EVENT_TABLE(TMessageBox, wxDialog)
EVT_TIMER(wxID_ANY, TMessageBox::OnTimeout)
END_EVENT_TABLE()
wxString TMessageBox::GetMessage() const
{
wxString str;
const wxWindow* txt = FindWindowById(wxID_EDIT, this);
if (txt != NULL)
{
wxHtmlWindow* html = wxDynamicCast(txt, wxHtmlWindow);
if (html != NULL)
str = html->ToText();
else
str = txt->GetLabel();
}
return str;
}
void TMessageBox::OnButton(wxCommandEvent& evt)
{
int ec = wxCANCEL;
@ -46,7 +83,15 @@ void TMessageBox::OnButton(wxCommandEvent& evt)
case wxID_YES: ec = wxYES; break;
case wxID_OK : ec = wxOK; break;
case wxID_NO : ec = wxNO; break;
default : ec = GetEscapeId(); break;
case wxID_COPY:
wxTheClipboard->Open();
wxTheClipboard->SetData(new wxTextDataObject(GetMessage()));
wxTheClipboard->Close();
return; // DO NOT EXIT
case wxID_SAVEAS:
xvt_mail_send("assistenza@sirio-is.it", NULL, NULL, _GetAppTitle(), GetMessage(), NULL, 1);
return; // DO NOT EXIT
default: ec = GetEscapeId(); break;
}
EndModal(ec);
}
@ -67,19 +112,15 @@ void TMessageBox::OnTimeout(wxTimerEvent& WXUNUSED(evt))
void TMessageBox::AddButton(wxSizer* sz, wxWindowID id)
{
const wxSize szButt(64,-1);
wxString strPrompt;
switch (id)
{
case 0x20:
sz->Add(new wxButton(this, id, "Si Tutti", wxDefaultPosition, szButt), 0, wxALL, 4);
break;
case 0x40:
sz->Add(new wxButton(this, id, "No Tutti", wxDefaultPosition, szButt), 0, wxALL, 4);
break;
default:
sz->Add(new wxButton(this, id, wxEmptyString, wxDefaultPosition, szButt), 0, wxALL, 4);
break;
case 0x20: strPrompt = _("Si Tutti"); break;
case 0x40: strPrompt = _("No Tutti"); break;
default : break;
}
wxButton* btn = new wxButton(this, id, strPrompt, wxDefaultPosition, wxSize(64,-1));
sz->Add(btn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 2);
}
TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int nTimeout)
@ -97,11 +138,11 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
}
}
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* sz1 = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(sz1);
wxBoxSizer* pMainSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* pTopSizer = new wxBoxSizer(wxHORIZONTAL);
pMainSizer->Add(pTopSizer);
wxArtID nIco = wxART_INFORMATION;
if (nStyle & wxICON_HAND) nIco = wxART_ERROR; else
if (nStyle & wxICON_INFORMATION) nIco = wxART_INFORMATION; else
@ -116,13 +157,14 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
const wxBitmap img = wxArtProvider::GetBitmap(nIco, wxART_MESSAGE_BOX, wxSize(nIcon,nIcon));
sz1->Add(new wxStaticBitmap(this, wxID_ANY, img), 0, wxALL|wxALIGN_CENTER, nBorder);
pTopSizer->Add(new wxStaticBitmap(this, wxID_ANY, img), 0, wxALL|wxALIGN_CENTER, nBorder);
if (msg.StartsWith("<html>") && msg.EndsWith("</html>"))
{
wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(nWrap,nWrap/1.6180339887));
TwxHtmlWindow* html = new TwxHtmlWindow;
html->Create(this, wxID_EDIT, wxDefaultPosition, wxSize(nWrap,nWrap/1.6180339887));
html->SetPage(msg);
sz1->Add(html, 0, wxALL|wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, nBorder);
pTopSizer->Add(html, 0, wxALL|wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, nBorder);
}
else
{
@ -133,21 +175,29 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
wxStringTokenizer tok(msg, wxT("\n"));
for (nLines = 0; tok.HasMoreTokens(); nLines++)
nLines += tok.GetNextToken().Len()/32;
ss = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
ss = new wxStaticText(this, wxID_EDIT, wxEmptyString, wxDefaultPosition,
wxSize(nWrap, 16*nLines), wxST_NO_AUTORESIZE);
}
else
ss = new wxStaticText(this, wxID_ANY, wxEmptyString);
ss = new wxStaticText(this, wxID_EDIT, wxEmptyString);
ss->Wrap(nWrap);
ss->SetLabel(msg);
sz1->Add(ss, 0, wxALL|wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, nBorder);
pTopSizer->Add(ss, 0, wxALL|wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, nBorder);
}
sizer->Add(new wxStaticLine(this), 0, wxALL|wxEXPAND, nBorder);
pMainSizer->Add(new wxStaticLine(this), wxID_STATIC, wxALL|wxEXPAND, nBorder);
wxFlexGridSizer* pBottomSizer = new wxFlexGridSizer(0, 2, 0, 0);
pBottomSizer->AddGrowableCol(1);
pMainSizer->Add(pBottomSizer, 0, wxGROW|wxALL, nBorder);
wxBoxSizer* pSmallSizer = new wxBoxSizer(wxHORIZONTAL);
pBottomSizer->Add(pSmallSizer, 0, wxALIGN_TOP|wxALL, 0);
wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL);
pBottomSizer->Add(pButtonSizer, 0, wxALIGN_RIGHT|wxALL, 0);
wxBoxSizer* sz2 = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(sz2, 0, wxALIGN_CENTER);
if (nStyle & wxYES_NO)
{
if (nStyle & 0x60) // Yes,No,*All
@ -156,17 +206,17 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
{
SetAffirmativeId(wxID_YES);
SetEscapeId(wxID_NO);
AddButton(sz2, wxID_NO);
AddButton(sz2, wxID_YES);
AddButton(sz2, 0x20);
AddButton(pButtonSizer, wxID_NO);
AddButton(pButtonSizer, wxID_YES);
AddButton(pButtonSizer, 0x20);
}
else // Yes, No, No All
{
SetAffirmativeId(wxID_NO);
SetEscapeId(wxID_YES);
AddButton(sz2, wxID_YES);
AddButton(sz2, wxID_NO);
AddButton(sz2, 0x40);
AddButton(pButtonSizer, wxID_YES);
AddButton(pButtonSizer, wxID_NO);
AddButton(pButtonSizer, 0x40);
}
}
else
@ -175,29 +225,45 @@ TMessageBox::TMessageBox(wxWindow* pParent, const wxString& msg, int nStyle, int
{
SetAffirmativeId(wxID_NO);
SetEscapeId(wxID_YES);
AddButton(sz2, wxID_NO);
AddButton(sz2, wxID_YES);
AddButton(pButtonSizer, wxID_NO);
AddButton(pButtonSizer, wxID_YES);
}
else
{
SetAffirmativeId(wxID_YES);
SetEscapeId(wxID_NO);
AddButton(sz2, wxID_YES);
AddButton(sz2, wxID_NO);
AddButton(pButtonSizer, wxID_YES);
AddButton(pButtonSizer, wxID_NO);
}
}
}
if (nStyle & wxOK)
{
SetAffirmativeId(wxID_OK);
AddButton(sz2, wxID_OK);
AddButton(pButtonSizer, wxID_OK);
}
if (nStyle & wxCANCEL)
{
SetEscapeId(wxID_CANCEL);
AddButton(sz2, wxID_CANCEL);
AddButton(pButtonSizer, wxID_CANCEL);
}
SetSizerAndFit(sizer);
if (!bTerminalino)
{
const wxBitmap bmpCopy = wxArtProvider::GetBitmap(wxART_COPY, wxART_BUTTON);
wxBitmapButton* btnCopy = new wxBitmapButton(this, wxID_COPY, bmpCopy);
pSmallSizer->Add(btnCopy, 0, wxALIGN_TOP);
if (xvt_mail_installed())
{
const wxBitmap bmpMail = wxArtProvider::GetBitmap("139", wxART_BUTTON, wxSize(bmpCopy.GetWidth(), bmpCopy.GetHeight()));
wxBitmapButton* btnMail = new wxBitmapButton(this, wxID_SAVEAS, bmpMail);
pSmallSizer->Add(btnMail, 0, wxALIGN_TOP);
}
}
SetSizerAndFit(pMainSizer);
CentreOnParent();
if (nTimeout > 0)
@ -212,6 +278,8 @@ int _MessageBox(const wxString& msg, int nStyle, int nTimeout = 0)
{
xvt_dm_post_speech(msg, 1, TRUE);
xvt_sys_beep((nStyle & wxICON_ERROR) ? 2 : (nStyle & wxICON_WARNING) ? 1 : 0);
TMessageBox dlg(NULL, msg, nStyle, nTimeout);
const int ret = dlg.ShowModal();
@ -393,7 +461,6 @@ void xvt_dm_speech_enable(int mode)
{
#ifdef SPEECH_API
m_nSpeechMode = mode;
#ifdef __WXMSW__
if (m_nSpeechMode != 0)
{
if (!OsWin32_InitializeSpeech())
@ -404,7 +471,6 @@ void xvt_dm_speech_enable(int mode)
OsWin32_DeinitializeSpeech();
}
#endif
#endif
}
int xvt_dm_speech_enabled(void)
@ -553,11 +619,7 @@ BOOLEAN xvt_dm_post_speech(const char* text, int priority, BOOLEAN async)
BOOLEAN ok = FALSE;
#ifdef SPEECH_API
if ((m_nSpeechMode & (1 << priority)) != 0)
{
#ifdef __WXMSW__
ok = OsWin32_Speak(text, async != 0);
#endif
}
#endif
return ok;
}
@ -588,11 +650,6 @@ void xvt_dm_post_error(const char *fmt)
void xvt_dm_post_fatal_exit(const char *fmt)
{
/*
xvt_dm_post_speech(fmt, 1, TRUE);
wxLogFatalError(fmt);
xvt_dm_post_speech("OK", 7, TRUE);
*/
_MessageBox(fmt, wxOK | wxICON_HAND, 10);
abort();
}
@ -618,9 +675,9 @@ static FL_STATUS xvt_dm_post_file_ask(FILE_SPEC *fsp, const char *msg, int flags
wxString extension = fsp->type;
wxString wild;
if (!extension.IsEmpty() && extension != "*")
wild << "File " << extension << " (*." << extension << ")|*." << extension << "|";
wild << _("File ") << extension << " (*." << extension << ")|*." << extension << "|";
if (flags & wxFD_OPEN)
wild << "Tutti i file (*.*)|*.*|";
wild << _("Tutti i file (*.*)|*.*|");
wild << '|';
wxString selectedname = wxFileSelector(msg, path, name, extension , wild, flags);

View File

@ -4,6 +4,18 @@
#include "email.h"
#include <wx/tokenzr.h>
BOOLEAN xvt_mail_installed()
{
BOOLEAN bMapiInstalled = TRUE;
#ifdef __WXMSW__
bMapiInstalled = (::GetProfileInt(_T("MAIL"), _T("MAPI"), 0) != 0) &&
(SearchPath(NULL, _T("MAPI32.DLL"), NULL, 0, NULL, NULL) != 0);
#endif
return bMapiInstalled;
}
BOOLEAN xvt_mail_send(const char* to, const char* cc, const char* ccn,
const char* subject, const char* msg,
const char* attach, short flags)