array.cpp Corretto metodo TPointer_array::destroy
array.h Aggiunto metodo TPointer_array::insert_long browfile.h Aggiunto metodo TBrowse_file::set_vis_win da usare nelle derivazioni confapp.cpp Aggiornato uso del metodo TConfig::get (vedi sotto) config.h Tolto #include <xvt.h> Il metodo TConfig::get ora ritorna una 'const TString&' non piu' una 'TString&' I valori di default vengono scritti su file solo se non nulli controls.cpp Gestione menu di Modifica Allineamento dei bottoni a fianco di campi o listbox Corretta gestione dei tasti AltGr nelle tatstiere non U.S.A. git-svn-id: svn://10.65.10.50/trunk@6040 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
578ca8a01f
commit
33e30f1df6
@ -584,7 +584,7 @@ bool TPointer_array::destroy(
|
||||
return TArray::destroy(index, pack);
|
||||
}
|
||||
|
||||
TPointer_array& TPointer_array::operator= (const TArray& a)
|
||||
TPointer_array& TPointer_array::operator=(const TArray& a)
|
||||
{
|
||||
destroy();
|
||||
if (size() < a.size())
|
||||
@ -598,7 +598,8 @@ TPointer_array& TPointer_array::operator= (const TArray& a)
|
||||
|
||||
int TPointer_array::add(TObject* object, int index)
|
||||
{
|
||||
remove(index);
|
||||
if (index >= 0)
|
||||
remove(index);
|
||||
return TArray::add(object, index);
|
||||
}
|
||||
|
||||
@ -618,7 +619,8 @@ int TPointer_array::insert(const TObject& object, int index, bool force)
|
||||
|
||||
TBit_array::TBit_array(long size) : _bit(NULL), _size(0)
|
||||
{
|
||||
if (size) resize(index(size));
|
||||
if (size)
|
||||
resize(index(size));
|
||||
}
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
@ -216,7 +216,8 @@ public:
|
||||
virtual TPointer_array& operator= (const TArray& a);
|
||||
|
||||
long get_long(int index) const { return (long)objptr(index); }
|
||||
int add_long(long value, int index) { return add((TObject*)value, index); }
|
||||
int add_long(long value, int index = -1) { return add((TObject*)value, index); }
|
||||
int insert_long(long value, int index = -1) { return TArray::insert((TObject*)value, index, TRUE); }
|
||||
|
||||
TPointer_array() { }
|
||||
TPointer_array(int size) : TArray(size) { }
|
||||
|
@ -25,7 +25,7 @@ class TBrowsefile_field : public TOperable_field
|
||||
short _dlg;
|
||||
WINDOW _parent;
|
||||
|
||||
TString_array _background; // Background per usi diversi da anterpima!
|
||||
TString_array _background; // Background per usi diversi da anteprima!
|
||||
|
||||
protected:
|
||||
virtual word class_id() const;
|
||||
@ -36,6 +36,7 @@ protected:
|
||||
public:
|
||||
|
||||
TViswin* vis_win() const { return _viswin; }
|
||||
void set_vis_win(TViswin* viswin);
|
||||
|
||||
void add_line(const char* l);
|
||||
long set_text(const char* file, const char* line = NULL);
|
||||
|
@ -97,7 +97,7 @@ void TConfig_application::load_mask()
|
||||
const TFieldref* fr = f.field();
|
||||
const char* fname = fr->name();
|
||||
const int index = fr->to();
|
||||
TString& oldvl = _cnf->get(fname,NULL, index > -1 ? index : -1);
|
||||
const TString& oldvl = _cnf->get(fname,NULL, index > -1 ? index : -1);
|
||||
f.set(oldvl);
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,9 @@ void TConfig::_write_file()
|
||||
{
|
||||
if (_write_protected)
|
||||
return;
|
||||
|
||||
ifstream in(_file);
|
||||
|
||||
ifstream in(_file, ios::in, filebuf::sh_read);
|
||||
|
||||
TFilename temp;
|
||||
temp.temp("cnf");
|
||||
ofstream out(temp);
|
||||
@ -230,7 +231,7 @@ void TConfig::remove_all()
|
||||
// @rdesc Ritorna la stringa contenuta nella variabile, se questa esiste, altrimenti
|
||||
// il valore di default che dovrebbe assumere determinato dal parametro
|
||||
// <p def>
|
||||
TString& TConfig::get(
|
||||
const TString& TConfig::get(
|
||||
const char* var, // @parm Variabile della quale ritornare il valore
|
||||
const char* section, // @parm Sezione della varaibile (default NULL)
|
||||
int index, // @parm Eventuale indice della varaibailie (default -1)
|
||||
@ -245,8 +246,8 @@ TString& TConfig::get(
|
||||
{
|
||||
if (section) // Cambia paragrafo se necessario
|
||||
set_paragraph(section);
|
||||
|
||||
TString* val;
|
||||
|
||||
const TString* val;
|
||||
if (index >= 0)
|
||||
{
|
||||
TString v(80);
|
||||
@ -256,10 +257,15 @@ TString& TConfig::get(
|
||||
else
|
||||
val = (TString*)_data.objptr(var);
|
||||
|
||||
if (val == NULL) // Se non la trova inserisci il default
|
||||
{
|
||||
set(var, def, section, TRUE, index);
|
||||
val = &get(var, NULL, index);
|
||||
if (val == NULL) // Se non la trova inserisci il default
|
||||
{
|
||||
if (def && *def)
|
||||
{
|
||||
set(var, def, section, TRUE, index);
|
||||
val = &get(var, NULL, index);
|
||||
}
|
||||
else
|
||||
val = &EMPTY_STRING;
|
||||
}
|
||||
|
||||
return *val;
|
||||
@ -289,7 +295,7 @@ long TConfig::get_long(
|
||||
const char* n = get(var,section,index);
|
||||
if (*n)
|
||||
def = atol(n);
|
||||
else
|
||||
else if (def != 0)
|
||||
{
|
||||
TString16 d; d << def;
|
||||
set(var, d, section, TRUE, index);
|
||||
@ -322,7 +328,7 @@ char TConfig::get_char(
|
||||
const char* n = get(var,section,index);
|
||||
if (*n)
|
||||
def = *n;
|
||||
else
|
||||
else if (!isspace(def))
|
||||
{
|
||||
const char d[2] = { def, '\0' };
|
||||
set(var, d, section, TRUE, index);
|
||||
@ -380,7 +386,8 @@ bool TConfig::get_bool(
|
||||
// <mf TConfig::get_color>
|
||||
{
|
||||
const char* d = def ? "X" : "";
|
||||
const TString& s = get(var, section, index, d).upper();
|
||||
TString& s = (TString&)get(var, section, index, d);
|
||||
s.upper();
|
||||
return s != "" && (s == "X" || s == "Y" || s == "1" || s == "ON" || s == "YES" || s == "OK" || s == "TRUE");
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,6 @@
|
||||
#ifndef __CONFIG_H
|
||||
#define __CONFIG_H
|
||||
|
||||
#ifndef INCL_XVTH
|
||||
#include <xvt.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ASSOC_H
|
||||
#include <assoc.h>
|
||||
#endif
|
||||
@ -79,7 +75,7 @@ public:
|
||||
|
||||
// @cmember Ritorna il valore della variabile nella sezione corrente o in
|
||||
// quella specificata
|
||||
TString& get(const char* var, const char* section = NULL, int index = -1, const char* def = "");
|
||||
const TString& get(const char* var, const char* section = NULL, int index = -1, const char* def = "");
|
||||
|
||||
// @cmember Ritorna il valore della variabile nella sezione corrente o in
|
||||
// quella specificata (se la variabile contiene un long)
|
||||
@ -98,11 +94,11 @@ public:
|
||||
bool get_bool(const char* var, const char* section = NULL, int index = -1, bool def = FALSE);
|
||||
|
||||
// @cmember Ritorna il valore del colore settato nella variabile nella
|
||||
// sezione corrente o in quella specificata
|
||||
COLOR get_color(const char* var, const char* section = NULL, int index = -1, COLOR def = 0);
|
||||
// sezione corrente o in quella specificata (COLOR = unsigned long)
|
||||
unsigned long get_color(const char* var, const char* section = NULL, int index = -1, unsigned long def = 0);
|
||||
|
||||
// @cmember Setta il colore nella sezione corrente o specificata
|
||||
bool set_color(const char* var, COLOR col, const char* section = NULL, bool force = TRUE, int index = -1);
|
||||
bool set_color(const char* var, unsigned long col, const char* section = NULL, bool force = TRUE, int index = -1);
|
||||
|
||||
// @cmember Setta la variabile nella sezione corrente o specificata
|
||||
bool set(const char* var, const char* value, const char* section = NULL, bool force = TRUE, int index = -1);
|
||||
|
@ -73,12 +73,16 @@ HIDDEN int Y_FU_MULTIPLE = 0;
|
||||
HIDDEN const int ITF_CID = 30000;
|
||||
|
||||
KEY TControl::xiev_to_key(const XI_EVENT* xiev)
|
||||
{
|
||||
KEY key = xiev->v.chr.ch;
|
||||
{
|
||||
const int k = xiev->v.chr.ch;
|
||||
KEY key = k;
|
||||
if (key < K_INS || key > K_HELP)
|
||||
{
|
||||
if (xiev->v.chr.shift && (key < ' ' || key >= K_UP)) key += K_SHIFT;
|
||||
if (xiev->v.chr.control && key >= ' ') key += K_CTRL;
|
||||
if (xiev->v.chr.shift && (k < ' ' || k >= K_UP)) key += K_SHIFT;
|
||||
// if (xiev->v.chr.control && k >= ' ') key += K_CTRL;
|
||||
// Correzione per gestire i tasti AltGr sulle tastiere non U.S.A.
|
||||
if (xiev->v.chr.control && ((k >= K_F1 && k <= K_F12) || isalnum(k)))
|
||||
key += K_CTRL;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
@ -429,6 +433,9 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||
def->v.itf->tab_on_enter = TRUE;
|
||||
def->v.itf->win = win;
|
||||
|
||||
def->v.itf->edit_menu = TRUE; // Update edit menu items
|
||||
def->v.itf->menu_win = TASK_WIN; // Window that owns the menu
|
||||
|
||||
XI_OBJ* itf = xi_create(NULL, def);
|
||||
CHECK(itf, "Can't create an interface");
|
||||
|
||||
@ -532,7 +539,7 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
||||
ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj);
|
||||
else
|
||||
ctl = (TControl*)xi_get_app_data(xiev->v.xi_obj->parent);
|
||||
break;
|
||||
break;
|
||||
case a_xvt:
|
||||
switch (xiev->v.xvte.type)
|
||||
{
|
||||
@ -1146,7 +1153,7 @@ void TField_control::create(WINDOW win, short cid,
|
||||
RCT rct; coord2rct(win, left, top, width, height, rct);
|
||||
rct.right += XI_FU_MULTIPLE/4;
|
||||
|
||||
unsigned long attrib = flags2attr(flags);
|
||||
unsigned long attrib = flags2attr(flags) | XI_ATR_EDITMENU;
|
||||
if (AUTOSELECT)
|
||||
attrib |= XI_ATR_AUTOSELECT;
|
||||
if (!CAMPI_SCAVATI)
|
||||
@ -1187,15 +1194,18 @@ void TField_control::create(WINDOW win, short cid,
|
||||
CHECKD(_obj, "Can't create field ", cid);
|
||||
STX_DATA* stx = (STX_DATA*)_obj->v.field->stx;
|
||||
CHECKD(stx, "NULL stx for field ", cid);
|
||||
|
||||
if (button)
|
||||
{
|
||||
// Aggiusta il rettangolo del bottone in modo da allinearlo al testo
|
||||
RCT& br = (RCT&)_obj->v.field->btn_rct;
|
||||
const int offset = stx->rct.right - br.left - 1;
|
||||
br.left += offset;
|
||||
br.right += offset;
|
||||
br.bottom = stx->rct.bottom;
|
||||
}
|
||||
|
||||
// Aggiusta il rettangolo del bottone in modo da allinearlo al testo
|
||||
RCT& br = (RCT &) _obj->v.field->btn_rct;
|
||||
const int offset = stx->rct.right - br.left - 1;
|
||||
br.left += offset;
|
||||
br.right += offset;
|
||||
|
||||
update_tab_cid();
|
||||
|
||||
xi_dequeue();
|
||||
xi_tree_free(frm_def);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user