- some more fixes for unicode support (wxT("string") conversion)

This commit is contained in:
Volker Ruppert 2006-03-18 16:30:52 +00:00
parent a52301c56c
commit 6106f1c905
4 changed files with 317 additions and 317 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxdialog.cc,v 1.92 2006-03-11 10:00:56 vruppert Exp $
// $Id: wxdialog.cc,v 1.93 2006-03-18 16:30:50 vruppert Exp $
/////////////////////////////////////////////////////////////////
// Define BX_PLUGGABLE in files that can be compiled into plugins. For
@ -80,12 +80,12 @@ LogMsgAskDialog::LogMsgAskDialog(
{
for (int i=0; i<N_BUTTONS; i++) enabled[i] = TRUE;
vertSizer = new wxBoxSizer(wxVERTICAL);
context = new wxStaticText (this, -1, "");
context = new wxStaticText (this, -1, wxT(""));
wxFont font = context->GetFont ();
font.SetWeight (wxBOLD);
font.SetPointSize (2 + font.GetPointSize ());
context->SetFont (font);
message = new wxStaticText (this, -1, "");
message = new wxStaticText (this, -1, wxT(""));
message->SetFont (font);
dontAsk = new wxCheckBox (this, -1, LOG_MSG_DONT_ASK_STRING);
btnSizer = new wxBoxSizer(wxHORIZONTAL);
@ -120,12 +120,12 @@ void LogMsgAskDialog::Init ()
btnSizer->Add (btn, 1, wxALL, 5);
}
wxSize ms = message->GetSize ();
wxLogMessage ("message size is %d,%d", ms.GetWidth(), ms.GetHeight ());
// wxLogMessage(wxT("message size is %d,%d"), ms.GetWidth(), ms.GetHeight());
SetAutoLayout(TRUE);
SetSizer(vertSizer);
vertSizer->Fit (this);
wxSize size = vertSizer->GetMinSize ();
wxLogMessage ("minsize is %d,%d", size.GetWidth(), size.GetHeight ());
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
int margin = 10;
SetSizeHints (size.GetWidth () + margin, size.GetHeight () + margin);
Center ();
@ -147,7 +147,7 @@ void LogMsgAskDialog::OnEvent(wxCommandEvent& event)
default:
return; // without EndModal
}
wxLogMessage ("you pressed button id=%d, return value=%d", id, ret);
// wxLogMessage(wxT("you pressed button id=%d, return value=%d"), id, ret);
EndModal (ret);
}
@ -191,7 +191,7 @@ END_EVENT_TABLE()
FloppyConfigDialog::FloppyConfigDialog(
wxWindow* parent,
wxWindowID id)
: wxDialog (parent, id, "", wxDefaultPosition, wxDefaultSize,
: wxDialog (parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
validate = NULL;
@ -228,7 +228,7 @@ FloppyConfigDialog::FloppyConfigDialog(
// create filename and diskImageRadioBtn so that we can tweak them before
// Init comes. However don't add it to any sizer yet because it needs to go
// in after the last radio button.
filename = new wxTextCtrl (this, ID_FilenameText, "", wxDefaultPosition, longTextSize);
filename = new wxTextCtrl (this, ID_FilenameText, wxT(""), wxDefaultPosition, longTextSize);
diskImageRadioBtn = new wxRadioButton (this, ID_Filename, FLOPPY_CONFIG_DISKIMG);
// the radioSizer contents will be added by successive calls to
@ -240,12 +240,12 @@ void FloppyConfigDialog::AddRadio (
const wxString& filename)
{
if (n_rbtns >= FLOPPY_MAX_RBTNS) {
wxLogError ("AddRadio failed: increase FLOPPY_MAX_RBTNS in wxdialog.h");
wxLogError(wxT("AddRadio failed: increase FLOPPY_MAX_RBTNS in wxdialog.h"));
return;
}
rbtn[n_rbtns] = new wxRadioButton (this, -1, description);
rbtn[n_rbtns] = new wxRadioButton(this, -1, description);
equivalentFilename[n_rbtns] = filename;
radioSizer->Add (rbtn[n_rbtns]);
radioSizer->Add(rbtn[n_rbtns]);
n_rbtns++;
}
@ -260,7 +260,7 @@ void FloppyConfigDialog::SetDriveName (wxString name) {
void FloppyConfigDialog::SetCapacityChoices (int n, char *choices[])
{
for (int i=0; i<n; i++)
capacity->Append (wxString (choices[i]));
capacity->Append(wxString (choices[i]));
}
void FloppyConfigDialog::SetCapacity (int cap)
@ -272,33 +272,33 @@ void FloppyConfigDialog::SetCapacity (int cap)
void FloppyConfigDialog::Init()
{
// add contents of diskImageSizer
diskImageSizer->Add (diskImageRadioBtn);
diskImageSizer->Add (filename, 1, wxGROW);
diskImageSizer->Add(diskImageRadioBtn);
diskImageSizer->Add(filename, 1, wxGROW);
wxButton *btn = new wxButton (this, ID_Browse, BTNLABEL_BROWSE);
diskImageSizer->Add (btn, 0, wxALL, 5);
radioSizer->Add (diskImageSizer);
diskImageSizer->Add(btn, 0, wxALL, 5);
radioSizer->Add(diskImageSizer);
SetAutoLayout(TRUE);
SetSizer(vertSizer);
vertSizer->Fit (this);
wxSize size = vertSizer->GetMinSize ();
wxLogMessage ("minsize is %d,%d", size.GetWidth(), size.GetHeight ());
vertSizer->Fit(this);
wxSize size = vertSizer->GetMinSize();
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
int margin = 5;
SetSizeHints (size.GetWidth () + margin, size.GetHeight () + margin);
Center ();
SetSizeHints (size.GetWidth() + margin, size.GetHeight() + margin);
Center();
}
int
FloppyConfigDialog::GetRadio () {
int i;
for (i=0; i<n_rbtns; i++) {
if (rbtn[i]->GetValue ())
if (rbtn[i]->GetValue())
return i;
}
if (diskImageRadioBtn->GetValue ()) {
if (diskImageRadioBtn->GetValue()) {
return i;
}
wxLogError ("GetRadio() found nothing selected");
wxLogError(wxT("GetRadio() found nothing selected"));
return 0;
}
@ -352,7 +352,7 @@ void FloppyConfigDialog::OnEvent(wxCommandEvent& event)
break;
case ID_Browse:
if (BrowseTextCtrl(filename)) {
capacity->SetSelection(capacity->FindString("auto"));
capacity->SetSelection(capacity->FindString(wxT("auto")));
}
break;
case ID_Capacity:
@ -363,20 +363,20 @@ void FloppyConfigDialog::OnEvent(wxCommandEvent& event)
break;
case ID_Create:
{
int cap = capacity->GetSelection ();
int cap = capacity->GetSelection();
char name[1024];
strncpy (name, filename->GetValue ().c_str (), sizeof(name));
strncpy (name, filename->GetValue().c_str(), sizeof(name));
if (CreateImage (0, floppy_type_n_sectors[cap], name)) {
wxString msg;
msg.Printf ("Created a %s disk image called '%s'.",
capacity->GetString (cap).c_str (),
filename->GetValue ().c_str ());
wxMessageBox(msg, "Image Created", wxOK | wxICON_INFORMATION, this);
msg.Printf("Created a %s disk image called '%s'.",
capacity->GetString(cap).c_str(),
filename->GetValue().c_str());
wxMessageBox(msg, wxT("Image Created"), wxOK | wxICON_INFORMATION, this);
}
}
break;
case wxID_CANCEL:
EndModal (wxID_CANCEL);
EndModal(wxID_CANCEL);
break;
case wxID_HELP:
ShowHelp();
@ -384,7 +384,7 @@ void FloppyConfigDialog::OnEvent(wxCommandEvent& event)
}
}
void FloppyConfigDialog::ShowHelp ()
void FloppyConfigDialog::ShowHelp()
{
wxMessageBox(MSG_NO_HELP, MSG_NO_HELP_CAPTION, wxOK | wxICON_ERROR, this );
}
@ -425,7 +425,7 @@ END_EVENT_TABLE()
AdvancedLogOptionsDialog::AdvancedLogOptionsDialog(
wxWindow* parent,
wxWindowID id)
: wxDialog (parent, id, "", wxDefaultPosition, wxDefaultSize,
: wxDialog (parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
//static int integers[LOG_OPTS_N_CHOICES_NORMAL] = {0, 1, 2, 3};
@ -447,7 +447,7 @@ AdvancedLogOptionsDialog::AdvancedLogOptionsDialog(
// logfileSizer contents
text = new wxStaticText (this, -1, ADVLOG_OPTS_LOGFILE);
logfileSizer->Add (text);
logfile = new wxTextCtrl (this, -1, "", wxDefaultPosition, longTextSize);
logfile = new wxTextCtrl (this, -1, wxT(""), wxDefaultPosition, longTextSize);
logfileSizer->Add (logfile);
wxButton *btn = new wxButton (this, ID_Browse, BTNLABEL_BROWSE);
logfileSizer->Add (btn, 0, wxALL, 5);
@ -522,16 +522,16 @@ AdvancedLogOptionsDialog::~AdvancedLogOptionsDialog()
void AdvancedLogOptionsDialog::Init()
{
CopyParamToGui ();
CopyParamToGui();
// lay it out!
SetAutoLayout(TRUE);
SetSizer(vertSizer);
vertSizer->Fit (this);
wxSize size = vertSizer->GetMinSize ();
wxLogMessage ("minsize is %d,%d", size.GetWidth(), size.GetHeight ());
vertSizer->Fit(this);
wxSize size = vertSizer->GetMinSize();
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
int margin = 5;
SetSizeHints (size.GetWidth () + margin, size.GetHeight () + margin);
Center ();
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
Center();
}
void AdvancedLogOptionsDialog::CopyParamToGui() {
@ -565,20 +565,20 @@ void AdvancedLogOptionsDialog::CopyGuiToParam() {
void AdvancedLogOptionsDialog::SetAction (int dev, int evtype, int act) {
// find the choice whose client data matches "act".
int *ptr;
//wxLogDebug ("SetAction dev=%d type=%d act=%d", dev, evtype, act);
// wxLogDebug(wxT("SetAction dev=%d type=%d act=%d"), dev, evtype, act);
wxChoice *control = action[dev][evtype];
for (int i=0; i < control->GetCount (); i++) {
//wxLogDebug ("reading action[%d][%d]->GetClientData(%d)", dev, evtype, i);
ptr = (int*) control->GetClientData (i);
// wxLogDebug(wxT("reading action[%d][%d]->GetClientData(%d)"), dev, evtype, i);
ptr = (int*) control->GetClientData(i);
if (ptr == NULL) continue;
if (act == *ptr) { // found it!
control->SetSelection (i);
control->SetSelection(i);
return;
}
}
// this can happen if one of the choices that is excluded by
// ADVLOG_OPTS_EXCLUDE() is used, for example.
wxLogDebug ("warning: SetAction type=%d act=%d not found", evtype, act);
wxLogDebug(wxT("warning: SetAction type=%d act=%d not found"), evtype, act);
}
int AdvancedLogOptionsDialog::GetAction (int dev, int evtype) {
@ -591,7 +591,7 @@ int AdvancedLogOptionsDialog::GetAction (int dev, int evtype) {
void AdvancedLogOptionsDialog::OnEvent(wxCommandEvent& event)
{
int id = event.GetId ();
wxLogMessage ("you pressed button id=%d", id);
// wxLogMessage(wxT("you pressed button id=%d"), id);
switch (id) {
case ID_Browse:
BrowseTextCtrl (logfile);
@ -660,14 +660,14 @@ END_EVENT_TABLE()
DebugLogDialog::DebugLogDialog(
wxWindow* parent,
wxWindowID id)
: wxDialog (parent, id, "", wxDefaultPosition, wxDefaultSize,
: wxDialog (parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
lengthMax = DEBUG_LOG_DEFAULT_LENGTH_MAX;
lengthTolerance = DEBUG_LOG_DEFAULT_TOLERANCE;
SetTitle (DEBUG_LOG_TITLE);
mainSizer = new wxBoxSizer (wxVERTICAL);
log = new wxTextCtrl (this, -1, "",
log = new wxTextCtrl (this, -1, wxT(""),
wxDefaultPosition, wxSize(400, 300),
wxTE_MULTILINE | wxTE_RICH | wxTE_READONLY);
mainSizer->Add (log, 1, wxALL|wxGROW, 10);
@ -679,7 +679,7 @@ DebugLogDialog::DebugLogDialog(
mainSizer->Add (buttonSizer, 0, wxALIGN_RIGHT);
// commandSizer contents
command = new wxTextCtrl (this, ID_DebugCommand, "",
command = new wxTextCtrl (this, ID_DebugCommand, wxT(""),
wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER);
commandSizer->Add (command, 1, wxGROW);
@ -697,12 +697,12 @@ void DebugLogDialog::Init()
// lay it out!
SetAutoLayout(TRUE);
SetSizer(mainSizer);
mainSizer->Fit (this);
wxSize size = mainSizer->GetMinSize ();
wxLogMessage ("minsize is %d,%d", size.GetWidth(), size.GetHeight ());
mainSizer->Fit(this);
wxSize size = mainSizer->GetMinSize();
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
int margin = 5;
SetSizeHints (size.GetWidth () + margin, size.GetHeight () + margin);
Center ();
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
Center();
}
void DebugLogDialog::Execute(bool clear)
@ -743,13 +743,13 @@ void DebugLogDialog::CheckLogLength ()
void DebugLogDialog::AppendCommand (const char *cmd)
{
log->AppendText (wxT(">>> "));
log->AppendText (wxString (cmd));
log->AppendText (wxT("\n"));
int n = log->GetLastPosition ();
log->AppendText(wxT(">>> "));
log->AppendText(wxString (cmd));
log->AppendText(wxT("\n"));
int n = log->GetLastPosition();
if (n>0) n--;
log->ShowPosition (n);
CheckLogLength ();
log->ShowPosition(n);
CheckLogLength();
}
void DebugLogDialog::AppendText (wxString text) {
@ -762,23 +762,23 @@ void DebugLogDialog::AppendText (wxString text) {
void DebugLogDialog::OnEvent(wxCommandEvent& event)
{
int id = event.GetId ();
//wxLogMessage ("event was from id=%d, type=%d", id, (int)event.GetEventType ());
int id = event.GetId();
//wxLogMessage(wxT("event was from id=%d, type=%d"), id, (int)event.GetEventType ());
switch (id) {
case wxID_OK:
Show(FALSE);
break;
case ID_Execute: // pressed execute button
Execute (false);
Execute(false);
break;
default:
event.Skip ();
event.Skip();
}
}
void DebugLogDialog::OnKeyEvent(wxKeyEvent& event)
{
wxLogDebug ("key event");
wxLogDebug(wxT("key event"));
}
#endif
@ -797,7 +797,7 @@ END_EVENT_TABLE()
ParamDialog::ParamDialog(
wxWindow* parent,
wxWindowID id)
: wxDialog (parent, id, "", wxDefaultPosition, wxDefaultSize,
: wxDialog (parent, id, wxT(""), wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
idHash = new wxHashTable (wxKEY_INTEGER);
@ -814,13 +814,13 @@ ParamDialog::ParamDialog(
ParamDialog::~ParamDialog()
{
paramHash->BeginFind ();
paramHash->BeginFind();
wxNode *node;
while ((node = paramHash->Next ()) != NULL) {
while ((node = paramHash->Next()) != NULL) {
// assume that no ParamStruct appears in the hash table under multiple
// keys. If so, we will delete it twice and corrupt memory.
ParamStruct *pstr = (ParamStruct*) node->GetData ();
//wxLogDebug ("deleting ParamStruct id=%d for param %s", pstr->id, pstr->param->get_name ());
ParamStruct *pstr = (ParamStruct*) node->GetData();
// wxLogDebug(wxT("deleting ParamStruct id=%d for param %s"), pstr->id, pstr->param->get_name());
delete pstr;
}
delete idHash;
@ -855,9 +855,9 @@ void ParamDialog::Init()
SetSizer(mainSizer);
mainSizer->Fit(this);
wxSize size = mainSizer->GetMinSize();
wxLogMessage ("minsize is %d,%d", size.GetWidth(), size.GetHeight());
// wxLogMessage(wxT("minsize is %d,%d"), size.GetWidth(), size.GetHeight());
int margin = 5;
SetSizeHints (size.GetWidth() + margin, size.GetHeight() + margin);
SetSizeHints(size.GetWidth() + margin, size.GetHeight() + margin);
Center();
}
@ -911,7 +911,7 @@ void ParamDialog::AddParam (
wxASSERT (context->vertSizer != NULL);
if (param_generic == NULL)
return; // param not registered, probably this option was not compiled in
wxLogDebug ("AddParam for param '%s'", param_generic->get_name ());
wxLogDebug(wxT("AddParam for param '%s'"), param_generic->get_name());
if (context->gridSizer == NULL) {
// create a gridSizer if none exists yet. add it to default vertSizer.
context->gridSizer = new wxFlexGridSizer (3);
@ -941,7 +941,7 @@ void ParamDialog::AddParam (
case BXT_PARAM_BOOL: {
bx_param_bool_c *param = (bx_param_bool_c*) param_generic;
if (!plain) ADD_LABEL (prompt);
wxCheckBox *ckbx = new wxCheckBox (context->parent, pstr->id, "");
wxCheckBox *ckbx = new wxCheckBox (context->parent, pstr->id, wxT(""));
ckbx->SetValue (param->get ());
if (description) ckbx->SetToolTip(description);
sizer->Add (ckbx, 0, wxALL, 2);
@ -964,7 +964,7 @@ void ParamDialog::AddParam (
if (!plain) sizer->Add (1, 1); // spacer
pstr->u.spin = spinctrl;
} else {
wxTextCtrl *textctrl = new wxTextCtrl (context->parent, pstr->id, "", wxDefaultPosition, normalTextSize);
wxTextCtrl *textctrl = new wxTextCtrl (context->parent, pstr->id, wxT(""), wxDefaultPosition, normalTextSize);
const char *format = param->get_format ();
if (!format)
format = strdup(param->get_base () == 16 ? "0x%X" : "%d");
@ -1000,7 +1000,7 @@ void ParamDialog::AddParam (
bx_param_string_c *param = (bx_param_string_c*) param_generic;
if (!plain) ADD_LABEL (prompt);
bool isFilename = param->get_options ()->get () & param->IS_FILENAME;
wxTextCtrl *txtctrl = new wxTextCtrl (context->parent, pstr->id, "", wxDefaultPosition, isFilename? longTextSize : normalTextSize);
wxTextCtrl *txtctrl = new wxTextCtrl (context->parent, pstr->id, wxT(""), wxDefaultPosition, isFilename? longTextSize : normalTextSize);
if (description) txtctrl->SetToolTip(description);
if (param->get_options()->get () & param->RAW_BYTES) {
char *value = param->getptr ();
@ -1010,7 +1010,7 @@ void ParamDialog::AddParam (
sep_string[1] = 0;
for (int i=0; i<param->get_maxsize (); i++) {
wxString eachbyte;
eachbyte.Printf ("%s%02x", (i>0)?sep_string : "", (unsigned int)0xff&value[i]);
eachbyte.Printf ("%s%02x", (i>0)?sep_string : wxT(""), (unsigned int)0xff&value[i]);
buffer += eachbyte;
}
txtctrl->SetValue (buffer);
@ -1086,7 +1086,7 @@ void ParamDialog::AddParam (
if (list->get_options()->get () & bx_list_c::USE_BOX_TITLE) {
boxTitle = prompt;
} else {
boxTitle = "";
boxTitle = wxT("");
}
wxStaticBox *box = new wxStaticBox (context->parent, -1, boxTitle);
wxStaticBoxSizer *boxsz = new wxStaticBoxSizer (box, wxVERTICAL);
@ -1113,22 +1113,22 @@ void ParamDialog::AddParam (
break;
}
default:
wxLogError ("ParamDialog::AddParam called with unsupported param type id=%d", (int)type);
wxLogError(wxT("ParamDialog::AddParam called with unsupported param type id=%d"), (int)type);
}
if (pstr->label) pstr->label->Enable(pstr->param->get_enabled());
if (pstr->u.window) pstr->u.window->Enable(pstr->param->get_enabled());
if (pstr->browseButton) pstr->browseButton->Enable(pstr->param->get_enabled());
}
bool ParamDialog::CopyGuiToParam ()
bool ParamDialog::CopyGuiToParam()
{
// loop through all the parameters
idHash->BeginFind ();
idHash->BeginFind();
wxNode *node;
while ((node = idHash->Next ()) != NULL) {
ParamStruct *pstr = (ParamStruct*) node->GetData ();
wxLogDebug ("commit changes for param %s", pstr->param->get_name ());
int type = pstr->param->get_type ();
while ((node = idHash->Next()) != NULL) {
ParamStruct *pstr = (ParamStruct*) node->GetData();
wxLogDebug(wxT("commit changes for param %s"), pstr->param->get_name());
int type = pstr->param->get_type();
switch (type) {
case BXT_PARAM_BOOL: {
bx_param_bool_c *boolp = (bx_param_bool_c*) pstr->param;
@ -1147,11 +1147,11 @@ bool ParamDialog::CopyGuiToParam ()
} else {
n = GetTextCtrlInt (pstr->u.text, &valid, true, complaint);
}
if ((n < nump->get_min ()) || (n > nump->get_max ())) {
wxMessageBox("Numerical parameter out of range", "Error", wxOK | wxICON_ERROR, this );
if ((n < nump->get_min()) || (n > nump->get_max())) {
wxMessageBox(wxT("Numerical parameter out of range"), wxT("Error"), wxOK | wxICON_ERROR, this );
return false;
}
if (n != nump->get ()) nump->set (n);
if (n != nump->get()) nump->set(n);
break;
}
case BXT_PARAM_ENUM: {
@ -1180,7 +1180,7 @@ bool ParamDialog::CopyGuiToParam ()
buf[i] = n;
p+=2;
} else {
wxMessageBox("Illegal raw byte format", "Error", wxOK | wxICON_ERROR, this );
wxMessageBox(wxT("Illegal raw byte format"), wxT("Error"), wxOK | wxICON_ERROR, this );
return false;
}
}
@ -1194,7 +1194,7 @@ bool ParamDialog::CopyGuiToParam ()
case BXT_LIST:
break;
default:
wxLogError ("ParamDialog::CopyGuiToParam: unsupported param type id=%d", (int)type);
wxLogError(wxT("ParamDialog::CopyGuiToParam: unsupported param type id=%d"), (int)type);
}
}
return true;
@ -1220,7 +1220,7 @@ void ParamDialog::EnableChanged()
void ParamDialog::EnableChanged(ParamStruct *pstrOfCheckbox)
{
wxLogDebug("EnableChanged on checkbox %s", pstrOfCheckbox->param->get_name());
wxLogDebug(wxT("EnableChanged on checkbox %s"), pstrOfCheckbox->param->get_name());
bx_param_bool_c *enableParam = (bx_param_bool_c*) pstrOfCheckbox->param;
wxASSERT(enableParam->get_type() == BXT_PARAM_BOOL); // or we wouldn't be here
bool en = pstrOfCheckbox->u.checkbox->GetValue();
@ -1239,15 +1239,15 @@ void ParamDialog::EnableChangedRecursive(
ParamStruct *pstr = (ParamStruct*) paramHash->Get(param->get_id());
if (pstr) {
if (param == pstrOfCheckbox->param) {
wxLogDebug("not setting enable on checkbox '%s' that triggered the enable change", pstrOfCheckbox->param->get_name());
wxLogDebug(wxT("not setting enable on checkbox '%s' that triggered the enable change"), pstrOfCheckbox->param->get_name());
continue;
}
wxLogDebug ("setting enable for param '%s' to %d", pstr->param->get_name(), en?1:0);
wxLogDebug(wxT("setting enable for param '%s' to %d"), pstr->param->get_name(), en?1:0);
if (en != pstr->u.window->IsEnabled()) {
EnableParam(pstr->param->get_id(), en);
bx_list_c *deps = pstr->param->get_dependent_list();
if (deps) {
wxLogDebug ("recursing on dependent list of %s", list->get_name());
wxLogDebug(wxT("recursing on dependent list of %s"), list->get_name());
if (pstr->param->get_type() == BXT_PARAM_BOOL) {
bool dep_en = pstr->u.window->IsEnabled() && pstr->u.checkbox->GetValue();
EnableChangedRecursive(deps, dep_en, pstr);
@ -1298,7 +1298,7 @@ void ParamDialog::EnableParam(const char *pname, bx_list_c *base, bool enabled)
void ParamDialog::EnumChanged(ParamStruct *pstr)
{
wxLogDebug("EnumChanged");
wxLogDebug(wxT("EnumChanged"));
char pname[512];
Bit8u channel, device;
@ -1328,7 +1328,7 @@ void ParamDialog::EnumChanged(ParamStruct *pstr)
int type = pstr->u.choice->GetSelection();
if (type == BX_ATA_DEVICE_DISK) {
// enable cylinders, heads, spt
wxLogDebug ("enabling disk parameters");
wxLogDebug(wxT("enabling disk parameters"));
EnableParam("mode", base, 1);
EnableParam("cylinders", base, 1);
EnableParam("heads", base, 1);
@ -1352,7 +1352,7 @@ void ParamDialog::EnumChanged(ParamStruct *pstr)
} else {
// enable inserted
wxLogDebug ("enabling cdrom parameters");
wxLogDebug(wxT("enabling cdrom parameters"));
EnableParam("mode", base, 0);
EnableParam("cylinders", base, 0);
EnableParam("heads", base, 0);
@ -1870,7 +1870,7 @@ int GetTextCtrlInt (wxTextCtrl *ctrl,
bool BrowseTextCtrl (wxTextCtrl *text, wxString prompt, long style) {
// try to configure the dialog to show hidden files
wxConfigBase::Get() -> Write(wxT("/wxWidgets/wxFileDialog/ShowHidden"), true);
wxFileDialog *fdialog = new wxFileDialog (text->GetParent (), prompt, "", text->GetValue (), "*.*", style);
wxFileDialog *fdialog = new wxFileDialog (text->GetParent(), prompt, wxT(""), text->GetValue(), wxT("*.*"), style);
int result = fdialog->ShowModal();
if (result == wxID_OK)
text->SetValue (fdialog->GetPath ());

View File

@ -1,5 +1,5 @@
////////////////////////////////////////////////////////////////////
// $Id: wxdialog.h,v 1.61 2006-03-11 10:00:56 vruppert Exp $
// $Id: wxdialog.h,v 1.62 2006-03-18 16:30:51 vruppert Exp $
////////////////////////////////////////////////////////////////////
//
// wxWidgets dialogs for Bochs
@ -9,20 +9,20 @@
////////////////////////////////////////////////////////////////////
// text messages used in several places
////////////////////////////////////////////////////////////////////
#define MSG_NO_HELP "No help is available yet."
#define MSG_NO_HELP_CAPTION "No help"
#define MSG_ENABLED "Enabled"
#define BTNLABEL_HELP "Help"
#define BTNLABEL_CANCEL "Cancel"
#define BTNLABEL_OK "Ok"
#define BTNLABEL_CREATE_IMG "Create Image"
#define BTNLABEL_BROWSE "<--Browse"
#define BTNLABEL_DEBUG_CONTINUE "Continue"
#define BTNLABEL_DEBUG_STOP "Stop"
#define BTNLABEL_DEBUG_STEP "Step"
#define BTNLABEL_DEBUG_COMMIT "Commit"
#define BTNLABEL_CLOSE "Close"
#define BTNLABEL_EXECUTE "Execute"
#define MSG_NO_HELP wxT("No help is available yet.")
#define MSG_NO_HELP_CAPTION wxT("No help")
#define MSG_ENABLED wxT("Enabled")
#define BTNLABEL_HELP wxT("Help")
#define BTNLABEL_CANCEL wxT("Cancel")
#define BTNLABEL_OK wxT("Ok")
#define BTNLABEL_CREATE_IMG wxT("Create Image")
#define BTNLABEL_BROWSE wxT("<--Browse")
#define BTNLABEL_DEBUG_CONTINUE wxT("Continue")
#define BTNLABEL_DEBUG_STOP wxT("Stop")
#define BTNLABEL_DEBUG_STEP wxT("Step")
#define BTNLABEL_DEBUG_COMMIT wxT("Commit")
#define BTNLABEL_CLOSE wxT("Close")
#define BTNLABEL_EXECUTE wxT("Execute")
#if defined(WIN32)
// On win32, apparantly the spinctrl depends on a native control which only
@ -37,9 +37,9 @@
void ChangeStaticText(wxSizer *sizer, wxStaticText *win, wxString newtext);
bool CreateImage(int harddisk, int sectors, const char *filename);
void SetTextCtrl(wxTextCtrl *text, const char *format, int val);
int GetTextCtrlInt(wxTextCtrl *text, bool *valid = NULL, bool complain=false, wxString complaint = "Invalid integer!");
int GetTextCtrlInt(wxTextCtrl *text, bool *valid = NULL, bool complain=false, wxString complaint = wxT("Invalid integer!"));
bool BrowseTextCtrl(wxTextCtrl *text,
wxString prompt="Choose a file",
wxString prompt= wxT("Choose a file"),
long style=wxOPEN);
wxChoice *makeLogOptionChoiceBox(wxWindow *parent, wxWindowID id, int evtype, bool includeNoChange = false);
@ -75,11 +75,11 @@ public:
#define LOG_MSG_ASK_IDS \
{ ID_Continue, ID_Die, ID_DumpCore, ID_Debugger, wxHELP }
#define LOG_MSG_ASK_NAMES \
{ "Continue", "Kill Sim", "Dump Core", "Debugger", "Help" }
{ wxT("Continue"), wxT("Kill Sim"), wxT("Dump Core"), wxT("Debugger"), wxT("Help") }
#define LOG_MSG_DONT_ASK_STRING \
"Don't ask about future messages like this"
#define LOG_MSG_CONTEXT "Context: %s"
#define LOG_MSG_MSG "Message: %s"
wxT("Don't ask about future messages like this")
#define LOG_MSG_CONTEXT wxT("Context: %s")
#define LOG_MSG_MSG wxT("Message: %s")
private:
wxStaticText *context, *message;
wxCheckBox *dontAsk;
@ -168,12 +168,12 @@ DECLARE_EVENT_TABLE()
class FloppyConfigDialog: public wxDialog
{
public:
#define FLOPPY_CONFIG_TITLE "Configure %s"
#define FLOPPY_CONFIG_INSTRS "Select the device or image to use when simulating %s."
#define FLOPPY_CONFIG_CAP "What is the capacity of this disk?"
#define FLOPPY_CONFIG_HINT "To create a disk image, choose the file name and capacity, then click on \"Create Image\".\n\n" \
"Clicking OK signals a media change for this drive."
#define FLOPPY_CONFIG_DISKIMG "Disk image: "
#define FLOPPY_CONFIG_TITLE wxT("Configure %s")
#define FLOPPY_CONFIG_INSTRS wxT("Select the device or image to use when simulating %s.")
#define FLOPPY_CONFIG_CAP wxT("What is the capacity of this disk?")
#define FLOPPY_CONFIG_HINT wxT("To create a disk image, choose the file name and capacity, then click on \"Create Image\".\n\n" \
"Clicking OK signals a media change for this drive.")
#define FLOPPY_CONFIG_DISKIMG wxT("Disk image: ")
private:
void Init (); // called automatically by ShowModal()
void ShowHelp ();
@ -239,16 +239,16 @@ DECLARE_EVENT_TABLE()
class AdvancedLogOptionsDialog: public wxDialog
{
private:
#define ADVLOG_OPTS_TITLE "Configure Log Events"
#define ADVLOG_OPTS_LOGFILE "Log file"
#define ADVLOG_OPTS_PROMPT \
#define ADVLOG_OPTS_TITLE wxT("Configure Log Events")
#define ADVLOG_OPTS_LOGFILE wxT("Log file")
#define ADVLOG_OPTS_PROMPT wxT( \
"This table determines how Bochs will respond to each kind of event coming\n" \
"from a particular source. For example if you are having problems with\n" \
"the keyboard, you could ask for debug and info events from the keyboard\n" \
"to be reported."
#define ADVLOG_OPTS_TYPE_NAMES { "Debug", "Info", "Error", "Panic", "Pass" }
"to be reported.")
#define ADVLOG_OPTS_TYPE_NAMES { wxT("debug"), wxT("Info"), wxT("Error"), wxT("Panic"), wxT("Pass") }
#define ADVLOG_OPTS_N_TYPES 5
#define ADVLOG_DEFAULTS "Use defaults for all devices"
#define ADVLOG_DEFAULTS wxT("Use defaults for all devices")
void Init (); // called automatically by ShowModal()
void ShowHelp ();
wxBoxSizer *vertSizer, *logfileSizer, *buttonSizer;
@ -301,8 +301,8 @@ DECLARE_EVENT_TABLE()
class DebugLogDialog: public wxDialog
{
private:
#define DEBUG_LOG_TITLE "Debugger log"
#define DEBUG_CMD_PROMPT "Type a debugger command:"
#define DEBUG_LOG_TITLE wxT("Debugger log")
#define DEBUG_CMD_PROMPT wxT("Type a debugger command:")
wxBoxSizer *mainSizer, *commandSizer, *buttonSizer;
wxTextCtrl *log, *command;
Bit32u lengthMax;
@ -440,11 +440,11 @@ DECLARE_EVENT_TABLE()
class LogOptionsDialog : public ParamDialog
{
private:
#define LOG_OPTS_TITLE "Configure Log Events"
#define LOG_OPTS_PROMPT "How should Bochs respond to each type of event?"
#define LOG_OPTS_TYPE_NAMES { "Debug events: ", "Info events: ", "Error events: ", "Panic events: ", "Pass events: " }
#define LOG_OPTS_TITLE wxT("Configure Log Events")
#define LOG_OPTS_PROMPT wxT("How should Bochs respond to each type of event?")
#define LOG_OPTS_TYPE_NAMES { wxT("Debug events: "), wxT("Info events: "), wxT("Error events: "), wxT("Panic events: "), wxT("Pass events: ") }
#define LOG_OPTS_N_TYPES 5
#define LOG_OPTS_CHOICES { "ignore", "log", "ask user", "end simulation", "no change" }
#define LOG_OPTS_CHOICES { wxT("ignore"), wxT("log"), wxT("ask user"), wxT("end simulation"), wxT("no change") }
#define LOG_OPTS_N_CHOICES_NORMAL 4
#define LOG_OPTS_N_CHOICES 5 // number of choices, including "no change"
#define LOG_OPTS_NO_CHANGE 4 // index of "no change"
@ -457,7 +457,7 @@ private:
/* can't ignore panics or errors */ \
|| (type >= 2 && choice==0) \
)
#define LOG_OPTS_ADV "For additional control over how each device responds to events, use the menu option \"Log ... By Device\"."
#define LOG_OPTS_ADV wxT("For additional control over how each device responds to events, use the menu option \"Log ... By Device\".")
wxFlexGridSizer *gridSizer;
wxChoice *action[LOG_OPTS_N_TYPES];
public:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.cc,v 1.131 2006-03-12 15:11:54 vruppert Exp $
// $Id: wxmain.cc,v 1.132 2006-03-18 16:30:51 vruppert Exp $
/////////////////////////////////////////////////////////////////
//
// wxmain.cc implements the wxWidgets frame, toolbar, menus, and dialogs.
@ -171,20 +171,20 @@ static int ci_callback (void *userdata, ci_command_t command)
// So, in main.cc we define WinMain and fill in the bx_startup_flags
// structure with the data, so that when we're ready to call wxEntry
// it has access to the data.
wxEntry (
wxEntry(
bx_startup_flags.hInstance,
bx_startup_flags.hPrevInstance,
bx_startup_flags.m_lpCmdLine,
bx_startup_flags.nCmdShow);
#else
wxEntry (bx_startup_flags.argc, bx_startup_flags.argv);
wxEntry(bx_startup_flags.argc, bx_startup_flags.argv);
#endif
break;
case CI_RUNTIME_CONFIG:
fprintf (stderr, "wxmain.cc: runtime config not implemented\n");
fprintf(stderr, "wxmain.cc: runtime config not implemented\n");
break;
case CI_SHUTDOWN:
fprintf (stderr, "wxmain.cc: shutdown not implemented\n");
fprintf(stderr, "wxmain.cc: shutdown not implemented\n");
break;
}
return 0;
@ -193,10 +193,10 @@ static int ci_callback (void *userdata, ci_command_t command)
extern "C" int libwx_LTX_plugin_init (plugin_t *plugin, plugintype_t type,
int argc, char *argv[])
{
wxLogDebug ("plugin_init for wxmain.cc");
wxLogDebug ("installing wxWidgets as the configuration interface");
SIM->register_configuration_interface ("wx", ci_callback, NULL);
wxLogDebug ("installing %s as the Bochs GUI", "wxWidgets");
wxLogDebug(wxT("plugin_init for wxmain.cc"));
wxLogDebug(wxT("installing wxWidgets as the configuration interface"));
SIM->register_configuration_interface("wx", ci_callback, NULL);
wxLogDebug(wxT("installing %s as the Bochs GUI"), wxT("wxWidgets"));
SIM->get_param_enum(BXPN_SEL_DISPLAY_LIBRARY)->set_enabled(0);
MyPanel::OnPluginInit ();
return 0; // success
@ -270,7 +270,7 @@ MyApp::DefaultCallback (void *thisptr, BxEvent *event)
// gui closing down, do something simple and nongraphical.
fprintf (stderr, "%s\n", text.c_str ());
} else {
wxMessageBox (text, "Error", wxOK | wxICON_ERROR );
wxMessageBox(text, wxT("Error"), wxOK | wxICON_ERROR );
// maybe I can make OnLogMsg display something that looks appropriate.
// theFrame->OnLogMsg (event);
}
@ -417,62 +417,62 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
// set up the gui
menuConfiguration = new wxMenu;
menuConfiguration->Append(ID_Config_New, "&New Configuration" );
menuConfiguration->Append(ID_Config_Read, "&Read Configuration" );
menuConfiguration->Append(ID_Config_Save, "&Save Configuration" );
menuConfiguration->Append(ID_Config_New, wxT("&New Configuration"));
menuConfiguration->Append(ID_Config_Read, wxT("&Read Configuration"));
menuConfiguration->Append(ID_Config_Save, wxT("&Save Configuration"));
menuConfiguration->AppendSeparator();
menuConfiguration->Append (ID_Quit, "&Quit");
menuConfiguration->Append (ID_Quit, wxT("&Quit"));
menuEdit = new wxMenu;
menuEdit->Append(ID_Edit_FD_0, "Floppy Disk &0..." );
menuEdit->Append(ID_Edit_FD_1, "Floppy Disk &1..." );
menuEdit->Append(ID_Edit_ATA0, "ATA Channel 0..." );
menuEdit->Append(ID_Edit_ATA1, "ATA Channel 1..." );
menuEdit->Append(ID_Edit_ATA2, "ATA Channel 2..." );
menuEdit->Append(ID_Edit_ATA3, "ATA Channel 3..." );
menuEdit->Append(ID_Edit_CPU, "&CPU..." );
menuEdit->Append(ID_Edit_Memory, "&Memory..." );
menuEdit->Append(ID_Edit_Clock_Cmos, "C&lock/Cmos..." );
menuEdit->Append(ID_Edit_PCI, "&PCI..." );
menuEdit->Append(ID_Edit_Display, "&Display + Interface..." );
menuEdit->Append(ID_Edit_Keyboard, "&Keyboard + Mouse..." );
menuEdit->Append(ID_Edit_Boot, "&Boot..." );
menuEdit->Append(ID_Edit_Serial_Parallel, "&Serial/Parallel..." );
menuEdit->Append(ID_Edit_Network, "&Network..." );
menuEdit->Append(ID_Edit_Sound, "S&ound..." );
menuEdit->Append(ID_Edit_Other, "&Other..." );
menuEdit->Append(ID_Edit_FD_0, wxT("Floppy Disk &0..."));
menuEdit->Append(ID_Edit_FD_1, wxT("Floppy Disk &1..."));
menuEdit->Append(ID_Edit_ATA0, wxT("ATA Channel 0..."));
menuEdit->Append(ID_Edit_ATA1, wxT("ATA Channel 1..."));
menuEdit->Append(ID_Edit_ATA2, wxT("ATA Channel 2..."));
menuEdit->Append(ID_Edit_ATA3, wxT("ATA Channel 3..."));
menuEdit->Append(ID_Edit_CPU, wxT("&CPU..."));
menuEdit->Append(ID_Edit_Memory, wxT("&Memory..."));
menuEdit->Append(ID_Edit_Clock_Cmos, wxT("C&lock/Cmos..."));
menuEdit->Append(ID_Edit_PCI, wxT("&PCI..."));
menuEdit->Append(ID_Edit_Display, wxT("&Display + Interface..."));
menuEdit->Append(ID_Edit_Keyboard, wxT("&Keyboard + Mouse..."));
menuEdit->Append(ID_Edit_Boot, wxT("&Boot..."));
menuEdit->Append(ID_Edit_Serial_Parallel, wxT("&Serial/Parallel..."));
menuEdit->Append(ID_Edit_Network, wxT("&Network..."));
menuEdit->Append(ID_Edit_Sound, wxT("S&ound..."));
menuEdit->Append(ID_Edit_Other, wxT("&Other..."));
menuSimulate = new wxMenu;
menuSimulate->Append(ID_Simulate_Start, "&Start...");
menuSimulate->Append(ID_Simulate_PauseResume, "&Pause...");
menuSimulate->Append(ID_Simulate_Stop, "S&top...");
menuSimulate->Append(ID_Simulate_Start, wxT("&Start..."));
menuSimulate->Append(ID_Simulate_PauseResume, wxT("&Pause..."));
menuSimulate->Append(ID_Simulate_Stop, wxT("S&top..."));
menuSimulate->AppendSeparator();
menuSimulate->Enable(ID_Simulate_PauseResume, FALSE);
menuSimulate->Enable(ID_Simulate_Stop, FALSE);
menuDebug = new wxMenu;
menuDebug->Append(ID_Debug_ShowCpu, "Show &CPU");
menuDebug->Append(ID_Debug_ShowKeyboard, "Show &Keyboard");
menuDebug->Append(ID_Debug_ShowCpu, wxT("Show &CPU"));
menuDebug->Append(ID_Debug_ShowKeyboard, wxT("Show &Keyboard"));
#if BX_DEBUGGER
menuDebug->Append(ID_Debug_Console, "Debug Console");
menuDebug->Append(ID_Debug_Console, wxT("Debug Console"));
#endif
menuDebug->Append(ID_Debug_ShowMemory, "Show &memory");
menuDebug->Append(ID_Debug_ShowMemory, wxT("Show &memory"));
menuLog = new wxMenu;
menuLog->Append(ID_Log_View, "&View");
menuLog->Append(ID_Log_Prefs, "&Preferences...");
menuLog->Append(ID_Log_PrefsDevice, "By &Device...");
menuLog->Append(ID_Log_View, wxT("&View"));
menuLog->Append(ID_Log_Prefs, wxT("&Preferences..."));
menuLog->Append(ID_Log_PrefsDevice, wxT("By &Device..."));
menuHelp = new wxMenu;
menuHelp->Append(ID_Help_About, "&About..." );
menuHelp->Append(ID_Help_About, wxT("&About..."));
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuConfiguration, "&File" );
menuBar->Append(menuEdit, "&Edit" );
menuBar->Append(menuSimulate, "&Simulate" );
menuBar->Append(menuDebug, "&Debug" );
menuBar->Append(menuLog, "&Log" );
menuBar->Append(menuHelp, "&Help" );
menuBar->Append(menuConfiguration, wxT("&File"));
menuBar->Append(menuEdit, wxT("&Edit"));
menuBar->Append(menuSimulate, wxT("&Simulate"));
menuBar->Append(menuDebug, wxT("&Debug"));
menuBar->Append(menuLog, wxT("&Log"));
menuBar->Append(menuHelp, wxT("&Help"));
SetMenuBar(menuBar);
// disable things that don't work yet
@ -497,20 +497,20 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
tb->AddTool(id, wxBitmap(xpm_name), tooltip); \
} while (0)
BX_ADD_TOOL(ID_Edit_FD_0, floppya_xpm, "Change Floppy A");
BX_ADD_TOOL(ID_Edit_FD_1, floppyb_xpm, "Change Floppy B");
BX_ADD_TOOL(ID_Edit_Cdrom, cdromd_xpm, "Change CDROM");
BX_ADD_TOOL(ID_Toolbar_Reset, reset_xpm, "Reset the system");
BX_ADD_TOOL(ID_Toolbar_Power, power_xpm, "Turn power on/off");
BX_ADD_TOOL(ID_Edit_FD_0, floppya_xpm, wxT("Change Floppy A"));
BX_ADD_TOOL(ID_Edit_FD_1, floppyb_xpm, wxT("Change Floppy B"));
BX_ADD_TOOL(ID_Edit_Cdrom, cdromd_xpm, wxT("Change CDROM"));
BX_ADD_TOOL(ID_Toolbar_Reset, reset_xpm, wxT("Reset the system"));
BX_ADD_TOOL(ID_Toolbar_Power, power_xpm, wxT("Turn power on/off"));
BX_ADD_TOOL(ID_Toolbar_Copy, copy_xpm, "Copy to clipboard");
BX_ADD_TOOL(ID_Toolbar_Paste, paste_xpm, "Paste from clipboard");
BX_ADD_TOOL(ID_Toolbar_Snapshot, snapshot_xpm, "Save screen snapshot");
BX_ADD_TOOL(ID_Toolbar_Copy, copy_xpm, wxT("Copy to clipboard"));
BX_ADD_TOOL(ID_Toolbar_Paste, paste_xpm, wxT("Paste from clipboard"));
BX_ADD_TOOL(ID_Toolbar_Snapshot, snapshot_xpm, wxT("Save screen snapshot"));
// Omit config button because the whole wxWidgets interface is like
// one really big config button.
//BX_ADD_TOOL(ID_Toolbar_Config, configbutton_xpm, "Runtime Configuration");
BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, "Enable/disable mouse capture\nThere is also a shortcut for this: a CTRL key + the middle mouse button.");
BX_ADD_TOOL(ID_Toolbar_User, userbutton_xpm, "Keyboard shortcut");
BX_ADD_TOOL(ID_Toolbar_Mouse_en, mouse_xpm, wxT("Enable/disable mouse capture\nThere is also a shortcut for this: a CTRL key + the middle mouse button."));
BX_ADD_TOOL(ID_Toolbar_User, userbutton_xpm, wxT("Keyboard shortcut"));
tb->Realize();
@ -534,14 +534,14 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
MyFrame::~MyFrame ()
{
delete panel;
wxLogDebug ("MyFrame destructor");
wxLogDebug(wxT("MyFrame destructor"));
theFrame = NULL;
}
void MyFrame::OnConfigNew(wxCommandEvent& WXUNUSED(event))
{
int answer = wxMessageBox ("This will reset all settings back to their default values.\nAre you sure you want to do this?",
"Are you sure?", wxYES_NO | wxCENTER, this);
int answer = wxMessageBox(wxT("This will reset all settings back to their default values.\nAre you sure you want to do this?"),
wxT("Are you sure?"), wxYES_NO | wxCENTER, this);
if (answer == wxYES) SIM->reset_all_param ();
}
@ -549,7 +549,7 @@ void MyFrame::OnConfigRead(wxCommandEvent& WXUNUSED(event))
{
char *bochsrc;
long style = wxOPEN;
wxFileDialog *fdialog = new wxFileDialog (this, "Read configuration", "", "", "*.*", style);
wxFileDialog *fdialog = new wxFileDialog (this, wxT("Read configuration"), wxT(""), wxT(""), wxT("*.*"), style);
if (fdialog->ShowModal() == wxID_OK) {
bochsrc = (char *)fdialog->GetPath().c_str ();
SIM->reset_all_param ();
@ -562,7 +562,7 @@ void MyFrame::OnConfigSave(wxCommandEvent& WXUNUSED(event))
{
char *bochsrc;
long style = wxSAVE | wxOVERWRITE_PROMPT;
wxFileDialog *fdialog = new wxFileDialog (this, "Save configuration", "", "", "*.*", style);
wxFileDialog *fdialog = new wxFileDialog (this, wxT("Save configuration"), wxT(""), wxT(""), wxT("*.*"), style);
if (fdialog->ShowModal() == wxID_OK) {
bochsrc = (char *)fdialog->GetPath().c_str ();
SIM->write_rc (bochsrc, 1);
@ -642,8 +642,8 @@ void MyFrame::OnEditBoot(wxCommandEvent& WXUNUSED(event))
bootDevices++;
}
if (bootDevices == 0) {
wxMessageBox( "All the possible boot devices are disabled right now!\nYou must enable the first floppy drive, a hard drive, or a CD-ROM.",
"None enabled", wxOK | wxICON_ERROR, this );
wxMessageBox(wxT("All the possible boot devices are disabled right now!\nYou must enable the first floppy drive, a hard drive, or a CD-ROM."),
wxT("None enabled"), wxOK | wxICON_ERROR, this );
return;
}
ParamDialog dlg(this, -1);
@ -767,16 +767,16 @@ void MyFrame::OnShowCpu(wxCommandEvent& WXUNUSED(event))
{
if (SIM->get_param(BXPN_CPU_0_STATE) == NULL) {
// if params not initialized yet, then give up
wxMessageBox("Cannot show the debugger window until the simulation has begun.",
"Sim not started", wxOK | wxICON_ERROR, this);
wxMessageBox(wxT("Cannot show the debugger window until the simulation has begun."),
wxT("Sim not started"), wxOK | wxICON_ERROR, this);
return;
}
if (showCpu == NULL) {
showCpu = new CpuRegistersDialog(this, -1);
#if BX_DEBUGGER
showCpu->SetTitle("Bochs Debugger");
showCpu->SetTitle(wxT("Bochs Debugger"));
#else
showCpu->SetTitle("CPU Registers");
showCpu->SetTitle(wxT("CPU Registers"));
#endif
showCpu->Init();
} else {
@ -789,13 +789,13 @@ void MyFrame::OnShowKeyboard(wxCommandEvent& WXUNUSED(event))
{
if (SIM->get_param(BXPN_KBD_STATE) == NULL) {
// if params not initialized yet, then give up
wxMessageBox("Cannot show the debugger window until the simulation has begun.",
"Sim not started", wxOK | wxICON_ERROR, this );
wxMessageBox(wxT("Cannot show the debugger window until the simulation has begun."),
wxT("Sim not started"), wxOK | wxICON_ERROR, this );
return;
}
if (showKbd == NULL) {
showKbd = new ParamDialog(this, -1);
showKbd->SetTitle("Keyboard State (incomplete, this is a demo)");
showKbd->SetTitle(wxT("Keyboard State (incomplete, this is a demo)"));
showKbd->AddParam(SIM->get_param(BXPN_KBD_STATE));
showKbd->Init();
} else {
@ -813,15 +813,15 @@ void MyFrame::OnDebugLog(wxCommandEvent& WXUNUSED(event))
}
void
MyFrame::DebugBreak ()
MyFrame::DebugBreak()
{
if (debugCommand) {
delete debugCommand;
debugCommand = NULL;
}
wxASSERT (showDebugLog != NULL);
showDebugLog->AppendCommand ("*** break ***");
SIM->debug_break ();
showDebugLog->AppendCommand("*** break ***");
SIM->debug_break();
}
void
@ -835,12 +835,12 @@ MyFrame::DebugCommand (wxString cmd)
void
MyFrame::DebugCommand (const char *cmd)
{
wxLogDebug ("debugger command: %s", cmd);
wxASSERT (showDebugLog != NULL);
showDebugLog->AppendCommand (cmd);
wxLogDebug(wxT("debugger command: %s"), cmd);
wxASSERT(showDebugLog != NULL);
showDebugLog->AppendCommand(cmd);
if (debugCommand != NULL) {
// one is already waiting
wxLogDebug ("multiple debugger commands, discarding the earlier one");
wxLogDebug(wxT("multiple debugger commands, discarding the earlier one"));
delete debugCommand;
debugCommand = NULL;
}
@ -849,7 +849,7 @@ MyFrame::DebugCommand (const char *cmd)
strncpy (tmp, cmd, len+1);
// if an event is waiting for us, fill it an send back to sim_thread.
if (debugCommandEvent != NULL) {
wxLogDebug ("sim_thread was waiting for this command '%s'", tmp);
wxLogDebug(wxT("sim_thread was waiting for this command '%s'"), tmp);
wxASSERT (debugCommandEvent->type == BX_SYNC_EVT_GET_DBG_COMMAND);
debugCommandEvent->u.debugcmd.command = tmp;
debugCommandEvent->retcode = 1;
@ -858,7 +858,7 @@ MyFrame::DebugCommand (const char *cmd)
debugCommandEvent = NULL;
} else {
// store this command in debugCommand for the future
wxLogDebug ("storing debugger command '%s'", tmp);
wxLogDebug(wxT("storing debugger command '%s'"), tmp);
debugCommand = tmp;
}
}
@ -871,18 +871,18 @@ void MyFrame::OnQuit(wxCommandEvent& event)
// no simulation thread is running. Just close the window.
Close( TRUE );
} else {
SIM->set_notify_callback (&MyApp::DefaultCallback, this);
SIM->set_notify_callback(&MyApp::DefaultCallback, this);
// ask the simulator to stop. When it stops it will close this frame.
SetStatusText ("Waiting for simulation to stop...");
OnKillSim (event);
SetStatusText(wxT("Waiting for simulation to stop..."));
OnKillSim(event);
}
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxString str;
str.Printf ("Bochs x86 Emulator version %s (wxWidgets port)", VER_STRING);
wxMessageBox( str, "About Bochs", wxOK | wxICON_INFORMATION, this );
str.Printf("Bochs x86 Emulator version %s (wxWidgets port)", VER_STRING);
wxMessageBox(str, wxT("About Bochs"), wxOK | wxICON_INFORMATION, this );
}
// update the menu items, status bar, etc.
@ -892,31 +892,31 @@ void MyFrame::simStatusChanged (StatusChange change, bx_bool popupNotify) {
switch (change) {
case Start: // running
wxLogStatus ("Starting Bochs simulation");
menuSimulate->Enable (ID_Simulate_Start, FALSE);
menuSimulate->Enable (ID_Simulate_PauseResume, TRUE);
menuSimulate->Enable (ID_Simulate_Stop, TRUE);
menuSimulate->SetLabel (ID_Simulate_PauseResume, "&Pause");
wxLogStatus(wxT("Starting Bochs simulation"));
menuSimulate->Enable(ID_Simulate_Start, FALSE);
menuSimulate->Enable(ID_Simulate_PauseResume, TRUE);
menuSimulate->Enable(ID_Simulate_Stop, TRUE);
menuSimulate->SetLabel(ID_Simulate_PauseResume, wxT("&Pause"));
break;
case Stop: // not running
wxLogStatus ("Simulation stopped");
menuSimulate->Enable (ID_Simulate_Start, TRUE);
menuSimulate->Enable (ID_Simulate_PauseResume, FALSE);
menuSimulate->Enable (ID_Simulate_Stop, FALSE);
menuSimulate->SetLabel (ID_Simulate_PauseResume, "&Pause");
wxLogStatus(wxT("Simulation stopped"));
menuSimulate->Enable(ID_Simulate_Start, TRUE);
menuSimulate->Enable(ID_Simulate_PauseResume, FALSE);
menuSimulate->Enable(ID_Simulate_Stop, FALSE);
menuSimulate->SetLabel(ID_Simulate_PauseResume, wxT("&Pause"));
// This should only be used if the simulation stops due to error.
// Obviously if the user asked it to stop, they don't need to be told.
if (popupNotify)
wxMessageBox("Bochs simulation has stopped.", "Bochs Stopped",
wxMessageBox(wxT("Bochs simulation has stopped."), wxT("Bochs Stopped"),
wxOK | wxICON_INFORMATION, this);
break;
case Pause: // pause
wxLogStatus ("Pausing simulation");
menuSimulate->SetLabel (ID_Simulate_PauseResume, "&Resume");
wxLogStatus(wxT("Pausing simulation"));
menuSimulate->SetLabel (ID_Simulate_PauseResume, wxT("&Resume"));
break;
case Resume: // resume
wxLogStatus ("Resuming simulation");
menuSimulate->SetLabel (ID_Simulate_PauseResume, "&Pause");
wxLogStatus(wxT("Resuming simulation"));
menuSimulate->SetLabel (ID_Simulate_PauseResume, wxT("&Pause"));
break;
}
bool canConfigure = (change == Stop);
@ -960,9 +960,9 @@ void MyFrame::OnStartSim(wxCommandEvent& event)
{
wxCriticalSectionLocker lock(sim_thread_lock);
if (sim_thread != NULL) {
wxMessageBox (
"Can't start Bochs simulator, because it is already running",
"Already Running", wxOK | wxICON_ERROR, this);
wxMessageBox(
wxT("Can't start Bochs simulator, because it is already running"),
wxT("Already Running"), wxOK | wxICON_ERROR, this);
return;
}
// check that display library is set to wx. If not, give a warning and
@ -972,27 +972,27 @@ void MyFrame::OnStartSim(wxCommandEvent& event)
bx_param_enum_c *gui_param = SIM->get_param_enum(BXPN_SEL_DISPLAY_LIBRARY);
char *gui_name = gui_param->get_selected();
if (strcmp(gui_name, "wx") != 0) {
wxMessageBox (
wxMessageBox(wxT(
"The display library was not set to wxWidgets. When you use the\n"
"wxWidgets configuration interface, you must also select the wxWidgets\n"
"display library. I will change it to 'wx' now.",
"display library error", wxOK | wxICON_WARNING, this);
"display library. I will change it to 'wx' now."),
wxT("display library error"), wxOK | wxICON_WARNING, this);
if (!gui_param->set_by_name ("wx")) {
wxASSERT (0 && "Could not set display library setting to 'wx");
wxASSERT(0 && "Could not set display library setting to 'wx");
}
}
// give warning about restarting the simulation
start_bochs_times++;
if (start_bochs_times>1) {
wxMessageBox (
"You have already started the simulator once this session. Due to memory leaks and bugs in init code, you may get unstable behavior.",
"2nd time warning", wxOK | wxICON_WARNING, this);
wxMessageBox(wxT(
"You have already started the simulator once this session. Due to memory leaks and bugs in init code, you may get unstable behavior."),
wxT("2nd time warning"), wxOK | wxICON_WARNING, this);
}
num_events = 0; // clear the queue of events for bochs to handle
sim_thread = new SimThread (this);
sim_thread->Create ();
sim_thread->Run ();
wxLogDebug ("Simulator thread has started.");
wxLogDebug(wxT("Simulator thread has started."));
// set up callback for events from simulator thread
SIM->set_notify_callback (&SimThread::SiminterfaceCallback, sim_thread);
simStatusChanged (Start);
@ -1017,14 +1017,14 @@ void MyFrame::OnKillSim(wxCommandEvent& WXUNUSED(event))
// DON'T use a critical section here. Delete implicitly calls
// OnSimThreadExit, which also tries to lock sim_thread_lock.
// If we grab the lock at this level, deadlock results.
wxLogDebug ("OnKillSim()");
wxLogDebug(wxT("OnKillSim()"));
#if BX_DEBUGGER
// the sim_thread may be waiting for a debugger command. If so, send
// it a "quit"
DebugCommand ("quit");
DebugCommand("quit");
#endif
if (sim_thread) {
sim_thread->Delete ();
sim_thread->Delete();
// Next time the simulator reaches bx_real_sim_c::periodic() it
// will quit. This is better than killing the thread because it
// gives it a chance to clean up after itself.
@ -1040,7 +1040,7 @@ MyFrame::OnSimThreadExit () {
int
MyFrame::HandleAskParamString (bx_param_string_c *param)
{
wxLogDebug ("HandleAskParamString start");
wxLogDebug(wxT("HandleAskParamString start"));
bx_param_num_c *opt = param->get_options ();
wxASSERT (opt != NULL);
int n_opt = opt->get();
@ -1054,17 +1054,17 @@ MyFrame::HandleAskParamString (bx_param_string_c *param)
// use file open dialog
long style =
(n_opt & param->SAVE_FILE_DIALOG) ? wxSAVE|wxOVERWRITE_PROMPT : wxOPEN;
wxLogDebug ("HandleAskParamString: create dialog");
wxFileDialog *fdialog = new wxFileDialog (this, msg, "", wxString(param->getptr ()), "*.*", style);
wxLogDebug ("HandleAskParamString: before showmodal");
wxLogDebug(wxT("HandleAskParamString: create dialog"));
wxFileDialog *fdialog = new wxFileDialog (this, msg, wxT(""), wxString(param->getptr ()), wxT("*.*"), style);
wxLogDebug(wxT("HandleAskParamString: before showmodal"));
if (fdialog->ShowModal() == wxID_OK)
newval = (char *)fdialog->GetPath().c_str ();
wxLogDebug ("HandleAskParamString: after showmodal");
wxLogDebug(wxT("HandleAskParamString: after showmodal"));
dialog = fdialog; // so I can delete it
} else {
// use simple string dialog
long style = wxOK|wxCANCEL;
wxTextEntryDialog *tdialog = new wxTextEntryDialog (this, msg, "Enter new value", wxString(param->getptr ()), style);
wxTextEntryDialog *tdialog = new wxTextEntryDialog (this, msg, wxT("Enter new value"), wxString(param->getptr()), style);
if (tdialog->ShowModal() == wxID_OK)
newval = (char *)tdialog->GetValue().c_str ();
dialog = tdialog; // so I can delete it
@ -1074,8 +1074,8 @@ MyFrame::HandleAskParamString (bx_param_string_c *param)
// it!
if (newval && strlen(newval)>0) {
// change floppy path to this value.
wxLogDebug ("Setting param %s to '%s'", param->get_name (), newval);
param->set (newval);
wxLogDebug(wxT("Setting param %s to '%s'"), param->get_name(), newval);
param->set(newval);
delete dialog;
return 1;
}
@ -1111,7 +1111,7 @@ MyFrame::HandleAskParam (BxEvent *event)
wxString msg;
msg.Printf ("ask param for parameter type %d is not implemented in wxWidgets",
param->get_type ());
wxMessageBox( msg, "not implemented", wxOK | wxICON_ERROR, this );
wxMessageBox(msg, wxT("not implemented"), wxOK | wxICON_ERROR, this );
return -1;
}
}
@ -1124,22 +1124,22 @@ MyFrame::HandleAskParam (BxEvent *event)
void
MyFrame::OnSim2CIEvent (wxCommandEvent& event)
{
IFDBG_EVENT (wxLogDebug ("received a bochs event in the GUI thread"));
BxEvent *be = (BxEvent *) event.GetEventObject ();
IFDBG_EVENT (wxLogDebug ("event type = %d", (int) be->type));
IFDBG_EVENT(wxLogDebug(wxT("received a bochs event in the GUI thread")));
BxEvent *be = (BxEvent *) event.GetEventObject();
IFDBG_EVENT(wxLogDebug(wxT("event type = %d"), (int)be->type));
// all cases should return. sync event handlers MUST send back a
// response. async event handlers MUST delete the event.
switch (be->type) {
case BX_ASYNC_EVT_REFRESH:
RefreshDialogs ();
RefreshDialogs();
break;
case BX_SYNC_EVT_ASK_PARAM:
wxLogDebug ("before HandleAskParam");
wxLogDebug(wxT("before HandleAskParam"));
be->retcode = HandleAskParam (be);
wxLogDebug ("after HandleAskParam");
wxLogDebug(wxT("after HandleAskParam"));
// return a copy of the event back to the sender.
sim_thread->SendSyncResponse(be);
wxLogDebug ("after SendSyncResponse");
wxLogDebug(wxT("after SendSyncResponse"));
break;
#if BX_DEBUGGER
case BX_ASYNC_EVT_DBG_MSG:
@ -1153,7 +1153,7 @@ MyFrame::OnSim2CIEvent (wxCommandEvent& event)
OnLogMsg (be);
break;
case BX_SYNC_EVT_GET_DBG_COMMAND:
wxLogDebug ("BX_SYNC_EVT_GET_DBG_COMMAND received");
wxLogDebug(wxT("BX_SYNC_EVT_GET_DBG_COMMAND received"));
if (debugCommand == NULL) {
// no debugger command is ready to send, so don't send a response yet.
// When a command is issued, MyFrame::DebugCommand will fill in the
@ -1167,7 +1167,7 @@ MyFrame::OnSim2CIEvent (wxCommandEvent& event)
}
} else {
// a debugger command is waiting for us!
wxLogDebug ("sending debugger command '%s' that was waiting", debugCommand);
wxLogDebug(wxT("sending debugger command '%s' that was waiting"), debugCommand);
be->u.debugcmd.command = debugCommand;
debugCommand = NULL; // ready for the next one
debugCommandEvent = NULL;
@ -1176,7 +1176,7 @@ MyFrame::OnSim2CIEvent (wxCommandEvent& event)
}
break;
default:
wxLogDebug ("OnSim2CIEvent: event type %d ignored", (int)be->type);
wxLogDebug(wxT("OnSim2CIEvent: event type %d ignored"), (int)be->type);
if (!BX_EVT_IS_ASYNC(be->type)) {
// if it's a synchronous event, and we fail to send back a response,
// the sim thread will wait forever. So send something!
@ -1189,7 +1189,7 @@ MyFrame::OnSim2CIEvent (wxCommandEvent& event)
}
void MyFrame::OnLogMsg (BxEvent *be) {
wxLogDebug ("log msg: level=%d, prefix='%s', msg='%s'",
wxLogDebug(wxT("log msg: level=%d, prefix='%s', msg='%s'"),
be->u.logmsg.level,
be->u.logmsg.prefix,
be->u.logmsg.msg);
@ -1212,7 +1212,7 @@ void MyFrame::OnLogMsg (BxEvent *be) {
if (dlg.GetDontAsk ()) n = BX_LOG_ASK_CHOICE_CONTINUE_ALWAYS;
}
be->retcode = n;
wxLogDebug ("you chose %d", n);
wxLogDebug(wxT("you chose %d"), n);
// This can be called from two different contexts:
// 1) before sim_thread starts, the default application callback can
// call OnLogMsg to display messages.
@ -1235,26 +1235,26 @@ void MyFrame::editFloppyConfig(int drive)
dlg.SetDriveName(wxString (drive==0? BX_FLOPPY0_NAME : BX_FLOPPY1_NAME));
dlg.SetCapacityChoices(n_floppy_type_names, floppy_type_names);
bx_list_c *list = (bx_list_c*) SIM->get_param((drive==0)? BXPN_FLOPPYA : BXPN_FLOPPYB);
if (!list) { wxLogError ("floppy object param is null"); return; }
if (!list) { wxLogError(wxT("floppy object param is null")); return; }
bx_param_filename_c *fname = (bx_param_filename_c*) list->get_by_name("path");
bx_param_enum_c *disktype = (bx_param_enum_c *) list->get_by_name("type");
bx_param_enum_c *status = (bx_param_enum_c *) list->get_by_name("status");
if (fname->get_type() != BXT_PARAM_STRING
|| disktype->get_type() != BXT_PARAM_ENUM
|| status->get_type() != BXT_PARAM_ENUM) {
wxLogError ("floppy params have wrong type");
wxLogError(wxT("floppy params have wrong type"));
return;
}
if (sim_thread == NULL) {
dlg.AddRadio("Not Present", "");
dlg.AddRadio(wxT("Not Present"), wxT(""));
}
dlg.AddRadio("Ejected", "none");
dlg.AddRadio(wxT("Ejected"), wxT("none"));
#if defined(__linux__)
dlg.AddRadio("Physical floppy drive /dev/fd0", "/dev/fd0");
dlg.AddRadio("Physical floppy drive /dev/fd1", "/dev/fd1");
dlg.AddRadio(wxT("Physical floppy drive /dev/fd0"), wxT("/dev/fd0"));
dlg.AddRadio(wxT("Physical floppy drive /dev/fd1"), wxT("/dev/fd1"));
#elif defined(WIN32)
dlg.AddRadio("Physical floppy drive A:", "A:");
dlg.AddRadio("Physical floppy drive B:", "B:");
dlg.AddRadio(wxT("Physical floppy drive A:"), wxT("A:"));
dlg.AddRadio(wxT("Physical floppy drive B:"), wxT("B:"));
#else
// add your favorite operating system here
#endif
@ -1269,13 +1269,13 @@ void MyFrame::editFloppyConfig(int drive)
// otherwise the SetFilename() should have done the right thing.
}
int n = dlg.ShowModal();
wxLogMessage ("floppy config returned %d", n);
wxLogMessage(wxT("floppy config returned %d"), n);
if (n==wxID_OK) {
char filename[1024];
wxString fn(dlg.GetFilename());
strncpy(filename, fn.c_str(), sizeof(filename));
wxLogMessage("filename is '%s'", filename);
wxLogMessage("capacity = %d (%s)", dlg.GetCapacity(), floppy_type_names[dlg.GetCapacity ()]);
wxLogMessage(wxT("filename is '%s'"), filename);
wxLogMessage(wxT("capacity = %d (%s)"), dlg.GetCapacity(), floppy_type_names[dlg.GetCapacity()]);
fname->set(filename);
disktype->set(disktype->get_min() + dlg.GetCapacity());
if (sim_thread == NULL) {
@ -1290,19 +1290,19 @@ void MyFrame::editFloppyConfig(int drive)
}
}
void MyFrame::editFirstCdrom ()
void MyFrame::editFirstCdrom()
{
bx_param_c *firstcd = SIM->get_first_cdrom ();
bx_param_c *firstcd = SIM->get_first_cdrom();
if (!firstcd) {
wxMessageBox ("No CDROM drive is enabled. Use Edit:ATA to set one up.",
"No CDROM", wxOK | wxICON_ERROR, this );
wxMessageBox(wxT("No CDROM drive is enabled. Use Edit:ATA to set one up."),
wxT("No CDROM"), wxOK | wxICON_ERROR, this );
return;
}
ParamDialog dlg (this, -1);
dlg.SetTitle ("Configure CDROM");
dlg.AddParam (firstcd);
dlg.SetRuntimeFlag (sim_thread != NULL);
dlg.ShowModal ();
ParamDialog dlg(this, -1);
dlg.SetTitle(wxT("Configure CDROM"));
dlg.AddParam(firstcd);
dlg.SetRuntimeFlag(sim_thread != NULL);
dlg.ShowModal();
}
void MyFrame::OnEditATA(wxCommandEvent& event)
@ -1321,7 +1321,7 @@ void MyFrame::OnEditATA(wxCommandEvent& event)
void MyFrame::OnToolbarClick(wxCommandEvent& event)
{
wxLogDebug ("clicked toolbar thingy");
wxLogDebug(wxT("clicked toolbar thingy"));
bx_toolbar_buttons which = BX_TOOLBAR_UNDEFINED;
int id = event.GetId ();
switch (id) {
@ -1346,7 +1346,7 @@ void MyFrame::OnToolbarClick(wxCommandEvent& event)
case ID_Toolbar_Mouse_en: which = BX_TOOLBAR_MOUSE_EN; break;
case ID_Toolbar_User: which = BX_TOOLBAR_USER; break;
default:
wxLogError ("unknown toolbar id %d", id);
wxLogError(wxT("unknown toolbar id %d"), id);
}
if (num_events < MAX_EVENTS) {
event_queue[num_events].type = BX_ASYNC_EVT_TOOLBAR;
@ -1387,27 +1387,27 @@ SimThread::Entry (void)
// the -1 and calls quit_sim, which longjumps to quit_context, which is
// right here in SimThread::Entry.
// - Entry() exits and the thread stops. Whew.
wxLogDebug ("in SimThread, starting at bx_continue_after_config_interface");
wxLogDebug(wxT("in SimThread, starting at bx_continue_after_config_interface"));
static jmp_buf context; // this must not go out of scope. maybe static not needed
if (setjmp (context) == 0) {
SIM->set_quit_context (&context);
SIM->begin_simulation (bx_startup_flags.argc, bx_startup_flags.argv);
wxLogDebug ("in SimThread, SIM->begin_simulation() exited normally");
wxLogDebug(wxT("in SimThread, SIM->begin_simulation() exited normally"));
} else {
wxLogDebug ("in SimThread, SIM->begin_simulation() exited by longjmp");
wxLogDebug(wxT("in SimThread, SIM->begin_simulation() exited by longjmp"));
}
SIM->set_quit_context (NULL);
// it is possible that the whole interface has already been shut down.
// If so, we must end immediately.
// we're in the sim thread, so we must get a gui mutex before calling
// wxwidgets methods.
wxLogDebug ("SimThread::Entry: get gui mutex");
wxLogDebug(wxT("SimThread::Entry: get gui mutex"));
wxMutexGuiEnter();
if (!wxBochsClosing) {
wxLogDebug ("SimThread::Entry: sim thread ending. call simStatusChanged");
wxLogDebug(wxT("SimThread::Entry: sim thread ending. call simStatusChanged"));
theFrame->simStatusChanged (theFrame->Stop, true);
} else {
wxLogMessage ("SimThread::Entry: the gui is waiting for sim to finish. Now that it has finished, I will close the frame.");
wxLogMessage(wxT("SimThread::Entry: the gui is waiting for sim to finish. Now that it has finished, I will close the frame."));
theFrame->Close (TRUE);
}
wxMutexGuiLeave();
@ -1479,12 +1479,12 @@ SimThread::SiminterfaceCallback2 (BxEvent *event)
wxCommandEvent wxevent (wxEVT_COMMAND_MENU_SELECTED, ID_Sim2CI_Event);
wxevent.SetEventObject ((wxEvent *)event);
if (isSimThread ()) {
IFDBG_EVENT (wxLogDebug ("Sending an event to the window"));
wxPostEvent (frame, wxevent);
IFDBG_EVENT(wxLogDebug(wxT("Sending an event to the window")));
wxPostEvent(frame, wxevent);
// if it is an asynchronous event, return immediately. The event will be
// freed by the recipient in the GUI thread.
if (async) return NULL;
wxLogDebug ("SiminterfaceCallback2: synchronous event; waiting for response");
wxLogDebug(wxT("SiminterfaceCallback2: synchronous event; waiting for response"));
// now wait forever for the GUI to post a response.
BxEvent *response = NULL;
while (response == NULL) {
@ -1495,7 +1495,7 @@ SimThread::SiminterfaceCallback2 (BxEvent *event)
}
// don't get stuck here if the gui is trying to close.
if (wxBochsClosing) {
wxLogDebug ("breaking out of sync event wait because gui is closing");
wxLogDebug(wxT("breaking out of sync event wait because gui is closing"));
event->retcode = -1;
return event;
}
@ -1503,7 +1503,7 @@ SimThread::SiminterfaceCallback2 (BxEvent *event)
wxASSERT (response != NULL);
return response;
} else {
wxLogDebug ("sim2ci event sent from the GUI thread. calling handler directly");
wxLogDebug(wxT("sim2ci event sent from the GUI thread. calling handler directly"));
theFrame->OnSim2CIEvent (wxevent);
return event;
}
@ -1514,23 +1514,23 @@ SimThread::ClearSyncResponse ()
{
wxCriticalSectionLocker lock(sim2gui_mailbox_lock);
if (sim2gui_mailbox != NULL) {
wxLogDebug ("WARNING: ClearSyncResponse is throwing away an event that was previously in the mailbox");
wxLogDebug(wxT("WARNING: ClearSyncResponse is throwing away an event that was previously in the mailbox"));
}
sim2gui_mailbox = NULL;
}
void
SimThread::SendSyncResponse (BxEvent *event)
SimThread::SendSyncResponse(BxEvent *event)
{
wxCriticalSectionLocker lock(sim2gui_mailbox_lock);
if (sim2gui_mailbox != NULL) {
wxLogDebug ("WARNING: SendSyncResponse is throwing away an event that was previously in the mailbox");
wxLogDebug(wxT("WARNING: SendSyncResponse is throwing away an event that was previously in the mailbox"));
}
sim2gui_mailbox = event;
}
BxEvent *
SimThread::GetSyncResponse ()
SimThread::GetSyncResponse()
{
wxCriticalSectionLocker lock(sim2gui_mailbox_lock);
BxEvent *event = sim2gui_mailbox;
@ -1542,10 +1542,10 @@ SimThread::GetSyncResponse ()
// utility
///////////////////////////////////////////////////////////////////
void
safeWxStrcpy (char *dest, wxString src, int destlen)
safeWxStrcpy(char *dest, wxString src, int destlen)
{
wxString tmp (src);
strncpy (dest, tmp.c_str (), destlen);
wxString tmp(src);
strncpy(dest, tmp.c_str(), destlen);
dest[destlen-1] = 0;
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////
// $Id: wxmain.h,v 1.52 2006-03-01 17:14:36 vruppert Exp $
// $Id: wxmain.h,v 1.53 2006-03-18 16:30:52 vruppert Exp $
/////////////////////////////////////////////////////////////////
// This file defines variables and classes that the wxWidgets .cc files
// share. It should be included only by wx.cc and wxmain.cc.
@ -135,7 +135,7 @@ class MyPanel: public wxPanel
bx_bool fillBxKeyEvent_MSW (wxKeyEvent& event, BxKeyEvent& bxev, bx_bool release);
bx_bool fillBxKeyEvent_GTK (wxKeyEvent& event, BxKeyEvent& bxev, bx_bool release);
public:
MyPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = "panel");
MyPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxT("panel"));
~MyPanel();
void OnKeyDown(wxKeyEvent& event);
void OnKeyUp(wxKeyEvent& event);