Patch level : 12.0 372

Files correlati     : xvaga.dll

Modificate le funzioni xvt_fsys_....._dir per evitare di avere direttori sbagliati cambiati ad esempio da Office

git-svn-id: svn://10.65.10.50/branches/R_10_00@23729 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2017-04-10 07:22:57 +00:00
parent 4335fa7722
commit eadf511ccb
3 changed files with 154 additions and 12 deletions

View File

@ -152,7 +152,14 @@ void xvt_app_create(int WXUNUSED(argc), char** WXUNUSED(argv), unsigned long WXU
}
else
{
#ifdef __WXMSW__
style |= wxMAXIMIZE;
#else
style &= ~wxMAXIMIZE;
const wxRect rect = wxGetClientDisplayRect();
pos = rect.GetPosition();
size = rect.GetSize();
#endif
}
if (_startup_style & WSF_NO_TASKBAR)
@ -1548,16 +1555,17 @@ wxString xvt_fsys_get_default_dir_name()
void xvt_fsys_get_default_dir(DIRECTORY *dirp)
{
if (_startup_dir.IsEmpty())
_startup_dir = ::wxGetCwd();
xvt_fsys_convert_str_to_dir(_startup_dir, dirp);
xvt_fsys_convert_str_to_dir(xvt_fsys_get_default_dir_name(), dirp);
}
BOOLEAN xvt_fsys_get_dir(DIRECTORY *dirp)
{
if (_startup_dir.IsEmpty())
_startup_dir = ::wxGetCwd();
return xvt_fsys_convert_str_to_dir(_startup_dir, dirp);
return xvt_fsys_convert_str_to_dir(xvt_fsys_get_default_dir_name(), dirp);
}
BOOLEAN xvt_fsys_get_curr_dir(DIRECTORY *dirp)
{
return xvt_fsys_convert_str_to_dir(::wxGetCwd(), dirp);
}
void xvt_fsys_get_temp_dir(DIRECTORY *dirp)
@ -1609,8 +1617,14 @@ BOOLEAN xvt_fsys_is_removable_drive(const char* path)
if (path && *path)
{
#ifdef __WXMSW__
const wxString strRoot = get_disk_root(path);
yes = ::GetDriveType(strRoot) == DRIVE_REMOVABLE;
#else
char dev[_MAX_PATH];
OsLinux_GetFileSys(path, dev, NULL, NULL);
yes = strncmp(dev, "/dev/fd", 7) == 0;
#endif
}
return yes;
}
@ -1624,8 +1638,12 @@ BOOLEAN xvt_fsys_is_network_drive(const char* path)
yes = TRUE;
else
{
#ifdef __WXMSW__
const wxString strRoot = get_disk_root(path);
yes = ::GetDriveType(strRoot) == DRIVE_REMOTE;
#else
yes = OsLinux_IsNetworkDrive(path);
#endif
}
}
return yes;
@ -1638,8 +1656,12 @@ BOOLEAN xvt_fsys_is_fixed_drive(const char* path)
{
if (!wxIsPathSeparator(path[0]) || !wxIsPathSeparator(path[1]))
{
#ifdef __WXMSW__
const wxString strRoot = get_disk_root(path);
yes = ::GetDriveType(strRoot) == DRIVE_FIXED;
#else
yes = !(xvt_fsys_is_network_drive(path) || xvt_fsys_is_removable_drive(path));
#endif
}
}
return yes;
@ -1912,6 +1934,33 @@ BOOLEAN xvt_fsys_fcopy(const char* orig, const char* dest)
{
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);
}
@ -2075,7 +2124,17 @@ COLOR xvt_image_get_pixel(XVT_IMAGE image, short x, short y)
XVT_IMAGE xvt_image_read(const char* filenamep)
{
TXVT_IMAGE* i = NULL;
#ifdef __WXMSW__
const wxString name = filenamep;
#else
wxString name;
if (isalpha(filenamep[0u]))
{
name = _startup_dir;
name += "/";
}
name += filenamep;
#endif
if (::wxFileExists(name))
{
i = new TXVT_IMAGE;
@ -3352,6 +3411,11 @@ long xvt_sys_execute(const char* cmdline, BOOLEAN sync, BOOLEAN iconizetask)
long exitcode = 0;
wxString cmd(cmdline);
#ifdef LINUX
if (isalpha(cmd[0u]))
cmd = "./" + cmd;
#endif
if (sync)
{
if (iconizetask)
@ -3420,22 +3484,31 @@ long xvt_sys_execute_in_window(const char* cmdline, WINDOW win)
if (inst > 0 && win != NULL_WIN)
{
CAST_WIN(win, w);
#ifdef __WXMSW__
OsWin32_PlaceProcessInWindow(inst, "", (unsigned int)w.GetHandle());
#else
OsLinux_PlaceProcessInWindow(inst, "", w.GetHandle());
#endif
}
return inst;
}
long xvt_sys_close_children(WINDOW win)
{
long c = 0;
#ifdef __WXMSW__
CAST_WIN(win, w);
return OsWin32_CloseChildren((unsigned int)w.GetHandle());
c = OsWin32_CloseChildren((unsigned int)w.GetHandle());
#endif
return c;
}
BOOLEAN xvt_sys_goto_url(const char* url, const char* action)
{
#ifdef __WXMSW__
if (action && *action && !xvt_str_same(action, "open"))
return OsWin32_GotoUrl(url, action);
#endif
return wxLaunchDefaultBrowser(url);
}
@ -3520,7 +3593,28 @@ int xvt_sys_get_profile_string(const char* file, const char* paragraph, const ch
if (!(paragraph && *paragraph))
paragraph = "Main";
#ifdef __WXMSW__
int len = ::GetPrivateProfileString(paragraph, name, defval, value, maxsize, file);
#else
wxFileConfig ini("", "", file, "", wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
wxString path;
path << "/" << paragraph;
ini.SetPath(path);
int len = 0;
wxString val;
if (!ini.Read(name, &val))
val = defval;
len = val.Length();
if (value)
{
wxStrncpy(value, val, maxsize);
value[maxsize-1] = '\0';
}
#endif
return len;
}
@ -3549,14 +3643,29 @@ BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph, cons
if (paragraph == NULL || *paragraph == '\0')
paragraph = "Main";
#ifdef __WXMSW__
return ::WritePrivateProfileString(paragraph, name, value, file) > 0;
#else
wxFileConfig ini("", "", file, "", wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
ini.SetUmask(0x0);
wxString path;
path << "/" << paragraph;
ini.SetPath(path);
return ini.Write(name, value);
#endif
}
BOOLEAN xvt_sys_find_editor(const char* file, char* editor)
{
BOOLEAN ok = FALSE;
#ifdef __WXMSW__
const wxString e = OsWin32_File2App(file);
#else
const wxString e = OsLinux_File2App(file);
#endif
ok = !e.IsEmpty();
if (ok && editor != NULL)
wxStrncpy(editor, e, _MAX_PATH);
@ -3589,7 +3698,7 @@ unsigned long xvt_sys_get_free_memory_kb()
int xvt_sys_get_os_version()
{
int os = 0;
#ifdef __WXMSW__
int nVersion = 0;
::GetWinVer(NULL, 0, &nVersion); // Implemented in XFont.cpp, not a Win32 API
switch (nVersion)
@ -3607,6 +3716,7 @@ int xvt_sys_get_os_version()
case 111: os = XVT_WS_WIN_8; break;
default : os = XVT_WS_WIN_10; break;
}
#endif
return os;
}
@ -3629,9 +3739,12 @@ int xvt_sys_get_version(char* os_version, char* ptk_version, int maxsize)
const int version = xvt_sys_get_os_version();
if (os_version && maxsize >= 8)
{
if (version >= XVT_WS_WIN_VISTA)
#ifdef __WXMSW__
if (version >= XVT_WS_WIN_VISTA) // wxWidgets non sa descrivere i moderni sistemi Microsoft
::GetWinVer(os_version, maxsize, NULL); // wxWidgets non sa descrivere i moderni sistemi Microsoft
else
#endif
wxStrncpy(os_version, wxGetOsDescription(), maxsize);
}
if (ptk_version && maxsize >= 8)
@ -3660,7 +3773,31 @@ XVTDLL BOOLEAN xvt_sys_get_env(const char* varname, char* value, int max_size)
void xvt_sys_search_env(const char * filename, const char * varname, char * pathname)
{
#ifdef __WXMSW__
_searchenv(filename, varname, pathname);
#else
const char * value = wxGetEnv(varname);
if (value)
{
char path_list[4096];
strcpy(path_list, value);
for (const char* s = path_list; *s; )
{
char* s1 = strchr(s, ';');
if (s1 != NULL)
*s1 = '\0';
xvt_fsys_build_pathname(pathname, NULL, s, filename, NULL, NULL);
if (xvt_fsys_file_exists(pathname))
break;
if (s1 != NULL)
s = s1 + 1;
else
break;
}
}
else
*pathname = '\0';
#endif
}
BOOLEAN xvt_sys_set_env(const char* varname, const char* value)
@ -4262,7 +4399,11 @@ WINDOW xvt_win_create(WIN_TYPE wtype, const RCT* rct_p, const char* title, int m
w->_app_data = app_data;
w->SetBackgroundStyle(wxBG_STYLE_CUSTOM); // Lo sfondo viene disegnato nella OnPaint
#ifdef __WXMSW__
OsWin32_SetCaptionStyle(w->GetHWND(), style);
#else
OsLinux_SetCaptionStyle(w, style);
#endif
if (menu_rid > 0 && menu_rid != 8000) // 8000 = NULL_MENU_RID
{

View File

@ -172,7 +172,8 @@ XVTDLL BOOLEAN xvt_fsys_convert_str_to_dir(const char *path, DIRECTORY *dirp);
XVTDLL BOOLEAN xvt_fsys_convert_fspec_to_str(const FILE_SPEC *fs, char *path, int sz_path);
XVTDLL BOOLEAN xvt_fsys_convert_str_to_fspec(const char *mbs, FILE_SPEC *fs);
XVTDLL BOOLEAN xvt_fsys_get_dir(DIRECTORY* dirp);
XVTDLL BOOLEAN xvt_fsys_get_dir(DIRECTORY* dirp); // da eliminare nella 13
XVTDLL BOOLEAN xvt_fsys_get_curr_dir(DIRECTORY* dirp);
XVTDLL void xvt_fsys_get_default_dir(DIRECTORY* dirp);
XVTDLL void xvt_fsys_get_temp_dir(DIRECTORY* dirp);
XVTDLL SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs);

View File

@ -665,7 +665,7 @@ static wxString MakeFileName(const wxChar* name, const wxChar* ext)
static FL_STATUS xvt_dm_post_file_ask(FILE_SPEC *fsp, const char *msg, int flags)
{
DIRECTORY savedir; xvt_fsys_get_dir(&savedir); // Salvo cartella corrente
DIRECTORY savedir; xvt_fsys_get_curr_dir(&savedir); // Salvo cartella corrente
wxString path = fsp->dir.path;
wxString name = MakeFileName(fsp->name, fsp->type);