array.cpp Corretta packing nella remove/destroy
colors.h Aggiunto colore della toolbar controls.cpp Aggiunto supporto per il colore di sfondo controls.h Aggiunti metodi set/get_back_color form.cpp Reindentato mask.cpp Aggiunto supporto per il colore della toolbar mask.h Resa pubblica la funzione toolwin() maskfld.cpp Aggiunto supporto per il colore dello sfondo maskfld.h Aggiunta funzione set_back_color ai campi msksheet.cpp Corretto metodi insert e destroy pagsca.h Aggiunto campo PASSATT relapp.cpp Cambiati messaggi di richiesta di proseguire in caso d'errore relation.cpp Corretta lfile che non falliva mai anche se avrebbe dovuto xvtility.cpp Aggiunta funzione xvt_ctrl_set_back_color xvtility.h Come sopra git-svn-id: svn://10.65.10.50/trunk@2005 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e77565deb7
commit
aec59575dc
@ -262,10 +262,12 @@ int TArray::insert(const TObject& object, int index)
|
||||
TObject* TArray::remove(
|
||||
int index, // @parm Indica la posizione dell'elemento da eliminare
|
||||
bool dopack) // @parm Indica se si vuole richiamare la funzione
|
||||
// <mf TArray::pack> (default FALSE) per il compattamento dell'array
|
||||
// <mf TArray::pack> (default FALSE) per spostare gli elementi successivi dell'array
|
||||
|
||||
// @rdesc Ritorna l'elemento dell'array eliminato senza farne la delete
|
||||
{
|
||||
{
|
||||
CHECKD(index >= 0 && index < _size, "Can't remove array item ", index);
|
||||
|
||||
TObject* o = objptr(index);
|
||||
if (o)
|
||||
{
|
||||
@ -274,7 +276,13 @@ TObject* TArray::remove(
|
||||
if (index < _next)
|
||||
_next = index;
|
||||
}
|
||||
if (dopack) pack();
|
||||
if (dopack)
|
||||
{
|
||||
const int last = _size-1;
|
||||
for (int i = index ; i < last; i++)
|
||||
_data[i] = _data[i+1];
|
||||
_data[last] = NULL;
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
extern COLOR MASK_BACK_COLOR;
|
||||
extern COLOR MASK_LIGHT_COLOR;
|
||||
extern COLOR MASK_DARK_COLOR;
|
||||
extern COLOR TOOL_BACK_COLOR;
|
||||
extern COLOR NORMAL_COLOR;
|
||||
extern COLOR NORMAL_BACK_COLOR;
|
||||
extern COLOR DISABLED_COLOR;
|
||||
|
@ -141,8 +141,9 @@ void TControl::create(
|
||||
short left, short top, short right, short bottom, const char* title,
|
||||
WINDOW parent, long flags, long app_data, short id)
|
||||
{
|
||||
bool bold = FALSE;
|
||||
_color = NORMAL_COLOR;
|
||||
bool bold = FALSE;
|
||||
_color = NORMAL_COLOR;
|
||||
_backcolor = MASK_BACK_COLOR;
|
||||
|
||||
while (*title == '@' || *title == '$')
|
||||
{
|
||||
@ -163,7 +164,7 @@ void TControl::create(
|
||||
}
|
||||
while (*title != ']') // Find ]
|
||||
{
|
||||
CHECK(*title, "Bad prompt format");
|
||||
CHECK(*title, "Bad prompt color format");
|
||||
title++;
|
||||
}
|
||||
break;
|
||||
@ -312,7 +313,7 @@ void TControl::update() const
|
||||
{
|
||||
if (_win != _hdc)
|
||||
get_geometry(_win);
|
||||
xvt_dwin_clear(_hdc, MASK_BACK_COLOR);
|
||||
xvt_dwin_clear(_hdc, _backcolor);
|
||||
xvt_dwin_set_fore_color(_hdc, disabled() ? DISABLED_COLOR : color());
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,8 @@ WINDOW xvt_create_checkbox(
|
||||
{
|
||||
WINDOW _win;
|
||||
short _id;
|
||||
TString80 _caption;
|
||||
COLOR _color;
|
||||
TString _caption;
|
||||
COLOR _color, _backcolor;
|
||||
|
||||
bool _disabled : 1;
|
||||
bool _checked : 1;
|
||||
@ -91,6 +91,9 @@ public:
|
||||
|
||||
COLOR color() const { return _color; }
|
||||
void set_color(COLOR c) { _color = c; }
|
||||
|
||||
COLOR back_color() const { return _backcolor; }
|
||||
void set_back_color(COLOR c) { _backcolor = c; }
|
||||
|
||||
bool checked() const { return _checked; }
|
||||
virtual void check(bool on);
|
||||
|
@ -2261,12 +2261,17 @@ bool TForm::print(long from, long to)
|
||||
TString s("La lunghezza totale della sezione ");
|
||||
switch ( t )
|
||||
{
|
||||
case odd_page: s << "standard"; break;
|
||||
case even_page: s << "pagine pari"; break;
|
||||
case first_page: s << "prima pagina"; break;
|
||||
case last_page: s << "ultima pagina"; break;
|
||||
default: break;
|
||||
}
|
||||
case odd_page:
|
||||
s << "standard"; break;
|
||||
case even_page:
|
||||
s << "pagine pari"; break;
|
||||
case first_page:
|
||||
s << "prima pagina"; break;
|
||||
case last_page:
|
||||
s << "ultima pagina"; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
s << " eccede la lunghezza reale del foglio.";
|
||||
message_box(s);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
||||
RCT r; xvt_vobj_get_client_rect(win, &r); r.right--; r.bottom--;
|
||||
xvt_draw_rect(win, r, MASK_LIGHT_COLOR, MASK_DARK_COLOR, 1);
|
||||
}
|
||||
else xvt_dwin_clear(win, MASK_DARK_COLOR);
|
||||
else xvt_dwin_clear(win, TOOL_BACK_COLOR);
|
||||
xvt_tx_process_event(win, ep);
|
||||
#else
|
||||
xvt_dwin_clear(win, MASK_BACK_COLOR);
|
||||
@ -948,7 +948,7 @@ TMask_field* TMask::parse_field(TScanner& scanner)
|
||||
// @rdesc Ritorna l'andle della finestra creata
|
||||
WINDOW TMask::read_page(
|
||||
TScanner& scanner, // @parm File dal quale leggere la pagina
|
||||
bool toolbar) // @parm Indica se esiste la toolbar
|
||||
bool toolbar) // @parm Indica se e' la toolbar
|
||||
|
||||
// @comm Il parametro <p toolbar> e' utilizzato per indicare se la pagina deve essere visualizzata
|
||||
// a tutto schermo (TRUE) oppure no
|
||||
@ -1009,9 +1009,13 @@ WINDOW TMask::read_page(
|
||||
|
||||
f->construct(scanner, w);
|
||||
_field.add(f);
|
||||
|
||||
if (toolbar)
|
||||
f->set_back_color(TOOL_BACK_COLOR);
|
||||
|
||||
_build_time += clock()-start;
|
||||
}
|
||||
|
||||
|
||||
set_win(NULL_WIN);
|
||||
return w;
|
||||
@ -1167,12 +1171,25 @@ void TMask::set(
|
||||
}
|
||||
|
||||
void TMask::set(short fld_id, long n, bool hit)
|
||||
{
|
||||
{
|
||||
char s[16];
|
||||
sprintf(s, "%ld", n);
|
||||
set(fld_id, s, hit);
|
||||
}
|
||||
|
||||
void TMask::set(short fld_id, const real& n, bool hit)
|
||||
{
|
||||
CHECK(field(fld_id).class_id() == CLASS_REAL_FIELD, "Can't set a real value in a non-number field");
|
||||
set(fld_id, n.string(), hit);
|
||||
}
|
||||
|
||||
void TMask::set(short fld_id, const TDate& d, bool hit)
|
||||
{
|
||||
CHECK(field(fld_id).class_id() == CLASS_DATE_FIELD, "Can't set a date in a non-date field");
|
||||
set(fld_id, d.string(), hit);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @mfunc Permette di attivare/disattivare tutta la pagina
|
||||
void TMask::activate(
|
||||
|
@ -95,9 +95,6 @@ protected:
|
||||
// @cmember Ritorna la finestra della pagina corrente (Usare con attenzione)
|
||||
WINDOW win() const
|
||||
{ return _page < 0 ? _pagewin[0] : _pagewin[_page]; }
|
||||
// @cmember Ritorna la finestra della toolbar
|
||||
WINDOW toolwin() const
|
||||
{ return _pagewin[MAX_PAGES]; }
|
||||
|
||||
// @cmember Ritorna il numero di campi nella finestra
|
||||
int find_field_win(WINDOW win) const;
|
||||
@ -207,6 +204,10 @@ public:
|
||||
virtual void close();
|
||||
// @cmember Permette di attivare/disattivare tutta la pagina
|
||||
virtual void activate(bool on = TRUE);
|
||||
|
||||
// @cmember Ritorna la finestra della toolbar
|
||||
WINDOW toolwin() const
|
||||
{ return _pagewin[MAX_PAGES]; }
|
||||
|
||||
// @cmember Converte un identificatore di campo nella sua posizione
|
||||
int id2pos(short id) const;
|
||||
@ -223,8 +224,13 @@ public:
|
||||
|
||||
// @cmember Setta il campo con una stringa
|
||||
void set(short fld_id, const char* str, bool hit=FALSE);
|
||||
// @cmember Setta il campo con un valore
|
||||
// @cmember Setta il campo con un valore intero
|
||||
void set(short fld_id, long num, bool hit=FALSE);
|
||||
// @cmember Setta il campo con un reale
|
||||
void set(short fld_id, const real& num, bool hit=FALSE);
|
||||
// @cmember Setta il campo con una data
|
||||
void set(short fld_id, const TDate& day, bool hit=FALSE);
|
||||
|
||||
// @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di stringa
|
||||
const TString& get(short fld_id) const;
|
||||
// @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di long
|
||||
@ -244,9 +250,10 @@ public:
|
||||
void move_focus_field(int num);
|
||||
// @cmember Setta il focus al campo la cui finestra e' <p win>
|
||||
void set_focus_win(WINDOW win, bool force);
|
||||
// @cmember Ritorna il numero del controllo che possiede il focus
|
||||
int focus_field() const
|
||||
{ return _focus;}
|
||||
// @cmember Ritorna il controllo che possiede il focus
|
||||
TMask_field& focus_field() const
|
||||
{ return fld(_focus);}
|
||||
|
||||
// @cmember Disabilita la lettura dei check della maschera
|
||||
void disable_starting_check()
|
||||
{ _should_check = FALSE;}
|
||||
|
@ -200,6 +200,11 @@ void TMask_field::construct(TScanner& scanner, WINDOW parent)
|
||||
create(parent);
|
||||
}
|
||||
|
||||
void TMask_field::set_back_color(COLOR c) const
|
||||
{
|
||||
xvt_set_ctrl_back_color(win(), c);
|
||||
}
|
||||
|
||||
bool TMask_field::parse_item(TScanner& scanner)
|
||||
{
|
||||
if (scanner.key() == "PR") // PROMPT
|
||||
@ -500,7 +505,7 @@ const char* TMask_field::get_field_data() const
|
||||
// @rdesc Ritorna la stringa formattata
|
||||
const char* TMask_field::picture_data(
|
||||
const char* data, // @parm Stringa da dare il formato
|
||||
bool video) // @parm Se TRUE permette di visualizzare la stringa a video
|
||||
bool video) const // @parm Se TRUE permette di visualizzare la stringa a video
|
||||
|
||||
// @comm Utilizzata soprattutto dagli sheet che in questo modo possono formattare
|
||||
// il contenuto delle celle con lo stesso formato deglia altri campi della maschera
|
||||
@ -2100,6 +2105,13 @@ void TEdit_field::create(WINDOW parent)
|
||||
}
|
||||
}
|
||||
|
||||
void TEdit_field::set_back_color(COLOR c) const
|
||||
{
|
||||
if (_promptwin != NULL_WIN)
|
||||
xvt_set_ctrl_back_color(_promptwin, c);
|
||||
}
|
||||
|
||||
|
||||
void TEdit_field::destroy()
|
||||
{
|
||||
if (_buttonwin)
|
||||
@ -2121,7 +2133,7 @@ const char* TEdit_field::get_field_data() const
|
||||
{ return _str; }
|
||||
|
||||
|
||||
const char* TEdit_field::format(const char* d)
|
||||
const char* TEdit_field::format(const char* d) const
|
||||
{
|
||||
fpark = d;
|
||||
if (_flags.trim) fpark.trim();
|
||||
@ -2161,7 +2173,7 @@ const char* TEdit_field::format(const char* d)
|
||||
|
||||
|
||||
|
||||
const char* TEdit_field::picture_data(const char* data, bool video)
|
||||
const char* TEdit_field::picture_data(const char* data, bool video) const
|
||||
{
|
||||
fpark = video ? data : format(data);
|
||||
return fpark.trim();
|
||||
@ -2176,8 +2188,8 @@ const char* TEdit_field::picture_data(const char* data, bool video)
|
||||
// @flag FALSE | Se la validata no ha avuto successo
|
||||
bool TEdit_field::validate(
|
||||
KEY k) // @parm Tasto da passare alla funzione di validazione
|
||||
{
|
||||
return ::validate(_validate_func, *this, k, _validate_parms);
|
||||
{
|
||||
return _validate_func < 0 ? TRUE : ::validate(_validate_func, *this, k, _validate_parms);
|
||||
}
|
||||
|
||||
// Certified 90%
|
||||
@ -2391,6 +2403,10 @@ void TBoolean_field::create(WINDOW parent)
|
||||
wincreate(WC_CHECKBOX, _prompt.len()+4, 1, _prompt, parent, 0);
|
||||
}
|
||||
|
||||
void TBoolean_field::set_back_color(COLOR c) const
|
||||
{
|
||||
xvt_set_ctrl_back_color(win(), c);
|
||||
}
|
||||
|
||||
const char* TBoolean_field::get_window_data() const
|
||||
{
|
||||
@ -2571,6 +2587,10 @@ void TButton_field::create(WINDOW parent)
|
||||
wincreate(WC_PUSHBUTTON, _width + 2, _size, _prompt, parent, flags);
|
||||
}
|
||||
|
||||
void TButton_field::set_back_color(COLOR c) const
|
||||
{}
|
||||
|
||||
|
||||
void TButton_field::enable(bool on)
|
||||
{
|
||||
_flags.enabled = on;
|
||||
@ -2639,7 +2659,7 @@ void TDate_field::set_window_data(const char* data)
|
||||
// @rdesc Ritorna la data formattata
|
||||
const char* TDate_field::format_data(
|
||||
const char* datum, // @parm Stringa contenenete la data da formattare
|
||||
bool* ch) const // @parm Indica se e' stata cambiato il formato rispetto alla stringa passsata
|
||||
bool* ch) const // @parm Indica se e' stata cambiato il formato rispetto alla stringa passsata
|
||||
|
||||
// @comm Permette di gestire anche alcuni date particolari come:
|
||||
//
|
||||
@ -2760,7 +2780,7 @@ bool TDate_field::autosave(TRelation* r) const
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const char* TDate_field::picture_data(const char* data, bool video)
|
||||
const char* TDate_field::picture_data(const char* data, bool video) const
|
||||
{
|
||||
return video ? format_data(data) : data;
|
||||
}
|
||||
@ -2921,11 +2941,13 @@ const char* TReal_field::get_window_data() const
|
||||
return fpark;
|
||||
}
|
||||
|
||||
const char* TReal_field::picture_data(const char* data, bool video)
|
||||
const char* TReal_field::picture_data(const char* data, bool video) const
|
||||
{
|
||||
if (video)
|
||||
{
|
||||
fpark = real::ita2eng(data);
|
||||
if (_flags.zerofilled && fpark.not_empty())
|
||||
fpark.right_just(_size, '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3151,6 +3173,12 @@ void TList_field::create(WINDOW parent)
|
||||
add_list();
|
||||
}
|
||||
|
||||
void TList_field::set_back_color(COLOR c) const
|
||||
{
|
||||
if (_promptwin != NULL_WIN)
|
||||
xvt_set_ctrl_back_color(_promptwin, c);
|
||||
}
|
||||
|
||||
|
||||
int TList_field::str2curr(const char* data)
|
||||
{
|
||||
@ -3299,14 +3327,14 @@ bool TList_field::on_key(KEY key)
|
||||
dispacth_e_char(win(), K_F9);
|
||||
#endif
|
||||
|
||||
if (_validate_func>=0 && (key == K_TAB || key == K_ENTER))
|
||||
if (_validate_func >= 0 && (key == K_TAB || key == K_ENTER))
|
||||
{
|
||||
bool ok = ::validate(_validate_func, *this, key, _validate_parms);
|
||||
if (!ok)
|
||||
const bool ok = ::validate(_validate_func, *this, key, _validate_parms);
|
||||
if (!ok)
|
||||
{
|
||||
if (_warning.not_empty())
|
||||
return error_box(_warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key == K_SPACE) on_hit();
|
||||
@ -3366,6 +3394,14 @@ void TRadio_field::create(WINDOW parent)
|
||||
set_field_data("");
|
||||
}
|
||||
|
||||
|
||||
void TRadio_field::set_back_color(COLOR c) const
|
||||
{
|
||||
TList_field::set_back_color(c);
|
||||
xvt_set_ctrl_back_color(win(), c);
|
||||
}
|
||||
|
||||
|
||||
void TRadio_field::destroy()
|
||||
{
|
||||
if (_promptwin)
|
||||
@ -3462,6 +3498,11 @@ void TGroup_field::create(WINDOW parent)
|
||||
wincreate(WC_GROUPBOX, _width, _size, _prompt, parent, f);
|
||||
}
|
||||
|
||||
void TGroup_field::set_back_color(COLOR c) const
|
||||
{
|
||||
xvt_set_ctrl_back_color(win(), c);
|
||||
}
|
||||
|
||||
void TGroup_field::set_window_data(const char* data)
|
||||
{ xvt_set_title(win(), data); }
|
||||
|
||||
@ -3509,6 +3550,10 @@ void TMemo_field::create(WINDOW parent)
|
||||
enable_default(); // Setta colori default
|
||||
}
|
||||
|
||||
void TMemo_field::set_back_color(COLOR) const
|
||||
{
|
||||
}
|
||||
|
||||
void TMemo_field::highlight() const
|
||||
{
|
||||
xvt_tx_set_active(_te);
|
||||
|
@ -1,6 +1,10 @@
|
||||
#ifndef __MASKFLD_H
|
||||
#define __MASKFLD_H
|
||||
|
||||
#ifndef __DATE_H
|
||||
#include <date.h>
|
||||
#endif
|
||||
|
||||
#ifndef __REAL_H
|
||||
#include <real.h>
|
||||
#endif
|
||||
@ -144,6 +148,8 @@ protected:
|
||||
virtual void destroy();
|
||||
// @cmember Setta il focus sul campo
|
||||
virtual void highlight() const;
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
|
||||
// @cmember Legge il valore del campo direttamente dalla finestra del controllo
|
||||
virtual const char* get_window_data() const;
|
||||
@ -295,9 +301,9 @@ public:
|
||||
{ return _userdata; };
|
||||
|
||||
// @cmember Permette di dare la stessa formattazione del campo della maschera
|
||||
virtual const char* picture_data(const char* data, bool video);
|
||||
// @cmember Ritorna il contenuto del warning associato al campo
|
||||
virtual const char * warning()
|
||||
virtual const char* picture_data(const char* data, bool video) const;
|
||||
// @cmember Ritorna il warning del campo
|
||||
virtual const char* warning() const
|
||||
{ return _warning;}
|
||||
|
||||
// @cmember Legge dalla relazione il valore del campo
|
||||
@ -403,6 +409,8 @@ protected:
|
||||
virtual void parse_head(TScanner& scanner);
|
||||
// @cmember Legge un item del controllo dal file <p scanner>
|
||||
virtual bool parse_item(TScanner& scanner);
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
|
||||
virtual bool is_edit() const { return TRUE; }
|
||||
|
||||
@ -436,7 +444,7 @@ public:
|
||||
{ return _browse || _sheet;}
|
||||
// @cmember Permette di dare la stessa formattazione del campo della maschera
|
||||
// (vedi <mf TMask_field::picture_data>)
|
||||
virtual const char* picture_data(const char* data, bool video);
|
||||
virtual const char* picture_data(const char* data, bool video) const;
|
||||
// @cmember Permette di rendere visibile/invisibile un campo (vedi <mf TMask_field::show>)
|
||||
virtual void show(bool on = TRUE);
|
||||
// @cmember Abilita/disabilita il campo (lo rende scrivibile) (vedi <mf TMask_field::enable>)
|
||||
@ -466,7 +474,7 @@ public:
|
||||
{ return _check_enabled;}
|
||||
|
||||
// @cmember Ritorna <p data> formattato secondo i flags settati del campo
|
||||
const char* format(const char* data);
|
||||
const char* format(const char* data) const;
|
||||
// @cmember Ritorna la picture del campo
|
||||
const char* picture() const
|
||||
{ return _picture; }
|
||||
@ -678,7 +686,7 @@ protected:
|
||||
// @cmember Setta il valore del cambio nel campo
|
||||
virtual void exchange(bool show_value, const real& n);
|
||||
|
||||
virtual const char* picture_data(const char* data, bool video);
|
||||
virtual const char* picture_data(const char* data, bool video) const;
|
||||
|
||||
// @cmember Crea il controllo
|
||||
virtual void create(WINDOW parent);
|
||||
@ -719,7 +727,7 @@ protected:
|
||||
virtual bool on_key(KEY key);
|
||||
// @cmember Permette di dare la stessa formattazione del campo della maschera
|
||||
// (vedi <mf TMask_field::picture_data>)
|
||||
virtual const char* picture_data(const char* data, bool video);
|
||||
virtual const char* picture_data(const char* data, bool video) const;
|
||||
// @cmember Legge il valore del campo direttamente dalla finestra del controllo
|
||||
virtual const char* get_window_data() const;
|
||||
// @cmember Scrive il valore del campo direttamente dalla finestra del controllo
|
||||
@ -762,6 +770,8 @@ protected:
|
||||
virtual bool parse_item(TScanner& scanner);
|
||||
// @cmember Abilita/Disabilita il campo (vedi <mf TMask_field::enable>)
|
||||
virtual void enable(bool on);
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
// @cmember Gestisce la chiamata all'handler del campo
|
||||
virtual bool on_hit();
|
||||
// @cmember Gestisce la pressione del tasto (TRUE se la gestione ha avuto successo)
|
||||
@ -821,6 +831,8 @@ protected:
|
||||
virtual bool on_key(KEY key);
|
||||
// @cmember Legge dal file gli item dello sheet
|
||||
virtual void read_item(TScanner& scanner);
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
|
||||
// @cmember Legge un item del controllo dal file <p scanner>
|
||||
virtual void parse_head(TScanner& scanner);
|
||||
@ -869,6 +881,8 @@ protected:
|
||||
virtual void enable(bool on);
|
||||
// @cmember Permette di mostrare/nascondere il radio button (vedi <mf TMask_field::show>)
|
||||
virtual void show(bool on);
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
|
||||
// @cmember Setta la voce corrente
|
||||
virtual void current(int n);
|
||||
@ -907,6 +921,8 @@ protected:
|
||||
virtual word class_id() const;
|
||||
// @cmember Crea il controllo
|
||||
virtual void create(WINDOW parent);
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
|
||||
// @cmember Legge un item del controllo dal file <p scanner>
|
||||
void parse_head(TScanner& scanner);
|
||||
@ -936,7 +952,6 @@ public:
|
||||
// @base public | TMask_field
|
||||
class TGroup_field : public TMask_field
|
||||
{
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Legge un item del controllo dal file <p scanner>
|
||||
@ -947,6 +962,8 @@ protected:
|
||||
virtual void set_window_data(const char* data);
|
||||
// @cmember Scrive il valore del campo
|
||||
virtual void set_field_data(const char* data);
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
@ -985,13 +1002,14 @@ protected:
|
||||
// @cmember Setta il focus sul campo
|
||||
virtual void highlight() const;
|
||||
|
||||
|
||||
// @cmember Permette di abilitare/disabilitare il campo (vedi <mf TMask_field::enable>)
|
||||
virtual void enable(bool on);
|
||||
// @cmember Permette di mostrare/nascondere il campo (vedi <mf TMask_field::show>)
|
||||
virtual void show(bool on);
|
||||
// @cmember Gestisce la pressione del tasto (TRUE se la gestione ha avuto successo)
|
||||
virtual bool on_key(KEY k);
|
||||
// @cmember Setta il colore dello sfondo
|
||||
virtual void set_back_color(COLOR c) const;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
|
@ -91,9 +91,12 @@ class TSpreadsheet : public TWindow
|
||||
protected:
|
||||
//@cmember Gestisce gli eventi delle celle (chiamata dal <mf TSpreadsheet::xiev_handler>)
|
||||
void list_handler(XI_EVENT* xiev);
|
||||
|
||||
|
||||
//@cmember Copia una cella nel corrispondente campo della maschera e ne ritorna il contenuto
|
||||
const char* copy_cell2field(XI_OBJ* cell = NULL);
|
||||
|
||||
//@cmember Gestisce l'uscita delle celle (chiamata dal <mf TSpreadsheet::list_handler>)
|
||||
bool off_cell_handler(XI_OBJ* cell);
|
||||
bool off_cell_handler(XI_OBJ* cell = NULL);
|
||||
|
||||
// @cmember Ritorna il campo della maschera corrispondente alla cella dello
|
||||
// spreadsheet indicata da <p pos>
|
||||
@ -517,14 +520,16 @@ void TSpreadsheet::update_rec(int rec)
|
||||
const int riga = rec2row(rec);
|
||||
if (riga >= 0)
|
||||
{
|
||||
if (rec == selected())
|
||||
const bool has_focus = rec == selected() &&
|
||||
mask().focus_field().dlg() == _owner->dlg();
|
||||
if (has_focus)
|
||||
xi_set_focus(_itf);
|
||||
|
||||
XI_OBJ row;
|
||||
XI_MAKE_ROW(&row, _list, riga);
|
||||
xi_cell_request(&row); // Update internal values
|
||||
|
||||
if (rec == selected())
|
||||
if (has_focus)
|
||||
{
|
||||
str2mask(_cur_rec);
|
||||
set_focus_cell(riga, _cur_col);
|
||||
@ -576,33 +581,32 @@ int TSpreadsheet::insert(
|
||||
{
|
||||
static bool ininsert = FALSE;
|
||||
|
||||
if ( ininsert )
|
||||
if (ininsert || items() >= 999)
|
||||
return -1;
|
||||
|
||||
if (items() >= 999 || !_active)
|
||||
return -1;
|
||||
if (rec < 0 && items() > 0 && !_owner->append() )
|
||||
rec = _cur_rec + 1;
|
||||
|
||||
ininsert = TRUE;
|
||||
const int r = _str.insert(new TToken_string(80), rec);
|
||||
int r = _str.insert(new TToken_string(80), rec);
|
||||
|
||||
const bool ok = notify(r, K_INS);
|
||||
if (ok)
|
||||
{
|
||||
_disabled.insert(NULL, r);
|
||||
xi_insert_row(_list, INT_MAX);
|
||||
xi_cell_request(_list);
|
||||
|
||||
if (!ok)
|
||||
// Notifica che l'inserimento è terminato
|
||||
notify(r, K_CTRL + K_INS);
|
||||
}
|
||||
else
|
||||
{
|
||||
_str.destroy(r);
|
||||
return -1;
|
||||
r = -1;
|
||||
}
|
||||
|
||||
_disabled.insert(NULL, r);
|
||||
xi_insert_row(_list, INT_MAX);
|
||||
xi_cell_request(_list);
|
||||
|
||||
// Notifica che l'inserimento è terminato
|
||||
notify( r, K_CTRL + K_INS );
|
||||
ininsert = FALSE;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -622,7 +626,7 @@ bool TSpreadsheet::destroy(
|
||||
static bool indestroy = FALSE;
|
||||
|
||||
if ( indestroy )
|
||||
return -1;
|
||||
return FALSE;
|
||||
|
||||
indestroy = TRUE;
|
||||
bool ok = TRUE;
|
||||
@ -637,7 +641,7 @@ bool TSpreadsheet::destroy(
|
||||
{
|
||||
_disabled.destroy(rec, TRUE); // Destroy enable info
|
||||
ok = _str.destroy(rec, TRUE); // Destroy line
|
||||
enable_cell(_str.items(), -1); // Enable last line
|
||||
// enable_cell(_str.items(), -1); // Enable last line
|
||||
}
|
||||
|
||||
if (ok && mask().is_running())
|
||||
@ -691,14 +695,30 @@ HIDDEN void XVT_CALLCONV1 xiev_handler(XI_OBJ *itf, XI_EVENT *xiev)
|
||||
es->list_handler(xiev);
|
||||
}
|
||||
|
||||
const char* TSpreadsheet::copy_cell2field(XI_OBJ* cell)
|
||||
{
|
||||
const char* val;
|
||||
|
||||
if (cell == NULL)
|
||||
{
|
||||
XI_OBJ cella;
|
||||
XI_MAKE_CELL(&cella, _list, _cur_row, _cur_col);
|
||||
val = _edit_field->picture_data(xi_get_text(&cella, NULL, -1), TRUE);
|
||||
}
|
||||
else
|
||||
val = _edit_field->picture_data(xi_get_text(cell, NULL, -1), TRUE);
|
||||
_edit_field->set(val);
|
||||
_edit_field->set_dirty(); // Get it dirty!
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
bool TSpreadsheet::off_cell_handler(XI_OBJ *cell)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
if (_edit_field != NULL)
|
||||
{
|
||||
const char* nuo = _edit_field->picture_data(xi_get_text(cell, NULL, -1), TRUE);
|
||||
_edit_field->set(nuo); // Set new mask value
|
||||
_edit_field->set_dirty(); // Get it dirty!
|
||||
const char* nuo = copy_cell2field(cell);
|
||||
if (_edit_field->on_key(_edit_field->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it
|
||||
ok = *nuo != '\0';
|
||||
mask2str(_cur_rec); // Update sheet row
|
||||
@ -805,18 +825,14 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
_check_enabled = FALSE;
|
||||
|
||||
if (_cell_dirty)
|
||||
{
|
||||
XI_OBJ cell;
|
||||
XI_MAKE_CELL(&cell, _list, _cur_row, _cur_col);
|
||||
off_cell_handler(&cell);
|
||||
}
|
||||
off_cell_handler();
|
||||
|
||||
const int oldrec = _cur_rec;
|
||||
set_pos(xiev->v.select.xi_obj->v.row, xiev->v.select.column);
|
||||
if (oldrec != _cur_rec)
|
||||
{
|
||||
_row_dirty = FALSE;
|
||||
update(_cur_rec); // Forces update delayed by str2mask
|
||||
on_idle(); // Forces update delayed by str2mask
|
||||
}
|
||||
|
||||
if (sheet_mask().id2pos(FIRST_FIELD-1) != -1)
|
||||
@ -861,13 +877,13 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
if (k == K_DEL)
|
||||
{
|
||||
_row_dirty = _cell_dirty = FALSE;
|
||||
if (_cur_rec == items()-1)
|
||||
{
|
||||
_cur_rec--;
|
||||
_cur_row--;
|
||||
}
|
||||
}
|
||||
|
||||
if (_cur_rec >= items())
|
||||
{
|
||||
_row_dirty = _cell_dirty = FALSE;
|
||||
set_pos(0, 1);
|
||||
}
|
||||
if (_cur_rec >= 0)
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
_check_enabled = TRUE;
|
||||
@ -883,6 +899,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
mask().set_focus_win(win(), FALSE);
|
||||
break;
|
||||
case XIE_OFF_LIST:
|
||||
on_idle();
|
||||
break;
|
||||
case XIE_ON_ROW:
|
||||
if (_check_enabled)
|
||||
@ -906,8 +923,6 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
_check_enabled = FALSE; // Avoid recursion!
|
||||
if (_row_dirty)
|
||||
{
|
||||
TMask_field* old = _edit_field; // Save current field
|
||||
_edit_field = NULL; // Reset current field
|
||||
bool ok = sheet_mask().check_fields();
|
||||
if (ok)
|
||||
{
|
||||
@ -917,16 +932,17 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
if (ok)
|
||||
{
|
||||
xvt_statbar_refresh();
|
||||
_edit_field = NULL; // Reset current field
|
||||
}
|
||||
else
|
||||
{
|
||||
_edit_field = old; // Restore currrent field
|
||||
xiev->refused = TRUE;
|
||||
}
|
||||
}
|
||||
if (!xiev->refused)
|
||||
{
|
||||
// Notifica l'abbandono della riga
|
||||
notify(_cur_rec, K_CTRL+K_TAB);
|
||||
}
|
||||
// Notifica l'abbandono della riga
|
||||
notify(_cur_rec, K_CTRL+K_TAB);
|
||||
_check_enabled = TRUE;
|
||||
}
|
||||
break;
|
||||
@ -1013,10 +1029,12 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
_check_enabled = TRUE; // Enable checks
|
||||
break;
|
||||
case K_F2:
|
||||
case K_F3:
|
||||
case K_F8:
|
||||
case K_F9:
|
||||
if (_edit_field != NULL)
|
||||
copy_cell2field();
|
||||
case K_F2:
|
||||
case K_F3:
|
||||
case K_F11:
|
||||
if (_check_enabled && active())
|
||||
{
|
||||
@ -1025,7 +1043,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
const bool ok = _edit_field->on_key(k);
|
||||
if (!ok && k == K_F9) // Ricerca non completata?
|
||||
{
|
||||
_edit_field = &sheet_mask().fld(sheet_mask().focus_field());
|
||||
_edit_field = &sheet_mask().focus_field();
|
||||
const short foca = _edit_field->dlg();
|
||||
const int col = (foca - FIRST_FIELD) % 100 +1;
|
||||
if (col > 0 && col != _cur_col) // Ricerca alternativa
|
||||
@ -1037,10 +1055,9 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
if (ok)
|
||||
{
|
||||
mask2str(_cur_rec);
|
||||
update(_cur_rec); _needs_update = -1; // Update immediately!
|
||||
set_focus_cell(_cur_row, _cur_col);
|
||||
on_idle(); // Update immediately!
|
||||
}
|
||||
_check_enabled = TRUE; // Re-enable checks
|
||||
_check_enabled = TRUE; // Re-enable checks
|
||||
}
|
||||
break;
|
||||
case K_PREV:
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define PAGSCA_RITENUTE "RITENUTE"
|
||||
#define PAGSCA_ACCSAL "ACCSAL"
|
||||
#define PAGSCA_ABBUONI "ABBUONI"
|
||||
#define PAGSCA_PASSATT "PASSATT"
|
||||
#define PAGSCA_DIFFCAM "DIFFCAM"
|
||||
#define PAGSCA_DATAPAG "DATAPAG"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relapp.cpp,v 1.67 1995-09-22 12:30:14 guy Exp $
|
||||
// $Id: relapp.cpp,v 1.68 1995-10-25 09:43:44 guy Exp $
|
||||
#include <mailbox.h>
|
||||
#include <sheet.h>
|
||||
#include <urldefid.h>
|
||||
@ -473,7 +473,7 @@ bool TRelation_application::search_mode()
|
||||
return modify_mode();
|
||||
}
|
||||
|
||||
TMask_field* dopo = &_mask->fld(_mask->focus_field());
|
||||
TMask_field* dopo = &_mask->focus_field();
|
||||
prima = (dopo == prima) ? NULL : dopo;
|
||||
}
|
||||
return FALSE;
|
||||
@ -588,12 +588,21 @@ bool TRelation_application::save(bool check_dirty)
|
||||
{
|
||||
if (annulla)
|
||||
{
|
||||
TString w(_mask->field(dirty).warning());
|
||||
|
||||
if (w.empty())
|
||||
w = "Campo inconsistente";
|
||||
k = yesno_box("%s: annullare?", (const char *) w) ? K_ESC : K_NO;
|
||||
if (k == K_ESC) _mask->first_focus(-_mask->field(dirty).dlg());
|
||||
TString80 w(_mask->field(dirty).warning());
|
||||
if (w.empty()) w = "Campo inconsistente";
|
||||
w << ": si desidera ";
|
||||
switch (last)
|
||||
{
|
||||
case K_ESC:
|
||||
w << "annullare?"; break;
|
||||
case K_QUIT:
|
||||
w << "uscire?"; break;
|
||||
default:
|
||||
w << "continuare?"; break;
|
||||
}
|
||||
k = yesno_box(w) ? K_NO : K_ESC;
|
||||
if (k == K_ESC)
|
||||
_mask->first_focus(-dirty);
|
||||
}
|
||||
else k = K_ESC;
|
||||
}
|
||||
@ -615,7 +624,7 @@ bool TRelation_application::save(bool check_dirty)
|
||||
{
|
||||
if (!_mask->check_fields()) // Exit with ESC didn't check values
|
||||
{
|
||||
_mask->first_focus(-_mask->fld(_mask->focus_field()).dlg());
|
||||
_mask->first_focus(-_mask->focus_field().dlg());
|
||||
was_dirty = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relation.cpp,v 1.65 1995-09-19 15:45:37 guy Exp $
|
||||
// $Id: relation.cpp,v 1.66 1995-10-25 09:43:48 guy Exp $
|
||||
// relation.cpp
|
||||
// fv 12/8/93
|
||||
// relation class for isam files
|
||||
@ -332,24 +332,22 @@ void TRelation::save_status()
|
||||
|
||||
int TRelation::log2ind(int log) const
|
||||
{
|
||||
// returns _files index of logical number or
|
||||
// NOTFOUND if not present
|
||||
// sets error status
|
||||
// returns _files index of logical number or NOTFOUND if not present
|
||||
|
||||
if (log < 0) return alias2ind(-log);
|
||||
if (log <= 0)
|
||||
return alias2ind(-log);
|
||||
|
||||
const int num = _files.items();
|
||||
if (log > 0)
|
||||
{
|
||||
for (int i = 0; i < num; i++)
|
||||
if (file(i).num() == log) return i;
|
||||
}
|
||||
return num ? 0 : NOTFOUND;
|
||||
const int nf = _files.items();
|
||||
for (int i = 0; i < nf; i++)
|
||||
if (file(i).num() == log)
|
||||
return i;
|
||||
|
||||
return NOTFOUND;
|
||||
}
|
||||
|
||||
int TRelation::alias2ind(int alias) const
|
||||
{
|
||||
if (alias < 1) return 0;
|
||||
if (alias <= 0) return 0;
|
||||
|
||||
for (int i = 0; i < _reldefs.items(); i++)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <date.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <window.h>
|
||||
#include <mask.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
extern "C" { long nap(long period); }
|
||||
@ -88,6 +88,7 @@ HIDDEN int FontWeight;
|
||||
COLOR MASK_BACK_COLOR = COLOR_DKCYAN;
|
||||
COLOR MASK_LIGHT_COLOR = COLOR_CYAN;
|
||||
COLOR MASK_DARK_COLOR = COLOR_GRAY;
|
||||
COLOR TOOL_BACK_COLOR = COLOR_GRAY;
|
||||
COLOR NORMAL_COLOR = COLOR_BLACK;
|
||||
COLOR NORMAL_BACK_COLOR = COLOR_LTGRAY;
|
||||
COLOR DISABLED_COLOR = COLOR_GRAY;
|
||||
@ -314,7 +315,12 @@ RCT& resize_rect(
|
||||
{
|
||||
if (xvt_vobj_get_type(parent) == W_PLAIN) // Mask with Toolbar
|
||||
{
|
||||
if (y >= 0) y++;
|
||||
if (y >= 0)
|
||||
{
|
||||
const TMask* m = (const TMask*)xvt_vobj_get_data(parent);
|
||||
if (parent != m->toolwin())
|
||||
y++;
|
||||
}
|
||||
if (x > 0 || (wt != WO_TE && x == 0))
|
||||
{
|
||||
RCT pc; xvt_vobj_get_client_rect(parent, &pc); // Get parent window size
|
||||
@ -613,6 +619,7 @@ 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);
|
||||
}
|
||||
|
||||
// @func Stabilisce i parametri standard dei controlli
|
||||
@ -1037,6 +1044,19 @@ int xvt_get_checked_radio(
|
||||
}
|
||||
|
||||
|
||||
// @func Permette di cambiare il colore di sfondo di un controllo
|
||||
void xvt_set_ctrl_back_color(
|
||||
WINDOW win, // @parm Finestra di cui si vuole cambiare lo sfondo
|
||||
COLOR col) // @parm Colore dello sfondo
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||
c->set_back_color(col);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Gestione Status bar
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -64,7 +64,7 @@ WINDOW xvt_create_window
|
||||
bool xvt_get_checked_state(WINDOW win);
|
||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
||||
int xvt_get_checked_radio(const WINDOW* ctls, int count);
|
||||
// ??? NON LA TROVO NEL CPP ??? //
|
||||
void xvt_set_ctrl_back_color(WINDOW win, COLOR col);
|
||||
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
|
||||
|
||||
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||
|
Loading…
x
Reference in New Issue
Block a user