Aggiustate lunghezze dei lisbox (forse) e posizioni dei radio-button

orizzontali


git-svn-id: svn://10.65.10.50/trunk@2882 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-05-21 12:48:50 +00:00
parent ecb53048ca
commit 47f30ceee4
5 changed files with 148 additions and 189 deletions

View File

@ -1,20 +1,20 @@
// Header file for PRINT SETUP mask
#define MSK_1_TYPE 101
#define MSK_1_FILENAME 102
#define MSK_1_PRINTERS 103
#define MSK_1_CODES 111
#define MSK_TYPE 101
#define MSK_FILENAME 102
#define MSK_PRINTERS 103
#define MSK_CODES 111
// IMPORTANTE! lasciare il numero 111,
// in modo che la maschera sia compatibile
// con i metodi di ba2300, usati anche
// da printer
#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_ISGRAPHICS 334
#define MSK_SIZE 335
#define MSK_LINES 336
#define MSK_NPAGES 337
#define MSK_FONT 338
#define MSK_1_PRINTERFILE prn.epf
#define MSK_1_NAMESFILE nms.epf
#define MSK_PRINTERFILE prn.epf
#define MSK_NAMESFILE nms.epf
#define PRINTERSFILE "prn.epf"
#define NAMESFILE "nms.epf"

View File

