diff --git a/include/applicat.cpp b/include/applicat.cpp index 15accc87a..b9db275a3 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -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: { diff --git a/include/archives.cpp b/include/archives.cpp index 9e4437b36..38670603b 100755 --- a/include/archives.cpp +++ b/include/archives.cpp @@ -1,15 +1,10 @@ -#include - #include #include #include -#include #include #include -#include #include #include -#include #include /////////////////////////////////////////////////////////// @@ -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)) diff --git a/include/checks.cpp b/include/checks.cpp index 73184915e..0bccdd1ea 100755 --- a/include/checks.cpp +++ b/include/checks.cpp @@ -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); } diff --git a/include/controls.cpp b/include/controls.cpp index 9bf7ca3b2..0e03c5ef3 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -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; diff --git a/include/os_dep.h b/include/os_dep.h index f8a31c937..fcb5c0a88 100755 --- a/include/os_dep.h +++ b/include/os_dep.h @@ -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(); diff --git a/include/os_win32.cpp b/include/os_win32.cpp index 639bdabe5..7e409f384 100755 --- a/include/os_win32.cpp +++ b/include/os_win32.cpp @@ -2,7 +2,6 @@ #define WIN32_LEAN_AND_MEAN #include -#include #include #include @@ -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;