Patch level : 10.0 220

Files correlati     : ba0.exe
Ricompilazione Demo : [ ]
Commento            :
Corretto funzionamento del bottone di impostazione stampante nella toolbar


git-svn-id: svn://10.65.10.50/trunk@17423 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2008-10-17 07:11:40 +00:00
parent b5d542918d
commit 42f04613ed

View File

@ -4,6 +4,7 @@
#include <golem.h> #include <golem.h>
#include <printer.h> #include <printer.h>
#include <printwin.h> #include <printwin.h>
#include <toolfld.h>
#include <urldefid.h> #include <urldefid.h>
#include <utility.h> #include <utility.h>
#include <viswin.h> #include <viswin.h>
@ -69,25 +70,20 @@ void TPrinter_setup_mask::fill_font_list()
} }
TString oldfont = _font; // Memorizzo il font corrente in quanto poi cambia TString oldfont = _font; // Memorizzo il font corrente in quanto poi cambia
TList_field& lst = (TList_field&)field(MSK_FONT); TList_field& lst = lfield(MSK_FONT);
lst.replace_items(fn, fn); lst.replace_items(fn, fn);
// Controlla se il font c'e' ancora // Controlla se il font c'e' ancora
if (fn.get_pos(oldfont) < 0) if (fn.get_pos(oldfont) < 0)
oldfont = fn.get(0); oldfont = fn.get(0);
set(MSK_FONT, oldfont, 0x1); set(MSK_FONT, oldfont, 0x1);
long ph, pw;
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, _pcd, &ph, &pw, NULL, NULL);
const int priter_orientation = ph > pw ? 1 : 2;
set(MSK_ORIENTATION, ph > pw ? 1 : 2);
} }
void TPrinter_setup_mask::fill_size_list() void TPrinter_setup_mask::fill_size_list()
{ {
const int MAXSIZES = 128; const int MAXSIZES = 128;
long sizes[MAXSIZES]; long sizes[MAXSIZES];
BOOLEAN scalable; BOOLEAN scalable = FALSE;
const int num_sizes = (int)xvt_fmap_get_family_sizes(_pcd, _font.get_buffer(), sizes, &scalable, MAXSIZES); const int num_sizes = (int)xvt_fmap_get_family_sizes(_pcd, _font.get_buffer(), sizes, &scalable, MAXSIZES);
@ -108,8 +104,8 @@ void TPrinter_setup_mask::fill_size_list()
pn1.add(printer().get_char_size()); // semper better than nothing pn1.add(printer().get_char_size()); // semper better than nothing
} }
TList_field& lst = (TList_field&)field(MSK_SIZE); TList_field& lst = lfield(MSK_SIZE);
const TString8 old_size = lst.get(); const TString4 old_size = lst.get();
lst.replace_items(pn1, pn1); lst.replace_items(pn1, pn1);
lst.set(old_size); lst.set(old_size);
lst.enable(pn1.items() > 1); lst.enable(pn1.items() > 1);
@ -159,10 +155,17 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
TString256 name; TString256 name;
xvt_print_get_name(_pcd, name.get_buffer(), name.size()); xvt_print_get_name(_pcd, name.get_buffer(), name.size());
set(MSK_PRINTERS, name, 0x1); set(MSK_PRINTERS, name, 0x1);
on_field_event(lfield(MSK_ORIENTATION), fe_init, 0);
} }
} }
break; break;
case MSK_ORIENTATION: case MSK_ORIENTATION:
if (e == fe_init)
{
long ph, pw;
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, _pcd, &ph, &pw, NULL, NULL);
o.set(ph > pw ? "1" : "2");
} else
if (e == fe_modify || e == fe_close) if (e == fe_modify || e == fe_close)
{ {
long ph, pw; long ph, pw;
@ -210,7 +213,7 @@ TPrinter_setup_mask::TPrinter_setup_mask()
else else
set(MSK_TYPE, "0"); set(MSK_TYPE, "0");
TList_field& plst = (TList_field&)field (MSK_PRINTERS); TList_field& plst = lfield (MSK_PRINTERS);
plst.replace_items(pn2, pn2); // Genera printer list plst.replace_items(pn2, pn2); // Genera printer list
set(MSK_PRINTERS, pr._prname); set(MSK_PRINTERS, pr._prname);
@ -224,6 +227,9 @@ TPrinter_setup_mask::TPrinter_setup_mask()
set(MSK_ISGRAPHICS, pr.isgraphics() ? "X" : ""); set(MSK_ISGRAPHICS, pr.isgraphics() ? "X" : "");
TButton_tool& sp = (TButton_tool&)field(DLG_SETPRINT);
sp.set_exit_key(0); // Evita chiamate ricorsive all'impostazione stampante
_skip_events = false; _skip_events = false;
} }