Migliorata gestione cursore attesa e aggiunta Tab_app

git-svn-id: svn://10.65.10.50/trunk@813 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-01-03 14:19:41 +00:00
parent 9693095752
commit 1071675ff5
12 changed files with 1329 additions and 1158 deletions

View File

@ -10,6 +10,7 @@
#include <modaut.h>
#include <applicat.h>
#include <colors.h>
#include <config.h>
#include <mask.h>
#include <prefix.h>
@ -53,12 +54,7 @@ bool xvt_running() { return _application != NULL; }
HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
{
#if XVT_OS == XVT_OS_WIN
clear_window( win, COLOR_GRAY );
#else
clear_window( win, COLOR_BLUE );
#endif
clear_window(win, MASK_DARK_COLOR);
return 0L;
}
@ -648,6 +644,27 @@ bool TApplication::config()
return ok;
}
void TApplication::set_cursor(bool w)
{
static _count = 0;
if (w)
{
_count++;
if (_count == 1)
::set_cursor(TASK_WIN, CURSOR_WAIT);
}
else
{
_count--;
#ifdef DBG
if (_count >= 0)
yesnofatal_box("end_wait without matching begin_wait");
#endif
if (_count == 0)
::set_cursor(TASK_WIN, CURSOR_ARROW);
}
}
void TApplication::on_firm_change()
{}

View File

@ -37,7 +37,12 @@ class TApplication
word _waiting;
static TString16 _user;
void terminate(); // End of application
void set_cursor(bool w); // Change mouse cursor
bool config(); // Change parameters
void about() const; // About box
protected:
const char* get_module_name() const;
static long task_eh(WINDOW win, EVENT* ep);
@ -58,10 +63,6 @@ protected:
void set_user(const char * user) { _user = user; }
void set_perms();
void terminate();
bool config();
void about() const;
public:
// @FPUB
@ -101,6 +102,9 @@ public:
void wait_for(word taskid) { _waiting = taskid; }
void wake_up() { _waiting = 0; }
word waiting() const { return _waiting; }
void begin_wait() { set_cursor(TRUE); } // Set CURSOR_WAIT
void end_wait() { set_cursor(FALSE); } // Set CURSOR_ARROW
TApplication();
virtual ~TApplication();

View File

@ -94,13 +94,7 @@ END
BOOLEAN MSK_1_ISGRAPHICS
BEGIN
PROMPT 4 8 "Salva configurazione"
HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
END
BOOLEAN MSK_1_ISGRAPHICS
BEGIN
PROMPT 4 9 "Stampa elementi grafici"
PROMPT 4 8 "Stampa elementi grafici"
HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
END

View File

