Corretta generazione campi memo

git-svn-id: svn://10.65.10.50/trunk@4424 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-05-27 16:56:21 +00:00
parent a5dac2cb67
commit 27beae6c17

View File

@ -232,7 +232,7 @@ private:
TMaschera *_m;
protected:
// Carica un file di tabella in un TString array
void carica_tabella( const TFilename& fn, TString_array& tabella );
@ -375,9 +375,9 @@ void TMaschera::item( const TString& str )
TToken_string s("", '~');
for( i = 0; i < u.items( ); i ++ )
{
{
s = u.get();
_out << "IT \"" << s.get(0) << "\"\n";
for( j = 1; j < s.items( ); j ++ )
_out << "ME " << s.get() << "\n";
@ -525,14 +525,14 @@ static void genera_campo( const TObject& campo )
static void verifica_campo( const TObject& campo )
{
// Per evitare 3000 casts ...
TField & cmp = (TField&) campo;
TField & cmp = (TField&) campo;
TGruppo & gruppo = cmp.grp();
cmp.stato(cmp.stato_reale());
if (cmp.stato() != S_NASCOSTO)
{
int h = cmp.y() + 1;
if (cmp.type() == T_CORNICE)
int h = cmp.y() + 1;
if (cmp.type() == T_CORNICE || cmp.type() == T_MEMO )
h += cmp.size()%100 - 1;
if (gruppo.height() < h)
gruppo.height(h);
@ -552,10 +552,10 @@ static void genera_gruppo( const TObject& gruppo )
grp.campi().for_each(verifica_campo);
do_events();
if(grp.present())
grp.genera();
grp.genera();
if (_bar)
_bar->addstatus(1);
}
TObject* TGruppo::dup() const
@ -565,10 +565,10 @@ TObject* TGruppo::dup() const
g->generatore(generatore());
g->present(present());
g->_fields = _fields;
g->_fields = _fields;
TArray & fields = g->campi();
const int items = fields.items();
for (int i = 0; i < items; i++)
((TField &)fields[i]).grp(g);
return g;
@ -662,9 +662,9 @@ TField::TField( )
}
TObject* TField::dup() const
{
{
TField * f = new TField;
f->_nome = _nome;
f->_fieldname = _fieldname;
f->_x = _x;
@ -684,7 +684,7 @@ TObject* TField::dup() const
f->_output = _output;
f->_special = _special;
f->_items = _items;
f->_configs = _configs;
f->_configs = _configs;
return f;
}
@ -698,54 +698,54 @@ int TField::stato_reale()
// e nella sezione CONFIGS nel .INI di definizione dei gruppi.
// Utilizza poi la minore delle due.
int stato = S_OBBLIGATORIO;
{
TToken_string config(fieldsini().get( "CONFIGS", _nome ));
const int items = config.items();
for ( int i = 0; i < items; i += 3 )
{
TString80 chiave(config.get(i));
const TString80 valore(config.get(i + 1));
const int pos = chiave.find( '[' );
int index = -1;
if ( pos >= 0 )
{
index = atoi(chiave.sub(pos + 1, chiave.find( ']')));
chiave.cut(pos);
}
}
if ( valore == ditta( ).get( chiave, "ve", index))
stato = config.get_int(i + 2);
}
}
TToken_string riga_profilo(grp().generatore().profilo().get(_nome, "PROFILO"));
const int stato_profilo = riga_profilo.get_int(P_STATO);
if (stato > stato_profilo )
stato = stato_profilo;
if (stato > S_NASCOSTO)
if (stato > S_NASCOSTO)
{
const TString80 gruppo(fieldsini().get("GROUP", _nome));
TToken_string config(groupsini().get("CONFIGS", gruppo));
const int items = config.items( );
int stato_gruppo = S_OBBLIGATORIO;
for ( int i = 0; i < items; i += 3 )
{
const TString80 chiave = config.get( i );
const TString80 valore = config.get( i + 1 );
if (valore == ditta( ).get( chiave, "ve"))
stato_gruppo = config.get_int(i + 2);
};
if (stato > stato_gruppo)
stato = stato_gruppo;
const int stato_gruppo_profilo = grp().generatore().profilo().get_int(gruppo, "PROFILOGRUPPO");
if (stato > stato_gruppo_profilo)
stato = stato_gruppo_profilo;
}
@ -793,9 +793,9 @@ void TField::genera( )
break;
default:
break;
}
}
if ((_type == T_DATA || _type == T_STRINGA ||
_type == T_NUMERO || _type == T_MEMO) &&
_type == T_NUMERO || _type == T_MEMO) &&
(_stato == S_OBBLIGATORIO || !_use.blank()))
m.check( _stato );
if ( !_fieldname.blank( ) ) m.field( _fieldname );
@ -831,36 +831,36 @@ TMask_generator::TMask_generator( const TString& profilo ) : _fieldsini( "ve0300
if( param == "-all" )
{
TString_array profiles;
{
TAssoc_array profiles_array;
TRelation rel("%TIP");
TCursor t( &rel );
long count = t.items();
for( t = 0; t.pos( ) < count; ++t )
{
{
const TString profile_name(t.curr().get("S4"));
TFilename profile(profile_name);
profile.ext("ini");
if (fexist(profile) && !profiles_array.is_key(profile_name))
profiles_array.add(profile_name);
}
profiles_array.get_keys(profiles);
}
TProgind bar( profiles.items(), "Generazione automatica profili", FALSE, TRUE);
const int items = profiles.items();
for (int i = 0; i < items; i++)
{
const TString &profile = profiles.row(i);
const TString &profile = profiles.row(i);
genera(profile);
bar.addstatus(1);
}
_ditta.set( "CHANGED", "", "ve" );
}
_ditta.set( "CHANGED", "", "ve" );
}
else genera( profilo );
}
@ -1103,7 +1103,7 @@ void TMask_generator::intestazione_pagina( )
_m->group( 11 );
_m->flag( "D" );
_m->end( );
}
void TMask_generator::genera( const TString& profilo )
@ -1111,7 +1111,7 @@ void TMask_generator::genera( const TString& profilo )
int i, last;
TString temp_s;
TFilename proname( profilo );
// All'inizio il gruppo h 'chiuso'
_groupopen = FALSE;
@ -1119,7 +1119,7 @@ void TMask_generator::genera( const TString& profilo )
proname.ext( "ini" );
// Se il file di profilo non esiste, esci con un errore fatale
if (!fexist( proname))
if (!fexist( proname))
{
error_box( "Il profilo %s non esiste!", ( const char * )profilo);
return;
@ -1129,7 +1129,7 @@ void TMask_generator::genera( const TString& profilo )
TFilename _mskname( _pro->get( "MSKFILE", "MAIN") );
_mskname.ext( "msk" );
do_events();
// Mi serve per ordinare i gruppi a seconda del documento
TAssoc_array grouporder;
@ -1142,7 +1142,7 @@ void TMask_generator::genera( const TString& profilo )
_m->control( T_BOTTONE, DLG_SAVEREC, 1002 );
_m->begin( );
_m->prompt( -15, -1, "~Registra" );
_m->message( "EXIT,20082" );
_m->message( "EXIT,20082" );
_m->picture(BMP_SAVEREC);
_m->picture(BMP_SAVERECDN);
_m->end( );
@ -1156,7 +1156,7 @@ void TMask_generator::genera( const TString& profilo )
_m->control( T_BOTTONE, 99, 1002 );
_m->begin( );
_m->prompt( -35, -1, "E~labora" );
_m->message( "EXIT,345" );
// _m->message( "EXIT,345" );
_m->end( );
_m->control( T_BOTTONE, DLG_PRINT, 1002 );
@ -1188,13 +1188,13 @@ void TMask_generator::genera( const TString& profilo )
_m->control( T_STRINGA, F_CODNUM, 4 );
_m->begin( );
_m->prompt( 2, 1, "Cod. num. " );
_m->field("CODNUM");
_m->field("CODNUM");
_m->use("%NUM", 1);
temp_s.format("CODTAB %d", F_CODNUM);
_m->input(temp_s);
_m->display("\"Codice\" CODTAB~\"Descrizione@50\" S0");
temp_s.format("%d S0", F_DESNUM);
_m->output(temp_s);
_m->output(temp_s);
_m->check(S_NORMALE);
_m->flag( "GDU" );
_m->message( "CO,2@" );
@ -1345,15 +1345,15 @@ void TMask_generator::genera( const TString& profilo )
last = _pro->get_int( "NGROUPS", "ORDINEGRUPPI" );
for( i = 1; i <= last; i ++ )
{
do_events();
do_events();
chiave.format( "%d", i );
chiavegruppo.GROUPKEY( _pro->get_int( chiave, "ORDINEGRUPPI" ) );
if( _gruppi.is_key( chiavegruppo ) )
sortedgroups.add( _gruppi[ (chiavegruppo) ] );
}
TString80 message;
message.format("Generazione profilo : %s", (const char *) profilo);
_bar = new TProgind(sortedgroups.items(), message, FALSE, TRUE);
sortedgroups.for_each( genera_gruppo );
@ -1383,10 +1383,10 @@ void TMask_generator::genera( const TString& profilo )
_m->end( );
// Generazione pagina dei piedi
// Generazione pagina dei piedi
{
TToken_string s(_pro->get("CAMPICALC", "MAIN"));
if (s.not_empty())
{
intestazione_pagina( );
@ -1394,32 +1394,32 @@ void TMask_generator::genera( const TString& profilo )
int nr = 1;
int id = 0;
for (const char * cp = s.get(0); cp && *cp; cp = s.get())
{
{
const TString16 codpiede(cp);
do_events();
frd.zero( );
frd.put( "CODTAB", codpiede );
frd.put( "CODTAB", codpiede );
if ( frd.read( ) == NOERR )
{
const TString80 picture(frd.get( "S3"));
const TString80 picture(frd.get( "S3"));
const int len = picture.len() > 0 ? picture.len() : 18;
int dec = picture.find(',');
if (dec >= 0)
dec = len - dec - 1;
else
dec = 0;
id++;
dec = 0;
id++;
if (frd.get_bool("B0"))
_m->control( T_NUMERO, BASE_PIEDE + id, len * 100 + dec);
else
_m->control( T_STRINGA, BASE_PIEDE + id, len * 100);
_m->begin( );
TString80 header(frd.get("S0")); header.left_just(58 - len);
_m->prompt( 2, 7 + nr, header );
_m->field(codpiede);
_m->field(codpiede);
if (picture.not_empty())
_m->picture(picture);
@ -1454,8 +1454,8 @@ void TMask_generator::genera( const TString& profilo )
// Applicazione guscio
class TGenMask_application : public TApplication
{
{
protected:
virtual bool create ( );
@ -1467,7 +1467,7 @@ protected:
bool TGenMask_application::create( )
{
TApplication::create( );
TApplication::create( );
TMask_generator *a = new TMask_generator(argv(2));
delete a;
return FALSE;