Skip to content

Commit

Permalink
Bugfixes + Example tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoam committed May 4, 2015
1 parent ceb8b33 commit 2521e35
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 189 deletions.
2 changes: 1 addition & 1 deletion src/Ui/Scheme/mkDockbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace mk
{
Dockbox::Dockbox(Dockbar& dockbar, const string& title, const string& icon)
: Window(title)
: Window(title, static_cast<WindowState>(WINDOW_CLOSABLE))
, mDockbar(dockbar)
, mToggle(dockbar.toggles().emplace<DockToggle>(*this, icon))
{
Expand Down
2 changes: 2 additions & 0 deletions src/Ui/Scheme/mkWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ namespace mk
, mFooter(this->makeappend<WindowFooter>(*this))
{
mStyle = dock ? &DockWindow::cls() : &Window::cls();
if(!this->sizable())
mFooter.hide();
}

Window::~Window()
Expand Down
1 change: 1 addition & 0 deletions src/Ui/Widget/mkInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <Ui/mkUiForward.h>
#include <Ui/Widget/mkValue.h>
#include <Ui/Widget/mkSlider.h>
#include <Ui/Widget/mkTypeIn.h>

#include <Object/Util/mkStat.h>
#include <Object/Util/mkDispatch.h>
Expand Down
4 changes: 2 additions & 2 deletions src/Ui/Widget/mkScrollbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ namespace mk
, mDown(this->makeappend<ScrollDown>(std::bind(&Scrollbar::scrolldown, this)))
{
mStyle = &cls();
//mScroller->resetMetrics(0.f, mSheet->sequenceLength() - mSheet->dclipsize(DIM_Y), mSheet->cursor(), 1.f, mSheet->dclipsize(DIM_Y));
}

Scrollbar::~Scrollbar()
Expand Down Expand Up @@ -117,7 +116,8 @@ namespace mk
void Scrollbar::nextFrame(size_t tick, size_t delta)
{
Sheet::nextFrame(tick, delta);
mScroller.updateMetrics(0.f, mSheet.stripe().sequenceLength() - mSheet.stripe().dclipsize(DIM_Y), mSheet.stripe().cursor(), 1.f, mSheet.stripe().dclipsize(DIM_Y));
Stripe& stripe = mSheet.stripe();
mScroller.updateMetrics(0.f, stripe.sequenceLength() - stripe.dclipsize(DIM_Y), stripe.cursor(), 1.f, stripe.dclipsize(DIM_Y));
}

ScrollArea::ScrollArea(Sheet& sheet)
Expand Down
5 changes: 3 additions & 2 deletions src/Ui/Widget/mkSheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ namespace mk
{
Widget::nextFrame(tick, delta);

for(size_t i = 0; i < mContents.size(); ++i)
mContents[i]->nextFrame(tick, delta);
Stripe& stripe = this->stripe();
for(size_t i = 0; i < stripe.contents().size(); ++i)
stripe.contents()[i]->widget().nextFrame(tick, delta);
}

void Sheet::bind(Sheet* parent, size_t index)
Expand Down
8 changes: 4 additions & 4 deletions src/Ui/Widget/mkSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,17 @@ namespace mk
mKnobLength = knobLength ? knobLength : mStepLength;

this->markDirty();
this->updateKnob();
//this->updateKnob(); @useless ?
}

void Slider::updateKnob()
{
if(!(mState & BOUND) || !mFrame->visible())
return;

if(mButton.frame().dmanual(mDim))
mButton.frame().setSizeDim(mDim, std::max(mFrame->dsize(mDim == DIM_X ? DIM_Y : DIM_X), mKnobLength / (mKnobLength + mMax - mMin) * mFrame->dsize(mDim)));

float pos = (mVal - mMin) / (mMax - mMin) * this->length();
mFiller.frame().setSizeDim(mDim, pos);
mButton.frame().parent()->positionDepth(mButton.frame());
Expand All @@ -166,9 +169,6 @@ namespace mk
mButton.frame().setPositionDim(mDim, pos);
else
mButton.frame().setPositionDim(mDim, 0);

if(mButton.frame().dmanual(mDim))
mButton.frame().setSizeDim(mDim, std::max(mFrame->dsize(mDim == DIM_X ? DIM_Y : DIM_X), mKnobLength / (mKnobLength + mMax - mMin) * mFrame->dsize(mDim)));
}

SliderDisplay::SliderDisplay(const string& label)
Expand Down

0 comments on commit 2521e35

Please sign in to comment.