window.cpp Migliorata gestione tasti nella TScroll_window

window.h     Resa pubblica le log2dev  e dev2log
xvtility.cpp Corretta gestione statbar in seguito a cambio titolo


git-svn-id: svn://10.65.10.50/trunk@6147 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-02-06 16:17:05 +00:00
parent df07199bd8
commit 577a7d7200
3 changed files with 38 additions and 46 deletions

View File

@ -529,6 +529,8 @@ void TImage::convert_transparent_color(COLOR transparent)
// @comm Legge nell'immagine i pixel uguali a quello in alto a sinistra e li setta // @comm Legge nell'immagine i pixel uguali a quello in alto a sinistra e li setta
// uguali allo sfondo delle maschere // uguali allo sfondo delle maschere
{ {
if (_image)
{
const COLOR trans = xvt_image_get_pixel(_image, 0, 0) & 0x00FFFFFF; const COLOR trans = xvt_image_get_pixel(_image, 0, 0) & 0x00FFFFFF;
if (trans != (transparent & 0x00FFFFFF) && if (trans != (transparent & 0x00FFFFFF) &&
xvt_image_get_format(_image) == XVT_IMAGE_CL8) xvt_image_get_format(_image) == XVT_IMAGE_CL8)
@ -540,6 +542,7 @@ void TImage::convert_transparent_color(COLOR transparent)
// break; don't break: replace all colors equal to upper left in the palette // break; don't break: replace all colors equal to upper left in the palette
} }
} }
}
} }
@ -1239,54 +1242,41 @@ void TScroll_window::update_thumb(
void TScroll_window::handler(WINDOW win, EVENT* ep) void TScroll_window::handler(WINDOW win, EVENT* ep)
{ {
bool up = FALSE; if (ep->type == E_HSCROLL || ep->type == E_VSCROLL)
switch (ep->type)
{
case E_HSCROLL:
case E_VSCROLL:
{ {
long& pos = (ep->type == E_HSCROLL) ? _origin.x : _origin.y; long& pos = (ep->type == E_HSCROLL) ? _origin.x : _origin.y;
const long oldpos = pos;
const long max = (ep->type == E_HSCROLL) ? _max.x : _max.y; const long max = (ep->type == E_HSCROLL) ? _max.x : _max.y;
const short pag = (ep->type == E_HSCROLL) ? columns()/2+1 : rows()/2+1; const short pag = (ep->type == E_HSCROLL) ? columns()/2+1 : rows()/2+1;
switch(ep->v.scroll.what) switch(ep->v.scroll.what)
{ {
case SC_PAGE_UP: case SC_PAGE_UP:
pos -= pag; pos -= pag;
up = TRUE;
break; break;
case SC_LINE_UP: case SC_LINE_UP:
pos--; pos--;
up = TRUE;
break; break;
case SC_PAGE_DOWN: case SC_PAGE_DOWN:
pos += pag; pos += pag;
up = TRUE;
break; break;
case SC_LINE_DOWN: case SC_LINE_DOWN:
pos++; pos++;
up = TRUE;
break; break;
case SC_THUMB: case SC_THUMB:
pos = ep->v.scroll.pos; pos = ep->v.scroll.pos;
up = TRUE;
break; break;
default: default:
break; break;
} }
if (pos < 0) pos = 0; if (pos < 0) pos = 0;
if (pos > max) pos = max; if (pos > max) pos = max;
}
break;
default:
break;
}
if (up) if (pos != oldpos)
{ {
update_thumb(); update_thumb();
force_update(); force_update();
} }
}
TWindow::handler(win, ep); TWindow::handler(win, ep);
} }

View File

@ -200,11 +200,6 @@ protected:
virtual void update() virtual void update()
{} {}
// @cmember Converte le coordinate logiche (caratteri) in coordinate fisiche (pixel)
virtual PNT log2dev(long x, long y) const;
// @cmember Converte le coordinate fisiche (pixel) in coordinate logiche (caratteri)
virtual TPoint dev2log(const PNT& p) const;
// @access Public Member // @access Public Member
public: public:
// @cmember Costruttore // @cmember Costruttore
@ -321,6 +316,11 @@ public:
// @cmember Sceglie il font da utilizzare nella finestra // @cmember Sceglie il font da utilizzare nella finestra
void set_font(const char* family = XVT_FFN_FIXED, int style = 0, int dim = 0); void set_font(const char* family = XVT_FFN_FIXED, int style = 0, int dim = 0);
// @cmember Converte le coordinate logiche (caratteri) in coordinate fisiche (pixel)
virtual PNT log2dev(long x, long y) const;
// @cmember Converte le coordinate fisiche (pixel) in coordinate logiche (caratteri)
virtual TPoint dev2log(const PNT& p) const;
// @cmember Disegna un rettangolo con la possibilita' di settare la penna e il draw_mode // @cmember Disegna un rettangolo con la possibilita' di settare la penna e il draw_mode
void frame(short left, short top, short right, short bottom, int flag); void frame(short left, short top, short right, short bottom, int flag);

View File

@ -247,7 +247,7 @@ BOOL deny_another_instance()
BOOL allow_another_instance() BOOL allow_another_instance()
{ {
#ifdef DBG #ifdef DBG
const bool noMunge = getenv("NOMUNGE") != NULL; bool noMunge = getenv("NOMUNGE") != NULL;
if (noMunge) if (noMunge)
return FALSE; return FALSE;
@ -1002,14 +1002,16 @@ void xvt_statbar_set(
// //
// @xref <f xvt_create_statbar> <f xvt_statbar_refresh> // @xref <f xvt_create_statbar> <f xvt_statbar_refresh>
{ {
CHECK(_statbar, "NULL statbar"); // CHECK(_statbar, "NULL statbar");
if (_statbar)
{
const TDate oggi(TODAY); const TDate oggi(TODAY);
TString t(31); TString t(31);
t << text << '\t' << oggi.string() << " - " << main_app().title(); t << text << '\t' << oggi.string() << " - " << main_app().title();
if (def) if (def)
statbar_set_default_title(_statbar, (char*)(const char*)t); statbar_set_default_title(_statbar, (char*)(const char*)t);
statbar_set_title(_statbar, (char*)(const char*)t); statbar_set_title(_statbar, (char*)(const char*)t);
}
} }
// @doc INTERNAL // @doc INTERNAL