Corretta l acreate() (esegue la new di TMask prima della dispatch_e_item)

aggiunto metodo mask() e check_form(). Modificate la paint_example e handler
di TFink_mask per rendere un po' piu' visibili le righe. Virtualizzata
la edit().


git-svn-id: svn://10.65.10.50/trunk@2312 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1995-12-16 10:45:54 +00:00
parent c4ee36ff0f
commit cf5e765ed1
2 changed files with 28 additions and 6 deletions

View File

@ -1,5 +1,6 @@
#include "baformed.h" #include "baformed.h"
#include <colors.h> #include <colors.h>
#include <tabutil.h>
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// maschera per le finkature // maschera per le finkature
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@ -65,7 +66,10 @@ void TFink_mask::handler(WINDOW win, EVENT* ep)
if (ep->type == E_UPDATE) if (ep->type == E_UPDATE)
{ {
// pittura le righette // pittura le righette
rect(xl, yt, xr+1, yb+1); line(xl,yt,xr,yt);
line(xl,yb,xr,yb);
line(xl,yt,xl,yb);
line(xr,yt,xr,yb);
line(xl, ym, xr, ym); line(xl, ym, xr, ym);
line(xm, yt, xm, yb); line(xm, yt, xm, yb);
paint_example(); paint_example();
@ -78,7 +82,7 @@ void TFink_mask::paint_example()
// on the right of the mask // on the right of the mask
TString line(xr); TString line(xr);
set_font(XVT_FFN_COURIER); set_font(XVT_FFN_COURIER);
set_color(MASK_DARK_COLOR,MASK_BACK_COLOR); set_color(MASK_LIGHT_COLOR,MASK_BACK_COLOR);
set_opaque_text(TRUE); set_opaque_text(TRUE);
for (int i = yt; i <= yb; i++) for (int i = yt; i <= yb; i++)
@ -182,6 +186,7 @@ bool TForm_editor::create()
} }
enable_menu_item(M_FILE_PRINT); enable_menu_item(M_FILE_PRINT);
_m = new TMask(selection_mask());
if ((form && code) || (form && code == 0 && _extra)) if ((form && code) || (form && code == 0 && _extra))
{ {
_form = new TForm(form, (code!=0) ? format("%05ld",code) : "", _extra ? 2 : 1); _form = new TForm(form, (code!=0) ? format("%05ld",code) : "", _extra ? 2 : 1);
@ -190,7 +195,6 @@ bool TForm_editor::create()
else else
dispatch_e_menu(MENU_ITEM(14)); dispatch_e_menu(MENU_ITEM(14));
_m = new TMask(selection_mask());
if (form) if (form)
{ {
_m->set(F_BASE, form); _m->set(F_BASE, form);
@ -365,6 +369,7 @@ bool TForm_editor::edit_formato_numero()
bool TForm_editor::edit_formato_data() bool TForm_editor::edit_formato_data()
{ {
bool dirty = FALSE; bool dirty = FALSE;
TString16 fmt("1"),sep("-");
char format[6] = { "1444-" }; char format[6] = { "1444-" };
TMask m("ba21dt"); TMask m("ba21dt");
@ -377,12 +382,27 @@ bool TForm_editor::edit_formato_data()
TDate dd(TODAY); TDate dd(TODAY);
TFormatted_date d(dd); TFormatted_date d(dd);
d.set_format(format); d.set_format(format);
if (_form->code()[4] != '\0')
{//Loads date format from %LNG
TTable l("%LNG");
l.put("CODTAB",_form->code()[4]);
if (l.read() == NOERR)
{
fmt = l.get("S7");//formato
fmt.cut(3);
sep.format("%c", l.get("S7")[3]);//separatore
if (sep!="-" && sep!="/" && sep!="." && sep!="," && sep!=" ") sep = "-";
if (fmt=="MAG") fmt = "2";
else if (fmt=="AMG") fmt = "3";
else fmt = "1";
}
}
m.set(F_DFORMAT, "1"); m.set(F_DFORMAT, fmt);
m.set(F_DDAY, "4"); m.set(F_DDAY, "4");
m.set(F_DMONTH, "4"); m.set(F_DMONTH, "4");
m.set(F_DYEAR, "4"); m.set(F_DYEAR, "4");
m.set(F_DSEP, "-"); m.set(F_DSEP, sep);
m.set(F_DEXAMPLE, d.string()); m.set(F_DEXAMPLE, d.string());
if (dirty = (m.run() == K_ENTER)) if (dirty = (m.run() == K_ENTER))

View File

@ -36,9 +36,11 @@ protected:
bool edit_fincatura(); bool edit_fincatura();
bool edit_formato_numero(); bool edit_formato_numero();
bool edit_formato_data(); bool edit_formato_data();
bool edit(char s, pagetype p); virtual bool edit(char s, pagetype p);
bool form_config() const; bool form_config() const;
void check_form() { if (_form != NULL) delete _form; }
TForm& form() { return *_form; } TForm& form() { return *_form; }
TMask& mask() { return *_m; }
public: public: