- implement clipboard functions for wxWindows

- enable keymapping for wxWindows, by inserting bx_keymap.loadKeymap(NULL)
  call in wx.cc
This commit is contained in:
Bryce Denney 2002-09-05 13:38:44 +00:00
parent 1fb02cacf1
commit 28801ce9ff
2 changed files with 40 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wx.cc,v 1.14 2002-09-05 06:08:47 bdenney Exp $
// $Id: wx.cc,v 1.15 2002-09-05 13:38:42 bdenney Exp $
/////////////////////////////////////////////////////////////////
//
// wxWindows VGA display for Bochs. wx.cc implements a custom
@ -40,6 +40,7 @@
#include <wx/wx.h>
#endif
#include <wx/image.h>
#include <wx/clipbrd.h>
#include "bochs.h"
#include "gui/icon_bochs.h"
@ -627,6 +628,10 @@ bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth,
wxTileX = tilewidth;
wxTileY = tileheight;
// load keymap tables
if(bx_options.keyboard.OuseMapping->get())
bx_keymap.loadKeymap(NULL);
}
// ::HANDLE_EVENTS()
@ -995,17 +1000,42 @@ bx_gui_c::mouse_enabled_changed_specific (Boolean val)
int
bx_gui_c::get_clipboard_text(Bit8u **bytes, Bit32s *nbytes)
{
UNUSED(bytes);
UNUSED(nbytes);
return 0;
int ret = 0;
wxMutexGuiEnter ();
if (wxTheClipboard->Open ()) {
if (wxTheClipboard->IsSupported (wxDF_TEXT)) {
wxTextDataObject data;
wxTheClipboard->GetData (data);
wxString str = data.GetText ();
int len = str.Len ();
Bit8u *buf = (Bit8u *) malloc (len);
memcpy (buf, str.c_str (), len);
*bytes = buf;
*nbytes = len;
ret = 1;
// buf will be free()d in bx_keyb_c::paste_bytes or
// bx_keyb_c::service_paste_buf.
}
wxTheClipboard->Close ();
}
wxMutexGuiLeave ();
return ret;
}
int
bx_gui_c::set_clipboard_text(char *text_snapshot, Bit32u len)
{
UNUSED(text_snapshot);
UNUSED(len);
return 0;
wxMutexGuiEnter ();
int ret = 0;
if (wxTheClipboard->Open ()) {
wxString string (text_snapshot, len);
wxTheClipboard->SetData (new wxTextDataObject (string));
wxTheClipboard->Close ();
wxMutexGuiLeave ();
ret = 1;
}
wxMutexGuiLeave ();
return ret;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.cc,v 1.35 2002-09-05 07:48:39 bdenney Exp $
// $Id: wxmain.cc,v 1.36 2002-09-05 13:38:44 bdenney Exp $
/////////////////////////////////////////////////////////////////
//
// wxmain.cc implements the wxWindows frame, toolbar, menus, and dialogs.
@ -46,6 +46,7 @@
#include <wx/wx.h>
#endif
#include <wx/image.h>
#include <wx/clipbrd.h>
#include "config.h" // definitions based on configure script
#include "osdep.h" // workarounds for missing stuff
@ -137,6 +138,7 @@ bool MyApp::OnInit()
theFrame = frame; // hack alert
frame->Show( TRUE );
SetTopWindow( frame );
wxTheClipboard->UsePrimarySelection (true);
// if quickstart is enabled, kick off the simulation
if (SIM->get_param_bool(BXP_QUICK_START)->get ()) {
wxCommandEvent unusedEvent;