@ -1,39 +1,39 @@
#include <bagn001a.h>
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 76 13
PAGE "IMPOSTAZIONE STAMPANTE" -1 -1 76 11
RADIOBUTTON MSK_1_TYPE 1 74
RADIOBUTTON MSK_TYPE 1 74
BEGIN
PROMPT 2 1 "Stampa su..."
HELP "Selezionare il tipo dove direzionare la stampa"
ITEM "0|Stampante"
MESSAGE HIDE,MSK_1_FILENAME
MESSAGE SHOW,MSK_1_PRINTERS|ENABLE,MSK_1_PRINTERS
MESSAGE ENABLE,MSK_1_CODES
MESSAGE ENABLE,MSK_1_SIZE
MESSAGE ENABLE,MSK_1_LINES
MESSAGE ENABLE,MSK_1_FONT
MESSAGE HIDE,MSK_FILENAME
MESSAGE SHOW,MSK_PRINTERS|ENABLE,MSK_PRINTERS
MESSAGE ENABLE,MSK_CODES
MESSAGE ENABLE,MSK_SIZE
MESSAGE ENABLE,MSK_LINES
MESSAGE ENABLE,MSK_FONT
MESSAGE ENABLE,DLG_SETPRINT
ITEM "2|Visualizzazione"
MESSAGE HIDE,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,MSK_1_FONT
MESSAGE HIDE,MSK_FILENAME
MESSAGE SHOW,MSK_PRINTERS|DISABLE,MSK_PRINTERS
MESSAGE DISABLE,MSK_CODES
MESSAGE DISABLE,MSK_SIZE
MESSAGE DISABLE,MSK_LINES
MESSAGE DISABLE,MSK_FONT
MESSAGE DISABLE,DLG_SETPRINT
ITEM "1|File su disco"
MESSAGE SHOW,MSK_1_FILENAME
MESSAGE HIDE,MSK_1_PRINTERS
MESSAGE ENABLE,MSK_1_CODES
MESSAGE DISABLE,MSK_1_SIZE
MESSAGE DISABLE,MSK_1_LINES
MESSAGE DISABLE,MSK_1_FONT
MESSAGE SHOW,MSK_FILENAME
MESSAGE HIDE,MSK_PRINTERS
MESSAGE ENABLE,MSK_CODES
MESSAGE DISABLE,MSK_SIZE
MESSAGE DISABLE,MSK_LINES
MESSAGE DISABLE,MSK_FONT
MESSAGE DISABLE,DLG_SETPRINT
FLAGS "Z"
END
LIST MSK_1_PRINTERS 50
LIST MSK_PRINTERS 50
BEGIN
/* viene riempito a run-time con nomi letti da config */
PROMPT 4 5 "Stampante "
@ -41,7 +41,7 @@ BEGIN
FLAGS "G"
END
STRING MSK_1_FILENAME 52
STRING MSK_FILENAME 52
BEGIN
PROMPT 4 5 "Nome file "
CHECKTYPE REQUIRED
@ -51,28 +51,28 @@ BEGIN
WARNING "E' necessario specificare un nome di file"
END
LIST MSK_1_CODES 40
LIST MSK_CODES 40
BEGIN
PROMPT 4 6 "Tipo stampa "
HELP "Modalita' nelle quale si desidera la stampa"
FLAGS "H"
END
LIST MSK_1_FONT 2 16
LIST MSK_FONT 2 16
BEGIN
PROMPT 4 6 "Font "
HELP "Font di stampa su video o stampante"
ITEM "Courier|Courier"
END
LIST MSK_1_SIZE 3
LIST MSK_SIZE 3
BEGIN
PROMPT 31 6 "Carattere "
ITEM "12|12"
HELP "Dimensioni del carattere di stampa"
END
LIST MSK_1_LINES 3
LIST MSK_LINES 3
BEGIN
PROMPT 52 6 "Linee/Inch "
ITEM "4|4"
@ -85,26 +85,21 @@ BEGIN
HELP "Numero di linee per pollice"
END
NUMBER MSK_1_NPAGES 3
NUMBER MSK_NPAGES 3
BEGIN
PROMPT 54 8 "N.o copie "
HELP "Numero di copie da fare"
END
BOOLEAN MSK_1_ISGRAPHICS
BOOLEAN MSK_ISGRAPHICS
BEGIN
PROMPT 4 8 "Stampa elementi grafici"
HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
END
GROUPBOX DLG_NULL 73 4
BEGIN
PROMPT 2 9 ""
END
BUTTON DLG_SETPRINT 10 2
BEGIN
PROMPT -14 10 "~Imposta"
PROMPT -14 -1 "~Imposta"
HELP "Chiama l'Impostazione Stampante di Windows"
MESSAGE EXIT,DLG_SETPRINT
PICTURE 165
@ -112,7 +107,7 @@ END
BUTTON DLG_SAVEREC 10 2
BEGIN
PROMPT -24 10 "~Registra"
PROMPT -24 -1 "~Registra"
MESSAGE EXIT,K_INS
PICTURE 103
PICTURE 153
@ -120,12 +115,12 @@ END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -34 10 ""
PROMPT -34 -1 ""
END
BUTTON DLG_CANCEL 10 2
BEGIN
PROMPT -44 10 ""
PROMPT -44 -1 ""
END
ENDPAGE

View File

