Patch level : 12.0 998

Files correlati     : xvaga.dll
Commento            :

Aggiunte funzioni per verificare e scaricare un URL
Aggiunto supporto per finestre principali non a pieno schermo.
 bisogna specificare nel paragrafo main di campo.ini MaxDim= "dimX"x"dimY esempio MaxDim=1024x768
This commit is contained in:
Alessandro Bonazzi 2020-09-24 07:09:05 +02:00
parent 070afa432b
commit ae7c61c788
4 changed files with 121 additions and 8 deletions

View File

@ -10,8 +10,14 @@
#define WINVER 0x0500
#define STRICT
#define WXUSINGDLL 1
#include <wx/wxprec.h>
#else
#define _FILE_OFFSET_BITS 64
#define _LARGE_FILES
#define __WXGTK__
#define GTK_NO_CHECK_CASTS
#define _IODBC
#include <wx/wx.h>
#endif
#include <wx/wxprec.h>
#endif
#endif

View File

@ -141,6 +141,46 @@ void xvt_app_create(int WXUNUSED(argc), char** WXUNUSED(argv), unsigned long WXU
if ((szWin.y - szCli.y) > 2) // Sposto la finestra in modo da coprire il menu del padre
_startup_rect.top -= xvt_vobj_get_attr(NULL_WIN, ATTR_MENU_HEIGHT);
}
else
{
char xmax[50];
xvt_sys_get_profile_string(xvt_fsys_get_campo_ini(), "Main", "MaxDim", "MAX", xmax, sizeof(xmax));
if (strcmp(xmax, "MAX") != 0)
{
char * ymax = strchr(xmax, 'x');
if (ymax == NULL)
ymax = strchr(xmax, 'X');
if (ymax != NULL)
{
*ymax++ = '\0';
const wxRect rect = wxGetClientDisplayRect();
int x = atoi(xmax);
int y = atoi(ymax);
if (x >= 1024 && y >= 768)
{
pos = rect.GetPosition();
size = rect.GetSize();
pos.x += (size.x - x) / 2;
pos.y += (size.y - y) / 2;
size.x = x;
size.y = y;
}
else
{
pos.x = 0;
pos.y = 0;
size.x = 0;
size.y = 0;
}
}
}
}
#endif
if (_startup_rect.right > _startup_rect.left)
@ -153,11 +193,16 @@ void xvt_app_create(int WXUNUSED(argc), char** WXUNUSED(argv), unsigned long WXU
else
{
#ifdef __WXMSW__
style |= wxMAXIMIZE;
if (size.x <= 0 || size.y <= 0)
style |= wxMAXIMIZE;
else
style &= ~wxMAXIMIZE;
#else
style &= ~wxMAXIMIZE;
const wxRect rect = wxGetClientDisplayRect();
pos = rect.GetPosition();
const wxRect rect = wxGetClientDisplayRect();
pos = rect.GetPosition();
size = rect.GetSize();
#endif
}
@ -1487,7 +1532,16 @@ BOOLEAN xvt_fsys_parse_pathname(const char* mbs, char* volname, char* dirname, c
if (dirname) strcpy(dirname, path);
if (leafroot) strcpy(leafroot, file);
if (leafext) strcpy(leafext, ext);
if (leafvers) strcpy(leafvers, ""); // TBI put here last change date/time?
if (leafvers)
{
wxFileName name(mbs);
wxDateTime t;
wxString strTime;
name.GetTimes(nullptr, &t, nullptr);
strTime = t.Format(wxDefaultDateTimeFormat);
strcpy(leafvers, strTime);
}
return true;
}
@ -1755,9 +1809,27 @@ long xvt_fsys_file_attr(const char* path, long attr)
ret = sz.GetHi() != 0 ? INT_MAX : sz.GetLo();
}
break;
case XVT_FILE_ATTR_ATIME:
{
wxFileName name(path);
wxDateTime t;
name.GetTimes(&t, nullptr, nullptr);
ret = t.GetTicks();
}
break;
case XVT_FILE_ATTR_MTIME:
ret = ::wxFileModificationTime(path);
break;
case XVT_FILE_ATTR_CTIME:
{
wxFileName name(path);
wxDateTime t;
name.GetTimes(nullptr, nullptr, &t);
ret = t.GetTicks();
}
break;
default: break;
}
}
@ -4689,8 +4761,32 @@ BOOLEAN statbar_destroy(WINDOW win)
pStatusBar->Destroy();
}
return pStatusBar != NULL;
}
BOOLEAN xvt_url_valid(const char * url)
{
if (url && *url)
{
wxURL u(url);
return u.IsOk();
}
return FALSE;
}
BOOLEAN xvt_url_get(const char * url, const char * path, const char *outfile)
{
if (xvt_url_valid(url))
{
wxURL u(url);
wxInputStream * in = u.GetInputStream();
wxString file(outfile);
wxFileOutputStream out(file);
in->Read(out);
return TRUE;
}
return FALSE;
}

View File

@ -558,6 +558,9 @@ XVTDLL void xvt_treelist_set_node_images(WINDOW win, XVT_TREEVIEW_N
XVTDLL void xvt_treelist_set_node_string(WINDOW win, XVT_TREEVIEW_NODE node, const char* text);
XVTDLL void xvt_treelist_suspend(WINDOW win);
XVTDLL BOOLEAN xvt_url_valid(const char * url);
XVTDLL BOOLEAN xvt_url_get(const char * url, const char * path, const char * outfile);
// Send email using normal methods
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

View File

@ -6,6 +6,14 @@
#define TRUE 1
#endif
#ifdef LINUX
#define _MAX_PATH 512
#define _MAX_EXT 6
#define _MAX_DRIVE 6
#define _MAX_DIR 512
#define _MAX_FNAME 512
#endif
typedef unsigned long WINDOW;
typedef unsigned int UNIT_TYPE;
typedef unsigned long ULONG;