Patch level : 2.2
Files correlati : Ricompilazione Demo : [ ] Commento : Corretta gestione spezzamento testo su piu' righe nei report git-svn-id: svn://10.65.10.50/trunk@13379 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
318e2071f2
commit
a6d80e96b1
@ -171,106 +171,56 @@ HIDDEN const char* producer_name(TString& firm)
|
||||
// Gestione dello sfondo della finestra principale
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
HIDDEN long backdrop_eh(WINDOW win, EVENT* ep)
|
||||
HIDDEN void paint_background(WINDOW win)
|
||||
{
|
||||
const XVT_DISPLAY_TYPE type = (XVT_DISPLAY_TYPE)xvt_vobj_get_attr(win, ATTR_DISPLAY_TYPE);
|
||||
xvt_dwin_clear(win, MASK_DARK_COLOR);
|
||||
RCT r; xvt_vobj_get_client_rect(win, &r);
|
||||
|
||||
const XVT_DISPLAY_TYPE type = (XVT_DISPLAY_TYPE)xvt_vobj_get_attr(win, ATTR_DISPLAY_TYPE);
|
||||
if (ADVANCED_GRAPHICS && type == XVT_DISPLAY_DIRECT_COLOR)
|
||||
{
|
||||
const int step = 6;
|
||||
RCT r; xvt_vobj_get_client_rect(win, &r);
|
||||
const int bot = r.bottom;
|
||||
|
||||
xvt_dwin_set_std_cpen(win, TL_PEN_HOLLOW);
|
||||
CBRUSH brush = { PAT_SOLID, COLOR_BLACK };
|
||||
|
||||
for (int y = 0; y < bot; y += step)
|
||||
CPEN pen; memset(&pen, 0, sizeof(pen));
|
||||
pen.width = 7;
|
||||
const int R = r.bottom;
|
||||
for (int x = R; x >= 0; x-=pen.width)
|
||||
{
|
||||
brush.color = blend_colors(MASK_DARK_COLOR, MASK_LIGHT_COLOR, double(y) / double(bot));
|
||||
xvt_dwin_set_cbrush(win, &brush);
|
||||
r.top = y; r.bottom = y+step;
|
||||
xvt_dwin_draw_rect(win, &r);
|
||||
}
|
||||
const COLOR c = blend_colors(MASK_DARK_COLOR, MASK_LIGHT_COLOR, double(x) / double(R));
|
||||
if (c != pen.color)
|
||||
{
|
||||
pen.color = c;
|
||||
xvt_dwin_set_cpen(win, &pen);
|
||||
}
|
||||
const PNT p = { x, 0 };
|
||||
const PNT t = { 0, x };
|
||||
xvt_dwin_draw_set_pos(win, p);
|
||||
xvt_dwin_draw_line(win, t);
|
||||
}
|
||||
}
|
||||
else
|
||||
xvt_dwin_clear(win, MASK_DARK_COLOR);
|
||||
|
||||
return 0L;
|
||||
}
|
||||
const int BIGY = 3*CHARY/2;
|
||||
|
||||
HIDDEN void create_backdrop(void)
|
||||
{
|
||||
xvtil_create_statbar();
|
||||
xvtil_statbar_set("");
|
||||
}
|
||||
xvtil_set_font(win, XVT_FFN_TIMES, XVT_FS_BOLD | XVT_FS_ITALIC, BIGY);
|
||||
const char* t = main_app().title();
|
||||
int w = xvt_dwin_get_text_width(win, t, -1);
|
||||
int a; xvt_dwin_get_font_metrics(win, NULL, &a, NULL);
|
||||
int x = (r.right-w)>>1, y = r.top+a;
|
||||
xvt_dwin_set_fore_color(win, MASK_LIGHT_COLOR);
|
||||
xvt_dwin_draw_text(win, x+1, y+1, t, -1);
|
||||
xvt_dwin_set_fore_color(win, NORMAL_COLOR);
|
||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Gestione del banner iniziale
|
||||
///////////////////////////////////////////////////////////
|
||||
xvtil_set_font(win, NULL, XVT_FS_NONE);
|
||||
TString spa;
|
||||
t = producer_name(spa);
|
||||
w = xvt_dwin_get_text_width(win, t, -1);
|
||||
x = (r.right-r.left-w)>>1; y = r.bottom-CHARY;
|
||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||
|
||||
class TBanner : public TWindow
|
||||
{
|
||||
bool _updated;
|
||||
|
||||
protected:
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
|
||||
public:
|
||||
bool updated() const { return _updated;}
|
||||
TBanner();
|
||||
virtual ~TBanner();
|
||||
};
|
||||
|
||||
TBanner::TBanner()
|
||||
{
|
||||
create(-1, 1, 76, 4, "BANNER", WSF_NONE, W_PLAIN);
|
||||
hide_brush();
|
||||
open();
|
||||
_updated = false;
|
||||
}
|
||||
|
||||
TBanner::~TBanner()
|
||||
{
|
||||
if (is_open())
|
||||
close();
|
||||
}
|
||||
|
||||
void TBanner::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
if (ep->type == E_UPDATE)
|
||||
if (ADVANCED_GRAPHICS)
|
||||
{
|
||||
_updated = true;
|
||||
const int BIGY = 3*CHARY/2;
|
||||
RCT r; xvt_vobj_get_client_rect(win, &r);
|
||||
|
||||
clear(COLOR_LTGRAY);
|
||||
|
||||
set_color(COLOR_WHITE, COLOR_LTGRAY);
|
||||
set_font(XVT_FFN_TIMES, XVT_FS_BOLD | XVT_FS_ITALIC, BIGY);
|
||||
char* t = (char*)(const char*)main_app().title();
|
||||
int w = xvt_dwin_get_text_width(win, t, -1);
|
||||
int a; xvt_dwin_get_font_metrics(win, NULL, &a, NULL);
|
||||
int x = (r.right-w)>>1, y = (r.bottom+a)>>1 ;
|
||||
xvt_dwin_draw_text(win, x+1, y+1, t, -1);
|
||||
set_color(COLOR_BLACK, COLOR_LTGRAY);
|
||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||
|
||||
set_font(XVT_FFN_TIMES);
|
||||
TString spa;
|
||||
t = (char*)producer_name(spa);
|
||||
w = xvt_dwin_get_text_width(win, t, -1);
|
||||
x = (r.right-r.left-w)>>1; y = BIGY;
|
||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||
|
||||
r.left += 5; r.right -= 4;
|
||||
r.top += 5; r.bottom -= 4;
|
||||
set_pen(COLOR_WHITE); xvt_dwin_draw_rect(win, &r);
|
||||
xvt_rect_offset(&r, -1, -1);
|
||||
set_pen(COLOR_BLACK); xvt_dwin_draw_rect(win, &r);
|
||||
|
||||
xvt_dwin_draw_icon(win, CHARX<<1, CHARX<<1, ICON_RSRC);
|
||||
xvt_dwin_draw_icon(win, r.right-40, r.bottom-40, ICON_RSRC);
|
||||
xvt_dwin_draw_icon(win, 8, r.bottom-40, ICON_RSRC);
|
||||
}
|
||||
else
|
||||
TWindow::handler(win, ep);
|
||||
}
|
||||
|
||||
long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
@ -330,14 +280,14 @@ long TApplication::task_eh(WINDOW win, EVENT *ep)
|
||||
// Carica colori e font
|
||||
customize_controls(TRUE);
|
||||
|
||||
// Crea il banner iniziale
|
||||
create_backdrop();
|
||||
xvtil_create_statbar();
|
||||
xvtil_statbar_set("");
|
||||
|
||||
do_events(); // strateggicca non scancellare
|
||||
}
|
||||
break;
|
||||
case E_UPDATE:
|
||||
backdrop_eh(win, ep);
|
||||
paint_background(win);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -360,16 +310,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
switch (ep->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
{
|
||||
TBanner banner;
|
||||
|
||||
while (!banner.updated())
|
||||
{
|
||||
xvt_sys_sleep(10);
|
||||
do_events();
|
||||
}
|
||||
_create_ok = create();
|
||||
}
|
||||
_create_ok = create();
|
||||
if (_create_ok)
|
||||
{
|
||||
on_firm_change();
|
||||
|
@ -1079,7 +1079,7 @@ void TControl::set_rjust(bool on)
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @mfunc Allineamento a destra del testo
|
||||
// @mfunc Flag di sola lettura
|
||||
void TControl::read_only(bool on)
|
||||
{
|
||||
change_attrib(XI_ATR_READONLY, on);
|
||||
@ -1185,7 +1185,7 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
rct.top += XI_FU_MULTIPLE - 2;
|
||||
rct.bottom -= Y_FU_MULTIPLE / 2;
|
||||
|
||||
XI_OBJ_DEF* def = xi_add_rect_def(NULL, cid, (XinRect *) &rct, XI_ATR_VISIBLE, 0, 0); // Ignore colors
|
||||
XI_OBJ_DEF* def = xi_add_rect_def(NULL, cid, (XI_RCT*) &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;
|
||||
@ -1200,7 +1200,7 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
_rct = xi_create(get_interface(win), def);
|
||||
CHECKD(_rct, "Can't create Groupbox_control ", cid);
|
||||
|
||||
RCT& rt = (RCT&)_obj->v.text->rct;
|
||||
XI_RCT& rt = _obj->v.text->rct;
|
||||
rt.top--; rt.bottom--;
|
||||
|
||||
xi_dequeue();
|
||||
@ -1215,7 +1215,7 @@ void TGroupbox_control::show(bool on)
|
||||
|
||||
RCT& TGroupbox_control::get_rect(RCT& r) const
|
||||
{
|
||||
xi_get_rect(_rct, (XinRect*)&r);
|
||||
xi_get_rect(_rct, (XI_RCT*)&r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
LIBRARY DEVPRN
|
||||
DESCRIPTION 'Libreria di Stampa per Fox-Pro'
|
||||
EXETYPE WINDOWS
|
||||
CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 1024
|
||||
EXPORTS
|
||||
PrintAbortProc
|
@ -83,7 +83,7 @@ void TMask::init_mask()
|
||||
}
|
||||
|
||||
TMask::TMask()
|
||||
: _mask_num(0)
|
||||
: _mask_num(0)
|
||||
{ init_mask(); }
|
||||
|
||||
|
||||
@ -257,7 +257,7 @@ void TMask::add_default_tag_buttons()
|
||||
}
|
||||
|
||||
TMask::TMask(const char* maskname, int num, int max)
|
||||
: _mask_num(num)
|
||||
: _mask_num(num), _sheet(NULL)
|
||||
{
|
||||
if (maskname && *maskname)
|
||||
read_mask(maskname, num, max);
|
||||
@ -2068,7 +2068,8 @@ bool TMask::load(
|
||||
if (reset) _lastpos = 0;
|
||||
fseek(f, _lastpos, SEEK_SET);
|
||||
TToken_string t(256);
|
||||
while (fgets((char*)(const char*)t, t.size(), f) != NULL && t != "[EOM]")
|
||||
char* buffer = t.get_buffer();
|
||||
while (fgets(buffer, t.size(), f) != NULL && t != "[EOM]")
|
||||
{
|
||||
if (t.not_empty())
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
void TTable_names::add_file(int logic, const TString& table)
|
||||
{
|
||||
TString8* id = new TString8;
|
||||
TString* id = new TString8;
|
||||
id->format("%d", logic);
|
||||
_names.add(table, id);
|
||||
_ids.add(table, logic);
|
||||
|
@ -1446,7 +1446,7 @@ const TRectangle& TReport_field::compute_draw_rect(const TBook& book)
|
||||
if (!txt.blank())
|
||||
{
|
||||
TString_array para;
|
||||
book.compute_text_frame(formatted_text(), print_font(), r, para);
|
||||
book.compute_text_frame(txt, print_font(), r, para);
|
||||
if (r.height() > get_rect().height())
|
||||
r.set_height(get_rect().height());
|
||||
if (r.height() < 100)
|
||||
|
@ -809,9 +809,8 @@ int TBook::compute_text_frame(const TString& tmp, const TReport_font& font, TRec
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (good_len == 0) // Puo' succedere per linee senza spazi o con parole lunghissime
|
||||
{
|
||||
// Linea senza spazi
|
||||
for (good_len = row.len() * max_row_width / w + 1; good_len > 0; good_len--)
|
||||
{
|
||||
const int pix = xvt_dwin_get_text_width(w, row, good_len);
|
||||
|
@ -553,22 +553,26 @@ void TWindow::handler(
|
||||
{
|
||||
switch(ep->type)
|
||||
{
|
||||
case E_CHAR:
|
||||
on_key(e_char_to_key(ep));
|
||||
break;
|
||||
case E_CLOSE:
|
||||
stop_run(K_ESC);
|
||||
break;
|
||||
case E_CREATE:
|
||||
if (_win == NULL_WIN)
|
||||
_win = win; // Gestisco meglio gli eventi che avvengono durante la creazione
|
||||
break;
|
||||
case E_CONTROL:
|
||||
if (ep->v.ctl.ci.type == WC_PUSHBUTTON)
|
||||
on_button(ep->v.ctl.id);
|
||||
break;
|
||||
case E_UPDATE:
|
||||
update();
|
||||
break;
|
||||
case E_CHAR:
|
||||
on_key(e_char_to_key(ep));
|
||||
break;
|
||||
case E_DESTROY:
|
||||
_win = NULL_WIN;
|
||||
break;
|
||||
case E_UPDATE:
|
||||
update();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -635,13 +639,11 @@ void TWindow::activate(
|
||||
xvt_vobj_set_enabled(win(), _active = on);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::set_caption(const char* title)
|
||||
{
|
||||
xvt_vobj_set_title(win(), (char*)title);
|
||||
xvt_vobj_set_title(win(), title);
|
||||
}
|
||||
|
||||
|
||||
const char* TWindow::get_caption(TString& str) const
|
||||
{
|
||||
char* title = str.get_buffer(128);
|
||||
@ -649,14 +651,12 @@ const char* TWindow::get_caption(TString& str) const
|
||||
return title;
|
||||
}
|
||||
|
||||
|
||||
void TWindow::force_update()
|
||||
{
|
||||
if (win() != NULL_WIN)
|
||||
xvt_dwin_invalidate_rect(win(), NULL);
|
||||
}
|
||||
|
||||
|
||||
bool TWindow::save_ctools()
|
||||
{
|
||||
if (_ctools_saved == FALSE)
|
||||
@ -667,7 +667,6 @@ bool TWindow::save_ctools()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool TWindow::restore_ctools()
|
||||
{
|
||||
if (_ctools_saved)
|
||||
@ -831,7 +830,7 @@ int TWindow::char2pixel(int len) const
|
||||
{
|
||||
const TString emme(quantem, 'M');
|
||||
long& bcw = (long&)_base_char_width;
|
||||
bcw = xvt_dwin_get_text_width(win(), (char*)(const char*)emme, quantem);
|
||||
bcw = xvt_dwin_get_text_width(win(), emme, quantem);
|
||||
}
|
||||
const int pix = int(len * _base_char_width / quantem);
|
||||
return pix;
|
||||
|
Loading…
x
Reference in New Issue
Block a user