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

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

View File

@ -200,11 +200,6 @@ protected:
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
public:
// @cmember Costruttore
@ -321,6 +316,11 @@ public:
// @cmember Sceglie il font da utilizzare nella finestra
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
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()
{
#ifdef DBG
const bool noMunge = getenv("NOMUNGE") != NULL;
bool noMunge = getenv("NOMUNGE") != NULL;
if (noMunge)
return FALSE;
@ -1002,14 +1002,16 @@ void xvt_statbar_set(
//
// @xref <f xvt_create_statbar> <f xvt_statbar_refresh>
{
CHECK(_statbar, "NULL statbar");
const TDate oggi(TODAY);
TString t(31);
t << text << '\t' << oggi.string() << " - " << main_app().title();
if (def)
statbar_set_default_title(_statbar, (char*)(const char*)t);
statbar_set_title(_statbar, (char*)(const char*)t);
// CHECK(_statbar, "NULL statbar");
if (_statbar)
{
const TDate oggi(TODAY);
TString t(31);
t << text << '\t' << oggi.string() << " - " << main_app().title();
if (def)
statbar_set_default_title(_statbar, (char*)(const char*)t);
statbar_set_title(_statbar, (char*)(const char*)t);
}
}
// @doc INTERNAL