Windows are properly stacked and destructed in the right order.

This commit is contained in:
David Given
2022-08-07 17:26:17 +02:00
parent 1d4dccf454
commit 03d2a3a685
7 changed files with 14 additions and 15 deletions

View File

@@ -441,7 +441,7 @@ void FluxViewerControl::DisplayDecodedData(std::shared_ptr<const Sector> sector)
hexdump(s, sector->data);
(new HexViewerWindow(s.str()))->Show(true);
(new HexViewerWindow(this, s.str()))->Show(true);
}
void FluxViewerControl::DisplayRawData(std::shared_ptr<const Sector> sector)
@@ -459,7 +459,7 @@ void FluxViewerControl::DisplayRawData(std::shared_ptr<const Sector> sector)
hexdump(s, record->rawData);
}
(new HexViewerWindow(s.str()))->Show(true);
(new HexViewerWindow(this, s.str()))->Show(true);
}
void FluxViewerControl::DisplayRawData(const Location& location, std::shared_ptr<const Record> record)
@@ -472,5 +472,5 @@ void FluxViewerControl::DisplayRawData(const Location& location, std::shared_ptr
hexdump(s, record->rawData);
(new HexViewerWindow(s.str()))->Show(true);
(new HexViewerWindow(this, s.str()))->Show(true);
}

View File

@@ -4,8 +4,8 @@
#include "fluxviewerwindow.h"
#include "fluxviewercontrol.h"
FluxViewerWindow::FluxViewerWindow(std::shared_ptr<const TrackFlux> flux):
FluxViewerWindowGen(nullptr),
FluxViewerWindow::FluxViewerWindow(wxWindow* parent, std::shared_ptr<const TrackFlux> flux):
FluxViewerWindowGen(parent),
_flux(flux)
{
fluxviewer->SetScrollbar(scrollbar);

View File

@@ -8,7 +8,7 @@ class TrackFlux;
class FluxViewerWindow : public FluxViewerWindowGen
{
public:
FluxViewerWindow(std::shared_ptr<const TrackFlux> flux);
FluxViewerWindow(wxWindow* parent, std::shared_ptr<const TrackFlux> flux);
private:
void OnExit(wxCommandEvent& event);

View File

@@ -4,8 +4,8 @@
#include "hexviewerwindow.h"
#include "fmt/format.h"
HexViewerWindow::HexViewerWindow(const std::string& text):
HexViewerWindowGen(nullptr)
HexViewerWindow::HexViewerWindow(wxWindow* parent, const std::string& text):
HexViewerWindowGen(parent)
{
auto size = hexEntry->GetTextExtent("M");
SetSize(size.Scale(85, 25));

View File

@@ -6,7 +6,7 @@
class HexViewerWindow : public HexViewerWindowGen
{
public:
HexViewerWindow(const std::string& text);
HexViewerWindow(wxWindow* parent, const std::string& text);
private:
void OnExit(wxCommandEvent& event);

View File

@@ -384,6 +384,6 @@ void MainWindow::UpdateDevices()
void MainWindow::OnTrackSelection(TrackSelectionEvent& event)
{
(new FluxViewerWindow(event.trackFlux))->Show(true);
(new FluxViewerWindow(this, event.trackFlux))->Show(true);
}

View File

@@ -183,8 +183,6 @@ void VisualisationControl::OnPaint(wxPaintEvent&)
void VisualisationControl::OnMotion(wxMouseEvent& event)
{
wxClientDC dc(this);
auto loc = event.GetLogicalPosition(dc);
auto size = GetSize();
int w = size.GetWidth();
int w2 = w / 2;
@@ -195,9 +193,9 @@ void VisualisationControl::OnMotion(wxMouseEvent& event)
int scaletop = h / 2 - scalesize / 2;
int scalebottom = scaletop + scalesize - 1;
int headno = loc.x > w2;
int headno = event.GetX() > w2;
int trackno = (loc.y - scaletop) / SECTORSIZE;
int trackno = (event.GetY() - scaletop) / SECTORSIZE;
if ((trackno < 0) || (trackno >= TRACKS))
trackno = -1;
if ((_selectedHead != headno) || (_selectedTrack != trackno))
@@ -210,7 +208,6 @@ void VisualisationControl::OnMotion(wxMouseEvent& event)
void VisualisationControl::OnLeftDown(wxMouseEvent& event)
{
event.Skip();
OnMotion(event);
if ((_selectedHead != -1) && (_selectedTrack != -1))
@@ -225,6 +222,8 @@ void VisualisationControl::OnLeftDown(wxMouseEvent& event)
ProcessWindowEvent(event);
}
}
else
event.Skip();
}
void VisualisationControl::OnLeaveWindow(wxMouseEvent&)