Patch level : 2.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Modificone globalone


git-svn-id: svn://10.65.10.50/trunk@10895 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-03-11 09:17:38 +00:00
parent 33eceba57c
commit 6a9ae2deb2
13 changed files with 98 additions and 156 deletions

@ -66,7 +66,7 @@ void TInfo_mask::add_row(const char* prompt, unsigned long value)
}
TInfo_mask::TInfo_mask()
: TMask("Informazioni", 1, 72, 9, -1, -1), _row(0), _col(1)
: TMask("Informazioni", 1, 72, 11, -1, -1), _row(0), _col(1)
{
const word ser_no = dongle().number();
int year, release, tag, patch;
@ -109,6 +109,7 @@ TInfo_mask::TInfo_mask()
add_row(TR("Protezione"), prot);
add_row(TR("Programma"), arg);
add_row(TR("Utente"), user());
add_row(TR("Config"), CGetPrawinName());
add_row(TR("Studio"), firm2dir(-1));
add_row(TR("Ditta"), firm.codice());
add_row(TR("Valuta"), firm.codice_valuta());
@ -191,27 +192,19 @@ HIDDEN long backdrop_eh(WINDOW win, EVENT* ep)
XVT_DISPLAY_TYPE type = (XVT_DISPLAY_TYPE)xvt_vobj_get_attr(win, ATTR_DISPLAY_TYPE);
if (type == XVT_DISPLAY_DIRECT_COLOR) // True color (senza palette)
{
const int base_r = XVT_COLOR_GET_RED(MASK_DARK_COLOR);
const int base_g = XVT_COLOR_GET_GREEN(MASK_DARK_COLOR);
const int base_b = XVT_COLOR_GET_BLUE(MASK_DARK_COLOR);
const long delta_r = XVT_COLOR_GET_RED(MASK_LIGHT_COLOR) - base_r;
const long delta_g = XVT_COLOR_GET_GREEN(MASK_LIGHT_COLOR) - base_g;
const long delta_b = XVT_COLOR_GET_BLUE(MASK_LIGHT_COLOR) - base_b;
const int step = 4;
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 < r.bottom; y += step)
for (int y = 0; y < bot; y += step)
{
brush.color = RGB2COLOR(byte(base_r + delta_r * y / r.bottom),
byte(base_g + delta_g * y / r.bottom),
byte(base_b + delta_b * y / r.bottom));
brush.color = blend_colors(MASK_DARK_COLOR, MASK_LIGHT_COLOR, double(y) / double(bot));
xvt_dwin_set_cbrush(win, &brush);
RCT rct; xvt_rect_set(&rct, r.left, y, r.right, y+step);
xvt_dwin_draw_rect(win, &rct);
r.top = y; r.bottom = y+step;
xvt_dwin_draw_rect(win, &r);
}
}
else

@ -34,7 +34,7 @@ COLOR choose_color(COLOR col, WINDOW win)
return os_choose_color(col, win);
}
COLOR blend_colors(COLOR col1, COLOR col2, int perc)
COLOR blend_colors(COLOR col1, COLOR col2, double perc)
{
const unsigned int r1 = XVT_COLOR_GET_RED(col1);
const unsigned int g1 = XVT_COLOR_GET_GREEN(col1);
@ -43,9 +43,9 @@ COLOR blend_colors(COLOR col1, COLOR col2, int perc)
const unsigned int g2 = XVT_COLOR_GET_GREEN(col2);
const unsigned int b2 = XVT_COLOR_GET_BLUE(col2);
const byte r = (r1 * perc + r2*(100-perc)) / 100;
const byte g = (g1 * perc + g2*(100-perc)) / 100;
const byte b = (b1 * perc + b2*(100-perc)) / 100;
const byte r = byte(r1 * perc + r2*(1.0-perc));
const byte g = byte(g1 * perc + g2*(1.0-perc));
const byte b = byte(b1 * perc + b2*(1.0-perc));
return RGB2COLOR(r, g, b);
}

