mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Set useful titles to all the windows. Also fix a nasty spurious drag caused by creating a
window with the left mouse button held down.
This commit is contained in:
@@ -365,9 +365,10 @@ void FluxViewerControl::OnMouseMotion(wxMouseEvent& event)
|
|||||||
}
|
}
|
||||||
else if (event.ButtonUp(wxMOUSE_BTN_LEFT))
|
else if (event.ButtonUp(wxMOUSE_BTN_LEFT))
|
||||||
{
|
{
|
||||||
/* end drag, do nothing */
|
_dragStartX = -1;
|
||||||
|
_dragStartPosition = -1;
|
||||||
}
|
}
|
||||||
else if (event.Dragging() && event.LeftIsDown())
|
else if (event.Dragging() && event.LeftIsDown() && (_dragStartX != -1))
|
||||||
{
|
{
|
||||||
int dx = _dragStartX - event.GetX();
|
int dx = _dragStartX - event.GetX();
|
||||||
nanoseconds_t dt = dx * _nanosecondsPerPixel;
|
nanoseconds_t dt = dx * _nanosecondsPerPixel;
|
||||||
@@ -434,22 +435,24 @@ void FluxViewerControl::DisplayDecodedData(std::shared_ptr<const Sector> sector)
|
|||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
|
||||||
s << fmt::format("Decoded user data for c{}.h{}.s{}\n",
|
auto title = fmt::format("User data for c{}.h{}.s{}",
|
||||||
sector->logicalTrack, sector->logicalSide, sector->logicalSector);
|
sector->logicalTrack, sector->logicalSide, sector->logicalSector);
|
||||||
|
s << title << '\n';
|
||||||
dumpSectorMetadata(s, sector);
|
dumpSectorMetadata(s, sector);
|
||||||
s << '\n';
|
s << '\n';
|
||||||
|
|
||||||
hexdump(s, sector->data);
|
hexdump(s, sector->data);
|
||||||
|
|
||||||
(new HexViewerWindow(this, s.str()))->Show(true);
|
HexViewerWindow::Create(this, title, s.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxViewerControl::DisplayRawData(std::shared_ptr<const Sector> sector)
|
void FluxViewerControl::DisplayRawData(std::shared_ptr<const Sector> sector)
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
|
||||||
s << fmt::format("Raw undecoded data for c{}.h{}.s{}\n",
|
auto title = fmt::format("Raw data for c{}.h{}.s{}",
|
||||||
sector->logicalTrack, sector->logicalSide, sector->logicalSector);
|
sector->logicalTrack, sector->logicalSide, sector->logicalSector);
|
||||||
|
s << title << '\n';
|
||||||
dumpSectorMetadata(s, sector);
|
dumpSectorMetadata(s, sector);
|
||||||
s << fmt::format("Number of records: {}\n", sector->records.size());
|
s << fmt::format("Number of records: {}\n", sector->records.size());
|
||||||
|
|
||||||
@@ -459,18 +462,17 @@ void FluxViewerControl::DisplayRawData(std::shared_ptr<const Sector> sector)
|
|||||||
hexdump(s, record->rawData);
|
hexdump(s, record->rawData);
|
||||||
}
|
}
|
||||||
|
|
||||||
(new HexViewerWindow(this, s.str()))->Show(true);
|
HexViewerWindow::Create(this, title, s.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxViewerControl::DisplayRawData(const Location& location, std::shared_ptr<const Record> record)
|
void FluxViewerControl::DisplayRawData(const Location& location, std::shared_ptr<const Record> record)
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
|
||||||
s << fmt::format("Raw undecoded data for record c{}.h{} + {:.3f}ms\n",
|
auto title = fmt::format("Raw data for record c{}.h{} + {:.3f}ms",
|
||||||
location.physicalTrack, location.head, record->startTime / 1e6)
|
location.physicalTrack, location.head, record->startTime / 1e6);
|
||||||
<< '\n';
|
s << title << "\n\n";
|
||||||
|
|
||||||
hexdump(s, record->rawData);
|
hexdump(s, record->rawData);
|
||||||
|
|
||||||
(new HexViewerWindow(this, s.str()))->Show(true);
|
HexViewerWindow::Create(this, title, s.str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,15 +41,15 @@ private:
|
|||||||
private:
|
private:
|
||||||
wxScrollBar* _scrollbar;
|
wxScrollBar* _scrollbar;
|
||||||
std::shared_ptr<const TrackFlux> _flux;
|
std::shared_ptr<const TrackFlux> _flux;
|
||||||
nanoseconds_t _scrollPosition;
|
nanoseconds_t _scrollPosition = 0;
|
||||||
nanoseconds_t _totalDuration;
|
nanoseconds_t _totalDuration = 0;
|
||||||
double _nanosecondsPerPixel;
|
double _nanosecondsPerPixel = 0;
|
||||||
std::vector<float> _densityMap;
|
std::vector<float> _densityMap;
|
||||||
int _dragStartX;
|
int _dragStartX = -1;
|
||||||
nanoseconds_t _dragStartPosition;
|
nanoseconds_t _dragStartPosition = -1;
|
||||||
int _mouseX;
|
int _mouseX = -1;
|
||||||
int _mouseY;
|
int _mouseY = -1;
|
||||||
bool _rightClicked;
|
bool _rightClicked = false;
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "fluxviewerwindow.h"
|
#include "fluxviewerwindow.h"
|
||||||
#include "fluxviewercontrol.h"
|
#include "fluxviewercontrol.h"
|
||||||
|
#include "lib/flux.h"
|
||||||
|
#include "fmt/format.h"
|
||||||
|
|
||||||
FluxViewerWindow::FluxViewerWindow(wxWindow* parent, std::shared_ptr<const TrackFlux> flux):
|
FluxViewerWindow::FluxViewerWindow(wxWindow* parent, std::shared_ptr<const TrackFlux> flux):
|
||||||
FluxViewerWindowGen(parent),
|
FluxViewerWindowGen(parent),
|
||||||
@@ -10,6 +12,9 @@ FluxViewerWindow::FluxViewerWindow(wxWindow* parent, std::shared_ptr<const Track
|
|||||||
{
|
{
|
||||||
fluxviewer->SetScrollbar(scrollbar);
|
fluxviewer->SetScrollbar(scrollbar);
|
||||||
fluxviewer->SetFlux(flux);
|
fluxviewer->SetFlux(flux);
|
||||||
|
SetTitle(
|
||||||
|
fmt::format("Flux for c{} h{}",
|
||||||
|
flux->location.physicalTrack, flux->location.head));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FluxViewerWindow::OnExit(wxCommandEvent& event)
|
void FluxViewerWindow::OnExit(wxCommandEvent& event)
|
||||||
|
|||||||
@@ -4,14 +4,21 @@
|
|||||||
#include "hexviewerwindow.h"
|
#include "hexviewerwindow.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
||||||
HexViewerWindow::HexViewerWindow(wxWindow* parent, const std::string& text):
|
HexViewerWindow::HexViewerWindow(wxWindow* parent,
|
||||||
|
const std::string& title, const std::string& text):
|
||||||
HexViewerWindowGen(parent)
|
HexViewerWindowGen(parent)
|
||||||
{
|
{
|
||||||
auto size = hexEntry->GetTextExtent("M");
|
auto size = hexEntry->GetTextExtent("M");
|
||||||
SetSize(size.Scale(85, 25));
|
SetSize(size.Scale(85, 25));
|
||||||
|
SetTitle(title);
|
||||||
hexEntry->SetValue(text);
|
hexEntry->SetValue(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HexViewerWindow::Create(wxWindow* parent, const std::string& title, const std::string& text)
|
||||||
|
{
|
||||||
|
(new HexViewerWindow(parent, title, text))->Show(true);
|
||||||
|
}
|
||||||
|
|
||||||
void HexViewerWindow::OnExit(wxCommandEvent& event)
|
void HexViewerWindow::OnExit(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
Close(true);
|
Close(true);
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
class HexViewerWindow : public HexViewerWindowGen
|
class HexViewerWindow : public HexViewerWindowGen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HexViewerWindow(wxWindow* parent, const std::string& text);
|
HexViewerWindow(wxWindow* parent, const std::string& title, const std::string& text);
|
||||||
|
|
||||||
|
static void Create(wxWindow* parent, const std::string& title, const std::string& text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnExit(wxCommandEvent& event);
|
void OnExit(wxCommandEvent& event);
|
||||||
|
|||||||
Reference in New Issue
Block a user