CCorretta gestione numero copie

git-svn-id: svn://10.65.10.50/trunk@242 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-09-14 16:47:19 +00:00
parent 7696ebc104
commit c1e97ca1f9
12 changed files with 823 additions and 828 deletions

View File

@ -33,20 +33,6 @@ HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
clear_window( win, COLOR_BLUE );
#else
clear_window( win, COLOR_GRAY );
/*
const RCT& rct = ep->v.update.rct;
bool even = FALSE;
for (int y = 0; y < rct.bottom; y += 96)
{
const int sx = even ? 96 : 0;
for (int x = sx; x < rct.right; x += 192)
if (
(y+64) > rct.top && y < rct.bottom &&
(x+64) > rct.left && x < rct.right
) win_draw_icon(win, x, y, ICON_RSRC);
even = !even;
}
*/
#endif
return 0L;
@ -57,7 +43,7 @@ HIDDEN void create_backdrop( void )
#if XVTWS == WMWS
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_CONTROL, COLOR_BLACK, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DISABLED, COLOR_GRAY, COLOR_WHITE);
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MNEMONIC, COLOR_RED, COLOR_WHITE);
@ -120,7 +106,7 @@ void TApplication::wait_for(const char* command)
while (waiting_for) do_events();
///////////////////////////////////////////////////////////
// It seems necessary to restore these things
// We need to restore these things
///////////////////////////////////////////////////////////
customize_controls(TRUE);
xvt_statbar_refresh();

View File

@ -54,6 +54,7 @@ public:
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
virtual bool destroy(); // Rimuove l'applicazione
virtual void print();
virtual word class_id() const { return CLASS_APPLICATION; }
void stop_run(); // Forza chiusura applicazione
void check_menu_item(MENU_TAG item); // Check menu

View File

@ -15,6 +15,9 @@
#define CLASS_FILENAME 12
#define CLASS_TOKEN_STRING 13
#define CLASS_APPLICATION 40
#define CLASS_PRINT_APPLICATION 41
#define CLASS_PRINTROW 50
#define CLASS_PRINTER 51

View File

@ -43,17 +43,17 @@ int TExternal_app::run(bool async)
// ems swap
setems(1);
// *** BLinker support; uncomment as needed
// BLIUNHOOK();
// *******************
// *** BLinker support; uncomment as needed
// BLIUNHOOK();
// *******************
char* s = getenv("TMPDIR");
if (s == NULL)
_exitcode = holdev("\\tmp;",0,_path);
else
_exitcode = holdev(s,0,_path);
// *** BLinker support; uncomment as needed
// BLREINIT();
// *******************
// *** BLinker support; uncomment as needed
// BLREINIT();
// *******************
if (!_exitcode)
_exitcode = childret();
else
@ -61,44 +61,50 @@ int TExternal_app::run(bool async)
xvt_escape(XVT_ESC_CH_REFRESH);
#elif XVT_OS == XVT_OS_WIN
set_cursor(TASK_WIN, CURSOR_WAIT);
set_cursor(TASK_WIN, CURSOR_WAIT);
_exitcode = WinExec((char*)_path, SW_SHOW);
if (!async) MainApp()->wait_for(_path);
set_cursor(TASK_WIN, CURSOR_ARROW);
if (_exitcode >= 32)
{
if (!async) MainApp()->wait_for(_path);
_exitcode = 0;
}
else error_box("Impossibile eseguire %s", (const char*)_path);
set_cursor(TASK_WIN, CURSOR_ARROW);
#else
switch (fork())
{
case -1:
_error = errno;
_exitcode = -1;
break;
case 0:
const char* s = strdup(_path);
char* p = strchr(s, ' ');
if (p) *p = '\0';
const char* pathn = strdup(s);
const char* args[21];
int i = 0;
args[i++] = pathn;
while ((i < 20) && (p))
{
case -1:
_error = errno;
_exitcode = -1;
break;
case 0:
const char* s = strdup(_path);
char* p = strchr(s, ' ');
if (p) *p = '\0';
const char* pathn = strdup(s);
const char* args[21];
int i = 0;
args[i++] = pathn;
while ((i < 20) && (p))
{
s = p + 1;
p = strchr(s, ' ');
if (p) *p = '\0';
args[i++] = strdup(s);
}
args[i] = NULL;
for (i = 3; i < _NFILE; i++) fcntl(i,F_SETFD,1);
// execvp(_path, NULL);
execvp ( pathn , args );
exit ( -1 );
default:
if(wait(&_exitcode) == -1)
_exitcode = -1;
else _exitcode = _exitcode >> 8;
break;
s = p + 1;
p = strchr(s, ' ');
if (p) *p = '\0';
args[i++] = strdup(s);
}
args[i] = NULL;
for (i = 3; i < _NFILE; i++) fcntl(i,F_SETFD,1);
// execvp(_path, NULL);
execvp ( pathn , args );
exit ( -1 );
default:
if(wait(&_exitcode) == -1)
_exitcode = -1;
else _exitcode = _exitcode >> 8;
break;
}
_error = errno;
xvt_escape(XVT_ESC_CH_REFRESH);
@ -110,7 +116,7 @@ int TExternal_app::run(bool async)
// update counts
if (_exitcode == 0)
_count++;
return _exitcode;
return _exitcode;
}
TExternal_app::TExternal_app(const char* p)

