- text mode cursur feature added for X and prepared for other GUIs

This commit is contained in:
Volker Ruppert 2001-12-13 18:36:29 +00:00
parent 5427df8b36
commit 051ef5f1c9
10 changed files with 42 additions and 31 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: amigaos.cc,v 1.4 2001-10-03 13:10:37 bdenney Exp $ // $Id: amigaos.cc,v 1.5 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2000 MandrakeSoft S.A. // Copyright (C) 2000 MandrakeSoft S.A.
@ -380,7 +380,7 @@ bx_gui_c::clear_screen(void)
void void
bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) Bit16u cursor_state, unsigned nrows)
{ {
int i; int i;
int cursori; int cursori;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: beos.cc,v 1.12 2001-12-07 18:52:24 bdenney Exp $ // $Id: beos.cc,v 1.13 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -332,7 +332,7 @@ bx_gui_c::clear_screen(void)
void void
bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) Bit16u cursor_state, unsigned nrows)
{ {
unsigned i, x, y; unsigned i, x, y;
BPoint point; BPoint point;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: carbon.cc,v 1.5 2001-10-03 13:10:37 bdenney Exp $ // $Id: carbon.cc,v 1.6 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -796,7 +796,7 @@ void bx_gui_c::clear_screen(void)
void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) Bit16u cursor_state, unsigned nrows)
{ {
int i; int i;
unsigned char achar; unsigned char achar;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: gui.h,v 1.15 2001-11-26 09:54:12 vruppert Exp $ // $Id: gui.h,v 1.16 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -34,7 +34,7 @@ public:
unsigned x_tilesize, unsigned y_tilesize, unsigned header_bar_y); unsigned x_tilesize, unsigned y_tilesize, unsigned header_bar_y);
static void text_update(Bit8u *old_text, Bit8u *new_text, static void text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned rows); Bit16u cursor_state, unsigned rows);
static void graphics_update(Bit8u *snapshot); static void graphics_update(Bit8u *snapshot);
static void graphics_tile_update(Bit8u *snapshot, unsigned x, unsigned y); static void graphics_tile_update(Bit8u *snapshot, unsigned x, unsigned y);
static void handle_events(void); static void handle_events(void);

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: macintosh.cc,v 1.9 2001-10-03 13:10:37 bdenney Exp $ // $Id: macintosh.cc,v 1.10 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -791,7 +791,7 @@ void bx_gui_c::clear_screen(void)
void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) Bit16u cursor_state, unsigned nrows)
{ {
int i; int i;
unsigned char achar; unsigned char achar;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: nogui.cc,v 1.12 2001-10-03 13:10:37 bdenney Exp $ // $Id: nogui.cc,v 1.13 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -136,12 +136,13 @@ bx_gui_c::clear_screen(void)
void void
bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) Bit16u cursor_state, unsigned nrows)
{ {
UNUSED(old_text); UNUSED(old_text);
UNUSED(new_text); UNUSED(new_text);
UNUSED(cursor_x); UNUSED(cursor_x);
UNUSED(cursor_y); UNUSED(cursor_y);
UNUSED(cursor_state);
UNUSED(nrows); UNUSED(nrows);
} }

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: rfb.cc,v 1.13 2001-11-12 17:56:47 bdenney Exp $ // $Id: rfb.cc,v 1.14 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2000 Psyon.Org! // Copyright (C) 2000 Psyon.Org!
@ -522,7 +522,7 @@ void bx_gui_c::clear_screen(void)
// cursor_x: new x location of cursor // cursor_x: new x location of cursor
// cursor_y: new y location of cursor // cursor_y: new y location of cursor
void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, unsigned long cursor_x, unsigned long cursor_y, unsigned nrows) void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, unsigned long cursor_x, unsigned long cursor_y, Bit16u cursor_state, unsigned nrows)
{ {
unsigned char cChar; unsigned char cChar;
unsigned int nchars; unsigned int nchars;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: term.cc,v 1.10 2001-10-03 13:10:37 bdenney Exp $ // $Id: term.cc,v 1.11 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2000 MandrakeSoft S.A. // Copyright (C) 2000 MandrakeSoft S.A.
@ -395,8 +395,10 @@ bx_gui_c::clear_screen(void)
void void
bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) Bit16u cursor_state, unsigned nrows)
{ {
UNUSED(cursor_state);
unsigned ncols = 4000/nrows/2; unsigned ncols = 4000/nrows/2;
// XXX There has GOT to be a better way of doing this // XXX There has GOT to be a better way of doing this
for(int i=0;i<4001;i+=2) { for(int i=0;i<4001;i+=2) {

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.20 2001-11-26 07:24:16 vruppert Exp $ // $Id: win32.cc,v 1.21 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -683,12 +683,16 @@ void bx_gui_c::clear_screen(void) {
void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) { Bit16u cursor_state, unsigned nrows) {
HDC hdc; HDC hdc;
unsigned char cChar; unsigned char cChar;
unsigned i, x, y; unsigned i, x, y;
Bit8u cursor_start, cursor_end;
unsigned nchars; unsigned nchars;
cursor_start = cursor_state >> 8;
cursor_end = cursor_state & 0xff;
if (!stInfo.UIinited) return; if (!stInfo.UIinited) return;
EnterCriticalSection(&stInfo.drawCS); EnterCriticalSection(&stInfo.drawCS);
@ -722,7 +726,7 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
prev_block_cursor_y = cursor_y; prev_block_cursor_y = cursor_y;
// now draw character at new block cursor location in reverse // now draw character at new block cursor location in reverse
if ((cursor_y*80 + cursor_x) < nchars ) { if (((cursor_y*80 + cursor_x) < nchars ) && (cursor_start <= cursor_end)) {
cChar = new_text[(cursor_y*80 + cursor_x)*2]; cChar = new_text[(cursor_y*80 + cursor_x)*2];
//reverse background and foreground colors //reverse background and foreground colors
char cAttr = new_text[((cursor_y*80 + cursor_x)*2)+1]; char cAttr = new_text[((cursor_y*80 + cursor_x)*2)+1];

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: x.cc,v 1.24 2001-12-08 13:42:55 bdenney Exp $ // $Id: x.cc,v 1.25 2001-12-13 18:36:29 vruppert Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -461,7 +461,7 @@ if (bx_options.Oprivate_colormap->get ()) {
XSetState(bx_x_display, gc, white_pixel, black_pixel, GXcopy,AllPlanes); XSetState(bx_x_display, gc, white_pixel, black_pixel, GXcopy,AllPlanes);
XSetState(bx_x_display, gc_inv, black_pixel, white_pixel, GXcopy,AllPlanes); XSetState(bx_x_display, gc_inv, black_pixel, white_pixel, GXinvert,AllPlanes);
XSetState(bx_x_display, gc_headerbar, black_pixel, white_pixel, GXcopy,AllPlanes); XSetState(bx_x_display, gc_headerbar, black_pixel, white_pixel, GXcopy,AllPlanes);
@ -946,14 +946,18 @@ bx_gui_c::clear_screen(void)
void void
bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
unsigned long cursor_x, unsigned long cursor_y, unsigned long cursor_x, unsigned long cursor_y,
unsigned nrows) Bit16u cursor_state, unsigned nrows)
{ {
int font_height; int font_height;
unsigned i, x, y, curs; unsigned i, x, y, curs;
unsigned new_foreground, new_background; unsigned new_foreground, new_background;
Bit8u string[1]; Bit8u string[1];
Bit8u cursor_start, cursor_end;
unsigned nchars; unsigned nchars;
cursor_start = cursor_state >> 8;
cursor_end = cursor_state & 0xff;
font_height = font_info->ascent + font_info->descent; font_height = font_info->ascent + font_info->descent;
// Number of characters on screen, variable number of rows // Number of characters on screen, variable number of rows
@ -1008,15 +1012,15 @@ bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
XSetBackground(bx_x_display, gc, black_pixel); XSetBackground(bx_x_display, gc, black_pixel);
// now draw character at new block cursor location in reverse // now draw character at new block cursor location in reverse
if ( (cursor_y*80 + cursor_x) < nchars ) { if ( ( (cursor_y*80 + cursor_x) < nchars ) && (cursor_start <= cursor_end) ) {
string[0] = new_text[(cursor_y*80 + cursor_x)*2]; for (unsigned i = cursor_start; i <= cursor_end; i++)
if (string[0] == 0) string[0] = ' '; // convert null to space XDrawLine(bx_x_display, win,
XDrawImageString(bx_x_display, win, gc_inv,
gc_inv, cursor_x * font_info->max_bounds.width,
cursor_x * font_info->max_bounds.width, cursor_y * font_height + bx_headerbar_y + i,
cursor_y * font_height + font_info->max_bounds.ascent + bx_headerbar_y, (cursor_x + 1) * font_info->max_bounds.width - 1,
(char *) string, cursor_y * font_height + bx_headerbar_y + i
1); );
} }
XFlush(bx_x_display); XFlush(bx_x_display);