Fix linux compilation.

This commit is contained in:
James Grogan 2023-01-23 10:08:29 +00:00
parent ec57e3b534
commit 990cde402b
28 changed files with 245 additions and 161 deletions

View file

@ -23,6 +23,11 @@ ImageEditorView::ImageEditorView()
addWidget(std::move(hSpacer)); addWidget(std::move(hSpacer));
} }
ImageEditorView::~ImageEditorView()
{
}
std::unique_ptr<ImageEditorView> ImageEditorView::Create() std::unique_ptr<ImageEditorView> ImageEditorView::Create()
{ {
return std::make_unique<ImageEditorView>(); return std::make_unique<ImageEditorView>();

View file

@ -8,6 +8,8 @@ public:
ImageEditorView(); ImageEditorView();
virtual ~ImageEditorView();
static std::unique_ptr<ImageEditorView> Create(); static std::unique_ptr<ImageEditorView> Create();
}; };

View file

@ -11,6 +11,11 @@ ImageViewWidget::ImageViewWidget()
mName = "ImageViewWidget"; mName = "ImageViewWidget";
} }
ImageViewWidget::~ImageViewWidget()
{
}
void ImageViewWidget::doPaint(const PaintEvent* event) void ImageViewWidget::doPaint(const PaintEvent* event)
{ {
if (!mVisible) if (!mVisible)

View file

@ -9,6 +9,8 @@ class ImageViewWidget : public Widget
public: public:
ImageViewWidget(); ImageViewWidget();
virtual ~ImageViewWidget();
private: private:
void doPaint(const PaintEvent* event) override; void doPaint(const PaintEvent* event) override;
unsigned mNumX{5}; unsigned mNumX{5};

View file

@ -10,6 +10,11 @@ ElectronicCircuitNode::ElectronicCircuitNode(const Transform& transform)
} }
ElectronicCircuitNode::~ElectronicCircuitNode()
{
}
void ElectronicCircuitNode::setContent(ElectronicCircuit* content) void ElectronicCircuitNode::setContent(ElectronicCircuit* content)
{ {
mContent = content; mContent = content;

View file

@ -13,6 +13,8 @@ class ElectronicCircuitNode : public AbstractVisualNode
public: public:
ElectronicCircuitNode(const Transform& transform); ElectronicCircuitNode(const Transform& transform);
virtual ~ElectronicCircuitNode();
void setContent(ElectronicCircuit* content); void setContent(ElectronicCircuit* content);
void update(SceneInfo* sceneInfo); void update(SceneInfo* sceneInfo);

View file

@ -13,6 +13,11 @@ LogicGateNode::LogicGateNode(const Transform& transform)
} }
LogicGateNode::~LogicGateNode()
{
}
void LogicGateNode::setContent(LogicGate* content) void LogicGateNode::setContent(LogicGate* content)
{ {
mContent = content; mContent = content;

View file

@ -2,15 +2,18 @@
#include "AbstractVisualNode.h" #include "AbstractVisualNode.h"
#include "CircleNode.h"
class LogicGate; class LogicGate;
class PathNode; class PathNode;
class CircleNode;
class LogicGateNode : public AbstractVisualNode class LogicGateNode : public AbstractVisualNode
{ {
public: public:
LogicGateNode(const Transform& transform); LogicGateNode(const Transform& transform);
virtual ~LogicGateNode();
void setContent(LogicGate* content); void setContent(LogicGate* content);
void update(SceneInfo* sceneInfo); void update(SceneInfo* sceneInfo);

View file

@ -5,6 +5,11 @@ void AbstractMesh::addConstantNodeVectorAttribute(const std::string& tag, const
} }
AbstractMesh::~AbstractMesh()
{
}
std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string& tag) std::vector<std::vector<double> > AbstractMesh::getNodeVectorAttributes(const std::string& tag)
{ {
std::vector<std::vector<double> > attribs(mNodes.size()); std::vector<std::vector<double> > attribs(mNodes.size());

View file

@ -20,7 +20,7 @@ public:
QUAD QUAD
}; };
virtual ~AbstractMesh() = default; virtual ~AbstractMesh();
void addVectorAttribute(const std::string& tag, const std::vector<double>& values); void addVectorAttribute(const std::string& tag, const std::vector<double>& values);

View file

@ -14,6 +14,11 @@ CircleNode::CircleNode(const Transform& transform, double radius)
mMinorRadius = mRadius; mMinorRadius = mRadius;
} }
CircleNode::~CircleNode()
{
}
CircleNode::Type CircleNode::getType() CircleNode::Type CircleNode::getType()
{ {
return Type::Circle; return Type::Circle;

View file

@ -10,6 +10,8 @@ class CircleNode : public GeometryNode
public: public:
CircleNode(const Transform& transform, double radius); CircleNode(const Transform& transform, double radius);
virtual ~CircleNode();
Type getType() override; Type getType() override;
double getRadius() const; double getRadius() const;

View file

@ -9,6 +9,11 @@ GridNode::GridNode(const Transform& transform)
} }
GridNode::~GridNode()
{
}
void GridNode::setNumX(std::size_t numX) void GridNode::setNumX(std::size_t numX)
{ {
if (mNumberX != numX) if (mNumberX != numX)

View file

@ -10,6 +10,8 @@ class GridNode : public MaterialNode
public: public:
GridNode(const Transform& transform); GridNode(const Transform& transform);
virtual ~GridNode();
void setNumX(std::size_t numX); void setNumX(std::size_t numX);
void setNumY(std::size_t numY); void setNumY(std::size_t numY);

View file

@ -8,6 +8,11 @@ MaterialNode::MaterialNode(const Transform& transform)
} }
MaterialNode::~MaterialNode()
{
}
const Color& MaterialNode::getFillColor() const const Color& MaterialNode::getFillColor() const
{ {
return mFillColor; return mFillColor;

View file

@ -8,6 +8,7 @@ class MaterialNode : public AbstractVisualNode
{ {
public: public:
MaterialNode(const Transform& transform); MaterialNode(const Transform& transform);
virtual ~MaterialNode();
const Color& getFillColor() const; const Color& getFillColor() const;
const Color& getStrokeColor() const; const Color& getStrokeColor() const;

View file

@ -9,6 +9,28 @@ MeshNode::MeshNode(const Transform& transform)
} }
MeshNode::~MeshNode()
{
}
SceneItem* MeshNode::getSceneItem(std::size_t idx) const
{
return mModel.get();
}
std::size_t MeshNode::getNumSceneItems() const
{
if (mWorkingMesh)
{
return 1;
}
else
{
return 0;
}
}
void MeshNode::setWidth(double width) void MeshNode::setWidth(double width)
{ {
if (mWidth != width) if (mWidth != width)
@ -33,23 +55,6 @@ void MeshNode::setMesh(AbstractMesh* mesh)
mMeshIsDirty = true; mMeshIsDirty = true;
} }
SceneItem* MeshNode::getSceneItem(std::size_t idx) const
{
return mModel.get();
}
std::size_t MeshNode::getNumSceneItems() const
{
if (mWorkingMesh)
{
return 1;
}
else
{
return 0;
}
}
void MeshNode::update(SceneInfo* sceneInfo) void MeshNode::update(SceneInfo* sceneInfo)
{ {
if (!mModel || mMeshIsDirty) if (!mModel || mMeshIsDirty)

View file

@ -9,6 +9,8 @@ class MeshNode : public MaterialNode
{ {
public: public:
MeshNode(const Transform& transform); MeshNode(const Transform& transform);
virtual ~MeshNode();
void setMesh(AbstractMesh* mesh); void setMesh(AbstractMesh* mesh);
SceneItem* getSceneItem(std::size_t idx) const override; SceneItem* getSceneItem(std::size_t idx) const override;

View file

@ -5,6 +5,11 @@ SceneItem::SceneItem()
} }
SceneItem::~SceneItem()
{
}
const Color& SceneItem::getFillColor() const const Color& SceneItem::getFillColor() const
{ {
return mFillColor; return mFillColor;
@ -20,6 +25,11 @@ const Transform& SceneItem::getTransform() const
return mTransform; return mTransform;
} }
const std::string& SceneItem::getName() const
{
return mName;
}
double SceneItem::getOutlineThickness() const double SceneItem::getOutlineThickness() const
{ {
return mOutlineThickness; return mOutlineThickness;
@ -78,3 +88,8 @@ void SceneItem::updateTransform(const Transform& transform)
mTransform = transform; mTransform = transform;
} }
} }
void SceneItem::setName(const std::string& name)
{
mName = name;
}

View file

@ -18,7 +18,7 @@ public:
SceneItem(); SceneItem();
virtual ~SceneItem() = default; virtual ~SceneItem();
const Color& getFillColor() const; const Color& getFillColor() const;
@ -30,6 +30,8 @@ public:
double getOutlineThickness() const; double getOutlineThickness() const;
const std::string& getName() const;
bool hasFillColor() const; bool hasFillColor() const;
bool hasOutlineColor() const; bool hasOutlineColor() const;
@ -44,18 +46,10 @@ public:
void setFillColor(const Color& color); void setFillColor(const Color& color);
void setName(const std::string& name);
void updateTransform(const Transform& transform); void updateTransform(const Transform& transform);
void setName(const std::string& name)
{
mName = name;
}
const std::string& getName() const
{
return mName;
}
protected: protected:
Transform mTransform; Transform mTransform;

View file

@ -10,6 +10,11 @@ SceneModel::SceneModel(std::unique_ptr<AbstractMesh> mesh)
} }
SceneModel::~SceneModel()
{
}
SceneModel::SceneModel(std::unique_ptr<AbstractGeometricItem> geometry) SceneModel::SceneModel(std::unique_ptr<AbstractGeometricItem> geometry)
: SceneItem(), : SceneItem(),
mGeometry(std::move(geometry)) mGeometry(std::move(geometry))