View File

@ -218,9 +218,7 @@ TMask::TMask(const char* title, int pages, int cols, int rows, int xpos,
void TMask::read_mask(const char* name, int mode, int num)
{
#ifdef DBG
clock1 = clock();
#endif
_source_file = name;
_source_file.ext(MASK_EXT);
@ -258,9 +256,7 @@ void TMask::read_mask(const char* name, int mode, int num)
add_buttons();
#ifdef DBG
clock1 = clock()-clock1;
#endif
}
@ -434,9 +430,7 @@ bool TMask::page_enabled(int page) const
void TMask::start_run()
{
#ifdef DBG
clock2 = clock();
#endif
load_checks();
@ -465,9 +459,7 @@ void TMask::start_run()
}
}
#ifdef DBG
clock2 = clock() - clock2;
#endif
}
bool TMask::check_fields()

View File

@ -25,6 +25,6 @@
#define MOV_OCFPI "OCFPI"
#define MOV_CORRLIRE "CORRLIRE"
#define MOV_CORRVALUTA "CORRVALUTA"
#define MOV_DATACOMP "DATACOMP"
#endif

View File

@ -616,11 +616,11 @@ break;
if (ok) dispatch_e_char(parent(), k);
}
break;
case K_ENTER:
case K_ESC:
case K_CTRL+K_ENTER:
{
const bool ok = (bool)xi_move_focus(_itf);
if (ok) dispatch_e_char(parent(), k == K_ENTER ? K_TAB : K_BTAB);
dispatch_e_char(parent(), k == K_ESC ? K_ESC : K_TAB);
}
break;

View File

@ -14,10 +14,6 @@
#include <relation.h>
#endif
#ifndef __STRINGS_H
#include <strings.h>
#endif
// compatibility
#define TPrintapp TPrint_application
@ -395,6 +391,8 @@ public:
// di solito basta e avanza quella di default
virtual bool menu(MENU_TAG m);
virtual word class_id() const { return CLASS_PRINT_APPLICATION; }
// print menu is enabled when set_print returns TRUE
void enable_print_menu();
void disable_print_menu();

View File

