array.cpp Corretto calcolo resize per array molto grandi (> 32000)
array.h Corretto distruttore dei TPointer_array controls.cpp Corretto disegno cornice in maschere senza tag buttons isam.cpp Eliminato include <applicat.cpp> inutilissimo mask.* Migliorato controllo campi con id duplicato git-svn-id: svn://10.65.10.50/trunk@5765 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
412275444a
commit
e394195ac8
@ -307,10 +307,15 @@ int TArray::add(
|
|||||||
//
|
//
|
||||||
// @xref <mf TArray::insert>
|
// @xref <mf TArray::insert>
|
||||||
{
|
{
|
||||||
if (index < 0) for (index = _next; index < size() && _data[index]; index++);
|
if (index < 0)
|
||||||
|
for (index = _next; index < size() && _data[index]; index++);
|
||||||
if (index >= size()) resize(int(3L*index/2) + 1);
|
if (index >= size())
|
||||||
|
{
|
||||||
|
long newsize = 3L * index / 2 + 1;
|
||||||
|
if (newsize > INT_MAX)
|
||||||
|
newsize = INT_MAX;
|
||||||
|
resize((int)newsize);
|
||||||
|
}
|
||||||
if (_data[index] != NULL)
|
if (_data[index] != NULL)
|
||||||
{
|
{
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
@ -208,6 +208,7 @@ inline TObject& TArray::operator[] (int index) const
|
|||||||
|
|
||||||
class TPointer_array : public TArray
|
class TPointer_array : public TArray
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
virtual bool destroy(int index = -1, bool pack = FALSE);
|
virtual bool destroy(int index = -1, bool pack = FALSE);
|
||||||
virtual int add(const TObject& object, int index);
|
virtual int add(const TObject& object, int index);
|
||||||
virtual int insert(const TObject& object, int index = 0, bool force = FALSE);
|
virtual int insert(const TObject& object, int index = 0, bool force = FALSE);
|
||||||
@ -216,7 +217,7 @@ class TPointer_array : public TArray
|
|||||||
TPointer_array() { }
|
TPointer_array() { }
|
||||||
TPointer_array(int size) : TArray(size) { }
|
TPointer_array(int size) : TArray(size) { }
|
||||||
TPointer_array(const TArray& a) { *this = a; }
|
TPointer_array(const TArray& a) { *this = a; }
|
||||||
virtual ~TPointer_array() { }
|
virtual ~TPointer_array() { destroy(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
@ -440,12 +440,11 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
|||||||
xvt_vobj_move(win, &r);
|
xvt_vobj_move(win, &r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag)
|
|
||||||
{
|
|
||||||
XI_RCT rct; xi_get_xi_rct(itf, &rct);
|
XI_RCT rct; xi_get_xi_rct(itf, &rct);
|
||||||
|
if (tag)
|
||||||
rct.top += Y_FU_MULTIPLE; // Lascia lo spazio per i Bottoni di cambio pagina
|
rct.top += Y_FU_MULTIPLE; // Lascia lo spazio per i Bottoni di cambio pagina
|
||||||
|
|
||||||
def = xi_add_rect_def(NULL, MASK_RECT_ID, &rct, XI_ATR_VISIBLE, 0, 0);
|
def = xi_add_rect_def(NULL, tag ? MASK_RECT_ID : -1, &rct, XI_ATR_VISIBLE, 0, 0);
|
||||||
XI_OBJ* obj = xi_create(itf, def);
|
XI_OBJ* obj = xi_create(itf, def);
|
||||||
CHECK(obj, "Can't create page rectangle");
|
CHECK(obj, "Can't create page rectangle");
|
||||||
|
|
||||||
@ -457,7 +456,6 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
|||||||
|
|
||||||
xi_dequeue();
|
xi_dequeue();
|
||||||
xi_tree_free(def);
|
xi_tree_free(def);
|
||||||
}
|
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#define __ISAM_CPP
|
#define __ISAM_CPP
|
||||||
|
|
||||||
#ifndef FOXPRO
|
#ifndef FOXPRO
|
||||||
#include <applicat.h>
|
|
||||||
#include <expr.h>
|
#include <expr.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
@ -1984,7 +1983,7 @@ int TSystemisamfile::exec_convapp(
|
|||||||
TToken_string s(conv.get(v, NULL, num()), ' ');
|
TToken_string s(conv.get(v, NULL, num()), ' ');
|
||||||
TFilename f(s.get(0));
|
TFilename f(s.get(0));
|
||||||
f.ext(".exe");
|
f.ext(".exe");
|
||||||
s << " " << main_app().get_firm();
|
s << " " << prefix().get_codditta();
|
||||||
TExternal_app app(s);
|
TExternal_app app(s);
|
||||||
|
|
||||||
if (app.can_run())
|
if (app.can_run())
|
||||||
@ -2354,7 +2353,7 @@ int TSystemisamfile::load(
|
|||||||
TDate d(TODAY);
|
TDate d(TODAY);
|
||||||
TLocalisamfile ditte(LF_NDITTE);
|
TLocalisamfile ditte(LF_NDITTE);
|
||||||
|
|
||||||
firm.format("%05ld", main_app().get_firm());
|
firm.format("%05ld", prefix().get_codditta());
|
||||||
year.format("%04d", d.year());
|
year.format("%04d", d.year());
|
||||||
ditte.zero();
|
ditte.zero();
|
||||||
ditte.put("CODDITTA", firm);
|
ditte.put("CODDITTA", firm);
|
||||||
|
@ -165,6 +165,20 @@ void TMask::read_mask(
|
|||||||
_total_time = clock()-start_t;
|
_total_time = clock()-start_t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TMask::add_field(TMask_field* f)
|
||||||
|
{
|
||||||
|
const long pos = _field.add(f)+1;
|
||||||
|
const short id = f->dlg();
|
||||||
|
if (id > 0 && id < 512)
|
||||||
|
{
|
||||||
|
#ifdef DBG
|
||||||
|
if (_position.objptr(id))
|
||||||
|
NFCHECK("Il campo %d e' duplicato!", id);
|
||||||
|
#endif
|
||||||
|
_position.TArray::add((TObject*)pos, id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TMask::add_tag_button(byte pag, TToken_string& tags, byte sel)
|
void TMask::add_tag_button(byte pag, TToken_string& tags, byte sel)
|
||||||
{
|
{
|
||||||
TPage_field* pf = new TPage_field(this);
|
TPage_field* pf = new TPage_field(this);
|
||||||
@ -172,8 +186,7 @@ void TMask::add_tag_button(byte pag, TToken_string& tags, byte sel)
|
|||||||
pf->replace_items("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16", tags);
|
pf->replace_items("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16", tags);
|
||||||
pf->set_default(sel);
|
pf->set_default(sel);
|
||||||
pf->create(_pagewin[pag]);
|
pf->create(_pagewin[pag]);
|
||||||
|
add_field(pf);
|
||||||
_field.add(pf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMask::add_tag_buttons(TToken_string& tags)
|
void TMask::add_tag_buttons(TToken_string& tags)
|
||||||
@ -494,6 +507,7 @@ int TMask::id2pos(
|
|||||||
// @comm Cerca nella maschera il campo con identificatore <p id> e ne ritorna il numero ordinale
|
// @comm Cerca nella maschera il campo con identificatore <p id> e ne ritorna il numero ordinale
|
||||||
// (es. il campo 120 e' il quarto della maschera)
|
// (es. il campo 120 e' il quarto della maschera)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
const int MAX_FIELDS = 256;
|
const int MAX_FIELDS = 256;
|
||||||
static byte positions[MAX_FIELDS]; // 100 <= id < MAX_FIELDS
|
static byte positions[MAX_FIELDS]; // 100 <= id < MAX_FIELDS
|
||||||
const int max = fields();
|
const int max = fields();
|
||||||
@ -523,6 +537,16 @@ int TMask::id2pos(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return -1; // Not found!
|
return -1; // Not found!
|
||||||
|
*/
|
||||||
|
int pos = -1;
|
||||||
|
if (id > 0 && id < 512)
|
||||||
|
pos = int(long(_position.objptr(id))-1);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (pos = fields()-1; pos >= 0; pos--)
|
||||||
|
if (fld(pos).dlg() == id) break;
|
||||||
|
}
|
||||||
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -533,7 +557,7 @@ TMask_field& TMask::field(short id) const
|
|||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
{
|
{
|
||||||
yesnofatal_box("Il campo %d non esiste", id);
|
NFCHECK("Il campo %d non esiste", id);
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -937,7 +961,7 @@ WINDOW TMask::read_page(
|
|||||||
const long start = clock();
|
const long start = clock();
|
||||||
|
|
||||||
f->construct(scanner, w);
|
f->construct(scanner, w);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
|
|
||||||
_build_time += clock()-start;
|
_build_time += clock()-start;
|
||||||
}
|
}
|
||||||
@ -1498,7 +1522,7 @@ TMask_field& TMask::add_static (
|
|||||||
{
|
{
|
||||||
TText_field* f = new TText_field(this);
|
TText_field* f = new TText_field(this);
|
||||||
f->construct(id, prompt, x, y, 0, _pagewin[page], flags);
|
f->construct(id, prompt, x, y, 0, _pagewin[page], flags);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1522,7 +1546,7 @@ TEdit_field& TMask::add_string (
|
|||||||
{
|
{
|
||||||
TEdit_field* f = new TEdit_field(this);
|
TEdit_field* f = new TEdit_field(this);
|
||||||
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, width);
|
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, width);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1550,7 +1574,7 @@ TButton_field& TMask::add_button (
|
|||||||
f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx);
|
f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx);
|
||||||
if (bmpup > 0)
|
if (bmpup > 0)
|
||||||
f->set_bmp(bmpup, bmpdn);
|
f->set_bmp(bmpup, bmpdn);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1572,7 +1596,7 @@ TBoolean_field& TMask::add_boolean (
|
|||||||
{
|
{
|
||||||
TBoolean_field* f = new TBoolean_field(this);
|
TBoolean_field* f = new TBoolean_field(this);
|
||||||
f->construct(id, prompt, x, y, strlen(prompt), _pagewin[page], flags);
|
f->construct(id, prompt, x, y, strlen(prompt), _pagewin[page], flags);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1596,7 +1620,7 @@ TReal_field& TMask::add_number (
|
|||||||
{
|
{
|
||||||
TReal_field* f = new TReal_field(this);
|
TReal_field* f = new TReal_field(this);
|
||||||
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, ndec);
|
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, ndec);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1618,7 +1642,7 @@ TDate_field& TMask::add_date (
|
|||||||
{
|
{
|
||||||
TDate_field* f = new TDate_field(this);
|
TDate_field* f = new TDate_field(this);
|
||||||
f->construct(id, prompt, x, y, 10, _pagewin[page], flags);
|
f->construct(id, prompt, x, y, 10, _pagewin[page], flags);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1644,7 +1668,7 @@ TList_field& TMask::add_list (
|
|||||||
TList_field* f = new TList_field(this);
|
TList_field* f = new TList_field(this);
|
||||||
f->construct(id, prompt, x, y, dim, _pagewin[page], flags);
|
f->construct(id, prompt, x, y, dim, _pagewin[page], flags);
|
||||||
f->replace_items(codes,items);
|
f->replace_items(codes,items);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1670,7 +1694,7 @@ TRadio_field& TMask::add_radio(
|
|||||||
TRadio_field* f = new TRadio_field(this);
|
TRadio_field* f = new TRadio_field(this);
|
||||||
f->replace_items(codes, items);
|
f->replace_items(codes, items);
|
||||||
f->construct(id, prompt, x, y, dx, _pagewin[page], flags, dx);
|
f->construct(id, prompt, x, y, dx, _pagewin[page], flags, dx);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1695,7 +1719,7 @@ TZoom_field& TMask::add_zoom (
|
|||||||
{
|
{
|
||||||
TZoom_field* f = new TZoom_field(this);
|
TZoom_field* f = new TZoom_field(this);
|
||||||
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, width);
|
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, width);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1719,7 +1743,7 @@ TMemo_field& TMask::add_memo(
|
|||||||
{
|
{
|
||||||
TMemo_field* f = new TMemo_field(this);
|
TMemo_field* f = new TMemo_field(this);
|
||||||
f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx);
|
f->construct(id, prompt, x, y, dy, _pagewin[page], flags, dx);
|
||||||
_field.add(f);
|
add_field(f);
|
||||||
return *f;
|
return *f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,9 @@ class TMask : public TWindow
|
|||||||
// @cmember:(INTERNAL) Ultimo offset letto nel file di salvataggio
|
// @cmember:(INTERNAL) Ultimo offset letto nel file di salvataggio
|
||||||
long _lastpos;
|
long _lastpos;
|
||||||
|
|
||||||
|
// @cmember:(INTERNAL) Array per convertire da id a posizione
|
||||||
|
TPointer_array _position;
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Cambio attuale per i cambi in valuta
|
// @cmember:(INTERNAL) Cambio attuale per i cambi in valuta
|
||||||
real _exchange;
|
real _exchange;
|
||||||
// @cmember:(INTERNAL) Controlla se la maschera deve fare i controlli iniziali di validita' dei campi
|
// @cmember:(INTERNAL) Controlla se la maschera deve fare i controlli iniziali di validita' dei campi
|
||||||
@ -112,6 +115,9 @@ class TMask : public TWindow
|
|||||||
protected:
|
protected:
|
||||||
TArray& fields_array() { return _field; }
|
TArray& fields_array() { return _field; }
|
||||||
|
|
||||||
|
// Aggiunge un campo all'array _field
|
||||||
|
void add_field(TMask_field* f);
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Numero di sheet contenuti nella maschera
|
// @cmember:(INTERNAL) Numero di sheet contenuti nella maschera
|
||||||
int _sheets;
|
int _sheets;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user