@ -11,7 +11,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, int perc = 50);
COLOR blend_colors(COLOR col1, COLOR col2, double perc = 0.5);
extern COLOR MASK_BACK_COLOR;
extern COLOR MASK_LIGHT_COLOR;

@ -230,38 +230,6 @@ static byte event_map[XIE_POST_NAVIGATION+1];
enum event_action { a_ignore, a_xvt, a_xvt_post, a_obj, a_child, a_update, a_select, a_post, a_debug };
HIDDEN void set_default_palette(WINDOW win)
{
COLOR colori[12] = { MASK_BACK_COLOR, MASK_LIGHT_COLOR, MASK_DARK_COLOR,
NORMAL_COLOR, NORMAL_BACK_COLOR,
FOCUS_COLOR, FOCUS_BACK_COLOR,
DISABLED_COLOR, DISABLED_BACK_COLOR,
BTN_BACK_COLOR, BTN_LIGHT_COLOR, BTN_DARK_COLOR };
XVT_PALETTE wp = xvt_vobj_get_palet(win);
if (wp != NULL)
{
XVT_PALETTE up = xvt_palet_create(XVT_PALETTE_USER, NULL);
if (up != NULL)
{
xvt_palet_set_tolerance(up, xvt_palet_get_tolerance(wp));
const int MAXCOL = 256;
COLOR colors[MAXCOL];
const int num = xvt_palet_get_colors(wp, colors, MAXCOL);
xvt_palet_add_colors(up, colors, num);
const int add = xvt_palet_add_colors(up, colori, 12);
if (add > 0)
{
xvt_vobj_set_palet(win, up);
xvt_palet_destroy(wp);
}
else
xvt_palet_destroy(up);
}
}
}
// @func Permette di aggiornare i colori attivi del programma
void customize_colors()
@ -303,8 +271,6 @@ void customize_colors()
BTN_DARK_COLOR = colors.get_color("ButtonDark", NULL, -1, BTN_DARK_COLOR);
aga_set_pref(AGA_PREF_BTN_COLOR_DARK, BTN_DARK_COLOR);
set_default_palette(TASK_WIN);
if (_picture)
_picture->reload();
@ -459,7 +425,6 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
EM_ALL, (EVENT_HANDLER)xi_event, (long)msk);
CHECK(win, "Can't create an XVT window for an interface");
xvt_set_font(win, NULL, 0, 0);
set_default_palette(win);
XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, (XinRect *) &r, (char*)caption, (long)msk);
CHECK(def, "Can't define an interface");
@ -1955,45 +1920,51 @@ void TDropDownList::ddl_str_eh(XI_OBJ* itf, XI_EVENT* xiev)
switch(xiev->type)
{
case XIE_CELL_REQUEST:
row = ddl->item(xiev->v.cell_request.rec);
strncpy(xiev->v.cell_request.s, (char *)row, xiev->v.cell_request.len);
xiev->v.cell_request.s[xiev->v.cell_request.len - 1] = '\0';
break;
case XIE_GET_FIRST:
if (ddl->items() == 0)
xiev->refused = TRUE;
else
if (ddl->items() > 0)
{
xiev->v.rec_request.data_rec = ddl->items() * xiev->v.rec_request.percent/100;
ddl->update_selection(xiev);
// GUY
// xiev->v.rec_request.data_rec = ddl->items() * xiev->v.rec_request.percent/100;
// ddl->update_selection(xiev);
long n = ddl->items() * (long)xiev->v.rec_request.percent / 100L;
if (n < 0L) n = 0L;
xiev->v.rec_request.data_rec = n;
}
else
xiev->refused = TRUE;
break;
case XIE_GET_LAST:
xiev->v.rec_request.data_rec = ddl->items() - 1;
ddl->update_selection(xiev);
break;
case XIE_GET_NEXT:
if (xiev->v.rec_request.spec_rec >= ddl->items()-1)
xiev->refused = TRUE;
else
{
xiev->v.rec_request.data_rec = xiev->v.rec_request.spec_rec + 1;
ddl->update_selection(xiev);
}
// GUY ddl->update_selection(xiev);
break;
case XIE_GET_PREV:
if (xiev->v.rec_request.spec_rec <= 0)
xiev->refused = TRUE;
else
case XIE_GET_NEXT:
{
xiev->v.rec_request.data_rec = xiev->v.rec_request.spec_rec - 1;
ddl->update_selection(xiev);
}
const long n = xiev->v.rec_request.spec_rec + (xiev->type == XIE_GET_NEXT ? +1 : -1) ;
if (n >= 0 && n < ddl->items())
xiev->v.rec_request.data_rec = n;
else
xiev->refused = TRUE;
}
break;
case XIE_CELL_REQUEST:
{
const long rec = xiev->v.cell_request.rec;
if (rec >= 0 && rec < ddl->items())
{
const char* row = ddl->item(xiev->v.cell_request.rec);
const int len = xiev->v.cell_request.len;
strncpy(xiev->v.cell_request.s, (char*)row, len);
xiev->v.cell_request.s[len - 1] = '\0';
}
}
break;
case XIE_GET_PERCENT:
if (ddl->items() > 1)
xiev->v.get_percent.percent = int((xiev->v.get_percent.record * 100L)/(ddl->items()-1));
{
const long rec = xiev->v.get_percent.record;
long n = ddl->items(); if (n <= 0) n = 1;
xiev->v.get_percent.percent = int(rec * 100L / n);
}
break;
case XIE_DBL_CELL:
ddl->select((int)(ddl->row2rec(xiev->v.xi_obj->v.cell.row)));

