From 10b377cf0ab053eb9f9c8bd16dd080e3cc0dee88 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 28 Feb 1996 16:58:50 +0000 Subject: [PATCH] Correzioni all'editor dei form git-svn-id: svn://10.65.10.50/trunk@2651 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/form.cpp | 89 +++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/include/form.cpp b/include/form.cpp index 9a00d432d..cbb2b2826 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -518,7 +518,8 @@ bool TForm_item::read_from(const TRectype& prof) changed = TRUE; } - TToken_string special(prof.get("SPECIAL"),'\n'); + TToken_string special(prof.get("SPECIAL"),'\n'); + special.rtrim(); const int sp_items = special.items(); for (i = 0; i < sp_items; i++) { @@ -560,7 +561,7 @@ void TForm_item::print_on(TRectype& prof) // una X alla fine (campo 3) { TToken_string special(128,'\n'); - _special.restart(); + _special.restart(); for (int i = 0; i < _special.items(); i++) { @@ -577,6 +578,7 @@ void TForm_item::print_on(TRectype& prof) special.add(sp); } } + special.rtrim(); prof.put("SPECIAL", special); } } @@ -2568,6 +2570,8 @@ bool TPrint_section::edit( { const bool is_ba_editor = TString(_form->section_mask()).left(2) == "ba"; bool nstd_dirty = FALSE; + bool font_found = FALSE; + _cur_form = _form; _cur_sect = this; @@ -2638,7 +2642,6 @@ bool TPrint_section::edit( const int MAX_FAMILIES = 128; char* family[MAX_FAMILIES]; const int num_families = (int)xvt_fmap_get_families(printer().get_printrcd(), family, MAX_FAMILIES); - bool font_found = FALSE; TToken_string pn1(256), pn2(256); for (int i = 0; i < num_families; i++) @@ -2650,8 +2653,13 @@ bool TPrint_section::edit( xvt_mem_free(family[i]); } TList_field& lst = (TList_field&)m.field(F_FONT); + if (!font_found) + { + warning_box("Il font %s non esiste per la stampante di default.",(const char*) form().fontname()); + pn1.add(form().fontname()); + pn2.add(form().fontname()); + } lst.replace_items(pn1, pn2); - if (!font_found) warning_box("Il font %s non esiste per la stampante di default.",(const char*) form().fontname()); lst.set(form().fontname()); printer().set_char_size(form().fontsize()); m.set_handler(F_FONT,font_handler); @@ -2725,45 +2733,48 @@ bool TPrint_section::edit( { if (!form().dirty()) form().set_dirty(); _dirty = TRUE; - s_data prm; - prm.size_1=form().fontsize(); - strcpy(prm.name_1,form().fontname()); - prm.size_2=size; - strcpy(prm.name_2,name); - prm.ratio = 1.0; - // Next 3 lines may be changed - xvt_print_open(); - xvt_print_start_thread (wpr, (long)&prm); - xvt_print_close(); - - form().fontname() = name; - form().fontsize() = size; - const char sechar[4] = { 'B', 'F', 'G', 'H' }; - for (int sn = 0; sn < 4 ; sn++) + if (font_found && yesno_box("E' stato cambiato il font o la dimensione del carattere\ndevo aggiornale le coordinate dei campi")) { - const char sc = sechar[sn]; - for (pagetype pt = odd_page; pt <= last_page; pt = pagetype(pt+1)) - { - TPrint_section* sec = form().exist(sc, pt); - if (sec != NULL && !sec->columnwise()) - { - sec->set_dirty(); - for (word i = 0; i < sec->fields() ; i++) - { - TForm_item& fi = sec->field(i); - short value = fi.x(); - if (value > 0 && (prm.ratio != 1.0)) + s_data prm; + prm.size_1=form().fontsize(); + strcpy(prm.name_1,form().fontname()); + prm.size_2=size; + strcpy(prm.name_2,name); + prm.ratio = 1.0; + // Next 3 lines may be changed + xvt_print_open(); + xvt_print_start_thread (wpr, (long)&prm); + xvt_print_close(); + + const char sechar[4] = { 'B', 'F', 'G', 'H' }; + for (int sn = 0; sn < 4 ; sn++) + { + const char sc = sechar[sn]; + for (pagetype pt = odd_page; pt <= last_page; pt = pagetype(pt+1)) + { + TPrint_section* sec = form().exist(sc, pt); + if (sec != NULL && !sec->columnwise()) + { + sec->set_dirty(); + for (word i = 0; i < sec->fields() ; i++) { - real x_pos; - x_pos = value * prm.ratio; - x_pos.round(); - fi.set_x((short)x_pos.integer()); - fi.set_dirty(); + TForm_item& fi = sec->field(i); + short value = fi.x(); + if (value > 0 && (prm.ratio != 1.0)) + { + real x_pos; + x_pos = value * prm.ratio; + x_pos.round(); + fi.set_x((short)x_pos.integer()); + fi.set_dirty(); + } } } - } - } - } + } + } + } + form().fontname() = name; + form().fontsize() = size; } } else // controlli se l'editor non e' quello base nstd_dirty = _form->post_edit_checks(m,_cur_sect);