2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2009-02-08 12:05:52 +03:00
|
|
|
// $Id: nogui.cc,v 1.28 2009-02-08 09:05:52 vruppert Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2001-04-10 06:20:02 +04:00
|
|
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// MandrakeSoft S.A.
|
|
|
|
// 43, rue d'Aboukir
|
|
|
|
// 75002 Paris - France
|
|
|
|
// http://www.linux-mandrake.com/
|
|
|
|
// http://www.mandrakesoft.com/
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-02-08 12:05:52 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
|
2008-02-06 01:57:43 +03:00
|
|
|
// platforms that require a special tag on exported symbols, BX_PLUGGABLE
|
2002-10-25 01:07:56 +04:00
|
|
|
// is used to know when we are exporting symbols and when we are importing.
|
|
|
|
#define BX_PLUGGABLE
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "bochs.h"
|
2005-07-10 13:02:30 +04:00
|
|
|
#if BX_WITH_NOGUI
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "icon_bochs.h"
|
|
|
|
|
2002-10-25 01:07:56 +04:00
|
|
|
class bx_nogui_gui_c : public bx_gui_c {
|
|
|
|
public:
|
|
|
|
bx_nogui_gui_c (void) {}
|
|
|
|
DECLARE_GUI_VIRTUAL_METHODS()
|
|
|
|
};
|
|
|
|
|
|
|
|
// declare one instance of the gui object and call macro to insert the
|
|
|
|
// plugin code
|
|
|
|
static bx_nogui_gui_c *theGui = NULL;
|
|
|
|
IMPLEMENT_GUI_PLUGIN_CODE(nogui)
|
|
|
|
|
|
|
|
#define LOG_THIS theGui->
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
// This file defines stubs for the GUI interface, which is a
|
|
|
|
// place to start if you want to port bochs to a platform, for
|
|
|
|
// which there is no support for your native GUI, or if you want to compile
|
|
|
|
// bochs without any native GUI support (no output window or
|
|
|
|
// keyboard input will be possible).
|
|
|
|
// Look in 'x.cc', 'beos.cc', and 'win32.cc' for specific
|
|
|
|
// implementations of this interface. -Kevin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ::SPECIFIC_INIT()
|
|
|
|
//
|
|
|
|
// Called from gui.cc, once upon program startup, to allow for the
|
|
|
|
// specific GUI code (X11, BeOS, ...) to be initialized.
|
|
|
|
//
|
|
|
|
// argc, argv: not used right now, but the intention is to pass native GUI
|
|
|
|
// specific options from the command line. (X11 options, BeOS options,...)
|
|
|
|
//
|
|
|
|
// tilewidth, tileheight: for optimization, graphics_tile_update() passes
|
|
|
|
// only updated regions of the screen to the gui code to be redrawn.
|
|
|
|
// These define the dimensions of a region (tile).
|
|
|
|
// headerbar_y: A headerbar (toolbar) is display on the top of the
|
|
|
|
// VGA window, showing floppy status, and other information. It
|
|
|
|
// always assumes the width of the current VGA mode width, but
|
|
|
|
// it's height is defined by this parameter.
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::specific_init(int argc, char **argv, unsigned tilewidth, unsigned tileheight,
|
2001-04-10 05:04:59 +04:00
|
|
|
unsigned headerbar_y)
|
|
|
|
{
|
2002-10-25 01:07:56 +04:00
|
|
|
put("NGUI");
|
2001-04-10 05:04:59 +04:00
|
|
|
UNUSED(argc);
|
|
|
|
UNUSED(argv);
|
|
|
|
UNUSED(tilewidth);
|
|
|
|
UNUSED(tileheight);
|
|
|
|
UNUSED(headerbar_y);
|
|
|
|
|
|
|
|
UNUSED(bochs_icon_bits); // global variable
|
|
|
|
|
2006-02-22 00:35:09 +03:00
|
|
|
if (SIM->get_param_bool(BXPN_PRIVATE_COLORMAP)->get()) {
|
2001-05-30 22:56:02 +04:00
|
|
|
BX_INFO(("private_colormap option ignored."));
|
2006-02-22 00:35:09 +03:00
|
|
|
}
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::HANDLE_EVENTS()
|
|
|
|
//
|
|
|
|
// Called periodically (vga_update_interval in .bochsrc) so the
|
|
|
|
// the gui code can poll for keyboard, mouse, and other
|
|
|
|
// relevant events.
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::handle_events(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::FLUSH()
|
|
|
|
//
|
|
|
|
// Called periodically, requesting that the gui code flush all pending
|
|
|
|
// screen update requests.
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::flush(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::CLEAR_SCREEN()
|
|
|
|
//
|
|
|
|
// Called to request that the VGA region is cleared. Don't
|
|
|
|
// clear the area that defines the headerbar.
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::clear_screen(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ::TEXT_UPDATE()
|
|
|
|
//
|
|
|
|
// Called in a VGA text mode, to update the screen with
|
|
|
|
// new content.
|
|
|
|
//
|
|
|
|
// old_text: array of character/attributes making up the contents
|
|
|
|
// of the screen from the last call. See below
|
|
|
|
// new_text: array of character/attributes making up the current
|
|
|
|
// contents, which should now be displayed. See below
|
|
|
|
//
|
2008-01-29 00:52:09 +03:00
|
|
|
// format of old_text & new_text: each is tm_info.line_offset*text_rows
|
|
|
|
// bytes long. Each character consists of 2 bytes. The first by is
|
|
|
|
// the character value, the second is the attribute byte.
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// cursor_x: new x location of cursor
|
|
|
|
// cursor_y: new y location of cursor
|
2008-01-29 00:52:09 +03:00
|
|
|
// tm_info: this structure contains information for additional
|
|
|
|
// features in text mode (cursor shape, line offset,...)
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2008-01-29 00:52:09 +03:00
|
|
|
void bx_nogui_gui_c::text_update(Bit8u *old_text, Bit8u *new_text,
|
2001-04-10 05:47:26 +04:00
|
|
|
unsigned long cursor_x, unsigned long cursor_y,
|
2008-01-26 03:00:31 +03:00
|
|
|
bx_vga_tminfo_t tm_info)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
UNUSED(old_text);
|
|
|
|
UNUSED(new_text);
|
|
|
|
UNUSED(cursor_x);
|
|
|
|
UNUSED(cursor_y);
|
2003-05-07 23:15:47 +04:00
|
|
|
UNUSED(tm_info);
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
|
|
|
|
2002-03-16 14:30:06 +03:00
|
|
|
int
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes)
|
2002-03-16 14:30:06 +03:00
|
|
|
{
|
|
|
|
UNUSED(bytes);
|
|
|
|
UNUSED(nbytes);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
|
2002-03-15 19:45:10 +03:00
|
|
|
{
|
|
|
|
UNUSED(text_snapshot);
|
|
|
|
UNUSED(len);
|
2002-03-16 14:30:06 +03:00
|
|
|
return 0;
|
2002-03-15 19:45:10 +03:00
|
|
|
}
|
|
|
|
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
// ::PALETTE_CHANGE()
|
|
|
|
//
|
|
|
|
// Allocate a color in the native GUI, for this color, and put
|
|
|
|
// it in the colormap location 'index'.
|
|
|
|
// returns: 0=no screen update needed (color map change has direct effect)
|
|
|
|
// 1=screen updated needed (redraw using current colormap)
|
|
|
|
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_bool
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::palette_change(unsigned index, unsigned red, unsigned green, unsigned blue)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
UNUSED(index);
|
|
|
|
UNUSED(red);
|
|
|
|
UNUSED(green);
|
|
|
|
UNUSED(blue);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::GRAPHICS_TILE_UPDATE()
|
|
|
|
//
|
|
|
|
// Called to request that a tile of graphics be drawn to the
|
|
|
|
// screen, since info in this region has changed.
|
|
|
|
//
|
|
|
|
// tile: array of 8bit values representing a block of pixels with
|
|
|
|
// dimension equal to the 'tilewidth' & 'tileheight' parameters to
|
|
|
|
// ::specific_init(). Each value specifies an index into the
|
|
|
|
// array of colors you allocated for ::palette_change()
|
|
|
|
// x0: x origin of tile
|
|
|
|
// y0: y origin of tile
|
|
|
|
//
|
|
|
|
// note: origin of tile and of window based on (0,0) being in the upper
|
|
|
|
// left of the window.
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::graphics_tile_update(Bit8u *tile, unsigned x0, unsigned y0)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
UNUSED(tile);
|
|
|
|
UNUSED(x0);
|
|
|
|
UNUSED(y0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ::DIMENSION_UPDATE()
|
|
|
|
//
|
|
|
|
// Called when the VGA mode changes it's X,Y dimensions.
|
|
|
|
// Resize the window to this size, but you need to add on
|
|
|
|
// the height of the headerbar to the Y value.
|
|
|
|
//
|
|
|
|
// x: new VGA x size
|
|
|
|
// y: new VGA y size (add headerbar_y parameter from ::specific_init().
|
2003-06-28 12:04:31 +04:00
|
|
|
// fheight: new VGA character height in text mode
|
|
|
|
// fwidth : new VGA character width in text mode
|
|
|
|
// bpp : bits per pixel in graphics mode
|
2001-04-10 05:04:59 +04:00
|
|
|
|
|
|
|
void
|
2003-06-28 12:04:31 +04:00
|
|
|
bx_nogui_gui_c::dimension_update(unsigned x, unsigned y, unsigned fheight, unsigned fwidth, unsigned bpp)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
UNUSED(x);
|
|
|
|
UNUSED(y);
|
2002-04-20 11:19:35 +04:00
|
|
|
UNUSED(fheight);
|
2003-05-11 19:07:54 +04:00
|
|
|
UNUSED(fwidth);
|
2003-06-28 12:04:31 +04:00
|
|
|
UNUSED(bpp);
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::CREATE_BITMAP()
|
|
|
|
//
|
|
|
|
// Create a monochrome bitmap of size 'xdim' by 'ydim', which will
|
|
|
|
// be drawn in the headerbar. Return an integer ID to the bitmap,
|
|
|
|
// with which the bitmap can be referenced later.
|
|
|
|
//
|
|
|
|
// bmap: packed 8 pixels-per-byte bitmap. The pixel order is:
|
|
|
|
// bit0 is the left most pixel, bit7 is the right most pixel.
|
|
|
|
// xdim: x dimension of bitmap
|
|
|
|
// ydim: y dimension of bitmap
|
|
|
|
|
|
|
|
unsigned
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::create_bitmap(const unsigned char *bmap, unsigned xdim, unsigned ydim)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
UNUSED(bmap);
|
|
|
|
UNUSED(xdim);
|
|
|
|
UNUSED(ydim);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::HEADERBAR_BITMAP()
|
|
|
|
//
|
|
|
|
// Called to install a bitmap in the bochs headerbar (toolbar).
|
|
|
|
//
|
|
|
|
// bmap_id: will correspond to an ID returned from
|
|
|
|
// ::create_bitmap(). 'alignment' is either BX_GRAVITY_LEFT
|
|
|
|
// or BX_GRAVITY_RIGHT, meaning install the bitmap in the next
|
|
|
|
// available leftmost or rightmost space.
|
|
|
|
// alignment: is either BX_GRAVITY_LEFT or BX_GRAVITY_RIGHT,
|
|
|
|
// meaning install the bitmap in the next
|
|
|
|
// available leftmost or rightmost space.
|
|
|
|
// f: a 'C' function pointer to callback when the mouse is clicked in
|
|
|
|
// the boundaries of this bitmap.
|
|
|
|
|
|
|
|
unsigned
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::headerbar_bitmap(unsigned bmap_id, unsigned alignment, void (*f)(void))
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
UNUSED(bmap_id);
|
|
|
|
UNUSED(alignment);
|
|
|
|
UNUSED(f);
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::SHOW_HEADERBAR()
|
|
|
|
//
|
|
|
|
// Show (redraw) the current headerbar, which is composed of
|
|
|
|
// currently installed bitmaps.
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::show_headerbar(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::REPLACE_BITMAP()
|
|
|
|
//
|
|
|
|
// Replace the bitmap installed in the headerbar ID slot 'hbar_id',
|
|
|
|
// with the one specified by 'bmap_id'. 'bmap_id' will have
|
|
|
|
// been generated by ::create_bitmap(). The old and new bitmap
|
|
|
|
// must be of the same size. This allows the bitmap the user
|
|
|
|
// sees to change, when some action occurs. For example when
|
|
|
|
// the user presses on the floppy icon, it then displays
|
|
|
|
// the ejected status.
|
|
|
|
//
|
|
|
|
// hbar_id: headerbar slot ID
|
|
|
|
// bmap_id: bitmap ID
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::replace_bitmap(unsigned hbar_id, unsigned bmap_id)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
|
|
|
UNUSED(hbar_id);
|
|
|
|
UNUSED(bmap_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ::EXIT()
|
|
|
|
//
|
|
|
|
// Called before bochs terminates, to allow for a graceful
|
|
|
|
// exit from the native GUI mechanism.
|
|
|
|
|
|
|
|
void
|
2002-10-25 01:07:56 +04:00
|
|
|
bx_nogui_gui_c::exit(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2002-10-25 01:07:56 +04:00
|
|
|
BX_INFO(("bx_nogui_gui_c::exit() not implemented yet."));
|
2001-06-23 07:18:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-25 15:44:41 +04:00
|
|
|
bx_nogui_gui_c::mouse_enabled_changed_specific (bx_bool val)
|
2001-06-23 07:18:14 +04:00
|
|
|
{
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
2005-07-10 13:02:30 +04:00
|
|
|
|
|
|
|
#endif /* if BX_WITH_NOGUI */
|