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 ); clear_window( win, COLOR_BLUE );
#else #else
clear_window( win, COLOR_GRAY ); 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 #endif
return 0L; return 0L;
@ -120,7 +106,7 @@ void TApplication::wait_for(const char* command)
while (waiting_for) do_events(); while (waiting_for) do_events();
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// It seems necessary to restore these things // We need to restore these things
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
customize_controls(TRUE); customize_controls(TRUE);
xvt_statbar_refresh(); xvt_statbar_refresh();

View File

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

View File

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

View File

@ -43,17 +43,17 @@ int TExternal_app::run(bool async)
// ems swap // ems swap
setems(1); setems(1);
// *** BLinker support; uncomment as needed // *** BLinker support; uncomment as needed
// BLIUNHOOK(); // BLIUNHOOK();
// ******************* // *******************
char* s = getenv("TMPDIR"); char* s = getenv("TMPDIR");
if (s == NULL) if (s == NULL)
_exitcode = holdev("\\tmp;",0,_path); _exitcode = holdev("\\tmp;",0,_path);
else else
_exitcode = holdev(s,0,_path); _exitcode = holdev(s,0,_path);
// *** BLinker support; uncomment as needed // *** BLinker support; uncomment as needed
// BLREINIT(); // BLREINIT();
// ******************* // *******************
if (!_exitcode) if (!_exitcode)
_exitcode = childret(); _exitcode = childret();
else else
@ -63,7 +63,13 @@ int TExternal_app::run(bool async)
#elif XVT_OS == XVT_OS_WIN #elif XVT_OS == XVT_OS_WIN
set_cursor(TASK_WIN, CURSOR_WAIT); set_cursor(TASK_WIN, CURSOR_WAIT);
_exitcode = WinExec((char*)_path, SW_SHOW); _exitcode = WinExec((char*)_path, SW_SHOW);
if (_exitcode >= 32)
{
if (!async) MainApp()->wait_for(_path); if (!async) MainApp()->wait_for(_path);
_exitcode = 0;
}
else error_box("Impossibile eseguire %s", (const char*)_path);
set_cursor(TASK_WIN, CURSOR_ARROW); set_cursor(TASK_WIN, CURSOR_ARROW);
#else #else

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) void TMask::read_mask(const char* name, int mode, int num)
{ {
#ifdef DBG
clock1 = clock(); clock1 = clock();
#endif
_source_file = name; _source_file = name;
_source_file.ext(MASK_EXT); _source_file.ext(MASK_EXT);
@ -258,9 +256,7 @@ void TMask::read_mask(const char* name, int mode, int num)
add_buttons(); add_buttons();
#ifdef DBG
clock1 = clock()-clock1; clock1 = clock()-clock1;
#endif
} }
@ -434,9 +430,7 @@ bool TMask::page_enabled(int page) const
void TMask::start_run() void TMask::start_run()
{ {
#ifdef DBG
clock2 = clock(); clock2 = clock();
#endif
load_checks(); load_checks();
@ -465,9 +459,7 @@ void TMask::start_run()
} }
} }
#ifdef DBG
clock2 = clock() - clock2; clock2 = clock() - clock2;
#endif
} }
bool TMask::check_fields() bool TMask::check_fields()

View File

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

View File

@ -616,11 +616,11 @@ break;
if (ok) dispatch_e_char(parent(), k); if (ok) dispatch_e_char(parent(), k);
} }
break; break;
case K_ENTER: case K_ESC:
case K_CTRL+K_ENTER: case K_CTRL+K_ENTER:
{ {
const bool ok = (bool)xi_move_focus(_itf); 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; break;

View File

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

View File

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

View File

@ -1,36 +1,36 @@
BUTTON DLG_SAVEREC 8 2 BUTTON DLG_SAVEREC 8 2
BEGIN BEGIN
PROMPT -16 -1 "~Registra" PROMPT -16 -1 "~Registra"
MESSAGE EXIT,K_SAVE MESSAGE EXIT,K_SAVE
END END
BUTTON DLG_NEWREC 8 2 BUTTON DLG_NEWREC 8 2
BEGIN BEGIN
PROMPT -26 -1 "~Nuovo" PROMPT -26 -1 "~Nuovo"
MESSAGE EXIT,K_INS MESSAGE EXIT,K_INS
END END
BUTTON DLG_DELREC 8 2 BUTTON DLG_DELREC 8 2
BEGIN BEGIN
PROMPT -36 -1 "~Elimina" PROMPT -36 -1 "~Elimina"
MESSAGE EXIT,K_DEL MESSAGE EXIT,K_DEL
END END
BUTTON DLG_FINDREC 8 2 BUTTON DLG_FINDREC 8 2
BEGIN BEGIN
PROMPT -46 -1 "Ri~cerca" PROMPT -46 -1 "Ri~cerca"
MESSAGE EXIT,K_F9 MESSAGE EXIT,K_F9
END END
BUTTON DLG_CANCEL 8 2 BUTTON DLG_CANCEL 8 2
BEGIN BEGIN
PROMPT -56 -1 "" PROMPT -56 -1 ""
MESSAGE EXIT,K_ESC MESSAGE EXIT,K_ESC
END END
BUTTON DLG_QUIT 8 2 BUTTON DLG_QUIT 8 2
BEGIN BEGIN
PROMPT -66 -1 "" PROMPT -66 -1 ""
MESSAGE EXIT,K_QUIT MESSAGE EXIT,K_QUIT
END 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 (get_window_type(parent) == W_PLAIN) // Mask with Toolbar
{ {
if (y >= 0) y++; 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); const int width = (int)get_value(NULL_WIN, ATTR_SCREEN_WIDTH);
if (width > 640) x += (width-640) / (2*COLX); 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()); CHECKD(win, "Can't create a window: XVT error ", get_xvterrno());
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
static bool set = TRUE; static bool to_set = TRUE;
if (set) if (to_set)
{ {
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW); HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
word style = GetClassWord(hwnd, GCW_STYLE); word style = GetClassWord(hwnd, GCW_STYLE);
style |= CS_BYTEALIGNCLIENT | CS_SAVEBITS; style |= CS_BYTEALIGNCLIENT | CS_SAVEBITS;
SetClassWord(hwnd, GCW_STYLE, style); SetClassWord(hwnd, GCW_STYLE, style);
set = FALSE; to_set = FALSE;
} }
#endif #endif