Patch level : 1.32 nopatch
Files correlati : Tutto Ricompilazione Demo : [ ] Commento : Hello 32 bits world! git-svn-id: svn://10.65.10.50/trunk@10097 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e513c7e910
commit
bf0690bda0
@ -1,5 +1,3 @@
|
|||||||
#define STRICT
|
|
||||||
#define XVT_INCL_NATIVE
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -78,7 +76,7 @@ HIDDEN const char* prassi_spa(TString& firm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (firm.empty())
|
if (firm.empty())
|
||||||
firm = "PR.A.S.S.I. S.p.A.";
|
firm = "Campo";
|
||||||
|
|
||||||
return firm;
|
return firm;
|
||||||
}
|
}
|
||||||
@ -89,11 +87,8 @@ HIDDEN const char* prassi_spa(TString& firm)
|
|||||||
|
|
||||||
HIDDEN long backdrop_eh(WINDOW win, EVENT* ep)
|
HIDDEN long backdrop_eh(WINDOW win, EVENT* ep)
|
||||||
{
|
{
|
||||||
bool has_palette = TRUE;
|
XVT_DISPLAY_TYPE type = (XVT_DISPLAY_TYPE)xvt_vobj_get_attr(win, ATTR_DISPLAY_TYPE);
|
||||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
bool has_palette = type != XVT_DISPLAY_DIRECT_COLOR;
|
||||||
HDC hdc = (HDC)xvt_vobj_get_attr(win, ATTR_NATIVE_GRAPHIC_CONTEXT);
|
|
||||||
has_palette = (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE) != 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!has_palette)
|
if (!has_palette)
|
||||||
{
|
{
|
||||||
@ -148,7 +143,7 @@ public:
|
|||||||
|
|
||||||
TBanner::TBanner()
|
TBanner::TBanner()
|
||||||
{
|
{
|
||||||
create(-1, 6, 72, 6, "BANNER", WSF_NONE, W_PLAIN);
|
create(-1, 1, 76, 4, "BANNER", WSF_NONE, W_PLAIN);
|
||||||
hide_brush();
|
hide_brush();
|
||||||
open();
|
open();
|
||||||
do_events();
|
do_events();
|
||||||
@ -186,11 +181,6 @@ void TBanner::handler(WINDOW win, EVENT* ep)
|
|||||||
x = (r.right-r.left-w)>>1; y = BIGY;
|
x = (r.right-r.left-w)>>1; y = BIGY;
|
||||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||||
|
|
||||||
t = "Caricamento in corso";
|
|
||||||
w = xvt_dwin_get_text_width(win, t, -1);
|
|
||||||
x = (r.right-r.left-w)>>1, y = r.bottom - CHARY;
|
|
||||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
|
||||||
|
|
||||||
r.left += 5; r.right -= 4;
|
r.left += 5; r.right -= 4;
|
||||||
r.top += 5; r.bottom -= 4;
|
r.top += 5; r.bottom -= 4;
|
||||||
set_pen(COLOR_WHITE); xvt_dwin_draw_rect(win, &r);
|
set_pen(COLOR_WHITE); xvt_dwin_draw_rect(win, &r);
|
||||||
@ -203,7 +193,7 @@ void TBanner::handler(WINDOW win, EVENT* ep)
|
|||||||
TWindow::handler(win, ep);
|
TWindow::handler(win, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
long XVT_CALLCONV1 TApplication::task_eh(WINDOW win, EVENT *ep)
|
long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||||
{
|
{
|
||||||
switch (ep->type)
|
switch (ep->type)
|
||||||
{
|
{
|
||||||
@ -275,7 +265,7 @@ long XVT_CALLCONV1 TApplication::task_eh(WINDOW win, EVENT *ep)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _application->handler(win, ep);
|
return _application->handler(win, ep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TApplication::dispatch_e_menu(MENU_TAG tag)
|
void TApplication::dispatch_e_menu(MENU_TAG tag)
|
||||||
@ -350,6 +340,10 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
|||||||
case E_CLOSE:
|
case E_CLOSE:
|
||||||
if (can_close())
|
if (can_close())
|
||||||
stop_run();
|
stop_run();
|
||||||
|
#ifdef XVGUY
|
||||||
|
else
|
||||||
|
return 1; // Divieto!
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case E_FONT:
|
case E_FONT:
|
||||||
{
|
{
|
||||||
@ -489,7 +483,7 @@ const char* TApplication::get_module_name() const
|
|||||||
TString& module = ((TApplication*)this)->_module_name; // Fool the compiler
|
TString& module = ((TApplication*)this)->_module_name; // Fool the compiler
|
||||||
if (module.empty())
|
if (module.empty())
|
||||||
{
|
{
|
||||||
TScanner scanner("prassi.aut");
|
TScanner scanner(AUT_FILE);
|
||||||
|
|
||||||
bool ok = FALSE;
|
bool ok = FALSE;
|
||||||
for (int aut = 0; scanner.line() != ""; aut++)
|
for (int aut = 0; scanner.line() != ""; aut++)
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define MSG_AI "AI" // message auto_insert (relapp)
|
#define MSG_AI "AI" // message auto_insert (relapp)
|
||||||
#define MSG_FS "FS" // message filtered start (relapp)
|
#define MSG_FS "FS" // message filtered start (relapp)
|
||||||
#define MSG_LN "LN" // message link (printapp -> relapp)
|
#define MSG_LN "LN" // message link (printapp -> relapp)
|
||||||
@ -18,6 +17,12 @@
|
|||||||
#define CHK_DONGLE 0 // dongle authorization checks
|
#define CHK_DONGLE 0 // dongle authorization checks
|
||||||
#define CHK_USER 1 // user authorization checks
|
#define CHK_USER 1 // user authorization checks
|
||||||
|
|
||||||
|
#ifdef XVGUY
|
||||||
|
#define AUT_FILE "campo.aut"
|
||||||
|
#else
|
||||||
|
#define AUT_FILE "prassi.aut"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __ASSOC_H
|
#ifndef __ASSOC_H
|
||||||
class TAssoc_array;
|
class TAssoc_array;
|
||||||
#endif
|
#endif
|
||||||
@ -73,7 +78,7 @@ protected:
|
|||||||
// @cmember Ritorna il nome del modulo dell'applicazione
|
// @cmember Ritorna il nome del modulo dell'applicazione
|
||||||
const char* get_module_name() const;
|
const char* get_module_name() const;
|
||||||
// @cmember Event handler della finestra principale del programma
|
// @cmember Event handler della finestra principale del programma
|
||||||
static long XVT_CALLCONV1 task_eh(WINDOW win, EVENT* ep);
|
static long task_eh(WINDOW win, EVENT* ep);
|
||||||
|
|
||||||
// @cmember Handler degli eventi della finestra principale, chiamato da <mf TApplication::task_eh>
|
// @cmember Handler degli eventi della finestra principale, chiamato da <mf TApplication::task_eh>
|
||||||
virtual long handler(WINDOW win, EVENT* ep);
|
virtual long handler(WINDOW win, EVENT* ep);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <limits.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#define MSK_TYPE 101
|
#define MSK_TYPE 101
|
||||||
#define MSK_FILENAME 102
|
#define MSK_FILENAME 102
|
||||||
#define MSK_PRINTERS 103
|
#define MSK_PRINTERS 103
|
||||||
#define MSK_CODES 111
|
// #define MSK_CODES 111
|
||||||
// IMPORTANTE! lasciare il numero 111,
|
// IMPORTANTE! lasciare il numero 111,
|
||||||
// in modo che la maschera sia compatibile
|
// in modo che la maschera sia compatibile
|
||||||
// con i metodi di ba2300, usati anche
|
// con i metodi di ba2300, usati anche
|
||||||
@ -14,7 +14,9 @@
|
|||||||
#define MSK_NPAGES 337
|
#define MSK_NPAGES 337
|
||||||
#define MSK_FONT 338
|
#define MSK_FONT 338
|
||||||
|
|
||||||
|
/*
|
||||||
#define MSK_PRINTERFILE prn.epf
|
#define MSK_PRINTERFILE prn.epf
|
||||||
#define MSK_NAMESFILE nms.epf
|
#define MSK_NAMESFILE nms.epf
|
||||||
#define PRINTERSFILE "prn.epf"
|
#define PRINTERSFILE "prn.epf"
|
||||||
#define NAMESFILE "nms.epf"
|
#define NAMESFILE "nms.epf"
|
||||||
|
*/
|
@ -1,15 +1,14 @@
|
|||||||
#include <bagn001a.h>
|
#include <bagn001a.h>
|
||||||
|
|
||||||
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 76 11
|
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 69 11
|
||||||
|
|
||||||
RADIOBUTTON MSK_TYPE 1 74
|
RADIOBUTTON MSK_TYPE 1 66
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 1 "Stampa su..."
|
PROMPT 2 1 "Stampa su..."
|
||||||
HELP "Selezionare il tipo dove direzionare la stampa"
|
HELP "Selezionare il tipo dove direzionare la stampa"
|
||||||
ITEM "0|Stampante"
|
ITEM "0|Stampante"
|
||||||
MESSAGE HIDE,MSK_FILENAME
|
MESSAGE HIDE,MSK_FILENAME
|
||||||
MESSAGE SHOW,MSK_PRINTERS|ENABLE,MSK_PRINTERS
|
MESSAGE SHOW,MSK_PRINTERS|ENABLE,MSK_PRINTERS
|
||||||
MESSAGE ENABLE,MSK_CODES
|
|
||||||
MESSAGE ENABLE,MSK_SIZE
|
MESSAGE ENABLE,MSK_SIZE
|
||||||
MESSAGE ENABLE,MSK_LINES
|
MESSAGE ENABLE,MSK_LINES
|
||||||
MESSAGE ENABLE,MSK_FONT
|
MESSAGE ENABLE,MSK_FONT
|
||||||
@ -17,7 +16,6 @@ BEGIN
|
|||||||
ITEM "2|Visualizzazione"
|
ITEM "2|Visualizzazione"
|
||||||
MESSAGE HIDE,MSK_FILENAME
|
MESSAGE HIDE,MSK_FILENAME
|
||||||
MESSAGE SHOW,MSK_PRINTERS|DISABLE,MSK_PRINTERS
|
MESSAGE SHOW,MSK_PRINTERS|DISABLE,MSK_PRINTERS
|
||||||
MESSAGE DISABLE,MSK_CODES
|
|
||||||
MESSAGE DISABLE,MSK_SIZE
|
MESSAGE DISABLE,MSK_SIZE
|
||||||
MESSAGE DISABLE,MSK_LINES
|
MESSAGE DISABLE,MSK_LINES
|
||||||
MESSAGE DISABLE,MSK_FONT
|
MESSAGE DISABLE,MSK_FONT
|
||||||
@ -25,7 +23,6 @@ BEGIN
|
|||||||
ITEM "1|File su disco"
|
ITEM "1|File su disco"
|
||||||
MESSAGE SHOW,MSK_FILENAME
|
MESSAGE SHOW,MSK_FILENAME
|
||||||
MESSAGE HIDE,MSK_PRINTERS
|
MESSAGE HIDE,MSK_PRINTERS
|
||||||
MESSAGE ENABLE,MSK_CODES
|
|
||||||
MESSAGE DISABLE,MSK_SIZE
|
MESSAGE DISABLE,MSK_SIZE
|
||||||
MESSAGE DISABLE,MSK_LINES
|
MESSAGE DISABLE,MSK_LINES
|
||||||
MESSAGE DISABLE,MSK_FONT
|
MESSAGE DISABLE,MSK_FONT
|
||||||
@ -51,14 +48,7 @@ BEGIN
|
|||||||
WARNING "E' necessario specificare un nome di file"
|
WARNING "E' necessario specificare un nome di file"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST MSK_CODES 40
|
LIST MSK_FONT 32
|
||||||
BEGIN
|
|
||||||
PROMPT 4 6 "Tipo stampa "
|
|
||||||
HELP "Modalita' nelle quale si desidera la stampa"
|
|
||||||
FLAGS "H"
|
|
||||||
END
|
|
||||||
|
|
||||||
LIST MSK_FONT 2 16
|
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 4 6 "Font "
|
PROMPT 4 6 "Font "
|
||||||
HELP "Font di stampa su video o stampante"
|
HELP "Font di stampa su video o stampante"
|
||||||
@ -67,14 +57,14 @@ END
|
|||||||
|
|
||||||
LIST MSK_SIZE 3
|
LIST MSK_SIZE 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 31 6 "Carattere "
|
PROMPT 53 6 "Carattere "
|
||||||
ITEM "12|12"
|
ITEM "10|10"
|
||||||
HELP "Dimensioni del carattere di stampa"
|
HELP "Dimensioni del carattere di stampa"
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST MSK_LINES 3
|
LIST MSK_LINES 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 52 6 "Linee/Inch "
|
PROMPT 45 7 "Linee per pollice "
|
||||||
ITEM "4|4"
|
ITEM "4|4"
|
||||||
ITEM "5|5"
|
ITEM "5|5"
|
||||||
ITEM "6|6"
|
ITEM "6|6"
|
||||||
|
@ -20,6 +20,17 @@
|
|||||||
typedef char *FileName;
|
typedef char *FileName;
|
||||||
typedef char *RecType;
|
typedef char *RecType;
|
||||||
typedef long RecNoType;
|
typedef long RecNoType;
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define __PACKED__ __attribute__ ((packed))
|
||||||
|
#define __ALIGNED__ __attribute__ ((aligned(2)))
|
||||||
|
#define __PACK_1__
|
||||||
|
#else
|
||||||
|
#define __PACKED__
|
||||||
|
#define __ALIGNED__
|
||||||
|
#pragma pack(2)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int F;
|
int F;
|
||||||
FILE *Fd;
|
FILE *Fd;
|
||||||
@ -43,14 +54,9 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
#define BLOCKEXT(len,rec) (((((RecNoType) (len)) * ((RecNoType) (rec))) / BlockLenIO) + 1)
|
#define BLOCKEXT(len,rec) (((((RecNoType) (len)) * ((RecNoType) (rec))) / BlockLenIO) + 1)
|
||||||
|
|
||||||
/* @(!) 2.3.01.325 */
|
|
||||||
#ifdef DOS
|
#ifdef DOS
|
||||||
//#define ASPETTA(x) (sleep_dos(x))
|
#pragma pack()
|
||||||
#else
|
|
||||||
//#define ASPETTA(x) (sleep(x))
|
|
||||||
#endif
|
#endif
|
||||||
/* @(:) 2.3.01.325 */
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define __CFILES_H
|
#define __CFILES_H
|
||||||
|
|
||||||
#ifndef __CCUSTIO_H
|
#ifndef __CCUSTIO_H
|
||||||
#include "ccustio.h"
|
#include "ccustio.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
@ -54,7 +54,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
BOOLEAN DupKeys __ALIGNED__ ;
|
short DupKeys __ALIGNED__ ; // Was BOOLEAN and dangerous
|
||||||
byte NkFields __ALIGNED__ ;
|
byte NkFields __ALIGNED__ ;
|
||||||
byte FieldSeq[MKFields] __PACKED__ ;
|
byte FieldSeq[MKFields] __PACKED__ ;
|
||||||
byte FromCh[MKFields] __PACKED__ ;
|
byte FromCh[MKFields] __PACKED__ ;
|
||||||
|
@ -36,24 +36,11 @@ bool fatal_box(
|
|||||||
{
|
{
|
||||||
buildmsg();
|
buildmsg();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
xvt_dm_post_fatal_exit(msg);
|
||||||
MessageBeep(MB_ICONHAND);
|
|
||||||
MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL);
|
|
||||||
|
|
||||||
if (xvt_running())
|
if (xvt_running())
|
||||||
main_app().stop_run();
|
main_app().stop_run();
|
||||||
else
|
else
|
||||||
exit(1);
|
exit(1);
|
||||||
#else
|
|
||||||
beep();
|
|
||||||
if (xvt_running()) xvt_dm_post_fatal_exit("%s", msg);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s\n", msg);
|
|
||||||
getchar();
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ int DB_flush(int handle)
|
|||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
yesnofatal_box("Sono in attesa nella DB_flush");
|
yesnofatal_box("Sono in attesa nella DB_flush");
|
||||||
#else
|
#else
|
||||||
u4delay_sec();
|
u4delaySec();
|
||||||
#endif
|
#endif
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
|
#include <image.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <os_dep.h>
|
#include <os_dep.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -51,7 +52,7 @@ HIDDEN int _last_mouse_button = 0;
|
|||||||
|
|
||||||
short low_get_focus_id(WINDOW win)
|
short low_get_focus_id(WINDOW win)
|
||||||
{
|
{
|
||||||
XI_OBJ * itf = xi_get_itf(win);
|
XI_OBJ * itf = xi_get_itf((XinWindow)win);
|
||||||
XI_OBJ * obj = xi_get_focus(itf);
|
XI_OBJ * obj = xi_get_focus(itf);
|
||||||
|
|
||||||
if (obj == NULL || obj->type == XIT_ITF)
|
if (obj == NULL || obj->type == XIT_ITF)
|
||||||
@ -65,7 +66,7 @@ short low_get_focus_id(WINDOW win)
|
|||||||
// Doesn't work: DON'T USE!
|
// Doesn't work: DON'T USE!
|
||||||
void low_set_focus_id(WINDOW win, short cid)
|
void low_set_focus_id(WINDOW win, short cid)
|
||||||
{
|
{
|
||||||
XI_OBJ * itf = xi_get_itf(win);
|
XI_OBJ * itf = xi_get_itf((XinWindow)win);
|
||||||
if (cid > 0)
|
if (cid > 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -102,7 +103,7 @@ KEY TControl::xiev_to_key(const XI_EVENT* xiev)
|
|||||||
class TPicture_array : public TArray
|
class TPicture_array : public TArray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TImage& add(short id);
|
bool add(short id);
|
||||||
|
|
||||||
const TImage& image(short id) const { return (const TImage&)operator[](id); }
|
const TImage& image(short id) const { return (const TImage&)operator[](id); }
|
||||||
bool exist(short id) const { return objptr(id) != NULL; }
|
bool exist(short id) const { return objptr(id) != NULL; }
|
||||||
@ -112,18 +113,24 @@ public:
|
|||||||
virtual ~TPicture_array() {}
|
virtual ~TPicture_array() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
TImage& TPicture_array::add(short id)
|
bool TPicture_array::add(short id)
|
||||||
{
|
{
|
||||||
TImage* i = (TImage*)objptr(id);
|
TImage* i = (TImage*)objptr(id);
|
||||||
|
|
||||||
if (i == NULL)
|
if (i == NULL)
|
||||||
{
|
{
|
||||||
i = new TImage(id);
|
i = new TImage(id);
|
||||||
i->convert_transparent_color(BTN_BACK_COLOR);
|
if (i->ok())
|
||||||
TArray::add(i, id);
|
{
|
||||||
|
i->convert_transparent_color(BTN_BACK_COLOR);
|
||||||
|
TArray::add(i, id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete i;
|
||||||
|
i = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return i != NULL;
|
||||||
return *i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPicture_array::reload()
|
void TPicture_array::reload()
|
||||||
@ -156,7 +163,7 @@ XVT_FNTID xvt_default_font(bool bold)
|
|||||||
TConfig font(CONFIG_USER, "Font");
|
TConfig font(CONFIG_USER, "Font");
|
||||||
TString font_ser_desc(font.get("FontDesc"));
|
TString font_ser_desc(font.get("FontDesc"));
|
||||||
if (font_ser_desc.empty())
|
if (font_ser_desc.empty())
|
||||||
font_ser_desc << "01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier";
|
font_ser_desc = "01\\Courier\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/Courier";
|
||||||
xvt_font_deserialize(DEF_FONT, (char *)(const char *) font_ser_desc);
|
xvt_font_deserialize(DEF_FONT, (char *)(const char *) font_ser_desc);
|
||||||
xvt_font_map_using_default(DEF_FONT);
|
xvt_font_map_using_default(DEF_FONT);
|
||||||
CHECK(xvt_font_is_mapped(DEF_FONT), "Can't map native font");
|
CHECK(xvt_font_is_mapped(DEF_FONT), "Can't map native font");
|
||||||
@ -210,6 +217,7 @@ XVT_FNTID xvt_load_default_font()
|
|||||||
|
|
||||||
X_FU_MULTIPLE = Y_FU_MULTIPLE = 0;
|
X_FU_MULTIPLE = Y_FU_MULTIPLE = 0;
|
||||||
XVT_FNTID font = xvt_default_font(FALSE);
|
XVT_FNTID font = xvt_default_font(FALSE);
|
||||||
|
xi_init_sysvals(); // Ricalcola i FU units
|
||||||
|
|
||||||
statbar_set_fontid(TASK_WIN, font);
|
statbar_set_fontid(TASK_WIN, font);
|
||||||
|
|
||||||
@ -416,8 +424,10 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
|||||||
if (x <= 0 || y <= 0 || dx <= 0 || dy <= 0)
|
if (x <= 0 || y <= 0 || dx <= 0 || dy <= 0)
|
||||||
{
|
{
|
||||||
RCT max_rct; xvt_vobj_get_client_rect(parent, &max_rct);
|
RCT max_rct; xvt_vobj_get_client_rect(parent, &max_rct);
|
||||||
|
#ifndef WIN32
|
||||||
if (parent == TASK_WIN)
|
if (parent == TASK_WIN)
|
||||||
max_rct.bottom -= 26; // Non contare la status bar
|
max_rct.bottom -= 26; // Non contare la status bar
|
||||||
|
#endif
|
||||||
|
|
||||||
if (dy <= 0)
|
if (dy <= 0)
|
||||||
{
|
{
|
||||||
@ -459,11 +469,11 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
|||||||
def->v.itf->back_color = MASK_BACK_COLOR;
|
def->v.itf->back_color = MASK_BACK_COLOR;
|
||||||
def->v.itf->font_id = xvt_default_font(FALSE);
|
def->v.itf->font_id = xvt_default_font(FALSE);
|
||||||
def->v.itf->tab_on_enter = TRUE;
|
def->v.itf->tab_on_enter = TRUE;
|
||||||
def->v.itf->win = win;
|
def->v.itf->win = (XinWindow)win;
|
||||||
|
|
||||||
#ifdef XI_R4
|
#ifdef XI_R4
|
||||||
def->v.itf->edit_menu = TRUE; // Update edit menu items
|
def->v.itf->edit_menu = TRUE; // Update edit menu items
|
||||||
def->v.itf->menu_win = TASK_WIN; // Window that owns the menu
|
def->v.itf->menu_win = (XinWindow)TASK_WIN; // Window that owns the menu
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XI_OBJ* itf = xi_create(NULL, def);
|
XI_OBJ* itf = xi_create(NULL, def);
|
||||||
@ -518,7 +528,7 @@ void attach_interface(WINDOW win, COLOR back)
|
|||||||
def->v.itf->automatic_back_color = FALSE;
|
def->v.itf->automatic_back_color = FALSE;
|
||||||
def->v.itf->back_color = back;
|
def->v.itf->back_color = back;
|
||||||
def->v.itf->tab_on_enter = TRUE;
|
def->v.itf->tab_on_enter = TRUE;
|
||||||
def->v.itf->win = win;
|
def->v.itf->win = (XinWindow)win;
|
||||||
|
|
||||||
XI_OBJ* itf = xi_create(NULL, def);
|
XI_OBJ* itf = xi_create(NULL, def);
|
||||||
CHECK(itf, "Can't create an interface");
|
CHECK(itf, "Can't create an interface");
|
||||||
@ -652,7 +662,7 @@ XI_OBJ* TControl::get_interface(WINDOW win) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itf = xi_get_itf(win);
|
itf = xi_get_itf((XinWindow)win);
|
||||||
CHECK(itf, "Can't get the interface from a window");
|
CHECK(itf, "Can't get the interface from a window");
|
||||||
}
|
}
|
||||||
return itf;
|
return itf;
|
||||||
@ -942,7 +952,7 @@ const char* TControl::parse_caption(const char* cap, bool& bold, COLOR& color) c
|
|||||||
|
|
||||||
WINDOW TControl::parent() const
|
WINDOW TControl::parent() const
|
||||||
{
|
{
|
||||||
return xi_get_window(_obj->itf);
|
return (WINDOW)xi_get_window(_obj->itf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TControl::set_focus() const
|
void TControl::set_focus() const
|
||||||
@ -1275,7 +1285,7 @@ void TField_control::show_button(bool on)
|
|||||||
if (has_button != on)
|
if (has_button != on)
|
||||||
{
|
{
|
||||||
f->button = on;
|
f->button = on;
|
||||||
xi_invalidate_rect(parent(), &f->btn_rct);
|
xi_invalidate_rect((XinWindow)parent(), &f->btn_rct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,18 +1556,37 @@ void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn)
|
|||||||
{
|
{
|
||||||
if (bmp_up > 0)
|
if (bmp_up > 0)
|
||||||
{
|
{
|
||||||
_picture->add(_bmp_up = bmp_up);
|
_bmp_up = (bmp_up > 0 && _picture->add(bmp_up)) ? bmp_up : 0;
|
||||||
if (bmp_dn > 0)
|
_bmp_dn = (bmp_dn > 0 && _picture->add(bmp_dn)) ? bmp_dn : _bmp_up;
|
||||||
_picture->add(_bmp_dn = bmp_dn);
|
|
||||||
else
|
|
||||||
_bmp_dn = _bmp_up;
|
|
||||||
set_native_icon(0);
|
set_native_icon(0);
|
||||||
_obj->v.btn->drawable = TRUE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
_bmp_up = _bmp_dn = 0;
|
_bmp_up = _bmp_dn = 0;
|
||||||
}
|
_obj->v.btn->drawable = _bmp_up > 0;
|
||||||
|
/*
|
||||||
|
if (bmp_up > 0)
|
||||||
|
{
|
||||||
|
XI_BITMAP* b1 = xi_bitmap_create_res(bmp_up, XI_BITMAP_NORMAL);
|
||||||
|
xi_bitmap_background_set(b1, BTN_BACK_COLOR);
|
||||||
|
xi_bitmap_hcenter_set(b1, TRUE);
|
||||||
|
xi_bitmap_vcenter_set(b1, TRUE);
|
||||||
|
xi_set_bitmap(_obj, b1);
|
||||||
|
if (bmp_dn <= 0)
|
||||||
|
bmp_dn = bmp_up;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
xi_set_bitmap(_obj, NULL);
|
||||||
|
if (bmp_dn > 0)
|
||||||
|
{
|
||||||
|
XI_BITMAP* b2 = xi_bitmap_create_res(bmp_dn, XI_BITMAP_NORMAL);
|
||||||
|
xi_bitmap_background_set(b2, BTN_BACK_COLOR);
|
||||||
|
xi_bitmap_hcenter_set(b2, TRUE);
|
||||||
|
xi_bitmap_vcenter_set(b2, TRUE);
|
||||||
|
xi_set_down_bitmap(_obj, b2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
xi_set_down_bitmap(_obj, NULL);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPushbutton_control::update()
|
void TPushbutton_control::update()
|
||||||
@ -1582,6 +1611,11 @@ void TPushbutton_control::update()
|
|||||||
|
|
||||||
if (_native_hicon)
|
if (_native_hicon)
|
||||||
{
|
{
|
||||||
|
if (_obj->v.btn->down)
|
||||||
|
{
|
||||||
|
rct.left += 2; rct.right += 2;
|
||||||
|
rct.top += 2; rct.bottom += 2;
|
||||||
|
}
|
||||||
os_draw_native_icon(win, rct, _native_hicon);
|
os_draw_native_icon(win, rct, _native_hicon);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1913,7 +1947,6 @@ void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const char* row = NULL;
|
const char* row = NULL;
|
||||||
// long rec = 0l;
|
|
||||||
|
|
||||||
switch(xiev->type)
|
switch(xiev->type)
|
||||||
{
|
{
|
||||||
@ -2004,8 +2037,8 @@ void TDropDownList::close()
|
|||||||
_open = FALSE;
|
_open = FALSE;
|
||||||
if (_xi_lst)
|
if (_xi_lst)
|
||||||
{
|
{
|
||||||
xvt_vobj_set_visible(xi_get_window(_xi_lst->itf), FALSE);
|
xvt_vobj_set_visible((WINDOW)xi_get_window(_xi_lst->itf), FALSE);
|
||||||
xvt_dwin_update (xi_get_window(_obj->itf));
|
xvt_dwin_update((WINDOW)xi_get_window(_obj->itf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2129,7 +2162,7 @@ void TDropDownList::create()
|
|||||||
ld->scroll_bar = items() > 6;
|
ld->scroll_bar = items() > 6;
|
||||||
ld->no_heading = TRUE;
|
ld->no_heading = TRUE;
|
||||||
ld->no_horz_lines = TRUE;
|
ld->no_horz_lines = TRUE;
|
||||||
// ld->no_vert_lines = TRUE;
|
ld->no_vert_lines = TRUE;
|
||||||
ld->resize_with_window = TRUE;
|
ld->resize_with_window = TRUE;
|
||||||
ld->single_select = TRUE;
|
ld->single_select = TRUE;
|
||||||
|
|
||||||
@ -2143,6 +2176,9 @@ void TDropDownList::create()
|
|||||||
// Larghezza in pixel del bottone
|
// Larghezza in pixel del bottone
|
||||||
const int bw = int(_obj->itf->v.itf->fu_height * XI_FU_MULTIPLE / _obj->itf->v.itf->fu_width);
|
const int bw = int(_obj->itf->v.itf->fu_height * XI_FU_MULTIPLE / _obj->itf->v.itf->fu_width);
|
||||||
len -= bw;
|
len -= bw;
|
||||||
|
#ifdef XVGUY
|
||||||
|
len -= 4; // Don't ask why
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
// Larghezza in form units dell'edit field
|
// Larghezza in form units dell'edit field
|
||||||
len = len * XI_FU_MULTIPLE / _obj->itf->v.itf->fu_width - 2;
|
len = len * XI_FU_MULTIPLE / _obj->itf->v.itf->fu_width - 2;
|
||||||
@ -2163,7 +2199,7 @@ void TDropDownList::create()
|
|||||||
|
|
||||||
RCT l; xi_get_def_rect(lstdef, (XinRect *) &l);
|
RCT l; xi_get_def_rect(lstdef, (XinRect *) &l);
|
||||||
PNT p; p.h = r.left;
|
PNT p; p.h = r.left;
|
||||||
WINDOW pwin = xi_get_window(_obj->itf);
|
WINDOW pwin = (WINDOW)xi_get_window(_obj->itf);
|
||||||
RCT w; xvt_vobj_get_client_rect(pwin, &w);
|
RCT w; xvt_vobj_get_client_rect(pwin, &w);
|
||||||
// place rectangle
|
// place rectangle
|
||||||
if (r.bottom + l.bottom - l.top <= w.bottom)
|
if (r.bottom + l.bottom - l.top <= w.bottom)
|
||||||
@ -2175,8 +2211,8 @@ void TDropDownList::create()
|
|||||||
}
|
}
|
||||||
RCT wr;
|
RCT wr;
|
||||||
wr.left = p.h; wr.top = p.v;
|
wr.left = p.h; wr.top = p.v;
|
||||||
xi_get_def_rect(lstdef, (XinRect *) &l);
|
// xi_get_def_rect(lstdef, (XinRect *) &l);
|
||||||
wr.right = r.right; // wr.left + (l.right - l.left) -1;
|
wr.right = r.right;
|
||||||
wr.bottom = wr.top + l.bottom - l.top;
|
wr.bottom = wr.top + l.bottom - l.top;
|
||||||
const int delta_x = _obj->itf->v.itf->delta_x;
|
const int delta_x = _obj->itf->v.itf->delta_x;
|
||||||
const int delta_y = _obj->itf->v.itf->delta_y;
|
const int delta_y = _obj->itf->v.itf->delta_y;
|
||||||
@ -2187,7 +2223,7 @@ void TDropDownList::create()
|
|||||||
|
|
||||||
WINDOW win = xvt_win_create(W_PLAIN, &wr, "", 0, pwin, WSF_NO_MENUBAR, EM_ALL,
|
WINDOW win = xvt_win_create(W_PLAIN, &wr, "", 0, pwin, WSF_NO_MENUBAR, EM_ALL,
|
||||||
(EVENT_HANDLER)xi_event, 0L);
|
(EVENT_HANDLER)xi_event, 0L);
|
||||||
itfdef->v.itf->win = win;
|
itfdef->v.itf->win = (XinWindow)win;
|
||||||
itfdef->v.itf->rctp = (XinRect *) ≀
|
itfdef->v.itf->rctp = (XinRect *) ≀
|
||||||
XI_OBJ* itfobj = xi_create(NULL, itfdef);
|
XI_OBJ* itfobj = xi_create(NULL, itfdef);
|
||||||
xi_tree_free(itfdef);
|
xi_tree_free(itfdef);
|
||||||
@ -2202,7 +2238,7 @@ void TDropDownList::create()
|
|||||||
void TDropDownList::open()
|
void TDropDownList::open()
|
||||||
{
|
{
|
||||||
if (_xi_lst)
|
if (_xi_lst)
|
||||||
xvt_vobj_set_visible(xi_get_window(_xi_lst->itf), TRUE);
|
xvt_vobj_set_visible((WINDOW)xi_get_window(_xi_lst->itf), TRUE);
|
||||||
else
|
else
|
||||||
create();
|
create();
|
||||||
|
|
||||||
@ -2212,7 +2248,7 @@ void TDropDownList::open()
|
|||||||
_open = TRUE;
|
_open = TRUE;
|
||||||
xi_cell_request(_xi_lst);
|
xi_cell_request(_xi_lst);
|
||||||
|
|
||||||
WINDOW win = xi_get_window(_xi_lst->itf);
|
WINDOW win = (WINDOW)xi_get_window(_xi_lst->itf);
|
||||||
xvt_scr_set_focus_vobj(win);
|
xvt_scr_set_focus_vobj(win);
|
||||||
xvt_vobj_raise(win);
|
xvt_vobj_raise(win);
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ public:
|
|||||||
void close();
|
void close();
|
||||||
bool is_open() const { return _open; }
|
bool is_open() const { return _open; }
|
||||||
|
|
||||||
const char* item(long i) { return _values.get(int(i)); }
|
const char* item(long i) { const char* s = _values.get(int(i)); return s ? s : ""; }
|
||||||
int items() const { return _values.items(); }
|
int items() const { return _values.items(); }
|
||||||
long row2rec(int) const;
|
long row2rec(int) const;
|
||||||
int rec2row(long rec) const;
|
int rec2row(long rec) const;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#define __DATE_CPP
|
#define __DATE_CPP
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <stdlib.h>
|
|
||||||
#define XVT_INCL_NATIVE
|
#define XVT_INCL_NATIVE
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -13,15 +13,14 @@
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _DEMO_
|
#ifndef _DEMO_
|
||||||
|
|
||||||
#include <hlapi_c.h>
|
#include <hlapi_c.h>
|
||||||
|
|
||||||
#define USERADR 26952
|
#define USERADR 26952
|
||||||
#define AGAADR 26953
|
#define AGAADR 26953
|
||||||
#define PRASSIADR 26954
|
#define PRASSIADR 26954
|
||||||
#define PROCOMADR 26956
|
#define PROCOMADR 26956
|
||||||
#define REFKEY "CAMPOKEY"
|
#define REFKEY (unsigned char*)"CAMPOKEY"
|
||||||
#define VERKEY "ìpÙˆ¬cê<"
|
#define VERKEY (unsigned char*)"ìpÙˆ¬cê<"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -185,12 +184,22 @@ const TString& TDongle::administrator(TString* pwd)
|
|||||||
TConfig ini("install.ini", "Main");
|
TConfig ini("install.ini", "Main");
|
||||||
_admin = ini.get("Administrator");
|
_admin = ini.get("Administrator");
|
||||||
if (_admin.empty())
|
if (_admin.empty())
|
||||||
|
{
|
||||||
|
#ifdef XVGUY
|
||||||
_admin = "PRASSI";
|
_admin = "PRASSI";
|
||||||
|
#else
|
||||||
|
_admin = "ADMIN";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_admin = ::decode(_admin);
|
_admin = ::decode(_admin);
|
||||||
_admpwd = ini.get("Password");
|
_admpwd = ini.get("Password");
|
||||||
if (_admpwd.empty())
|
if (_admpwd.empty())
|
||||||
_admpwd = "pr.assi";
|
{
|
||||||
|
_admpwd = _admin;
|
||||||
|
_admpwd.lower();
|
||||||
|
_admpwd.insert(".", 2);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
_admpwd = ::decode(_admpwd);
|
_admpwd = ::decode(_admpwd);
|
||||||
}
|
}
|
||||||
@ -209,7 +218,7 @@ void TDongle::garble(word* data) const
|
|||||||
switch (_hardware)
|
switch (_hardware)
|
||||||
{
|
{
|
||||||
case _dongle_hardlock:
|
case _dongle_hardlock:
|
||||||
HL_CODE(EYECAST data, 1);
|
HL_CODE(data, 1);
|
||||||
break;
|
break;
|
||||||
case _dongle_eutron:
|
case _dongle_eutron:
|
||||||
if (_eutron_key)
|
if (_eutron_key)
|
||||||
@ -299,7 +308,7 @@ bool TDongle::hardlock_login(bool test_all_keys)
|
|||||||
{
|
{
|
||||||
_hardware = _dongle_hardlock;
|
_hardware = _dongle_hardlock;
|
||||||
|
|
||||||
HL_READBL((char*)_eprom);
|
HL_READBL((unsigned char*)_eprom);
|
||||||
|
|
||||||
word data[4];
|
word data[4];
|
||||||
memcpy(data, _eprom, sizeof(data));
|
memcpy(data, _eprom, sizeof(data));
|
||||||
@ -646,7 +655,7 @@ bool TDongle::read_words(word reg, word len, word* ud) const
|
|||||||
case _dongle_hardlock:
|
case _dongle_hardlock:
|
||||||
{
|
{
|
||||||
for (word i = 0; i < len; i++)
|
for (word i = 0; i < len; i++)
|
||||||
HL_READ(reg+i, (int*)&ud[i]);
|
HL_READ(reg+i, &ud[i]);
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <filetext.h>
|
#include <filetext.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ typedef struct
|
|||||||
real ratio; // ratio (width_old_font/width_new_font)
|
real ratio; // ratio (width_old_font/width_new_font)
|
||||||
} s_data;
|
} s_data;
|
||||||
|
|
||||||
BOOLEAN XVT_CALLCONV1 wpr (long data)
|
BOOLEAN wpr(long data)
|
||||||
{
|
{
|
||||||
s_data* st =(s_data*)data;
|
s_data* st =(s_data*)data;
|
||||||
WINDOW prwin = xvt_print_create_win(printer().get_printrcd(),"");
|
WINDOW prwin = xvt_print_create_win(printer().get_printrcd(),"");
|
||||||
|
@ -5,14 +5,13 @@
|
|||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <golem.h>
|
#include <golem.h>
|
||||||
|
#include <image.h>
|
||||||
#include <msksheet.h>
|
#include <msksheet.h>
|
||||||
#include <os_dep.h>
|
#include <os_dep.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <window.h>
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
#include <mapi.h>
|
#include <mapi.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
@ -1,172 +1,72 @@
|
|||||||
#ifndef __HLAPI_H
|
/* $Id: hlapi_c.h,v 1.2 2002-02-28 11:34:54 guy Exp $ */
|
||||||
#define __HLAPI_H
|
|
||||||
|
|
||||||
/****************************************************************************/
|
#include "fastapi.h"
|
||||||
/** **/
|
|
||||||
/** Hardlock E-Y-E **/
|
|
||||||
/** API-Structures and definitions **/
|
|
||||||
/** **/
|
|
||||||
/** This file contains some helpful defines to access a Hardlock using **/
|
|
||||||
/** the application programing interface (API) for Hardlock E-Y-E. **/
|
|
||||||
/** **/
|
|
||||||
/** (c) 1992 by ///FAST Electronic **/
|
|
||||||
/** **/
|
|
||||||
/** **/
|
|
||||||
/** Authors : Thomas Schr”ter **/
|
|
||||||
/** Henri Volk **/
|
|
||||||
/** Version : 3.0 **/
|
|
||||||
/** Date : 01-Sep-1992 **/
|
|
||||||
/** **/
|
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
#define EYECAST (char huge *)
|
|
||||||
|
|
||||||
/* -------------------------------- */
|
|
||||||
/* Definitions and API structures : */
|
|
||||||
/* -------------------------------- */
|
|
||||||
typedef unsigned char Byte;
|
|
||||||
typedef signed short Word;
|
|
||||||
typedef unsigned long Long;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Word Use_Key;
|
|
||||||
Byte Key[8];
|
|
||||||
}
|
|
||||||
DES_MODE;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
Word ModAd; /* Moduleaddress EYE */
|
|
||||||
Word Register; /* Memory register adress */
|
|
||||||
Word Value; /* Memory value */
|
|
||||||
Byte Reserved[4];
|
|
||||||
}
|
|
||||||
EYE_MODE;
|
|
||||||
|
|
||||||
typedef union
|
|
||||||
{
|
|
||||||
DES_MODE Des;
|
|
||||||
EYE_MODE Eye;
|
|
||||||
}
|
|
||||||
HARDWARE;
|
|
||||||
|
|
||||||
typedef struct hl_api
|
|
||||||
{
|
|
||||||
Byte API_Version_ID[2]; /* Version */
|
|
||||||
Word API_Options[2]; /* API Optionflags */
|
|
||||||
Word ModID; /* Modul-ID (EYE = 0...) */
|
|
||||||
HARDWARE Module; /* Hardware type */
|
|
||||||
void far *Data; /* Pointer to cipher data */
|
|
||||||
Word Bcnt; /* Number of blocks */
|
|
||||||
Word Function; /* Function number */
|
|
||||||
Word Status; /* Actual status */
|
|
||||||
Word Remote; /* Remote or local?? */
|
|
||||||
Word Port; /* Port address if local */
|
|
||||||
Word Speed; /* Speed of port if local */
|
|
||||||
Word NetUsers; /* Current Logins (HLSERVER) */
|
|
||||||
Byte ID_Ref[8]; /* Referencestring */
|
|
||||||
Byte ID_Verify[8]; /* Encrypted ID_Ref */
|
|
||||||
Long Task_ID; /* Multitasking program ID */
|
|
||||||
Byte Reserved[200]; /* Reserved area */
|
|
||||||
}
|
|
||||||
HL_API;
|
|
||||||
|
|
||||||
/* ------------- */
|
|
||||||
/* Module-ID's : */
|
|
||||||
/* ------------- */
|
|
||||||
#define EYE_DONGLE 0 /* Hardlock E-Y-E */
|
|
||||||
#define DES_DONGLE 1 /* FAST DES */
|
|
||||||
|
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
/* API function calls : */
|
/* Function prototypes : */
|
||||||
/* --------------------- */
|
/* --------------------- */
|
||||||
#define API_INIT 0 /* Init API structure */
|
#ifdef __cplusplus
|
||||||
#define API_DOWN 1 /* Free API structure */
|
extern "C" {
|
||||||
#define API_FORCE_DOWN 31 /* Force deinintialization */
|
#endif
|
||||||
#define API_MULTI_SHELL_ON 2 /* MTS is enabled */
|
|
||||||
#define API_MULTI_SHELL_OFF 3 /* MTS is disabled */
|
|
||||||
#define API_MULTI_ON 4 /* Enable MTS */
|
|
||||||
#define API_MULTI_OFF 5 /* Disable MTS */
|
|
||||||
#define API_AVAIL 6 /* Dongle available? */
|
|
||||||
#define API_LOGIN 7 /* Login dongle server */
|
|
||||||
#define API_LOGOUT 8 /* Logout dongle server */
|
|
||||||
#define API_INFO 9 /* Get API informations */
|
|
||||||
|
|
||||||
/* --------------------------- */
|
|
||||||
/* Data and memory functions : */
|
|
||||||
/* --------------------------- */
|
|
||||||
#define API_KEYE 11 /* Use KEYE for encryption */
|
|
||||||
#define API_READ 20 /* Read one word of dongle EEPROM */
|
|
||||||
#define API_WRITE 21 /* Write one word of dongle EEPROM */
|
|
||||||
#define API_READ_BLOCK 23 /* Read EEPROM in one block */
|
|
||||||
#define API_WRITE_BLOCK 24 /* Write EEPROM in one block */
|
|
||||||
#define API_GET_ID_KEY 30 /* Encrypt ID_Ref to ID_Verify */
|
|
||||||
#define API_ABORT 53 /* Critical Error Abort */
|
|
||||||
|
|
||||||
/* -------------------- */
|
|
||||||
/* Dongle access mode : */
|
|
||||||
/* -------------------- */
|
|
||||||
#define LOCAL_DEVICE 1 /* Query local HL only */
|
|
||||||
#define NET_DEVICE 2 /* Query remote HL only */
|
|
||||||
#define DONT_CARE 3 /* Query local or remote HL */
|
|
||||||
|
|
||||||
/* ------------------ */
|
/* ------------------ */
|
||||||
/* API Status Codes : */
|
/* Basic Hardlock API */
|
||||||
/* ------------------ */
|
/* ------------------ */
|
||||||
#define STATUS_OK 0 /* API call was succesfull */
|
RET_ FAR_ CALL_ HL_LOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey);
|
||||||
#define NOT_INIT 1 /* DONGLE not initialized */
|
RET_ FAR_ CALL_ HL_LOGOUT (void);
|
||||||
#define ALREADY_INIT 2 /* Already initialized */
|
RET_ FAR_ CALL_ HL_AVAIL (void);
|
||||||
#define UNKNOWN_DONGLE 3 /* Device not supported */
|
RET_ FAR_ CALL_ HL_PORTINF (void);
|
||||||
#define UNKNOWN_FUNCTION 4 /* Function not supported */
|
RET_ FAR_ CALL_ HL_ACCINF (void);
|
||||||
#define NO_DONGLE 7 /* No device available */
|
RET_ FAR_ CALL_ HL_USERINF (void);
|
||||||
#define NETWORK_ERROR 8 /* A network error occured */
|
RET_ FAR_ CALL_ HL_MAXUSER (void);
|
||||||
#define NO_ACCESS 9 /* No device available */
|
RET_ FAR_ CALL_ HL_MEMINF (void);
|
||||||
#define INVALID_PARAM 10 /* A wrong parameter occured */
|
RET_ FAR_ CALL_ HL_CODE (void DATAFAR_ *Data, Word Count);
|
||||||
#define VERSION_MISMATCH 11 /* HL-Server not API version */
|
RET_ FAR_ CALL_ HL_WRITE (Word Reg, Word Value);
|
||||||
|
RET_ FAR_ CALL_ HL_READ (Word Reg, Word DATAFAR_ *Value);
|
||||||
|
RET_ FAR_ CALL_ HL_READBL (Byte DATAFAR_ *Eeprom);
|
||||||
|
RET_ FAR_ CALL_ HL_WRITEBL (Byte DATAFAR_ *Eeprom);
|
||||||
|
RET_ FAR_ CALL_ HL_ABORT (void);
|
||||||
|
RET_ FAR_ CALL_ HL_VERSION (void);
|
||||||
|
RET_ FAR_ CALL_ HL_HLSVERS (void);
|
||||||
|
RET_ FAR_ CALL_ HL_SELECT (HL_API DATAFAR_ *hl_ptr);
|
||||||
|
RET_ FAR_ CALL_ HL_READID (Word DATAFAR_ *IDLow, Word DATAFAR_ *IDHigh);
|
||||||
|
|
||||||
|
/* ---------------- */
|
||||||
|
/* Hardlock RUS API */
|
||||||
|
/* ---------------- */
|
||||||
|
RET_ FAR_ CALL_ HLM_LOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey, Byte DATAFAR_ * VKey, Long RUSOptions, Byte DATAFAR_ * SearchStr);
|
||||||
|
RET_ FAR_ CALL_ HLM_OCCUPYSLOT (Long Slot);
|
||||||
|
RET_ FAR_ CALL_ HLM_FREESLOT (Long Slot);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKSLOT (Long Slot, Long * MaxUser, Long * CurrentUser);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKCOUNTER (Word IncVal, Long * MaxCounter, Long * CurrentCounter);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKEXPDATE (Long Slot, Word * Year, Word * Month, Word * Day);
|
||||||
|
RET_ FAR_ CALL_ HLM_GETRUSINFO (Long * BufLen, Byte DATAFAR_ * RTBBuffer, Word Base64);
|
||||||
|
RET_ FAR_ CALL_ HLM_WRITELICENSE (Long BufLen, Byte DATAFAR_ * RTBBuffer, Word Access, Byte DATAFAR_ * SearchStr,Word Options);
|
||||||
|
RET_ FAR_ CALL_ HLM_ISRUSHL (Long * ID);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKALLSLOTS (Long *BufLen, HL_LIS *Buffer);
|
||||||
|
RET_ FAR_ CALL_ HLM_LOGOUT (void);
|
||||||
|
|
||||||
|
/* ---------------------- */
|
||||||
|
/* Hardlock Error Routine */
|
||||||
|
/* ---------------------- */
|
||||||
|
const char * FAR_ CALL_ HL_ERRMSG (Word num, Long options, Byte ** errdefine, Byte ** errextmsg);
|
||||||
|
|
||||||
|
/* ------------------------------------------- */
|
||||||
|
/* Obsolete functions, for compatiblity only!! */
|
||||||
|
/* ------------------------------------------- */
|
||||||
|
#ifndef __OS2__
|
||||||
|
void FAR_ CALL_ HL_ON (Word Port, Word ModAd);
|
||||||
|
void FAR_ CALL_ HL_OFF (Word Port);
|
||||||
|
Word FAR_ CALL_ K_EYE (Word Port, char DATAFAR_ *Inp, Word BlkCnt);
|
||||||
|
void FAR_ CALL_ HL_WR (Word Port, Word Reg, Word Val);
|
||||||
|
Word FAR_ CALL_ HL_RD (Word Port, Word Reg);
|
||||||
|
void FAR_ CALL_ INT_ON (void);
|
||||||
|
void FAR_ CALL_ INT_OFF (void);
|
||||||
|
#endif
|
||||||
|
RET_ FAR_ CALL_ HL_CALC (Word i1, Word i2, Word i3, Word i4);
|
||||||
|
RET_ FAR_ CALL_ HL_LMLOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey, Word SlotID, Byte DATAFAR_ *SearchStr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
/* --------------------- */
|
|
||||||
/* Function prototypes : */
|
|
||||||
/* --------------------- */
|
|
||||||
static int CALL_API (HL_API far *as);
|
|
||||||
Word far HL_LOGIN (Word ModAd, Word Access, char * RefKey, char * VerKey);
|
|
||||||
Word far HL_LOGOUT (void);
|
|
||||||
Word far HL_AVAIL (void);
|
|
||||||
Word far HL_PORTINF (void);
|
|
||||||
Word far HL_ACCINF (void);
|
|
||||||
Word far HL_USERINF (void);
|
|
||||||
Word far HL_MAXUSER (void);
|
|
||||||
Word far HL_MEMINF (void);
|
|
||||||
Word far HL_CODE (void far *Data, Word Count);
|
|
||||||
Word far HL_WRITE (Word Register, Word Value);
|
|
||||||
Word far HL_READ (Word Register, int far *Value);
|
|
||||||
char far * HL_GET_ID (char * id_ref);
|
|
||||||
Word far HL_READBL (char * Eeprom);
|
|
||||||
Word far HL_WRITEBL (char * Eeprom);
|
|
||||||
Word far HL_ABORT (void);
|
|
||||||
Word far HL_VERSION (void);
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
/****************************************************************************/
|
|
||||||
/* The following functions map the old Hardlock Calls on the new API. These */
|
|
||||||
/* functions are defined only for compatibility reasons. */
|
|
||||||
/* !!! Don't mix old and new functions. Don't use if it is not necessary.!!!*/
|
|
||||||
/****************************************************************************/
|
|
||||||
/****************************************************************************/
|
|
||||||
void far HL_ON (int Port, Word ModAd);
|
|
||||||
void far HL_OFF (int Port);
|
|
||||||
int far K_EYE (int Port, char huge *Inp, int BlkCnt);
|
|
||||||
void far HL_WR (int Port, int Register, Word Val);
|
|
||||||
Word far HL_RD (int Port, int Register);
|
|
||||||
void far INT_ON (void);
|
|
||||||
void far INT_OFF (void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
/* eof */
|
||||||
|
@ -13,11 +13,9 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int CIOResult()
|
int CIOResult()
|
||||||
|
|
||||||
{
|
{
|
||||||
int res = errno ;
|
const int res = errno;
|
||||||
|
errno = NoErr;
|
||||||
errno = NoErr ;
|
return res;
|
||||||
return(res) ;
|
|
||||||
}
|
}
|
||||||
|
105
include/isam.cpp
105
include/isam.cpp
@ -2,14 +2,13 @@
|
|||||||
#include <share.h>
|
#include <share.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define __ISAM_CPP
|
#define __ISAM_CPP
|
||||||
|
|
||||||
#ifndef FOXPRO
|
|
||||||
#include <expr.h>
|
#include <expr.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <codeb.h>
|
#include <codeb.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -84,8 +83,6 @@ void write_journal(TJournalHeader& jh, void* data, int len)
|
|||||||
Str80 cprefix;
|
Str80 cprefix;
|
||||||
bool __field_changed = FALSE;
|
bool __field_changed = FALSE;
|
||||||
|
|
||||||
HIDDEN char _isam_string[257];
|
|
||||||
|
|
||||||
#define NOALLOC (char **) -1
|
#define NOALLOC (char **) -1
|
||||||
|
|
||||||
HIDDEN bool __autoload = TRUE;
|
HIDDEN bool __autoload = TRUE;
|
||||||
@ -752,16 +749,18 @@ long TBaseisamfile::items() const
|
|||||||
|
|
||||||
const char* TBaseisamfile::name() const
|
const char* TBaseisamfile::name() const
|
||||||
{
|
{
|
||||||
sprintf(_isam_string, "%d", num());
|
TString& tmp = get_tmp_string();
|
||||||
return _isam_string;
|
tmp.format("%d", num());
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TBaseisamfile::filename() const
|
const char* TBaseisamfile::filename() const
|
||||||
{
|
{
|
||||||
const int n = _isam_handle > 0 ? _isam_handle : num();
|
const int n = _isam_handle > 0 ? _isam_handle : num();
|
||||||
strcpy(_isam_string, prefix().get_filename(n));
|
TString& tmp = get_tmp_string();
|
||||||
strcat(_isam_string, ".dbf");
|
tmp = prefix().get_filename(n);
|
||||||
return _isam_string;
|
tmp << ".dbf";
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TBaseisamfile::description()
|
const char* TBaseisamfile::description()
|
||||||
@ -2988,7 +2987,7 @@ const char* TRectype::fieldname(int i) const
|
|||||||
|
|
||||||
const TString& TRectype::get_str(const char* fieldname) const
|
const TString& TRectype::get_str(const char* fieldname) const
|
||||||
{
|
{
|
||||||
static TFixed_string tmp(_isam_string, sizeof(_isam_string));
|
TString& tmp = get_tmp_string(256);
|
||||||
const RecDes * recd = rec_des();
|
const RecDes * recd = rec_des();
|
||||||
const int nf = findfld(recd, fieldname);
|
const int nf = findfld(recd, fieldname);
|
||||||
const RecFieldDes& fd = recd->Fd[nf];
|
const RecFieldDes& fd = recd->Fd[nf];
|
||||||
@ -2999,13 +2998,11 @@ const TString& TRectype::get_str(const char* fieldname) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__getfieldbuff(fd.Len, fd.TypeF, _rec + fd.RecOff, _isam_string);
|
__getfieldbuff(fd.Len, fd.TypeF, _rec + fd.RecOff, tmp.get_buffer());
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef FOXPRO
|
|
||||||
|
|
||||||
const TString& TRectype::get(const char* fieldname) const
|
const TString& TRectype::get(const char* fieldname) const
|
||||||
{
|
{
|
||||||
if (_memo_data && type(fieldname) == _memofld)
|
if (_memo_data && type(fieldname) == _memofld)
|
||||||
@ -3088,7 +3085,6 @@ bool TRectype::get_memo(
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FOXPRO
|
|
||||||
|
|
||||||
|
|
||||||
TDate TRectype::get_date(const char* fieldname) const
|
TDate TRectype::get_date(const char* fieldname) const
|
||||||
@ -3097,19 +3093,19 @@ TDate TRectype::get_date(const char* fieldname) const
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef FOXPRO
|
|
||||||
|
|
||||||
void TRectype::put(const char* fieldname, int val)
|
void TRectype::put(const char* fieldname, int val)
|
||||||
{
|
{
|
||||||
sprintf(_isam_string, "%d", val);
|
TString16 tmp;
|
||||||
put_str( fieldname, _isam_string);
|
tmp.format("%d", val);
|
||||||
|
put_str(fieldname, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TRectype::put(const char* fieldname, long val)
|
void TRectype::put(const char* fieldname, long val)
|
||||||
{
|
{
|
||||||
sprintf(_isam_string, "%ld", val);
|
TString16 tmp;
|
||||||
put_str( fieldname, _isam_string);
|
tmp.format("%ld", val);
|
||||||
|
put_str(fieldname, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRectype::put(const char* fieldname, TTextfile& txt)
|
void TRectype::put(const char* fieldname, TTextfile& txt)
|
||||||
@ -3128,15 +3124,15 @@ void TRectype::put(const char* fieldname, TTextfile& txt)
|
|||||||
const long id = memo.set_field(txt, isnew ? FIELDERR : val);
|
const long id = memo.set_field(txt, isnew ? FIELDERR : val);
|
||||||
if (isnew) val = id;
|
if (isnew) val = id;
|
||||||
|
|
||||||
sprintf(_isam_string, "%ld", val);
|
TString16 tmp; tmp.format("%ld", val);
|
||||||
put_str( fieldname, _isam_string);
|
put_str( fieldname, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TRectype::put(const char* fieldname, word val)
|
void TRectype::put(const char* fieldname, word val)
|
||||||
{
|
{
|
||||||
sprintf(_isam_string, "%u", val);
|
TString16 tmp; tmp.format("%u", val);
|
||||||
put_str( fieldname, _isam_string);
|
put_str( fieldname, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRectype::put(const char* fieldname, const real& val)
|
void TRectype::put(const char* fieldname, const real& val)
|
||||||
@ -3169,8 +3165,6 @@ void TRectype::put(const char* fieldname, bool val)
|
|||||||
put_str( fieldname, s);
|
put_str( fieldname, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FOXPRO
|
|
||||||
|
|
||||||
|
|
||||||
void TRectype::put_str(const char* fieldname, const char* val)
|
void TRectype::put_str(const char* fieldname, const char* val)
|
||||||
{
|
{
|
||||||
@ -3355,8 +3349,9 @@ TRectype& TRectype::operator =(const char* rec)
|
|||||||
|
|
||||||
const char* TRectype::key(int numkey) const
|
const char* TRectype::key(int numkey) const
|
||||||
{
|
{
|
||||||
__build_key(rec_des(), numkey, _rec, _isam_string,FALSE);
|
TString& tmp = get_tmp_string(256);
|
||||||
return _isam_string;
|
__build_key(rec_des(), numkey, _rec, tmp.get_buffer(), FALSE);
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRectype::fill_transaction(TConfig& cfg, int row) const
|
void TRectype::fill_transaction(TConfig& cfg, int row) const
|
||||||
@ -3455,9 +3450,6 @@ long TRecfield::operator =(long l)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef FOXPRO
|
|
||||||
|
|
||||||
const real& TRecfield::operator =(const real& r)
|
const real& TRecfield::operator =(const real& r)
|
||||||
{
|
{
|
||||||
char buff[80];
|
char buff[80];
|
||||||
@ -3467,9 +3459,6 @@ const real& TRecfield::operator =(const real& r)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FOXPRO
|
|
||||||
|
|
||||||
|
|
||||||
const TDate& TRecfield::operator =(const TDate& d)
|
const TDate& TRecfield::operator =(const TDate& d)
|
||||||
{
|
{
|
||||||
char buff[16];
|
char buff[16];
|
||||||
@ -3506,60 +3495,59 @@ void TRecfield::setptr(TRecnotype r)
|
|||||||
|
|
||||||
TRecfield::operator int() const
|
TRecfield::operator int() const
|
||||||
{
|
{
|
||||||
|
char tmp[32];
|
||||||
if (_type == _intfld || _type == _intzerofld || _type == _longfld || _type == _longzerofld)
|
if (_type == _intfld || _type == _intzerofld || _type == _longfld || _type == _longzerofld)
|
||||||
{
|
{
|
||||||
strncpy(_isam_string, _p, _len);
|
strncpy(tmp, _p, _len);
|
||||||
_isam_string[_len] = '\0';
|
tmp[_len] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
__getfieldbuff( _len, _type, _p, _isam_string);
|
__getfieldbuff( _len, _type, _p, tmp);
|
||||||
return atoi(_isam_string);
|
return atoi(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TRecfield::operator long() const
|
TRecfield::operator long() const
|
||||||
{
|
{
|
||||||
|
char tmp[32];
|
||||||
if (_type == _longfld || _type == _longzerofld || _type == _intfld || _type == _intzerofld)
|
if (_type == _longfld || _type == _longzerofld || _type == _intfld || _type == _intzerofld)
|
||||||
{
|
{
|
||||||
strncpy(_isam_string, _p, _len);
|
strncpy(tmp, _p, _len);
|
||||||
_isam_string[_len] = '\0';
|
tmp[_len] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
__getfieldbuff( _len, _type, _p, _isam_string);
|
__getfieldbuff( _len, _type, _p, tmp);
|
||||||
|
|
||||||
return atol(_isam_string);
|
return atol(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef FOXPRO
|
|
||||||
|
|
||||||
TRecfield::operator const real() const
|
TRecfield::operator const real() const
|
||||||
{
|
{
|
||||||
|
char tmp[32];
|
||||||
if (_type == _realfld)
|
if (_type == _realfld)
|
||||||
{
|
{
|
||||||
strncpy(_isam_string, _p, _len);
|
strncpy(tmp, _p, _len);
|
||||||
_isam_string[_len] = '\0';
|
tmp[_len] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
__getfieldbuff( _len, _type, _p, _isam_string);
|
__getfieldbuff( _len, _type, _p, tmp);
|
||||||
real r(_isam_string);
|
real r(tmp);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FOXPRO
|
|
||||||
|
|
||||||
|
|
||||||
TRecfield::operator TDate() const
|
TRecfield::operator TDate() const
|
||||||
{
|
{
|
||||||
|
char tmp[16];
|
||||||
if (_type == _datefld)
|
if (_type == _datefld)
|
||||||
{
|
{
|
||||||
strncpy(_isam_string, _p, 8);
|
strncpy(tmp, _p, 8);
|
||||||
_isam_string[8] = '\0';
|
tmp[8] = '\0';
|
||||||
return TDate(atol(_isam_string));
|
return TDate(atol(tmp));
|
||||||
}
|
}
|
||||||
__getfieldbuff(_len, _type, _p, _isam_string);
|
__getfieldbuff(_len, _type, _p, tmp);
|
||||||
return TDate(_isam_string);
|
return TDate(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3568,8 +3556,9 @@ TRecfield::operator const char*() const
|
|||||||
if (_type == _memofld)
|
if (_type == _memofld)
|
||||||
return _rec->get(_name);
|
return _rec->get(_name);
|
||||||
|
|
||||||
__getfieldbuff(_len, _type, _p, _isam_string);
|
TString& tmp = get_tmp_string(_len);
|
||||||
return _isam_string;
|
__getfieldbuff(_len, _type, _p, tmp.get_buffer());
|
||||||
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,12 +231,12 @@ void TMask::add_field(TMask_field* f)
|
|||||||
|
|
||||||
void TMask::add_tag_button(byte pag, TToken_string& tags, byte sel)
|
void TMask::add_tag_button(byte pag, TToken_string& tags, byte sel)
|
||||||
{
|
{
|
||||||
TPage_field* pf = new TPage_field(this);
|
TPage_field* pf = new TPage_field(this);
|
||||||
pf->_ctl_data._dlg = DLG_PAGETAGS + 100 * pag;
|
pf->_ctl_data._dlg = DLG_PAGETAGS + 100 * pag;
|
||||||
pf->replace_items("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16", tags);
|
pf->replace_items("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16", tags);
|
||||||
pf->set_default(sel);
|
pf->set_default(sel);
|
||||||
pf->create(_pagewin[pag]);
|
pf->create(_pagewin[pag]);
|
||||||
add_field(pf);
|
add_field(pf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMask::add_tag_buttons(TToken_string& tags)
|
void TMask::add_tag_buttons(TToken_string& tags)
|
||||||
@ -266,6 +266,7 @@ TMask::TMask(const char* maskname, int num, int max)
|
|||||||
|
|
||||||
TMask::~TMask()
|
TMask::~TMask()
|
||||||
{
|
{
|
||||||
|
_field.destroy();
|
||||||
for (int p = MAX_PAGES; p >= 0; p--)
|
for (int p = MAX_PAGES; p >= 0; p--)
|
||||||
if (_pagewin[p])
|
if (_pagewin[p])
|
||||||
{
|
{
|
||||||
|
@ -4792,8 +4792,8 @@ const char* TZoom_field::get_first_line() const
|
|||||||
#ifndef INCL_XI
|
#ifndef INCL_XI
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void XVT_CALLCONV1 xi_draw_3d_rect XVT_CC_ARGS( ( WINDOW win, RCT* rctp, BOOLEAN well, int height,
|
void xi_draw_3d_rect( WINDOW win, RCT* rctp, BOOLEAN well, int height,
|
||||||
COLOR color_light, COLOR color_ctrl, COLOR color_dark ) );
|
COLOR color_light, COLOR color_ctrl, COLOR color_dark );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -4805,7 +4805,7 @@ void TField_window::handler(WINDOW win, EVENT* ep)
|
|||||||
if (ep->v.active)
|
if (ep->v.active)
|
||||||
{
|
{
|
||||||
WINDOW parent = xvt_vobj_get_parent(win);
|
WINDOW parent = xvt_vobj_get_parent(win);
|
||||||
XI_OBJ* itf = xi_get_itf(parent);
|
XI_OBJ* itf = xi_get_itf((XinWindow)parent);
|
||||||
xi_set_focus(itf);
|
xi_set_focus(itf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4851,7 +4851,7 @@ void TField_window::update()
|
|||||||
const WINDOW pa = parent();
|
const WINDOW pa = parent();
|
||||||
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
|
RCT rct; xvt_vobj_get_outer_rect(me, &rct);
|
||||||
rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2;
|
rct.left -= 2; rct.top -= 2; rct.right += 2; rct.bottom += 2;
|
||||||
xi_draw_3d_rect(pa, (XinRect *) &rct, TRUE, 2, // qui
|
xi_draw_3d_rect((XinWindow)pa, (XinRect *) &rct, TRUE, 2, // qui
|
||||||
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
|
MASK_LIGHT_COLOR, MASK_BACK_COLOR, MASK_DARK_COLOR);
|
||||||
}
|
}
|
||||||
xvt_dwin_clear(me, NORMAL_BACK_COLOR);
|
xvt_dwin_clear(me, NORMAL_BACK_COLOR);
|
||||||
|
@ -13,6 +13,10 @@
|
|||||||
#include <scanner.h>
|
#include <scanner.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __WINDOW_H
|
||||||
|
#include <window.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class TControl; // __CONTROL_H
|
class TControl; // __CONTROL_H
|
||||||
class TText_control;
|
class TText_control;
|
||||||
class TPushbutton_control;
|
class TPushbutton_control;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <memo.h>
|
#include <memo.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
|
#include <io.h>
|
||||||
#include <sys/locking.h>
|
#include <sys/locking.h>
|
||||||
|
|
||||||
#define HEADER_SIZE (sizeof(long)+sizeof(char))
|
#define HEADER_SIZE (sizeof(long)+sizeof(char))
|
||||||
|
@ -2227,7 +2227,7 @@ bool TSpreadsheet::notify(int rec, KEY k)
|
|||||||
{
|
{
|
||||||
const bool ok = _notify ? _notify(owner(), rec, k) : TRUE;
|
const bool ok = _notify ? _notify(owner(), rec, k) : TRUE;
|
||||||
if (k == K_ENTER)
|
if (k == K_ENTER)
|
||||||
set_dirty(ok ? TRUE : 3);
|
set_dirty(ok ? 1 : 3);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2452,7 +2452,6 @@ TString_array& TSheet_field::rows_array() const
|
|||||||
return ((TSpreadsheet*)_ctl)->rows_array();
|
return ((TSpreadsheet*)_ctl)->rows_array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
// Ritorna l'indice della prima riga vuota dello sheet
|
// Ritorna l'indice della prima riga vuota dello sheet
|
||||||
int TSheet_field::first_empty() const
|
int TSheet_field::first_empty() const
|
||||||
|
@ -672,3 +672,14 @@ void os_sleep(long m)
|
|||||||
{
|
{
|
||||||
::Sleep(m);
|
::Sleep(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void os_beep(int severity)
|
||||||
|
{
|
||||||
|
switch (severity)
|
||||||
|
{
|
||||||
|
case 0: MessageBeep(MB_OK); break;
|
||||||
|
case 1: MessageBeep(MB_ICONEXCLAMATION); break;
|
||||||
|
default: MessageBeep(MB_ICONSTOP); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1526,7 +1526,7 @@ bool TPrint_application::print_one (
|
|||||||
pos[pr->row ()] += ps.len ();
|
pos[pr->row ()] += ps.len ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// print!
|
// print!
|
||||||
const int last = rw.last();
|
const int last = rw.last();
|
||||||
@ -1551,10 +1551,10 @@ bool TPrint_application::menu(MENU_TAG m)
|
|||||||
{
|
{
|
||||||
// funziona da se' fino a 20 voci della menubar
|
// funziona da se' fino a 20 voci della menubar
|
||||||
if (m >= BAR_ITEM (1) && m <= BAR_ITEM (20))
|
if (m >= BAR_ITEM (1) && m <= BAR_ITEM (20))
|
||||||
{
|
{
|
||||||
_last_choice = m;
|
_last_choice = m;
|
||||||
do_print((m - BAR_ITEM (0)) / 100);
|
do_print((m - BAR_ITEM (0)) / 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Se non esistono altre voci di menu termina l'applicazione
|
// Se non esistono altre voci di menu termina l'applicazione
|
||||||
return xvt_test_menu_tag (BAR_ITEM (2));
|
return xvt_test_menu_tag (BAR_ITEM (2));
|
||||||
@ -1632,7 +1632,8 @@ TPrint_application::TPrint_application ():TApplication (), _transtab (10),
|
|||||||
_cur_file = 0;
|
_cur_file = 0;
|
||||||
_magic_currency = FALSE;
|
_magic_currency = FALSE;
|
||||||
_print_zero = FALSE;
|
_print_zero = FALSE;
|
||||||
_last_choice = BAR_ITEM (1);
|
|
||||||
|
_last_choice = BAR_ITEM (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPrint_application::reset_files()
|
void TPrint_application::reset_files()
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <viswin.h>
|
#include <viswin.h>
|
||||||
|
|
||||||
|
#include <agasys.h>
|
||||||
|
|
||||||
#include <bagn001a.h>
|
#include <bagn001a.h>
|
||||||
|
|
||||||
#define STYLE_NUM 4
|
#define STYLE_NUM 4
|
||||||
@ -199,7 +201,7 @@ struct PrDesc
|
|||||||
TPrinter * _p;
|
TPrinter * _p;
|
||||||
} PrintWhat;
|
} PrintWhat;
|
||||||
|
|
||||||
BOOLEAN XVT_CALLCONV1 TPrinter::start_print (long data)
|
BOOLEAN TPrinter::start_print(long data)
|
||||||
{
|
{
|
||||||
const PrDesc *pd = (PrDesc *) data;
|
const PrDesc *pd = (PrDesc *) data;
|
||||||
TTextfile& txt = *(pd->_txt);
|
TTextfile& txt = *(pd->_txt);
|
||||||
@ -545,106 +547,7 @@ TString_array& TPrinter::getbgdesc(word page) const
|
|||||||
return *bg;
|
return *bg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//bool printers_on_key(TMask_field & f, KEY key);
|
||||||
bool printers_on_key(TMask_field & f, KEY key);
|
|
||||||
|
|
||||||
// fv support structs for config
|
|
||||||
|
|
||||||
// @doc INTERNAL
|
|
||||||
|
|
||||||
// @mfunc Legge la descrizione della stampante dal file
|
|
||||||
//
|
|
||||||
// @rdesc Ritorna il risultato dell'operazione:
|
|
||||||
//
|
|
||||||
// @flag TRUE | Se e' riuscito a leggere la descrizione della stampante
|
|
||||||
// @flag FALSE | Se non e' riuscito a leggere la descrizione della stampante
|
|
||||||
bool PrinterDef::read(
|
|
||||||
const char *name, // @parm Nome della stampante di cui cercarne la descrizione
|
|
||||||
FILE * fd) // @parm Puntatore al file contenente la descrizione
|
|
||||||
{
|
|
||||||
_printername = name;
|
|
||||||
_printername.trim ();
|
|
||||||
|
|
||||||
TToken_string tmp (64, '=');
|
|
||||||
TString l (48);
|
|
||||||
TString r (16);
|
|
||||||
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
const long p = ftell (fd); // Memorizza inizio paragrafo
|
|
||||||
|
|
||||||
if (fgets (__tmp_string, 256, fd) == NULL)
|
|
||||||
return FALSE;
|
|
||||||
tmp = __tmp_string;
|
|
||||||
tmp.trim ();
|
|
||||||
|
|
||||||
if (tmp == "[End of File]")
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (tmp[0] == '[')
|
|
||||||
{
|
|
||||||
fseek (fd, p, SEEK_SET); // Ritorna ad inizio paragrafo
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
l = tmp.get ();
|
|
||||||
l.trim ();
|
|
||||||
r = tmp.get ();
|
|
||||||
r.trim ();
|
|
||||||
|
|
||||||
if (l == "Device name")
|
|
||||||
{
|
|
||||||
_devicename = r;
|
|
||||||
}
|
|
||||||
else if (l == "Filter name")
|
|
||||||
{
|
|
||||||
_filtername = r;
|
|
||||||
}
|
|
||||||
else if (l == "Printer type")
|
|
||||||
{
|
|
||||||
_printertype = r;
|
|
||||||
}
|
|
||||||
else if (l == "Normal")
|
|
||||||
{
|
|
||||||
strcpy (_atstr[normalstyle], r);
|
|
||||||
}
|
|
||||||
else if (l == "Bold")
|
|
||||||
{
|
|
||||||
strcpy (_atstr[boldstyle], r);
|
|
||||||
}
|
|
||||||
else if (l == "Italic")
|
|
||||||
{
|
|
||||||
strcpy (_atstr[italicstyle], r);
|
|
||||||
}
|
|
||||||
else if (l == "Underlined")
|
|
||||||
{
|
|
||||||
strcpy (_atstr[underlinedstyle], r);
|
|
||||||
}
|
|
||||||
else if (l == "Code")
|
|
||||||
{
|
|
||||||
TToken_string code (r);
|
|
||||||
_names.add ( code.get() );
|
|
||||||
_codes.add ( code.get() );
|
|
||||||
}
|
|
||||||
else if (l == "Form feed")
|
|
||||||
{
|
|
||||||
_ffcode = r;
|
|
||||||
}
|
|
||||||
else if (l == "Newline")
|
|
||||||
{
|
|
||||||
_nlcode = r;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return error_box ("Riga di configurazione stampante errata:\n%s", (const char *) l);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PrinterDef::isdefault ()
|
|
||||||
{
|
|
||||||
return strcmp(_printername, "Default") == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////// TPRINTROW //////////
|
////////// TPRINTROW //////////
|
||||||
|
|
||||||
@ -924,26 +827,6 @@ TPrintrow& TPrintrow::put(const char *str, int position, int len)
|
|||||||
|
|
||||||
////////// TPRINTER //////////
|
////////// TPRINTER //////////
|
||||||
|
|
||||||
HIDDEN bool printer_handler (TMask_field & f, KEY key)
|
|
||||||
{
|
|
||||||
if (key == K_SPACE)
|
|
||||||
{
|
|
||||||
TToken_string pn1(10), pn2(80);
|
|
||||||
|
|
||||||
const PrinterDef & def = printer().get_description(atoi(f.get ()));
|
|
||||||
const char *s;
|
|
||||||
int j = 0;
|
|
||||||
while ((s = def.get_codenames (j)) != NULL)
|
|
||||||
{
|
|
||||||
pn1.add (format ("%02d", j));
|
|
||||||
pn2.add (s);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
((TList_field &) f.mask ().field (MSK_CODES)).replace_items (pn1, pn2);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TPrinter::set_printrcd()
|
void TPrinter::set_printrcd()
|
||||||
{
|
{
|
||||||
if (_print_rcd != NULL)
|
if (_print_rcd != NULL)
|
||||||
@ -1107,9 +990,6 @@ TPrinter::TPrinter()
|
|||||||
{
|
{
|
||||||
_footerhandler = _headerhandler = NULL;
|
_footerhandler = _headerhandler = NULL;
|
||||||
_linkhandler = NULL;
|
_linkhandler = NULL;
|
||||||
_curprn = 0; // first in list if no default is specified
|
|
||||||
|
|
||||||
_curcode = 0; // first in list if no default is specified
|
|
||||||
|
|
||||||
_formlen = 66;
|
_formlen = 66;
|
||||||
_formwidth = 0;
|
_formwidth = 0;
|
||||||
@ -1125,32 +1005,13 @@ TPrinter::TPrinter()
|
|||||||
_isopen = FALSE;
|
_isopen = FALSE;
|
||||||
_multiple_copies = main_app().class_id() == CLASS_PRINT_APPLICATION;
|
_multiple_copies = main_app().class_id() == CLASS_PRINT_APPLICATION;
|
||||||
|
|
||||||
// read configuration file
|
os_get_default_printer(_defPrinter);
|
||||||
|
|
||||||
|
// read configuration file
|
||||||
read_configuration ();
|
read_configuration ();
|
||||||
|
|
||||||
init_formlen ();
|
init_formlen ();
|
||||||
|
|
||||||
os_get_default_printer(_defPrinter);
|
|
||||||
|
|
||||||
TToken_string pn2; os_get_printer_names(pn2); // get printer names
|
|
||||||
|
|
||||||
CHECK(_curprn >= 0, "Can't find printer ");
|
|
||||||
|
|
||||||
if (_curprn >= word(pn2.items()))
|
|
||||||
{
|
|
||||||
TString pdev(_defPrinter); // Nome stampante corrente
|
|
||||||
int comma = pdev.find(',');
|
|
||||||
if (comma > 0)
|
|
||||||
pdev.cut(comma);
|
|
||||||
_curprn = pn2.get_pos(pdev);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const TString pdev(pn2.get(_curprn)); // Nome stampante corrente
|
|
||||||
// scrivi (e semmai lo si risistema poi)
|
|
||||||
os_set_default_printer(pdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_fincatura("+++++++++-|");
|
set_fincatura("+++++++++-|");
|
||||||
|
|
||||||
set_fink_mode(TRUE);
|
set_fink_mode(TRUE);
|
||||||
@ -1196,20 +1057,50 @@ void TPrinter::read_configuration(
|
|||||||
iniptr = new TConfig(CONFIG_USER, "Printer");
|
iniptr = new TConfig(CONFIG_USER, "Printer");
|
||||||
|
|
||||||
const int what = iniptr->get_int("Type", NULL, -1, 0); // Tipo stampante
|
const int what = iniptr->get_int("Type", NULL, -1, 0); // Tipo stampante
|
||||||
_curprn = iniptr->get_int("Number", NULL, -1, 0); // Numero stampante corrente
|
_prname = iniptr->get("Name", NULL, -1, _defPrinter); // Nome stampante corrente
|
||||||
_printerfile = iniptr->get("File", NULL, -1, ""); // File di stampa
|
_printerfile = iniptr->get("File", NULL, -1, ""); // File di stampa
|
||||||
_curcode = iniptr->get_int("Codes", NULL, -1, 0); // Codici di stampa
|
|
||||||
_fontname = iniptr->get("Font", NULL, -1, XVT_FFN_FIXED); // Nome del font
|
_fontname = iniptr->get("Font", NULL, -1, XVT_FFN_FIXED); // Nome del font
|
||||||
_ch_size = iniptr->get_int("Size", NULL, -1, 12); // Dimensione del font
|
_ch_size = iniptr->get_int("Size", NULL, -1, 12); // Dimensione del font
|
||||||
_lines_per_inch = iniptr->get_int("Lines", NULL, -1, 6); // Linee per pollice
|
_lines_per_inch = iniptr->get_int("Lines", NULL, -1, 6); // Linee per pollice
|
||||||
_isgraphics = iniptr->get_bool("Graphic", NULL, -1, FALSE); // Grafica attiva
|
_isgraphics = iniptr->get_bool("Graphic", NULL, -1, FALSE); // Grafica attiva
|
||||||
|
|
||||||
|
#ifdef XVGUY
|
||||||
|
bool read_rcd = TRUE;
|
||||||
|
const TString& host = iniptr->get("Host");
|
||||||
|
if (host.not_empty())
|
||||||
|
{
|
||||||
|
char hostname[32];
|
||||||
|
aga_get_host_name(hostname, sizeof(hostname));
|
||||||
|
if (host != hostname)
|
||||||
|
{
|
||||||
|
read_rcd = yesno_box("Le impostazioni della stampante sono relative alla stazione di lavoro %s:\n"
|
||||||
|
"si desidera applicarle ugualmente alla stazione %s?", (const char*)host, hostname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (read_rcd)
|
||||||
|
#endif
|
||||||
|
|
||||||
if (iniptr->exist("rcd", 0))
|
if (iniptr->exist("rcd", 0))
|
||||||
{
|
{
|
||||||
int size, i = 0;
|
int size, i = 0;
|
||||||
byte* rcd = (byte*)get_printrcd(&size);
|
byte* rcd = (byte*)get_printrcd(&size);
|
||||||
|
|
||||||
TToken_string s(256);
|
TToken_string s(256);
|
||||||
|
|
||||||
|
#ifdef XVGUY
|
||||||
|
// Devo leggere tutti numeri, anche se sono di pìù di quelli attuali!
|
||||||
|
for (int index = 0; ; index++)
|
||||||
|
{
|
||||||
|
s = iniptr->get("rcd", NULL, index);
|
||||||
|
if (s.not_empty())
|
||||||
|
{
|
||||||
|
for (const char* n = s.get(0); n; n = s.get())
|
||||||
|
rcd[i++] = (byte)atoi(n);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
for (int index = 0; i < size; index++)
|
for (int index = 0; i < size; index++)
|
||||||
{
|
{
|
||||||
s = iniptr->get("rcd", NULL, index);
|
s = iniptr->get("rcd", NULL, index);
|
||||||
@ -1221,6 +1112,7 @@ void TPrinter::read_configuration(
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (xvt_print_is_valid(_print_rcd))
|
if (xvt_print_is_valid(_print_rcd))
|
||||||
{
|
{
|
||||||
init_formlen();
|
init_formlen();
|
||||||
@ -1253,11 +1145,9 @@ void TPrinter::read_configuration(
|
|||||||
break;
|
break;
|
||||||
case 4: // video
|
case 4: // video
|
||||||
_printertype = screenvis;
|
_printertype = screenvis;
|
||||||
_curcode = 0;
|
|
||||||
break;
|
break;
|
||||||
case 6: // export
|
case 6: // export
|
||||||
_printertype = export;
|
_printertype = export;
|
||||||
_curcode = 0;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1273,14 +1163,20 @@ void TPrinter::save_configuration()
|
|||||||
TConfig prini(_config == "Printer" ? CONFIG_USER : CONFIG_STAMPE, _config);
|
TConfig prini(_config == "Printer" ? CONFIG_USER : CONFIG_STAMPE, _config);
|
||||||
|
|
||||||
prini.set("Type", _printertype); // Tipo stampante
|
prini.set("Type", _printertype); // Tipo stampante
|
||||||
prini.set("Number", _curprn); // Numero stampante corrente
|
prini.set("Name", _prname); // Numero stampante corrente
|
||||||
prini.set("File", _printerfile); // File di stampa
|
prini.set("File", _printerfile); // File di stampa
|
||||||
prini.set("Codes", _curcode); // Codici di stampa
|
|
||||||
prini.set("Font", _fontname); // Nome del font
|
prini.set("Font", _fontname); // Nome del font
|
||||||
prini.set("Size", _ch_size); // Dimensione del font
|
prini.set("Size", _ch_size); // Dimensione del font
|
||||||
prini.set("Lines", _lines_per_inch); // Linee per pollice
|
prini.set("Lines", _lines_per_inch); // Linee per pollice
|
||||||
prini.set("Graphic", _isgraphics ? "X" : ""); // Grafica attiva
|
prini.set("Graphic", _isgraphics ? "X" : ""); // Grafica attiva
|
||||||
|
|
||||||
|
#ifdef XVGUY
|
||||||
|
char hostname[32];
|
||||||
|
aga_get_host_name(hostname, sizeof(hostname));
|
||||||
|
prini.set("Host", hostname);
|
||||||
|
prini.set("User", user());
|
||||||
|
#endif
|
||||||
|
|
||||||
int n = 0, index = 0;
|
int n = 0, index = 0;
|
||||||
TToken_string val(256);
|
TToken_string val(256);
|
||||||
|
|
||||||
@ -1631,9 +1527,7 @@ void TPrinter::reset()
|
|||||||
|
|
||||||
bool TPrinter::open()
|
bool TPrinter::open()
|
||||||
{
|
{
|
||||||
TToken_string pn2; os_get_printer_names(pn2); // get printer names
|
os_set_default_printer(_prname);
|
||||||
TString pdev(pn2.get(_curprn)); // Nome stampante corrente
|
|
||||||
os_set_default_printer(pdev);
|
|
||||||
|
|
||||||
if (_printertype == screenvis)
|
if (_printertype == screenvis)
|
||||||
{
|
{
|
||||||
@ -1668,29 +1562,20 @@ bool TPrinter::set()
|
|||||||
|
|
||||||
TMask mask("bagn001a");
|
TMask mask("bagn001a");
|
||||||
|
|
||||||
TToken_string pn1(50);
|
|
||||||
int i;
|
|
||||||
|
|
||||||
mask.set(MSK_FILENAME, _printerfile);
|
mask.set(MSK_FILENAME, _printerfile);
|
||||||
mask.set(MSK_NPAGES, _ncopies);
|
mask.set(MSK_NPAGES, _ncopies);
|
||||||
|
|
||||||
const bool can_save = _config == "Printer";
|
const bool can_save = _config == "Printer";
|
||||||
mask.enable(DLG_OK, can_save);
|
mask.enable(DLG_OK, can_save);
|
||||||
// mask.enable(DLG_SAVEREC, can_save);
|
|
||||||
|
// mask.enable(DLG_SAVEREC, can_save);
|
||||||
|
|
||||||
TToken_string pn2; os_get_printer_names(pn2);
|
TToken_string pn2; os_get_printer_names(pn2);
|
||||||
|
|
||||||
TString old_default;
|
|
||||||
os_get_default_printer(old_default);
|
|
||||||
|
|
||||||
const int np = pn2.items();
|
|
||||||
for (i = 0; i < np; i++)
|
|
||||||
pn1.add(i);
|
|
||||||
|
|
||||||
TList_field& plst = (TList_field&)mask.field (MSK_PRINTERS);
|
TList_field& plst = (TList_field&)mask.field (MSK_PRINTERS);
|
||||||
plst.replace_items(pn1, pn2); // Genera printer list
|
plst.replace_items(pn2, pn2); // Genera printer list
|
||||||
|
|
||||||
mask.set(MSK_PRINTERS, _curprn); // Genera font list
|
mask.set(MSK_PRINTERS, _prname); // Genera font list
|
||||||
set_windows_print_device(mask.field(MSK_PRINTERS), K_TAB);
|
set_windows_print_device(mask.field(MSK_PRINTERS), K_TAB);
|
||||||
|
|
||||||
mask.set(MSK_FONT, _fontname); // Genera size list
|
mask.set(MSK_FONT, _fontname); // Genera size list
|
||||||
@ -1700,8 +1585,8 @@ bool TPrinter::set()
|
|||||||
mask.set(MSK_LINES, _lines_per_inch);
|
mask.set(MSK_LINES, _lines_per_inch);
|
||||||
mask.set(MSK_ISGRAPHICS, _isgraphics ? "X" : "");
|
mask.set(MSK_ISGRAPHICS, _isgraphics ? "X" : "");
|
||||||
|
|
||||||
mask.set_handler (MSK_PRINTERS, set_windows_print_device);
|
mask.set_handler(MSK_PRINTERS, set_windows_print_device);
|
||||||
mask.set_handler (MSK_FONT, font_handler);
|
mask.set_handler(MSK_FONT, font_handler);
|
||||||
|
|
||||||
if (!_multiple_copies)
|
if (!_multiple_copies)
|
||||||
mask.hide(MSK_NPAGES);
|
mask.hide(MSK_NPAGES);
|
||||||
@ -1713,11 +1598,12 @@ bool TPrinter::set()
|
|||||||
else
|
else
|
||||||
mask.set (MSK_TYPE, "0");
|
mask.set (MSK_TYPE, "0");
|
||||||
|
|
||||||
const int oldprn = _curprn;
|
const TString oldprn = _prname;
|
||||||
s_printrcd * rcd = get_printrcd();
|
PRINT_RCD* rcd = get_printrcd();
|
||||||
|
|
||||||
TString oldrcd(_print_rcd_size);
|
const int old_rcd_size = _print_rcd_size;
|
||||||
memcpy((char *) (const char *) oldrcd, rcd, _print_rcd_size);
|
TString oldrcd(old_rcd_size);
|
||||||
|
memcpy(oldrcd.get_buffer(), rcd, old_rcd_size);
|
||||||
|
|
||||||
KEY k;
|
KEY k;
|
||||||
while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS)
|
while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS)
|
||||||
@ -1729,28 +1615,18 @@ bool TPrinter::set()
|
|||||||
{
|
{
|
||||||
// Ricarica la lista delle stampanti (L'utente puo' aggiungerne!)
|
// Ricarica la lista delle stampanti (L'utente puo' aggiungerne!)
|
||||||
os_get_printer_names(pn2);
|
os_get_printer_names(pn2);
|
||||||
pn1.cut(0);
|
plst.replace_items(pn2, pn2); // Genera printer list
|
||||||
int i = 0;
|
|
||||||
FOR_EACH_TOKEN(pn2, tok)
|
|
||||||
pn1.add(i++);
|
|
||||||
plst.replace_items(pn1, pn2); // Genera printer list
|
|
||||||
|
|
||||||
// see if user has changed printer
|
// see if user has changed printer
|
||||||
// determine index of currently selected printer
|
// determine index of currently selected printer
|
||||||
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
|
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
|
||||||
|
|
||||||
const char* name = (const char *)(get_printrcd() + 4);
|
_prname = (const char *)(get_printrcd() + 4);
|
||||||
_curprn = pn2.get_pos(name);
|
if (_prname.blank())
|
||||||
if (*name == '\0' || _curprn < 0)
|
_prname = oldprn;
|
||||||
{
|
|
||||||
NFCHECK("Can't find printer '%s'", name);
|
|
||||||
_curprn = oldprn;
|
|
||||||
}
|
|
||||||
|
|
||||||
mask.set(MSK_PRINTERS, pn1.get(_curprn));
|
mask.set(MSK_PRINTERS, _prname);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
beep ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1759,15 +1635,15 @@ bool TPrinter::set()
|
|||||||
// riaggiusta stampante default windows come prima
|
// riaggiusta stampante default windows come prima
|
||||||
// curprn e rcd sono quelle di prima
|
// curprn e rcd sono quelle di prima
|
||||||
main_app().enable_menu_item(M_FILE_PG_SETUP);
|
main_app().enable_menu_item(M_FILE_PG_SETUP);
|
||||||
os_set_default_printer(old_default);
|
os_set_default_printer(oldprn);
|
||||||
_curprn = oldprn;
|
_prname = oldprn;
|
||||||
s_printrcd * rcd = get_printrcd();
|
PRINT_RCD* rcd = get_printrcd();
|
||||||
memcpy(rcd, (const char *) oldrcd, _print_rcd_size);
|
memcpy(rcd, (const char *)oldrcd, old_rcd_size);
|
||||||
init_formlen();
|
init_formlen();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_curprn = atoi(mask.get(MSK_PRINTERS));
|
_prname = mask.get(MSK_PRINTERS);
|
||||||
_ncopies = atoi (mask.get (MSK_NPAGES));
|
_ncopies = atoi (mask.get (MSK_NPAGES));
|
||||||
|
|
||||||
switch (atoi (mask.get (MSK_TYPE)))
|
switch (atoi (mask.get (MSK_TYPE)))
|
||||||
@ -1778,11 +1654,9 @@ bool TPrinter::set()
|
|||||||
case 1: // file
|
case 1: // file
|
||||||
_printertype = fileprinter;
|
_printertype = fileprinter;
|
||||||
_printerfile = mask.get (MSK_FILENAME);
|
_printerfile = mask.get (MSK_FILENAME);
|
||||||
_curcode = atoi (mask.get (MSK_CODES));
|
|
||||||
break;
|
break;
|
||||||
case 2: // video
|
case 2: // video
|
||||||
_printertype = screenvis;
|
_printertype = screenvis;
|
||||||
_curcode = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2049,8 +1923,7 @@ struct font_data
|
|||||||
int _columns;
|
int _columns;
|
||||||
};
|
};
|
||||||
|
|
||||||
HIDDEN
|
HIDDEN BOOLEAN calc_font_callback(long data)
|
||||||
BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
|
|
||||||
{
|
{
|
||||||
font_data& fd = *(font_data*)data;
|
font_data& fd = *(font_data*)data;
|
||||||
|
|
||||||
@ -2084,7 +1957,7 @@ BOOLEAN XVT_CALLCONV1 calc_font_callback(long data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN
|
HIDDEN
|
||||||
BOOLEAN XVT_CALLCONV1 calc_cols_callback(long data)
|
BOOLEAN calc_cols_callback(long data)
|
||||||
{
|
{
|
||||||
int &numcols=*(int *)data;
|
int &numcols=*(int *)data;
|
||||||
|
|
||||||
|
@ -9,10 +9,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef XVT_INCL_XVTTYPE
|
|
||||||
#include <xvt_type.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __DATE_H
|
#ifndef __DATE_H
|
||||||
#include <date.h>
|
#include <date.h>
|
||||||
#endif
|
#endif
|
||||||
@ -137,57 +133,6 @@ public:
|
|||||||
|
|
||||||
// @doc INTERNAL
|
// @doc INTERNAL
|
||||||
|
|
||||||
// @class PrinterDef | Classe per la definizione delle stampanti da utilizzare
|
|
||||||
//
|
|
||||||
// @base public | TObject
|
|
||||||
class PrinterDef : public TObject
|
|
||||||
|
|
||||||
// @author:(INTERNAL) Villa
|
|
||||||
|
|
||||||
{
|
|
||||||
// @cfriend TPrinter
|
|
||||||
friend class TPrinter;
|
|
||||||
|
|
||||||
// @access:(INTERNAL) Private Member
|
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Nome del file della stampante
|
|
||||||
TString _printername;
|
|
||||||
// @cmember:(INTERNAL) Tipo di stampante da utilizzare (0=diretta,1=locale,2=spool)
|
|
||||||
TString _printertype;
|
|
||||||
// @cmember:(INTERNAL) Filtro per la pipe '<pipe>' (solo per unix
|
|
||||||
TString _filtername;
|
|
||||||
// @cmember:(INTERNAL) Nome del device di stampa
|
|
||||||
TString _devicename;
|
|
||||||
// @cmember:(INTERNAL) Codici attributo per la stampante corrente
|
|
||||||
char _atstr[4][10];
|
|
||||||
// @cmember:(INTERNAL) Codici di stampa
|
|
||||||
TString_array _codes;
|
|
||||||
// @cmember:(INTERNAL) Nome dei codici di stampa
|
|
||||||
TString_array _names;
|
|
||||||
// @cmember:(INTERNAL) Codice del formfeed per la stampante corrente
|
|
||||||
TString _ffcode;
|
|
||||||
// @cmember:(INTERNAL) Codice del new line per la stampante corrente
|
|
||||||
TString _nlcode;
|
|
||||||
|
|
||||||
// @access Public Member
|
|
||||||
public:
|
|
||||||
// @cmember Legge la descrizione della stampante dal file
|
|
||||||
bool read(const char* name, FILE* fd);
|
|
||||||
// @cmember Controlla se il nome del file della stampante e' "Default"
|
|
||||||
bool isdefault();
|
|
||||||
// @cmember Ritorna l'<p i>-esimo nome del codice di stampa
|
|
||||||
const char* get_codenames(word i) const
|
|
||||||
{ return i < (word)_names.items() ? (const char*)_names.row(i) : NULL; }
|
|
||||||
// @cmember Ritorna l'<p i>-esimo codice di stampa
|
|
||||||
const char* get_codes(word i) const
|
|
||||||
{ return i < (word)_codes.items() ? (const char*)_codes.row(i) : NULL; }
|
|
||||||
// @cmember Costruttore
|
|
||||||
PrinterDef() : _printername(10), _filtername(10), _ffcode("\f"), _nlcode("\n")
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
// @doc INTERNAL
|
|
||||||
|
|
||||||
// @class BkDef | Classe per la definizione dei bookmark in anteprima di stampa
|
// @class BkDef | Classe per la definizione dei bookmark in anteprima di stampa
|
||||||
//
|
//
|
||||||
// @base public | TObject
|
// @base public | TObject
|
||||||
@ -251,7 +196,7 @@ class TPrinter : public TObject
|
|||||||
FILE* _fp;
|
FILE* _fp;
|
||||||
// @cmember:(INTERNAL) Puntatore al file di visualizzaizone
|
// @cmember:(INTERNAL) Puntatore al file di visualizzaizone
|
||||||
TViswin* _vf;
|
TViswin* _vf;
|
||||||
// @cmember:(INTERNAL) Stampande di default di sistema
|
// @cmember:(INTERNAL) Stampante di default di sistema
|
||||||
TString _defPrinter;
|
TString _defPrinter;
|
||||||
// @cmember:(INTERNAL) Testo da stampare
|
// @cmember:(INTERNAL) Testo da stampare
|
||||||
TTextfile _txt;
|
TTextfile _txt;
|
||||||
@ -265,12 +210,8 @@ class TPrinter : public TObject
|
|||||||
TArray _header;
|
TArray _header;
|
||||||
// @cmember:(INTERNAL) Contenuto del footer
|
// @cmember:(INTERNAL) Contenuto del footer
|
||||||
TArray _footer;
|
TArray _footer;
|
||||||
// @cmember:(INTERNAL) Descrizione delle stampanti
|
// @cmember:(INTERNAL) Nome della stampante corrente
|
||||||
TArray _printers;
|
TString _prname;
|
||||||
// @cmember:(INTERNAL) Indice corrente della stampante
|
|
||||||
word _curprn;
|
|
||||||
// @cmember:(INTERNAL) Codice corrente della stampante
|
|
||||||
int _curcode;
|
|
||||||
// @cmember:(INTERNAL) Lunghezza della pagina logica
|
// @cmember:(INTERNAL) Lunghezza della pagina logica
|
||||||
int _formlen;
|
int _formlen;
|
||||||
// @cmember:(INTERNAL) Larghezza della pagina logica
|
// @cmember:(INTERNAL) Larghezza della pagina logica
|
||||||
@ -279,7 +220,7 @@ class TPrinter : public TObject
|
|||||||
int _currentrow;
|
int _currentrow;
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Nome del font per la stampa
|
// @cmember:(INTERNAL) Nome del font per la stampa
|
||||||
TString80 _fontname;
|
TString _fontname;
|
||||||
// @cmember:(INTERNAL) Dimensione del font per la stampa
|
// @cmember:(INTERNAL) Dimensione del font per la stampa
|
||||||
int _ch_size;
|
int _ch_size;
|
||||||
|
|
||||||
@ -395,7 +336,7 @@ public:
|
|||||||
virtual ~TPrinter();
|
virtual ~TPrinter();
|
||||||
|
|
||||||
// @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_print(long data);
|
static BOOLEAN start_print(long data);
|
||||||
|
|
||||||
// @cmember Setta il numero della prima pagina da stampare
|
// @cmember Setta il numero della prima pagina da stampare
|
||||||
void set_from_page (word from)
|
void set_from_page (word from)
|
||||||
@ -410,13 +351,6 @@ public:
|
|||||||
// @cmember Permette di tradurre la stringa con i codici @codes in un array utilizzabile dalla stampa
|
// @cmember Permette di tradurre la stringa con i codici @codes in un array utilizzabile dalla stampa
|
||||||
void parse_background(const char* bgdesc, TString_array& background);
|
void parse_background(const char* bgdesc, TString_array& background);
|
||||||
|
|
||||||
// @cmember Ritorna il numero delle stampanti disponibili
|
|
||||||
int descriptions()
|
|
||||||
{ return _printers.items(); }
|
|
||||||
// @cmember Ritorna il nome della <p i>-esima stampante disponibile
|
|
||||||
const PrinterDef& get_description(word i) const
|
|
||||||
{ return (const PrinterDef&) _printers[i]; }
|
|
||||||
|
|
||||||
// @cmember Ritorna il nome della classe
|
// @cmember Ritorna il nome della classe
|
||||||
virtual const char* class_name() const;
|
virtual const char* class_name() const;
|
||||||
// @cmember Ritorna l'identificatore della classe
|
// @cmember Ritorna l'identificatore della classe
|
||||||
@ -675,12 +609,12 @@ public:
|
|||||||
int get_char_size() const
|
int get_char_size() const
|
||||||
{ return _ch_size; }
|
{ return _ch_size; }
|
||||||
// @cmember Ritorna il nome del font di stampa
|
// @cmember Ritorna il nome del font di stampa
|
||||||
char* fontname() const
|
const TString& fontname() const
|
||||||
{ return (char*)(const char*)_fontname; }
|
{ return _fontname; }
|
||||||
|
|
||||||
// @cmember Ritorna il nome della stampante
|
// @cmember Ritorna il nome della stampante
|
||||||
const char* printername() const
|
const TString& printername() const
|
||||||
{ return (const char*)get_description(_curprn)._devicename; }
|
{ return _prname; }
|
||||||
|
|
||||||
// @cmember Setta la dimensione dei caratteri da stampare
|
// @cmember Setta la dimensione dei caratteri da stampare
|
||||||
void set_char_size(int size)
|
void set_char_size(int size)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
|
#include <image.h>
|
||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#include <printwin.h>
|
#include <printwin.h>
|
||||||
|
|
||||||
@ -12,12 +13,12 @@ HIDDEN int LEN_SPACES(WINDOW win, int x)
|
|||||||
}
|
}
|
||||||
if (w == 0L)
|
if (w == 0L)
|
||||||
{
|
{
|
||||||
TString spc(132, 'm');
|
TString256 spc; spc.fill('m', 132);
|
||||||
w = xvt_dwin_get_text_width(win, spc.get_buffer(), 132);
|
w = xvt_dwin_get_text_width(win, spc.get_buffer(), 132);
|
||||||
}
|
}
|
||||||
const int k = int((w*x) / 132);
|
const int k = int((w*x) / 132);
|
||||||
|
|
||||||
#ifdef DBG
|
#if defined(DBG) && !defined(XVGUY)
|
||||||
static bool error_on = TRUE;
|
static bool error_on = TRUE;
|
||||||
if (error_on)
|
if (error_on)
|
||||||
{
|
{
|
||||||
@ -269,7 +270,7 @@ void TPrintwin::paint_row(long j)
|
|||||||
// @rdesc Ritorna se e' riuscito a stampare in una unica pagina
|
// @rdesc Ritorna se e' riuscito a stampare in una unica pagina
|
||||||
bool TPrintwin::print_band(
|
bool TPrintwin::print_band(
|
||||||
int page, // @parm Numero della pagina in cui stampare
|
int page, // @parm Numero della pagina in cui stampare
|
||||||
RCT& r) // @parm Parte di finestra da stampare
|
const RCT& r) // @parm Parte di finestra da stampare
|
||||||
|
|
||||||
// @comm Di solito viene disegnata l'intera pagina, ma la cosa dipende dal driver di stampa
|
// @comm Di solito viene disegnata l'intera pagina, ma la cosa dipende dal driver di stampa
|
||||||
{
|
{
|
||||||
@ -294,6 +295,16 @@ bool TPrintwin::print_band(
|
|||||||
return (j + k < _txt.lines() + _frlc);
|
return (j + k < _txt.lines() + _frlc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XVGUY
|
||||||
|
TPrintwin* _curr_print = NULL;
|
||||||
|
|
||||||
|
bool print_callback(int page, const RCT& rct)
|
||||||
|
{
|
||||||
|
return _curr_print->print_band(page-1, rct);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// @doc INTERNAL
|
// @doc INTERNAL
|
||||||
|
|
||||||
// @mfunc Inizia la stampa
|
// @mfunc Inizia la stampa
|
||||||
@ -303,19 +314,14 @@ bool TPrintwin::print_band(
|
|||||||
// @flag TRUE | La stampa e' andata a buon fine
|
// @flag TRUE | La stampa e' andata a buon fine
|
||||||
// @flag FALSE | La stampa e' stata interrotta
|
// @flag FALSE | La stampa e' stata interrotta
|
||||||
bool TPrintwin::do_print()
|
bool TPrintwin::do_print()
|
||||||
|
// @comm Quando possibile parte un processo concorrente (dipende dal sistema operativo)
|
||||||
// @comm Quando possibile parte un processo concorrente (dipende dal sistema operativo)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int page = 0;
|
|
||||||
RCT* rct;
|
|
||||||
bool ok = TRUE;
|
|
||||||
|
|
||||||
#ifdef DBG
|
|
||||||
const long size = xvt_dwin_get_font_size_mapped(win());
|
|
||||||
#endif
|
|
||||||
_frlc = 0;
|
_frlc = 0;
|
||||||
_blank_lines_to_print = 0;
|
_blank_lines_to_print = 0;
|
||||||
|
|
||||||
|
int page = 0;
|
||||||
|
bool ok = TRUE;
|
||||||
|
RCT* rct;
|
||||||
while (ok && !_aborted)
|
while (ok && !_aborted)
|
||||||
{
|
{
|
||||||
_aborted = xvt_print_open_page(_printrcd) == 0;
|
_aborted = xvt_print_open_page(_printrcd) == 0;
|
||||||
@ -324,16 +330,13 @@ bool TPrintwin::do_print()
|
|||||||
{
|
{
|
||||||
set_font(XVT_FFN_SYSTEM, XVT_FS_NONE, _char_size);
|
set_font(XVT_FFN_SYSTEM, XVT_FS_NONE, _char_size);
|
||||||
set_font(printer().fontname(), XVT_FS_NONE, _char_size);
|
set_font(printer().fontname(), XVT_FS_NONE, _char_size);
|
||||||
#ifdef DBG
|
|
||||||
long size1 = xvt_dwin_get_font_size_mapped(win());
|
|
||||||
CHECK(size == size1, "Failed to set font. xvt bugs???");
|
|
||||||
#endif
|
|
||||||
ok = print_band(page, *rct);
|
ok = print_band(page, *rct);
|
||||||
}
|
}
|
||||||
_aborted |= (xvt_print_close_page(_printrcd) == 0);
|
_aborted |= (xvt_print_close_page(_printrcd) == 0);
|
||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
return !_aborted;
|
|
||||||
|
return !_aborted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,11 +73,11 @@ class TPrintwin : public TWindow
|
|||||||
void paint_row(long j);
|
void paint_row(long j);
|
||||||
// @cmember:(INTERNAL) Permette di disegnare un'immagine alla riga y
|
// @cmember:(INTERNAL) Permette di disegnare un'immagine alla riga y
|
||||||
void paint_image(int y, const char* cp);
|
void paint_image(int y, const char* cp);
|
||||||
// @cmember:(INTERNAL) Permette di disegnare la parte di finestra per la pagina <p page>
|
|
||||||
bool print_band(int page, RCT&);
|
|
||||||
|
|
||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
|
// @cmember:(INTERNAL) Permette di disegnare la parte di finestra per la pagina <p page>
|
||||||
|
bool print_band(int page, const RCT& rct);
|
||||||
|
|
||||||
// @cmember Ritorna se la stampa e' stata interrotta (viene ritornata anche della
|
// @cmember Ritorna se la stampa e' stata interrotta (viene ritornata anche della
|
||||||
// <mf TPrintwin::do_print>)
|
// <mf TPrintwin::do_print>)
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#ifndef INCL_XI
|
#ifndef INCL_XI
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void XVT_CALLCONV1 xi_draw_3d_rect XVT_CC_ARGS( ( WINDOW win, RCT* rctp, BOOLEAN well, int height,
|
void xi_draw_3d_rect (WINDOW win, RCT* rctp, BOOLEAN well, int height,
|
||||||
COLOR color_light, COLOR color_ctrl, COLOR color_dark ) );
|
COLOR color_light, COLOR color_ctrl, COLOR color_dark);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <real.h>
|
#include <real.h>
|
||||||
|
|
||||||
HIDDEN char __string[128];
|
|
||||||
const real ZERO (0.0);
|
const real ZERO (0.0);
|
||||||
|
|
||||||
#ifdef __LONGDOUBLE__
|
#ifdef __LONGDOUBLE__
|
||||||
@ -121,7 +120,7 @@ long real::integer () const
|
|||||||
// @mfunc Trasforma un reale in stringa
|
// @mfunc Trasforma un reale in stringa
|
||||||
//
|
//
|
||||||
// @rdesc Ritorna la stringa nella lunghezza richiesta
|
// @rdesc Ritorna la stringa nella lunghezza richiesta
|
||||||
char *real::string (
|
const char *real::string (
|
||||||
int len, // @parm Lunghezza della stringa (compreso decimali)
|
int len, // @parm Lunghezza della stringa (compreso decimali)
|
||||||
int dec, // @parm Numero di decimali (default UNDEFINED)
|
int dec, // @parm Numero di decimali (default UNDEFINED)
|
||||||
char pad) const // @parm Carattere di riempimento (default ' ')
|
char pad) const // @parm Carattere di riempimento (default ' ')
|
||||||
@ -143,6 +142,10 @@ char *real::string (
|
|||||||
if (len != 0) fmt << len;
|
if (len != 0) fmt << len;
|
||||||
if (dec != UNDEFINED) fmt << '.' << dec;
|
if (dec != UNDEFINED) fmt << '.' << dec;
|
||||||
fmt << "Lf";
|
fmt << "Lf";
|
||||||
|
|
||||||
|
TString& tmp = get_tmp_string();
|
||||||
|
char* __string = tmp.get_buffer(len);
|
||||||
|
|
||||||
sprintf(__string, fmt, _dec);
|
sprintf(__string, fmt, _dec);
|
||||||
|
|
||||||
if (len == 0 && dec == UNDEFINED && strchr(__string, '.') != NULL)
|
if (len == 0 && dec == UNDEFINED && strchr(__string, '.') != NULL)
|
||||||
@ -1210,7 +1213,7 @@ TObject* real::dup () const
|
|||||||
return new real(*this);
|
return new real(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *real::eng2ita (char *s)
|
const char *real::eng2ita (char *s)
|
||||||
{
|
{
|
||||||
if (s)
|
if (s)
|
||||||
{
|
{
|
||||||
@ -1222,8 +1225,11 @@ char *real::eng2ita (char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Elimina gli spazi ed i punti, converte le virgole in punti
|
// Elimina gli spazi ed i punti, converte le virgole in punti
|
||||||
char *real::ita2eng (const char *s)
|
const char *real::ita2eng (const char *s)
|
||||||
{
|
{
|
||||||
|
TString& tmp = get_tmp_string();
|
||||||
|
char* __string = tmp.get_buffer(strlen(s));
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
if (s)
|
if (s)
|
||||||
for (int i = 0; s[i]; i++)
|
for (int i = 0; s[i]; i++)
|
||||||
@ -1282,7 +1288,7 @@ bool real::is_natural (const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Certified 75%
|
// Certified 75%
|
||||||
char* real::literals() const
|
const char* real::literals() const
|
||||||
{
|
{
|
||||||
const char *primi20[] =
|
const char *primi20[] =
|
||||||
{"", "uno", "due", "tre", "quattro",
|
{"", "uno", "due", "tre", "quattro",
|
||||||
@ -1308,7 +1314,7 @@ char* real::literals() const
|
|||||||
if (negativo)
|
if (negativo)
|
||||||
r.ltrim (1);
|
r.ltrim (1);
|
||||||
|
|
||||||
TFixed_string risultato (__string, 128);
|
TString& risultato = get_tmp_string(128);
|
||||||
risultato.cut (0);
|
risultato.cut (0);
|
||||||
|
|
||||||
TString centinaia;
|
TString centinaia;
|
||||||
@ -1377,11 +1383,11 @@ char* real::literals() const
|
|||||||
|
|
||||||
if (negativo)
|
if (negativo)
|
||||||
risultato.insert ("meno", 0);
|
risultato.insert ("meno", 0);
|
||||||
return __string;
|
return risultato;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 75%
|
// Certified 75%
|
||||||
char* real::points (int dec) const
|
const char* real::points (int dec) const
|
||||||
{
|
{
|
||||||
const char *str = stringa (0, dec);
|
const char *str = stringa (0, dec);
|
||||||
const int neg = (*str == '-') ? 1 : 0;
|
const int neg = (*str == '-') ? 1 : 0;
|
||||||
@ -1408,7 +1414,7 @@ char* real::points (int dec) const
|
|||||||
for (i = dot - 3; i > neg; i -= 3)
|
for (i = dot - 3; i > neg; i -= 3)
|
||||||
n.insert (".", i);
|
n.insert (".", i);
|
||||||
|
|
||||||
return __string;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN int get_picture_decimals (const TString& picture, char& decsep)
|
HIDDEN int get_picture_decimals (const TString& picture, char& decsep)
|
||||||
@ -1452,7 +1458,7 @@ HIDDEN int get_picture_decimals (const TString& picture, char& decsep)
|
|||||||
return decimali;
|
return decimali;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* real::string(const char *picture) const
|
const char* real::string(const char *picture) const
|
||||||
{
|
{
|
||||||
if (*picture == '\0')
|
if (*picture == '\0')
|
||||||
return string ();
|
return string ();
|
||||||
@ -1462,9 +1468,10 @@ char* real::string(const char *picture) const
|
|||||||
return literals ();
|
return literals ();
|
||||||
|
|
||||||
TString v (string());
|
TString v (string());
|
||||||
TString f (picture);
|
TString& f = get_tmp_string();
|
||||||
char decsep = ','; // Separatore dei decimali
|
f = picture;
|
||||||
|
|
||||||
|
char decsep = ','; // Separatore dei decimali
|
||||||
if (f[f.len() - 1] == 'E')
|
if (f[f.len() - 1] == 'E')
|
||||||
{
|
{
|
||||||
f.rtrim(1);
|
f.rtrim(1);
|
||||||
@ -1546,17 +1553,16 @@ char* real::string(const char *picture) const
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return strcpy (__string, f);
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
char *real ::stringa (int len, int dec, char pad) const
|
const char* real::stringa (int len, int dec, char pad) const
|
||||||
|
|
||||||
{
|
{
|
||||||
string (len, dec, pad);
|
char* str = (char*)string(len, dec, pad);
|
||||||
if (dec > 0 || dec == UNDEFINED)
|
if (dec > 0 || dec == UNDEFINED)
|
||||||
eng2ita (__string);
|
eng2ita (str);
|
||||||
return __string;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
void real::print_on(ostream& out) const
|
void real::print_on(ostream& out) const
|
||||||
|
@ -36,10 +36,10 @@ protected:
|
|||||||
// @cmember Duplica il numero reale (vedi classe <c TObject>)
|
// @cmember Duplica il numero reale (vedi classe <c TObject>)
|
||||||
virtual TObject* dup() const;
|
virtual TObject* dup() const;
|
||||||
// @cmember Traduce in lettere il numero reale
|
// @cmember Traduce in lettere il numero reale
|
||||||
char* literals() const;
|
const char* literals() const;
|
||||||
// @cmember Inserisce i punti separatori delle migliaia e riempe i decimali
|
// @cmember Inserisce i punti separatori delle migliaia e riempe i decimali
|
||||||
// alla lunghezza passata (es: 3.000,20)
|
// alla lunghezza passata (es: 3.000,20)
|
||||||
char* points(int decimals = 0) const;
|
const char* points(int decimals = 0) const;
|
||||||
|
|
||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
@ -49,10 +49,10 @@ public:
|
|||||||
|
|
||||||
// @cmember Trasforma un numero dal formato inglese (decimali con punto) in
|
// @cmember Trasforma un numero dal formato inglese (decimali con punto) in
|
||||||
// formato italiano (decimali con virgola)
|
// formato italiano (decimali con virgola)
|
||||||
static char* eng2ita(char* s);
|
static const char* eng2ita(char* s);
|
||||||
// @cmember Trasforma un numero dal formato italiano (decimali con virgola) in
|
// @cmember Trasforma un numero dal formato italiano (decimali con virgola) in
|
||||||
// formato inglese (decimali con punto)
|
// formato inglese (decimali con punto)
|
||||||
static char* ita2eng(const char* s);
|
static const char* ita2eng(const char* s);
|
||||||
// @cmember Controlla se si tratta di un numero reale (TRUE se vero)
|
// @cmember Controlla se si tratta di un numero reale (TRUE se vero)
|
||||||
static bool is_real(const char* n);
|
static bool is_real(const char* n);
|
||||||
// @cmember Controlla se si tratta di un numero naturale intero (TRUE se vero)
|
// @cmember Controlla se si tratta di un numero naturale intero (TRUE se vero)
|
||||||
@ -60,12 +60,12 @@ public:
|
|||||||
// @cmember Controlla se si tratta di uno zero (TRUE se vero)
|
// @cmember Controlla se si tratta di uno zero (TRUE se vero)
|
||||||
static bool is_null(const char* n);
|
static bool is_null(const char* n);
|
||||||
// @cmember Trasforma un reale in stringa
|
// @cmember Trasforma un reale in stringa
|
||||||
char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
const char* string(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||||
// @cmember Trasforma un reale in stringa (chiama <mf real::string>), ma
|
// @cmember Trasforma un reale in stringa (chiama <mf real::string>), ma
|
||||||
// ritorna il formato italiano
|
// ritorna il formato italiano
|
||||||
char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
const char* stringa(int len = 0, int dec = UNDEFINED, char pad = ' ') const;
|
||||||
// @cmember Ritorna la stringa con il formato passato
|
// @cmember Ritorna la stringa con il formato passato
|
||||||
char* string(const char* picture) const;
|
const char* string(const char* picture) const;
|
||||||
|
|
||||||
// @cmember Ritorna la precisione del reale (numero di decimali)
|
// @cmember Ritorna la precisione del reale (numero di decimali)
|
||||||
int precision() const;
|
int precision() const;
|
||||||
@ -169,10 +169,10 @@ protected:
|
|||||||
// @cmember Duplica il numero reale (vedi classe <c TObject>)
|
// @cmember Duplica il numero reale (vedi classe <c TObject>)
|
||||||
virtual TObject* dup() const;
|
virtual TObject* dup() const;
|
||||||
// @cmember Traduce in lettere il numero reale
|
// @cmember Traduce in lettere il numero reale
|
||||||
char* literals() const;
|
const char* literals() const;
|
||||||
// @cmember Inserisce i punti separatori delle migliaia e riempe i decimali
|
// @cmember Inserisce i punti separatori delle migliaia e riempe i decimali
|
||||||
// alla lunghezza passata (es: 3.000,20)
|
// alla lunghezza passata (es: 3.000,20)
|
||||||
char* points(int decimals = 0) const;
|
const char* points(int decimals = 0) const;
|
||||||
|
|
||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
@ -183,10 +183,10 @@ public:
|
|||||||
|
|
||||||
// @cmember Trasforma un numero dal formato inglese (decimali con punto) in
|
// @cmember Trasforma un numero dal formato inglese (decimali con punto) in
|
||||||
// formato italiano (decimali con virgola)
|
// formato italiano (decimali con virgola)
|
||||||
static char* eng2ita(char* s);
|
static const char* eng2ita(char* s);
|
||||||
// @cmember Trasforma un numero dal formato italiano (decimali con virgola) in
|
// @cmember Trasforma un numero dal formato italiano (decimali con virgola) in
|
||||||
// formato inglese (decimali con punto)
|
// formato inglese (decimali con punto)
|
||||||
static char* ita2eng(const char* s);
|
static const char* ita2eng(const char* s);
|
||||||
// @cmember Controlla se si tratta di un numero reale (TRUE se vero)
|
// @cmember Controlla se si tratta di un numero reale (TRUE se vero)
|
||||||
static bool is_real(const char* n);
|
static bool is_real(const char* n);
|
||||||
// @cmember Controlla se si tratta di un numero naturale intero (TRUE se vero)
|
// @cmember Controlla se si tratta di un numero naturale intero (TRUE se vero)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <regexp.h>
|
#include <regexp.h>
|
||||||
|
|
||||||
// codici di ritorno della matche()
|
// codici di ritorno della matche()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <scanner.h>
|
#include <scanner.h>
|
||||||
|
|
||||||
|
@ -964,7 +964,7 @@ TSheet::TSheet(short x, short y, short dx, short dy,
|
|||||||
_parked(-1), _sheet(NULL), _select_row(-1)
|
_parked(-1), _sheet(NULL), _select_row(-1)
|
||||||
{
|
{
|
||||||
TQuery_field* qf = new TQuery_field(this);
|
TQuery_field* qf = new TQuery_field(this);
|
||||||
qf->construct(30883, head, 1, sht_y, -3, win(), "", -1);
|
qf->construct(25883, head, 1, sht_y, -3, win(), "", -1);
|
||||||
fields_array().add(qf);
|
fields_array().add(qf);
|
||||||
_sheet = qf->sheet();
|
_sheet = qf->sheet();
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
/* Application : SkeyTsr */
|
/* Application : SkeyTsr */
|
||||||
/* Module : skeytsr.h */
|
/* Module : skeytsr.h */
|
||||||
/* Version : 1.0 */
|
/* Version : 1.0 */
|
||||||
/* Date : 18.4.1995 */
|
/* Date : 8.2.1996 */
|
||||||
/* Note : */
|
/* Note : */
|
||||||
/* */
|
/* */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
@ -74,6 +74,7 @@
|
|||||||
#define ST_DRIVER_NOT_INST -13 /* SKEYTSR not installed */
|
#define ST_DRIVER_NOT_INST -13 /* SKEYTSR not installed */
|
||||||
#define ST_TOO_MANY_OPEN_KEY -14 /* Too many open SmartKey */
|
#define ST_TOO_MANY_OPEN_KEY -14 /* Too many open SmartKey */
|
||||||
#define ST_NET_PASS_INVALID -15 /* Invalid net password */
|
#define ST_NET_PASS_INVALID -15 /* Invalid net password */
|
||||||
|
#define ST_EXEC_ERROR -16 /* Max exec reached */
|
||||||
#define ST_HW_FAILURE -20 /* Smartkey damaged */
|
#define ST_HW_FAILURE -20 /* Smartkey damaged */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
@ -119,7 +120,6 @@ typedef struct smartkey {
|
|||||||
/* Interface function prototype */
|
/* Interface function prototype */
|
||||||
/* -------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
short smartlink(KEY_NET *pSkey);
|
||||||
short __far __pascal smartlink(KEY_NET __far *pSkey);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <strstrea.h>
|
#include <strstrea.h>
|
||||||
|
|
||||||
@ -30,81 +31,6 @@ const TToken_string& empty_string()
|
|||||||
const int DEFAULT_SIZE = 50;
|
const int DEFAULT_SIZE = 50;
|
||||||
const int MAX_SIZE = 32000;
|
const int MAX_SIZE = 32000;
|
||||||
|
|
||||||
#ifdef FOXPRO
|
|
||||||
class TString512 : public TFixed_string
|
|
||||||
{
|
|
||||||
char _str512[513];
|
|
||||||
|
|
||||||
public:
|
|
||||||
char* get_buffer();
|
|
||||||
|
|
||||||
TString512() : TFixed_string(_str512, 513) { }
|
|
||||||
const TString& operator =(const char* s);
|
|
||||||
const TString& operator =(const TString& s) { return operator =((const char*)s); }
|
|
||||||
void strncpy(const char* s, int n);
|
|
||||||
};
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
class TString512 : public TString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
char* get_buffer();
|
|
||||||
|
|
||||||
TString512() : TString(512) { }
|
|
||||||
const TString& operator =(const char* s);
|
|
||||||
const TString& operator =(const TString& s) { return operator =((const char*)s); }
|
|
||||||
void strncpy(const char* s, int n);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char* TString512::get_buffer()
|
|
||||||
{
|
|
||||||
if (_size == 0)
|
|
||||||
{
|
|
||||||
#ifdef DBG
|
|
||||||
NFCHECK("Tentativo d'uso di una stringa statica non inizializzata.");
|
|
||||||
#endif
|
|
||||||
#ifdef FOXPRO
|
|
||||||
_str = _str512;
|
|
||||||
_size = 512;
|
|
||||||
#else
|
|
||||||
_str = new char[_size = 512];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return _str;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const TString& TString512::operator =(const char* s)
|
|
||||||
{
|
|
||||||
if (_size == 0)
|
|
||||||
get_buffer();
|
|
||||||
return set(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TString512::strncpy(const char* s, int n)
|
|
||||||
{
|
|
||||||
if (_size == 0)
|
|
||||||
get_buffer();
|
|
||||||
#ifdef FOXPRO
|
|
||||||
TFixed_string::strncpy(s, n);
|
|
||||||
#else
|
|
||||||
if (n > _size)
|
|
||||||
resize(n, FALSE);
|
|
||||||
::strncpy(_str, s, n);
|
|
||||||
_str[n] = '\0';
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FOXPRO
|
|
||||||
HIDDEN TString512 spark;
|
|
||||||
#else
|
|
||||||
HIDDEN TString512* ptr_spark = new TString512;
|
|
||||||
HIDDEN TString512& spark = *ptr_spark;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline bool is_space(char c)
|
inline bool is_space(char c)
|
||||||
{ return c >= '\t' && c <= ' '; }
|
{ return c >= '\t' && c <= ' '; }
|
||||||
|
|
||||||
@ -484,7 +410,9 @@ const TString& TString::left(
|
|||||||
|
|
||||||
// @rdesc Ritorna l'indirizzo della stringa contenente i <p count> caratteri da sinistra
|
// @rdesc Ritorna l'indirizzo della stringa contenente i <p count> caratteri da sinistra
|
||||||
{
|
{
|
||||||
spark.strncpy(_str, count);
|
TString& spark = get_tmp_string();
|
||||||
|
spark = _str;
|
||||||
|
spark.cut(count);
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -497,6 +425,7 @@ const TString& TString::right(
|
|||||||
|
|
||||||
// @rdesc Ritorna l'indirizzo della stringa contenente i <p count> caratteri da destra
|
// @rdesc Ritorna l'indirizzo della stringa contenente i <p count> caratteri da destra
|
||||||
{
|
{
|
||||||
|
TString& spark = get_tmp_string();
|
||||||
int from = len()-count;
|
int from = len()-count;
|
||||||
if (from < 0) from = 0;
|
if (from < 0) from = 0;
|
||||||
spark = _str + from;
|
spark = _str + from;
|
||||||
@ -515,6 +444,7 @@ const TString& TString::mid(
|
|||||||
|
|
||||||
// @rdesc Ritorna l'indirizzo della stringa contenente i <p count> cartteri da <p from>
|
// @rdesc Ritorna l'indirizzo della stringa contenente i <p count> cartteri da <p from>
|
||||||
{
|
{
|
||||||
|
TString& spark = get_tmp_string();
|
||||||
const int l = len();
|
const int l = len();
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
@ -527,7 +457,8 @@ const TString& TString::mid(
|
|||||||
if (from > l) from = l;
|
if (from > l) from = l;
|
||||||
if (count < 0 || from+count>l)
|
if (count < 0 || from+count>l)
|
||||||
count = l-from;
|
count = l-from;
|
||||||
spark.strncpy(&_str[from], count);
|
spark = &_str[from];
|
||||||
|
spark.cut(count);
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -552,9 +483,6 @@ TString& TString::cut(int n)
|
|||||||
CHECKD(n >= 0, "Invalid TString::cut position ", n);
|
CHECKD(n >= 0, "Invalid TString::cut position ", n);
|
||||||
if (n <= _size)
|
if (n <= _size)
|
||||||
_str[n] = '\0';
|
_str[n] = '\0';
|
||||||
// else
|
|
||||||
// NFCHECK("Hai tagliato a %d la stringa '%s' lunga %d(%d)",
|
|
||||||
// n, _str, len(), size());
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,6 +669,7 @@ TString& TString::right_just(
|
|||||||
//
|
//
|
||||||
// @xref <mf TString::left_just> <mf TString::center_just>
|
// @xref <mf TString::left_just> <mf TString::center_just>
|
||||||
{
|
{
|
||||||
|
TString& spark = get_tmp_string();
|
||||||
if (n < 0) n = size();
|
if (n < 0) n = size();
|
||||||
trim();
|
trim();
|
||||||
spark = _str;
|
spark = _str;
|
||||||
@ -763,6 +692,7 @@ TString& TString::center_just(
|
|||||||
//
|
//
|
||||||
// @xref <mf TString::left_just> <mf TString::right_just>
|
// @xref <mf TString::left_just> <mf TString::right_just>
|
||||||
{
|
{
|
||||||
|
TString& spark = get_tmp_string();
|
||||||
if (n < 0) n = size();
|
if (n < 0) n = size();
|
||||||
trim();
|
trim();
|
||||||
spark = _str;
|
spark = _str;
|
||||||
@ -786,6 +716,7 @@ TString& TString::left_just(
|
|||||||
//
|
//
|
||||||
// @xref <mf TString::right_just> <mf TString::center_just>
|
// @xref <mf TString::right_just> <mf TString::center_just>
|
||||||
{
|
{
|
||||||
|
TString& spark = get_tmp_string();
|
||||||
if (n < 0) n = size();
|
if (n < 0) n = size();
|
||||||
trim();
|
trim();
|
||||||
spark = _str;
|
spark = _str;
|
||||||
@ -831,6 +762,7 @@ TString& TString::format(
|
|||||||
// @comm Funziona come la funzione "sprintf" standard del C e ritorna la
|
// @comm Funziona come la funzione "sprintf" standard del C e ritorna la
|
||||||
// stringa formattata con i parametri passati.
|
// stringa formattata con i parametri passati.
|
||||||
{
|
{
|
||||||
|
TString& spark = get_tmp_string(512);
|
||||||
va_list pars;
|
va_list pars;
|
||||||
va_start(pars, fmt);
|
va_start(pars, fmt);
|
||||||
const int tot = vsprintf(spark.get_buffer(), fmt, pars);
|
const int tot = vsprintf(spark.get_buffer(), fmt, pars);
|
||||||
@ -953,9 +885,9 @@ TString& TString::insert(
|
|||||||
{
|
{
|
||||||
const int l = strlen(s);
|
const int l = strlen(s);
|
||||||
make_room(l);
|
make_room(l);
|
||||||
mid(pos); // Scrivi in spark la stringa da pos in poi
|
const TString& spark = mid(pos); // Scrivi in spark la stringa da pos in poi
|
||||||
overwrite(s, pos); // Aggiungi s
|
overwrite(s, pos); // Aggiungi s
|
||||||
strcpy(&_str[pos+l], spark); // Aggiungi spark
|
strcpy(&_str[pos+l], spark); // Aggiungi spark
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -1084,7 +1016,9 @@ const char* TFilename::name() const
|
|||||||
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
spark.strncpy(&_str[i+1], start-i);
|
TString& spark = get_tmp_string();
|
||||||
|
spark = &_str[i+1];
|
||||||
|
spark.cut(start-i);
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1097,7 +1031,9 @@ const char* TFilename::path() const
|
|||||||
for (int i = start; i >= 0; i--)
|
for (int i = start; i >= 0; i--)
|
||||||
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
||||||
break;
|
break;
|
||||||
spark.strncpy(_str, i+1);
|
TString& spark = get_tmp_string();
|
||||||
|
spark = _str;
|
||||||
|
spark.cut(i+1);
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1435,6 +1371,7 @@ const char* TToken_string::get(
|
|||||||
// @xref <mf TToken_string::get_char>
|
// @xref <mf TToken_string::get_char>
|
||||||
{
|
{
|
||||||
CHECK(_separator, "Corrupted TToken_string: NULL separator");
|
CHECK(_separator, "Corrupted TToken_string: NULL separator");
|
||||||
|
TString& spark = get_tmp_string();
|
||||||
|
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
@ -1599,6 +1536,7 @@ bool TToken_string::get(
|
|||||||
bool TToken_string::set_item(const char* v, int n)
|
bool TToken_string::set_item(const char* v, int n)
|
||||||
{
|
{
|
||||||
CHECK(_separator, "Corrupted TToken_string: NULL separator");
|
CHECK(_separator, "Corrupted TToken_string: NULL separator");
|
||||||
|
TString& spark = get_tmp_string();
|
||||||
|
|
||||||
int sep = 0;
|
int sep = 0;
|
||||||
for (int i = 0; sep < n && _str[i]; i++)
|
for (int i = 0; sep < n && _str[i]; i++)
|
||||||
@ -1615,7 +1553,7 @@ bool TToken_string::set_item(const char* v, int n)
|
|||||||
int e = find(_separator, i);
|
int e = find(_separator, i);
|
||||||
if (e < 0) e = len();
|
if (e < 0) e = len();
|
||||||
|
|
||||||
spark = _str+e; // Salva items seguenti
|
spark = _str+e; // Salva items seguenti
|
||||||
cut(i); // Considera solo items precedenti
|
cut(i); // Considera solo items precedenti
|
||||||
*this << v << spark; // Aggiunge item desiderato e seguenti
|
*this << v << spark; // Aggiunge item desiderato e seguenti
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1938,3 +1876,23 @@ void TString_array::sort(bool ascending)
|
|||||||
TArray::sort(ascending ? ascending_string : descending_string);
|
TArray::sort(ascending ? ascending_string : descending_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Temporary strings generator: a little step for a man, a big step for campo!
|
||||||
|
|
||||||
|
TToken_string& get_tmp_string(int len)
|
||||||
|
{
|
||||||
|
static TString_array ararar(128);
|
||||||
|
static int next = 0;
|
||||||
|
|
||||||
|
TToken_string* str = (TToken_string*)ararar.objptr(next);
|
||||||
|
if (str == NULL || str->size() < len)
|
||||||
|
{
|
||||||
|
str = new TToken_string(len);
|
||||||
|
ararar.add(str, next);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
str->cut(0);
|
||||||
|
|
||||||
|
if (++next >= ararar.size())
|
||||||
|
next = 0;
|
||||||
|
return *str;
|
||||||
|
}
|
||||||
|
@ -282,11 +282,8 @@ public:
|
|||||||
// @cmember Distruttore
|
// @cmember Distruttore
|
||||||
virtual ~TFixed_string();
|
virtual ~TFixed_string();
|
||||||
|
|
||||||
#ifndef __WATCOMC__
|
// @cmember Manda un output formattato alla stringa oggetto
|
||||||
virtual
|
virtual TString& format(const char* fmt, ...);
|
||||||
#endif
|
|
||||||
// @cmember Manda un output formattato alla stringa oggetto
|
|
||||||
TString& format(const char* fmt, ...);
|
|
||||||
|
|
||||||
// @cmember Assegna la stringa passata con indirizzo
|
// @cmember Assegna la stringa passata con indirizzo
|
||||||
const TString& operator =(const TString& s)
|
const TString& operator =(const TString& s)
|
||||||
@ -719,6 +716,8 @@ public:
|
|||||||
|
|
||||||
TString& user();
|
TString& user();
|
||||||
|
|
||||||
|
TToken_string& get_tmp_string(int len = -1);
|
||||||
|
|
||||||
const TToken_string& empty_string();
|
const TToken_string& empty_string();
|
||||||
#define EMPTY_STRING empty_string()
|
#define EMPTY_STRING empty_string()
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <tree.h>
|
#include <tree.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <window.h>
|
#include <image.h>
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <golem.h>
|
#include <golem.h>
|
||||||
|
#include <image.h>
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <printapp.h>
|
#include <printapp.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -62,7 +63,6 @@ public:
|
|||||||
class _BkMenuDesc : public TObject
|
class _BkMenuDesc : public TObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TString_array _menu;
|
TString_array _menu;
|
||||||
int _father_id;
|
int _father_id;
|
||||||
_BkMenuDesc() {}
|
_BkMenuDesc() {}
|
||||||
@ -71,15 +71,6 @@ public:
|
|||||||
|
|
||||||
int TViswin::tabx(int x) const
|
int TViswin::tabx(int x) const
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
HIDDEN long w = 0L;
|
|
||||||
if (w == 0L)
|
|
||||||
{
|
|
||||||
const TString t(256, 'm');
|
|
||||||
w = xvt_dwin_get_text_width(win(), (char*)(const char*)t, 256);
|
|
||||||
}
|
|
||||||
return int((w*x) >> 8);
|
|
||||||
*/
|
|
||||||
return char2pixel(x);
|
return char2pixel(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1590,10 +1581,8 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
autoscroll(TRUE);
|
autoscroll(TRUE);
|
||||||
|
|
||||||
if (_selecting)
|
if (_selecting)
|
||||||
_isselection = TRUE;;
|
|
||||||
{
|
|
||||||
_isselection = TRUE;
|
_isselection = TRUE;
|
||||||
}
|
|
||||||
// scroll if necessary
|
// scroll if necessary
|
||||||
if (p.y >= _textrows + 1l)
|
if (p.y >= _textrows + 1l)
|
||||||
{
|
{
|
||||||
@ -1895,7 +1884,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
update ();
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TViswin::on_key (KEY key)
|
bool TViswin::on_key(KEY key)
|
||||||
{
|
{
|
||||||
EVENT_TYPE type = E_USER;
|
EVENT_TYPE type = E_USER;
|
||||||
|
|
||||||
@ -2277,8 +2266,9 @@ void TViswin::sel_to_clipboard()
|
|||||||
// put data
|
// put data
|
||||||
for (i = 0; i < txt.items(); i++)
|
for (i = 0; i < txt.items(); i++)
|
||||||
{
|
{
|
||||||
TString& s = txt.row(i);
|
const TString& s = txt.row(i);
|
||||||
for (int j = 0; j < s.len(); j++)
|
const int slen = s.len();
|
||||||
|
for (int j = 0; j < slen; j++)
|
||||||
*p++ = s[j];
|
*p++ = s[j];
|
||||||
for (j = 0; j < eol_len; j++)
|
for (j = 0; j < eol_len; j++)
|
||||||
*p++ = EOL_SEQ[j];
|
*p++ = EOL_SEQ[j];
|
||||||
|
@ -61,9 +61,9 @@ HIDDEN void set_menu_item(MENU_ITEM& m, TToken_string& tt)
|
|||||||
|
|
||||||
m.tag = tag;
|
m.tag = tag;
|
||||||
m.text = text;
|
m.text = text;
|
||||||
m.enabled = !(flag.find('D') != -1);
|
m.enabled = flag.find('D') < 0;
|
||||||
m.checkable = flag.find('C') != -1 || flag.find('c') != -1;
|
m.checkable = flag.find('C') >= 0 || flag.find('c') >= 0;
|
||||||
m.checked = flag.find('c') != -1;
|
m.checked = flag.find('c') >= 0;
|
||||||
m.separator = text == NULL;
|
m.separator = text == NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,9 +198,12 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
|||||||
void TWindow_manager::menu_enable(bool on) const
|
void TWindow_manager::menu_enable(bool on) const
|
||||||
{
|
{
|
||||||
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
||||||
xvt_menu_enable(mi, on);
|
if (mi)
|
||||||
xvt_menu_update(TASK_WIN);
|
{
|
||||||
xvt_res_free_menu_tree(mi);
|
xvt_menu_enable(mi, on);
|
||||||
|
xvt_menu_update(TASK_WIN);
|
||||||
|
xvt_res_free_menu_tree(mi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -311,256 +314,6 @@ WINDOW cur_win()
|
|||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// TImage
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
// Certified 99%
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @mfunc Setta l'immagine e le sue dimensioni
|
|
||||||
//
|
|
||||||
// @rdesc Ritorna l'immagine stessa
|
|
||||||
XVT_IMAGE TImage::set(
|
|
||||||
XVT_IMAGE i) // @parm Immagine da settare
|
|
||||||
|
|
||||||
// @comm L'immagine precedente viene cancellata quando viene settata una nuova
|
|
||||||
{
|
|
||||||
if (_image)
|
|
||||||
xvt_image_destroy(_image);
|
|
||||||
_image = i;
|
|
||||||
if (i)
|
|
||||||
{
|
|
||||||
_src.left = _src.top = 0;
|
|
||||||
xvt_image_get_dimensions(i, &_src.right, &_src.bottom);
|
|
||||||
_dst = _src;
|
|
||||||
}
|
|
||||||
return _image;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @mfunc Legge l'immagine dal file
|
|
||||||
XVT_IMAGE TImage::load(
|
|
||||||
const char* n) // @parm Nome del file contenente l'immagine
|
|
||||||
{
|
|
||||||
WinManager.free_handle();
|
|
||||||
XVT_IMAGE i = xvt_image_read_bmp((char*)n);
|
|
||||||
WinManager.lock_handle();
|
|
||||||
|
|
||||||
if (i != NULL) set(i);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
XVT_IMAGE TImage::load(short id)
|
|
||||||
{
|
|
||||||
return set(xvt_res_get_image(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
TImage::TImage(const char* n) : _image(NULL)
|
|
||||||
{
|
|
||||||
if (n && *n) load(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
TImage::TImage(short id) : _image(NULL)
|
|
||||||
{
|
|
||||||
if (id > 0) load(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 90%
|
|
||||||
TImage::TImage(const TImage& im, short w, short h) : _image(NULL)
|
|
||||||
{
|
|
||||||
const XVT_IMAGE_FORMAT fmt = xvt_image_get_format(im._image);
|
|
||||||
if (w < 0 || h < 0)
|
|
||||||
{
|
|
||||||
short iw, ih;
|
|
||||||
xvt_image_get_dimensions(im._image, &iw, &ih);
|
|
||||||
if (w < 0) w = iw;
|
|
||||||
if (h < 0) h = ih;
|
|
||||||
}
|
|
||||||
set(xvt_image_create(fmt, w, h, NULL));
|
|
||||||
|
|
||||||
if (ok())
|
|
||||||
{
|
|
||||||
if (fmt == XVT_IMAGE_CL8)
|
|
||||||
{
|
|
||||||
const short colors = xvt_image_get_ncolors(im._image);
|
|
||||||
xvt_image_set_ncolors(_image, colors);
|
|
||||||
for (short c = 0; c < colors; c++)
|
|
||||||
xvt_image_set_clut(_image, c, xvt_image_get_clut((XVT_IMAGE)im._image, c));
|
|
||||||
}
|
|
||||||
xvt_image_transfer(_image, (XVT_IMAGE)im._image, &_src, (RCT*)&im._src);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 90%
|
|
||||||
TImage::TImage(short w, short h, XVT_IMAGE_FORMAT fmt) : _image(NULL)
|
|
||||||
{
|
|
||||||
set(xvt_image_create(fmt, w, h, NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
TImage::~TImage()
|
|
||||||
{
|
|
||||||
if (_image != NULL)
|
|
||||||
xvt_image_destroy(_image);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @mfunc Permette di settare la posizione della figura
|
|
||||||
void TImage::set_pos(
|
|
||||||
int x, // @parm Coordinata x dell'immagine da settare
|
|
||||||
int y) // @parm Coordinata y dell'immagine da settare
|
|
||||||
|
|
||||||
// @comm Permette di aggiornare il mebro <p _dst> sommandogli i valori
|
|
||||||
// passati con <p x> e <p y>
|
|
||||||
{
|
|
||||||
_dst = _src;
|
|
||||||
xvt_rect_offset(&_dst, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
void TImage::draw(WINDOW w) const
|
|
||||||
{
|
|
||||||
xvt_dwin_draw_image(w, _image, (RCT*)&_dst, (RCT*)&_src);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @mfunc Permette di gestire il disegno dell'immagine sullo schermo
|
|
||||||
void TImage::draw(
|
|
||||||
WINDOW w, // @parm Immagine da disegnare
|
|
||||||
int x, // @parm Coordinata x in cui disegnare l'immagine
|
|
||||||
int y) const // @parm Coordinata y in cui disegnare l'immagine
|
|
||||||
// @parm RCT& | _src | Rettangolo contenente l'immagine da disegnare
|
|
||||||
// @parm RCT& | _dst | Rettangolo in cui disegnare l'immagine
|
|
||||||
|
|
||||||
// @syntax void draw(WINDOW w);
|
|
||||||
// @syntax void draw(WINDOW w, int x, int y);
|
|
||||||
// @syntax void draw(WINDOW w, const RCT& dst);
|
|
||||||
// @syntax void draw(WINDOW w, const RCT& dst, const RCT& src);
|
|
||||||
|
|
||||||
// @comm Nel caso utilizzo l'ultima sintassi e' possibile disegnare solo una parte
|
|
||||||
// dell'immagine, precisamente delle dimensioni <p _dst> se tale parametro e'
|
|
||||||
// minore di <p _pst>
|
|
||||||
{
|
|
||||||
RCT dst = _src;
|
|
||||||
xvt_rect_offset(&dst, x, y);
|
|
||||||
xvt_dwin_draw_image(w, _image, &dst, (RCT*)&_src);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
void TImage::draw(WINDOW w, const RCT& dst) const
|
|
||||||
{
|
|
||||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&_src);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
void TImage::draw(WINDOW w, const RCT& dst, const RCT& src) const
|
|
||||||
{
|
|
||||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&src);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 99%
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @mfunc Fa corrispondere la palette della finestra a quella dell'immagine
|
|
||||||
void TImage::set_palette(
|
|
||||||
WINDOW w) const // @parm Finestra a cui settare la palette
|
|
||||||
{
|
|
||||||
XVT_PALETTE wp = xvt_vobj_get_palet(w);
|
|
||||||
if (wp != NULL)
|
|
||||||
{
|
|
||||||
XVT_PALETTE p = xvt_palet_create(XVT_PALETTE_USER, NULL);
|
|
||||||
const int ncolors = xvt_palet_get_ncolors(wp);
|
|
||||||
COLOR* color = new COLOR[ncolors];
|
|
||||||
xvt_palet_get_colors(wp, color, ncolors);
|
|
||||||
xvt_palet_add_colors(p, color, ncolors);
|
|
||||||
delete color;
|
|
||||||
xvt_palet_add_colors_from_image(p, _image);
|
|
||||||
xvt_vobj_set_palet(w, p);
|
|
||||||
xvt_palet_destroy(wp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 100%
|
|
||||||
void TImage::set_clut(byte n, COLOR c)
|
|
||||||
{
|
|
||||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
|
||||||
xvt_image_set_clut(_image, n, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TImage::set_pixel(int x, int y, COLOR col)
|
|
||||||
{
|
|
||||||
xvt_image_set_pixel(_image, x, y, col);
|
|
||||||
}
|
|
||||||
|
|
||||||
COLOR TImage::get_pixel(int x, int y) const
|
|
||||||
{
|
|
||||||
return xvt_image_get_pixel(_image, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Certified 99%
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
|
||||||
void TImage::convert_to_default_colors()
|
|
||||||
|
|
||||||
// @comm Legge nell'immagine i colori CYAN e DARK_CYAN e li setta a seconda del colore
|
|
||||||
// della finestra per fare in modo di rendere trasparenti tali colori.
|
|
||||||
{
|
|
||||||
if (MASK_BACK_COLOR != COLOR_DKCYAN && xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
|
||||||
{
|
|
||||||
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
|
|
||||||
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
|
|
||||||
{
|
|
||||||
const COLOR c = get_pixel(x, y);
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case COLOR_DKCYAN & 0x00FFFFFF:
|
|
||||||
set_pixel(x, y, MASK_BACK_COLOR); break;
|
|
||||||
case COLOR_CYAN & 0x00FFFFFF:
|
|
||||||
set_pixel(x, y, MASK_LIGHT_COLOR); break;
|
|
||||||
case COLOR_GRAY & 0x00FFFFFF:
|
|
||||||
set_pixel(x, y, MASK_DARK_COLOR); break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
|
|
||||||
void TImage::convert_transparent_color(COLOR transparent)
|
|
||||||
|
|
||||||
// @comm Legge nell'immagine i pixel uguali a quello in alto a sinistra e li setta
|
|
||||||
// uguali allo sfondo delle maschere
|
|
||||||
{
|
|
||||||
if (_image)
|
|
||||||
{
|
|
||||||
const COLOR trans = get_pixel(0, 0) & 0x00FFFFFF;
|
|
||||||
if (trans != (transparent & 0x00FFFFFF) &&
|
|
||||||
xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
|
||||||
{
|
|
||||||
for (int index = xvt_image_get_ncolors(_image)-1; index >=0; index--)
|
|
||||||
if (trans == (xvt_image_get_clut(_image, index) & 0x00FFFFFF))
|
|
||||||
{
|
|
||||||
xvt_image_set_clut(_image, index, transparent);
|
|
||||||
// break; don't break: replace all colors equal to upper left in the palette
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TWindow
|
// TWindow
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -577,7 +330,7 @@ TWindow::TWindow()
|
|||||||
word TWindow::class_id() const
|
word TWindow::class_id() const
|
||||||
{ return CLASS_WINDOW; }
|
{ return CLASS_WINDOW; }
|
||||||
|
|
||||||
long XVT_CALLCONV1 TWindow::window_handler(WINDOW win, EVENT* ep)
|
long TWindow::window_handler(WINDOW win, EVENT* ep)
|
||||||
{
|
{
|
||||||
TWindow* w = (TWindow*)xvt_vobj_get_data(win);
|
TWindow* w = (TWindow*)xvt_vobj_get_data(win);
|
||||||
CHECK(w != NULL, "Invalid window");
|
CHECK(w != NULL, "Invalid window");
|
||||||
@ -810,7 +563,7 @@ void TWindow::maximize() const
|
|||||||
|
|
||||||
void TWindow::set_background_color(COLOR col)
|
void TWindow::set_background_color(COLOR col)
|
||||||
{
|
{
|
||||||
XI_OBJ* itf = xi_get_itf(win());
|
XI_OBJ* itf = xi_get_itf((XinWindow)win());
|
||||||
itf->v.itf->back_color = col;
|
itf->v.itf->back_color = col;
|
||||||
force_update();
|
force_update();
|
||||||
}
|
}
|
||||||
@ -942,14 +695,18 @@ void TWindow::frame(
|
|||||||
if (left > right) swap(left, right);
|
if (left > right) swap(left, right);
|
||||||
if (top > bottom) swap(top, bottom);
|
if (top > bottom) swap(top, bottom);
|
||||||
|
|
||||||
const bool saved = flag && save_ctools();
|
const bool saved = flag != 0 && save_ctools();
|
||||||
|
|
||||||
if (flag & 1) hide_pen();
|
if (flag & 1) hide_pen();
|
||||||
if (flag & 2) hide_brush();
|
if (flag & 2) hide_brush();
|
||||||
if (flag & 4)
|
if (flag & 4)
|
||||||
{
|
{
|
||||||
set_mode(M_XOR);
|
set_mode(M_XOR);
|
||||||
|
#ifdef XVGUY
|
||||||
|
set_brush(COLOR_WHITE);
|
||||||
|
#else
|
||||||
set_brush(COLOR_BLACK); // Needed for Windows
|
set_brush(COLOR_BLACK); // Needed for Windows
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const PNT f = log2dev(left,top);
|
const PNT f = log2dev(left,top);
|
||||||
@ -1044,7 +801,6 @@ TPoint TWindow::dev2log(const PNT& p) const
|
|||||||
TPoint pnt(p.h, p.v);
|
TPoint pnt(p.h, p.v);
|
||||||
if (!_pixmap)
|
if (!_pixmap)
|
||||||
{
|
{
|
||||||
// pnt.x /= CHARX;
|
|
||||||
pnt.x = int(128L * p.h / char2pixel(128));
|
pnt.x = int(128L * p.h / char2pixel(128));
|
||||||
pnt.y /= CHARY;
|
pnt.y /= CHARY;
|
||||||
}
|
}
|
||||||
|
@ -51,93 +51,6 @@ struct TPoint
|
|||||||
{ return p.x != x || p.y != y; }
|
{ return p.x != x || p.y != y; }
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// TImage
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
|
||||||
|
|
||||||
// @class TImage | Classe per la gestione delle imagini a video
|
|
||||||
//
|
|
||||||
// @base public | TObject
|
|
||||||
class TImage : public TObject
|
|
||||||
|
|
||||||
// @author:(INTERNAL) Guido
|
|
||||||
{
|
|
||||||
// @access Private Member
|
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Immagine de gestire
|
|
||||||
XVT_IMAGE _image;
|
|
||||||
// @cmember:(INTERNAL) Rettangolo originale (origine 0,0 e dimensioni originali) dell'immagine
|
|
||||||
RCT _src;
|
|
||||||
// @cmember:(INTERNAL) Rettangolo di visualizzazione dell'immagine (dove mettere l'immagine)
|
|
||||||
RCT _dst;
|
|
||||||
|
|
||||||
// @access Public Member
|
|
||||||
public:
|
|
||||||
// @cmember Fa corrispondere la palette della finestra a quella dell'immagine
|
|
||||||
void set_palette(WINDOW w) const;
|
|
||||||
// @cmember Permette di settare la posizione della figura
|
|
||||||
void set_pos(int x, int y);
|
|
||||||
|
|
||||||
// @cmember Disegna l'immagine nella poszione di default e nella dimensione
|
|
||||||
// di defalut
|
|
||||||
void draw(WINDOW w) const ;
|
|
||||||
// @cmember Disegna l'immagine con dimensione default in un punto dello schermo
|
|
||||||
void draw(WINDOW w, int x, int y) const;
|
|
||||||
// @cmember Disegna/modifica l'immagine sullo schermo
|
|
||||||
void draw(WINDOW w, const RCT& dst) const;
|
|
||||||
// @cmember Disegna l'immagine sulla finestra
|
|
||||||
void draw(WINDOW w, const RCT& dst, const RCT& src) const;
|
|
||||||
// @cmember Setta un pixel
|
|
||||||
void set_pixel(int x, int y, COLOR c);
|
|
||||||
// @cmember Legge un pixel
|
|
||||||
COLOR get_pixel(int x, int y) const;
|
|
||||||
|
|
||||||
// @cmember Setta l'immagine e le sue dimensioni
|
|
||||||
XVT_IMAGE set(XVT_IMAGE i);
|
|
||||||
// @cmember Legge l'immagine dal file
|
|
||||||
XVT_IMAGE load(const char* n);
|
|
||||||
// @cmember Legge l'immagine dal file di risorse
|
|
||||||
XVT_IMAGE load(short id);
|
|
||||||
|
|
||||||
// @cmember Controlla che l'immagine sia un oggetto valido (diverso da NULL)
|
|
||||||
virtual bool ok() const
|
|
||||||
{ return _image != NULL; }
|
|
||||||
|
|
||||||
// @cmember Ritorna la larghezza dell'immagine
|
|
||||||
short width() const
|
|
||||||
{ return _src.right; }
|
|
||||||
// @cmember Ritorna l'altezza dell'immagine
|
|
||||||
short height() const
|
|
||||||
{ return _src.bottom; }
|
|
||||||
// @cmember Ritorna il rettangolo dell'immagine originale
|
|
||||||
const RCT& rect() const
|
|
||||||
{ return _src; }
|
|
||||||
|
|
||||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
|
||||||
// usando i colori di default (di Morpurgo)
|
|
||||||
void convert_to_default_colors();
|
|
||||||
|
|
||||||
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
|
|
||||||
// usando l'angolo in alto a sinistra dell'imagine stessa
|
|
||||||
void convert_transparent_color(COLOR transparent);
|
|
||||||
|
|
||||||
// @cmember Setta l'<p n>.esime entry della paletta al colore <p c>
|
|
||||||
void set_clut(byte n, COLOR c);
|
|
||||||
|
|
||||||
// @cmember Costruttore. Viene passato il nome del file
|
|
||||||
TImage(const char* n);
|
|
||||||
// @cmember Costruttore. Viene passato l'identificatore dell'immagine sul file di risorsa
|
|
||||||
TImage(short id);
|
|
||||||
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
|
||||||
TImage(const TImage& i, short width = -1, short height = -1);
|
|
||||||
// @cmember Costruttore. Viene passata l'immagine e le sue diemsioni
|
|
||||||
TImage(short width, short height, XVT_IMAGE_FORMAT fmt = XVT_IMAGE_CL8);
|
|
||||||
// @cmember Distruttore
|
|
||||||
virtual ~TImage();
|
|
||||||
};
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @class TWindow | Classe per la definizione di una finestra generica
|
// @class TWindow | Classe per la definizione di una finestra generica
|
||||||
@ -183,7 +96,7 @@ protected:
|
|||||||
bool _pixmap : 1;
|
bool _pixmap : 1;
|
||||||
|
|
||||||
// @cmember Intercetta tutti i messaggi diretti alla finestra di XVT
|
// @cmember Intercetta tutti i messaggi diretti alla finestra di XVT
|
||||||
static long XVT_CALLCONV1 window_handler(WINDOW win, EVENT* ep);
|
static long window_handler(WINDOW win, EVENT* ep);
|
||||||
// @cmember Crea la finestra
|
// @cmember Crea la finestra
|
||||||
virtual WINDOW create(short x, short y, short dx, short dy, const char* title = "", long flags = WSF_NONE, WIN_TYPE rt = W_DOC, WINDOW parent = NULL_WIN, int menu = 0) ;
|
virtual WINDOW create(short x, short y, short dx, short dy, const char* title = "", long flags = WSF_NONE, WIN_TYPE rt = W_DOC, WINDOW parent = NULL_WIN, int menu = 0) ;
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#define STRICT
|
|
||||||
#define XVT_INCL_NATIVE
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
@ -589,7 +587,7 @@ void xvt_statbar_set(
|
|||||||
|
|
||||||
// @doc INTERNAL
|
// @doc INTERNAL
|
||||||
|
|
||||||
// @func Permette di cambiare il titolo alla barra di stato presente
|
// @func Setta il testo standard della barra di stato
|
||||||
void xvt_statbar_refresh()
|
void xvt_statbar_refresh()
|
||||||
|
|
||||||
// @xref <f xvt_create_statbar> <f xvt_statbar_set>
|
// @xref <f xvt_create_statbar> <f xvt_statbar_set>
|
||||||
@ -629,9 +627,13 @@ bool xvt_test_menu_tag(
|
|||||||
MENU_TAG tag) // @parm Menu' nel quale cercare la voce
|
MENU_TAG tag) // @parm Menu' nel quale cercare la voce
|
||||||
|
|
||||||
{
|
{
|
||||||
|
bool ok = FALSE;
|
||||||
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
||||||
const bool ok = test_menu_tag(mi, tag);
|
if (mi)
|
||||||
xvt_res_free_menu_tree(mi);
|
{
|
||||||
|
ok = test_menu_tag(mi, tag);
|
||||||
|
xvt_res_free_menu_tree(mi);
|
||||||
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user