Patch level : 12.0 400

Files correlati     : ba8.exe

Aggiunto un campo lughezza fissa per l'esportazione dei file di testo. Se non valorizzato il file non è a lughezza fissa.
Questa funzione sarà presente nei programmi dalla patch 402.

git-svn-id: svn://10.65.10.50/branches/R_10_00@23834 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2017-05-23 17:46:53 +00:00
parent b30cc9cc34
commit 6053f80c8e
7 changed files with 38 additions and 15 deletions

View File

@ -2,20 +2,25 @@
PAGE "Esportazione" -1 -1 76 5 PAGE "Esportazione" -1 -1 76 5
GROUPBOX DLG_NULL 74 4 GROUPBOX DLG_NULL 74 5
BEGIN BEGIN
PROMPT 1 1 "@bFile di Output" PROMPT 1 1 "@bFile di Output"
END END
STRING F_PRINTER 80 58 STRING F_PRINTER 80 48
BEGIN BEGIN
PROMPT 2 2 "Cartella " PROMPT 2 2 "Cartella "
DSELECT DSELECT
END END
STRING F_FORM 128 60 STRING F_FORM 128 50
BEGIN BEGIN
PROMPT 2 3 "File " PROMPT 2 3 "File "
END
STRING F_SIZE 128 60
BEGIN
PROMPT 2 4 "Lunghezza riga (txt) "
END END
ENDPAGE ENDPAGE

View File

@ -2236,7 +2236,9 @@ bool TBook::esporta()
split_file_if_needed(); split_file_if_needed();
TFilename fname; TFilename fname;
const KEY key = spotlite_ask_name(fname); int size;
const KEY key = spotlite_ask_name(fname, size);
bool ok = isalpha(key) != 0; bool ok = isalpha(key) != 0;
const bool signature = key >= 'a'; const bool signature = key >= 'a';
switch (key) switch (key)

View File

@ -21,7 +21,7 @@ bool spotlite_generate_name(const char* codnum, TFilename& pdf)
return ok; return ok;
} }
KEY spotlite_ask_name(TFilename& pdf) KEY spotlite_ask_name(TFilename& pdf, int & size)
{ {
TMask msk("bagn009"); TMask msk("bagn009");
@ -59,6 +59,10 @@ KEY spotlite_ask_name(TFilename& pdf)
pdf.tempdir(); pdf.tempdir();
if (!msk.field(F_FORM).empty()) if (!msk.field(F_FORM).empty())
export_name = msk.get(F_FORM); export_name = msk.get(F_FORM);
if (msk.id2pos(F_SIZE) >= 0 && !msk.field(F_SIZE).empty())
size = msk.get_int(F_SIZE);
else
size = 0;
pdf.add(export_name); pdf.add(export_name);
pdf.ext("pdf"); pdf.ext("pdf");

View File

@ -6,7 +6,7 @@
#endif #endif
bool spotlite_generate_name(const char* codnum, TFilename& pdf); bool spotlite_generate_name(const char* codnum, TFilename& pdf);
KEY spotlite_ask_name(TFilename& pdf); KEY spotlite_ask_name(TFilename& pdf, int & size);
bool spotlite_notify(const TFilename& pdf); bool spotlite_notify(const TFilename& pdf);
bool spotlite_send_mail(const TFilename& pdf); bool spotlite_send_mail(const TFilename& pdf);

View File

@ -770,7 +770,8 @@ void TTextfile::print ()
bool TTextfile::write ( bool TTextfile::write (
const char *path, // @parm Nome del file in cui scrivere il testo const char *path, // @parm Nome del file in cui scrivere il testo
TPoint * from, // @parm Punto da cui iniziare a scrivere il testo TPoint * from, // @parm Punto da cui iniziare a scrivere il testo
TPoint * to) // @parm Punto a cui terminare di scrivere il testo TPoint * to, // @parm Punto a cui terminare di scrivere il testo
int size) // @parm lunghezza della riga (0 = variabile, > 0 fissa)
{ {
FILE* fp = fopen(path, "w"); FILE* fp = fopen(path, "w");
if (fp != NULL) if (fp != NULL)
@ -792,8 +793,12 @@ bool TTextfile::write (
s = s.mid(startx); s = s.mid(startx);
else if (j == endy) else if (j == endy)
s = s.left(endx); s = s.left(endx);
TString8 frm("%s\n");
fprintf(fp, "%s\n", (const char *) s); if ( size > 0)
frm.format("%%%ds\n", -size);
fprintf(fp, frm, (const char *) s);
} }
fclose (fp); fclose (fp);
} }
@ -808,7 +813,8 @@ bool TTextfile::write (
void TTextfile::write( void TTextfile::write(
TString_array& arr, // @parm Array in cui scrivere il testo TString_array& arr, // @parm Array in cui scrivere il testo
TPoint * from, // @parm Punto da cui iniziare a scrivere il testo TPoint * from, // @parm Punto da cui iniziare a scrivere il testo
TPoint * to) // @parm Punto a cui terminare di scrivere il testo TPoint * to, // @parm Punto a cui terminare di scrivere il testo
int size) // @parm lunghezza della riga (0 = variabile, > 0 fissa)
{ {
arr.destroy(); arr.destroy();
TString s(512); TString s(512);
@ -829,6 +835,9 @@ void TTextfile::write(
else if (j == endy) else if (j == endy)
s = s.left(endx); s = s.left(endx);
if (size > 0)
s.rpad(size);
arr.add(s); arr.add(s);
} }
} }

View File

@ -174,9 +174,9 @@ public:
{ _interactive = on; } { _interactive = on; }
// @cmember Scrive il testo (non formattato) su file // @cmember Scrive il testo (non formattato) su file
bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL); bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL, int size = 0);
// @cmember Scrive il testo (non formattato) su TString_array // @cmember Scrive il testo (non formattato) su TString_array
void write(TString_array& a, TPoint* from = NULL, TPoint* to = NULL); void write(TString_array& a, TPoint* from = NULL, TPoint* to = NULL, int size = 0);
// @cmember Scrive il testo (non formattato) su file xls (tab separated text) // @cmember Scrive il testo (non formattato) su file xls (tab separated text)
bool write_xls(const TFilename& xls); bool write_xls(const TFilename& xls);

View File

@ -2251,8 +2251,11 @@ void TViswin::sel_to_clipboard()
bool TViswin::call_editor() bool TViswin::call_editor()
{ {
TFilename pdf; TFilename pdf;
const KEY key = spotlite_ask_name(pdf); int size;
const KEY key = spotlite_ask_name(pdf, size);
bool ok = key >= 'A' && key <= 'Z'; bool ok = key >= 'A' && key <= 'Z';
switch (key) switch (key)
{ {
case 'A': case 'A':
@ -2273,7 +2276,7 @@ bool TViswin::call_editor()
ok = _txt.write (pdf, &p1, &p2); ok = _txt.write (pdf, &p1, &p2);
} }
else else
ok = _txt.write (pdf, NULL, NULL); ok = _txt.write (pdf, NULL, NULL, size);
if (ok) if (ok)
::edit_url(pdf); ::edit_url(pdf);
break; break;