Patch level : 10.0

Files correlati     : ca1.exe
Ricompilazione Demo : [ ]
Commento            :
Evitato di uscire da programma di stampa anialitica dopo ogni stampa


git-svn-id: svn://10.65.10.50/branches/R_10_00@22568 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-02-06 12:27:19 +00:00
parent ed1fcf7995
commit 8654b733ea
10 changed files with 108 additions and 114 deletions

View File

@ -4,7 +4,7 @@
#include <diction.h>
#include <keys.h>
#define buildmsg() char msg[1024];va_list argptr;va_start(argptr,fmt);_vsnprintf(msg,sizeof(msg),fmt,argptr);va_end(argptr);msg[1023] = '\0';
#define buildmsg() char msg[1024];va_list argptr;va_start(argptr,fmt);vsnprintf_s(msg,sizeof(msg),_TRUNCATE,fmt,argptr);va_end(argptr);
// @doc EXTERNAL
@ -142,8 +142,9 @@ bool yesnofatal_box(
buildmsg();
#ifdef DBG
char user[32]; xvt_sys_get_user_name(user, 32);
char s[256]; sprintf(s, "Ma lo sai %s cos'e' successo?\n%s\nVuoi perseverare?", user, msg);
char user[32]; xvt_sys_get_user_name(user, sizeof(user));
char s[sizeof(msg)+sizeof(user)];
sprintf_s(s, sizeof(s), "Sai %s cos'è successo?\n%s\nVuoi perseverare?", user, msg);
const bool ret = yesno_box(s);
if (!ret)
#endif

View File

@ -4,6 +4,14 @@
#include <diction.h>
#include <treectrl.h>
///////////////////////////////////////////////////////////
// Utilities
///////////////////////////////////////////////////////////
inline int Y601(int r, int g, int b)
{ return int(0.299*r + 0.587*g + 0.114*b); }
COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue)
{
COLOR def = XVT_MAKE_COLOR(red, green, blue);
@ -35,11 +43,31 @@ COLOR blend_colors(COLOR col1, COLOR col2, double perc)
COLOR grayed_color(COLOR col)
{
const unsigned int r = XVT_COLOR_GET_RED(col);
const unsigned int g = XVT_COLOR_GET_GREEN(col);
const unsigned int b = XVT_COLOR_GET_BLUE(col);
const unsigned int k = (unsigned int)(0.299 * r + 0.587 * g + 0.114 * b);
return RGB2COLOR(k, k, k);
const int luma = Y601(XVT_COLOR_GET_RED(col), XVT_COLOR_GET_GREEN(col), XVT_COLOR_GET_BLUE(col));
return RGB2COLOR(luma, luma, luma);
}
inline int rgb_clamp(double c)
{
if (c <= 0) return 0;
if (c >= 255) return 255;
return int(c+0.5);
}
// -1.0 = Black; 0.0 = Same Color; +1.0 = white
COLOR modulate_color(COLOR col, double perc)
{
int r = XVT_COLOR_GET_RED(col);
int g = XVT_COLOR_GET_GREEN(col);
int b = XVT_COLOR_GET_BLUE(col);
const int luma = rgb_clamp(Y601(r, g, b) + perc * 255);
if (luma >= 255) return COLOR_WHITE;
if (luma <= 0) return COLOR_BLACK;
r = rgb_clamp(r * (1+perc));
g = rgb_clamp(g * (1+perc));
b = rgb_clamp(b * (1+perc));
return RGB2COLOR(r, g, b);
}
///////////////////////////////////////////////////////////

View File

@ -8,6 +8,7 @@
COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue);
COLOR choose_color(COLOR col = COLOR_BLACK, WINDOW win = NULL_WIN);
COLOR blend_colors(COLOR col1, COLOR col2, double perc = 0.5);
COLOR modulate_color(COLOR col, double perc); // -1 = Black; 0 = col; +1 = White
COLOR grayed_color(COLOR col);
inline bool same_color(COLOR col1, COLOR col2) { return (col1 & 0x00FFFFFF) == (col2 & 0x00FFFFFF); }
// unsigned int color_distance(COLOR col1, COLOR col2);

View File