@ -5,8 +5,9 @@
#include <xvt.h>
#endif
extern COLOR MASK_COLOR;
extern COLOR MASK_BACK_COLOR;
extern COLOR MASK_LIGHT_COLOR;
extern COLOR MASK_DARK_COLOR;
extern COLOR NORMAL_COLOR;
extern COLOR NORMAL_BACK_COLOR;
extern COLOR DISABLED_COLOR;
@ -16,6 +17,10 @@ extern COLOR FOCUS_BACK_COLOR;
const COLOR COLOR_DKCYAN = MAKE_COLOR(0,128,128);
const COLOR COLOR_DKYELLOW = MAKE_COLOR(128,128, 0);
const COLOR COLOR_DKGREEN = MAKE_COLOR(0,128, 0);
const COLOR COLOR_DKBLUE = MAKE_COLOR(0,0,128);
const COLOR COLOR_DKRED = MAKE_COLOR(128,0, 0);
const COLOR COLOR_DKMAGENTA = MAKE_COLOR(128,0,128);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -452,6 +452,7 @@ protected:
virtual void read_from(const TMask& m);
virtual bool parse_item(TScanner&);
virtual bool read();
virtual bool update();
const char* get() const;
@ -462,8 +463,6 @@ protected:
TFieldref& field(int i) const { return (TFieldref&)_field[i]; }
void put_paragraph(const char* s);
bool read();
public:
TForm_string(TPrint_section* section) : TForm_item(section) {}
virtual ~TForm_string() {}
@ -569,6 +568,7 @@ void TForm_string::put_paragraph(const char* s)
bool TForm_string::update()
{
TForm_item::update();
if (read())
{
if (_picture.not_empty())
@ -579,7 +579,8 @@ bool TForm_string::update()
}
else
put_paragraph(get());
}
}
return TRUE;
}
@ -632,7 +633,9 @@ class TForm_date : public TForm_string
{
protected:
virtual const char* class_name() const { return "DATA"; }
virtual bool read();
virtual bool set(const char*);
bool set(const TDate& d);
public:
TForm_date(TPrint_section* section);
@ -642,24 +645,30 @@ public:
TForm_date::TForm_date(TPrint_section* section)
: TForm_string(section)
{
if (automagic())
{
TDate oggi(TODAY);
set(oggi.string());
}
}
{}
bool TForm_date::read()
{
bool ok = TForm_string::read();
if ((!ok || !get()[0]) && automagic())
{
set(main_app().printer().getdate());
ok = TRUE;
}
return ok;
}
bool TForm_date::set(const char* s)
{
const TDate d(s);
TForm_string::set(d.string((width() == 8) ? 2 : 4));
#ifdef DBG
return d.ok();
#else
return TRUE;
#endif
}
bool TForm_date::set(const TDate& d)
{
TForm_string::set(d.string((width() == 8) ? 2 : 4));
return TRUE;
}
///////////////////////////////////////////////////////////

View File

@ -118,10 +118,10 @@ void TMask::handler(WINDOW win, EVENT* ep)
if (win != toolwin())
{
clear_window(win, MASK_BACK_COLOR);
RCT r; get_client_rect(win, &r);
xvt_draw_rect(win, r, MASK_COLOR, COLOR_GRAY, 1);
RCT r; get_client_rect(win, &r); r.right--; r.bottom--;
xvt_draw_rect(win, r, MASK_LIGHT_COLOR, MASK_DARK_COLOR, 1);
}
else clear_window(win, COLOR_GRAY);
else clear_window(win, MASK_DARK_COLOR);
#else
clear_window(win, MASK_BACK_COLOR);
#endif

View File

@ -258,6 +258,7 @@ public:
bool print (TPrintrow& rowtoprint);
bool isopen() { return _isopen; }
void setdate(const TDate& d) { _date = d; }
const TDate& getdate() const { return _date; }
TPrtype printtype() { return _printertype; }
void set_printtype(TPrtype dest) { _printertype=dest; }
void set_printerfile(const char * ffile) { _printerfile=ffile; }

View File

@ -462,11 +462,11 @@ bool TSheet::update_row(long n)
if (chk)
{
changed = TRUE;
set_color(MASK_BACK_COLOR, COLOR_LTGRAY);
set_color(MASK_BACK_COLOR, NORMAL_BACK_COLOR);
}
else if (_disabled[n])
{
set_color(COLOR_GRAY, COLOR_LTGRAY);
set_color(DISABLED_COLOR, NORMAL_BACK_COLOR);
changed = TRUE;
}
@ -497,7 +497,7 @@ bool TSheet::update_row(long n)
stringat(x1, y, s);
}
if (changed)
set_color(COLOR_BLACK, COLOR_LTGRAY);
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
return TRUE;
}
@ -520,9 +520,9 @@ void TSheet::update()
{
if (_last_update < 0)
{
set_color(COLOR_BLACK, COLOR_WHITE);
set_brush(COLOR_WHITE);
set_pen(COLOR_BLACK);
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
set_pen(NORMAL_COLOR);
set_brush(NORMAL_BACK_COLOR);
set_font(FF_FIXED);
_visible_rows = rows() - reserved_rows() - head_on();
}

75
include/tabapp.cpp Executable file
View File

@ -0,0 +1,75 @@
#include <relapp.h>
#include <stdtypes.h>
#include <tabutil.h>
#include <execp.h>
#include <utility.h>
#include <tabapp.h>
void Tab_application::print()
{
#if XVT_OS == XVT_OS_WIN
TExternal_app stampa(format("ba3a -1 %s", (const char *) _tabname));
#else
TExternal_app stampa(format("ba3 -1 %s", (const char *) _tabname));
#endif
stampa.run();
}
void Tab_application::init_query_mode(TMask& m)
{
m.send_key(K_SHIFT + K_CTRL + 'e', -GR_MODIFY_PROTECTED);
m.send_key(K_SHIFT + K_CTRL + 'e', -GR_RECORD_PROTECTED);
}
void Tab_application::init_modify_mode(TMask& m)
{
m.send_key(K_SHIFT + K_CTRL + 'd', -GR_MODIFY_PROTECTED);
const bool enable = !(_rel->curr().get_bool(FPC));
m.send_key(K_SHIFT + K_CTRL + 'd' + enable, -GR_RECORD_PROTECTED);
}
bool Tab_application::protected_record(TRectype& rec)
{
return rec.get_bool(FPC);
}
bool Tab_application::user_create()
{
if (argc() < 3)
return FALSE;
_tabname = argv(2);
if (_tabname.empty())
return FALSE;
_tabname.upper();
TString16 m, t(_tabname);
if (t[0] == '%') t.ltrim(1);
m << "BATB" << t;
_msk = new TMask(m) ;
for (int i = 0; i < _msk->fields(); i++)
if (_msk->fld(i).in_group(GR_SEARCH))
{
set_search_field(_msk->fld(i).dlg());
break;
}
_rel = new TRelation(_tabname);
set_title(_msk->get_caption());
return TRUE;
}
bool Tab_application::user_destroy()
{
if (_msk) delete _msk;
if (_rel) delete _rel;
return TRUE;
}

38
include/tabapp.h Executable file
View File

@ -0,0 +1,38 @@
#ifndef __TABAPP_H
#define __TABAPP_H
#ifndef __RELAPP_H
#include <relapp.h>
#endif
#define GR_SEARCH 29
#define GR_MODIFY_PROTECTED 30
#define GR_RECORD_PROTECTED 31
#define FPC "FPC"
class Tab_application : public TRelation_application
{
TMask* _msk;
TRelation* _rel;
TString16 _tabname;
protected:
virtual bool protected_record(TRectype& rec);
virtual TMask* get_mask(int mode = NO_MODE) { return _msk;}
virtual bool changing_mask(int mode) { return FALSE;}
virtual TRelation* get_relation() const { return _rel;}
virtual void init_query_mode(TMask& m);
virtual void init_modify_mode(TMask& m);
virtual bool user_create() ;
virtual bool user_destroy() ;
virtual void print();
public:
Tab_application() : _msk(NULL), _rel(NULL) {}
virtual ~Tab_application() {}
const TString& get_tabname() const { return _tabname; }
};
#endif

View File

@ -26,6 +26,7 @@ short BASEY = 8;
short ROWY = 8;
COLOR MASK_BACK_COLOR = COLOR_WHITE;
COLOR MASK_DARK_COLOR = COLOR_BLUE;
COLOR NORMAL_COLOR = COLOR_BLACK;
COLOR NORMAL_BACK_COLOR = COLOR_WHITE;
COLOR DISABLED_COLOR = COLOR_GRAY;
@ -75,8 +76,9 @@ HIDDEN LOGFONT LogFont;
HIDDEN int FontWeight;
COLOR MASK_COLOR = COLOR_CYAN;
COLOR MASK_BACK_COLOR = COLOR_DKCYAN;
COLOR MASK_LIGHT_COLOR = COLOR_CYAN;
COLOR MASK_DARK_COLOR = COLOR_GRAY;
COLOR NORMAL_COLOR = COLOR_BLACK;
COLOR NORMAL_BACK_COLOR = COLOR_LTGRAY;
COLOR DISABLED_COLOR = COLOR_GRAY;
@ -490,8 +492,9 @@ void customize_controls(bool on)
{
TConfig colors(CONFIG_GENERAL, "Colors");
MASK_COLOR = colors.get_color("Mask", NULL, -1, MASK_COLOR);
MASK_BACK_COLOR = colors.get_color("MaskBack", NULL, -1, MASK_BACK_COLOR);
MASK_LIGHT_COLOR = colors.get_color("MaskLight", NULL, -1, MASK_LIGHT_COLOR);
MASK_DARK_COLOR = colors.get_color("MaskDark", NULL, -1, MASK_DARK_COLOR);
NORMAL_COLOR = colors.get_color("Normal", NULL, -1, NORMAL_COLOR);
NORMAL_BACK_COLOR = colors.get_color("NormalBack", NULL, -1, NORMAL_BACK_COLOR);
DISABLED_COLOR = colors.get_color("Disabled", NULL, -1, DISABLED_COLOR);