From e35d75f96e6f5f3abf92f5a28295d45d1da25b45 Mon Sep 17 00:00:00 2001 From: guy <guy@c028cbd2-c16b-5b4b-a496-9718f37d4682> Date: Fri, 31 Oct 1997 13:43:39 +0000 Subject: [PATCH] applicat.cpp Cambiata una TString80 in TFilename form.cpp Corretto il settabbgio del background alla printer printer.cpp Corretto il gettaggio del background dalla printer ATTENZIONE: Queste due correzioni implicano aggiornamenti al programma che ha dichiarato come unico background nel form SECTION GRAPHICS FIRST e non ODD come tutti. git-svn-id: svn://10.65.10.50/trunk@5501 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/applicat.cpp | 2 +- include/form.cpp | 8 ++++---- include/printer.cpp | 18 ++++++++++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/include/applicat.cpp b/include/applicat.cpp index b390c1aed..59e5fd3e2 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -614,7 +614,7 @@ bool TApplication::set_firm(long newfirm) if (newfirm < 1) { TMask mask("bagn002"); - TString80 pp(__ptprf); pp.cut(pp.len()-1); + TFilename pp(__ptprf); pp.cut(pp.len()-1); mask.set(F_PATHPREF, pp); mask.show(-2, extended_firm()); diff --git a/include/form.cpp b/include/form.cpp index f8e2995a2..e70e3ef1e 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -2170,10 +2170,10 @@ bool TGraphic_section::update() int index; switch(page_type()) { - case even_page: index = 1; break; - case odd_page : index = 2; break; - case last_page: index = 3; break; - default : index = 0; break; + case even_page : index = 1; break; + case first_page: index = 2; break; + case last_page : index = 3; break; + default : index = 0; break; } printer().setbackground(_back, index); return ok; diff --git a/include/printer.cpp b/include/printer.cpp index 4423858db..8b490d5cf 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -575,11 +575,21 @@ void TPrinter::setbackground(const char* b, int index) TString_array& TPrinter::getbgdesc(word page) const { - if (_backgrounds.items() == 0) - ((TPrinter*)this)->_backgrounds.add(new TString_array(formlen())); - int index = (page > 0) ? ((page-1) % _backgrounds.items()) : 0; + int index = 0; + if (page == 0 && _backgrounds.objptr(3)) + index = 3; + if (page == 1 && _backgrounds.objptr(2)) + index = 2; + if (index == 0 && (page & 0x1) == 0 && _backgrounds.objptr(1)) + index = 1; + TString_array* bg = (TString_array*)_backgrounds.objptr(index); - CHECK(bg, "Null printer background"); + if (bg == NULL) + { + bg = new TString_array(formlen()); + ((TPrinter*)this)->_backgrounds.add(bg, index); // keep const + } + return *bg; }