Riaggiustata gestione stampanti, maschere e risorse

git-svn-id: svn://10.65.10.50/trunk@531 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1994-11-04 10:09:35 +00:00
parent 7deaba2654
commit 2a1f95ad3d
7 changed files with 160 additions and 123 deletions

View File

@ -8,12 +8,11 @@
// in modo che la maschera sia compatibile
// con i metodi di ba2300, usati anche
// da printer
#define MSK_1_SAVE 112
#define MSK_1_SETUP 333
#define MSK_1_ISGRAPHICS 334
#define MSK_1_SIZE 335
#define MSK_1_LINES 336
#define MSK_1_NPAGES 337
#define MSK_1_FONT 338
#define MSK_1_PRINTERFILE prn.epf
#define MSK_1_NAMESFILE nms.epf

View File

@ -1,71 +1,57 @@
#include <bagn001a.h>
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 76 10
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 76 13
RADIOBUTTON MSK_1_TYPE 16
RADIOBUTTON MSK_1_TYPE 70
BEGIN
PROMPT 1 1 "Stampa su..."
HELP "Selezionare il tipo di stampa"
ITEM "0|Stampante"
MESSAGE DISABLE,MSK_1_FILENAME|RESET,MSK_1_FILENAME
MESSAGE HIDE,MSK_1_FILENAME|RESET,MSK_1_FILENAME|SHOW,MSK_1_PRINTERS
MESSAGE ENABLE,MSK_1_PRINTERS
MESSAGE ENABLE,MSK_1_CODES
MESSAGE ENABLE,MSK_1_SIZE
ITEM "1|File"
MESSAGE ENABLE,MSK_1_FILENAME|DISABLE,MSK_1_PRINTERS
MESSAGE ENABLE,MSK_1_CODES
MESSAGE DISABLE,MSK_1_SIZE
ITEM "2|Video"
MESSAGE DISABLE,MSK_1_FILENAME|RESET,MSK_1_FILENAME
MESSAGE DISABLE,MSK_1_PRINTERS
MESSAGE ENABLE,MSK_1_LINES
MESSAGE ENABLE,DLG_SETPRINT
ITEM "2|Visualizzazione"
MESSAGE HIDE,MSK_1_FILENAME|RESET,MSK_1_FILENAME
MESSAGE SHOW,MSK_1_PRINTERS|DISABLE,MSK_1_PRINTERS
MESSAGE DISABLE,MSK_1_CODES
MESSAGE DISABLE,MSK_1_SIZE
MESSAGE DISABLE,MSK_1_LINES
MESSAGE DISABLE,DLG_SETPRINT
ITEM "1|File"
MESSAGE SHOW,MSK_1_FILENAME|HIDE,MSK_1_PRINTERS
MESSAGE ENABLE,MSK_1_CODES
MESSAGE DISABLE,MSK_1_SIZE
MESSAGE DISABLE,MSK_1_LINES
MESSAGE DISABLE,DLG_SETPRINT
FLAGS "Z"
END
LIST MSK_1_PRINTERS 40
LIST MSK_1_PRINTERS 50
BEGIN
/* viene riempito runtime con nomi letti da config */
PROMPT 21 1 "Stampante "
/* viene riempito a run-time con nomi letti da config */
PROMPT 4 5 "Stampante "
HELP "Selezionare la stampante desiderata"
END
STRING MSK_1_FILENAME 40
STRING MSK_1_FILENAME 52
BEGIN
PROMPT 21 3 "Nome file "
PROMPT 4 5 "Nome file "
HELP "Inserire qui il nome del file in caso di stampa su file"
END
LIST MSK_1_CODES 40
BEGIN
PROMPT 21 5 "Tipo stampa "
PROMPT 4 6 "Tipo stampa "
/* pure */
HELP "Selezionare la modalita' nelle quale si desidera la stampa"
END
BUTTON MSK_1_SETUP 20 1
BEGIN
PROMPT 33 5 "Imposta stampante... "
HELP "Chiama l'Impostazione Stampante di Windows"
MESSAGE EXIT,MSK_1_SETUP
END
BOOLEAN MSK_1_SAVE
BEGIN
PROMPT 1 6 "Salva la configurazione"
HELP "Salva la configurazione corrente della stampante"
END
BOOLEAN MSK_1_ISGRAPHICS
BEGIN
PROMPT 1 7 "Stampa elementi grafici"
HELP "Stampa elementi grafici (linee, box, logo) se la stampante lo consente"
END
LIST MSK_1_SIZE 3
BEGIN
PROMPT 57 5 "Carattere "
PROMPT 32 6 "Carattere "
ITEM "7|7"
ITEM "8|8"
ITEM "10|10"
@ -77,7 +63,7 @@ END
LIST MSK_1_LINES 3
BEGIN
PROMPT 57 6 "Linee/Inch "
PROMPT 52 6 "Linee/Inch "
ITEM "4|4"
ITEM "5|5"
ITEM "6|6"
@ -88,20 +74,51 @@ BEGIN
HELP "Selezionare il numero di linee per pollice"
END
LIST MSK_1_FONT 10
BEGIN
PROMPT 4 6 "Font "
ITEM "1|Courier"
FLAGS "D"
END
NUMBER MSK_1_NPAGES 3 0
BEGIN
PROMPT 57 7 "N.o copie "
PROMPT 54 8 "N.o copie "
END
BOOLEAN MSK_1_ISGRAPHICS
BEGIN
PROMPT 4 8 "Stampa elementi grafici"
HELP "Stampa elementi grafici (linee, box, logo) se la stampante lo consente"
END
GROUPBOX DLG_NULL 74 4
BEGIN
PROMPT 1 9 ""
END
BUTTON DLG_SETPRINT 9 2
BEGIN
PROMPT -14 -2 "Imposta"
HELP "Chiama l'Impostazione Stampante di Windows"
MESSAGE EXIT,DLG_SETPRINT
END
BUTTON DLG_SAVEREC 9 2
BEGIN
PROMPT -24 -2 ""
MESSAGE EXIT,K_INS
END
BUTTON DLG_OK 9 2
BEGIN
PROMPT -12 -1 ""
PROMPT -34 -2 ""
END
BUTTON DLG_CANCEL 9 2
BEGIN
PROMPT -22 -1 ""
PROMPT -44 -2 ""
END
ENDPAGE

