Patch level : 10.0

Files correlati     : agalib.lib
Ricompilazione Demo : [ ]
Commento            :
Migliorato calcolo interlinea dei campi in modo da avere 3 righe di spazio in piu' sulle maschere


git-svn-id: svn://10.65.10.50/trunk@18130 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2009-01-28 08:59:32 +00:00
parent 88cfa4d4cb
commit 47abf1d5c2
4 changed files with 57 additions and 36 deletions

View File

@ -184,6 +184,20 @@ HIDDEN XVT_FNTID FAT_FONT = NULL;
HIDDEN XVT_FNTID BIG_FONT = NULL;
HIDDEN XVT_FNTID BIGFAT_FONT = NULL;
HIDDEN void get_taskwin_size(XinPoint& pnt)
{
RCT max_rct; xvt_vobj_get_client_rect(TASK_WIN, &max_rct);
pnt.h = max_rct.right;
pnt.v = max_rct.bottom;
int sbh = xvtil_statbar_height();
if (sbh <= 0) sbh = 24;
pnt.v -= sbh; // Tolgo lo spazio occupato dalla status bar
pnt.v -= sbh; // Tolgo lo spazio occupato dai tab buttons
pnt.v -= TOOL_SIZE + 8; // Tolgo lo spazio occupato dalle icone della toolbar
pnt.v -= TOOL_TEXT ? 12 : 0; // Tolgo lo spazio occupato dal testo della toolbar
}
bool is_xvt_font(const char * nome_font)
{
const int max_fonts = 1024;
@ -203,8 +217,6 @@ XVT_FNTID xvtil_default_font(bool bold, bool big)
{
if (DEF_FONT == NULL)
{
RCT pc; xvt_vobj_get_client_rect(TASK_WIN, &pc);
DEF_FONT = xvt_dwin_get_font(TASK_WIN);
TConfig font(CONFIG_GUI, "Colors");
@ -216,7 +228,7 @@ XVT_FNTID xvtil_default_font(bool bold, bool big)
if (font_ser_desc.empty())
{
const char* name = "Verdana";
font_ser_desc.format("01\\%s\\0\\10\\WIN01/-13/0/0/0/400/0/0/0/0/1/2/1/49/%s", name, name);
font_ser_desc.format("01\\%s\\0\\8\\WIN01/8/0/0/0/400/0/0/0/0/1/2/1/49/%s", name, name);
font.set("FontDesc", font_ser_desc, "Colors", true); // Salva definitivamente il font
}
@ -245,23 +257,23 @@ XVT_FNTID xvtil_default_font(bool bold, bool big)
xvt_font_map_using_default(BIGFAT_FONT);
CHECK(xvt_font_is_mapped(BIGFAT_FONT), "Can't map native font");
// Compute true text size
ROWY = (pc.bottom - pc.top) / 25;
const int COLX = (pc.right - pc.left) / 80;
TString str(80, 'M');
CHARX = xvt_dwin_get_text_width(TASK_WIN, str.get_buffer(), str.size()) / str.size();
int leading, ascent, descent;
xvt_dwin_get_font_metrics(TASK_WIN, &leading, &ascent, &descent);
CHARY = ascent + descent + 1;
BASEY = ascent;
if (CHARX > COLX)
CHARX = COLX;
// Compute suitable text size
XinPoint pnt; get_taskwin_size(pnt);
ROWY = pnt.v / 23;
if (CHARY > ROWY-2)
CHARY = ROWY-2;
const int COLX = pnt.h / 80;
TString str(80, 'M');
CHARX = xvt_dwin_get_text_width(TASK_WIN, str, str.size()) / str.size();
if (CHARX > COLX)
CHARX = COLX;
}
XVT_FNTID f = NULL;
@ -494,10 +506,10 @@ HIDDEN void xi_event_handler(XI_OBJ *itf, XI_EVENT *xiev);
HIDDEN void init_fu_multiple(XI_OBJ* itf)
{
RCT max_rct; xvt_vobj_get_client_rect(TASK_WIN, &max_rct);
xi_pu_to_fu(itf, (XinPoint *) &max_rct, 2);
X_FU_MULTIPLE = max_rct.right / 80;
Y_FU_MULTIPLE = max_rct.bottom / 25;
XinPoint pnt; get_taskwin_size(pnt);
xi_pu_to_fu(itf, &pnt, 1);
X_FU_MULTIPLE = pnt.h / 80;
Y_FU_MULTIPLE = pnt.v / 23;
}
WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
@ -571,7 +583,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
xi_dequeue();
xi_tree_free(def);
if (Y_FU_MULTIPLE == 0)
if (Y_FU_MULTIPLE <= 0)
init_fu_multiple(itf);
if (dx > 0)
@ -895,20 +907,9 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT &
XI_OBJ* itf = get_interface(win);
if (Y_FU_MULTIPLE == 0) // Puo' succedere che non sia ancora inizializzato
if (Y_FU_MULTIPLE <= 0) // Puo' succedere che non sia ancora inizializzato
init_fu_multiple(itf);
/* OBSOLETE
// Se ci sono i tab controls sulla pagina salta una riga
if (y >= 0)
{
int num;
XI_OBJ** child = xi_get_member_list(itf, &num);
if (num > 0 && child[0]->cid == MASK_RECT_ID)
y++;
}
*/
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;
@ -1266,12 +1267,18 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
def->v.rect->back_color = MASK_BACK_COLOR;
def->v.rect->shadow_color = MASK_DARK_COLOR;
const bool erre = strchr(flags, 'R') != NULL;
if (erre)
if (CAMPI_SCAVATI)
{
def->v.rect->well = true; // Mette in rilievo il rettangolo
change_attrib(XI_ATR_RJUST, false, _obj); // Toglie l'erroneo allineamento a destra del titolo
const bool erre = strchr(flags, 'R') != NULL;
if (erre)
{
def->v.rect->well = true; // Mette in rilievo il rettangolo
change_attrib(XI_ATR_RJUST, false, _obj); // Toglie l'erroneo allineamento a destra del titolo
}
}
else
def->v.rect->ridge = true; // Angoli arrotondati
_rct = xi_create(get_interface(win), def);
CHECKD(_rct, "Can't create Groupbox_control ", cid);
@ -1403,6 +1410,7 @@ void TField_control::create(WINDOW win, short cid,
const int offset = stx->rct.right - br.left - 1;
br.left += offset;
br.right += offset;
br.top = stx->rct.top+1;
br.bottom = stx->rct.bottom;
}

View File

@ -486,7 +486,7 @@ void TRelation_application::insert_mode()
_mask->reset();
_mask->set_workfile(workname);
_mask->load();
::remove(workname);
xvt_fsys_remove_file(workname);
_mask->open_modal();
}
else
@ -2029,7 +2029,7 @@ bool TRelation_application::mask2mail(const TMask& m)
mask2ini(m, ini);
}
ok = ::dispatch_transaction(get_relation()->curr(), ininame);
::remove(ininame);
xvt_fsys_remove_file(ininame);
}
return ok;
}

View File

@ -589,6 +589,18 @@ void xvtil_statbar_destroy()
_statbar = NULL;
}
int xvtil_statbar_height()
{
int h = 0;
if (_statbar != NULL_WIN)
{
RCT rct; xvt_vobj_get_outer_rect(_statbar, &rct);
h = rct.bottom - rct.top;
}
return h;
}
///////////////////////////////////////////////////////////
// Test menu
///////////////////////////////////////////////////////////

View File

@ -34,6 +34,7 @@ WINDOW xvtil_create_statbar();
void xvtil_statbar_set(const char* text, bool def = FALSE);
void xvtil_statbar_refresh();
void xvtil_statbar_destroy();
int xvtil_statbar_height();
void beep(int severity = 0);
void do_events();