Patch level :4.0 981

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :corretti casini di riporto


git-svn-id: svn://10.65.10.50/trunk@15626 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-09-18 10:38:15 +00:00
parent 7d2b65b4b5
commit 180a0b720c
5 changed files with 11 additions and 198 deletions

View File

@ -685,16 +685,10 @@ bool list_custom_files(const char* ext, const char* classe, TString_array& files
TString_array lista;
TFilename path;
{
TWait_cursor hourglass;
TString_array files;
TFilename name = path.name();
const bool wild = (name.find('*') >= 0) || (name.find('?') >= 0);
if (!wild)
name = "*";
// Leggo i files in custom
if (main_app().has_module(RSAUT))
{
@ -704,7 +698,7 @@ bool list_custom_files(const char* ext, const char* classe, TString_array& files
xvt_fsys_mkdir(custom);
path = custom;
path.add(name);
path.add("*");
path.ext(ext);
}
list_files(path, lista);
@ -732,17 +726,8 @@ bool list_custom_files(const char* ext, const char* classe, TString_array& files
if (classe && *classe)
ok = acqua == classe;
list_files(path, files);
}
path = name; path.ext(ext); // Leggo i files in campo
list_files(path, files);
sort_files(files); // Ordino i files e rimuovo i doppioni
TString str;
FOR_EACH_ARRAY_ROW(files, i, row)
{
path = *row; path.ext(ext);
if (path.custom_path())
if (ok)
{
get_xml_child(stringona, "description", desc);
TToken_string* riga = new TToken_string;
@ -750,18 +735,18 @@ bool list_custom_files(const char* ext, const char* classe, TString_array& files
riga->add(acqua);
riga->add(desc);
files.add(riga);
}
}
}
return !files.empty();
}
bool select_custom_file(TFilename& path, const char* ext, const char* library)
bool select_custom_file(TFilename& path, const char* ext, const char* classe)
{
TArray_sheet sheet(-1, -1, 78, 20, TR("Selezione"), HR("Nome@8|Classe|Descrizione@50|Custom"));
TString_array& files = sheet.rows_array();
bool ok = list_custom_files(ext, library, files);
bool ok = list_custom_files(ext, classe, files);
if (ok)
{

View File

@ -995,7 +995,7 @@ void TBook::draw_text(const TRectangle& r, const char* txt)
define_frame(r);
*_out << "<text>" << endl << str << endl << "</text>" << endl;
}
}
}
}
void TBook::draw_text(const TRectangle& r, const TString_array& txt)
@ -1650,15 +1650,6 @@ bool TBook::init()
return true;
}
void TBook::close_output()
{
if (_out != NULL)
{
_out->close();
delete _out;
}
_out = NULL;
}
void TBook::split_file(int colonne)
{
@ -1720,105 +1711,6 @@ void TBook::split_file(int colonne)
_pages = _index.last();
}
void TBook::join_file(int pps)
{
TProgind pi(pages(), TR("Rigenerazione pagine"), true, true);
TFilename temp; temp.temp();
ofstream out(temp);
close_output(); // Chiudo file di stampa eventualmente aperto
ifstream ifs(_file); // Apro file di stampa da splittare
_index.destroy(); // Distruggo il vecchio indice delle pagine che poi ricostruisco
_pages = (_pages - 1) / pps + 1; // Ricalcolo in nuovo numero di pagine totali
int in_page = 1;
int out_page = 0;
int off_page = 0;
TString str(1024);
char* buffer = str.get_buffer();
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
if (str.starts_with("<page "))
{
SAFE_SCAN(str, "<page number=%d", &in_page);
// const int sub = (in_page % pps) - 1;
const int sub = ((in_page - 1) % pps);
off_page = sub * logical_page_height() / pps;
if (sub == 0)
{
out_page = (in_page - 1) / pps + 1;
_index.add_long(out.tellp(), out_page);
str.format("<page number=%d>", out_page);
}
else
{
// E' utile resettare l'allineamento dei testi :-)
str = "<text_align horizontal=L vertical=T />";
}
} else
if (str.starts_with("<frame ") && off_page > 0)
{
long x, y, dx, dy;
SAFE_SCAN(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
str.format("<frame x=%ld y=%ld dx=%ld dy=%ld />", x, y+off_page, dx, dy);
} else
if (str.starts_with("</page "))
{
if (out_page % pps == 0)
{
str.format("</page number=%d>", out_page);
out_page = 0;
}
else
continue;
}
out << str << endl;
}
if (out_page != 0) // Non ho ancora scritto l'ultimo fine pagina
{
str.format("</page number=%d>", out_page);
out << str << endl;
}
out.close();
// Sostituisce il file di stampa con quello joinato ed aggiorna l'indice delle pagine
fcopy(temp, _file);
xvt_fsys_removefile(temp);
}
bool TBook::split_file_if_needed()
{
const TPoint sheet(logical_page_width(), logical_page_height());
const int colonne = _max_frame.x > sheet.x ? (_max_frame.x+sheet.x-1) / sheet.x : 1;
if (colonne > 1)
{
if (yesno_box(FR("Si desidera suddividere le pagine su %d fogli"), colonne))
split_file(colonne);
}
else
{
const int pps = (_max_frame.y > 100 && pages() > 1) ? sheet.y / _max_frame.y : 1;
if (pps > 1)
{
if (yesno_box(FR("Si desidera raggruppare %d pagine per foglio"), pps))
join_file(pps);
}
}
_max_frame.x = _max_frame.y = 0; // Impedisce ulteriore splitting
return true;
}
void TBook::close_output()
{
if (_out != NULL)
@ -1829,66 +1721,6 @@ void TBook::close_output()
_out = NULL;
}
void TBook::split_file(int colonne)
{
TProgind pi(pages(), TR("Rigenerazione pagine"), true, true);
TFilename temp; temp.temp();
ofstream out(temp);
TPointer_array index;
close_output(); // Chiudo file di stampa eventualmente aperto
ifstream ifs(_file); // Apro file di stampa da splittare
TString str(1024);
char* buffer = str.get_buffer();
for (unsigned int page = 1; page <= pages(); page++)
{
if (!pi.setstatus(page))
break;
const streampos pos = _index.get_long(page);
for (int c = 0; c < colonne; c++)
{
const TRectangle rct_page(c*_pw, 0, _pw, _ph);
ifs.seekg(pos);
while (!ifs.eof())
{
ifs.getline(buffer, str.size());
if (str.starts_with("<page "))
{
const int p = (page-1)*colonne+1+c;
index.add_long(out.tellp(), p);
str.format("<page number=%d>", p);
} else
if (str.starts_with("<frame "))
{
long x, y, dx, dy;
sscanf(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
str.format("<frame x=%ld y=%ld dx=%ld dy=%ld />", x-rct_page.x, y, dx, dy);
} else
if (str.starts_with("</page "))
{
str.format("</page number=%d>", index.last());
}
out << str << endl;
if (str.starts_with("</page "))
break;
}
}
}
out.close();
// Sostituisce il file di stampa con quello splittato ed aggiorna l'indice delle pagine
fcopy(temp, _file);
xvt_fsys_removefile(temp);
_index = index;
_pages = _index.last();
}
void TBook::join_file(int pps)
{
TProgind pi(pages(), TR("Rigenerazione pagine"), true, true);
@ -1977,11 +1809,8 @@ bool TBook::split_file_if_needed()
{
if (_max_frame.x > 100 && _max_frame.y > 100) // Evita calcolo splitting se possibile
{
// Dalla 3.1 in poi deve essere fatto cosi'!
const TPoint sheet(logical_page_width(), logical_page_height());
// Nella 3.0 deve essere fatto cosa'!
// const TPoint sheet(_pw, _ph);
const TPoint sheet(_pw, _ph);
const int spp = _max_frame.x > sheet.x ? (_max_frame.x+sheet.x-1) / sheet.x : 1;
if (spp > 1 && can_split(spp)) // Sheets per page

View File

@ -1659,7 +1659,7 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
const char* title, const char* head, byte buttons,
TEdit_field& f, TToken_string& sibling)
: TCursor_sheet(cursor, fields, title, head, buttons,
f->browse() ? f->browse()->input_fields() : 1),
f.browse() ? f.browse()->input_fields() : 1),
_field(f), _sel(0), _original_filter(cursor->filter())
{
const bool normal = f.browse() != NULL && sibling.full();
@ -1732,7 +1732,7 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
TString8 flags;
if (c.roman()) flags << 'M';
if (c.roman()) flags << 'M';
if (c.right_justified()) flags << 'R';
if (c.uppercase()) flags << 'U';
if (c.zerofilled()) flags << 'Z';

View File

@ -225,7 +225,7 @@ class TBrowse_sheet : public TCursor_sheet
// @access:(INTERNAL) Private Member
{
// @cmember:(INTERNAL) Campi collegati ai campi editabili (vedi <c TEdit_field>)
TEdit_field* const _field;
TEdit_field& _field;
// @cmember:(INTERNAL) filtro originale del cursore
TString _original_filter;

View File

@ -803,7 +803,6 @@ HIDDEN bool _ora_val(TMask_field& f, KEY key)
else
return f.error_box(TR("Ora errata o formato non valido"));
}
}
}
return true;
}