diff --git a/src/include/bagn009.uml b/src/include/bagn009.uml index 8c70f384c..0f5779b2e 100755 --- a/src/include/bagn009.uml +++ b/src/include/bagn009.uml @@ -2,20 +2,25 @@ PAGE "Esportazione" -1 -1 76 5 -GROUPBOX DLG_NULL 74 4 +GROUPBOX DLG_NULL 74 5 BEGIN PROMPT 1 1 "@bFile di Output" END -STRING F_PRINTER 80 58 +STRING F_PRINTER 80 48 BEGIN - PROMPT 2 2 "Cartella " + PROMPT 2 2 "Cartella " DSELECT END -STRING F_FORM 128 60 +STRING F_FORM 128 50 BEGIN - PROMPT 2 3 "File " + PROMPT 2 3 "File " +END + +STRING F_SIZE 128 60 +BEGIN + PROMPT 2 4 "Lunghezza riga (txt) " END ENDPAGE diff --git a/src/include/reprint.cpp b/src/include/reprint.cpp index 7ed93cb94..f1713ea36 100755 --- a/src/include/reprint.cpp +++ b/src/include/reprint.cpp @@ -2236,7 +2236,9 @@ bool TBook::esporta() split_file_if_needed(); TFilename fname; - const KEY key = spotlite_ask_name(fname); + int size; + + const KEY key = spotlite_ask_name(fname, size); bool ok = isalpha(key) != 0; const bool signature = key >= 'a'; switch (key) diff --git a/src/include/spotlite.cpp b/src/include/spotlite.cpp index 2eb520fb7..6468a5d8f 100755 --- a/src/include/spotlite.cpp +++ b/src/include/spotlite.cpp @@ -21,7 +21,7 @@ bool spotlite_generate_name(const char* codnum, TFilename& pdf) return ok; } -KEY spotlite_ask_name(TFilename& pdf) +KEY spotlite_ask_name(TFilename& pdf, int & size) { TMask msk("bagn009"); @@ -59,6 +59,10 @@ KEY spotlite_ask_name(TFilename& pdf) pdf.tempdir(); if (!msk.field(F_FORM).empty()) 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.ext("pdf"); diff --git a/src/include/spotlite.h b/src/include/spotlite.h index 4e4c49302..54c3350fe 100755 --- a/src/include/spotlite.h +++ b/src/include/spotlite.h @@ -6,7 +6,7 @@ #endif 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_send_mail(const TFilename& pdf); diff --git a/src/include/text.cpp b/src/include/text.cpp index d00072cf4..10fa5b8d5 100755 --- a/src/include/text.cpp +++ b/src/include/text.cpp @@ -770,7 +770,8 @@ void TTextfile::print () bool TTextfile::write ( const char *path, // @parm Nome del file in cui 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"); if (fp != NULL) @@ -792,8 +793,12 @@ bool TTextfile::write ( s = s.mid(startx); else if (j == endy) 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); } @@ -808,7 +813,8 @@ bool TTextfile::write ( void TTextfile::write( TString_array& arr, // @parm Array in cui 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(); TString s(512); @@ -829,6 +835,9 @@ void TTextfile::write( else if (j == endy) s = s.left(endx); + if (size > 0) + s.rpad(size); + arr.add(s); } } diff --git a/src/include/text.h b/src/include/text.h index fa8d64de7..601a78d3e 100755 --- a/src/include/text.h +++ b/src/include/text.h @@ -174,9 +174,9 @@ public: { _interactive = on; } // @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 - 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) bool write_xls(const TFilename& xls); diff --git a/src/include/viswin.cpp b/src/include/viswin.cpp index 3da29f9f8..2b0a001ce 100755 --- a/src/include/viswin.cpp +++ b/src/include/viswin.cpp @@ -2251,8 +2251,11 @@ void TViswin::sel_to_clipboard() bool TViswin::call_editor() { 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'; + switch (key) { case 'A': @@ -2273,7 +2276,7 @@ bool TViswin::call_editor() ok = _txt.write (pdf, &p1, &p2); } else - ok = _txt.write (pdf, NULL, NULL); + ok = _txt.write (pdf, NULL, NULL, size); if (ok) ::edit_url(pdf); break;