viswin.cpp Velocizzati calcoli necessari per ridisegno
viswin.h Resi virtuali alcuni metodi di disegno window.cpp Corretto uso del membro _pixmap per disegnare a pixel invece che a caratteri xvtility.cpp Aggiunta riga vuota git-svn-id: svn://10.65.10.50/trunk@6046 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1df45b8904
commit
3fc8354997
@ -1081,29 +1081,24 @@ void TViswin::paint_point (
|
||||
// @flag TRUE | Cancella il cursore precedente
|
||||
// @flag FALSE | Mantiene il cursore precedente
|
||||
{
|
||||
autoscroll (FALSE);
|
||||
static bool wasbar;
|
||||
autoscroll (FALSE);
|
||||
|
||||
const int x = int(_point.x - origin().x + X_OFFSET);
|
||||
const int y = int(_point.y - origin().y + Y_OFFSET);
|
||||
|
||||
if (_isbar)
|
||||
{
|
||||
invert_bar (X_OFFSET, (int)(_point.y - origin().y + (long)Y_OFFSET),
|
||||
(int)columns(), (int) (_point.y - origin().y + (long)Y_OFFSET + 1l));
|
||||
invert_bar ((int)(_point.x - origin().x + (long)X_OFFSET), Y_OFFSET,
|
||||
(int)(_point.x - origin().x + (long)X_OFFSET + 1l),
|
||||
(int)(rows() - (long)BUTTONROW_SIZE));
|
||||
invert_bar (X_OFFSET, y, (int)columns(), y+1);
|
||||
invert_bar (x, Y_OFFSET, x+1, (int)(rows() - BUTTONROW_SIZE));
|
||||
}
|
||||
else
|
||||
{
|
||||
invert_bar ((int) (_point.x - origin ().x + (long)X_OFFSET),
|
||||
(int) (_point.y - origin ().y + (long)Y_OFFSET),
|
||||
(int) (_point.x - origin ().x + (long)X_OFFSET + 1l),
|
||||
(int) (_point.y - origin ().y + (long)Y_OFFSET + 1l));
|
||||
invert_bar (x, y, x+1, y+1);
|
||||
if (_rulers)
|
||||
{
|
||||
invert_bar (0, (int) (_point.y - origin ().y + (long)Y_OFFSET), (X_OFFSET -1),
|
||||
(int) (_point.y - origin ().y + (long)Y_OFFSET + 1l));
|
||||
invert_bar ((int) (_point.x - origin ().x + (long)X_OFFSET), 0,
|
||||
(int) (_point.x - origin ().x + (long)X_OFFSET + 1l), 1);
|
||||
invert_bar (0, y, X_OFFSET-1, y+1);
|
||||
invert_bar (x, 0, x+1, 1);
|
||||
}
|
||||
}
|
||||
autoscroll (TRUE);
|
||||
@ -1130,7 +1125,7 @@ void TViswin::paint_header ()
|
||||
}
|
||||
autoscroll (FALSE);
|
||||
set_color (COLOR_WHITE, BACKGROUND);
|
||||
printat (0, 0, "P.%3ld ", ((origin().y) / _formlen) + 1l);
|
||||
printat (0, 0, "P.%3ld", ((origin().y) / _formlen) + 1l);
|
||||
autoscroll (TRUE);
|
||||
}
|
||||
|
||||
@ -1212,12 +1207,12 @@ void TViswin::update ()
|
||||
else
|
||||
if (_showbuts) ((TImage&)_modules[4]).draw(win());
|
||||
autoscroll (TRUE);
|
||||
paint_header ();
|
||||
paint_screen ();
|
||||
paint_screen();
|
||||
paint_header();
|
||||
if (_isselection)
|
||||
display_selection ();
|
||||
display_selection();
|
||||
}
|
||||
display_point ();
|
||||
display_point();
|
||||
check_link(&_point);
|
||||
autoscroll (TRUE);
|
||||
_need_update = TRUE;
|
||||
@ -1284,10 +1279,11 @@ void TViswin::on_button(short dlg)
|
||||
|
||||
void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
{
|
||||
static bool ignore = FALSE;
|
||||
|
||||
int kdiff_x, kdiff_y;
|
||||
PNT newcross;
|
||||
TPoint p;
|
||||
static bool ignore = FALSE;
|
||||
bool tlnk = FALSE;
|
||||
int kdiff;
|
||||
long new_origin;
|
||||
@ -1396,7 +1392,6 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
xvt_win_trap_pointer (win);
|
||||
|
||||
if (ep->v.mouse.button == 0) // left button: text selection
|
||||
|
||||
{
|
||||
if (need_paint_sel (FALSE))
|
||||
{
|
||||
@ -1433,7 +1428,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
{
|
||||
p = ep->v.mouse.where;
|
||||
|
||||
if (_isopen && (p.x >= 4 && p.x) <= X_OFFSET &&
|
||||
if (_isopen && _toplevel && (p.x >= 4 && p.x) <= X_OFFSET &&
|
||||
(p.y >= (int)rows () - BUTTONROW_SIZE && p.y <= (int)rows() - Y_OFFSET))
|
||||
{
|
||||
abort_print ();
|
||||
@ -1491,7 +1486,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
if (_sel_end.x > 255)
|
||||
_sel_end.x = 255;
|
||||
_point = _sel_end;
|
||||
_isselection = TRUE;
|
||||
_isselection = _selecting;
|
||||
check_link (&_point);
|
||||
display_point ();
|
||||
}
|
||||
@ -2259,6 +2254,15 @@ void TViswin::add_line (const char *l)
|
||||
}
|
||||
}
|
||||
|
||||
void TViswin::destroy_lines()
|
||||
{
|
||||
if (_isopen && !_frozen)
|
||||
{
|
||||
_txt.destroy();
|
||||
force_update();
|
||||
}
|
||||
}
|
||||
|
||||
void TViswin::close_print ()
|
||||
{
|
||||
_isopen = FALSE;
|
||||
@ -2469,7 +2473,7 @@ TViswin::TViswin(const char *fname,
|
||||
_down_dir(TRUE), _showbuts(FALSE), _case_sensitive(FALSE),
|
||||
_menu_present(FALSE), _regexp(FALSE)
|
||||
{
|
||||
begin_wait();
|
||||
TWait_cursor hourglass;
|
||||
|
||||
if (title == NULL)
|
||||
title = (fname ? fname : "Anteprima di stampa");
|
||||
@ -2592,8 +2596,6 @@ TViswin::TViswin(const char *fname,
|
||||
}
|
||||
|
||||
_hotspots = &(_txt.hotspots());
|
||||
|
||||
end_wait();
|
||||
}
|
||||
|
||||
TViswin ::~TViswin ()
|
||||
@ -2629,16 +2631,23 @@ void TBrowsefile_field::parse_head(TScanner& scanner)
|
||||
_ctl_data._size = scanner.integer();
|
||||
}
|
||||
|
||||
void TBrowsefile_field::set_vis_win(TViswin* viswin)
|
||||
{
|
||||
if (_viswin != NULL)
|
||||
delete _viswin;
|
||||
_viswin = viswin;
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TBrowsefile_field::create(WINDOW parent)
|
||||
{
|
||||
const TMask& m = mask();
|
||||
_viswin = new TViswin(_ctl_data._prompt, _ctl_data._prompt, FALSE, FALSE, FALSE,
|
||||
_ctl_data._x, _ctl_data._y, _ctl_data._size, _ctl_data._width,
|
||||
_flags.rightjust ? TRUE : FALSE, parent, this);
|
||||
WINDOW win = _viswin->win();
|
||||
if (_viswin == NULL)
|
||||
_viswin = new TViswin(_ctl_data._prompt, _ctl_data._prompt, FALSE, FALSE, FALSE,
|
||||
_ctl_data._x, _ctl_data._y, _ctl_data._size, _ctl_data._width,
|
||||
_flags.rightjust ? TRUE : FALSE, parent, this);
|
||||
_dlg = _ctl_data._dlg;
|
||||
_parent = parent;
|
||||
WINDOW win = _viswin->win();
|
||||
xvt_vobj_set_enabled(win, enabled());
|
||||
xvt_vobj_set_visible(win, shown());
|
||||
}
|
||||
@ -2652,7 +2661,7 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
if (instr == NULL)
|
||||
fatal_box("File non trovato: %s", file);
|
||||
|
||||
begin_wait();
|
||||
TWait_cursor hourglass;
|
||||
|
||||
TString256 tmpp;
|
||||
long ret = -1l;
|
||||
@ -2678,7 +2687,6 @@ long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
|
||||
_viswin->close_print();
|
||||
|
||||
end_wait();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -201,9 +201,9 @@ protected:
|
||||
// @cmember Disegna il cursore in xor nello stile del momento
|
||||
void paint_point(bool erase = FALSE);
|
||||
// @cmember Disegna la riga <p r>-esima (in coordinate testo)
|
||||
void paint_row(long r);
|
||||
virtual void paint_row(long r);
|
||||
// @cmember Disegna una colonna
|
||||
void paint_column(long r, bool end);
|
||||
virtual void paint_column(long c, bool end);
|
||||
// @cmember Disegna in xor la selezione corrente a meno che non sia gia' disegnata
|
||||
void paint_selection();
|
||||
// @cmember Controlla l'immagine di 'busy'; xor serve solo per UNIX, dove si
|
||||
@ -237,6 +237,8 @@ protected:
|
||||
void display_point();
|
||||
// @cmember Interfaccia per paint_point (se point): cancella se c'e'
|
||||
void erase_point();
|
||||
// @cmember Ritorna la posizione attuale del cursore
|
||||
const TPoint& get_point() const { return _point; }
|
||||
|
||||
// @cmember Controlla se la posizione cursore <p where> cade su un
|
||||
// link ipertestuale e si comporta di conseguenza
|
||||
@ -275,6 +277,8 @@ protected:
|
||||
// @cmember Abilita/Disabilita una voce di menu'
|
||||
void enable_menu_item(MENU_TAG item, bool on = TRUE);
|
||||
|
||||
TBrowsefile_field* browsefile_field() const { return _brwfld; }
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Permette di gestire i collegamenti ipertestuali. Occorre passare il testo completo
|
||||
@ -314,8 +318,10 @@ public:
|
||||
// @cmember Indica se mostrare o no i bottoni della finestra di anteprima
|
||||
void show_buttons(bool on = TRUE);
|
||||
|
||||
// @cmember Stampa nella finestra la riga <p l>-esima
|
||||
// @cmember Aggiunge la riga di testo <p l> in fondo al file
|
||||
void add_line(const char* l);
|
||||
// @cmember Elimina tutte le righe di testo
|
||||
void destroy_lines();
|
||||
|
||||
// @cmember Funzione di ricerca non interattiva
|
||||
long search (const char* txt, int& pos, long from = 0, bool down = TRUE, bool casesens = FALSE, bool regx = FALSE);
|
||||
|
@ -214,11 +214,11 @@ void TWindow_manager::reg(TWindow* m)
|
||||
{
|
||||
case 0 :
|
||||
menu_enable(FALSE);
|
||||
{
|
||||
const bool on = main_app().firm_change_enabled();
|
||||
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_NEW, on);
|
||||
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_REVERT, on);
|
||||
}
|
||||
{
|
||||
const bool on = main_app().firm_change_enabled();
|
||||
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_NEW, on);
|
||||
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_REVERT, on);
|
||||
}
|
||||
break;
|
||||
case 1 :
|
||||
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_QUIT, FALSE);
|
||||
@ -646,10 +646,12 @@ void TWindow::close()
|
||||
|
||||
|
||||
void TWindow::close_modal()
|
||||
{
|
||||
{
|
||||
CHECK(is_modal(), "Can't modal-close a non-modal window");
|
||||
WinManager.unreg(this);
|
||||
close();
|
||||
_open = FALSE;
|
||||
set_modal(FALSE);
|
||||
}
|
||||
|
||||
bool TWindow::stop_run(KEY key)
|
||||
@ -942,7 +944,7 @@ void TWindow::frame(
|
||||
r.bottom = t.v; r.right = t.h;
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
if (flag & 2)
|
||||
if (!_pixmap && (flag & 2))
|
||||
{
|
||||
r.left += CHARX>>1; r.top += CHARY>>1;
|
||||
r.right-= CHARX>>1; r.bottom -= CHARY>>1;
|
||||
@ -1052,10 +1054,13 @@ void TWindow::line(short x0, short y0, short x1, short y1)
|
||||
PNT t = log2dev(x1,y1);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|
||||
if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1;
|
||||
if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1;
|
||||
if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1;
|
||||
if (t.v == 0) t.v = -CHARY; else t.v += CHARY>>1;
|
||||
if (!_pixmap)
|
||||
{
|
||||
if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1;
|
||||
if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1;
|
||||
if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1;
|
||||
if (t.v == 0) t.v = -CHARY; else t.v += CHARY>>1;
|
||||
}
|
||||
#endif
|
||||
|
||||
xvt_dwin_draw_set_pos(win(), f);
|
||||
@ -1182,14 +1187,21 @@ WINDOW TScroll_window::create(short x, short y, short dx, short dy,
|
||||
PNT TScroll_window::log2dev(long x, long y) const
|
||||
{
|
||||
if (_autoscroll)
|
||||
{
|
||||
x -= _origin.x;
|
||||
y -= _origin.y >> _shift;
|
||||
{
|
||||
if (_pixmap)
|
||||
{
|
||||
x -= _origin.x * CHARX;
|
||||
y -= (_origin.y >> _shift) * CHARY;
|
||||
}
|
||||
else
|
||||
{
|
||||
x -= _origin.x;
|
||||
y -= _origin.y >> _shift;
|
||||
}
|
||||
}
|
||||
return TWindow::log2dev(x,y);
|
||||
}
|
||||
|
||||
|
||||
void TScroll_window::set_scroll_max(long maxx, long maxy)
|
||||
{
|
||||
if (_has_hscroll && maxx >= 0)
|
||||
|
@ -75,10 +75,11 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wparam == VK_F1)
|
||||
{
|
||||
{
|
||||
if ((lparam & (1<<29)) == 0) // Il tasto alt non e' premuto
|
||||
{
|
||||
{
|
||||
KEY k = K_F1;
|
||||
|
||||
int sc = GetAsyncKeyState(VK_CONTROL); // Stato del tasto control
|
||||
if (sc & 0x8000) k += K_CTRL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user