mirror of https://github.com/AxioDL/metaforce.git
Additional space-tree work
This commit is contained in:
parent
08c4270707
commit
69d1b5aa2b
|
@ -2,10 +2,12 @@
|
||||||
#define SPECTER_IVIEWMANAGER_HPP
|
#define SPECTER_IVIEWMANAGER_HPP
|
||||||
|
|
||||||
#include "Translator.hpp"
|
#include "Translator.hpp"
|
||||||
|
#include "SplitView.hpp"
|
||||||
#include <HECL/HECL.hpp>
|
#include <HECL/HECL.hpp>
|
||||||
|
|
||||||
namespace Specter
|
namespace Specter
|
||||||
{
|
{
|
||||||
|
struct ISplitSpaceController;
|
||||||
|
|
||||||
struct IViewManager
|
struct IViewManager
|
||||||
{
|
{
|
||||||
|
@ -19,6 +21,8 @@ public:
|
||||||
return vor;
|
return vor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void deferSpaceSplit(ISplitSpaceController* split, SplitView::Axis axis, int thisSlot) {}
|
||||||
|
|
||||||
virtual const std::vector<HECL::SystemString>* recentProjects() const {return nullptr;}
|
virtual const std::vector<HECL::SystemString>* recentProjects() const {return nullptr;}
|
||||||
virtual void pushRecentProject(const HECL::SystemString& path) {}
|
virtual void pushRecentProject(const HECL::SystemString& path) {}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ struct ISpaceController
|
||||||
struct ISplitSpaceController
|
struct ISplitSpaceController
|
||||||
{
|
{
|
||||||
virtual SplitView* splitView()=0;
|
virtual SplitView* splitView()=0;
|
||||||
|
virtual void setSplit(float split)=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Space : public View
|
class Space : public View
|
||||||
|
@ -31,7 +32,6 @@ class Space : public View
|
||||||
|
|
||||||
bool m_cornerDrag = false;
|
bool m_cornerDrag = false;
|
||||||
int m_cornerDragPoint[2];
|
int m_cornerDragPoint[2];
|
||||||
ISplitSpaceController* m_cornerDragSplitSpace = nullptr;
|
|
||||||
|
|
||||||
struct CornerView : View
|
struct CornerView : View
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,6 +66,7 @@ public:
|
||||||
SplitView(ViewResources& res, View& parentView, Axis axis, int clearanceA=-1, int clearanceB=-1);
|
SplitView(ViewResources& res, View& parentView, Axis axis, int clearanceA=-1, int clearanceB=-1);
|
||||||
View* setContentView(int slot, View* view);
|
View* setContentView(int slot, View* view);
|
||||||
void setSplit(float slide);
|
void setSplit(float slide);
|
||||||
|
void setAxis(Axis axis);
|
||||||
void startDragSplit(const boo::SWindowCoord& coord);
|
void startDragSplit(const boo::SWindowCoord& coord);
|
||||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||||
|
|
|
@ -14,6 +14,7 @@ RootView::RootView(IViewManager& viewMan, ViewResources& res, boo::IWindow* wind
|
||||||
m_renderTex = res.m_factory->newRenderTexture(rect.size[0], rect.size[1], 1);
|
m_renderTex = res.m_factory->newRenderTexture(rect.size[0], rect.size[1], 1);
|
||||||
commitResources(res);
|
commitResources(res);
|
||||||
resized(rect, rect);
|
resized(rect, rect);
|
||||||
|
printf("New RootView: %p\n", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootView::destroyed()
|
void RootView::destroyed()
|
||||||
|
|
|
@ -25,6 +25,7 @@ Space::Space(ViewResources& res, View& parentView, ISpaceController& controller,
|
||||||
m_cornerView.m_view.reset(new CornerView(res, *this, spaceTriangleColor()));
|
m_cornerView.m_view.reset(new CornerView(res, *this, spaceTriangleColor()));
|
||||||
if (tbPos != Toolbar::Position::None)
|
if (tbPos != Toolbar::Position::None)
|
||||||
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos));
|
m_toolbar.m_view.reset(new Toolbar(res, *this, tbPos));
|
||||||
|
printf("New Space: %p\n", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Space::CornerView::CornerView(ViewResources& res, Space& space, const Zeus::CColor& triColor)
|
Space::CornerView::CornerView(ViewResources& res, Space& space, const Zeus::CColor& triColor)
|
||||||
|
@ -109,6 +110,7 @@ View* Space::setContentView(View* view)
|
||||||
View* ret = m_contentView.m_view;
|
View* ret = m_contentView.m_view;
|
||||||
m_contentView.m_view = view;
|
m_contentView.m_view = view;
|
||||||
updateSize();
|
updateSize();
|
||||||
|
printf("Set Space: %p [%p]\n", this, view);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,37 +142,29 @@ void Space::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, bo
|
||||||
void Space::CornerView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
void Space::CornerView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||||
{
|
{
|
||||||
if (button == boo::EMouseButton::Primary)
|
if (button == boo::EMouseButton::Primary)
|
||||||
{
|
|
||||||
m_space.m_cornerDrag = false;
|
m_space.m_cornerDrag = false;
|
||||||
m_space.m_cornerDragSplitSpace = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Space::mouseMove(const boo::SWindowCoord& coord)
|
void Space::mouseMove(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
if (m_cornerDragSplitSpace)
|
if (m_cornerDrag)
|
||||||
{
|
|
||||||
m_cornerDragSplitSpace->splitView()->mouseMove(coord);
|
|
||||||
}
|
|
||||||
else if (m_cornerDrag)
|
|
||||||
{
|
{
|
||||||
float pf = rootView().viewRes().pixelFactor();
|
float pf = rootView().viewRes().pixelFactor();
|
||||||
|
ISplitSpaceController* cornerDragSplitSpace = nullptr;
|
||||||
if (m_cornerView.m_view->m_flip)
|
if (m_cornerView.m_view->m_flip)
|
||||||
{
|
{
|
||||||
if (coord.pixel[0] < m_cornerDragPoint[0] - CORNER_DRAG_THRESHOLD * pf)
|
if (coord.pixel[0] < m_cornerDragPoint[0] - CORNER_DRAG_THRESHOLD * pf)
|
||||||
m_cornerDragSplitSpace = m_controller.spaceSplit(SplitView::Axis::Vertical, 1);
|
rootView().viewManager().deferSpaceSplit(&m_controller, SplitView::Axis::Vertical, 1);
|
||||||
else if (coord.pixel[1] < m_cornerDragPoint[1] - CORNER_DRAG_THRESHOLD * pf)
|
else if (coord.pixel[1] < m_cornerDragPoint[1] - CORNER_DRAG_THRESHOLD * pf)
|
||||||
m_cornerDragSplitSpace = m_controller.spaceSplit(SplitView::Axis::Horizontal, 1);
|
rootView().viewManager().deferSpaceSplit(&m_controller, SplitView::Axis::Horizontal, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (coord.pixel[0] > m_cornerDragPoint[0] + CORNER_DRAG_THRESHOLD * pf)
|
if (coord.pixel[0] > m_cornerDragPoint[0] + CORNER_DRAG_THRESHOLD * pf)
|
||||||
m_cornerDragSplitSpace = m_controller.spaceSplit(SplitView::Axis::Vertical, 0);
|
rootView().viewManager().deferSpaceSplit(&m_controller, SplitView::Axis::Vertical, 0);
|
||||||
else if (coord.pixel[1] > m_cornerDragPoint[1] + CORNER_DRAG_THRESHOLD * pf)
|
else if (coord.pixel[1] > m_cornerDragPoint[1] + CORNER_DRAG_THRESHOLD * pf)
|
||||||
m_cornerDragSplitSpace = m_controller.spaceSplit(SplitView::Axis::Horizontal, 0);
|
rootView().viewManager().deferSpaceSplit(&m_controller, SplitView::Axis::Horizontal, 0);
|
||||||
}
|
}
|
||||||
if (m_cornerDragSplitSpace)
|
|
||||||
m_cornerDragSplitSpace->splitView()->startDragSplit(coord);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,7 @@ SplitView::SplitView(ViewResources& res, View& parentView, Axis axis, int cleara
|
||||||
m_splitBlockBuf = res.m_factory->newDynamicBuffer(boo::BufferUse::Uniform, sizeof(ViewBlock), 1);
|
m_splitBlockBuf = res.m_factory->newDynamicBuffer(boo::BufferUse::Uniform, sizeof(ViewBlock), 1);
|
||||||
m_splitVertsBinding.initTex(res, 4, m_splitBlockBuf, res.m_splitRes.m_shadingTex);
|
m_splitVertsBinding.initTex(res, 4, m_splitBlockBuf, res.m_splitRes.m_shadingTex);
|
||||||
commitResources(res);
|
commitResources(res);
|
||||||
|
printf("New SplitView: %p\n", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
View* SplitView::setContentView(int slot, View* view)
|
View* SplitView::setContentView(int slot, View* view)
|
||||||
|
@ -35,6 +36,7 @@ View* SplitView::setContentView(int slot, View* view)
|
||||||
m_views[slot].m_mouseDown = 0;
|
m_views[slot].m_mouseDown = 0;
|
||||||
m_views[slot].m_mouseIn = false;
|
m_views[slot].m_mouseIn = false;
|
||||||
updateSize();
|
updateSize();
|
||||||
|
printf("Set SplitView: %p [%d,%p]\n", this, slot, view);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +73,12 @@ void SplitView::setSplit(float slide)
|
||||||
updateSize();
|
updateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SplitView::setAxis(Axis axis)
|
||||||
|
{
|
||||||
|
m_axis = axis;
|
||||||
|
setSplit(m_slide);
|
||||||
|
}
|
||||||
|
|
||||||
void SplitView::startDragSplit(const boo::SWindowCoord& coord)
|
void SplitView::startDragSplit(const boo::SWindowCoord& coord)
|
||||||
{
|
{
|
||||||
m_dragging = true;
|
m_dragging = true;
|
||||||
|
|
Loading…
Reference in New Issue