Proting a 32Bit

git-svn-id: svn://10.65.10.50/trunk@4489 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-06-02 10:16:10 +00:00
parent 797062113f
commit 684d7bc7db
10 changed files with 119 additions and 114 deletions

View File

@ -726,7 +726,7 @@ bool TMask::on_key(
next_page(+1); next_page(+1);
break; break;
case K_F1: case K_F1:
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (fexist("prassi.hlp")) if (fexist("prassi.hlp"))
{ {
struct MULTIGUY struct MULTIGUY

View File

@ -174,7 +174,7 @@ long TMemo_file::set_field(TTextfile& t, long id)
fseek(_fp, 0, SEEK_END); fseek(_fp, 0, SEEK_END);
// lock file // lock file
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_locking(_fileno(_fp), _LK_LOCK, MAX_SIZE); _locking(_fileno(_fp), _LK_LOCK, MAX_SIZE);
#else #else
locking(fileno(_fp), LK_LOCK, MAX_SIZE); locking(fileno(_fp), LK_LOCK, MAX_SIZE);
@ -212,7 +212,7 @@ long TMemo_file::set_field(TTextfile& t, long id)
fseek(_fp, 0, SEEK_SET); fseek(_fp, 0, SEEK_SET);
fwrite(&_id_max, sizeof(long), 1, _fp); fwrite(&_id_max, sizeof(long), 1, _fp);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_locking(_fileno(_fp), _LK_UNLCK, MAX_SIZE); _locking(_fileno(_fp), _LK_UNLCK, MAX_SIZE);
#else #else
locking(fileno(_fp), LK_UNLCK, MAX_SIZE); locking(fileno(_fp), LK_UNLCK, MAX_SIZE);

View File

@ -4,7 +4,7 @@
#define XVT_INCL_NATIVE #define XVT_INCL_NATIVE
#include <xvt.h> #include <xvt.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <strstrea.h> #include <strstrea.h>
#else #else
#include <strstream.h> #include <strstream.h>
@ -227,7 +227,7 @@ struct PrDesc
} }
PrintWhat; PrintWhat;
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
void TPrinter::_get_windows_printer_names (TToken_string & t) void TPrinter::_get_windows_printer_names (TToken_string & t)
{ {
@ -893,7 +893,7 @@ PRINT_RCD* TPrinter::get_printrcd(int *size)
return _print_rcd; return _print_rcd;
} }
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// @doc EXTERNAL // @doc EXTERNAL
@ -1045,7 +1045,7 @@ TPrinter::TPrinter()
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE), : _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12), _ncopies(1), _export_header(FALSE), _lines_per_inch (6), _ch_size (12), _ncopies(1), _export_header(FALSE),
_export_header_len(0), _vf(NULL), _l_offset(0), _c_offset(0) _export_header_len(0), _vf(NULL), _l_offset(0), _c_offset(0)
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
, _print_rcd(NULL) , _print_rcd(NULL)
#endif #endif
@ -1071,7 +1071,7 @@ TPrinter::TPrinter()
// read configuration file // read configuration file
read_configuration (); read_configuration ();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// xvt_print_open (); // xvt_print_open ();
set_win_formlen (); set_win_formlen ();
@ -1134,7 +1134,7 @@ bool TPrinter::isfax() const
TToken_string& TPrinter::getprinternames () TToken_string& TPrinter::getprinternames ()
{ {
// per ora va solo in windows // per ora va solo in windows
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (_printer_names.empty()) if (_printer_names.empty())
_get_windows_printer_names(_printer_names); _get_windows_printer_names(_printer_names);
#endif #endif
@ -1243,7 +1243,7 @@ void TPrinter::read_configuration(
{ {
case 0: case 0:
case 5: case 5:
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_printertype = winprinter; _printertype = winprinter;
#else #else
PrinterDef & def = (PrinterDef &) get_description (_curprn); PrinterDef & def = (PrinterDef &) get_description (_curprn);
@ -1320,7 +1320,7 @@ void TPrinter::save_configuration()
TPrinter::~TPrinter () TPrinter::~TPrinter ()
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (_print_rcd != NULL) if (_print_rcd != NULL)
{ {
xvt_print_destroy(_print_rcd); xvt_print_destroy(_print_rcd);
@ -1480,7 +1480,7 @@ bool TPrinter::printrow(
return TRUE; return TRUE;
} }
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (_printertype == fileprinter) if (_printertype == fileprinter)
{ {
@ -1752,7 +1752,7 @@ bool TPrinter::open()
_vf->open_modal (); _vf->open_modal ();
} }
else if (_printertype == winprinter || _printertype == export else if (_printertype == winprinter || _printertype == export
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|| _printertype == fileprinter || _printertype == fileprinter
#endif #endif
) )
@ -1811,7 +1811,7 @@ bool TPrinter::set()
mask.enable(DLG_OK, can_save); mask.enable(DLG_OK, can_save);
// mask.enable(DLG_SAVEREC, can_save); // mask.enable(DLG_SAVEREC, can_save);
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
pn2 = getprinternames(); pn2 = getprinternames();
char old_default[80]; char old_default[80];
@ -1856,7 +1856,7 @@ bool TPrinter::set()
if (k == DLG_SETPRINT) if (k == DLG_SETPRINT)
{ {
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd // l'handler setta default di windows a quella nel listbox e ribecca l'rcd
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (xvt_dm_post_page_setup(get_printrcd())) if (xvt_dm_post_page_setup(get_printrcd()))
{ {
// see if user has changed printer // see if user has changed printer
@ -1984,7 +1984,7 @@ int TPrinter::set_bookmark(
void TPrinter::print_txt(TTextfile& txt) void TPrinter::print_txt(TTextfile& txt)
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (txt.lines() > 0) if (txt.lines() > 0)
{ {
PrintWhat._prcd = _print_rcd; PrintWhat._prcd = _print_rcd;
@ -2041,7 +2041,7 @@ void TPrinter::close ()
txt.close(); txt.close();
} }
} }
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
else if (_printertype == winprinter && _txt.lines() > 0L) else if (_printertype == winprinter && _txt.lines() > 0L)
{ {
print_txt(_txt); print_txt(_txt);
@ -2094,7 +2094,7 @@ void TPrinter::close ()
#include <bagn004.h> #include <bagn004.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const char* const FORMAT_COMMAND = "FORMAT"; const char* const FORMAT_COMMAND = "FORMAT";
#else #else
const char* const FORMAT_COMMAND = "dosformat -fq"; const char* const FORMAT_COMMAND = "dosformat -fq";

View File

@ -390,7 +390,7 @@ public:
virtual ~TPrinter(); virtual ~TPrinter();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// @cmember Inizia una nuova sessione di stampa. Viene passata alla <mf TPrintwin::do_print> // @cmember Inizia una nuova sessione di stampa. Viene passata alla <mf TPrintwin::do_print>
static BOOLEAN XVT_CALLCONV1 start_winprint(long); static BOOLEAN XVT_CALLCONV1 start_winprint(long);
#endif #endif
@ -630,7 +630,7 @@ public:
void set_printrcd(); void set_printrcd();
// @cmember Ritorna il record per la descrizione dello stato dell stampante // @cmember Ritorna il record per la descrizione dello stato dell stampante
PRINT_RCD* get_printrcd(int* size = NULL); PRINT_RCD* get_printrcd(int* size = NULL);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// @cmember Setta le caratteristiche della stampante leggendole da <p _print_rcd> // @cmember Setta le caratteristiche della stampante leggendole da <p _print_rcd>
void set_win_formlen(WINDOW prwin = NULL_WIN); void set_win_formlen(WINDOW prwin = NULL_WIN);
#endif #endif

View File

@ -183,7 +183,7 @@ void TPrintwin::paint_row(long j)
const char* cp; const char* cp;
while((cp = _txt.piece()) != NULL) while((cp = _txt.piece()) != NULL)
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const int st = _txt.get_style(); const int st = _txt.get_style();
set_font(printer().fontname(), st, _char_size); set_font(printer().fontname(), st, _char_size);
@ -215,7 +215,7 @@ void TPrintwin::paint_row(long j)
else else
{ {
set_font(printer().fontname(), XVT_FS_NONE, _char_size); set_font(printer().fontname(), XVT_FS_NONE, _char_size);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// Questa e' la patch per TTY.DRV. // Questa e' la patch per TTY.DRV.
const TString s(_txt.line(j - _frlc)); const TString s(_txt.line(j - _frlc));
if (j > 0 && (j % _realformlen) == 0 || _blank_lines_to_print > 0) if (j > 0 && (j % _realformlen) == 0 || _blank_lines_to_print > 0)
@ -358,7 +358,7 @@ TPrintwin::TPrintwin(TTextfile& txt)
{ {
TPrinter& p = printer(); TPrinter& p = printer();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_printrcd = p.get_printrcd(); _printrcd = p.get_printrcd();
WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title()); WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title());
@ -375,7 +375,7 @@ TPrintwin::TPrintwin(TTextfile& txt)
LEN_SPACES(win(), -1); // force update LEN_SPACES(win(), -1); // force update
_pagelen = p.formlen(); _pagelen = p.formlen();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
p.set_win_formlen(prwin); // Calcola offset e altre misure pagina p.set_win_formlen(prwin); // Calcola offset e altre misure pagina
int abs_column=p.get_column_offset(); int abs_column=p.get_column_offset();

View File

@ -7,7 +7,7 @@
#include <conf.h> #include <conf.h>
#include <modaut.h> #include <modaut.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <dos.h> #include <dos.h>
#include <hlapi_c.h> #include <hlapi_c.h>
#endif #endif
@ -33,7 +33,7 @@ long get_std_level()
// @rdesc Numero di serie della chiave // @rdesc Numero di serie della chiave
int get_serial_number() int get_serial_number()
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY); const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
if (status != STATUS_OK) if (status != STATUS_OK)
return -1; return -1;
@ -82,7 +82,7 @@ void init_global_vars()
// @func Dealloca le variabili globali // @func Dealloca le variabili globali
void free_global_vars() void free_global_vars()
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
HL_LOGOUT(); HL_LOGOUT();
#endif #endif
if (openf != NULL) if (openf != NULL)

View File

@ -2,7 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <strstrea.h> #include <strstrea.h>
#else #else
#include <strstream.h> #include <strstream.h>
@ -12,7 +12,7 @@
#include <prefix.h> #include <prefix.h>
#include <utility.h> #include <utility.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <process.h> #include <process.h>
#else #else
#include <sys/types.h> #include <sys/types.h>
@ -455,9 +455,9 @@ TString& TString::rpad(const int n,const char c)
if (n>l) if (n>l)
{ {
if (n > size()) resize(n, TRUE); if (n > size()) resize(n, TRUE);
memset(_str+l, c, n-l); memset(_str+l, c, n-l);
_str[n] = '\0'; _str[n] = '\0';
} }
return *this; return *this;
} }
@ -470,11 +470,11 @@ TString& TString::lpad(const int n,const char c)
const int nsp=n-l; const int nsp=n-l;
if (n>l) if (n>l)
{ {
if (n > size()) resize(n, TRUE); if (n > size()) resize(n, TRUE);
for (l--; l>=0; l--) for (l--; l>=0; l--)
*(_str+l+nsp)=*(_str+l); *(_str+l+nsp)=*(_str+l);
memset(_str, c, nsp); memset(_str, c, nsp);
_str[n] = '\0'; _str[n] = '\0';
} }
return *this; return *this;
} }
@ -925,7 +925,7 @@ TString& TFixed_string::format(
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
const char SLASH = const char SLASH =
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
'\\'; '\\';
#else #else
'/'; '/';
@ -1004,7 +1004,7 @@ bool TFilename::ok() const
{ {
switch(_str[c]) switch(_str[c])
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
case ':': case ':':
if (c != 1 || !isalpha(_str[0])) return FALSE; // Nome disco errato if (c != 1 || !isalpha(_str[0])) return FALSE; // Nome disco errato
len = 0; len = 0;
@ -1046,7 +1046,7 @@ const TFilename& TFilename::tempdir()
const char* dirpref = getenv("TEMP"); const char* dirpref = getenv("TEMP");
if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP"); if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP");
if (dirpref == NULL || *dirpref == '\0') if (dirpref == NULL || *dirpref == '\0')
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
dirpref = "\\tmp"; dirpref = "\\tmp";
#else #else
dirpref = "/tmp"; dirpref = "/tmp";
@ -1106,7 +1106,7 @@ const TFilename& TFilename::temp(
strip("$#*?."); // ... toglie caratteri jolly strip("$#*?."); // ... toglie caratteri jolly
const TFixed_string f(prefix); const TFixed_string f(prefix);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (f.find("$$") != -1) if (f.find("$$") != -1)
{ {
char pid[8]; char pid[8];

View File

@ -9,7 +9,7 @@
#include <xvt.h> #include <xvt.h>
#endif #endif
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>
#define F_OK 0 #define F_OK 0
@ -55,7 +55,7 @@ bool fcopy(
// creati dei box di comunicazione che indicano la causa del problema // creati dei box di comunicazione che indicano la causa del problema
{ {
const char* wflag; const char* wflag;
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const char* const rflag = "rb"; const char* const rflag = "rb";
if (append) if (append)
wflag = "ab"; wflag = "ab";
@ -120,7 +120,7 @@ bool make_dir(
const char* dir) // @parm Nome della directory da creare const char* dir) // @parm Nome della directory da creare
{ {
int res = int res =
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
mkdir(dir); mkdir(dir);
#else #else
mkdir(dir, 0777); mkdir(dir, 0777);
@ -431,7 +431,8 @@ os_type get_os_type()
return os_WindowsNT; return os_WindowsNT;
return os_Windows; return os_Windows;
#else #else
#error Ricordati di Win32 // #error Ricordati di Win32
return os_WindowsNT;
#endif #endif
} }

View File

@ -763,7 +763,7 @@ void TWindow::set_focus()
void TWindow::iconize() const void TWindow::iconize() const
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW); HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_MINIMIZE); ShowWindow(hwnd, SW_MINIMIZE);
#endif #endif
@ -771,7 +771,7 @@ void TWindow::iconize() const
void TWindow::maximize() const void TWindow::maximize() const
{ {
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW); HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_SHOWMAXIMIZED); ShowWindow(hwnd, SW_SHOWMAXIMIZED);
#else #else
@ -931,7 +931,7 @@ void TWindow::frame(
r.top = f.v; r.left = f.h; r.top = f.v; r.left = f.h;
r.bottom = t.v; r.right = t.h; r.bottom = t.v; r.right = t.h;
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (flag & 2) if (flag & 2)
{ {
r.left += CHARX>>1; r.top += CHARY>>1; r.left += CHARX>>1; r.top += CHARY>>1;
@ -1012,7 +1012,7 @@ TPoint TWindow::dev2log(const PNT& p) const
void TWindow::stringat(short x, short y, const char* str) void TWindow::stringat(short x, short y, const char* str)
{ {
PNT pnt = log2dev(x,y); PNT pnt = log2dev(x,y);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
pnt.v += BASEY; pnt.v += BASEY;
#endif #endif
@ -1041,7 +1041,7 @@ void TWindow::line(short x0, short y0, short x1, short y1)
PNT f = log2dev(x0,y0); PNT f = log2dev(x0,y0);
PNT t = log2dev(x1,y1); PNT t = log2dev(x1,y1);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1; if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1;
if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1; if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1;
if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1; if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1;

View File

@ -27,12 +27,72 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
#endif #endif
} }
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#ifndef ATTR_WIN_USE_CTL3D #ifndef ATTR_WIN_USE_CTL3D
#include <ctl3d.h> #include <ctl3d.h>
#endif #endif
#endif
HIDDEN HINSTANCE HInstance;
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
static BOOLEAN event_hook(HWND hwnd,
UINT msg,
UINT wparam,
ULONG lparam,
long* ret)
{
switch(msg)
{
#ifndef ATTR_WIN_USE_CTL3D
case WM_SYSCOLORCHANGE:
Ctl3dColorChange();
break;
#endif
case WM_MENUCHAR:
if (wparam > ' ' && wparam <= 'z')
{
WINDOW win = cur_win();
if (win != NULL_WIN)
{
// TWindow* w = (TWindow*)xvt_vobj_get_data(win);
const KEY key = toupper(wparam)+K_CTRL;
// w->on_key(key);
dispatch_e_char(win, key);
*ret = 2 << 8;
}
}
break;
case WM_KEYDOWN:
if (wparam == VK_F1)
{
if ((lparam & (1<<29)) == 0) // Il tasto alt non e' premuto
{
KEY k = K_F1;
int sc = GetAsyncKeyState(VK_CONTROL); // Stato del tasto control
if (sc & 1) k += K_CTRL;
int ss = GetAsyncKeyState(VK_SHIFT); // Stato del tasto shift
if (ss & 1) k += K_SHIFT;
WINDOW win = cur_win();
if (win != NULL_WIN)
dispatch_e_char(win, k);
}
}
break;
default:
if (msg == WM_WAKEUP && wparam == main_app().waiting())
main_app().wake_up();
break;
}
return TRUE; // Continua col processo normale
}
#if XVT_OS == XVT_OS_WIN
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#pragma hdrstop #pragma hdrstop
@ -47,8 +107,6 @@ short ROWY = -GetSystemMetrics(SM_CYSCREEN) / 25; // Not so good!
short CHARY = 14; short CHARY = 14;
short BASEY = 12; short BASEY = 12;
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
// By Matt Pietrek // By Matt Pietrek
//######################################################################## //########################################################################
// Code that does the real work // Code that does the real work
@ -126,7 +184,6 @@ int MungeModuleHeader( HINSTANCE hInstance, BOOL fMunge )
HIDDEN NPHOOKCHILD npHookLoadModule = 0; HIDDEN NPHOOKCHILD npHookLoadModule = 0;
HIDDEN char szOurFileName[MAX_PATH]; HIDDEN char szOurFileName[MAX_PATH];
HIDDEN HINSTANCE HInstance;
HINSTANCE HINSTANCE
WINAPI WINAPI
@ -206,60 +263,6 @@ BOOL allow_another_instance()
return (BOOL)npHookLoadModule; return (BOOL)npHookLoadModule;
} }
static BOOLEAN event_hook(HWND hwnd,
UINT msg,
UINT wparam,
ULONG lparam,
long* ret)
{
switch(msg)
{
#ifndef ATTR_WIN_USE_CTL3D
case WM_SYSCOLORCHANGE:
Ctl3dColorChange();
break;
#endif
case WM_MENUCHAR:
if (wparam > ' ' && wparam <= 'z')
{
WINDOW win = cur_win();
if (win != NULL_WIN)
{
// TWindow* w = (TWindow*)xvt_vobj_get_data(win);
const KEY key = toupper(wparam)+K_CTRL;
// w->on_key(key);
dispatch_e_char(win, key);
*ret = 2 << 8;
}
}
break;
case WM_KEYDOWN:
if (wparam == VK_F1)
{
if ((lparam & (1<<29)) == 0) // Il tasto alt non e' premuto
{
KEY k = K_F1;
int sc = GetAsyncKeyState(VK_CONTROL); // Stato del tasto control
if (sc & 1) k += K_CTRL;
int ss = GetAsyncKeyState(VK_SHIFT); // Stato del tasto shift
if (ss & 1) k += K_SHIFT;
WINDOW win = cur_win();
if (win != NULL_WIN)
dispatch_e_char(win, k);
}
}
break;
default:
if (msg == WM_WAKEUP && wparam == main_app().waiting())
main_app().wake_up();
break;
}
return TRUE; // Continua col processo normale
}
#endif #endif
// @doc INTERNAL // @doc INTERNAL
@ -600,8 +603,8 @@ void set_xvt_hooks()
xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook); xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook);
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE); xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook); xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)event_hook);
#ifdef ATTR_WIN_USE_CTL3D #ifdef ATTR_WIN_USE_CTL3D
xvt_vobj_set_attr(NULL_WIN, ATTR_WIN_USE_CTL3D, TRUE); xvt_vobj_set_attr(NULL_WIN, ATTR_WIN_USE_CTL3D, TRUE);
@ -637,9 +640,10 @@ void customize_controls(
{ {
if (on) if (on)
{ {
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
HInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
#ifndef ATTR_WIN_USE_CTL3D #ifndef ATTR_WIN_USE_CTL3D
HInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
Ctl3dRegister(HInstance); Ctl3dRegister(HInstance);
Ctl3dAutoSubclass(HInstance); Ctl3dAutoSubclass(HInstance);
#endif #endif
@ -651,7 +655,7 @@ void customize_controls(
} }
else else
{ {
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#ifndef ATTR_WIN_USE_CTL3D #ifndef ATTR_WIN_USE_CTL3D
Ctl3dUnregister(HInstance); Ctl3dUnregister(HInstance);
#endif #endif
@ -953,7 +957,7 @@ WINDOW xvt_create_statbar()
{ {
CHECK(_statbar == NULL_WIN, "Onli uan statbar, plis"); CHECK(_statbar == NULL_WIN, "Onli uan statbar, plis");
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const int prop_count = 4; const int prop_count = 4;
char* prop_list[prop_count+1] = char* prop_list[prop_count+1] =
{ {