Modifiche varie ed eventuali. Iniziato l'oggetto cliente

git-svn-id: svn://10.65.10.50/trunk@1787 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
matteo 1995-09-06 13:53:23 +00:00
parent 8a1e81ca02
commit 0a2b57b225
2 changed files with 2159 additions and 2119 deletions

View File

@ -29,7 +29,7 @@
#endif
#ifndef __VEUML_H
#include "VEUML.H"
#include "veuml.h"
#endif
#ifndef __SHEET_H
@ -45,15 +45,19 @@
#endif
#ifndef __VE0100_H
#include "VE0100.H"
#include "ve0100.h"
#endif
#ifndef __VE0100C_H
#include "VE0100C.H"
#include "ve0100C.h"
#endif
#ifndef __VE0100D_H
#include "VE0100D.H"
#include "ve0100D.h"
#endif
#ifndef __TCLIFOR_H
#include "tclifor.h"
#endif
// Numero di colonne presenti sullo sheet totale
@ -88,12 +92,6 @@ class TMotore_application : public TRelation_application
// Puntatore allo sheet delle righe documento
TSheet_field* _sheet;
// Posizione delle colonne nello sheet
int _pos_cols[ MAX_COLUMNS ];
// Numero di colonne realmente presenti sullo sheet
int _realcols;
// Ridefinizione dei metodi virtuali
virtual bool user_create( );
virtual bool user_destroy( );
@ -184,13 +182,10 @@ public:
virtual ~TMotore_application( ) { if ( _pro ) delete _pro; }
virtual const char* get_next_key( );
int numero_colonne( ){ return _realcols; }
int posizione_colonna( int index ){ return _pos_cols[ index ]; }
};
HIDDEN TMotore_application& app( ) { return (TMotore_application&) main_app( ); }
int TMotore_application::user_function( int index )
{
switch( index )
@ -271,7 +266,7 @@ void TMotore_application::user_set_handler( int fieldid, int index )
bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
{
if ( key == K_INS )
if ( key == K_INS ) // Inserimento
{
TMask& m = *app( )._msk1;
TTable tabtr( "%TRI" );
@ -281,43 +276,34 @@ bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
TToken_string& riga = ss.row( r );
riga.add( 1, 0 );
riga.add( m.get( F_LBTIPORIGA ), 1 );
riga.add( tabtr.get( "S4" ), 2 );
return TRUE;
};
if ( key == K_CTRL + K_INS ) // Dopo inserimento
{
TMask& m = *app( )._msk1;
TTable tabtr( "%TRI" );
tabtr.zero( );
tabtr.put( "CODTAB", m.get( F_LBTIPORIGA ) );
tabtr.read( );
TToken_string& riga = ss.row( r );
TFilename nome_proriga( tabtr.get( "S4" ) );
riga.add( nome_proriga, 2 );
nome_proriga.ext( "ini" );
TConfig pro( nome_proriga );
int ncols = pro.get_int( "NCOLS", "COLUMNS" );
// Disabilita tutte le colonne
for( int i = 1; i < app( ).numero_colonne( ); i ++ )
for( int i = 1; i <= MAX_COLUMNS; i ++ )
ss.disable_cell ( ss.items( ) - 1, i );
for( i = 1; i < ncols; i ++ )
// Abilita le colonne indicate nel profilo della riga
for( i = 1; i <= ncols; i ++ )
{
TString16 chiave;
chiave.format( "%d", i );
int coltoenable = pro.get_int( chiave, "COLUMNS" );
ss.enable_cell ( ss.items( ) - 1, app().posizione_colonna( coltoenable ) );
ss.enable_cell ( ss.items( ) - 1, coltoenable - 1 );
};
ss.force_update( );
app( ).curr_mask( ).send_key( K_ROWEDIT, F_SHEET );
// ss.on_key( K_SPACE );
// ss.edit( ss.items( ) );
/*
nome_proriga.ext( "ini" );
TConfig proriga( nome_proriga );
TMask *sm = new TMask( proriga.get( "MSK", "MAIN" ) );
// int numhandler = proriga.get_int( "NHANDLER", "HANDLERS" );
// for( int i = 1; i <= numhandler; i ++ )
// {
// TString chiave;
// chiave.format( "%d", i );
// TToken_string riga = proriga.get( chiave, "HANDLERS" );
// app().user_set_handler( riga.get_int( 0 ), riga.get_int( 1 ) );
// };
sm->disable( DLG_DELREC );
if ( sm->run( ) == K_ENTER )
{
// Riga inserita, vai col disabilitare le colonne
delete sm;
ss.force_update( ); */
return TRUE;
};
return TRUE;
@ -351,7 +337,11 @@ bool TMotore_application::num_handler( TMask_field& f, KEY key )
// Copio la descriozione della numerazione
m.set(F_DESNUM, tabnum.get("S0") );
// Copio i tipi di documento validi per la numerazione
m.set(F_TIPIDOCS, tabnum.get("S2") );
const TString tipidocs( tabnum.get("S2") );
m.set(F_TIPIDOCS, tipidocs );
// Propone il primo tipo di documento come default
m.set(F_TIPODOC, tipidocs.left( 4 ) );
// Se per questa numerazione è abilitata le numerazione provvisoria
if ( tabnum.get_bool ( "B0" ) )
{
@ -398,16 +388,30 @@ bool TMotore_application::tip_handler(TMask_field& f, KEY key)
return TRUE;
}
TString tipi_consentiti( m.get( F_TIPIDOCS ) );
TString tipo( f.get( ) );
if( tipi_consentiti.find( tipo ) % 4 )
{ message_box( "Tipo non valido per la numerazione selezionata!" );
f.set( "" );
return FALSE; }
TString16 tipo( f.get( ) );
tipo.trim( );
bool tipo_valido = FALSE;
for ( int i = 0; i < 10; i ++ )
{
TString16 curtipo( tipi_consentiti.mid( i * 4, 4 ) );
curtipo.trim( );
if( curtipo == tipo )
{
tipo_valido = TRUE;
break;
}
}
if( ! tipo_valido )
{
message_box( "Tipo non valido per la numerazione selezionata!" );
f.set( "" );
return FALSE;
}
TTable tabtip( "%TIP" );
tabtip.read( );
m.set(F_DESTIPODOC, tabtip.get("S0") );
m.set(F_PROFILO, tabtip.get("S4") );
};
}
if (key == K_ENTER && m.is_running( ) )
{ TString tipo( f.get( ) );
if ( ! tipo.blank( ) )
@ -464,8 +468,8 @@ bool TMotore_application::changing_mask(int mode)
void TMotore_application::configura_sheet( TSheet_field& sheet, TConfig& config )
{
_realcols = config.get_int( "NCOLS", "SHEET" );
for( int i = 1; i <= _realcols; i ++ )
int ncols = config.get_int( "NCOLS", "SHEET" );
for( int i = 1; i <= ncols; i ++ )
{
TString col;
col.format( "%d", i );
@ -478,7 +482,6 @@ void TMotore_application::configura_sheet( TSheet_field& sheet, TConfig& config
sheet.set_column_width( i, sheet_col.get_int( 2 ) );
int coltomove = sheet_col.get_int( 0 ) - 1;
sheet.move_column( coltomove, i );
_pos_cols[ coltomove ] = i;
};
for ( int j = MAX_COLUMNS; j >= i - 1; j -- )
sheet.delete_column( j );
@ -808,6 +811,14 @@ void TMotore_application::calcola_riga( TRectype& r )
bool TMotore_application::user_create( )
{
TCliFor C;
C.load( 'C', 1 );
TString s;
TString s1( C.get( LF_CLIFO, "RAGSOC" ) );
TString s2( C.get( LF_CFVEN, "CODINDDOC" ) );
s.format( "%s:%d", ( const char * )s1, atoi( s2 ) );
message_box( ( const char * ) s );
azzera_piedi( );
_msk = new TMask("VE1000A");
query_mask( ).set_handler( F_NDOC, ndoc_handler );
@ -819,14 +830,11 @@ bool TMotore_application::user_create( )
// Metto in relazione testata e righe
_rel = new TRelation(LF_DOC);
rel( ).add( LF_RIGHEDOC,"CODNUM=CODNUM;ANNO=ANNO;PROVV=PROVV;NDOC=NDOC" );
rel( ).add( LF_RIGHEDOC,"CODNUM=CODNUM|ANNO=ANNO|PROVV=PROVV|NDOC=NDOC" );
// Inizializzo il Record_array
_righe_rec = new TRecord_array( LF_RIGHEDOC, "NRIGA", 1 );
// Inizializzo l'array con la posizione delle colonne
for( int i = 0; i <= MAX_COLUMNS; i ++ )
_pos_cols[ i ] = -1;
return TRUE;
}

View File

@ -80,7 +80,7 @@
// Numero massimo di linee per pagina
#define MAX_LINES_PER_PAGE 17
#define MAX_LINES_PER_PAGE 16
#define MASK_FIRST_LINE 6
class TMaschera : public TObject
@ -211,35 +211,53 @@ void TMaschera::check( const int i )
void TMaschera::control( const int type, const int id, const int size )
{
switch ( type )
{ case T_DATE : _out << "DA"; break;
case T_STRING : _out << "ST"; break;
case T_BOOLEAN : _out << "BO"; break;
case T_NUMBER : _out << "NU"; break;
case T_LISTBOX : _out << "LI"; break;
case T_MEMO : _out << "ME"; break;
case T_GROUPBOX : _out << "GR"; break;
};
{
case T_DATE:
_out << "DA";
break;
case T_STRING:
_out << "ST";
break;
case T_BOOLEAN:
_out << "BO";
break;
case T_NUMBER:
_out << "NU";
break;
case T_LISTBOX:
_out << "LI";
break;
case T_MEMO:
_out << "ME";
break;
case T_GROUPBOX:
_out << "GR";
break;
}
_out << " " << id;
if ( size > 0 )
{ if ( size > 100 )
{
if ( size > 100 )
_out << " " << ( int )( size / 100 ) << " " << ( size % 100 );
else
_out << " " << size;
};
else
_out << " " << size;
}
_out << "\n";
}
void TMaschera::item( const TString& str )
{ int i, j;
TToken_string u( str, '@' );
TToken_string s;
{
int i, j;
TToken_string u( str, '@' );
TToken_string s;
for( i = 0; i < u.items(); i ++ )
{ _out << "IT \"" << s[ 0 ] << "\"\n";
for( j = 1; j < s.items(); j ++ )
_out << "ME " << s[ j ] << "\n";
}
}
for( i = 0; i < u.items(); i ++ )
{
_out << "IT \"" << s[ 0 ] << "\"\n";
for( j = 1; j < s.items(); j ++ )
_out << "ME " << s[ j ] << "\n";
}
}
class TGruppo : public TObject
{
@ -362,6 +380,7 @@ TField::TField( TString& campo, TConfig& pro ) : _nome( campo )
_gruppo = pro.get_int( "GROUP", campo );
CHECK( _gruppo != 0, "Gruppo uguale a 0" );
_id = pro.get_int( "MSKID", campo );
CHECK( _id != 0, "Campo con MSKID uguale a 0" );
_type = pro.get_int( "TYPE", campo );
_size = pro.get_int( "SIZE", campo );
_prompt = pro.get( "PROMPT", campo );
@ -419,7 +438,7 @@ TField::TField( )
_configs.separator( '~' );
_items = "";
_items.separator( '@' );
};
}
void TField::configura( TConfig& pro )
{
@ -445,25 +464,24 @@ void TField::genera( TMaschera& m )
m.control( _type, _id );
m.begin();
switch( _stato )
{ case FS_HIDDEN:
m.prompt( 2, 2 );
s = "H";
s << _flag;
m.flag( s ) ;
break;
case FS_DISABLED :
m.prompt( _x, _y + m.line( ), _prompt );
s = "D";
s << _flag;
m.flag( s ) ;
// m.advance_line( );
break;
case FS_NORMAL :
case FS_REQUIRED :
m.prompt( _x, _y + m.line( ), _prompt );
m.flag( _flag );
// m.advance_line( );
break;
{
case FS_HIDDEN:
m.prompt( 2, 2 );
s = "H";
s << _flag;
m.flag( s ) ;
break;
case FS_DISABLED :
m.prompt( _x, _y + m.line( ), _prompt );
s = "D";
s << _flag;
m.flag( s ) ;
break;
case FS_NORMAL :
case FS_REQUIRED :
m.prompt( _x, _y + m.line( ), _prompt );
m.flag( _flag );
break;
}
m.check( _stato );
if ( !_fieldname.blank( ) ) m.field( _fieldname );
@ -477,10 +495,11 @@ void TField::genera( TMaschera& m )
if ( !_special.blank( ) ) m.outline( _special );
m.end();
if ( ( m.line() > MAX_LINES_PER_PAGE ) && ( m._pageopen == TRUE))
{ m.end();
m._pageopen = FALSE;
m.line( MASK_FIRST_LINE );
};
{
m.end();
m._pageopen = FALSE;
m.line( MASK_FIRST_LINE );
}
}
@ -621,78 +640,85 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TArray& a )
TField *campo = NULL;
while ( infile.ok( ) )
{ line = infile.line( );
while ( ( line.empty() || line[ 0 ] == '#' ) && infile.ok( ) )
{ line = infile.line( );
line.trim(); }
if( infile.ok( ) )
{ if ( line[ 0 ] == '[' ) // Carica un un campo
{ line.strip( "[]" );
if ( campo )
{ a.add( campo );
// delete campo;
};
campo = new TField();
campo->nome( line );
}
else
{ int pos;
if( ( pos = line.find( '=' ) ) == 0 )
yesnofatal_box( "Linea errata nel file.INI: %s", (const char *) line );
else
{
TString key = line.sub( 0, pos );
key.trim();
TString value = line.mid( pos + 1 );
value.trim();
if( key == "X" )
{ campo->x( atoi( value ) ); }
else if( key == "Y" )
{ campo->y( atoi( value ) ); }
else if( key == "GROUP" )
{ campo->gruppo( atoi( value ) ); }
else if( key == "FIELDNAME" )
{ campo->fieldname( value ); }
else if( key == "MSKID" )
{ campo->id( atoi( value ) ); }
else if( key == "TYPE" )
{ campo->type( atoi( value ) ); }
else if( key == "SIZE" )
{ campo->size( atoi( value ) ); }
else if( key == "PROMPT" )
{ if( value[ 0 ] == '"' )
{ value.rtrim( 1 );
value.ltrim( 1 ); };
campo->prompt( value ); }
else if( key == "FLAG" )
{ campo->flag( value ); }
else if( key == "USE" )
{ campo->use( (TToken_string & ) value ); }
else if( key == "INPUT" )
{ campo->input( (TToken_string & )value ); }
else if( key == "DISPLAY" )
{ campo->display( (TToken_string & )value ); }
else if( key == "OUTPUT" )
{ campo->output( (TToken_string & )value ); }
else if( key == "WARNING" )
{ campo->warning( value ); }
else if( key == "HELP" )
{ campo->help( value ); }
else if( key == "SPECIAL" )
{ campo->special( (TToken_string & )value ); }
else if( key == "ITEMS" )
{ campo->items( (TToken_string & )value ); }
else if( key == "CONFIGS" )
{ campo->configs( (TToken_string & )value ); }
else yesnofatal_box( "Chiave non trovata(%s)", (const char *) key );
}
}
}
}
{
line = infile.line( );
line.trim( );
while ( ( line.empty() || line[ 0 ] == '#' || line.left( 2 ) == "//" ) && infile.ok( ) )
{
line = infile.line( );
line.trim();
}
if( infile.ok( ) )
{
if ( line[ 0 ] == '[' ) // Carica un un campo
{
line.strip( "[]" );
if ( campo )
a.add( campo );
campo = new TField();
campo->nome( line );
}
else
{
int pos;
if( ( pos = line.find( '=' ) ) == 0 )
yesnofatal_box( "Linea errata nel file.INI: %s", (const char *) line );
else
{
TString key = line.sub( 0, pos );
key.trim();
TString value = line.mid( pos + 1 );
value.trim();
if( key == "X" )
campo->x( atoi( value ) );
else if( key == "Y" )
campo->y( atoi( value ) );
else if( key == "GROUP" )
campo->gruppo( atoi( value ) );
else if( key == "FIELDNAME" )
campo->fieldname( value );
else if( key == "MSKID" )
campo->id( atoi( value ) );
else if( key == "TYPE" )
campo->type( atoi( value ) );
else if( key == "SIZE" )
campo->size( atoi( value ) );
else if( key == "PROMPT" )
{
if( value[ 0 ] == '"' )
{
value.rtrim( 1 );
value.ltrim( 1 );
};
campo->prompt( value );
}
else if( key == "FLAG" )
campo->flag( value );
else if( key == "USE" )
campo->use( (TToken_string & ) value );
else if( key == "INPUT" )
campo->input( (TToken_string & )value );
else if( key == "DISPLAY" )
campo->display( (TToken_string & )value );
else if( key == "OUTPUT" )
campo->output( (TToken_string & )value );
else if( key == "WARNING" )
campo->warning( value );
else if( key == "HELP" )
campo->help( value );
else if( key == "SPECIAL" )
campo->special( (TToken_string & )value );
else if( key == "ITEMS" )
campo->items( (TToken_string & )value );
else if( key == "CONFIGS" )
campo->configs( (TToken_string & )value );
else yesnofatal_box( "Chiave non trovata(%s)", (const char *) key );
}
}
}
}
if ( campo )
{ a.add( campo );
// delete campo;
};
a.add( campo );
}
void TMask_generator::carica_tabella( const TFilename& fn, TString_array& tabella )
@ -922,6 +948,12 @@ void TMask_generator::genera( )
_m->message( "CO,4@" );
_m->end();
_m->control( T_STRING, F_TIPOCF, 1 );
_m->begin();
_m->prompt( 2, 2, "Tipo CF " );
_m->flag( "H" );
_m->end();
_m->control( T_STRING, F_DESTIPODOC, 50 );
_m->begin();
_m->prompt( 24, 2 );