@ -337,20 +337,38 @@ HIDDEN XI_BITMAP* get_background_bitmap(bool reload)
if (bmp != NULL)
{
XVT_IMAGE img = (XVT_IMAGE)bmp->xin_bitmap->x;
short k, w, h; xvt_image_get_dimensions(img, &w, &h);
short 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++)
unsigned long r=0, g=0, b=0, k=0;
/*
for (short y = 0; y < h; y++)
{
const COLOR col = xvt_image_get_pixel(img, k, k);
for (short x = 0; x < w; x++)
{
const COLOR col = xvt_image_get_pixel(img, x, y);
r += XVT_COLOR_GET_RED(col);
g += XVT_COLOR_GET_GREEN(col);
b += XVT_COLOR_GET_BLUE(col);
k++;
}
}
*/
k = min(w,h);
for (short xy = 0; xy < short(k); xy++)
{
const COLOR col = xvt_image_get_pixel(img, xy, xy);
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);
MASK_LIGHT_COLOR = modulate_color(MASK_BACK_COLOR, +0.2);
MASK_DARK_COLOR = modulate_color(MASK_BACK_COLOR, -0.2);
DISABLED_BACK_COLOR = MASK_BACK_COLOR;
if (w > 512 || h > 512)
{
@ -634,16 +652,29 @@ void attach_interface(WINDOW win, COLOR back)
RCT rc; xvt_vobj_get_outer_rect(win, &rc);
char caption[80]; xvt_vobj_get_title(win, caption, 80);
char caption[128]; xvt_vobj_get_title(win, caption, 128);
TWindow* parent = (TWindow*)xvt_vobj_get_data(win);
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XI_RCT*)&rc, caption, (long)parent);
CHECK(def, "Can't define an interface");
def->v.itf->automatic_back_color = false;
def->v.itf->back_color = back;
def->v.itf->automatic_back_color = (back == 0);
if (back)
def->v.itf->back_color = back;
def->v.itf->tab_on_enter = true;
def->v.itf->win = (XinWindow)win;
if (ADVANCED_GRAPHICS && same_color(back, MASK_BACK_COLOR))
{
XI_BITMAP* bmpback = get_background_bitmap(false);
if (bmpback != NULL)
{
def->v.itf->automatic_back_color = false;
def->v.itf->back_color = 0;
def->v.itf->bitmap = bmpback;
}
}
XI_OBJ* itf = xi_create(NULL, def);
CHECK(itf, "Can't create an interface");
@ -1681,23 +1712,24 @@ bool TButton_control::event_handler(XI_OBJ* itf, XI_EVENT* xiev)
{
switch (_obj->v.btn->type)
{
case XIBT_CHECKBOX:
case XIBT_BUTTON_CHECKBOX:
toggle();
break;
default:
break;
case XIBT_CHECKBOX:
case XIBT_BUTTON_CHECKBOX:
toggle();
break;
default:
break;
}
ok = notify_key(K_SPACE);
}
}
}
else
{
if (xiev->type == XIE_POST_NAVIGATION)
ok = notify_key(K_CTRL + K_TAB);
else
ok = TControl::event_handler(itf, xiev);
}
return ok;
}

View File

