From 1dd712499dedf5f523a182ffe60a7452f0a83b1e Mon Sep 17 00:00:00 2001 From: angelo Date: Mon, 13 Nov 1995 08:18:10 +0000 Subject: [PATCH] Rif. mod. 95/52. Correzione a TForm::arrange_form(); ora il posizionamento avanza sempre di una riga; questo perche' non su tutte le stamp. si riescono a fare il flush dei caratteri senza andara a capo. Inserito il salvataggio dei dati General dopo la maschera di richiesta sezione. Inserito nel costruttore il font di default "Roman 17cpi". git-svn-id: svn://10.65.10.50/trunk@2133 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/form.cpp | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/include/form.cpp b/include/form.cpp index f403cd87d..e92176b74 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -1722,7 +1722,10 @@ bool TPrint_section::edit(const char* title) form().set_dirty(); _dirty = TRUE; } - if (m.get(F_CTP)[0] != form().char_to_pos()) + if (m.get(F_CTP)[0] != form().char_to_pos() || + m.get_int(F_IPX) != form().ipx() || + m.get_int(F_IPY) != form().ipy() || + m.get_int(F_PX) != form().fpx()) { form().char_to_pos() = m.get(F_CTP)[0]; form().ipx() = m.get_int(F_IPX); @@ -1778,7 +1781,28 @@ bool TPrint_section::edit(const char* title) } } } - + + if (_dirty && yesno_box("Dati generali modificati. Salvare?")) + { + TLocalisamfile frm(LF_FORM); + frm.zero(); + frm.put("TIPOPROF",form().name()); + frm.put("CODPROF",form().code()); + if (frm.read(_isequal,_lock) == NOERR) + { + frm.put("OFFY",form().offset_y()); + frm.put("OFFX",form().offset_x()); + frm.put("FONTNAME",form().fontname()); + frm.put("FONTSIZE",form().fontsize()); + frm.put("CTP",form().char_to_pos()); + frm.put("IPX", form().ipx()); + frm.put("IPY", form().ipy()); + frm.put("FPX", form().fpx()); + frm.rewrite(); + _dirty = FALSE; + } + } + const word flags = 0x08 | (form().edit_level() > 1 ? 0x06 : 0x00); TString80 caption("ID@4|Descrizione@40|Riga@R|Col.@R|Non stampare"); @@ -2351,14 +2375,14 @@ void TForm::arrange_form() { lpt = fopen(device,"w"); if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device); - fprintf(lpt,"%s",(const char*) bspc); - fprintf(lpt,"%s\r",(const char*) str_pos); +// fprintf(lpt,"%s",(const char*) bspc); + fprintf(lpt,"%s\n",(const char*) str_pos); fflush(lpt); fclose(lpt); } while (m.run() == K_ESC); // cicla sulla stampa posizionamento... const int h = height(odd_page); str_pos.cut(0); - for (i=0; i <= h; i++) str_pos << "\n"; + for (i=0; i < h; i++) str_pos << "\n"; lpt = fopen(device,"w"); if (lpt == NULL) fatal_box("Non rieso ad aprire il device %s.",device); fprintf(lpt, "%s", (const char*) str_pos); // Salta tante righe quanto e' lungo il form standard @@ -2561,7 +2585,6 @@ bool TForm::read_profile() prof.put("CODPROF",_code); if (prof.read(_isequal) == NOERR) { - bool complete = FALSE; rprof.zero(); rprof.put("TIPOPROF", _name); rprof.put("CODPROF", _code); @@ -2574,7 +2597,6 @@ bool TForm::read_profile() const pagetype pt = char2page(s[1]); const short id = rprof.get_int("ID"); - if (!complete) complete=TRUE; if (id == 0) { TPrint_section& se = section(sec, pt); @@ -2585,9 +2607,9 @@ bool TForm::read_profile() TForm_item& item = find_field(sec, pt, id); item.read_from(rprof.curr()); } - } - if (complete) // Get general data from header of form only if it's complete. - { // Complete means that there's at least a row + } + if (_code.not_empty()&& !_isnew) + { _x = prof.get_int("OFFX"); _y = prof.get_int("OFFY"); _fontname = prof.get("FONTNAME"); @@ -2674,7 +2696,7 @@ bool TForm::write_profile() TForm::TForm(const char* name, const char* code, int lev, const char* desc) : _name(name), _code(code), _relation(NULL), _cursor(NULL), _rel_desc(NULL), - _isnew(FALSE), _editlevel(lev), _desc(desc), _fontname("Courier New"), + _isnew(FALSE), _editlevel(lev), _desc(desc), _fontname("Roman 17cpi"), _fontsize(12), _x(0), _y(0), _char_to_pos('\0'), _ipx(0), _ipy(0), _fpx(0), _arrange(TRUE), _dirty(FALSE) {