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:
guy 2005-10-03 17:36:15 +00:00
parent 318e2071f2
commit a6d80e96b1
8 changed files with 66 additions and 134 deletions

View File

@ -171,106 +171,56 @@ HIDDEN const char* producer_name(TString& firm)
// Gestione dello sfondo della finestra principale // Gestione dello sfondo della finestra principale
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
HIDDEN long backdrop_eh(WINDOW win, EVENT* ep) HIDDEN void paint_background(WINDOW win)
{ {
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); const XVT_DISPLAY_TYPE type = (XVT_DISPLAY_TYPE)xvt_vobj_get_attr(win, ATTR_DISPLAY_TYPE);
if (ADVANCED_GRAPHICS && type == XVT_DISPLAY_DIRECT_COLOR) if (ADVANCED_GRAPHICS && type == XVT_DISPLAY_DIRECT_COLOR)
{ {
const int step = 6; CPEN pen; memset(&pen, 0, sizeof(pen));
RCT r; xvt_vobj_get_client_rect(win, &r); pen.width = 7;
const int bot = r.bottom; const int R = r.bottom;
for (int x = R; x >= 0; x-=pen.width)
xvt_dwin_set_std_cpen(win, TL_PEN_HOLLOW);
CBRUSH brush = { PAT_SOLID, COLOR_BLACK };
for (int y = 0; y < bot; y += step)
{ {
brush.color = blend_colors(MASK_DARK_COLOR, MASK_LIGHT_COLOR, double(y) / double(bot)); const COLOR c = blend_colors(MASK_DARK_COLOR, MASK_LIGHT_COLOR, double(x) / double(R));
xvt_dwin_set_cbrush(win, &brush); if (c != pen.color)
r.top = y; r.bottom = y+step; {
xvt_dwin_draw_rect(win, &r); 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;
}
HIDDEN void create_backdrop(void)
{
xvtil_create_statbar();
xvtil_statbar_set("");
}
///////////////////////////////////////////////////////////
// Gestione del banner iniziale
///////////////////////////////////////////////////////////
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)
{
_updated = true;
const int BIGY = 3*CHARY/2; const int BIGY = 3*CHARY/2;
RCT r; xvt_vobj_get_client_rect(win, &r);
clear(COLOR_LTGRAY); xvtil_set_font(win, XVT_FFN_TIMES, XVT_FS_BOLD | XVT_FS_ITALIC, BIGY);
const char* t = main_app().title();
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 w = xvt_dwin_get_text_width(win, t, -1);
int a; xvt_dwin_get_font_metrics(win, NULL, &a, NULL); int a; xvt_dwin_get_font_metrics(win, NULL, &a, NULL);
int x = (r.right-w)>>1, y = (r.bottom+a)>>1 ; 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_draw_text(win, x+1, y+1, t, -1);
set_color(COLOR_BLACK, COLOR_LTGRAY); xvt_dwin_set_fore_color(win, NORMAL_COLOR);
xvt_dwin_draw_text(win, x, y, t, -1); xvt_dwin_draw_text(win, x, y, t, -1);
set_font(XVT_FFN_TIMES); xvtil_set_font(win, NULL, XVT_FS_NONE);
TString spa; TString spa;
t = (char*)producer_name(spa); t = producer_name(spa);
w = xvt_dwin_get_text_width(win, t, -1); w = xvt_dwin_get_text_width(win, t, -1);
x = (r.right-r.left-w)>>1; y = BIGY; x = (r.right-r.left-w)>>1; y = r.bottom-CHARY;
xvt_dwin_draw_text(win, x, y, t, -1); xvt_dwin_draw_text(win, x, y, t, -1);
r.left += 5; r.right -= 4; if (ADVANCED_GRAPHICS)
r.top += 5; r.bottom -= 4; {
set_pen(COLOR_WHITE); xvt_dwin_draw_rect(win, &r); xvt_dwin_draw_icon(win, r.right-40, r.bottom-40, ICON_RSRC);
xvt_rect_offset(&r, -1, -1); xvt_dwin_draw_icon(win, 8, r.bottom-40, ICON_RSRC);
set_pen(COLOR_BLACK); xvt_dwin_draw_rect(win, &r);
xvt_dwin_draw_icon(win, CHARX<<1, CHARX<<1, ICON_RSRC);
} }
else
TWindow::handler(win, ep);
} }
long TApplication::task_eh(WINDOW win, EVENT *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 // Carica colori e font
customize_controls(TRUE); customize_controls(TRUE);
// Crea il banner iniziale xvtil_create_statbar();
create_backdrop(); xvtil_statbar_set("");
do_events(); // strateggicca non scancellare do_events(); // strateggicca non scancellare
} }
break; break;
case E_UPDATE: case E_UPDATE:
backdrop_eh(win, ep); paint_background(win);
break; break;
default: default:
break; break;
@ -360,16 +310,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
switch (ep->type) switch (ep->type)
{ {
case E_CREATE: case E_CREATE:
{
TBanner banner;
while (!banner.updated())
{
xvt_sys_sleep(10);
do_events();
}
_create_ok = create(); _create_ok = create();
}
if (_create_ok) if (_create_ok)
{ {
on_firm_change(); on_firm_change();

View File

@ -1079,7 +1079,7 @@ void TControl::set_rjust(bool on)
// @doc INTERNAL // @doc INTERNAL
// @mfunc Allineamento a destra del testo // @mfunc Flag di sola lettura
void TControl::read_only(bool on) void TControl::read_only(bool on)
{ {
change_attrib(XI_ATR_READONLY, 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.top += XI_FU_MULTIPLE - 2;
rct.bottom -= Y_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); CHECKS(def, "Can't create the definition of TGroupbox_control ", text);
def->v.rect->hilight_color = MASK_LIGHT_COLOR; def->v.rect->hilight_color = MASK_LIGHT_COLOR;
def->v.rect->back_color = MASK_BACK_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); _rct = xi_create(get_interface(win), def);
CHECKD(_rct, "Can't create Groupbox_control ", cid); 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--; rt.top--; rt.bottom--;
xi_dequeue(); xi_dequeue();
@ -1215,7 +1215,7 @@ void TGroupbox_control::show(bool on)
RCT& TGroupbox_control::get_rect(RCT& r) const RCT& TGroupbox_control::get_rect(RCT& r) const
{ {
xi_get_rect(_rct, (XinRect*)&r); xi_get_rect(_rct, (XI_RCT*)&r);
return r; return r;
} }

View File

@ -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

View File

@ -257,7 +257,7 @@ void TMask::add_default_tag_buttons()
} }
TMask::TMask(const char* maskname, int num, int max) TMask::TMask(const char* maskname, int num, int max)
: _mask_num(num) : _mask_num(num), _sheet(NULL)
{ {
if (maskname && *maskname) if (maskname && *maskname)
read_mask(maskname, num, max); read_mask(maskname, num, max);
@ -2068,7 +2068,8 @@ bool TMask::load(
if (reset) _lastpos = 0; if (reset) _lastpos = 0;
fseek(f, _lastpos, SEEK_SET); fseek(f, _lastpos, SEEK_SET);
TToken_string t(256); 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()) if (t.not_empty())
{ {

View File

@ -34,7 +34,7 @@ public:
void TTable_names::add_file(int logic, const TString& table) void TTable_names::add_file(int logic, const TString& table)
{ {
TString8* id = new TString8; TString* id = new TString8;
id->format("%d", logic); id->format("%d", logic);
_names.add(table, id); _names.add(table, id);
_ids.add(table, logic); _ids.add(table, logic);

View File

@ -1446,7 +1446,7 @@ const TRectangle& TReport_field::compute_draw_rect(const TBook& book)
if (!txt.blank()) if (!txt.blank())
{ {
TString_array para; 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()) if (r.height() > get_rect().height())
r.set_height(get_rect().height()); r.set_height(get_rect().height());
if (r.height() < 100) if (r.height() < 100)

View File

@ -809,9 +809,8 @@ int TBook::compute_text_frame(const TString& tmp, const TReport_font& font, TRec
break; 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--) 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); const int pix = xvt_dwin_get_text_width(w, row, good_len);

View File

@ -553,22 +553,26 @@ void TWindow::handler(
{ {
switch(ep->type) switch(ep->type)
{ {
case E_CHAR:
on_key(e_char_to_key(ep));
break;
case E_CLOSE: case E_CLOSE:
stop_run(K_ESC); stop_run(K_ESC);
break; break;
case E_CREATE:
if (_win == NULL_WIN)
_win = win; // Gestisco meglio gli eventi che avvengono durante la creazione
break;
case E_CONTROL: case E_CONTROL:
if (ep->v.ctl.ci.type == WC_PUSHBUTTON) if (ep->v.ctl.ci.type == WC_PUSHBUTTON)
on_button(ep->v.ctl.id); on_button(ep->v.ctl.id);
break; break;
case E_UPDATE:
update();
break;
case E_CHAR:
on_key(e_char_to_key(ep));
break;
case E_DESTROY: case E_DESTROY:
_win = NULL_WIN; _win = NULL_WIN;
break; break;
case E_UPDATE:
update();
break;
default: default:
break; break;
} }
@ -635,13 +639,11 @@ void TWindow::activate(
xvt_vobj_set_enabled(win(), _active = on); xvt_vobj_set_enabled(win(), _active = on);
} }
void TWindow::set_caption(const char* title) 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 const char* TWindow::get_caption(TString& str) const
{ {
char* title = str.get_buffer(128); char* title = str.get_buffer(128);
@ -649,14 +651,12 @@ const char* TWindow::get_caption(TString& str) const
return title; return title;
} }
void TWindow::force_update() void TWindow::force_update()
{ {
if (win() != NULL_WIN) if (win() != NULL_WIN)
xvt_dwin_invalidate_rect(win(), NULL); xvt_dwin_invalidate_rect(win(), NULL);
} }
bool TWindow::save_ctools() bool TWindow::save_ctools()
{ {
if (_ctools_saved == FALSE) if (_ctools_saved == FALSE)
@ -667,7 +667,6 @@ bool TWindow::save_ctools()
return FALSE; return FALSE;
} }
bool TWindow::restore_ctools() bool TWindow::restore_ctools()
{ {
if (_ctools_saved) if (_ctools_saved)
@ -831,7 +830,7 @@ int TWindow::char2pixel(int len) const
{ {
const TString emme(quantem, 'M'); const TString emme(quantem, 'M');
long& bcw = (long&)_base_char_width; 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); const int pix = int(len * _base_char_width / quantem);
return pix; return pix;