Skip to content

Commit

Permalink
MyFrameMain: remove tool re-insert workaround
Browse files Browse the repository at this point in the history
This was from 2011 and broke the UI on MacOS, buttons would not
re-appear. Not needed on nowadays GTK3 and MacOS.
  • Loading branch information
bk138 committed Oct 13, 2024
1 parent d85799c commit 53d257d
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions src/gui/MyFrameMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,8 @@ void MyFrameMain::onVNCConnReplayFinishedNotify(wxCommandEvent& event)
if(index < connections.size()) // found
{
frame_main_toolbar->SetToolNormalBitmap(ID_INPUT_REPLAY, bitmapBundleFromSVGResource("replay"));
frame_main_toolbar->FindById(ID_INPUT_REPLAY)->SetLabel(_("Replay Input"));
frame_main_menubar->SetLabel(ID_INPUT_REPLAY, _("Replay Input"));
// remove and insert are necessary, otherwise label won't be updated
size_t pos = frame_main_toolbar->GetToolPos(ID_INPUT_REPLAY);
wxToolBarToolBase *button = frame_main_toolbar->RemoveTool(ID_INPUT_REPLAY);
button->SetLabel(_("Replay Input"));
frame_main_toolbar->InsertTool(pos, button);

// re-enable record buttons
GetToolBar()->EnableTool(ID_INPUT_RECORD, true);
Expand Down Expand Up @@ -1372,11 +1368,7 @@ void MyFrameMain::machine_input_record(wxCommandEvent &event)
if(c->isRecording())
{
frame_main_toolbar->SetToolNormalBitmap(ID_INPUT_RECORD, bitmapBundleFromSVGResource("record"));
// remove and insert are necessary, otherwise label won't be updated
size_t pos = frame_main_toolbar->GetToolPos(ID_INPUT_RECORD);
wxToolBarToolBase *button = frame_main_toolbar->RemoveTool(ID_INPUT_RECORD);
button->SetLabel(_("Record Input"));
frame_main_toolbar->InsertTool(pos, button);
frame_main_toolbar->FindById(ID_INPUT_RECORD)->SetLabel(_("Record Input"));

wxArrayString recorded_input;

Expand Down Expand Up @@ -1434,12 +1426,8 @@ void MyFrameMain::machine_input_record(wxCommandEvent &event)
if( c->recordUserInputStart())
{
frame_main_toolbar->SetToolNormalBitmap(ID_INPUT_RECORD, bitmapBundleFromSVGResource("stop"));
frame_main_toolbar->FindById(ID_INPUT_RECORD)->SetLabel(_("Stop"));
frame_main_menubar->SetLabel(ID_INPUT_RECORD, _("Stop Recording"));
// remove and insert are necessary, otherwise label won't be updated
size_t pos = frame_main_toolbar->GetToolPos(ID_INPUT_RECORD);
wxToolBarToolBase *button = frame_main_toolbar->RemoveTool(ID_INPUT_RECORD);
button->SetLabel(_("Stop"));
frame_main_toolbar->InsertTool(pos, button);

wxLogStatus(_("Recording user input..."));

Expand Down Expand Up @@ -1471,12 +1459,8 @@ void MyFrameMain::machine_input_replay(wxCommandEvent &event)
c->replayUserInputStop();

frame_main_toolbar->SetToolNormalBitmap(ID_INPUT_REPLAY, bitmapBundleFromSVGResource("replay"));
frame_main_toolbar->FindById(ID_INPUT_REPLAY)->SetLabel(_("Replay Input"));
frame_main_menubar->SetLabel(ID_INPUT_REPLAY,_("Replay Input"));
// remove and insert are necessary, otherwise label won't be updated
size_t pos = frame_main_toolbar->GetToolPos(ID_INPUT_REPLAY);
wxToolBarToolBase *button = frame_main_toolbar->RemoveTool(ID_INPUT_REPLAY);
button->SetLabel(_("Replay Input"));
frame_main_toolbar->InsertTool(pos, button);

wxLogStatus(_("Stopped replaying user input!"));

Expand Down Expand Up @@ -1522,11 +1506,7 @@ void MyFrameMain::machine_input_replay(wxCommandEvent &event)
{
frame_main_toolbar->SetToolNormalBitmap(ID_INPUT_REPLAY, bitmapBundleFromSVGResource("stop"));
frame_main_menubar->SetLabel(ID_INPUT_REPLAY, _("Stop Replaying"));
// remove and insert are necessary, otherwise label won't be updated
size_t pos = frame_main_toolbar->GetToolPos(ID_INPUT_REPLAY);
wxToolBarToolBase *button = frame_main_toolbar->RemoveTool(ID_INPUT_REPLAY);
button->SetLabel(_("Stop"));
frame_main_toolbar->InsertTool(pos, button);
frame_main_toolbar->FindById(ID_INPUT_REPLAY)->SetLabel(_("Stop"));

if(shift_was_down)
wxLogStatus(_("Replaying user input in loop..."));
Expand Down

0 comments on commit 53d257d

Please sign in to comment.