Patch level : 10.0 gamma
Files correlati : *.* Ricompilazione Demo : [ ] Commento : Gestione campo su terminalini git-svn-id: svn://10.65.10.50/trunk@19687 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
298680e51d
commit
6fc2a216b4
@ -71,8 +71,10 @@ HIDDEN void paint_background(WINDOW win)
|
||||
|
||||
xvtil_set_font(win, NULL, XVT_FS_NONE);
|
||||
xvt_dwin_set_fore_color(win, NORMAL_COLOR);
|
||||
TString spa;
|
||||
spa << dongle().product() << " - " << dongle().reseller();
|
||||
|
||||
TString spa; spa << dongle().product();
|
||||
if (!xvt_sys_is_pda())
|
||||
spa << " - " << dongle().reseller();
|
||||
w = xvt_dwin_get_text_width(win, spa, -1);
|
||||
x = (r.right-r.left-w)/2; y = r.bottom-CHARY;
|
||||
xvt_dwin_draw_text(win, x, y, spa, -1);
|
||||
|
@ -49,8 +49,6 @@ bool ENTER_AS_TAB = false;
|
||||
|
||||
HIDDEN bool _ddl_shown = false;
|
||||
HIDDEN int _last_mouse_button = 0;
|
||||
HIDDEN int X_FU_MULTIPLE = 0;
|
||||
HIDDEN int Y_FU_MULTIPLE = 0;
|
||||
HIDDEN const int ITF_CID = 30000;
|
||||
|
||||
short low_get_focus_id(WINDOW win)
|
||||
@ -203,10 +201,11 @@ XVT_FNTID xvtil_default_font(bool bold, bool big)
|
||||
DEF_FONT = xvt_dwin_get_font(TASK_WIN);
|
||||
|
||||
TConfig font(CONFIG_GUI, "Colors");
|
||||
TString font_ser_desc = font.get("FontDesc"); // Modernamente e' nel paragrafo Colors
|
||||
TString font_ser_desc = font.get("FontDesc"); // Modernamente e' nel paragrafo Colors
|
||||
int interline = font.get_int("InterLine", NULL, -1, -1);
|
||||
|
||||
if (font_ser_desc.empty())
|
||||
font_ser_desc = font.get("FontDesc", "Font"); // Anticamente era nel paragrafo Font
|
||||
font_ser_desc = font.get("FontDesc", "Font"); // Anticamente era nel paragrafo Font
|
||||
|
||||
if (font_ser_desc.empty())
|
||||
{
|
||||
@ -220,6 +219,35 @@ XVT_FNTID xvtil_default_font(bool bold, bool big)
|
||||
CHECK(xvt_font_is_mapped(DEF_FONT), "Can't map native font");
|
||||
|
||||
xvt_dwin_set_font(TASK_WIN, DEF_FONT);
|
||||
|
||||
xi_set_font_id(DEF_FONT);
|
||||
xi_init_sysvals(); // Ricalcola i FU units
|
||||
|
||||
CHARX = xi_get_fu_width(NULL);
|
||||
CHARY = xi_get_fu_height(NULL);
|
||||
|
||||
// Compute suitable text size
|
||||
if (xvt_sys_is_pda()) // Schermo piccolo da terminalino
|
||||
{
|
||||
ROWY = CHARY;
|
||||
}
|
||||
else
|
||||
{
|
||||
//calcolo interlinea se non specificata dall'utente
|
||||
if (interline < 0) //interlinea automatica
|
||||
{
|
||||
const PNT pnt = xvtil_taskwin_size();
|
||||
ROWY = max(CHARY, pnt.v/MAX_MASK_ROWS);
|
||||
}
|
||||
else
|
||||
ROWY = CHARY + interline;
|
||||
}
|
||||
XI_PNT fu = { ROWY, CHARX };
|
||||
xi_pu_to_fu(NULL, &fu, 1);
|
||||
xi_fu_to_pu(NULL, &fu, 1);
|
||||
CHARX = fu.h;
|
||||
ROWY = fu.v;
|
||||
|
||||
xvt_menu_set_font_sel(TASK_WIN, DEF_FONT);
|
||||
|
||||
FAT_FONT = xvt_font_create();
|
||||
@ -239,18 +267,6 @@ XVT_FNTID xvtil_default_font(bool bold, bool big)
|
||||
xvt_font_set_size(BIGFAT_FONT, xvt_font_get_size(FAT_FONT) * 2);
|
||||
xvt_font_map_using_default(BIGFAT_FONT);
|
||||
CHECK(xvt_font_is_mapped(BIGFAT_FONT), "Can't map native font");
|
||||
|
||||
int leading, ascent, descent;
|
||||
xvt_dwin_get_font_metrics(TASK_WIN, &leading, &ascent, &descent);
|
||||
CHARY = ascent + descent + 1;
|
||||
BASEY = ascent;
|
||||
|
||||
// Compute suitable text size
|
||||
const PNT pnt = xvtil_taskwin_size();
|
||||
ROWY = pnt.v / min(23, pnt.v / CHARY);
|
||||
|
||||
TString str(80, 'M');
|
||||
CHARX = xvt_dwin_get_text_width(TASK_WIN, str, str.size()) / str.size();
|
||||
}
|
||||
|
||||
XVT_FNTID f = NULL;
|
||||
@ -284,11 +300,7 @@ XVT_FNTID xvtil_load_default_font()
|
||||
BIGFAT_FONT = NULL;
|
||||
}
|
||||
|
||||
X_FU_MULTIPLE = Y_FU_MULTIPLE = 0;
|
||||
XVT_FNTID font = xvtil_default_font();
|
||||
xi_set_font_id(font);
|
||||
xi_init_sysvals(); // Ricalcola i FU units
|
||||
|
||||
statbar_set_fontid(TASK_WIN, font);
|
||||
|
||||
return font;
|
||||
@ -306,8 +318,7 @@ HIDDEN XI_BITMAP* get_background_bitmap(bool reload)
|
||||
bmp = NULL;
|
||||
if (ADVANCED_GRAPHICS && !NATIVE_CONTROLS)
|
||||
{
|
||||
TConfig ini(CONFIG_GUI, "Colors");
|
||||
TFilename back = ini.get("Tile");
|
||||
TFilename back = ini_get_string(CONFIG_GUI, "Colors", "Tile");
|
||||
if (back.custom_path())
|
||||
bmp = xi_bitmap_create(back.get_buffer(), XI_BITMAP_TILE);
|
||||
}
|
||||
@ -483,15 +494,6 @@ bool has_virtual_keyboard()
|
||||
|
||||
HIDDEN void xi_event_handler(XI_OBJ *itf, XI_EVENT *xiev);
|
||||
|
||||
HIDDEN void init_fu_multiple(XI_OBJ* itf)
|
||||
{
|
||||
const PNT p = xvtil_taskwin_size();
|
||||
XinPoint pnt = { p.v, p.h };
|
||||
xi_pu_to_fu(itf, &pnt, 1);
|
||||
X_FU_MULTIPLE = CHARX;
|
||||
Y_FU_MULTIPLE = pnt.v / min(pnt.v/CHARY, 23);
|
||||
}
|
||||
|
||||
WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
const char* caption, TWindow* msk)
|
||||
{
|
||||
@ -500,8 +502,8 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
|
||||
short left = x * CHARX;
|
||||
short top = y * ROWY;
|
||||
short width = dx * CHARX;
|
||||
short height = dy * ROWY;
|
||||
short width = dx * CHARX + (dx > 0 ? CHARX : 0);
|
||||
short height = dy * ROWY + (dy > 0 ? ROWY : 0);
|
||||
|
||||
if (x <= 0 || y <= 0 || dx <= 0 || dy <= 0)
|
||||
{
|
||||
@ -513,7 +515,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
{
|
||||
height = -top;
|
||||
top += max_rct.bottom;
|
||||
y = (max_rct.bottom-height)/ROWY; // 22 - height/ROWY;
|
||||
y = (max_rct.bottom-height)/ROWY; // MAX_MASK_ROWS - height/ROWY;
|
||||
}
|
||||
else
|
||||
height = max_rct.bottom - top + dy * ROWY;
|
||||
@ -539,7 +541,8 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
CHECK(win, "Can't create an XVT window for an interface");
|
||||
xvtil_set_font(win, NULL, 0, 0);
|
||||
|
||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XI_RCT*) &r, (char*)caption, (long)msk);
|
||||
XI_RCT xrct; xrct = (XI_RCT&)r; xi_pu_to_fu(NULL, (XI_PNT*)&xrct, 2);
|
||||
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, &xrct, (char*)caption, (long)msk);
|
||||
CHECK(def, "Can't define an interface");
|
||||
|
||||
def->v.itf->automatic_back_color = false;
|
||||
@ -563,16 +566,13 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
xi_dequeue();
|
||||
xi_tree_free(def);
|
||||
|
||||
if (Y_FU_MULTIPLE <= 0)
|
||||
init_fu_multiple(itf);
|
||||
|
||||
if (dx > 0)
|
||||
if (dx > 0 && dy > 0)
|
||||
{
|
||||
xi_pu_to_fu(itf, (XinPoint *) &r, 2);
|
||||
xi_pu_to_fu(itf, (XI_PNT*)&r, 2);
|
||||
r.right = r.left + (dx+1) * XI_FU_MULTIPLE;
|
||||
r.bottom = r.top + (dy+1) * Y_FU_MULTIPLE;
|
||||
xi_fu_to_pu(itf, (XinPoint *) &r, 2);
|
||||
xvt_vobj_move(win, &r);
|
||||
r.bottom = r.top + (dy+1) * XI_FU_MULTIPLE;
|
||||
xi_fu_to_pu(itf, (XI_PNT*)&r, 2);
|
||||
xvt_vobj_move(win, &r); // Forza dimensioni corrette client area
|
||||
}
|
||||
return win;
|
||||
}
|
||||
@ -874,29 +874,24 @@ void TControl::update_tab_cid()
|
||||
}
|
||||
}
|
||||
|
||||
void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT & rct) const
|
||||
XI_RCT TControl::coord2rct(XI_OBJ* itf, short x, short y, short dx, short dy) const
|
||||
{
|
||||
// Spazio da lasciare prima di toccare i bordi
|
||||
const int X_FU_DELTA = XI_FU_MULTIPLE / 4;
|
||||
const int Y_FU_DELTA = XI_FU_MULTIPLE / 8;
|
||||
const int X_DELTA = CHARX / 4;
|
||||
const int Y_DELTA = CHARY / 8;
|
||||
XI_RCT rct;
|
||||
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
|
||||
if (Y_FU_MULTIPLE <= 0) // Puo' succedere che non sia ancora inizializzato
|
||||
init_fu_multiple(itf);
|
||||
RCT max_rct; xvt_vobj_get_client_rect((WINDOW)xi_get_window(itf), &max_rct);
|
||||
const short MAXX = max_rct.right;
|
||||
const short MAXY = max_rct.bottom;
|
||||
|
||||
RCT max_rct; xvt_vobj_get_client_rect(win, &max_rct);
|
||||
xi_pu_to_fu(itf, (XinPoint *)&max_rct, 2);
|
||||
const int MAXX = max_rct.right;
|
||||
const int MAXY = max_rct.bottom;
|
||||
|
||||
int width = XI_FU_MULTIPLE;
|
||||
int width = CHARX;
|
||||
if (dx > 0)
|
||||
width = dx * XI_FU_MULTIPLE;
|
||||
width = dx * CHARX;
|
||||
|
||||
int height = XI_FU_MULTIPLE;
|
||||
int height = CHARY + (ROWY-CHARY+1)/2;
|
||||
if (dy > 1)
|
||||
height += (dy-1) * Y_FU_MULTIPLE;
|
||||
height += (dy-1) * ROWY;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
@ -909,14 +904,14 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT &
|
||||
rct.left = spc + num * (spc+width);
|
||||
}
|
||||
else
|
||||
rct.left = MAXX - width - x * XI_FU_MULTIPLE;
|
||||
rct.left = MAXX - width - x * CHARX - X_DELTA;
|
||||
}
|
||||
else
|
||||
{
|
||||
rct.left = x * XI_FU_MULTIPLE + X_FU_DELTA;
|
||||
rct.left = x * CHARX + X_DELTA;
|
||||
|
||||
if (dx > 0 && MAXX > 80 * XI_FU_MULTIPLE)
|
||||
rct.left += (MAXX - 80 * XI_FU_MULTIPLE) / 2;
|
||||
if (dx > 0 && MAXX > 80 * CHARX)
|
||||
rct.left += (MAXX - 80 * CHARX) / 2;
|
||||
}
|
||||
|
||||
if (y < 0)
|
||||
@ -930,20 +925,23 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT &
|
||||
rct.top = spc + num * (spc+height);
|
||||
}
|
||||
else
|
||||
rct.top = MAXY - height - (y-1) * Y_FU_MULTIPLE - Y_FU_DELTA;
|
||||
rct.top = MAXY - height - (y-1) * ROWY - Y_DELTA;
|
||||
}
|
||||
else
|
||||
rct.top = y * Y_FU_MULTIPLE + Y_FU_DELTA;
|
||||
rct.top = y * ROWY + Y_DELTA;
|
||||
|
||||
if (dx > 0)
|
||||
rct.right = rct.left + width;
|
||||
else
|
||||
rct.right = MAXX + (dx-1) * XI_FU_MULTIPLE - X_FU_DELTA;
|
||||
rct.right = MAXX + (dx-1) * CHARX - X_DELTA;
|
||||
|
||||
if (dy > 0)
|
||||
rct.bottom = rct.top + height;
|
||||
else
|
||||
rct.bottom = MAXY + dy * Y_FU_MULTIPLE - X_FU_DELTA;
|
||||
rct.bottom = MAXY + dy * ROWY - Y_DELTA;
|
||||
|
||||
xi_pu_to_fu(itf, (XI_PNT*)&rct, 2);
|
||||
return rct;
|
||||
}
|
||||
|
||||
short TControl::id() const
|
||||
@ -1188,7 +1186,8 @@ TText_control::TText_control(WINDOW win, short cid,
|
||||
if (width <= 0)
|
||||
width = t.len();
|
||||
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_RCT rct = coord2rct(itf, left, top, width, height);
|
||||
rct.right += bold ? (width*XI_FU_MULTIPLE/4) : XI_FU_MULTIPLE;
|
||||
if (big)
|
||||
{
|
||||
@ -1197,12 +1196,12 @@ TText_control::TText_control(WINDOW win, short cid,
|
||||
}
|
||||
|
||||
const unsigned long attrib = flags2attr(flags);
|
||||
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, (XI_RCT*) &rct, attrib, (char*)(const char*)t);
|
||||
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, &rct, attrib, t.get_buffer());
|
||||
CHECKS(def, "Can't create the definition of TText_control:", text);
|
||||
def->v.text->fore_color = color;
|
||||
if (bold || big)
|
||||
def->v.text->font_id = xvtil_default_font(bold, big);
|
||||
_obj = xi_create(get_interface(win), def);
|
||||
_obj = xi_create(itf, def);
|
||||
CHECKS(_obj, "Can't create TText_control ", text);
|
||||
|
||||
xi_dequeue();
|
||||
@ -1228,15 +1227,12 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
const char* flags, const char* text)
|
||||
: TText_control(win, cid, left, top, width, 1, flags, text)
|
||||
{
|
||||
// Alza di un pixel il rettangolo per non coprire il rettangolo
|
||||
RCT& tr = (RCT &) _obj->v.text->rct;
|
||||
tr.top--; tr.bottom--;
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_RCT rct = coord2rct(itf, left, top, width, height);
|
||||
rct.top = _obj->v.text->xi_rct.bottom - 2;
|
||||
rct.bottom -= XI_FU_MULTIPLE / 2;
|
||||
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
rct.top += XI_FU_MULTIPLE - 2;
|
||||
rct.bottom -= Y_FU_MULTIPLE / 2;
|
||||
|
||||
XI_OBJ_DEF* def = xi_add_rect_def(NULL, cid, (XI_RCT*) &rct, XI_ATR_VISIBLE, 0, 0); // Ignore colors
|
||||
XI_OBJ_DEF* def = xi_add_rect_def(NULL, cid, &rct, XI_ATR_VISIBLE, 0, 0); // Ignore colors
|
||||
CHECKS(def, "Can't create the definition of TGroupbox_control ", text);
|
||||
def->v.rect->hilight_color = MASK_LIGHT_COLOR;
|
||||
def->v.rect->back_color = MASK_BACK_COLOR;
|
||||
@ -1251,7 +1247,7 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
else
|
||||
def->v.rect->ridge = true; // Angoli arrotondati in caso di stile piatto (!CAMPI_SCAVATI)
|
||||
|
||||
_rct = xi_create(get_interface(win), def);
|
||||
_rct = xi_create(itf, def);
|
||||
CHECKD(_rct, "Can't create Groupbox_control ", cid);
|
||||
|
||||
XI_RCT& rt = _obj->v.text->rct;
|
||||
@ -1308,7 +1304,8 @@ void TField_control::create(WINDOW win, short cid,
|
||||
bold = true;
|
||||
}
|
||||
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_RCT rct = coord2rct(itf, left, top, width, height);
|
||||
|
||||
rct.right += bold ? (width*XI_FU_MULTIPLE/4) : XI_FU_MULTIPLE/4;
|
||||
|
||||
@ -1367,7 +1364,6 @@ void TField_control::create(WINDOW win, short cid,
|
||||
f->var_len_text = true;
|
||||
}
|
||||
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_OBJ* form = xi_create(itf, frm_def);
|
||||
CHECKD(form, "Can't create the form for field ", cid);
|
||||
_obj = xi_get_obj(form, cid);
|
||||
@ -1496,10 +1492,10 @@ void TButton_control::create(WINDOW win, short cid,
|
||||
const char* t = parse_caption(txt, bold, big, color);
|
||||
if (width <= 0) width = strlen(t)+3;
|
||||
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
XI_RCT rct = coord2rct(get_interface(win), left, top, width, height);
|
||||
|
||||
const unsigned long attrib = flags2attr(flags);
|
||||
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, (XI_RCT*)&rct, attrib, (char*)t, cid);
|
||||
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, &rct, attrib, (char*)t, cid);
|
||||
CHECKD(def, "Can't create the interface of TButton_control ", cid);
|
||||
def->v.btn->fore_color = color;
|
||||
def->app_data = (long)this;
|
||||
@ -1860,7 +1856,8 @@ TRadiobutton_control::TRadiobutton_control(WINDOW win, short cid,
|
||||
const int tot = testo.items();
|
||||
|
||||
const XI_CONTAINER_ORIENTATION orient = height == 1 ? XI_STACK_HORIZONTAL : XI_STACK_VERTICAL;
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_RCT rct = coord2rct(itf, left, top, width, height);
|
||||
|
||||
if (height > 1)
|
||||
{
|
||||
@ -1895,7 +1892,6 @@ TRadiobutton_control::TRadiobutton_control(WINDOW win, short cid,
|
||||
btn->checked = b == 1;
|
||||
}
|
||||
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
_obj = xi_create(itf, def);
|
||||
CHECKD(_obj, "Can't create radio-button container ", cid);
|
||||
|
||||
@ -1996,7 +1992,7 @@ TTagbutton_control::TTagbutton_control(WINDOW win, short cid,
|
||||
{
|
||||
XI_OBJ* itf = get_interface(win);
|
||||
XI_RCT rct; xi_get_xi_rct(itf, &rct);
|
||||
rct.bottom = rct.top + Y_FU_MULTIPLE;
|
||||
rct.bottom = rct.top + XI_FU_MULTIPLE;
|
||||
XI_OBJ_DEF* cnt_def = xi_add_container_def(NULL, cid, &rct, XI_STACK_HORIZONTAL, cid);
|
||||
cnt_def->app_data = (long)this;
|
||||
|
||||
@ -2075,7 +2071,7 @@ const char* xvtil_get_cell_selection(XI_OBJ* field_or_cell, int sel, const char*
|
||||
TToken_string values(val);
|
||||
if (field_or_cell->type != XIT_FIELD)
|
||||
{
|
||||
RCT ownrct; xi_get_rect(field_or_cell, (XI_RCT*)&ownrct);
|
||||
XI_RCT ownrct; xi_get_rect(field_or_cell, &ownrct);
|
||||
const int max_width = (ownrct.right-ownrct.left) - 20; // Larghezza cella stimata senza bottone
|
||||
|
||||
WINDOW parent = (WINDOW)xi_get_window(field_or_cell);
|
||||
|
@ -15,6 +15,8 @@ class TMask_field; // __MASKFLD_H
|
||||
#ifndef INCL_XI
|
||||
struct XI_OBJ;
|
||||
struct XI_EVENT;
|
||||
struct XI_PNT;
|
||||
struct XI_RCT;
|
||||
#endif
|
||||
|
||||
|
||||
@ -60,7 +62,7 @@ protected:
|
||||
// @cmember Setta l'identificatore del prossimo controllo per il tasto TAB
|
||||
void set_tab_cid(XI_OBJ* obj, short id) const;
|
||||
|
||||
void coord2rct(WINDOW win, short left, short top, short width, short height, RCT& rct) const;
|
||||
XI_RCT coord2rct(XI_OBJ* itf, short x, short y, short dx, short dy) const;
|
||||
unsigned long flags2attr(const char* flags) const;
|
||||
void update_tab_cid();
|
||||
const char* parse_caption(const char* cap, bool& bold, bool& big, COLOR& color) const;
|
||||
|
@ -1165,8 +1165,14 @@ void TMask::read_page(
|
||||
create_book(false); // Crea notebook
|
||||
else
|
||||
{
|
||||
WINDOW w = create_interface(NULL_WIN, r.left, r.top, r.right, r.bottom, title, this);
|
||||
insert_page(w, 0); // Crea pagina principale
|
||||
//WINDOW w = create_interface(NULL_WIN, r.left, r.top, r.right, r.bottom, title, this);
|
||||
//insert_page(w, 0); // Crea pagina principale
|
||||
|
||||
const WIN_TYPE wt = (r.right == 0) ? W_PLAIN : W_DOC;
|
||||
const long wsf = WSF_INVISIBLE | WSF_NO_MENUBAR;
|
||||
create(r.left, r.top, r.right, r.bottom, title, wsf, wt);
|
||||
|
||||
|
||||
const bool single = l.starts_with("TO"); // Crea sotto-pagina singola o multipla?
|
||||
create_book(single);
|
||||
}
|
||||
@ -1314,9 +1320,11 @@ void TMask::insert_bar(WINDOW page)
|
||||
{
|
||||
CHECK(_toolbar == NULL_WIN, "One single top bar, please!");
|
||||
|
||||
if (rows() < 18) // Ridimensiono maschera piccola (non massimizzata)
|
||||
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
||||
const int nrows = r.bottom / ROWY;
|
||||
if (nrows < 18) // Ridimensiono maschera piccola (non massimizzata)
|
||||
{
|
||||
const short bar_height = max(rct_bar.bottom - rct_bar.top, TOOL_SIZE + TOOL_TEXT * 12);
|
||||
const short bar_height = max(rct_bar.bottom - rct_bar.top, TOOL_SIZE + TOOL_TEXT * 12 + 12);
|
||||
RCT rct_new; xvt_vobj_get_client_rect(parent, &rct_new);
|
||||
rct_new.bottom += bar_height;
|
||||
xvt_rect_offset(&rct_new, rct_win.left, rct_win.top-bar_height/2);
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include <maskfld.h>
|
||||
#endif
|
||||
|
||||
// Numero massimo di righe logiche per maschere
|
||||
#define MAX_MASK_ROWS 23
|
||||
|
||||
class TSheet_field;
|
||||
class TTree_field;
|
||||
class TCurrency;
|
||||
|
@ -511,7 +511,8 @@ TSpreadsheet::TSpreadsheet(
|
||||
}
|
||||
_columns = i;
|
||||
|
||||
RCT rct; coord2rct(parent, x, y, dx, dy, rct);
|
||||
XI_OBJ* itf = get_interface(parent);
|
||||
XI_RCT rct = coord2rct(itf, x, y, dx, dy);
|
||||
rct.right -= 2*XI_FU_MULTIPLE; // toglie scroll-bar
|
||||
|
||||
// Controlla se posso bloccare anche questa colonna
|
||||
@ -525,7 +526,6 @@ TSpreadsheet::TSpreadsheet(
|
||||
break;
|
||||
}
|
||||
}
|
||||
XI_OBJ* itf = get_interface(parent);
|
||||
|
||||
XI_OBJ_DEF* listdef = xi_add_list_def(NULL, dlg,
|
||||
rct.top, rct.left, rct.bottom-rct.top,
|
||||
|
@ -38,29 +38,43 @@ protected:
|
||||
void fill_size_list();
|
||||
|
||||
public:
|
||||
void set_print_rcd(PRINT_RCD* pcd, int size);
|
||||
void set_print_rcd(PRINT_RCD* pcd, int size, bool take_ownership);
|
||||
PRINT_RCD* get_print_rcd(int& size);
|
||||
|
||||
TPrinter_setup_mask();
|
||||
virtual ~TPrinter_setup_mask();
|
||||
};
|
||||
|
||||
void TPrinter_setup_mask::set_print_rcd(PRINT_RCD* pcd, int size)
|
||||
void TPrinter_setup_mask::set_print_rcd(PRINT_RCD* pcd, int size, bool take_ownership)
|
||||
{
|
||||
if (_pcd != NULL && _pcd_owned)
|
||||
xvt_print_destroy(_pcd);
|
||||
|
||||
_pcd_owned = _pcd != NULL; // Sto impostando una nuova stampante
|
||||
_pcd = pcd;
|
||||
_pcd_size = size;
|
||||
xvt_print_get_name(pcd, _pdev.get_buffer(), _pdev.size());
|
||||
if (pcd == NULL)
|
||||
{
|
||||
_pcd_owned = true;
|
||||
_pcd = xvt_print_create(&_pcd_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pcd_owned = take_ownership;
|
||||
_pcd = pcd;
|
||||
_pcd_size = size;
|
||||
}
|
||||
xvt_print_get_name(_pcd, _pdev.get_buffer(), _pdev.size());
|
||||
}
|
||||
|
||||
PRINT_RCD* TPrinter_setup_mask::get_print_rcd(int& size)
|
||||
{
|
||||
_pcd_owned = false;
|
||||
CHECK(_pcd != NULL && _pcd_size > 0, "Invalid PRINT_RCD");
|
||||
PRINT_RCD* pcd = _pcd;
|
||||
size = _pcd_size;
|
||||
return _pcd;
|
||||
|
||||
_pcd_owned = false;
|
||||
_pcd = NULL;
|
||||
_pcd_size = 0;
|
||||
|
||||
return pcd;
|
||||
}
|
||||
|
||||
int TPrinter_setup_mask::fill_font_list()
|
||||
@ -133,7 +147,7 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
{
|
||||
if (o.get().full())
|
||||
{
|
||||
set_print_rcd(NULL, 0);
|
||||
set_print_rcd(NULL, 0, true);
|
||||
set(MSK_PRINTERS, _pdev, 0x1);
|
||||
}
|
||||
}
|
||||
@ -149,9 +163,9 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
PRINT_RCD* tmp_pcd = xvt_print_create_by_name(&tmp_size, pdev);
|
||||
if (tmp_pcd != NULL)
|
||||
{
|
||||
set_print_rcd(tmp_pcd, tmp_size);
|
||||
set_print_rcd(tmp_pcd, tmp_size, true);
|
||||
if (fill_font_list() <= 0)
|
||||
return error_box(TR("La stampante selezionata non risulta essere compatibile"));
|
||||
return error_box(TR("Impossibile inizializzare la stampante %s"), (const char*)pdev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -224,9 +238,9 @@ TPrinter_setup_mask::TPrinter_setup_mask()
|
||||
enable(DLG_OK, can_save);
|
||||
|
||||
if (pr.forced_default_printer())
|
||||
set_print_rcd(NULL, 0);
|
||||
set_print_rcd(NULL, 0, true);
|
||||
else
|
||||
set_print_rcd(pr._print_rcd, pr._print_rcd_size);
|
||||
set_print_rcd(pr._print_rcd, pr._print_rcd_size, false);
|
||||
|
||||
// Crea la lista delle stampanti
|
||||
TToken_string pn2;
|
||||
@ -250,7 +264,7 @@ TPrinter_setup_mask::TPrinter_setup_mask()
|
||||
else
|
||||
set(MSK_TYPE, "0");
|
||||
|
||||
TList_field& plst = lfield (MSK_PRINTERS);
|
||||
TList_field& plst = lfield(MSK_PRINTERS);
|
||||
plst.replace_items(pn2, pn2); // Genera printer list
|
||||
set(MSK_PRINTERS, _pdev);
|
||||
|
||||
@ -278,6 +292,7 @@ TPrinter_setup_mask::~TPrinter_setup_mask()
|
||||
xvt_print_destroy(_pcd);
|
||||
_pcd_owned = false;
|
||||
_pcd = NULL;
|
||||
_pcd_size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1202,7 +1217,7 @@ void TPrinter::set_printrcd()
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
if (_prname.full())
|
||||
if (_prname.full() && !forced_default_printer())
|
||||
{
|
||||
_print_rcd = xvt_print_create_by_name(&_print_rcd_size, _prname);
|
||||
ok = xvt_print_is_valid(_print_rcd) != 0;
|
||||
@ -1293,7 +1308,6 @@ TPrinter::TPrinter()
|
||||
_hwformfeed = false;
|
||||
_currentpage = 1;
|
||||
_currentrow = 1;
|
||||
_fp = NULL;
|
||||
_headersize = 0;
|
||||
_footersize = 0;
|
||||
_isopen = false;
|
||||
@ -1983,12 +1997,6 @@ void TPrinter::close ()
|
||||
if (isopen() && _currentrow > 1 && _footersize > 0)
|
||||
formfeed();
|
||||
|
||||
if (_fp)
|
||||
{
|
||||
fclose (_fp);
|
||||
_fp = NULL;
|
||||
}
|
||||
|
||||
switch (_printertype)
|
||||
{
|
||||
case winprinter:
|
||||
|
@ -187,11 +187,7 @@ class TPrinter : public TObject
|
||||
{
|
||||
friend class TPrinter_setup_mask;
|
||||
|
||||
// @cmember:(INTERNAL) Puntatore al file di configurazione
|
||||
FILE* _cnfptr;
|
||||
// @cmember:(INTERNAL) Puntatore al file della stampante
|
||||
FILE* _fp;
|
||||
// @cmember:(INTERNAL) Puntatore al file di visualizzaizone
|
||||
// @cmember:(INTERNAL) Puntatore al file di visualizzazione
|
||||
TViswin* _vf;
|
||||
// @cmember:(INTERNAL) Testo da stampare
|
||||
TTextfile _txt;
|
||||
@ -206,7 +202,7 @@ class TPrinter : public TObject
|
||||
// @cmember:(INTERNAL) Contenuto del footer
|
||||
TArray _footer;
|
||||
// @cmember:(INTERNAL) Nome della stampante corrente
|
||||
TString _prname;
|
||||
TFilename _prname;
|
||||
// @cmember:(INTERNAL) Nome dell'ultimo TForm utilizzato
|
||||
TFilename _formname;
|
||||
// @cmember:(INTERNAL) Lunghezza della pagina logica
|
||||
|
@ -196,15 +196,13 @@ TSheet_control::TSheet_control(
|
||||
}
|
||||
|
||||
// Calcola rettangolo massimo per lo sheet
|
||||
// RCT rct; coord2rct(parent, x, y, dx, dy, rct);
|
||||
// rct.right -= 2*XI_FU_MULTIPLE; // toglie scroll-bar
|
||||
RCT rct; coord2rct(parent, x, y, -2, -2, rct);
|
||||
XI_OBJ* itf = get_interface(parent);
|
||||
const XI_RCT rct = coord2rct(itf, x, y, -2, -2);
|
||||
|
||||
// Controlla se ci sono troppe colonne fisse
|
||||
if ((f_width+max_width)*XI_FU_MULTIPLE > rct.right)
|
||||
fixed_columns = 1;
|
||||
|
||||
XI_OBJ* itf = get_interface(parent);
|
||||
|
||||
XI_OBJ_DEF* listdef = xi_add_list_def(NULL, cid,
|
||||
rct.top, rct.left, rct.bottom-rct.top,
|
||||
|
@ -1173,8 +1173,7 @@ void TViswin::paint_header ()
|
||||
{
|
||||
htmpst.format ("%d", i);
|
||||
htmpst.right_just (10, '.');
|
||||
xvt_dwin_draw_text(win(), tabx(i*10 - 4 - int(origin().x)), BASEY-1,
|
||||
(char*)(const char*)htmpst, 10);
|
||||
xvt_dwin_draw_text(win(), tabx(i*10 - 4 - int(origin().x)), CHARY-2, htmpst, 10);
|
||||
}
|
||||
autoscroll (FALSE);
|
||||
set_color (COLOR_WHITE, BACKGROUND);
|
||||
|
@ -766,11 +766,8 @@ void TWindow::frame(
|
||||
set_brush(COLOR_WHITE);
|
||||
}
|
||||
|
||||
const PNT f = log2dev(left,top);
|
||||
const PNT t = log2dev(right,bottom);
|
||||
RCT r;
|
||||
r.top = f.v; r.left = f.h;
|
||||
r.bottom = t.v; r.right = t.h;
|
||||
const TRectangle rctl(left, top, right-left, bottom-top);
|
||||
RCT r; log2dev(rctl, r);
|
||||
|
||||
if (!_pixmap && (flag & 2))
|
||||
{
|
||||
@ -880,6 +877,7 @@ void TWindow::dev2log(const RCT& rctd, TRectangle& rctl) const
|
||||
|
||||
void TWindow::stringat(short x, short y, const char* str)
|
||||
{
|
||||
int BASEY; xvt_dwin_get_font_metrics(win(), NULL, &BASEY, NULL);
|
||||
PNT pnt = log2dev(x,y);
|
||||
pnt.v += BASEY;
|
||||
xvt_dwin_draw_text(win(), pnt.h, pnt.v, str, -1);
|
||||
|
@ -13,7 +13,6 @@
|
||||
short CHARX = 8;
|
||||
short CHARY = 14;
|
||||
short ROWY = -CHARY; // Not so good!
|
||||
short BASEY = 12;
|
||||
|
||||
// ERROR HOOK che intercetta errori XVT
|
||||
// put breakpoint here
|
||||
@ -71,16 +70,6 @@ RCT& resize_rect(
|
||||
{
|
||||
if (xvt_vobj_get_type(parent) == W_PLAIN) // Mask with Toolbar
|
||||
{
|
||||
/* if (y >= 0)
|
||||
{
|
||||
const TWindow* w = (const TWindow*)xvt_vobj_get_data(parent);
|
||||
if (w->is_kind_of(CLASS_MASK))
|
||||
{
|
||||
const TMask* m = (const TMask*)w;
|
||||
if (parent != m->toolwin())
|
||||
y++;
|
||||
}
|
||||
} */
|
||||
if (x > 0 || (wt != WO_TE && wt != W_PLAIN && x == 0))
|
||||
{
|
||||
RCT pc; xvt_vobj_get_client_rect(parent, &pc); // Get parent window size
|
||||
@ -109,6 +98,7 @@ RCT& resize_rect(
|
||||
}
|
||||
else
|
||||
{
|
||||
int BASEY; xvt_dwin_get_font_metrics(parent, NULL, &BASEY, NULL);
|
||||
r.left = (x+1)*CHARX;
|
||||
r.top = y*ROWY;
|
||||
r.right = dx*CHARX;
|
||||
@ -121,7 +111,7 @@ RCT& resize_rect(
|
||||
r.left = x * CHARX;
|
||||
r.top = y * ROWY;
|
||||
r.right = dx * CHARX;
|
||||
r.bottom = dy * CHARY;
|
||||
r.bottom = dy * ROWY;
|
||||
break;
|
||||
default:
|
||||
r.left = x * CHARX;
|
||||
@ -137,7 +127,7 @@ RCT& resize_rect(
|
||||
if (parent == NULL_WIN) parent = TASK_WIN;
|
||||
xvt_vobj_get_client_rect(parent, &pc); // Get parent window size
|
||||
if (parent == TASK_WIN)
|
||||
pc.bottom -= 26;
|
||||
pc.bottom -= 26; // Cazzone???
|
||||
const short MAXX = pc.right;
|
||||
const short MAXY = pc.bottom;
|
||||
|
||||
@ -159,22 +149,35 @@ RCT& resize_rect(
|
||||
if (y < 0)
|
||||
{
|
||||
y = -y;
|
||||
if (wt != WC_TEXTEDIT && y == 1) y = 11;
|
||||
if (wt != WC_TEXTEDIT && y == 1)
|
||||
y = 11;
|
||||
if (y > 10)
|
||||
{
|
||||
const int num = y/10 -1;
|
||||
const int tot = y%10;
|
||||
const int spc = (MAXY - tot*r.bottom) / (tot+1);
|
||||
r.top = spc + num*(spc+r.bottom);
|
||||
int height = r.bottom;
|
||||
if (wt == W_DOC)
|
||||
{
|
||||
height += short(xvt_vobj_get_attr(parent, ATTR_TITLE_HEIGHT));
|
||||
height += short(2*xvt_vobj_get_attr(parent, ATTR_DOCFRAME_HEIGHT));
|
||||
}
|
||||
const int spc = (MAXY - tot*height) / (tot+1);
|
||||
r.top = spc + num*(spc+height);
|
||||
}
|
||||
else
|
||||
r.top = MAXY - r.bottom - (y-1)*ROWY;
|
||||
}
|
||||
|
||||
if (dx <= 0) r.right = MAXX + dx*CHARX;
|
||||
else r.right += r.left;
|
||||
if (dy <= 0) r.bottom = MAXY + dy*ROWY;
|
||||
else r.bottom += r.top;
|
||||
if (dx <= 0)
|
||||
r.right = MAXX + dx*CHARX;
|
||||
else
|
||||
r.right += r.left;
|
||||
if (dy <= 0)
|
||||
r.bottom = MAXY + dy*ROWY;
|
||||
else
|
||||
{
|
||||
r.bottom += r.top;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -77,6 +77,6 @@ COLOR trans_color(char c);
|
||||
PAT_STYLE trans_brush(char p);
|
||||
PEN_STYLE trans_pen (char p);
|
||||
|
||||
extern short CHARX, CHARY, BASEY, ROWY;
|
||||
extern short CHARX, CHARY, ROWY;
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user