View File

@ -564,6 +564,9 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
case DLG_PRINT:
capt = format("#%d", BMP_PRINT);
break;
case DLG_SETPRINT:
capt = format("#%d", BMP_SETPRINT);
break;
default:
break;
}

View File

@ -78,6 +78,7 @@ ACCEL MENU_FILE "f" ALT
BMP_EDIT bitmap DISCARDABLE f:\p.due\bmp\edit.bmp
BMP_LINK bitmap DISCARDABLE f:\p.due\bmp\link.bmp
BMP_PRINT bitmap DISCARDABLE f:\p.due\bmp\print.bmp
BMP_SETPRINT bitmap DISCARDABLE f:\p.due\bmp\setprint.bmp
$$$
#endif

View File

@ -27,6 +27,7 @@
#define DLG_EDIT 22 /* TAG del bottone Edit */
#define DLG_LINK 23 /* TAG del bottone Collega (applicazione) */
#define DLG_PRINT 24 /* TAG del bottone Stampa */
#define DLG_SETPRINT 25 /* TAG del bottone Imposta Stampa */
#define DLG_USER 100 /* TAG del primo controllo definito dall'utente */
/* @M

View File

@ -1,5 +1,6 @@
#include <stdlib.h>
#include <xvt.h>
#include <urldefid.h>
#if XVT_OS==XVT_OS_SCOUNIX
#include <unistd.h>
@ -622,7 +623,7 @@ bool printers_on_key (TMask_field & f, KEY key)
bool set_windows_print_device (TMask_field& f, KEY key)
{
static char szDevice[80];
if (key == K_SPACE)
if (key == K_SPACE && f.mask().is_running())
{
if (MainApp()->printer().get_printrcd() != NULL)
free_print_rcd (MainApp ()->printer().get_printrcd ());
@ -630,8 +631,8 @@ bool set_windows_print_device (TMask_field & f, KEY key)
TString pdev (pn.get (atoi (f.get())));
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
pdev << "," << szDevice;
// WriteProfileString("windows","device", pdev);
// madonna bona
// scrivi (e semmai lo si risistema poi)
WriteProfileString("windows", "device", pdev);
MainApp()->printer().set_printrcd(get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ())));
MainApp()->printer().set_win_formlen();
}
@ -1156,9 +1157,9 @@ void TPrinter::set()
}
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items (pn1, pn2);
mask.hide(MSK_1_SETUP);
mask.hide(MSK_1_SIZE);
mask.hide(MSK_1_LINES);
mask.disable(DLG_SETPRINT);
if (!_multiple_copies) mask.hide(MSK_1_NPAGES);
pn1 = "";
@ -1184,12 +1185,12 @@ void TPrinter::set()
mask.set(MSK_1_FILENAME, _printerfile);
mask.set(MSK_1_NPAGES, _ncopies);
mask.reset (MSK_1_SAVE);
KEY k;
if (mask.run () == K_ESC)
if ((k = mask.run()) == K_ESC)
return;
if (mask.get_bool(MSK_1_SAVE))
if (k == K_INS) // premuto REGISTRA
mask.save();
// get user choices
@ -1233,6 +1234,8 @@ void TPrinter::set()
#else
_get_windows_printer_names(pn2);
char old_default[80];
GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default));
for (i = 0; i < pn2.items (); i++)
pn1.add(i);
@ -1257,15 +1260,15 @@ void TPrinter::set()
mask.set (MSK_1_TYPE, "0");
mask.set_handler (MSK_1_PRINTERS, set_windows_print_device);
mask.reset (MSK_1_SAVE);
KEY k;
int oldprn = _curprn;
while ((k = mask.run ()) != K_ESC && k != K_ENTER)
while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS)
{
if (k == MSK_1_SETUP)
if (k == DLG_SETPRINT)
{
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd
if (_print_rcd != NULL)
{
if (page_setup_dlg(_print_rcd))
@ -1273,13 +1276,18 @@ void TPrinter::set()
// see if user has changed printer
// determine index of currently selected printer
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
if (_print_rcd != NULL)
free_print_rcd (_print_rcd);
_print_rcd = get_print_rcd(&_print_rcd_size);
for (i = 0; i < pn2.items(); i++)
if (strcmp((const char *)(_print_rcd + 4), pn2.get(i)) == 0)
{
_curprn = i;
break;
}
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
set_win_formlen();
}
mask.set_focus();
@ -1288,24 +1296,31 @@ void TPrinter::set()
beep ();
}
}
_curprn = atoi(mask.get(MSK_1_PRINTERS));
if (k == K_INS)
{
// tutto resta com'e'
mask.save ();
}
if (k == K_ESC || k == K_ENTER)
{
// riaggiusta stampante default windows come prima
// curprn e rcd sono quelle di prima
MainApp()->enable_menu_item(M_FILE_PG_SETUP);
WriteProfileString("windows","device", old_default);
}
if (k == K_ESC)
{
// rimetti come prima
// WriteProfileString("windows","device", pdev);
if (_print_rcd != NULL)
free_print_rcd (_print_rcd);
_curprn = oldprn;
_print_rcd = get_print_rcd(&_print_rcd_size);
set_win_formlen();
MainApp()->enable_menu_item(M_FILE_PG_SETUP);
return;
}
_curprn = atoi(mask.get(MSK_1_PRINTERS));
if (mask.get_bool(MSK_1_SAVE))
mask.save ();
_ncopies = atoi (mask.get (MSK_1_NPAGES));
switch (atoi (mask.get (MSK_1_TYPE)))

View File

@ -62,6 +62,7 @@
#define BMP_DELRECDN 154
#define BMP_NEWRECDN 155
#define BMP_QUITDN 164
#define BMP_SETPRINT 165
#endif