View file

@ -15,6 +15,8 @@ class SceneModel : public SceneItem
{ {
public: public:
SceneModel() = default; SceneModel() = default;
virtual ~SceneModel();
explicit SceneModel(std::unique_ptr<AbstractMesh> mesh); explicit SceneModel(std::unique_ptr<AbstractMesh> mesh);
explicit SceneModel(std::unique_ptr<AbstractGeometricItem> geometry); explicit SceneModel(std::unique_ptr<AbstractGeometricItem> geometry);

View file

@ -9,6 +9,11 @@ BoxGeometry::BoxGeometry()
} }
BoxGeometry::~BoxGeometry()
{
}
BoundedSize BoxGeometry::getSize() const BoundedSize BoxGeometry::getSize() const
{ {

View file

@ -51,7 +51,7 @@ class BoxGeometry
public: public:
BoxGeometry(); BoxGeometry();
virtual ~BoxGeometry() = default; virtual ~BoxGeometry();
bool contains(const DiscretePoint& loc) const; bool contains(const DiscretePoint& loc) const;

View file

@ -13,7 +13,7 @@ std::unique_ptr<XcbEventInterface> XcbEventInterface::Create()
return std::make_unique<XcbEventInterface>(); return std::make_unique<XcbEventInterface>();
} }
std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const std::unique_ptr<KeyboardEvent> XcbEventInterface::convertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const
{ {
auto ui_event = KeyboardEvent::Create(); auto ui_event = KeyboardEvent::Create();
ui_event->setAction(KeyboardEvent::Action::Pressed); ui_event->setAction(KeyboardEvent::Action::Pressed);
@ -29,7 +29,7 @@ std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyPress(xcb_key_press_
return ui_event; return ui_event;
} }
std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const std::unique_ptr<KeyboardEvent> XcbEventInterface::convertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const
{ {
auto ui_event = KeyboardEvent::Create(); auto ui_event = KeyboardEvent::Create();
ui_event->setAction(KeyboardEvent::Action::Released); ui_event->setAction(KeyboardEvent::Action::Released);
@ -45,31 +45,31 @@ std::unique_ptr<KeyboardEvent> XcbEventInterface::ConvertKeyRelease(xcb_key_pres
return ui_event; return ui_event;
} }
std::unique_ptr<MouseEvent> XcbEventInterface::ConvertButtonPress(xcb_button_press_event_t* event) const std::unique_ptr<MouseEvent> XcbEventInterface::convertButtonPress(xcb_button_press_event_t* event) const
{ {
auto ui_event = MouseEvent::Create(); auto ui_event = MouseEvent::Create();
auto x = static_cast<unsigned>(event->event_x); auto x = static_cast<unsigned>(event->event_x);
auto y = static_cast<unsigned>(event->event_y); auto y = static_cast<unsigned>(event->event_y);
ui_event->SetClientLocation(DiscretePoint(x, y)); ui_event->setClientLocation(DiscretePoint(x, y));
auto screen_x = static_cast<unsigned>(event->root_x); auto screen_x = static_cast<unsigned>(event->root_x);
auto screen_y = static_cast<unsigned>(event->root_y); auto screen_y = static_cast<unsigned>(event->root_y);
ui_event->SetScreenLocation(DiscretePoint(x, y)); ui_event->setScreenLocation(DiscretePoint(x, y));
ui_event->SetAction(MouseEvent::Action::Pressed); ui_event->setAction(MouseEvent::Action::Pressed);
return ui_event; return ui_event;
} }
std::unique_ptr<MouseEvent> XcbEventInterface::ConvertButtonRelease(xcb_button_press_event_t* event) const std::unique_ptr<MouseEvent> XcbEventInterface::convertButtonRelease(xcb_button_press_event_t* event) const
{ {
auto ui_event = MouseEvent::Create(); auto ui_event = MouseEvent::Create();
auto x = static_cast<unsigned>(event->event_x); auto x = static_cast<unsigned>(event->event_x);
auto y = static_cast<unsigned>(event->event_y); auto y = static_cast<unsigned>(event->event_y);
ui_event->SetClientLocation(DiscretePoint(x, y)); ui_event->setClientLocation(DiscretePoint(x, y));
auto screen_x = static_cast<unsigned>(event->root_x); auto screen_x = static_cast<unsigned>(event->root_x);
auto screen_y = static_cast<unsigned>(event->root_y); auto screen_y = static_cast<unsigned>(event->root_y);
ui_event->SetScreenLocation(DiscretePoint(x, y)); ui_event->setScreenLocation(DiscretePoint(x, y));
ui_event->SetAction(MouseEvent::Action::Released); ui_event->setAction(MouseEvent::Action::Released);
return ui_event; return ui_event;
} }

View file

@ -13,16 +13,15 @@ struct xcb_button_press_event_t;
class XcbEventInterface class XcbEventInterface
{ {
public: public:
static std::unique_ptr<XcbEventInterface> Create(); static std::unique_ptr<XcbEventInterface> Create();
std::unique_ptr<KeyboardEvent> ConvertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const; std::unique_ptr<KeyboardEvent> convertKeyPress(xcb_key_press_event_t* event, Keyboard* keyboard) const;
std::unique_ptr<KeyboardEvent> ConvertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const; std::unique_ptr<KeyboardEvent> convertKeyRelease(xcb_key_press_event_t* event, Keyboard* keyboard) const;
std::unique_ptr<MouseEvent> ConvertButtonPress(xcb_button_press_event_t* event) const; std::unique_ptr<MouseEvent> convertButtonPress(xcb_button_press_event_t* event) const;
std::unique_ptr<MouseEvent> ConvertButtonRelease(xcb_button_press_event_t* event) const; std::unique_ptr<MouseEvent> convertButtonRelease(xcb_button_press_event_t* event) const;
}; };
using XcbEventInterfacePtr = std::unique_ptr<XcbEventInterface>; using XcbEventInterfacePtr = std::unique_ptr<XcbEventInterface>;

View file

@ -182,7 +182,7 @@ void XcbInterface::addWindow(mt::Window* window)
void XcbInterface::onPaint() void XcbInterface::onPaint()
{ {
mDesktopManager->onUiEvent(PaintEvent::Create()); mDesktopManager->onUiEvent(PaintEvent::Create(mDesktopManager->getThemeManager(), mDesktopManager->getFontsManager()));
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow(); auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
auto defaultScreen = mDesktopManager->getDefaultScreen(); auto defaultScreen = mDesktopManager->getDefaultScreen();
@ -215,25 +215,25 @@ void XcbInterface::loop()
} }
case XCB_KEY_PRESS: { case XCB_KEY_PRESS: {
auto kp = reinterpret_cast<xcb_key_press_event_t*>(event); auto kp = reinterpret_cast<xcb_key_press_event_t*>(event);
auto ui_event = mEventInterface->ConvertKeyPress(kp, mDesktopManager->getKeyboard()); auto ui_event = mEventInterface->convertKeyPress(kp, mDesktopManager->getKeyboard());
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }
case XCB_KEY_RELEASE: { case XCB_KEY_RELEASE: {
auto kr = reinterpret_cast<xcb_key_release_event_t*>(event); auto kr = reinterpret_cast<xcb_key_release_event_t*>(event);
auto ui_event = mEventInterface->ConvertKeyRelease(kr, mDesktopManager->getKeyboard()); auto ui_event = mEventInterface->convertKeyRelease(kr, mDesktopManager->getKeyboard());
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }
case XCB_BUTTON_PRESS: { case XCB_BUTTON_PRESS: {
auto press = reinterpret_cast<xcb_button_press_event_t*>(event); auto press = reinterpret_cast<xcb_button_press_event_t*>(event);
auto ui_event = mEventInterface->ConvertButtonPress(press); auto ui_event = mEventInterface->convertButtonPress(press);
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }
case XCB_BUTTON_RELEASE: { case XCB_BUTTON_RELEASE: {
auto release = reinterpret_cast<xcb_button_release_event_t*>(event); auto release = reinterpret_cast<xcb_button_release_event_t*>(event);
auto ui_event = mEventInterface->ConvertButtonRelease(release); auto ui_event = mEventInterface->convertButtonRelease(release);
mDesktopManager->onUiEvent(std::move(ui_event)); mDesktopManager->onUiEvent(std::move(ui_event));
break; break;
} }

View file

@ -38,20 +38,23 @@ public:
void showWindow(mt::Window* window) override; void showWindow(mt::Window* window) override;
private: private:
void initialize() override;
void onPaint();
void onExposeEvent(xcb_expose_event_t* event);
void initializeHardwareRendering() override;
void createGraphicsContext(); void createGraphicsContext();
void connect(); void connect();
void updateScreen();
uint32_t getEventMask();
void initialize() override;
void initializeHardwareRendering() override;
void onPaint();
void onExposeEvent(xcb_expose_event_t* event);
void mapWindow(mt::Window* window); void mapWindow(mt::Window* window);
void shutDown() override; void shutDown() override;
uint32_t getEventMask();
void updateScreen();
private: private:
xcb_connection_t* mConnection{nullptr}; xcb_connection_t* mConnection{nullptr};
_XDisplay* mX11Display{nullptr}; _XDisplay* mX11Display{nullptr};