Riportate le modifche relative al controllo sul font della stampante

gia' presente in TPrint_section::edit().


git-svn-id: svn://10.65.10.50/trunk@2755 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-04-22 10:22:30 +00:00
parent 0c945f23fe
commit 0be38a2b39

View File

@ -99,7 +99,7 @@ protected:
static bool lng_handler(TMask_field& f, KEY k);
static bool ccodes_handler(TMask_field& f, KEY k);
static bool clngs_handler(TMask_field& f, KEY k);
void load_fonts();
bool load_fonts();
void change_pos(char sc, pagetype pt);
bool recalculate_positions(const char* name, int size);
void remove_temp_items(char sec, pagetype p);
@ -332,7 +332,7 @@ bool TForm_EC_editor::font_handler(TMask_field& f, KEY key)
return TRUE;
}
void TForm_EC_editor::load_fonts()
bool TForm_EC_editor::load_fonts()
{
const int MAX_FAMILIES = 128;
char* family[MAX_FAMILIES];
@ -352,6 +352,7 @@ void TForm_EC_editor::load_fonts()
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());
return font_found;
}
void TForm_EC_editor::change_pos(char sc, pagetype pt)
@ -389,8 +390,6 @@ bool TForm_EC_editor::recalculate_positions(const char* name, int size)
xvt_print_start_thread (wprms, (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++)
{
@ -567,8 +566,6 @@ bool TForm_EC_editor::edit(char s, pagetype p)
}
if (!extra() || (extra() && other))
{
// Carica i fonts disponibili nel listbox
load_fonts();
printer().set_char_size(form().fontsize()); // Questo settera' il carattere della stampante a quello del form
// Setta l'handler per il listbox dei fonts e per aggiornare i valori dello sfondo
_msk->set_handler(F_SFONT,font_handler);
@ -603,10 +600,12 @@ bool TForm_EC_editor::edit(char s, pagetype p)
_msk->set(F_BACKX,pict.x());
_msk->set(F_BACKY,pict.y());
}
bool font_changed=FALSE;
bool font_changed=FALSE,font_found;
while (TRUE)
{
// Carica i fonts disponibili nel listbox
bool local_dirty = FALSE;
font_found = load_fonts();
enable_menu_item(M_FILE_PRINT);
k = _msk->run();
disable_menu_item(M_FILE_PRINT);
@ -614,8 +613,12 @@ bool TForm_EC_editor::edit(char s, pagetype p)
{
font_changed = TRUE;
TString ff(_msk->get(F_SFONT));
dirty = recalculate_positions(ff, _msk->get_int(F_SSIZE)); // Va bene dirty e non local_dirty
printer().set_char_size(_msk->get_int(F_SSIZE)); // Questo settera' il carattere della stampante a quello del form
int ss=_msk->get_int(F_SSIZE);
if (font_found && yesno_box("E' stato cambiato il font o la dimensione del carattere\ndevo aggiornare le coordinate dei campi"))
dirty = recalculate_positions(ff, ss); // Va bene dirty e non local_dirty
form().fontname() = ff;
form().fontsize() = ss;
printer().set_char_size(ss); // Questo settera' il carattere della stampante a quello del form
}
if (k==K_F3) local_dirty = edit_fincatura();
else if (k==K_F4) local_dirty = edit_formato_data();
@ -652,10 +655,10 @@ bool TForm_EC_editor::edit(char s, pagetype p)
if (!local_dirty) // E' stato premuto annulla dalla maschera di sezione
{ // Quindi ripristina la vecchia sezione
form().section(s,odd_page) = saved_section;
if (font_changed)
if (font_changed && font_found)
//se e' stato cambiato il font allora in _prm ho i dati necessari
// per ricostruire le dimensioni corrette
change_pos(s,odd_page);
change_pos(s,odd_page);
}
}
}