@ -39,8 +39,7 @@ PrintWhat;
#include <windows.h>
void TPrinter ::
_get_windows_printer_names (TToken_string & t)
void TPrinter::_get_windows_printer_names (TToken_string & t)
{
char *buf = new char[4096]; // ammazzao'
@ -57,8 +56,7 @@ _get_windows_printer_names (TToken_string & t)
delete buf;
}
BOOLEAN TPrinter ::
start_winprint (long data)
BOOLEAN TPrinter::start_winprint (long data)
{
PrDesc *pd = (PrDesc *) data;
TTextfile & txt = *(pd->_txt);
@ -70,8 +68,7 @@ start_winprint (long data)
#endif
// utils del caz
HIDDEN void
read_int (const char *s, int &n, int &cnt)
HIDDEN void read_int (const char *s, int &n, int &cnt)
{
static char nbuf[10];
int j = 0;
@ -84,8 +81,7 @@ read_int (const char *s, int &n, int &cnt)
}
#if XVT_OS == XVT_OS_WIN
void TPrinter ::
set_win_formlen ()
void TPrinter::set_win_formlen ()
{
long pw, ph, phr, pvr;
xvt_escape (XVT_ESC_GET_PRINTER_INFO, _print_rcd, &ph, &pw, &pvr, &phr);
@ -98,13 +94,12 @@ set_win_formlen ()
}
else
warning_box ("Il driver di stampante non e' valido. Non stampare prima di averlo"
" reinstallato");
warning_box ("Il driver di stampante non e' valido.\n"
"Non stampare prima di averlo reinstallato");
}
#endif
void TPrinter ::
_parse_background ()
void TPrinter::_parse_background ()
{
char op;
int x1, x2, y1, y2;
@ -285,8 +280,7 @@ _parse_background ()
}
}
void TPrinter ::
setbackground (const char *b)
void TPrinter::setbackground (const char *b)
{
_background.destroy ();
_bg_desc = b;
@ -609,7 +603,7 @@ bool printers_on_key (TMask_field & f, KEY key)
{
TToken_string pn1 (10), pn2 (20);
const PrinterDef & def = MainApp ()->printer ().get_description (atoi (f.get ()));
const PrinterDef & def = MainApp()->printer().get_description(atoi(f.get ()));
const char *s;
int j = 0;
while ((s = def.get_codenames (j)) != NULL)
@ -630,24 +624,25 @@ bool set_windows_print_device (TMask_field & f, KEY key)
static char szDevice[80];
if (key == K_SPACE)
{
if (MainApp ()->printer ().get_printrcd () != NULL)
free_print_rcd (MainApp ()->printer ().get_printrcd ());
TToken_string & pn = MainApp ()->printer ().getprinternames ();
if (MainApp()->printer().get_printrcd() != NULL)
free_print_rcd (MainApp ()->printer().get_printrcd ());
TToken_string & pn = MainApp()->printer().getprinternames ();
TString pdev (pn.get (atoi (f.get ())));
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
pdev << "," << szDevice;
// WriteProfileString("windows","device", pdev);
// madonna bona
MainApp ()->printer ().set_printrcd (get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ())));
MainApp ()->printer ().set_win_formlen ();
MainApp()->printer().set_printrcd(get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ())));
MainApp()->printer().set_win_formlen();
}
return TRUE;
}
#endif
TPrinter :: TPrinter ():_date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12)
TPrinter::TPrinter()
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12)
{
_footerhandler = _headerhandler = NULL;
@ -1140,7 +1135,7 @@ void TPrinter::set()
TToken_string pn1 (50), pn2 (100);
int i;
MainApp ()->disable_menu_item (M_FILE_PG_SETUP);
MainApp()->disable_menu_item (M_FILE_PG_SETUP);
#if XVT_OS != XVT_OS_WIN
@ -1176,7 +1171,12 @@ void TPrinter::set()
mask.set (MSK_1_PRINTERS, format ("%d", _curprn));
mask.set (MSK_1_CODES, format ("%d", _curcode));
mask.set (MSK_1_FILENAME, _printerfile);
mask.set (MSK_1_NPAGES, format("%d",((TPrint_application*)MainApp())->get_n_copies()));
int nc = 1;
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
nc = ((TPrint_application*)MainApp())->get_n_copies();
mask.set(MSK_1_NPAGES, nc);
mask.reset (MSK_1_SAVE);
if (mask.run () == K_ESC)
@ -1196,7 +1196,9 @@ void TPrinter::set()
_curprn = atoi(mask.get(MSK_1_PRINTERS));
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
((TPrint_application*)MainApp())->set_n_copies(atoi(mask.get(MSK_1_NPAGES)));
PrinterDef& def = (PrinterDef &) get_description (_curprn);
switch (atoi(mask.get (MSK_1_TYPE)))
{
@ -1237,13 +1239,17 @@ void TPrinter::set()
for (i = 0; i < pn2.items (); i++)
pn1.add(i);
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items (pn1, pn2);
mask.set (MSK_1_PRINTERS, pn1.get (_curprn));
mask.hide (MSK_1_CODES);
mask.set (MSK_1_ISGRAPHICS, _isgraphics ? "X" : "");
mask.set (MSK_1_SIZE, format ("%d", _ch_size));
mask.set (MSK_1_LINES, format ("%d", _lines_per_inch));
mask.set (MSK_1_NPAGES, format("%d",((TPrint_application*)MainApp())->get_n_copies()));
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
mask.hide(MSK_1_CODES);
mask.set(MSK_1_ISGRAPHICS, _isgraphics ? "X" : "");
mask.set(MSK_1_SIZE, _ch_size);
mask.set(MSK_1_LINES, _lines_per_inch);
int nc = 1;
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
nc = ((TPrint_application*)MainApp())->get_n_copies();
mask.set(MSK_1_NPAGES, nc);
if (_printertype == fileprinter)
mask.set (MSK_1_TYPE, "1");
@ -1293,7 +1299,7 @@ void TPrinter::set()
_curprn = oldprn;
_print_rcd = get_print_rcd(&_print_rcd_size);
set_win_formlen ();
MainApp ()->enable_menu_item (M_FILE_PG_SETUP);
MainApp()->enable_menu_item(M_FILE_PG_SETUP);
return;
}
@ -1305,7 +1311,10 @@ void TPrinter::set()
mask.set_workfile (s);
mask.save ();
}
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
if (MainApp()->class_id() == CLASS_PRINT_APPLICATION)
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
switch (atoi (mask.get (MSK_1_TYPE)))
{
case 0: // stampante

View File

@ -100,7 +100,7 @@ class PrinterDef : public TObject
TArray _codes; // print codes
TArray _names; // name of print codes
TString _ffcode; // formfeed code for the current printer
TString _nlcode; // special newline code for the current printer
TString _nlcode; // special newline code for the current printer
public:
bool read(const char* name, FILE* fd); // read description from file;
@ -157,7 +157,7 @@ class TPrinter : public TObject
const char* _bg_desc;
TToken_string _printer_names;
bool _isgraphics;
bool _frozen;
bool _frozen;
#if XVT_OS == XVT_OS_WIN
PRINT_RCD* _print_rcd;
int _print_rcd_size;
@ -168,7 +168,7 @@ class TPrinter : public TObject
int _dots_per_line;
void _parse_background();
void _get_windows_printer_names(TToken_string& t);
void _get_windows_printer_names(TToken_string& t);
PRINTSECTIONHANDLER _headerhandler, _footerhandler;
LINKHANDLER _linkhandler;
@ -227,11 +227,11 @@ public:
void resetfooter();
void setbackground(const char* bg);
TArray* getbgdesc() { return &_background; }
bool frozen() { return _frozen; }
void freeze(bool b = TRUE) { _frozen = b; }
bool frozen() { return _frozen; }
void freeze(bool b = TRUE) { _frozen = b; }
TToken_string& getprinternames();
TTextfile& get_txt() { return _txt; }
TToken_string& getprinternames();
TTextfile& get_txt() { return _txt; }
void setheaderhandler(PRINTSECTIONHANDLER h) { _headerhandler = h; }
void setfooterhandler(PRINTSECTIONHANDLER h) { _footerhandler = h; }
@ -241,7 +241,7 @@ public:
// completamente anche da un'altra application
void setlinkhandler(LINKHANDLER h) { _linkhandler = h; }
LINKHANDLER getlinkhandler() { return _linkhandler; }
TArray& links() { return _linksdescr; }
TArray& links() { return _linksdescr; }
void setmultiplelink(bool on) { _multiple_link = on; }
bool ismultiplelink() { return _multiple_link; }

View File

@ -1,36 +1,36 @@
BUTTON DLG_SAVEREC 8 2
BEGIN
PROMPT -16 -1 "~Registra"
MESSAGE EXIT,K_SAVE
PROMPT -16 -1 "~Registra"
MESSAGE EXIT,K_SAVE
END
BUTTON DLG_NEWREC 8 2
BEGIN
PROMPT -26 -1 "~Nuovo"
MESSAGE EXIT,K_INS
PROMPT -26 -1 "~Nuovo"
MESSAGE EXIT,K_INS
END
BUTTON DLG_DELREC 8 2
BEGIN
PROMPT -36 -1 "~Elimina"
MESSAGE EXIT,K_DEL
PROMPT -36 -1 "~Elimina"
MESSAGE EXIT,K_DEL
END
BUTTON DLG_FINDREC 8 2
BEGIN
PROMPT -46 -1 "Ri~cerca"
MESSAGE EXIT,K_F9
PROMPT -46 -1 "Ri~cerca"
MESSAGE EXIT,K_F9
END
BUTTON DLG_CANCEL 8 2
BEGIN
PROMPT -56 -1 ""
MESSAGE EXIT,K_ESC
PROMPT -56 -1 ""
MESSAGE EXIT,K_ESC
END
BUTTON DLG_QUIT 8 2
BEGIN
PROMPT -66 -1 ""
MESSAGE EXIT,K_QUIT
PROMPT -66 -1 ""
MESSAGE EXIT,K_QUIT
END

View File

@ -211,7 +211,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
if (get_window_type(parent) == W_PLAIN) // Mask with Toolbar
{
if (y >= 0) y++;
if (x >= 0 && wt != WO_TE)
if (x > 0 || (wt != WO_TE && x == 0))
{
const int width = (int)get_value(NULL_WIN, ATTR_SCREEN_WIDTH);
if (width > 640) x += (width-640) / (2*COLX);
@ -526,14 +526,14 @@ WINDOW xvt_create_window(WIN_TYPE wt,
CHECKD(win, "Can't create a window: XVT error ", get_xvterrno());
#if XVT_OS == XVT_OS_WIN
static bool set = TRUE;
if (set)
static bool to_set = TRUE;
if (to_set)
{
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
word style = GetClassWord(hwnd, GCW_STYLE);
style |= CS_BYTEALIGNCLIENT | CS_SAVEBITS;
SetClassWord(hwnd, GCW_STYLE, style);
set = FALSE;
to_set = FALSE;
}
#endif