@ -2057,10 +2057,10 @@ int TBrowse::do_input(
// @comm Questa funzione serve ai <c TCursor_sheet>
{
int ne = 0;
if (_inp_id.empty()) return ne;
if (_inp_id.empty())
return ne;
TRectype& cur = _cursor->curr();
cur.zero();
TRectype filtrec(cur);
@ -2285,8 +2285,6 @@ void TBrowse::do_clear(CheckTime t)
s_checking = 0;
}
bool TBrowse::do_link(bool insert)
{
bool ok = FALSE;

@ -784,11 +784,11 @@ TFile_manager::TFile_manager()
{
TConfig prawin(CONFIG_INSTALL, "Main");
_max_open_files = prawin.get_int("MaxHandles", NULL, -1, 16);
if (_max_open_files < 8)
_max_open_files = 8;
if (_max_open_files < 16)
_max_open_files = 16;
else
if (_max_open_files > 32)
_max_open_files = 32;
if (_max_open_files > 64)
_max_open_files = 64;
}
///////////////////////////////////////////////////////////

@ -155,7 +155,7 @@ void TIndwin::update_bar()
const int lasti = (b.bottom-b.top)/2;
for (int i = 0; i <= lasti; i++)
{
set_pen(blend_colors(FOCUS_BACK_COLOR, MASK_BACK_COLOR, i * 100 / lasti));
set_pen(blend_colors(FOCUS_BACK_COLOR, MASK_BACK_COLOR, double(i) / double(lasti)));
PNT pt = { b.top+i, b.left };
xvt_dwin_draw_set_pos(w, pt);
pt.h = b.right;

@ -88,7 +88,8 @@ void TRelation_application::set_limits(
{
cur->setkey();
f.browse()->do_input(TRUE);
if (cur->items() == 0) _first = _last = -1;
if (cur->items() == 0)
_first = _last = -1;
else
{
if (what & 0x1)
@ -109,7 +110,8 @@ void TRelation_application::set_limits(
file().setkey(1);
if (what & 0x1)
{
if (file().empty()) _first = 1;
if (file().empty())
_first = 1;
else
{
file().first();
@ -118,7 +120,8 @@ void TRelation_application::set_limits(
}
if (what & 0x2)
{
if (file().empty()) _last = 1;
if (file().empty())
_last = 1;
else
{
file().last();
@ -133,8 +136,7 @@ void TRelation_application::set_find_button()
if (pos >= 0 && _mask->id2pos(DLG_FIRSTREC)) //se e' un bottone pentapartito...
{
TButton_field& f_find = (TButton_field &)_mask->fld(pos);
RCT rct_base, r;
f_find.get_rect(rct_base);
RCT rct_base; f_find.get_rect(rct_base);
const int bwidth = (rct_base.right - rct_base.left);
const int bheight = (rct_base.bottom - rct_base.top);
if (bwidth > 3*bheight/2) // Controllo se ho gia' ridimensionato i bottoni in precedenza
@ -142,10 +144,10 @@ void TRelation_application::set_find_button()
int bx = bwidth / 3;
int by = bheight / 2;
r = rct_base; r.left += bx; r.right -= bx;
RCT r = rct_base; r.left += bx-2; r.right -= bx-2;
f_find.set_rect(r); // Ridimensiona il bottone centrale di ricerca
bx += 4; by += 2; // Aggiusta dimensioni botoni sussidiari
bx += 5; by += 3; // Aggiusta dimensioni bottoni sussidiari
pos = _mask->id2pos(DLG_FIRSTREC);
if (pos >= 0)
@ -274,13 +276,13 @@ void TRelation_application::set_toolbar(bool all)
if (pos >= 0)
{
_mask->fld(pos).enable(_lnflag == 0);
const bool enable_btns = !_mask->query_mode();
pos = _mask->id2pos(DLG_FIRSTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_btns);
_mask->fld(pos).enable(_lnflag == 0 && _first > 0);
pos = _mask->id2pos(DLG_PREVREC);
const long recno = get_relation()->lfile().recno();
const bool enable_next_prev = enable_btns && !_mask->insert_mode();
const bool enable_next_prev = _mask->edit_mode();
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _first > 0 && _first != recno);
pos = _mask->id2pos(DLG_NEXTREC);
@ -288,7 +290,7 @@ void TRelation_application::set_toolbar(bool all)
_mask->fld(pos).enable(_lnflag == 0 && enable_next_prev && _last > 0 && _last != recno);
pos = _mask->id2pos(DLG_LASTREC);
if (pos >= 0)
_mask->fld(pos).enable(_lnflag == 0 && enable_btns);
_mask->fld(pos).enable(_lnflag == 0 && _last > 0);
}
pos = _mask->id2pos(DLG_NEWREC);
@ -411,7 +413,7 @@ void TRelation_application::query_mode(
}
_mask->set_mode(pre_ins ? MODE_QUERYINS : MODE_QUERY);
_mask->reset();
_mask->disable_page(1);
if (pre_ins)
{
@ -470,6 +472,8 @@ void TRelation_application::insert_mode()
::remove(workname);
_mask->open_modal();
}
else
_mask->enable_page(1);
set_mode(MODE_INS);
r->zero(); // Azzera tutta la relazione!
@ -508,9 +512,11 @@ bool TRelation_application::modify_mode()
if (changing)
_mask->open_modal();
else
_mask->enable_page(1);
set_mode(MODE_MOD);
err = read(*_mask);
if (err != NOERR)
{

@ -2083,7 +2083,15 @@ static TString buffer;
const char* TFieldref::read(TConfig& ini, const char* defpar) const
{
ini.set_paragraph(_id.empty() ? defpar : _id);
const char* para = defpar;
if (_id.not_empty())
{
if (isdigit(_id[0]))
para = _id;
else
para = _id[0] == '%' ? "4" : "5";
}
ini.set_paragraph(para);
if (!ini.exist(_name))
return "";
@ -2154,7 +2162,15 @@ void TFieldref::write(TConfig& ini, const char* defpar, const char* val) const
if ((val == NULL || *val == '\0') && !ini.exist(_name))
return;
const char* para = _id.empty() ? defpar : _id;
const char* para = defpar;
if (_id.not_empty())
{
if (isdigit(_id[0]))
para = _id;
else
para = _id[0] == '%' ? "4" : "5";
}
if (_from > 0 || _to > 0)
{
buffer = ini.get(_name, para);

@ -11,9 +11,8 @@ inline char match(char c)
TScanner::TScanner(const char* filename)
: _pushed(FALSE), _line(0),
_token(128), _key(2), _buffer(1024*16), _tmp(1024*8)
_token(128), _key(2), _tmp(1024*8)
{
// setbuf((char*)(const char*)_buffer, _buffer.size());
open(filename, ios::in | ios::nocreate, filebuf::sh_read);
if (fail())
fatal_box("Impossibile leggere il file '%s'", filename);
@ -21,11 +20,8 @@ TScanner::TScanner(const char* filename)
TScanner::~TScanner()
{
// close();
// setbuf(NULL, 0); // Altrimenti si incasina col buffer!
}
const TString& TScanner::pop()
{
if (!_pushed) do

@ -23,8 +23,6 @@ class TScanner : public ifstream
TString _token;
// @cmember:(INTERNAL) Chiave del token (prime due lettere)
TString _key;
// @cmember:(INTERNAL) Buffer utilizzato come buffer dello stream
TString _buffer;
// @cmember:(INTERNAL) Buffer utilizzato per la lettura della riga da file
TString _tmp;
// @cmember:(INTERNAL) Indica se il token e' stato ritornato al file

@ -275,12 +275,14 @@ TSheet_control::TSheet_control(
{
xi_get_rect(_obj, (XinRect *) &rct);
const int width = rct.right + 2*XI_FU_MULTIPLE;
const int width = (rct.right-rct.left) + 2*XI_FU_MULTIPLE;
if (width < cli.right)
{
cli.left += (cli.right - width) / 2;
RCT out; xvt_vobj_get_outer_rect(parent, &out);
cli.left = (cli.right - width) / 2;
cli.right = cli.left + width;
xvt_vobj_translate_points(parent, xvt_vobj_get_parent(parent), (PNT*)&cli, 2);
cli.top += out.top; // cli had left = 0 and top = 0
cli.bottom += out.top;
xvt_vobj_move(parent, &cli);
}
}
@ -993,7 +995,7 @@ TSheet::TSheet(short x, short y, short dx, short dy,
set_handler(DLG_USER, tutti_handler);
}
if (buttons & 0x01) add_button(DLG_LINK, TR("~Gestione"), K_CTRL+'G');
if (buttons & 0x01) add_button(DLG_LINK, TR("Colle~ga"), K_CTRL+'G', BMP_LINK);
if (buttons & 0x02) add_button(DLG_NEWREC, TR("~Nuovo"), K_INS, BMP_NEWREC, BMP_NEWRECDN);
if (buttons & 0x04) add_button(DLG_DELREC, "", K_DEL);
if (buttons & 0x08) add_button(DLG_QUIT, "", K_ESC);

@ -72,44 +72,6 @@ void free_global_vars()
prefix_destroy();
}
#if !defined(FOXPRO) && (XVT_OS != XVT_OS_WIN32)
// @doc EXTERNAL
// @func Operatore per la creazione di un oggetto (sostituisce operatore C++)
//
// @rdesc Ritorna il puntatore all'oggetto creato
void* operator new(size_t size)
// @comm Per maggiori informazioni fare riferimento all'omonimo comando sull'help
// in linea del C++.
// <nl>Questa funzione viene implementata se non si opera in ambiante FoxPro.
{
void* mem = (void*)malloc(size);
if (mem == NULL)
fatal_box("Out of memory: can't allocate %u bytes", size);
return mem;
}
// @doc EXTERNAL
// @func Operatore per la distruzione di un oggetto (sostituisce operatore C++)
void operator delete(
void* ptr) // @parm Puntatore all'oggetto da distruggere
// @comm Per maggiori informazioni fare riferimento all'omonimo comando sull'help
// in linea del C++.
// <nl>Nel caso venga passato un puntatore NULL viene emesso un <f CKECK>.
// <nl>Questa funzione viene implementata se non si opera in ambiante FoxPro.
{
CHECK(ptr, "Can't delete a NULL pointer");
free(ptr);
}
#endif // FOXPRO