diff --git a/include/printer.cpp b/include/printer.cpp index 7ead5e403..db75e3c5d 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -69,25 +70,20 @@ void TPrinter_setup_mask::fill_font_list() } 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); // Controlla se il font c'e' ancora if (fn.get_pos(oldfont) < 0) oldfont = fn.get(0); 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() { const int MAXSIZES = 128; 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); @@ -108,8 +104,8 @@ void TPrinter_setup_mask::fill_size_list() pn1.add(printer().get_char_size()); // semper better than nothing } - TList_field& lst = (TList_field&)field(MSK_SIZE); - const TString8 old_size = lst.get(); + TList_field& lst = lfield(MSK_SIZE); + const TString4 old_size = lst.get(); lst.replace_items(pn1, pn1); lst.set(old_size); lst.enable(pn1.items() > 1); @@ -158,11 +154,18 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon // determine name of currently selected printer TString256 name; 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; 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) { long ph, pw; @@ -210,7 +213,7 @@ TPrinter_setup_mask::TPrinter_setup_mask() else 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 set(MSK_PRINTERS, pr._prname); @@ -224,6 +227,9 @@ TPrinter_setup_mask::TPrinter_setup_mask() 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; }