2016-03-04 23:03:47 +00:00
|
|
|
#include "logvisor/logvisor.hpp"
|
|
|
|
#include "specter/SplitView.hpp"
|
|
|
|
#include "specter/RootView.hpp"
|
|
|
|
#include "specter/ViewResources.hpp"
|
|
|
|
#include "specter/Space.hpp"
|
2015-12-02 01:32:15 +00:00
|
|
|
|
2016-03-04 23:03:47 +00:00
|
|
|
namespace specter
|
2015-12-02 01:32:15 +00:00
|
|
|
{
|
2016-03-04 23:03:47 +00:00
|
|
|
static logvisor::Module Log("specter::SplitView");
|
2015-12-02 01:32:15 +00:00
|
|
|
|
2016-04-15 03:25:50 +00:00
|
|
|
static const zeus::RGBA32 Tex[3] =
|
|
|
|
{
|
2018-05-25 06:39:09 +00:00
|
|
|
{{0,0,0,64}},
|
|
|
|
{{0,0,0,255}},
|
|
|
|
{{255,255,255,64}}
|
2016-04-15 03:25:50 +00:00
|
|
|
};
|
|
|
|
|
2016-03-30 19:15:32 +00:00
|
|
|
void SplitView::Resources::init(boo::IGraphicsDataFactory::Context& ctx, const IThemeData& theme)
|
2015-12-02 01:32:15 +00:00
|
|
|
{
|
2017-10-01 04:26:31 +00:00
|
|
|
m_shadingTex = ctx.newStaticTexture(3, 1, 1, boo::TextureFormat::RGBA8, boo::TextureClampMode::Repeat, Tex, 12);
|
2015-12-02 01:32:15 +00:00
|
|
|
}
|
|
|
|
|
2016-01-12 00:44:54 +00:00
|
|
|
SplitView::SplitView(ViewResources& res, View& parentView, ISplitSpaceController* controller,
|
|
|
|
Axis axis, float split, int clearanceA, int clearanceB)
|
|
|
|
: View(res, parentView), m_controller(controller), m_axis(axis), m_slide(split),
|
|
|
|
m_clearanceA(clearanceA), m_clearanceB(clearanceB)
|
2015-12-02 01:32:15 +00:00
|
|
|
{
|
2016-03-30 19:15:32 +00:00
|
|
|
commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
|
|
|
{
|
|
|
|
buildResources(ctx, res);
|
2017-01-29 03:57:48 +00:00
|
|
|
m_splitBlockBuf = res.m_viewRes.m_bufPool.allocateBlock(res.m_factory);
|
2017-11-05 06:16:45 +00:00
|
|
|
m_splitVertsBinding.init(ctx, res, 4, m_splitBlockBuf, res.m_splitRes.m_shadingTex.get());
|
2016-03-30 19:15:32 +00:00
|
|
|
return true;
|
|
|
|
});
|
2015-12-02 01:32:15 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 03:14:38 +00:00
|
|
|
View* SplitView::setContentView(int slot, View* view)
|
2015-12-02 01:32:15 +00:00
|
|
|
{
|
|
|
|
if (slot < 0 || slot > 1)
|
2016-03-04 23:03:47 +00:00
|
|
|
Log.report(logvisor::Fatal, "out-of-range slot to RootView::SplitView::setContentView");
|
2015-12-10 03:14:38 +00:00
|
|
|
View* ret = m_views[slot].m_view;
|
|
|
|
m_views[slot].m_view = view;
|
2015-12-20 21:59:23 +00:00
|
|
|
m_views[slot].m_mouseDown = 0;
|
2015-12-05 00:42:46 +00:00
|
|
|
m_views[slot].m_mouseIn = false;
|
2015-12-02 01:32:15 +00:00
|
|
|
updateSize();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-01-10 06:40:23 +00:00
|
|
|
void SplitView::_setSplit(float slide)
|
2015-12-22 01:33:27 +00:00
|
|
|
{
|
|
|
|
m_slide = std::min(std::max(slide, 0.0f), 1.0f);
|
|
|
|
const boo::SWindowRect& rect = subRect();
|
|
|
|
if (rect.size[0] && rect.size[1] &&
|
|
|
|
(m_clearanceA >= 0 || m_clearanceB >= 0))
|
|
|
|
{
|
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
{
|
|
|
|
int slidePx = rect.size[1] * m_slide;
|
|
|
|
if (m_clearanceA >= 0 && slidePx < m_clearanceA)
|
|
|
|
m_slide = m_clearanceA / float(rect.size[1]);
|
|
|
|
if (m_clearanceB >= 0 && (rect.size[1] - slidePx) < m_clearanceB)
|
|
|
|
m_slide = 1.0 - m_clearanceB / float(rect.size[1]);
|
|
|
|
}
|
|
|
|
else if (m_axis == Axis::Vertical)
|
|
|
|
{
|
|
|
|
int slidePx = rect.size[0] * m_slide;
|
|
|
|
if (m_clearanceA >= 0 && slidePx < m_clearanceA)
|
|
|
|
m_slide = m_clearanceA / float(rect.size[0]);
|
|
|
|
if (m_clearanceB >= 0 && (rect.size[0] - slidePx) < m_clearanceB)
|
|
|
|
m_slide = 1.0 - m_clearanceB / float(rect.size[0]);
|
|
|
|
}
|
|
|
|
m_slide = std::min(std::max(m_slide, 0.0f), 1.0f);
|
|
|
|
}
|
2016-01-12 00:44:54 +00:00
|
|
|
if (m_controller)
|
|
|
|
m_controller->updateSplit(m_slide);
|
2015-12-22 01:33:27 +00:00
|
|
|
}
|
|
|
|
|
2016-01-10 06:40:23 +00:00
|
|
|
void SplitView::setSplit(float slide)
|
2015-12-22 01:33:27 +00:00
|
|
|
{
|
2016-01-10 06:40:23 +00:00
|
|
|
_setSplit(slide);
|
2015-12-22 01:33:27 +00:00
|
|
|
updateSize();
|
|
|
|
}
|
|
|
|
|
2016-01-11 01:46:58 +00:00
|
|
|
void SplitView::setAxis(Axis axis)
|
|
|
|
{
|
|
|
|
m_axis = axis;
|
|
|
|
setSplit(m_slide);
|
|
|
|
}
|
|
|
|
|
2016-01-12 00:44:54 +00:00
|
|
|
bool SplitView::testSplitHover(const boo::SWindowCoord& coord)
|
|
|
|
{
|
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[1] * m_slide;
|
|
|
|
if (abs(int(coord.pixel[1] - subRect().location[1]) - slidePx) < 4)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (m_axis == Axis::Vertical)
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[0] * m_slide;
|
|
|
|
if (abs(int(coord.pixel[0] - subRect().location[0]) - slidePx) < 4)
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-02-01 01:12:30 +00:00
|
|
|
bool SplitView::testJoinArrowHover(const boo::SWindowCoord& coord, int& origSlotOut,
|
|
|
|
SplitView*& splitOut, int& slotOut,
|
|
|
|
boo::SWindowRect& rectOut, ArrowDir& dirOut, int forceSlot)
|
2016-01-31 01:07:52 +00:00
|
|
|
{
|
|
|
|
if (!subRect().coordInRect(coord))
|
|
|
|
return false;
|
|
|
|
|
2016-02-01 01:12:30 +00:00
|
|
|
int origDummy;
|
|
|
|
ArrowDir dirDummy;
|
|
|
|
|
2016-01-31 01:07:52 +00:00
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[1] * m_slide;
|
2016-02-01 01:12:30 +00:00
|
|
|
if ((forceSlot == -1 && coord.pixel[1] - subRect().location[1] - slidePx >= 0) || forceSlot == 1)
|
2016-01-31 01:07:52 +00:00
|
|
|
{
|
2016-02-01 01:12:30 +00:00
|
|
|
origSlotOut = 0;
|
|
|
|
dirOut = ArrowDir::Up;
|
2016-01-31 01:07:52 +00:00
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
2016-02-01 01:12:30 +00:00
|
|
|
return chSplit->testJoinArrowHover(coord, origDummy, splitOut, slotOut, rectOut, dirDummy, 0);
|
2016-01-31 01:07:52 +00:00
|
|
|
}
|
2016-02-01 01:12:30 +00:00
|
|
|
splitOut = this;
|
2016-01-31 01:07:52 +00:00
|
|
|
slotOut = 1;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[1] += slidePx;
|
|
|
|
rectOut.size[1] -= slidePx;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-01 01:12:30 +00:00
|
|
|
origSlotOut = 1;
|
|
|
|
dirOut = ArrowDir::Down;
|
2016-01-31 01:07:52 +00:00
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
2016-02-01 01:12:30 +00:00
|
|
|
return chSplit->testJoinArrowHover(coord, origDummy, splitOut, slotOut, rectOut, dirDummy, 1);
|
2016-01-31 01:07:52 +00:00
|
|
|
}
|
2016-02-01 01:12:30 +00:00
|
|
|
splitOut = this;
|
2016-01-31 01:07:52 +00:00
|
|
|
slotOut = 0;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[1] = slidePx;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[0] * m_slide;
|
2016-02-01 01:12:30 +00:00
|
|
|
if ((forceSlot == -1 && coord.pixel[0] - subRect().location[0] - slidePx >= 0) || forceSlot == 1)
|
2016-01-31 01:07:52 +00:00
|
|
|
{
|
2016-02-01 01:12:30 +00:00
|
|
|
origSlotOut = 0;
|
|
|
|
dirOut = ArrowDir::Right;
|
2016-01-31 01:07:52 +00:00
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
2016-02-01 01:12:30 +00:00
|
|
|
return chSplit->testJoinArrowHover(coord, origDummy, splitOut, slotOut, rectOut, dirDummy, 0);
|
2016-01-31 01:07:52 +00:00
|
|
|
}
|
2016-02-01 01:12:30 +00:00
|
|
|
splitOut = this;
|
2016-01-31 01:07:52 +00:00
|
|
|
slotOut = 1;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[0] += slidePx;
|
|
|
|
rectOut.size[0] -= slidePx;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-02-01 01:12:30 +00:00
|
|
|
origSlotOut = 1;
|
|
|
|
dirOut = ArrowDir::Left;
|
2016-01-31 01:07:52 +00:00
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
2016-02-01 01:12:30 +00:00
|
|
|
return chSplit->testJoinArrowHover(coord, origDummy, splitOut, slotOut, rectOut, dirDummy, 1);
|
2016-01-31 01:07:52 +00:00
|
|
|
}
|
2016-02-01 01:12:30 +00:00
|
|
|
splitOut = this;
|
2016-01-31 01:07:52 +00:00
|
|
|
slotOut = 0;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[0] = slidePx;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::getJoinArrowHover(int slot, boo::SWindowRect& rectOut, ArrowDir& dirOut)
|
|
|
|
{
|
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[1] * m_slide;
|
|
|
|
if (slot == 1)
|
|
|
|
{
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
|
|
|
return chSplit->getJoinArrowHover(0, rectOut, dirOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[1] += slidePx;
|
|
|
|
rectOut.size[1] -= slidePx;
|
|
|
|
dirOut = ArrowDir::Up;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
|
|
|
return chSplit->getJoinArrowHover(1, rectOut, dirOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[1] = slidePx;
|
|
|
|
dirOut = ArrowDir::Down;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[0] * m_slide;
|
|
|
|
if (slot == 1)
|
|
|
|
{
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
|
|
|
return chSplit->getJoinArrowHover(0, rectOut, dirOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[0] += slidePx;
|
|
|
|
rectOut.size[0] -= slidePx;
|
|
|
|
dirOut = ArrowDir::Right;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
|
|
|
return chSplit->getJoinArrowHover(1, rectOut, dirOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[0] = slidePx;
|
|
|
|
dirOut = ArrowDir::Left;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SplitView::testSplitLineHover(const boo::SWindowCoord& coord, int& slotOut,
|
|
|
|
boo::SWindowRect& rectOut, float& splitOut, Axis& axisOut)
|
|
|
|
{
|
|
|
|
if (!subRect().coordInRect(coord))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[1] * m_slide;
|
|
|
|
if (coord.pixel[1] - subRect().location[1] - slidePx >= 0)
|
|
|
|
{
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
|
|
|
return chSplit->testSplitLineHover(coord, slotOut, rectOut, splitOut, axisOut);
|
|
|
|
}
|
|
|
|
slotOut = 1;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[1] += slidePx;
|
|
|
|
rectOut.size[1] -= slidePx;
|
|
|
|
splitOut = (coord.pixel[0] - rectOut.location[0]) / float(rectOut.size[0]);
|
|
|
|
axisOut = Axis::Vertical;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
|
|
|
return chSplit->testSplitLineHover(coord, slotOut, rectOut, splitOut, axisOut);
|
|
|
|
}
|
|
|
|
slotOut = 0;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[1] = slidePx;
|
|
|
|
splitOut = (coord.pixel[0] - rectOut.location[0]) / float(rectOut.size[0]);
|
|
|
|
axisOut = Axis::Vertical;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[0] * m_slide;
|
|
|
|
if (coord.pixel[0] - subRect().location[0] - slidePx >= 0)
|
|
|
|
{
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
|
|
|
return chSplit->testSplitLineHover(coord, slotOut, rectOut, splitOut, axisOut);
|
|
|
|
}
|
|
|
|
slotOut = 1;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[0] += slidePx;
|
|
|
|
rectOut.size[0] -= slidePx;
|
|
|
|
splitOut = (coord.pixel[1] - rectOut.location[1]) / float(rectOut.size[1]);
|
|
|
|
axisOut = Axis::Horizontal;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
|
|
|
return chSplit->testSplitLineHover(coord, slotOut, rectOut, splitOut, axisOut);
|
|
|
|
}
|
|
|
|
slotOut = 0;
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[0] = slidePx;
|
|
|
|
splitOut = (coord.pixel[1] - rectOut.location[1]) / float(rectOut.size[1]);
|
|
|
|
axisOut = Axis::Horizontal;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::getSplitLineHover(int slot, boo::SWindowRect& rectOut, Axis& axisOut)
|
|
|
|
{
|
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[1] * m_slide;
|
|
|
|
if (slot == 1)
|
|
|
|
{
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
|
|
|
return chSplit->getSplitLineHover(0, rectOut, axisOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[1] += slidePx;
|
|
|
|
rectOut.size[1] -= slidePx;
|
|
|
|
axisOut = Axis::Vertical;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Horizontal)
|
|
|
|
return chSplit->getSplitLineHover(1, rectOut, axisOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[1] = slidePx;
|
|
|
|
axisOut = Axis::Vertical;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int slidePx = subRect().size[0] * m_slide;
|
|
|
|
if (slot == 1)
|
|
|
|
{
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[1].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
|
|
|
return chSplit->getSplitLineHover(0, rectOut, axisOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.location[0] += slidePx;
|
|
|
|
rectOut.size[0] -= slidePx;
|
|
|
|
axisOut = Axis::Horizontal;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_views[0].m_view)
|
|
|
|
{
|
2018-10-07 02:58:28 +00:00
|
|
|
SplitView* chSplit = m_views[0].m_view->castToSplitView();
|
2016-01-31 01:07:52 +00:00
|
|
|
if (chSplit && chSplit->m_axis == Axis::Vertical)
|
|
|
|
return chSplit->getSplitLineHover(1, rectOut, axisOut);
|
|
|
|
}
|
|
|
|
rectOut = subRect();
|
|
|
|
rectOut.size[0] = slidePx;
|
|
|
|
axisOut = Axis::Horizontal;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-10 06:40:23 +00:00
|
|
|
void SplitView::startDragSplit(const boo::SWindowCoord& coord)
|
|
|
|
{
|
|
|
|
m_dragging = true;
|
2016-01-12 00:44:54 +00:00
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
setSplit((coord.pixel[1] - subRect().location[1]) / float(subRect().size[1]));
|
|
|
|
else if (m_axis == Axis::Vertical)
|
|
|
|
setSplit((coord.pixel[0] - subRect().location[0]) / float(subRect().size[0]));
|
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::endDragSplit()
|
|
|
|
{
|
|
|
|
m_dragging = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::moveDragSplit(const boo::SWindowCoord& coord)
|
|
|
|
{
|
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
setSplit((coord.pixel[1] - subRect().location[1]) / float(subRect().size[1]));
|
|
|
|
else if (m_axis == Axis::Vertical)
|
|
|
|
setSplit((coord.pixel[0] - subRect().location[0]) / float(subRect().size[0]));
|
2016-01-10 06:40:23 +00:00
|
|
|
}
|
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
void SplitView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
|
|
|
{
|
2015-12-20 21:59:23 +00:00
|
|
|
m_views[0].mouseDown(coord, button, mod);
|
|
|
|
m_views[1].mouseDown(coord, button, mod);
|
2015-12-02 01:32:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
|
|
|
{
|
2015-12-20 21:59:23 +00:00
|
|
|
m_views[0].mouseUp(coord, button, mod);
|
|
|
|
m_views[1].mouseUp(coord, button, mod);
|
2015-12-02 01:32:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::mouseMove(const boo::SWindowCoord& coord)
|
|
|
|
{
|
2015-12-20 21:59:23 +00:00
|
|
|
m_views[0].mouseMove(coord);
|
|
|
|
m_views[1].mouseMove(coord);
|
2015-12-05 00:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::mouseEnter(const boo::SWindowCoord& coord)
|
|
|
|
{
|
2015-12-20 21:59:23 +00:00
|
|
|
m_views[0].mouseEnter(coord);
|
|
|
|
m_views[1].mouseEnter(coord);
|
2015-12-05 00:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::mouseLeave(const boo::SWindowCoord& coord)
|
|
|
|
{
|
2015-12-20 21:59:23 +00:00
|
|
|
m_views[0].mouseLeave(coord);
|
|
|
|
m_views[1].mouseLeave(coord);
|
2015-12-02 01:32:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
|
|
|
{
|
|
|
|
View::resized(root, sub);
|
2016-01-10 06:40:23 +00:00
|
|
|
_setSplit(m_slide);
|
2015-12-02 01:32:15 +00:00
|
|
|
if (m_axis == Axis::Horizontal)
|
|
|
|
{
|
|
|
|
boo::SWindowRect ssub = sub;
|
|
|
|
ssub.size[1] *= m_slide;
|
2015-12-05 00:42:46 +00:00
|
|
|
if (m_views[0].m_view)
|
|
|
|
m_views[0].m_view->resized(root, ssub);
|
2015-12-02 01:32:15 +00:00
|
|
|
ssub.location[1] += ssub.size[1];
|
|
|
|
ssub.size[1] = sub.size[1] - ssub.size[1];
|
2015-12-05 00:42:46 +00:00
|
|
|
if (m_views[1].m_view)
|
|
|
|
m_views[1].m_view->resized(root, ssub);
|
2015-12-05 05:34:45 +00:00
|
|
|
ssub.location[1] -= 1;
|
2015-12-02 01:32:15 +00:00
|
|
|
m_splitBlock.setViewRect(root, ssub);
|
|
|
|
setHorizontalVerts(ssub.size[0]);
|
|
|
|
}
|
|
|
|
else if (m_axis == Axis::Vertical)
|
|
|
|
{
|
|
|
|
boo::SWindowRect ssub = sub;
|
|
|
|
ssub.size[0] *= m_slide;
|
2015-12-05 00:42:46 +00:00
|
|
|
if (m_views[0].m_view)
|
|
|
|
m_views[0].m_view->resized(root, ssub);
|
2015-12-02 01:32:15 +00:00
|
|
|
ssub.location[0] += ssub.size[0];
|
|
|
|
ssub.size[0] = sub.size[0] - ssub.size[0];
|
2015-12-05 00:42:46 +00:00
|
|
|
if (m_views[1].m_view)
|
|
|
|
m_views[1].m_view->resized(root, ssub);
|
2015-12-05 05:34:45 +00:00
|
|
|
ssub.location[0] -= 1;
|
2015-12-02 01:32:15 +00:00
|
|
|
m_splitBlock.setViewRect(root, ssub);
|
|
|
|
setVerticalVerts(ssub.size[1]);
|
|
|
|
}
|
2018-10-16 07:26:43 +00:00
|
|
|
m_splitBlockBuf.access().finalAssign(m_splitBlock);
|
2016-12-10 02:33:54 +00:00
|
|
|
m_splitVertsBinding.load<decltype(m_splitVerts)>(m_splitVerts);
|
2015-12-02 01:32:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SplitView::draw(boo::IGraphicsCommandQueue* gfxQ)
|
|
|
|
{
|
|
|
|
View::draw(gfxQ);
|
2015-12-05 00:42:46 +00:00
|
|
|
if (m_views[0].m_view)
|
|
|
|
m_views[0].m_view->draw(gfxQ);
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
m_views[1].m_view->draw(gfxQ);
|
2016-01-08 00:06:21 +00:00
|
|
|
gfxQ->setShaderDataBinding(m_splitVertsBinding);
|
2015-12-02 01:32:15 +00:00
|
|
|
gfxQ->draw(0, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|