controls.cpp Aggiustata altezza text e group controls
mask.cpp Corretta autosave in modo che salvi "in avanti" maskfld.* Aggiunte alcune is_kind_of msksheet.cpp Corretta force_update git-svn-id: svn://10.65.10.50/trunk@2824 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b619a73636
commit
fbc771205a
@ -803,12 +803,11 @@ TText_control::TText_control(WINDOW win, short cid,
|
|||||||
TString t = parse_caption(text, bold, color);
|
TString t = parse_caption(text, bold, color);
|
||||||
t.rtrim();
|
t.rtrim();
|
||||||
if (width <= 0)
|
if (width <= 0)
|
||||||
{
|
|
||||||
width = t.len();
|
width = t.len();
|
||||||
if (bold)
|
|
||||||
width = 4 * width / 3;
|
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||||
}
|
rct.right += bold ? (width*XI_FU_MULTIPLE/4) : XI_FU_MULTIPLE/2;
|
||||||
XI_RCT rct; coord2rct(win, left, top, width, height, rct); rct.right += XI_FU_MULTIPLE / 2;
|
|
||||||
const unsigned long attrib = flags2attr(flags);
|
const unsigned long attrib = flags2attr(flags);
|
||||||
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, &rct, attrib, (char*)(const char*)t);
|
XI_OBJ_DEF* def = xi_add_text_def(NULL, cid, &rct, attrib, (char*)(const char*)t);
|
||||||
CHECKS(def, "Can't create the definition of TText_control:", text);
|
CHECKS(def, "Can't create the definition of TText_control:", text);
|
||||||
@ -818,6 +817,10 @@ TText_control::TText_control(WINDOW win, short cid,
|
|||||||
_obj = xi_create(get_interface(win), def);
|
_obj = xi_create(get_interface(win), def);
|
||||||
CHECKS(_obj, "Can't create TText_control ", text);
|
CHECKS(_obj, "Can't create TText_control ", text);
|
||||||
|
|
||||||
|
// Alza di un pixel il rettangolo per allinearlo meglio agli edit field
|
||||||
|
RCT& tr = _obj->v.text->rct;
|
||||||
|
tr.top--; tr.bottom--;
|
||||||
|
|
||||||
xi_dequeue();
|
xi_dequeue();
|
||||||
xi_tree_free(def);
|
xi_tree_free(def);
|
||||||
}
|
}
|
||||||
@ -850,10 +853,19 @@ TGroupbox_control::TGroupbox_control(WINDOW win, short cid,
|
|||||||
def->v.rect->hilight_color = MASK_LIGHT_COLOR;
|
def->v.rect->hilight_color = MASK_LIGHT_COLOR;
|
||||||
def->v.rect->back_color = MASK_BACK_COLOR;
|
def->v.rect->back_color = MASK_BACK_COLOR;
|
||||||
def->v.rect->shadow_color = MASK_DARK_COLOR;
|
def->v.rect->shadow_color = MASK_DARK_COLOR;
|
||||||
def->v.rect->well = strchr(flags, 'R') ? FALSE : TRUE;
|
|
||||||
|
const bool erre = strchr(flags, 'R') != NULL;
|
||||||
|
if (erre)
|
||||||
|
{
|
||||||
|
def->v.rect->well = TRUE; // Mette in rilievo il rettangolo
|
||||||
|
change_attrib(XI_ATR_RJUST, FALSE, _obj); // Toglie l'erroneo allineamento a destra del titolo
|
||||||
|
}
|
||||||
_rct = xi_create(get_interface(win), def);
|
_rct = xi_create(get_interface(win), def);
|
||||||
CHECKD(_rct, "Can't create Groupbox_control ", cid);
|
CHECKD(_rct, "Can't create Groupbox_control ", cid);
|
||||||
|
|
||||||
|
RCT& rt = _obj->v.text->rct;
|
||||||
|
rt.top--; rt.bottom--;
|
||||||
|
|
||||||
xi_dequeue();
|
xi_dequeue();
|
||||||
xi_tree_free(def);
|
xi_tree_free(def);
|
||||||
}
|
}
|
||||||
@ -1184,7 +1196,7 @@ void TPushbutton_control::update()
|
|||||||
{
|
{
|
||||||
PNT p; p.v = y; p.h = px;
|
PNT p; p.v = y; p.h = px;
|
||||||
xvt_dwin_draw_set_pos(w, p);
|
xvt_dwin_draw_set_pos(w, p);
|
||||||
p.h += i.height();
|
p.v += i.height();
|
||||||
xvt_dwin_draw_line(w, p);
|
xvt_dwin_draw_line(w, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1235,12 +1247,12 @@ TRadiobutton_control::TRadiobutton_control(WINDOW win, short cid,
|
|||||||
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
|
XI_RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||||
|
|
||||||
// Aggiusta rettangolo in modo da centrare i bottoni
|
// Aggiusta rettangolo in modo da centrare i bottoni
|
||||||
const int extra = (rct.bottom - rct.top - tot * XI_FU_MULTIPLE) / 2;
|
const int extra = rct.bottom - rct.top - tot * XI_FU_MULTIPLE;
|
||||||
if (extra > 0)
|
if (extra > 0)
|
||||||
{
|
rct.top += extra / 2;
|
||||||
rct.top += extra;
|
else
|
||||||
|
if (extra < 0)
|
||||||
rct.bottom -= extra;
|
rct.bottom -= extra;
|
||||||
}
|
|
||||||
|
|
||||||
XI_OBJ_DEF* def = xi_add_container_def(NULL, cid, &rct, orient, cid);
|
XI_OBJ_DEF* def = xi_add_container_def(NULL, cid, &rct, orient, cid);
|
||||||
def->app_data = (long)this;
|
def->app_data = (long)this;
|
||||||
|
@ -99,8 +99,8 @@ void TMask::read_mask(
|
|||||||
CHECKD(_pages < MAX_PAGES, "Maschera con troppe pagine: ", _pages);
|
CHECKD(_pages < MAX_PAGES, "Maschera con troppe pagine: ", _pages);
|
||||||
WINDOW w = read_page(scanner, FALSE);
|
WINDOW w = read_page(scanner, FALSE);
|
||||||
|
|
||||||
char* title = &__tmp_string[512];
|
TString title(80);
|
||||||
xvt_vobj_get_title(w, title, 80);
|
xvt_vobj_get_title(w, (char*)(const char*)title, title.size());
|
||||||
captions.add(title);
|
captions.add(title);
|
||||||
|
|
||||||
_pagewin[_pages++] = w;
|
_pagewin[_pages++] = w;
|
||||||
@ -698,20 +698,20 @@ WINDOW TMask::read_page(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool orecchie = _pagewin[0] != NULL_WIN || toolwin();
|
bool orecchie = _pagewin[0] != NULL_WIN || toolwin();
|
||||||
if (!orecchie && !toolbar)
|
if (!orecchie && !toolbar) // Controlla se la maschera ha piu' di una pagina
|
||||||
{
|
{
|
||||||
const streampos pos = scanner.tellg();
|
const streampos pos = scanner.tellg(); // Memorizza posizione dello scanner
|
||||||
const TString& l = scanner.line();
|
TString l(scanner.line().left(2));
|
||||||
while (l != "EN" && l.not_empty())
|
while (l != "EN" && l.not_empty())
|
||||||
{
|
{
|
||||||
if (l == "PA")
|
if (l == "PA") // Ho trovato un'altra pagina!
|
||||||
{
|
{
|
||||||
orecchie = TRUE;
|
orecchie = TRUE; // Quindi devo metterci le orecchie
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
scanner.line();
|
l = scanner.line().left(2);
|
||||||
}
|
}
|
||||||
scanner.seekg(pos);
|
scanner.seekg(pos); // Ripristin aposizione dello scanner
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW w;
|
WINDOW w;
|
||||||
@ -900,13 +900,13 @@ void TMask::set(short fld_id, long n, bool hit)
|
|||||||
|
|
||||||
void TMask::set(short fld_id, const real& n, bool 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");
|
CHECK(field(fld_id).is_kind_of(CLASS_REAL_FIELD), "Can't set a real value in a non-number field");
|
||||||
set(fld_id, n.string(), hit);
|
set(fld_id, n.string(), hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMask::set(short fld_id, const TDate& d, bool 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");
|
CHECK(field(fld_id).is_kind_of(CLASS_DATE_FIELD), "Can't set a date in a non-date field");
|
||||||
set(fld_id, d.string(), hit);
|
set(fld_id, d.string(), hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,7 +944,8 @@ void TMask::enable(
|
|||||||
f.enable(on);
|
f.enable(on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else field(fld_id).enable(on);
|
else
|
||||||
|
field(fld_id).enable(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1101,7 +1102,8 @@ void TMask::show_default(
|
|||||||
|
|
||||||
void TMask::autoload(const TRelation& r)
|
void TMask::autoload(const TRelation& r)
|
||||||
{
|
{
|
||||||
for (int i = fields()-1; i >= 0; i--)
|
const int max = fields();
|
||||||
|
for (int i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
TMask_field& f = fld(i);
|
TMask_field& f = fld(i);
|
||||||
if (f.is_editable())
|
if (f.is_editable())
|
||||||
@ -1112,7 +1114,8 @@ void TMask::autoload(const TRelation& r)
|
|||||||
|
|
||||||
void TMask::autosave(TRelation& r) const
|
void TMask::autosave(TRelation& r) const
|
||||||
{
|
{
|
||||||
for (int i = fields()-1; i >= 0; i--)
|
const int max = fields();
|
||||||
|
for (int i = 0; i < max; i++)
|
||||||
{
|
{
|
||||||
TMask_field& f = fld(i);
|
TMask_field& f = fld(i);
|
||||||
if (f.is_editable())
|
if (f.is_editable())
|
||||||
@ -1609,7 +1612,6 @@ void TMask::copy_values(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* TMask::get_caption() const
|
const char* TMask::get_caption() const
|
||||||
{
|
{
|
||||||
char* title = &__tmp_string[512];
|
char* title = &__tmp_string[512];
|
||||||
|
@ -2922,6 +2922,10 @@ TDate_field::TDate_field(TMask* m) : TEdit_field(m)
|
|||||||
word TDate_field::class_id() const
|
word TDate_field::class_id() const
|
||||||
{ return CLASS_DATE_FIELD; }
|
{ return CLASS_DATE_FIELD; }
|
||||||
|
|
||||||
|
// Certified 100%
|
||||||
|
bool TDate_field::is_kind_of(word cid) const
|
||||||
|
{ return cid == CLASS_DATE_FIELD || TEdit_field::is_kind_of(cid); }
|
||||||
|
|
||||||
void TDate_field::create(WINDOW w)
|
void TDate_field::create(WINDOW w)
|
||||||
{
|
{
|
||||||
// Elimina il flag R che si interpreta come salva in formato ANSI
|
// Elimina il flag R che si interpreta come salva in formato ANSI
|
||||||
@ -3083,6 +3087,10 @@ TReal_field::TReal_field(TMask* m) : TEdit_field(m)
|
|||||||
word TReal_field::class_id() const
|
word TReal_field::class_id() const
|
||||||
{ return CLASS_REAL_FIELD; }
|
{ return CLASS_REAL_FIELD; }
|
||||||
|
|
||||||
|
// Certified 100%
|
||||||
|
bool TReal_field::is_kind_of(word cid) const
|
||||||
|
{ return cid == CLASS_REAL_FIELD || TEdit_field::is_kind_of(cid); }
|
||||||
|
|
||||||
void TReal_field::create(WINDOW w)
|
void TReal_field::create(WINDOW w)
|
||||||
{
|
{
|
||||||
_ctl_data._flags.strip("AFM");
|
_ctl_data._flags.strip("AFM");
|
||||||
|
@ -1016,6 +1016,9 @@ class TReal_field : public TEdit_field
|
|||||||
protected: // TMask_field
|
protected: // TMask_field
|
||||||
// @cmember Ritorna l'identificatore della calsse
|
// @cmember Ritorna l'identificatore della calsse
|
||||||
virtual word class_id() const;
|
virtual word class_id() const;
|
||||||
|
|
||||||
|
virtual bool is_kind_of(word cid) const;
|
||||||
|
|
||||||
// @cmember Crea il controllo
|
// @cmember Crea il controllo
|
||||||
virtual void create(WINDOW parent);
|
virtual void create(WINDOW parent);
|
||||||
|
|
||||||
@ -1088,7 +1091,9 @@ protected: // TEditable_field
|
|||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
// @cmember Legge un item del controllo dal file <p scanner>
|
// @cmember Legge un item del controllo dal file <p scanner>
|
||||||
void parse_head(TScanner& scanner);
|
virtual void parse_head(TScanner& scanner);
|
||||||
|
|
||||||
|
virtual bool is_kind_of(word cid) const;
|
||||||
|
|
||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
TDate_field(TMask* mask);
|
TDate_field(TMask* mask);
|
||||||
|
@ -667,14 +667,14 @@ void TSpreadsheet::update(
|
|||||||
if (!scroll)
|
if (!scroll)
|
||||||
{
|
{
|
||||||
xi_get_visible_rows(_obj, &first, &last);
|
xi_get_visible_rows(_obj, &first, &last);
|
||||||
scroll = items() < handle[first];
|
scroll = items() <= handle[first];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scroll)
|
if (scroll)
|
||||||
xi_scroll(_obj, XI_SCROLL_FIRST);
|
xi_scroll(_obj, XI_SCROLL_FIRST);
|
||||||
else
|
else
|
||||||
// xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
|
xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
|
||||||
xi_scroll(_obj, 0);
|
// xi_scroll(_obj, 0);
|
||||||
|
|
||||||
_needs_update = -1; // Clear pending row update
|
_needs_update = -1; // Clear pending row update
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user