@ -1247,14 +1247,16 @@ TRadiobutton_control::TRadiobutton_control(WINDOW win, short cid,
const XI_CONTAINER_ORIENTATION orient = height == 1 ? XI_STACK_HORIZONTAL : XI_STACK_VERTICAL;
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
// Aggiusta rettangolo in modo da centrare i bottoni
const int extra = rct.bottom - rct.top - tot * XI_FU_MULTIPLE;
if (extra > 0)
rct.top += extra / 2;
else
if (extra < 0)
rct.bottom -= extra;
if (height > 1)
{
// Aggiusta rettangolo in modo da centrare i bottoni
const int extra = rct.bottom - rct.top - tot * XI_FU_MULTIPLE;
if (extra > 0)
rct.top += extra / 2;
else
if (extra < 0)
rct.bottom -= extra;
}
XI_OBJ_DEF* def = xi_add_container_def(NULL, cid, &rct, orient, cid);
def->app_data = (long)this;
@ -1509,9 +1511,12 @@ void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev)
ddl->close();
else if (xiev->v.xvte.type == E_CHAR)
{
KEY k = xiev->v.xvte.v.chr.ch;
const KEY k = xiev->v.xvte.v.chr.ch;
if (k == K_ENTER || k == K_ESC)
ddl->close();
else
if (k >= ' ' && k <= 'z')
ddl->select_by_initial(k);
}
break;
case XIE_CHAR_CELL: // TBI: questa e' copiata da edit
@ -1527,7 +1532,7 @@ void TDropDownList::close()
{
_open = _displayed = FALSE;
xvt_vobj_destroy(xi_get_window(_xi_lst->itf));
xvt_dwin_update (xi_get_window(_xi_obj->itf));
xvt_dwin_update (xi_get_window(_obj->itf));
}
}
@ -1536,13 +1541,26 @@ void TDropDownList::select(int i, bool force)
if (force || i != _selected)
{
_selected = i;
xi_set_text(_xi_obj, (char*)_values.get(i));
xi_set_text(_obj, (char*)_values.get(i));
if (!_in_cell)
{
TListbox_control* listbox = (TListbox_control *)xi_get_app_data(_xi_obj);
TListbox_control* listbox = (TListbox_control *)xi_get_app_data(_obj);
listbox->notify_key(K_SPACE);
}
if (is_open())
{
int r = rec2row(i);
if (r < 0)
{
xi_scroll_rec(_xi_lst, i, FOCUS_COLOR, XI_ATR_ENABLED, 0);
r = rec2row(i);
}
CHECKD(r >= 0, "Can't select listbox item ", r);
XI_OBJ cell; XI_MAKE_CELL(&cell, _xi_lst, r, 0);
xi_set_focus(&cell);
}
}
}
@ -1575,7 +1593,7 @@ void TDropDownList::select_by_ofs(int i)
}
TDropDownList::TDropDownList(XI_OBJ* o, const char* values, int width, bool cell)
: _xi_obj(o), _values(values), _open(FALSE), _xi_lst(NULL), _width(width),
: _obj(o), _values(values), _open(FALSE), _xi_lst(NULL), _width(width),
_displayed(FALSE), _in_cell(cell), _selected(0)
{}
@ -1588,13 +1606,24 @@ void TDropDownList::open()
// qui si vedra' se e cosa modificare
itfdef->v.itf->automatic_back_color = TRUE;
// compute size of field with button
RCT r; xi_get_rect(_xi_obj, &r);
RCT r; xi_get_rect(_obj, &r);
XI_RCT xr = r;
xi_pu_to_fu(_obj->itf, (PNT*)&xr, 2);
if (_width == 0) // usually in spreadsheet cells
_width = (r.right - r.left)/XI_FU_MULTIPLE;
_width = (xr.right - xr.left)/XI_FU_MULTIPLE;
if ((xr.right - xr.left) < (_width * XI_FU_MULTIPLE))
{
xr.right = xr.left + (_width * XI_FU_MULTIPLE);
r = xr;
xi_fu_to_pu(_obj->itf, (PNT*)&r, 2);
}
int hei = items() <= 1 ? 2*XI_FU_MULTIPLE + 1 : (min(6,items()) * XI_FU_MULTIPLE) + 1;
XI_OBJ_DEF* lstdef = xi_add_list_def(itfdef, _xi_obj->cid+1000, 0, 0, hei,
XI_OBJ_DEF* lstdef = xi_add_list_def(itfdef, _obj->cid+1000, 0, 0, hei,
XI_ATR_ENABLED|XI_ATR_VISIBLE, NORMAL_COLOR, NORMAL_BACK_COLOR,
DISABLED_COLOR, DISABLED_BACK_COLOR, FOCUS_COLOR, 0);
@ -1605,23 +1634,24 @@ void TDropDownList::open()
lstdef->v.list->no_vert_lines = TRUE;
lstdef->v.list->resize_with_window = TRUE;
/*
int len;
if (_in_cell)
len = items() <= 6 ? r.right - r.left - 2 : (_width-1) * XI_FU_MULTIPLE;
else
len = items() <= 6 ? _xi_obj->v.field->rct.right - _xi_obj->v.field->rct.left - 2 :
len = items() <= 6 ? _obj->v.field->rct.right - _obj->v.field->rct.left - 2 :
(_width-1) * XI_FU_MULTIPLE;
*/
int len = xr.right - xr.left - 2;
if (items() > 6) len = (_width-1) * XI_FU_MULTIPLE;
XI_OBJ_DEF* coldef = xi_add_column_def(lstdef, _xi_obj->cid+2000,
XI_OBJ_DEF* coldef = xi_add_column_def(lstdef, _obj->cid+2000,
XI_ATR_VISIBLE|XI_ATR_ENABLED|XI_ATR_READONLY,
0, len, 80, "");
coldef->v.column->column_platform = FALSE;
RCT l; xi_get_def_rect(lstdef, &l);
PNT p; p.h = r.left;
WINDOW pwin = xi_get_window(_xi_obj->itf);
WINDOW pwin = xi_get_window(_obj->itf);
RCT w; xvt_vobj_get_client_rect(pwin, &w);
// place rectangle
if (r.bottom + l.bottom - l.top <= w.bottom)
@ -1634,10 +1664,10 @@ void TDropDownList::open()
RCT wr;
wr.left = p.h; wr.top = p.v;
xi_get_def_rect(lstdef, &l);
wr.right = wr.left + (l.right - l.left) -1; // r.right;
wr.right = r.right; // wr.left + (l.right - l.left) -1;
wr.bottom = wr.top + l.bottom - l.top;
const int delta_x = _xi_obj->itf->v.itf->delta_x;
const int delta_y = _xi_obj->itf->v.itf->delta_y;
const int delta_x = _obj->itf->v.itf->delta_x;
const int delta_y = _obj->itf->v.itf->delta_y;
wr.left -= delta_x;
wr.right -= delta_x;
wr.top -= delta_y;
@ -1652,7 +1682,7 @@ void TDropDownList::open()
CHECK(itfobj != NULL, "Oggetto del cazzo!");
_xi_lst = xi_get_obj(itfobj, _xi_obj->cid+1000);
_xi_lst = xi_get_obj(itfobj, _obj->cid+1000);
CHECK(_xi_lst != NULL, "Lista del cazzo!");
@ -1661,11 +1691,16 @@ void TDropDownList::open()
xvt_scr_set_focus_vobj(win);
xvt_vobj_raise(win);
_displayed = TRUE;
/*
xi_scroll_rec(_xi_lst, _selected, NORMAL_COLOR, XI_ATR_ENABLED, 0);
const int row = rec2row(_selected);
XI_OBJ cell;
XI_MAKE_CELL(&cell, _xi_lst, row, 0);
xi_set_focus(&cell);
*/
select(_selected, TRUE);
xi_dequeue();
}

View File

@ -265,7 +265,7 @@ public:
class TDropDownList : public TObject
{
XI_OBJ* _xi_obj;
XI_OBJ* _obj;
XI_OBJ* _xi_lst;
TToken_string _values;
int _selected;

View File

@ -872,7 +872,7 @@ HIDDEN bool printer_handler (TMask_field & f, KEY key)
pn2.add (s);
j++;
}
((TList_field &) f.mask ().field (MSK_1_CODES)).replace_items (pn1, pn2);
((TList_field &) f.mask ().field (MSK_CODES)).replace_items (pn1, pn2);
}
return TRUE;
}
@ -929,7 +929,7 @@ void TPrinter::set_win_formlen(
}
}
else
warning_box ("Il driver di stampante non e' valido.\n"
warning_box ("Il driver della stampante non e' valido.\n"
"Non stampare prima di averlo reinstallato");
}
@ -978,7 +978,7 @@ HIDDEN bool set_windows_print_device (TMask_field& f, KEY key)
}
TMask& m = f.mask();
TList_field& lst = (TList_field&)m.field(MSK_1_FONT);
TList_field& lst = (TList_field&)m.field(MSK_FONT);
lst.replace_items(pn1, pn2);
lst.set(printer().fontname());
@ -1021,7 +1021,7 @@ HIDDEN bool font_handler(TMask_field& f, KEY key)
else pn1.add(printer().get_char_size());
pn2 = pn1;
}
TList_field& lst = (TList_field&)f.mask().field(MSK_1_SIZE);
TList_field& lst = (TList_field&)f.mask().field(MSK_SIZE);
lst.replace_items(pn1, pn2);
lst.set(format("%d", printer().get_char_size()));
@ -1722,97 +1722,19 @@ bool TPrinter::set()
{
main_app().disable_menu_item (M_FILE_PG_SETUP);
TMask mask("bagn001a");
TMask* msk = new TMask("bagn001a");
TMask& mask = *msk;
TToken_string pn1(50), pn2(100);
int i;
mask.set(MSK_1_FILENAME, _printerfile);
mask.set(MSK_1_NPAGES, _ncopies);
mask.set(MSK_FILENAME, _printerfile);
mask.set(MSK_NPAGES, _ncopies);
mask.enable(DLG_OK, _config == "Printer");
#if XVT_OS == XVT_OS_SCOUNIX
for (i = 0; i < _printers.items (); i++)
{
pn1.add (i);
pn2.add (((PrinterDef &) _printers[i])._printername);
}
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items (pn1, pn2);
mask.hide(MSK_1_SIZE);
mask.hide(MSK_1_LINES);
mask.disable(DLG_SETPRINT);
if (!_multiple_copies)
mask.hide(MSK_1_NPAGES);
pn1 = pn2 = "";
for (i = 0; i < ((PrinterDef &)_printers[_curprn])._names.items(); i++)
{
pn1.add(i);
pn2.add((TString &)((PrinterDef &) _printers[_curprn])._names[i]);
}
((TList_field &)(mask.field (MSK_1_CODES))).replace_items(pn1, pn2);
mask.set_handler (MSK_1_PRINTERS, printer_handler);
if (_printertype == fileprinter)
mask.set (MSK_1_TYPE, "1");
else if (_printertype == screenvis)
mask.set (MSK_1_TYPE, "2");
else
mask.set (MSK_1_TYPE, "0");
mask.set(MSK_1_PRINTERS, _curprn);
mask.show(MSK_1_CODES);
mask.set(MSK_1_CODES, _curcode);
KEY k = mask.run();
if (k == K_ESC)
return FALSE;
// get user choices
_curprn = atoi(mask.get(MSK_1_PRINTERS));
_ncopies = atoi(mask.get(MSK_1_NPAGES));
PrinterDef& def = (PrinterDef &) get_description (_curprn);
switch (atoi(mask.get (MSK_1_TYPE)))
{
case 0: // stampante
_printertype = normprinter;
_curcode = atoi (mask.get (MSK_1_CODES));
switch (atoi (def._printertype))
{
case 0:
_printertype = normprinter;
break;
case 1:
_printertype = localprinter;
break;
case 2:
_printertype = spoolprinter;
break;
}
break;
case 1: // file
_printertype = fileprinter;
_printerfile = mask.get (MSK_1_FILENAME);
_curcode = atoi (mask.get (MSK_1_CODES));
break;
case 2: // video
_printertype = screenvis;
_curcode = 0;
break;
}
#else
mask.set_handler (MSK_1_PRINTERS, set_windows_print_device);
mask.set_handler (MSK_1_FONT, font_handler);
#if XVT_OS == XVT_OS_WIN
mask.set_handler (MSK_PRINTERS, set_windows_print_device);
mask.set_handler (MSK_FONT, font_handler);
pn2 = getprinternames();
char old_default[80];
@ -1822,24 +1744,24 @@ bool TPrinter::set()
for (i = 0; i < np; i++)
pn1.add(i);
TList_field& plst = (TList_field&)mask.field (MSK_1_PRINTERS);
TList_field& plst = (TList_field&)mask.field (MSK_PRINTERS);
plst.replace_items(pn1, pn2); // Genera printer list
mask.set(MSK_1_PRINTERS, _curprn, TRUE); // Genera font list
mask.set(MSK_1_FONT, _fontname, TRUE); // Genera size list
mask.set(MSK_1_SIZE, _ch_size);
mask.set(MSK_1_LINES, _lines_per_inch);
mask.set(MSK_1_ISGRAPHICS, _isgraphics ? "X" : "");
mask.set(MSK_PRINTERS, _curprn, TRUE); // Genera font list
mask.set(MSK_FONT, _fontname, TRUE); // Genera size list
mask.set(MSK_SIZE, _ch_size);
mask.set(MSK_LINES, _lines_per_inch);
mask.set(MSK_ISGRAPHICS, _isgraphics ? "X" : "");
if (!_multiple_copies)
mask.hide(MSK_1_NPAGES);
mask.hide(MSK_NPAGES);
if (_printertype == fileprinter)
mask.set (MSK_1_TYPE, "1");
mask.set (MSK_TYPE, "1");
else if (_printertype == screenvis)
mask.set (MSK_1_TYPE, "2");
mask.set (MSK_TYPE, "2");
else
mask.set (MSK_1_TYPE, "0");
mask.set (MSK_TYPE, "0");
KEY k;
int oldprn = _curprn;
@ -1859,7 +1781,7 @@ bool TPrinter::set()
const char* name = (const char *)(_print_rcd + 4);
_curprn = pn2.get_pos(name);
CHECKS(_curprn >= 0, "Can't find printer ", name);
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
mask.set(MSK_PRINTERS, pn1.get(_curprn));
// set_win_formlen(); // Update dimensions
}
else
@ -1880,21 +1802,23 @@ bool TPrinter::set()
_curprn = oldprn;
set_printrcd();
set_win_formlen();
delete msk; msk = NULL;
return FALSE;
}
_curprn = atoi(mask.get(MSK_1_PRINTERS));
_ncopies = atoi (mask.get (MSK_1_NPAGES));
_curprn = atoi(mask.get(MSK_PRINTERS));
_ncopies = atoi (mask.get (MSK_NPAGES));
switch (atoi (mask.get (MSK_1_TYPE)))
switch (atoi (mask.get (MSK_TYPE)))
{
case 0: // stampante
_printertype = winprinter;
break;
case 1: // file
_printertype = fileprinter;
_printerfile = mask.get (MSK_1_FILENAME);
_curcode = atoi (mask.get (MSK_1_CODES));
_printerfile = mask.get (MSK_FILENAME);
_curcode = atoi (mask.get (MSK_CODES));
break;
case 2: // video
_printertype = screenvis;
@ -1902,21 +1826,26 @@ bool TPrinter::set()
break;
}
_fontname = mask.get(MSK_1_FONT);
_fontname = mask.get(MSK_FONT);
const int cs = mask.get_int(MSK_1_SIZE);
const int cs = mask.get_int(MSK_SIZE);
if (cs > 4) _ch_size = cs;
_lines_per_inch = mask.get_int (MSK_1_LINES);
_isgraphics = mask.get_bool (MSK_1_ISGRAPHICS);
_lines_per_inch = mask.get_int (MSK_LINES);
_isgraphics = mask.get_bool (MSK_ISGRAPHICS);
set_win_formlen ();
#endif
if (k == K_INS)
save_configuration();
main_app().enable_menu_item (M_FILE_PG_SETUP);
if (msk)
{
delete msk;
msk = NULL;
}
return TRUE;
}