Patch level : 2.2
Files correlati : relapp in genere Ricompilazione Demo : [ ] Commento : Migliorato test per chiavi di ricerca "veramente" complete. Corretta funzione di somma giorni alle date Aggiunte funzioni per inserire nuove pagine dinamicamente nelle maschere git-svn-id: svn://10.65.10.50/trunk@13017 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5fddb6129f
commit
10a2791486
@ -1182,7 +1182,7 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
||||
_rct = xi_create(get_interface(win), def);
|
||||
CHECKD(_rct, "Can't create Groupbox_control ", cid);
|
||||
|
||||
RCT& rt = (RCT &) _obj->v.text->rct;
|
||||
RCT& rt = (RCT&)_obj->v.text->rct;
|
||||
rt.top--; rt.bottom--;
|
||||
|
||||
xi_dequeue();
|
||||
@ -1195,6 +1195,13 @@ void TGroupbox_control::show(bool on)
|
||||
change_attrib(XI_ATR_VISIBLE, on, _rct);
|
||||
}
|
||||
|
||||
RCT& TGroupbox_control::get_rect(RCT& r) const
|
||||
{
|
||||
xi_get_rect(_rct, (XinRect*)&r);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TField
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -1889,7 +1896,7 @@ void TTagbutton_control::set_caption(const char* text)
|
||||
TToken_string cap = text;
|
||||
int num;
|
||||
XI_OBJ** tag = xi_get_member_list(_obj, &num);
|
||||
for (int i = 0; i < num; i++)
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
text = cap.get();
|
||||
if (text == NULL)
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
// @cmember Forza il focus al controllo
|
||||
virtual void set_focus() const;
|
||||
|
||||
RCT& get_rect(RCT& r) const;
|
||||
virtual RCT& get_rect(RCT& r) const;
|
||||
virtual void set_rect(const RCT& r);
|
||||
|
||||
bool on_key(KEY k);
|
||||
@ -133,6 +133,7 @@ class TGroupbox_control : public TText_control
|
||||
|
||||
public: // TControl
|
||||
virtual void show(bool on);
|
||||
virtual RCT& get_rect(RCT& r) const;
|
||||
|
||||
public:
|
||||
TGroupbox_control(WINDOW win, short cid,
|
||||
|
@ -240,19 +240,19 @@ char* TDate::string(
|
||||
}
|
||||
|
||||
TString80 df, yf, mf;
|
||||
bool letterflag = FALSE;
|
||||
bool letterflag = false;
|
||||
|
||||
// format day
|
||||
if (dayf == letters)
|
||||
{
|
||||
const real ddd(day());
|
||||
df = ddd.string("LETTERE");
|
||||
letterflag = TRUE;
|
||||
letterflag = true;
|
||||
}
|
||||
else if (dayf == weekday)
|
||||
{
|
||||
df.format("%s %d", itow(wday()), day());
|
||||
letterflag = TRUE;
|
||||
letterflag = true;
|
||||
}
|
||||
else
|
||||
df.format(dayf == brief ? "%d" : "%02d", day());
|
||||
@ -262,7 +262,7 @@ char* TDate::string(
|
||||
{
|
||||
const real ddd(year());
|
||||
yf = ddd.string("LETTERE");
|
||||
letterflag = TRUE;
|
||||
letterflag = true;
|
||||
}
|
||||
else
|
||||
if (yearf == brief)
|
||||
@ -273,7 +273,7 @@ char* TDate::string(
|
||||
// format month
|
||||
if (monthf == letters)
|
||||
{
|
||||
letterflag = TRUE;
|
||||
letterflag = true;
|
||||
mf = itom(month());
|
||||
}
|
||||
else if (monthf == quarter)
|
||||
@ -469,7 +469,7 @@ bool TDate::isdate(const char* s)
|
||||
{
|
||||
const int len = strlen(s);
|
||||
if (len != 8 && len != 10)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
int d = 0, m = 0, y = 0, i;
|
||||
if (len == 8)
|
||||
@ -498,7 +498,7 @@ bool TDate::isdate(const char* s)
|
||||
if (d < 1 || d > 31 ||
|
||||
m < 1 || m > 12 ||
|
||||
y < 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
return d <= last_day(m,y);
|
||||
}
|
||||
@ -577,10 +577,8 @@ void swap(
|
||||
const TDate& fnc_min(
|
||||
const TDate& a, // @parm Prima data da confrontare
|
||||
const TDate& b) // @parm Secondo data da confrontare
|
||||
|
||||
{
|
||||
if (a < b) return a;
|
||||
else return b;
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -589,10 +587,8 @@ const TDate& fnc_min(
|
||||
const TDate& fnc_max(
|
||||
const TDate& a, // @parm Prima data da confrontare
|
||||
const TDate& b) // @parm Secondo data da confrontare
|
||||
|
||||
{
|
||||
if (a > b) return a;
|
||||
else return b;
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -1055,6 +1055,49 @@ bool TMask::check_current_field() const
|
||||
return ok;
|
||||
}
|
||||
|
||||
WINDOW TMask::insert_page(const char* title, int where)
|
||||
{
|
||||
WINDOW w = NULL_WIN;
|
||||
if (_pages < MAX_PAGES)
|
||||
{
|
||||
w = create_interface(NULL_WIN, 0, 0, 0, 0, title, this, true);
|
||||
|
||||
if (toolwin() != NULL_WIN)
|
||||
{
|
||||
RCT rctool; xvt_vobj_get_outer_rect(toolwin(), &rctool);
|
||||
RCT rctwin; xvt_vobj_get_outer_rect(w, &rctwin);
|
||||
rctwin.bottom = rctool.top-1;
|
||||
xvt_vobj_move(w, &rctwin);
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = _pages; i > where; i--)
|
||||
_pagewin[i] = _pagewin[i-1];
|
||||
_pagewin[where] = w;
|
||||
_pages++;
|
||||
|
||||
TToken_string tags;
|
||||
for (i = 0; i < _pages; i++)
|
||||
{
|
||||
char str[80];
|
||||
tags.add(xvt_vobj_get_title(_pagewin[i], str, sizeof(str)));
|
||||
}
|
||||
|
||||
// Kill page tags
|
||||
for (i = fields()-1; i > 0; i--)
|
||||
{
|
||||
TMask_field& tag = fld(i);
|
||||
if (tag.dlg() >= DLG_PAGETAGS)
|
||||
_field.destroy(i);
|
||||
else
|
||||
break;
|
||||
}
|
||||
// Create page tags
|
||||
add_tag_buttons(tags);
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
// @mfunc Mostra la prossima/precedente pagina
|
||||
@ -1403,20 +1446,22 @@ TEditable_field* TMask::get_key_field(
|
||||
bool TMask::key_valid(word key) const
|
||||
{
|
||||
const int maxflds = fields();
|
||||
bool full = false;
|
||||
for (int f = 0; f < maxflds; f++)
|
||||
{
|
||||
TMask_field& c = fld(f);
|
||||
if (c.is_editable() && c.shown())
|
||||
if (c.is_editable() && c.shown() && c.in_key(key))
|
||||
{
|
||||
TEditable_field& e = (TEditable_field&)c;
|
||||
if (e.required() && e.in_key(key))
|
||||
if (c.empty())
|
||||
{
|
||||
if (e.empty())
|
||||
if (c.required())
|
||||
return false;
|
||||
}
|
||||
else
|
||||
full = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return full;
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -2260,6 +2305,5 @@ TYesnoallnone_box::TYesnoallnone_box(const char * message, int default_key)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TYesnoallnone_box::~TYesnoallnone_box()
|
||||
{}
|
||||
|
@ -122,6 +122,7 @@ protected:
|
||||
void init_mask();
|
||||
// @cmember Legge la pagina da file
|
||||
WINDOW read_page(TScanner& scanner, bool toolbar = false);
|
||||
WINDOW insert_page(const char* title, int where);
|
||||
|
||||
// @cmember Aggiunge i tags ad una pagina
|
||||
void add_tag_button(byte pag, TToken_string& tags, byte sel);
|
||||
|
@ -175,6 +175,9 @@ class TSpreadsheet : public TControl
|
||||
// @cmember:(INTERNAL) Bisogna salvare l'ordien delle colonne
|
||||
byte _save_columns_order;
|
||||
|
||||
// @cmember:(INTERNAL) Campo corrente che si sta editando
|
||||
TOperable_field* _f9_target;
|
||||
|
||||
// @cmember:(INTERNAL) Inizializza lo spreadsheet
|
||||
void init();
|
||||
// @cmember:(INTERNAL) Funzione che intercetta gli eventi dello spreadsheet
|
||||
@ -406,7 +409,8 @@ TSpreadsheet::TSpreadsheet(
|
||||
_mask(), _active(TRUE), _notify(NULL),
|
||||
_edit_field(NULL), _cur_row(0), _cur_rec(0), _cur_col(1),
|
||||
_row_dirty(FALSE), _cell_dirty(FALSE), _check_enabled(TRUE),
|
||||
_needs_update(-1), _selection_posted(-1), _save_columns_order(FALSE)
|
||||
_needs_update(-1), _selection_posted(-1), _save_columns_order(FALSE),
|
||||
_f9_target(NULL)
|
||||
{
|
||||
int m_width[MAX_COL], v_width[MAX_COL];
|
||||
int fixed_cols = 0; // Number of fixed columns
|
||||
@ -1512,6 +1516,11 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
_cell_dirty = TRUE;
|
||||
case K_F8:
|
||||
case K_F9:
|
||||
if (_f9_target != NULL)
|
||||
{
|
||||
_edit_field = _f9_target;
|
||||
_f9_target = NULL;
|
||||
}
|
||||
if (_edit_field != NULL)
|
||||
{
|
||||
const bool spork = _edit_field->dirty() != 0; // TBT
|
||||
@ -1547,18 +1556,18 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
|
||||
ok = _edit_field->on_key(k);
|
||||
_cell_dirty = _edit_field->dirty() != 0; // TBT
|
||||
|
||||
|
||||
_f9_target = NULL;
|
||||
if (!ok && k == K_F9) // Ricerca non completata?
|
||||
{
|
||||
_edit_field = &owner().sheet_mask().focus_field();
|
||||
const int col = field2col(_edit_field);
|
||||
|
||||
if (col != _cur_col) // Ricerca alternativa
|
||||
TOperable_field* target = &owner().sheet_mask().focus_field();
|
||||
if (_edit_field != target) // Ricerca alternativa
|
||||
{
|
||||
_cur_col = col;
|
||||
dispatch_e_char(parent(), K_F9);
|
||||
_f9_target = target;
|
||||
_cur_col = field2col(_f9_target);
|
||||
dispatch_e_char(parent(), K_F9);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
@ -3130,7 +3139,7 @@ TRectype * TSheet_field::putkey(const TRelation& r)
|
||||
}
|
||||
|
||||
// Certified: ...under debug..
|
||||
bool TSheet_field::autoload_line(int i,TRectype & rec)
|
||||
bool TSheet_field::autoload_line(int i, const TRectype& rec)
|
||||
{
|
||||
TToken_string &row= this->row(i-1);
|
||||
|
||||
@ -3147,7 +3156,7 @@ bool TSheet_field::autoload_line(int i,TRectype & rec)
|
||||
{
|
||||
TMask_field& mf = sheet_mask().fld(j);
|
||||
const short id = mf.dlg();
|
||||
TFieldref const *dbfield=mf.field();
|
||||
const TFieldref* dbfield = mf.field();
|
||||
if (dbfield)
|
||||
{
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id)
|
||||
@ -3174,7 +3183,7 @@ bool TSheet_field::autosave_line(int i,TRectype & rec)
|
||||
{
|
||||
TMask_field& mf = sheet_mask().fld(j);
|
||||
const short id = mf.dlg();
|
||||
TFieldref const *dbfield=mf.field();
|
||||
const TFieldref* dbfield=mf.field();
|
||||
if (dbfield)
|
||||
{
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id)
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
virtual bool is_sheet() const { return TRUE; }
|
||||
|
||||
// @cmember Legge automaticamente la linea dal record array assegnato
|
||||
virtual bool autoload_line(int i,TRectype & rec);
|
||||
virtual bool autoload_line(int i,const TRectype & rec);
|
||||
// @cmember Salva automaticamente la linea nel record array assegnato
|
||||
virtual bool autosave_line(int i,TRectype & rec);
|
||||
|
||||
|
@ -1784,6 +1784,27 @@ void TToken_string::add(int n, int pos)
|
||||
add(s, pos);
|
||||
}
|
||||
|
||||
void TToken_string::insert_at(const char* s, int pos)
|
||||
{
|
||||
if (pos >= 0 && not_empty())
|
||||
{
|
||||
int sep = 0;
|
||||
for (int i = 0; _str[i] && sep < pos; i++)
|
||||
{
|
||||
if (_str[i] == _separator)
|
||||
sep++;
|
||||
}
|
||||
const TString& after = mid(i);
|
||||
cut(i);
|
||||
operator <<(s);
|
||||
operator <<(_separator);
|
||||
operator <<(after);
|
||||
}
|
||||
else
|
||||
add(s, pos);
|
||||
}
|
||||
|
||||
|
||||
// Certified 50%
|
||||
void TToken_string::destroy(int n)
|
||||
{
|
||||
@ -2017,9 +2038,12 @@ TToken_string& get_tmp_string(int len)
|
||||
str = new TToken_string(len);
|
||||
ararar.add(str, next);
|
||||
}
|
||||
if (str->size() < len)
|
||||
str->spaces(len);
|
||||
str->cut(0);
|
||||
else
|
||||
{
|
||||
if (str->size() < len)
|
||||
str->spaces(len);
|
||||
str->cut(0);
|
||||
}
|
||||
|
||||
if (++next >= ararar.size())
|
||||
next = 0;
|
||||
|
@ -579,6 +579,8 @@ public:
|
||||
void add(long n, int pos = -1);
|
||||
// @cmember Aggiunge un intero
|
||||
void add(int n, int pos = -1);
|
||||
// @cmember Inserisce una stringa
|
||||
void insert_at(const char* s, int n);
|
||||
// @cmember Toglie la stringa di posizione pos
|
||||
void destroy(int pos);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user