Patch level : 2.0 nopatch

Files correlati     : librerie
Ricompilazione Demo : [ ]
Commento            :
Spostata un'altra vagonata di roba da os_dep a xvaga


git-svn-id: svn://10.65.10.50/trunk@10952 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-03-28 15:32:17 +00:00
parent d1515b803e
commit 6876377a21
6 changed files with 6 additions and 147 deletions

View File

@ -113,7 +113,7 @@ TInfo_mask::TInfo_mask()
add_row(TR("Ditta"), firm.codice());
add_row(TR("Valuta"), firm.codice_valuta());
add_row(TR("Stampante"), stampante);
add_row(TR("Mb liberi"), os_get_disk_free_space("c:/", 'M'));
add_row(TR("Mb su disco"), xvt_fsys_get_disk_free_space("c:/", 'M'));
add_button(DLG_OK, 0, "", -11, -1, 10, 2);
}
@ -375,11 +375,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
{
on_firm_change();
on_config_change();
#ifdef XVAGA
return 1;
#else
do_events();
#endif
}
else
stop_run();
@ -438,10 +434,8 @@ long TApplication::handler(WINDOW win, EVENT* ep)
case E_CLOSE:
if (can_close())
stop_run();
#ifdef XVAGA
else
return 1; // Divieto!
#endif
break;
case E_FONT:
{

View File

@ -1,15 +1,10 @@
#include <direct.h>
#include <agasys.h>
#include <archives.h>
#include <config.h>
#include <defmask.h>
#include <isam.h>
#include <mask.h>
#include <os_dep.h>
#include <prefix.h>
#include <progind.h>
#include <urldefid.h>
#include <utility.h>
///////////////////////////////////////////////////////////
@ -183,12 +178,12 @@ bool TArchive::move_file(const TFilename& file, const char* dir) const
bool space_ok = filesize <= 0;
while (!space_ok)
{
space_ok = ::os_test_disk_free_space(dest, filesize);
space_ok = xvt_fsys_test_disk_free_space(dest, filesize) != 0;
if (!space_ok)
{
TString msg(128);
msg << "Lo spazio sull'unita' e' insufficiente:\n";
if (::os_is_removable_drive(dest))
if (xvt_fsys_is_removable_drive(dest))
msg << "Inserire un nuovo disco e ritentare?";
else
msg << "Liberare dello spazio e ritentare?";
@ -272,7 +267,7 @@ bool TArchive::fsplit_zip(
while (size <= 0)
{
message_box("Inserire il disco 1 nel drive %c:", floppy);
size = os_get_disk_size(path) - (64L*1024L);
size = xvt_fsys_get_disk_size(path, 'K') - 64;
if (size <= 0)
{
if (!yesno_box("Errore di accesso al drive %c\nSi desidera ritentare?", floppy))

View File

@ -179,7 +179,7 @@ bool __trace(
bool __tracemem(const char* msg)
{
unsigned long mem = os_get_free_memory() / 1024;
unsigned long mem = xvt_sys_get_free_memory_kb();
return __trace("%5lu Kb - %s", mem, msg);
}

View File

@ -2128,7 +2128,7 @@ void TDropDownList::create()
{
if (_xi_lst) return;
XI_OBJ_DEF* itfdef = xi_create_itf_def(ITF_CID, (XI_EVENT_HANDLER)ddl_str_eh, NULL, "",
XI_OBJ_DEF* itfdef = xi_create_itf_def(ITF_CID+1, (XI_EVENT_HANDLER)ddl_str_eh, NULL, "",
(long)this);
itfdef->v.itf->automatic_back_color = TRUE;

View File

@ -15,14 +15,6 @@ os_type os_get_type();
void os_post_menu_event(WINDOW win, MENU_TAG tag);
unsigned long os_get_free_memory();
bool os_is_removable_drive(const char* path);
bool os_is_network_drive(const char* path);
bool os_is_fixed_drive(const char* path);
unsigned long os_get_disk_size(const char* path, char unit = 'b'); // units allowed: b, K, M, G, T
unsigned long os_get_disk_free_space(const char* path, char unit = 'b');
bool os_test_disk_free_space(const char* path, unsigned long filesize_bytes);
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild);
unsigned long os_execute_in_window(const TFilename& path, WINDOW win);
@ -39,12 +31,6 @@ int os_get_printer_names(TToken_string& printers);
bool os_set_default_printer(const char* name);
bool os_get_default_printer(TString& name);
/*
bool os_open_spool_row(const char* device);
bool os_spool_row(const char* str);
bool os_close_spool_row();
*/
bool os_dongle_server_running();
bool os_test_network_version();

View File

@ -2,7 +2,6 @@
#define WIN32_LEAN_AND_MEAN
#include <os_dep.h>
#include <commdlg.h>
#include <winver.h>
#include <ctype.h>
@ -29,121 +28,6 @@ void os_draw_native_icon(WINDOW win, const RCT& rct, unsigned icon)
DrawIcon(hdc, x, y, (HICON)icon);
}
unsigned long os_get_free_memory()
{
MEMORYSTATUS ms;
GlobalMemoryStatus(&ms);
return ms.dwAvailPhys;
}
bool os_is_removable_drive(const char* path)
{
return GetDriveType(path) == DRIVE_REMOVABLE;
}
bool os_is_network_drive(const char* path)
{
return GetDriveType(path) == DRIVE_REMOTE;
}
bool os_is_fixed_drive(const char* path)
{
UINT dt = GetDriveType(path);
return dt == DRIVE_FIXED;
}
static unsigned long get_disk_size(const char* path, bool tot, char unit)
{
char drive[_MAX_DRIVE+1];
_splitpath(path, drive, NULL, NULL, NULL);
strcat(drive, "/");
DWORD nSecPerClust, nBytePerSec, nFreeClust, nTotalClust;
::GetDiskFreeSpace(drive, &nSecPerClust, &nBytePerSec, &nFreeClust, &nTotalClust);
__int64 nBytes = tot ? nTotalClust : nFreeClust;
nBytes *= nSecPerClust;
nBytes *= nBytePerSec;
switch (unit)
{
case 'K': nBytes >>= 10; break; // Kilobytes
case 'M': nBytes >>= 20; break; // Megabytes
case 'G': nBytes >>= 30; break; // Gigabytes
case 'T': nBytes >>= 40; break; // Terabytes
default: break;
}
const unsigned long nMax = (unsigned long)(~0L);
unsigned long nVal = nBytes > nMax ? nMax : (unsigned long)nBytes;
return nVal;
}
unsigned long os_get_disk_size(const char* path, char unit)
{
return get_disk_size(path, true, unit);
}
unsigned long os_get_disk_free_space(const char* path, char unit)
{
return get_disk_size(path, false, unit);
}
bool os_test_disk_free_space(const char* path, unsigned long filesize)
{
// Arrotonda per eccesso al Kilobyte
unsigned long kb = (filesize+1023)/1024;
return kb <= os_get_disk_free_space(path, 'K');
}
/*
void os_exec_help_command(MENU_TAG tag, const char* key)
{
TFilename hlp("prassi.hlp");
TString mod(key);
if (mod.not_empty())
{
mod.cut(2); mod.lower();
if (mod != "ba")
hlp.insert(mod, 0);
}
else
{
if (tag == M_HELP_ONCONTEXT)
tag = M_HELP_CONTENTS;
}
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
switch(tag)
{
case M_HELP_CONTENTS:
WinHelp(hwnd, hlp, HELP_CONTENTS, 0);
break;
case M_HELP_SEARCH:
WinHelp(hwnd, hlp, HELP_PARTIALKEY, (DWORD)"");
break;
case M_HELP_HELPONHELP:
WinHelp(hwnd, hlp, HELP_HELPONHELP, 0);
break;
case M_HELP_ONCONTEXT:
if (hlp.exist())
{
struct MULTIGUY
{
DWORD mkSize;
TCHAR mkKeylist;
TCHAR mkKeyphrase[16];
} mk;
mk.mkSize = sizeof(MULTIGUY);
mk.mkKeylist = 'M';
strncpy(mk.mkKeyphrase, key, sizeof(mk.mkKeyphrase));
WinHelp(hwnd, hlp, HELP_MULTIKEY, (DWORD)&mk);
}
break;
default: break;
}
}
*/
int os_execute(const TFilename& path, bool sync, bool iconizetask, bool showchild)
{
int exitcode = -1;