From 383a6f7d36ad98bb00df6972d7701865f02556a3 Mon Sep 17 00:00:00 2001 From: Alessandro Bonazzi Date: Fri, 7 Feb 2025 23:34:15 +0100 Subject: [PATCH] Patch level : 12.00 1370 Files correlati : xvaga.dll Bug : MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commento: La cartella dei file temporanei può essere personalizzata mettento nella variablie Temp di conf.ini %Study --- src/xvaga/xvaga.cpp | 86 ++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 33 deletions(-) diff --git a/src/xvaga/xvaga.cpp b/src/xvaga/xvaga.cpp index 87444ca7e..29fb8dd1b 100755 --- a/src/xvaga/xvaga.cpp +++ b/src/xvaga/xvaga.cpp @@ -300,7 +300,7 @@ DRAW_CTOOLS* xvt_app_get_default_ctools(DRAW_CTOOLS *ct) void xvt_app_process_pending_events(void) { wxApp* a = wxTheApp; // Memorizzo il risultato di wxGetInstance - if (a != NULL) // Puo' succedere! + if (a != nullptr) // Puo' succedere! { while (a->Pending()) a->Dispatch(); @@ -1626,7 +1626,22 @@ BOOLEAN xvt_fsys_get_curr_dir(DIRECTORY *dirp) void xvt_fsys_get_temp_dir(DIRECTORY *dirp) { xvt_sys_get_profile_string(NULL, "Main", "Temp", "", dirp->path, sizeof(dirp->path)); - if (!*dirp->path) + + wxString work_dirp(dirp->path); + + work_dirp.MakeUpper(); + + const int pos = work_dirp.Find("%STUDY"); + + if (pos >= 0) + { + char wrk[_MAX_PATH]; xvt_sys_get_profile_string(NULL, "Main", "Study", "", wrk, sizeof(wrk)); + + strcat_s(wrk, dirp->path + pos + 7); + dirp->path[pos] = '\0'; + strcat_s(dirp->path, wrk); + } + if (!*dirp->path) wxStrcpy(dirp->path, wxFileName::GetTempDir()); } @@ -1974,17 +1989,17 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest) wxInputStream* input = NULL; if (orig_url.HasScheme()) - { + { if (orig_url.GetScheme() == "ftp") - { + { wxFTP& ftp = *wxStaticCast(&orig_url.GetProtocol(), wxFTP); ftp.SetPassive(xvt_sys_ftp_passive_mode(orig_url.GetServer())); - } + } input = orig_url.GetInputStream(); - } - else + } + else input = new wxFileInputStream(orig); - + if (input == NULL) return FALSE; @@ -1994,23 +2009,23 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest) if (scheme == "ftp") { - wxFTP ftp; - const wxString strHost = dest_url.GetServer(); - const wxString strUser = dest_url.GetUser(); - const wxString strPwd = dest_url.GetPassword(); - const wxFileName fnPath = dest_url.GetPath(); + wxFTP ftp; + const wxString strHost = dest_url.GetServer(); + const wxString strUser = dest_url.GetUser(); + const wxString strPwd = dest_url.GetPassword(); + const wxFileName fnPath = dest_url.GetPath(); const wxString fnDir = fnPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX); const wxString fnName = fnPath.GetFullName(); - if (!strUser.IsEmpty()) - { - ftp.SetUser(strUser); - ftp.SetPassword(strPwd); - } - ftp.SetPassive(xvt_sys_ftp_passive_mode(strHost)); + if (!strUser.IsEmpty()) + { + ftp.SetUser(strUser); + ftp.SetPassword(strPwd); + } + ftp.SetPassive(xvt_sys_ftp_passive_mode(strHost)); - if (ftp.Connect(strHost) && ftp.SetBinary() && ftp.ChDir(fnDir)) - output = ftp.GetOutputStream(fnName); + if (ftp.Connect(strHost) && ftp.SetBinary() && ftp.ChDir(fnDir)) + output = ftp.GetOutputStream(fnName); } else { @@ -2030,6 +2045,7 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest) 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 can’t get your posted data. + wxString PostData("postdata="); PostData << fnPath.GetFullPath(); @@ -2040,24 +2056,25 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest) 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) + BOOLEAN ok = false; + + if (input != nullptr && output != nullptr) { input->Read(*output); wxStreamError err = output->GetLastError(); ok = (err == wxSTREAM_NO_ERROR); output->Close(); } - if (input != NULL) + if (input != nullptr) delete input; - if (output != NULL && scheme != "ftp") + if (output != nullptr && scheme != "ftp") delete output; return ok; } @@ -3662,7 +3679,7 @@ int xvt_sys_get_profile_string(const char* file, const char* paragraph, const ch if (file == NULL || *file == '\0') file = xvt_fsys_get_campo_ini(); - if (!(paragraph && *paragraph) && wxStricmp(file, "ssa.ini") == 0) + if (!(paragraph && *paragraph) && wxStricmp(file, "ssa.ini") == 0) { if (xvt_fsys_file_exists(file)) { @@ -4118,6 +4135,7 @@ static long xvt_vobj_get_metric(WINDOW win, wxSystemMetric data) long xvt_vobj_get_attr(WINDOW win, long data) { long ret = 0L; + switch(data) { case ATTR_APP_CTL_COLORS: @@ -4378,7 +4396,9 @@ void xvt_vobj_maximize(WINDOW win) else { CAST_WIN(win, w); + wxWindow* parent = w.GetParent(); + if (parent == NULL) parent = _task_win; int width, height; @@ -4393,7 +4413,7 @@ void xvt_vobj_minimize(WINDOW win) if (pMain != NULL) pMain->Iconize(); else - SORRY_BOX(); + SORRY_BOX(); } void xvt_vobj_hide(WINDOW win) @@ -4401,17 +4421,17 @@ void xvt_vobj_hide(WINDOW win) wxFrame* pMain = wxDynamicCast((wxObject*)win, wxFrame); if (pMain != NULL) pMain->Hide(); - else - SORRY_BOX(); + else + SORRY_BOX(); } void xvt_vobj_show(WINDOW win) { wxFrame* pMain = wxDynamicCast((wxObject*)win, wxFrame); if (pMain != NULL) - pMain->Show(); - else - SORRY_BOX(); + pMain->Show(); + else + SORRY_BOX(); } void xvt_vobj_move(WINDOW win, const RCT* rctp)