- new function set_clipboard_text() for GUI specific clipboard handling
GUI specific copy functions for X11 and WIN32 in copy_handler() moved to the new function - set_clipboard_text() prepared for other GUIs - value of text mode cursor variables fixed (and renamed in x.cc) - BX_ERROR message in snapshot_handler() fixed
This commit is contained in:
parent
026b7018bd
commit
7373bb7647
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: amigaos.cc,v 1.5 2001-12-13 18:36:29 vruppert Exp $
|
||||
// $Id: amigaos.cc,v 1.6 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2000 MandrakeSoft S.A.
|
||||
@ -429,6 +429,11 @@ for (i=0; i<nchars*2; i+=2)
|
||||
previ = cursori;
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Boolean
|
||||
bx_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigned blue)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: beos.cc,v 1.13 2001-12-13 18:36:29 vruppert Exp $
|
||||
// $Id: beos.cc,v 1.14 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -380,6 +380,11 @@ bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
aWindow->Unlock();
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: carbon.cc,v 1.7 2002-03-09 02:40:25 bdenney Exp $
|
||||
// $Id: carbon.cc,v 1.8 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -1086,6 +1086,11 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
windowUpdatesPending = true;
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.cc,v 1.35 2002-03-12 06:46:35 bdenney Exp $
|
||||
// $Id: gui.cc,v 1.36 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -284,20 +284,8 @@ bx_gui_c::copy_handler(void)
|
||||
return;
|
||||
}
|
||||
// copy to clipboard using gui dependent code.
|
||||
#ifdef WIN32
|
||||
if (OpenClipboard(NULL)) {
|
||||
HANDLE hMem = GlobalAlloc(GMEM_ZEROINIT, len);
|
||||
EmptyClipboard();
|
||||
lstrcpy((char *)hMem, text_snapshot);
|
||||
SetClipboardData(CF_TEXT, hMem);
|
||||
CloseClipboard();
|
||||
GlobalFree(hMem);
|
||||
}
|
||||
#elif BX_WITH_X11
|
||||
extern Display *bx_x_display;
|
||||
// this writes data to the clipboard.
|
||||
BX_INFO (("storing %d bytes to X windows clipboard", len));
|
||||
XStoreBytes (bx_x_display, (char *)text_snapshot, len);
|
||||
#if ( defined(WIN32) || defined(BX_WITH_X11) )
|
||||
set_clipboard_text(text_snapshot, len);
|
||||
#else
|
||||
FILE *fp = fopen("copy.txt", "w");
|
||||
fwrite(text_snapshot, 1, strlen(text_snapshot), fp);
|
||||
@ -313,7 +301,7 @@ bx_gui_c::snapshot_handler(void)
|
||||
char *text_snapshot;
|
||||
Bit32u len;
|
||||
if (make_text_snapshot (&text_snapshot, &len) < 0) {
|
||||
BX_ERROR(( "copy button failed, mode not implemented"));
|
||||
BX_ERROR(( "snapshot button failed, mode not implemented"));
|
||||
return;
|
||||
}
|
||||
FILE *fp = fopen("snapshot.txt", "w");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: gui.h,v 1.23 2002-03-11 15:04:58 bdenney Exp $
|
||||
// $Id: gui.h,v 1.24 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -46,6 +46,7 @@ public:
|
||||
static unsigned headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void));
|
||||
static void replace_bitmap(unsigned hbar_id, unsigned bmap_id);
|
||||
static void show_headerbar(void);
|
||||
static void set_clipboard_text(char *snapshot, Bit32u len);
|
||||
|
||||
// The following function(s) are defined already, and your
|
||||
// GUI code calls them
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: macintosh.cc,v 1.10 2001-12-13 18:36:29 vruppert Exp $
|
||||
// $Id: macintosh.cc,v 1.11 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -862,6 +862,11 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
SetPort(oldPort);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: nogui.cc,v 1.13 2001-12-13 18:36:29 vruppert Exp $
|
||||
// $Id: nogui.cc,v 1.14 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -146,6 +146,13 @@ bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
UNUSED(nrows);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
UNUSED(text_snapshot);
|
||||
UNUSED(len);
|
||||
}
|
||||
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: rfb.cc,v 1.14 2001-12-13 18:36:29 vruppert Exp $
|
||||
// $Id: rfb.cc,v 1.15 2002-03-15 16:45:09 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2000 Psyon.Org!
|
||||
@ -560,6 +560,11 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text, unsigned long curso
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: sdl.cc,v 1.9 2002-03-15 01:11:10 cbothamy Exp $
|
||||
// $Id: sdl.cc,v 1.10 2002-03-15 16:45:10 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -249,8 +249,8 @@ void bx_gui_c::text_update(
|
||||
Bit8u cs_start, cs_end, cs_line, mask;
|
||||
Boolean invert;
|
||||
|
||||
cs_start = cursor_state >> 8;
|
||||
cs_end = cursor_state & 0xff;
|
||||
cs_start = (cursor_state >> 8) & 0x3f;
|
||||
cs_end = cursor_state & 0x1f;
|
||||
|
||||
if( sdl_screen )
|
||||
{
|
||||
@ -332,6 +332,11 @@ void bx_gui_c::text_update(
|
||||
prev_cursor_y = cursor_y;
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void bx_gui_c::graphics_tile_update(
|
||||
Bit8u *snapshot,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: term.cc,v 1.11 2001-12-13 18:36:29 vruppert Exp $
|
||||
// $Id: term.cc,v 1.12 2002-03-15 16:45:10 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2000 MandrakeSoft S.A.
|
||||
@ -418,6 +418,11 @@ bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
mvaddch(cursor_y,cursor_x,new_text[(cursor_y*80+cursor_x)*2]);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: win32.cc,v 1.26 2002-03-15 10:55:48 mlerwill Exp $
|
||||
// $Id: win32.cc,v 1.27 2002-03-15 16:45:10 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -715,18 +715,18 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned nchars;
|
||||
unsigned char data[32];
|
||||
|
||||
cs_start = cursor_state >> 8;
|
||||
cs_end = cursor_state & 0xff;
|
||||
cs_start = (cursor_state >> 8) & 0x3f;
|
||||
cs_end = cursor_state & 0x1f;
|
||||
|
||||
if (!stInfo.UIinited) return;
|
||||
|
||||
|
||||
EnterCriticalSection(&stInfo.drawCS);
|
||||
|
||||
hdc = GetDC(stInfo.hwnd);
|
||||
|
||||
// Number of characters on screen, variable number of rows
|
||||
nchars = 80*nrows;
|
||||
|
||||
|
||||
if ( (prev_block_cursor_y*80 + prev_block_cursor_x) < nchars) {
|
||||
cChar = new_text[(prev_block_cursor_y*80 + prev_block_cursor_x)*2];
|
||||
DrawBitmap(hdc, vgafont[cChar], prev_block_cursor_x*8,
|
||||
@ -769,6 +769,19 @@ void bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
LeaveCriticalSection(&stInfo.drawCS);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
if (OpenClipboard(stInfo.hwnd)) {
|
||||
HANDLE hMem = GlobalAlloc(GMEM_ZEROINIT, len);
|
||||
EmptyClipboard();
|
||||
lstrcpy((char *)hMem, text_snapshot);
|
||||
SetClipboardData(CF_TEXT, hMem);
|
||||
CloseClipboard();
|
||||
GlobalFree(hMem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ::PALETTE_CHANGE()
|
||||
//
|
||||
@ -1031,12 +1044,12 @@ void create_vga_font(void) {
|
||||
|
||||
unsigned char reverse_bitorder(unsigned char b) {
|
||||
unsigned char ret=0;
|
||||
|
||||
|
||||
for (unsigned i=0; i<8; i++) {
|
||||
ret |= (b & 0x01) << (7-i);
|
||||
b >>= 1;
|
||||
}
|
||||
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: x.cc,v 1.34 2002-03-11 15:04:58 bdenney Exp $
|
||||
// $Id: x.cc,v 1.35 2002-03-15 16:45:10 vruppert Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -970,11 +970,11 @@ bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
unsigned i, x, y, curs;
|
||||
unsigned new_foreground, new_background;
|
||||
Bit8u string[1];
|
||||
Bit8u cursor_start, cursor_end;
|
||||
Bit8u cs_start, cs_end;
|
||||
unsigned nchars;
|
||||
|
||||
cursor_start = cursor_state >> 8;
|
||||
cursor_end = cursor_state & 0xff;
|
||||
cs_start = (cursor_state >> 8) & 0x3f;
|
||||
cs_end = cursor_state & 0x1f;
|
||||
|
||||
font_height = font_info->ascent + font_info->descent;
|
||||
|
||||
@ -1030,8 +1030,8 @@ bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
XSetBackground(bx_x_display, gc, black_pixel);
|
||||
|
||||
// now draw character at new block cursor location in reverse
|
||||
if ( ( (cursor_y*80 + cursor_x) < nchars ) && (cursor_start <= cursor_end) ) {
|
||||
for (unsigned i = cursor_start; i <= cursor_end; i++)
|
||||
if ( ( (cursor_y*80 + cursor_x) < nchars ) && (cs_start <= cs_end) ) {
|
||||
for (unsigned i = cs_start; i <= cs_end; i++)
|
||||
XDrawLine(bx_x_display, win,
|
||||
gc_inv,
|
||||
cursor_x * font_info->max_bounds.width,
|
||||
@ -1044,6 +1044,15 @@ bx_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
||||
XFlush(bx_x_display);
|
||||
}
|
||||
|
||||
void
|
||||
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
||||
{
|
||||
extern Display *bx_x_display;
|
||||
// this writes data to the clipboard.
|
||||
BX_INFO (("storing %d bytes to X windows clipboard", len));
|
||||
XStoreBytes (bx_x_display, (char *)text_snapshot, len);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bx_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
||||
|
Loading…
Reference in New Issue
Block a user