Centrato meglio il testo del banner iniziale

Adeguata printwin al fatto che title e' ora un TString& e non un const char*
MOdificato leggermente comportamento del tasto ESC in modo query in modo da
forzare la rilettura della maschera corrente (utile per ba4200?)


git-svn-id: svn://10.65.10.50/trunk@249 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-09-15 16:45:33 +00:00
parent 113424a344
commit 4af8e5aea4
5 changed files with 36 additions and 32 deletions

View File

@ -80,11 +80,9 @@ HIDDEN void create_backdrop( void )
class TBanner : public TWindow class TBanner : public TWindow
{ {
enum { Y = 6, X = 60 };
protected: protected:
virtual void handler(WINDOW win, EVENT* ep); virtual void handler(WINDOW win, EVENT* ep);
public: public:
TBanner(); TBanner();
~TBanner(); ~TBanner();
@ -92,8 +90,8 @@ public:
TBanner::TBanner() TBanner::TBanner()
{ {
create(-1, -1, X, Y, "BANNER", WSF_NONE, W_PLAIN); const int w = main_app().title().len()*3+4;
set_font(FF_TIMES, FS_BOLD, 28); create(-1, -1, w, 6, "BANNER", WSF_NONE, W_PLAIN);
hide_brush(); hide_brush();
open_modal(); open_modal();
do_events(); do_events();
@ -110,19 +108,28 @@ void TBanner::handler(WINDOW win, EVENT* ep)
{ {
clear(COLOR_LTGRAY); clear(COLOR_LTGRAY);
RCT r; get_client_rect(win, &r); RCT r; get_client_rect(win, &r);
r.left += CHARY; r.right -= CHARY;
r.top += CHARY; r.bottom -= CHARY;
set_pen(COLOR_BLACK); win_draw_rect(win, &r);
offset_rect(&r, 1, 1);
set_pen(COLOR_WHITE); win_draw_rect(win, &r);
char* t = (char*)(const char*)main_app().title();
const int w = win_get_text_width(win, t, -1);
const int x = (X*CHARX-w)>>1, y = (Y+2)*CHARY>>1;
set_color(COLOR_WHITE, COLOR_LTGRAY); set_color(COLOR_WHITE, COLOR_LTGRAY);
set_font(FF_TIMES, FS_BOLD, 28);
char* t = (char*)(const char*)main_app().title();
int w = win_get_text_width(win, t, -1);
int x = (r.right-r.left-w)>>1, y = r.bottom - 4*CHARY;
win_draw_text(win, x+2, y+2, t, -1); win_draw_text(win, x+2, y+2, t, -1);
set_color(COLOR_BLACK, COLOR_LTGRAY); set_color(COLOR_BLACK, COLOR_LTGRAY);
win_draw_text(win, x, y, t, -1); win_draw_text(win, x, y, t, -1);
icon(2, 2);
set_font(FF_TIMES);
t = "Attendere prego ...";
w = win_get_text_width(win, t, -1);
x = (r.right-r.left-w)>>1, y = r.bottom - 2*CHARY;
win_draw_text(win, x, y, t, -1);
r.left += CHARX; r.right -= CHARX;
r.top += CHARX; r.bottom -= CHARX;
set_pen(COLOR_BLACK); win_draw_rect(win, &r);
offset_rect(&r, 1, 1);
set_pen(COLOR_WHITE); win_draw_rect(win, &r);
win_draw_icon(win, CHARX<<1, CHARX<<1, ICON_RSRC);
} }
else else
TWindow::handler(win, ep); TWindow::handler(win, ep);

View File

@ -65,7 +65,7 @@ public:
int argc() const { return __argc; } int argc() const { return __argc; }
void set_title(const char* t) { _title = t; } void set_title(const char* t) { _title = t; }
const char* title() const { return _title; } const TString& title() const { return _title; }
void wait_for(const char* name); void wait_for(const char* name);
void wake_up_caller() const; void wake_up_caller() const;

View File

@ -72,6 +72,7 @@ class TPrint_application : public TApplication
TProgind* _prind; TProgind* _prind;
const char* _picture; const char* _picture;
MENU_TAG _last_choice; MENU_TAG _last_choice;
int _ncopies;
bool _repeat_print; bool _repeat_print;
// set the printer // set the printer
@ -455,6 +456,8 @@ public:
{ printer().setcurrentpage(n); } { printer().setcurrentpage(n); }
void set_n_copies(int n) { _ncopies = n; }
int get_n_copies() { return _ncopies; }
void repeat_print() { _repeat_print = TRUE; } void repeat_print() { _repeat_print = TRUE; }
TPrint_application(); TPrint_application();

View File

@ -5,7 +5,7 @@
void TPrintwin::paint_background(long j) void TPrintwin::paint_background(long j)
{ {
_isbackground = _bg->items() > 0 && MainApp()->printer().isgraphics(); _isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
if (!_isbackground) return; if (!_isbackground) return;
int rw = (int)(j % _formlen); int rw = (int)(j % _formlen);
TString& rwd = (TString&)(*_bg)[rw]; TString& rwd = (TString&)(*_bg)[rw];
@ -166,23 +166,23 @@ TPrintwin::~TPrintwin()
TPrintwin::TPrintwin(PRINT_RCD* p, TTextfile& txt, int chsz) : TPrintwin::TPrintwin(PRINT_RCD* p, TTextfile& txt, int chsz) :
_printrcd(p), _aborted(FALSE), _txt(txt), _char_size(chsz) _printrcd(p), _aborted(FALSE), _txt(txt), _char_size(chsz)
{ {
WINDOW w = new_print_window(_printrcd, (char*)MainApp()->title()); WINDOW w = new_print_window(_printrcd, (char*)(const char*)main_app().title());
set_win(w); set_win(w);
if (w != NULL_WIN) if (w != NULL_WIN)
{ {
_bg = MainApp()->printer().getbgdesc(); _bg = main_app().printer().getbgdesc();
_isbackground = _bg->items() > 0 && MainApp()->printer().isgraphics(); _isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
_formlen = MainApp()->printer().formlen(); _formlen = main_app().printer().formlen();
set_font(FF_SYSTEM,0,_char_size); set_font(FF_SYSTEM,0,_char_size);
win_get_font_metrics(win(), &_lead, &_ascent, &_descent); win_get_font_metrics(win(), &_lead, &_ascent, &_descent);
_charx = win_get_text_width(win(), "MM", -1) - win_get_text_width(win(), "M", -1); _charx = win_get_text_width(win(), "MM", -1) - win_get_text_width(win(), "M", -1);
_chary = MainApp()->printer().get_dots_per_line(); _chary = main_app().printer().get_dots_per_line();
RCT rct; get_client_rect(win(),&rct); RCT rct; get_client_rect(win(),&rct);
_vofs = MainApp()->printer().get_vert_offset(); _vofs = main_app().printer().get_vert_offset();
_hofs = (rct.right - rct.left) % _charx; _hofs = (rct.right - rct.left) % _charx;
} }
else _aborted = TRUE; else _aborted = TRUE;

View File

@ -1,4 +1,4 @@
// $Id: relapp.cpp,v 1.8 1994-09-13 16:43:48 guy Exp $ // $Id: relapp.cpp,v 1.9 1994-09-15 16:45:33 guy Exp $
#include <mailbox.h> #include <mailbox.h>
#include <sheet.h> #include <sheet.h>
#include <urldefid.h> #include <urldefid.h>
@ -696,15 +696,9 @@ bool TRelation_application::main_loop()
{ {
case K_ESC: case K_ESC:
if (save(TRUE)) if (save(TRUE))
{ query_mode();
if (_mask->query_mode()) if (_lnflag)
{ k = K_QUIT;
_mask->reset();
set_fixed();
}
else query_mode();
}
if (_lnflag) k = K_QUIT;
break; break;
case K_QUIT: case K_QUIT:
if (save(TRUE)) if (save(TRUE))