@ -222,53 +222,6 @@ COLOR TImage::get_pixel(int x, int y) const
return xvt_image_get_pixel(_image, x, y);
}
/* OBSOLETA
// Certified 99%
// @doc EXTERNAL
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
void TImage::convert_to_default_colors()
// @comm Legge nell'immagine i colori CYAN e DARK_CYAN e li setta a seconda del colore
// della finestra per fare in modo di rendere trasparenti tali colori.
{
if (!same_color(MASK_BACK_COLOR, COLOR_DKCYAN))
{
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
{
for (int index = xvt_image_get_ncolors(_image)-1; index >=0; index--)
{
const COLOR c = xvt_image_get_clut(_image, index) & 0x00FFFFFF;
switch (c)
{
case COLOR_DKCYAN & 0x00FFFFFF: xvt_image_set_clut(_image, index, MASK_BACK_COLOR); break;
case COLOR_CYAN & 0x00FFFFFF: xvt_image_set_clut(_image, index, MASK_LIGHT_COLOR); break;
case COLOR_GRAY & 0x00FFFFFF: xvt_image_set_clut(_image, index, MASK_DARK_COLOR); break;
default: break;
}
}
}
else
{
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
{
const COLOR c = get_pixel(x, y) & 0x00FFFFFF;
switch (c)
{
case COLOR_DKCYAN & 0x00FFFFFF: set_pixel(x, y, MASK_BACK_COLOR); break;
case COLOR_CYAN & 0x00FFFFFF : set_pixel(x, y, MASK_LIGHT_COLOR); break;
case COLOR_GRAY & 0x00FFFFFF : set_pixel(x, y, MASK_DARK_COLOR); break;
default: break;
}
}
}
}
}
*/
// @mfunc Setta i colori dell'immagine in modo da renderla trasparente
void TImage::convert_transparent_color(COLOR transparent)
// @comm Legge nell'immagine i pixel uguali a quello in alto a sinistra e li setta
@ -281,33 +234,6 @@ void TImage::convert_transparent_color(COLOR transparent)
if (same_color(trans, transparent))
return; // Nothing to do
/*
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
{
int i = -1;
while (true)
{
const int index = xvt_image_find_clut_index(_image, trans);
if (index > i)
{
xvt_image_set_clut(_image, index, transparent);
i = index;
}
else
break;
}
}
else
{
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
{
const COLOR c = get_pixel(x, y);
if (same_color(c, trans))
set_pixel(x, y, transparent);
}
}
*/
xvt_image_replace_color(_image, trans, transparent); // New "native" method
}

View File

@ -74,10 +74,6 @@ public:
const RCT& rect() const
{ return _src; }
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
// usando i colori di default (dell'obsoleto Morpurgo)
// void convert_to_default_colors();
// @cmember Setta i colori dell'immagine in modo da renderla trasparente
// usando l'angolo in alto a sinistra dell'imagine stessa
void convert_transparent_color(COLOR transparent);

View File

@ -3326,7 +3326,7 @@ bool TReport::on_link(const TReport_link& lnk)
const int logicnum = table2logic(table);
if (logicnum >= LF_USER)
{
TRectype rec(logicnum);;
TRectype rec(logicnum);
if (logicnum == LF_TAB || logicnum == LF_TABCOM)
rec.settab(table.right(3));
@ -3379,22 +3379,26 @@ void TReport::include_libraries(bool reload)
bool TReport::print_or_preview()
{
TReport_book book;
book.add(*this);
return book.print_or_preview();
bool done = book.add(*this);
if (done)
done = book.print_or_preview();
return done;
}
bool TReport::print()
{
TReport_book book;
book.add(*this);
return book.print();
bool done = book.add(*this);
done = book.print();
return done;
}
bool TReport::preview()
{
TReport_book book;
book.add(*this);
return book.preview();
bool done = book.add(*this);
done = book.preview();
return done;
}
bool TReport::archive(bool signature)

View File

@ -25,7 +25,7 @@ bool test_assistance_year()
if (get_serial_number() > 0)
{
const int new_year = dongle().year_assist();
if (new_year >= 2002 && new_year <= dongle_year)
if (new_year >= 2008 && new_year <= dongle_year)
dongle_year = new_year;
}

View File

@ -111,7 +111,10 @@ bool fcopy(
if (o == NULL)
{
fclose(i);
return error_box(FR("Impossibile creare il file '%s' (%s)\nper copiare il file '%s'\nErrore %d"), dest, wflag, orig, errno);
if (append)
return error_box(FR("Impossibile aprire il file '%s'\nper accodare il file '%s'\nErrore %d"), dest, orig, errno);
else
return error_box(FR("Impossibile creare il file '%s'\nper copiare il file '%s'\nErrore %d"), dest, orig, errno);
}
const int size = 16*1024;
@ -133,9 +136,7 @@ bool fcopy(
return ok;
}
else
return xvt_fsys_fcopy(orig, dest) != 0 ;
return xvt_fsys_fcopy(orig, dest) != 0 ;
}
// @doc EXTERNAL

View File

@ -5,6 +5,11 @@
#include <strings.h>
#endif
#ifndef __ARRAY_H
#include <array.h>
#endif
#ifndef __INCSTR_H
#include <../xvaga/incstr.h>
#endif