bsnes/hiro/core/layout.cpp
Tim Allen 0955295475 Update to v098r08 release.
byuu says:

Changelog:
- nall/vector rewritten from scratch
- higan/audio uses nall/vector instead of raw pointers
- higan/sfc/coprocessor/sdd1 updated with new research information
- ruby/video/glx and ruby/video/glx2: fuck salt glXSwapIntervalEXT!

The big change here is definitely nall/vector. The Windows, OS X and Qt
ports won't compile until you change some first/last strings to
left/right, but GTK will compile.

I'd be really grateful if anyone could stress-test nall/vector. Pretty
much everything I do relies on this class. If we introduce a bug, the
worst case scenario is my entire SFC game dump database gets corrupted,
or the byuu.org server gets compromised. So it's really critical that we
test the hell out of this right now.

The S-DD1 changes mean you need to update your installation of icarus
again. Also, even though the Lunar FMV never really worked on the
accuracy core anyway (it didn't initialize the PPU properly), it really
won't work now that we emulate the hard-limit of 16MiB for S-DD1 games.
2016-05-02 19:57:04 +10:00

71 lines
1.8 KiB
C++

#if defined(Hiro_Layout)
auto mLayout::allocate() -> pObject* {
return new pLayout(*this);
}
auto mLayout::destruct() -> void {
for(auto& sizable : state.sizables) sizable->destruct();
mSizable::destruct();
}
//
auto mLayout::append(sSizable sizable) -> type& {
state.sizables.append(sizable);
sizable->setParent(this, sizableCount() - 1);
setGeometry(geometry());
return *this;
}
auto mLayout::remove() -> type& {
#if defined(Hiro_TabFrame)
if(auto tabFrameItem = parentTabFrameItem()) tabFrameItem->remove(tabFrameItem->layout());
#endif
if(auto layout = parentLayout()) layout->remove(layout->sizable(offset()));
if(auto window = parentWindow()) window->remove(window->layout());
setParent();
for(auto& sizable : state.sizables) sizable->setParent(this, sizable->offset());
return *this;
}
auto mLayout::remove(sSizable sizable) -> type& {
auto offset = sizable->offset();
sizable->setParent();
state.sizables.remove(offset);
for(auto n : range(offset, sizableCount())) {
state.sizables[n]->adjustOffset(-1);
}
setGeometry(geometry());
return *this;
}
auto mLayout::reset() -> type& {
while(state.sizables) remove(state.sizables.right());
return *this;
}
auto mLayout::setParent(mObject* parent, signed offset) -> type& {
for(auto& sizable : state.sizables) sizable->destruct();
mObject::setParent(parent, offset);
for(auto& sizable : state.sizables) sizable->setParent(this, sizable->offset());
return *this;
}
auto mLayout::sizable(unsigned position) const -> Sizable {
if(position < sizableCount()) return state.sizables[position];
return {};
}
auto mLayout::sizableCount() const -> unsigned {
return state.sizables.size();
}
auto mLayout::sizables() const -> vector<Sizable> {
vector<Sizable> sizables;
for(auto& sizable : sizables) sizables.append(sizable);
return sizables;
}
#endif