Patch level : 10.0 760

Files correlati     : ve1.exe
Ricompilazione Demo : [ ]
Commento            :
0001653: 002554 - Dania - modulo di stampa fatture
La stampa delle fatture non stampa l'ultima riga della descrizione, nel caso di diverse righe di descrizione aggiuntiva. (bug 1653)


git-svn-id: svn://10.65.10.50/trunk@20560 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2010-06-09 14:59:42 +00:00
parent 6c5e0ac5ee
commit 48a8bdb667
11 changed files with 82 additions and 35 deletions

View File

@ -18,7 +18,6 @@ extern COLOR MASK_DARK_COLOR;
extern COLOR BTN_BACK_COLOR;
extern COLOR BTN_LIGHT_COLOR;
extern COLOR BTN_DARK_COLOR;
extern COLOR TOOL_BACK_COLOR;
extern COLOR NORMAL_COLOR;
extern COLOR NORMAL_BACK_COLOR;
extern COLOR PROMPT_COLOR;

View File

@ -27,7 +27,6 @@ COLOR MASK_DARK_COLOR = COLOR_GRAY;
COLOR BTN_BACK_COLOR = COLOR_LTGRAY;
COLOR BTN_LIGHT_COLOR = COLOR_WHITE;
COLOR BTN_DARK_COLOR = COLOR_GRAY;
COLOR TOOL_BACK_COLOR = COLOR_GRAY;
COLOR NORMAL_COLOR = COLOR_BLACK;
COLOR NORMAL_BACK_COLOR = COLOR_WHITE;
COLOR PROMPT_COLOR = NORMAL_COLOR;
@ -321,12 +320,48 @@ HIDDEN XI_BITMAP* get_background_bitmap(bool reload)
{
TFilename back = ini_get_string(CONFIG_GUI, "Colors", "Tile");
if (back.custom_path())
{
bmp = xi_bitmap_create(back.get_buffer(), XI_BITMAP_TILE);
if (bmp != NULL)
{
XVT_IMAGE img = (XVT_IMAGE)bmp->xin_bitmap->x;
short k, w, h; xvt_image_get_dimensions(img, &w, &h);
unsigned long r=0, g=0, b=0;
for (k = 0; k < w && k < h; k++)
{
const COLOR col = xvt_image_get_pixel(img, k, k);
r += XVT_COLOR_GET_RED(col);
g += XVT_COLOR_GET_GREEN(col);
b += XVT_COLOR_GET_BLUE(col);
}
r = (r+k/2)/k; g = (g+k/2)/k; b = (b+k/2)/k;
MASK_BACK_COLOR = XVT_MAKE_COLOR(r, g, b); // Mean texture color
MASK_LIGHT_COLOR = blend_colors(COLOR_WHITE, MASK_BACK_COLOR);
MASK_DARK_COLOR = blend_colors(COLOR_BLACK, MASK_BACK_COLOR);
if (w > 512 || h > 512)
{
bmp->mode = XI_BITMAP_NORMAL;
bmp->hcenter = bmp->vcenter = TRUE;
bmp->background = MASK_BACK_COLOR;
}
}
}
}
}
return bmp;
}
XVT_IMAGE get_background_texture()
{
XVT_IMAGE img = NULL;
XI_BITMAP* bmp = get_background_bitmap(false);
if (bmp != NULL)
img = (XVT_IMAGE)bmp->xin_bitmap->x;
return img;
}
static byte event_map[XIE_LAST_EVENT];
enum event_action { a_ignore, a_xvt, a_xvt_post, a_obj, a_child, a_update, a_select, a_post, a_debug };
@ -354,7 +389,6 @@ void customize_colors()
DISABLED_BACK_COLOR = colors.get_color("DisabledBack", NULL, -1, DISABLED_BACK_COLOR);
FOCUS_COLOR = colors.get_color("Focus", NULL, -1, FOCUS_COLOR);
FOCUS_BACK_COLOR = colors.get_color("FocusBack", NULL, -1, FOCUS_BACK_COLOR);
TOOL_BACK_COLOR = colors.get_color("ToolBack", NULL, -1, MASK_DARK_COLOR);
CAMPI_SCAVATI = colors.get_bool("Campi3D", NULL, -1, CAMPI_SCAVATI);
AUTOSELECT = colors.get_bool("AutoSelect", NULL, -1, AUTOSELECT);
AUTOZOOM = colors.get_bool("AutoZoom", NULL, -1, AUTOZOOM);
@ -1242,6 +1276,7 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
def->v.rect->hilight_color = MASK_LIGHT_COLOR;
def->v.rect->back_color = MASK_BACK_COLOR;
def->v.rect->shadow_color = MASK_DARK_COLOR;
def->v.rect->bitmap = get_background_bitmap(false);
const bool erre = strchr(flags, 'R') != NULL;
if (erre)

View File

@ -31,6 +31,7 @@ void attach_interface(WINDOW win, COLOR back);
short low_get_focus_id(WINDOW win);
void low_set_focus_id(WINDOW win, short cid);
bool has_virtual_keyboard();
XVT_IMAGE get_background_texture();
///////////////////////////////////////////////////////////
// Custom control

View File

@ -403,7 +403,7 @@ bool TDate::is_holiday() const
return true;
if ((m == 12) && ((d == 8) || (d == 25) || (d == 26)))
return true;
if (m == 3 || m == 4 && wday() == 1)
if (m == 3 || m == 4 && wday() == 1) // Lunedi di Pasqua (puo'succedere solo in Marzo o Aprile)
{
TDate angelo;
angelo.set_easter(year());
@ -474,9 +474,15 @@ void TDate::addmonth(int nmonth)
void TDate::addyear(int nyear)
{
const int wday = day();
int wday = day();
const int wmonth = month();
const int wyear = year() + nyear;
if (wmonth == 2)
{
const int last = last_day(wmonth, wyear);
if (wday > last)
wday = last;
}
_val = makedata(wday, wmonth, wyear);
}
@ -518,12 +524,8 @@ bool TDate::isdate(const char* s)
return d <= last_day(m,y);
}
bool TDate::ok() const
{
return _val > 0;
}
{ return _val > 0; }
// @doc EXTERNAL
@ -542,7 +544,6 @@ TDate operator +(
return tmp;
}
TDate operator +(const long nday, const TDate& b)
{
TDate tmp(b);

View File

@ -1303,7 +1303,7 @@ bool Tdninst::can_I_run(const bool is_personal_program) const
{
TFilename cmdline = main_app().argv(0);
cmdline = cmdline.name_only();
if (cmdline.starts_with("ba", true))
if (cmdline.starts_with("ba", true) || cmdline.ends_with("cnv", true))
return true;
const bool me = is_personal_program || cmdline.len()>3;

View File

@ -1348,8 +1348,11 @@ WINDOW TMask::create_bar(int height)
w = xvt_toolbar_create(-1, 0, 0, -1, TOOL_SIZE, flags, win()); // Top bar
XVT_COLOR_COMPONENT cc[4]; memset(cc, 0, sizeof(cc));
cc[0].type = XVT_COLOR_BLEND; cc[0].color = MASK_BACK_COLOR;
cc[1].type = XVT_COLOR_FOREGROUND; cc[1].color = NORMAL_COLOR;
cc[1].type = XVT_COLOR_FOREGROUND; cc[1].color = PROMPT_COLOR;
xvt_ctl_set_colors(w, cc, XVT_COLOR_ACTION_SET);
XVT_IMAGE txt = get_background_texture();
if (txt != NULL)
xvt_ctl_set_texture(w, txt);
}
insert_bar(w); // Inserisce toolbar e crea notebook, se necessario
return w;

View File

@ -1484,7 +1484,7 @@ const TString& TReport_field::formatted_text() const
tmp << _picture << ' ' << _var.as_string();
return tmp;
}
if (dynamic_height())
if (dynamic_height() && !_var.is_empty())
{
TString& tmp = get_tmp_string();
tmp = _var.as_string();

View File

@ -129,29 +129,35 @@ bool finisce_per_punto(const TString& str)
void advanced_draw_paragraph(WINDOW win, const TString_array& para, const RCT& rct,
char halign, char valign, int default_10row_height)
{
const int rows = para.items();
if (rows > 1) // Devo scrivere piu' righe?
const int needed_rows = para.items();
if (needed_rows > 1) // Devo scrivere piu' righe?
{
int leading, ascent, descent;
xvt_dwin_get_font_metrics(win, &leading, &ascent, &descent);
int ky10 = (leading + ascent + descent) * 10;
const int rct_height = rct.bottom - rct.top;
const int row_height = leading + ascent + descent;
int ky10 = row_height * 10;
// Aggiusta l'altezza di una riga standard, se necessario
if (ky10 < default_10row_height && ky10 > 75*default_10row_height/100)
ky10 = default_10row_height;
const int rct_height = rct.bottom - rct.top;
{
const int avail_rows = (rct_height+row_height/4)/row_height;
if (avail_rows > needed_rows)
ky10 = default_10row_height; else
if (avail_rows >= 4 && avail_rows >= needed_rows-1)
ky10 = rct_height*10/needed_rows;
}
int ybase = rct.top;
switch (valign)
{
case 'C': ybase += (rct_height - (rows * ky10) / 10) / 2; break;
case 'B': ybase += rct_height - (rows * ky10) / 10; break;
case 'C': ybase += (rct_height - (needed_rows * ky10) / 10) / 2; break;
case 'B': ybase += rct_height - (needed_rows * ky10) / 10; break;
default : break;
}
const int lastop = rct.bottom - ky10/20; // Ultima y valida = base del rettangolo MENO mezza riga
for (int row = 0; row < rows; row++)
for (int row = 0; row < needed_rows; row++)
{
const int top = ybase + (ky10 * row) / 10;
if (top < lastop)
@ -163,7 +169,7 @@ void advanced_draw_paragraph(WINDOW win, const TString_array& para, const RCT& r
rctline.top = top;
rctline.bottom = ybase + (ky10 * (row+1)) / 10; // top + ky10 / 10;
char ha = halign;
if (ha == 'J' && (row == rows-1 || finisce_per_punto(line)))
if (ha == 'J' && (row == needed_rows-1 || finisce_per_punto(line)))
ha = 'L'; // Le righe finali non vanno giustificate
advanced_draw_text_line(win, line, rctline, ha, 'T');
}
@ -867,12 +873,6 @@ int TBook::compute_text_frame(const TString& tmp, const TReport_font& font, TRep
WINDOW w = _printwin->win();
CHECK(w == PRINTER_WIN, "Finestra di stampa non valida");
xvt_dwin_set_font(w, font.get_xvt_font(*_printwin));
int leading, ascent, descent;
xvt_dwin_get_font_metrics(w, &leading, &ascent, &descent);
int ky10 = (leading + ascent + descent) * 10;
// Aggiusta l'altezza di 10 righe standard, se necessario
if (ky10 < def_10row_height && ky10 > 75*def_10row_height/100)
ky10 = def_10row_height;
TToken_string p(tmp, '\n');
FOR_EACH_TOKEN(p, line)
@ -914,6 +914,13 @@ int TBook::compute_text_frame(const TString& tmp, const TReport_font& font, TRep
}
}
int leading, ascent, descent;
xvt_dwin_get_font_metrics(w, &leading, &ascent, &descent);
int ky10 = (leading + ascent + descent) * 10;
// Aggiusta l'altezza di 10 righe standard, se necessario
if (ky10 < def_10row_height && ky10 > 75*def_10row_height/100)
ky10 = def_10row_height;
int h = para.items() * ky10 * 100 / def_10row_height;
const int resto = h % 100;
if (resto != 0)

View File

@ -2055,9 +2055,9 @@ void TParagraph_string::tokenize()
}
if (add_now >= start)
{
TString256 tok = sub(start, add_now);
tok.rtrim(); // Preserva gli spazi iniziali dopo un a capo forzato da \n
const TString& tok = sub(start, add_now);
tmp.add(tok);
tmp.rtrim(); // Preserva gli spazi iniziali dopo un a capo forzato da \n
start = add_now + (_str[add_now] <= ' ');
last_space = start;
}

View File

@ -649,8 +649,9 @@ TOutlook_window::TOutlook_window(int x, int y, int dx, int dy, WINDOW parent, TO
: TControl_host_window(x, y, dx, dy, parent, owner)
{
XVT_COLOR_COMPONENT xcc[4]; memset(xcc, 0, sizeof(xcc));
xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = BTN_BACK_COLOR;
xcc[0].type = XVT_COLOR_BACKGROUND; xcc[0].color = MASK_BACK_COLOR;
xcc[1].type = XVT_COLOR_FOREGROUND; xcc[1].color = PROMPT_COLOR;
xcc[2].type = XVT_COLOR_HIGHLIGHT; xcc[2].color = MASK_LIGHT_COLOR;
WIN_DEF wd; memset(&wd, 0, sizeof(wd));
wd.wtype = WC_OUTLOOKBAR;

View File

@ -177,12 +177,12 @@ public:
// @base public | TVariable_rectype
class TAuto_variable_rectype : public TVariable_rectype
// @author:(INTERNAL) Sandro
// @author:(INTERNAL) Alex
{
protected:
virtual bool auto_virtual_fields() const { return TRUE; }
virtual bool auto_virtual_fields() const { return true; }
public:
// @cmember Costruttore Costruisce un record staccato da un file.