mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-09-01 17:12:53 +02:00
Update to v106r47 release.
byuu says: This is probably the largest code-change diff I've done in years. I spent four days working 10-16 hours a day reworking layouts in hiro completely. The result is we now have TableLayout, which will allow for better horizontal+vertical combined alignment. Windows, GTK2, and now GTK3 are fully supported. Windows is getting the initial window geometry wrong by a bit. GTK2 and GTK3 work perfectly. I basically abandoned trying to detect resize signals, and instead keep a list of all hiro windows that are allocated, and every time the main loop runs, it will query all of them to see if they've been resized. I'm disgusted that I have to do this, but after fighting with GTK for years, I'm about sick of it. GTK was doing this crazy thing where it would trigger another size-allocate inside of a previous size-allocate, and so my layouts would be halfway through resizing all the widgets, and then the size-allocate would kick off another one. That would end up leaving the rest of the first layout loop with bad widget sizes. And if I detected a second re-entry and blocked it, then the entire window would end up with the older geometry. I started trying to build a message queue system to allow the second layout resize to occur after the first one completed, but this was just too much madness, so I went with the simpler solution. Qt4 has some geometry problems, and doesn't show tab frame layouts properly yet. Qt5 causes an ICE error and tanks my entire Xorg display server, so ... something is seriously wrong there, and it's not hiro's fault. Creating a dummy Qt5 application without even using hiro, just int main() { TestObject object; } with object performing a dynamic\_cast to a derived type segfaults. Memory is getting corrupted where GCC allocates the vtables for classes, just by linking in Qt. Could be somehow related to the -fPIC requirement that only Qt5 has ... could just be that FreeBSD 10.1 has a buggy implementation of Qt5. I don't know. It's beyond my ability to debug, so this one's going to stay broken. The Cocoa port is busted. I'll fix it up to compile again, but that's about all I'm going to do. Many optimizations mean bsnes and higan open faster. GTK2 and GTK3 both resize windows very quickly now. higan crashes when you load a game, so that's not good. bsnes works though. bsnes also has the start of a localization engine now. Still a long way to go. The makefiles received a rather substantial restructuring. Including the ruby and hiro makefiles will add the necessary compilation rules for you, which also means that moc will run for the qt4 and qt5 targets, and windres will run for the Windows targets.
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
#if defined(Hiro_Layout)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pLayout::construct() -> void {
|
||||
for(auto& sizable : state().sizables) sizable->construct();
|
||||
}
|
||||
|
||||
auto pLayout::destruct() -> void {
|
||||
for(auto& sizable : state().sizables) sizable->destruct();
|
||||
}
|
||||
|
||||
auto pLayout::setEnabled(bool enabled) -> void {
|
||||
for(auto& sizable : state().sizables) {
|
||||
if(auto self = sizable->self()) self->setEnabled(enabled && sizable->enabled(true));
|
||||
}
|
||||
}
|
||||
|
||||
auto pLayout::setFont(const Font& font) -> void {
|
||||
for(auto& sizable : state().sizables) {
|
||||
if(auto self = sizable->self()) self->setFont(font ? font : sizable->font(true));
|
||||
}
|
||||
}
|
||||
|
||||
auto pLayout::setVisible(bool visible) -> void {
|
||||
for(auto& sizable : state().sizables) {
|
||||
if(auto self = sizable->self()) self->setVisible(visible && sizable->visible(true));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,15 +0,0 @@
|
||||
#if defined(Hiro_Layout)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pLayout : pSizable {
|
||||
Declare(Layout, Sizable);
|
||||
|
||||
auto setEnabled(bool enabled) -> void override;
|
||||
auto setFont(const Font& font) -> void override;
|
||||
auto setVisible(bool visible) -> void override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -27,6 +27,9 @@ auto pObject::setFocused() -> void {
|
||||
auto pObject::setFont(const Font& font) -> void {
|
||||
}
|
||||
|
||||
auto pObject::setParent(mObject* parent, int offset) -> void {
|
||||
}
|
||||
|
||||
auto pObject::setVisible(bool visible) -> void {
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pObject {
|
||||
struct pObject : mLock {
|
||||
pObject(mObject& reference) : reference(reference) {}
|
||||
virtual ~pObject() {}
|
||||
auto self() const -> mObject& { return (mObject&)reference; }
|
||||
@@ -16,14 +16,10 @@ struct pObject {
|
||||
virtual auto setEnabled(bool enabled) -> void;
|
||||
virtual auto setFocused() -> void;
|
||||
virtual auto setFont(const Font& font) -> void;
|
||||
virtual auto setParent(mObject* parent, int offset) -> void;
|
||||
virtual auto setVisible(bool visible) -> void;
|
||||
|
||||
auto locked() const -> bool { return locks != 0 || Application::state.quit; }
|
||||
auto lock() -> void { ++locks; }
|
||||
auto unlock() -> void { --locks; }
|
||||
|
||||
mObject& reference;
|
||||
signed locks = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "action/menu-radio-item.cpp"
|
||||
|
||||
#include "sizable.cpp"
|
||||
#include "layout.cpp"
|
||||
|
||||
#include "widget/widget.cpp"
|
||||
#include "widget/button.cpp"
|
||||
|
@@ -38,7 +38,6 @@ namespace hiro {
|
||||
#include "action/menu-radio-item.hpp"
|
||||
|
||||
#include "sizable.hpp"
|
||||
#include "layout.hpp"
|
||||
|
||||
#include "widget/widget.hpp"
|
||||
#include "widget/button.hpp"
|
||||
|
@@ -31,22 +31,22 @@ auto pFrame::destruct() -> void {
|
||||
}
|
||||
}
|
||||
|
||||
auto pFrame::append(sLayout layout) -> void {
|
||||
auto pFrame::append(sSizable sizable) -> void {
|
||||
}
|
||||
|
||||
auto pFrame::remove(sLayout layout) -> void {
|
||||
auto pFrame::remove(sSizable sizable) -> void {
|
||||
}
|
||||
|
||||
auto pFrame::setEnabled(bool enabled) -> void {
|
||||
pWidget::setEnabled(enabled);
|
||||
if(auto layout = _layout()) layout->setEnabled(layout->self().enabled(true));
|
||||
if(auto& sizable = _sizable()) sizable->setEnabled(sizable->self().enabled(true));
|
||||
}
|
||||
|
||||
auto pFrame::setFont(const Font& font) -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView setTitleFont:pFont::create(font)];
|
||||
}
|
||||
if(auto layout = _layout()) layout->setFont(layout->self().font(true));
|
||||
if(auto& sizable = _sizable()) sizable->setFont(sizable->self().font(true));
|
||||
}
|
||||
|
||||
auto pFrame::setGeometry(Geometry geometry) -> void {
|
||||
@@ -56,8 +56,8 @@ auto pFrame::setGeometry(Geometry geometry) -> void {
|
||||
geometry.x() - 3, geometry.y() - (empty ? size.height() - 2 : 1),
|
||||
geometry.width() + 6, geometry.height() + (empty ? size.height() + 2 : 5)
|
||||
});
|
||||
if(auto layout = state().layout) {
|
||||
layout->setGeometry({
|
||||
if(auto& sizable = state().sizable) {
|
||||
sizable->setGeometry({
|
||||
geometry.x() + 1, geometry.y() + (empty ? 1 : size.height() - 2),
|
||||
geometry.width() - 2, geometry.height() - (empty ? 1 : size.height() - 1)
|
||||
});
|
||||
@@ -72,12 +72,12 @@ auto pFrame::setText(const string& text) -> void {
|
||||
|
||||
auto pFrame::setVisible(bool visible) -> void {
|
||||
pWidget::setVisible(visible);
|
||||
if(auto layout = _layout()) layout->setVisible(layout->self().visible(true));
|
||||
if(auto& sizable = _sizable()) sizable->setVisible(sizable->self().visible(true));
|
||||
}
|
||||
|
||||
auto pFrame::_layout() -> maybe<pLayout&> {
|
||||
if(auto layout = state().layout) {
|
||||
if(auto self = layout->self()) return *self;
|
||||
auto pFrame::_sizable() -> maybe<pSizable&> {
|
||||
if(auto sizable = state().sizable) {
|
||||
if(auto self = sizable->self()) return *self;
|
||||
}
|
||||
return nothing;
|
||||
}
|
||||
|
@@ -12,15 +12,15 @@ namespace hiro {
|
||||
struct pFrame : pWidget {
|
||||
Declare(Frame, Widget)
|
||||
|
||||
auto append(sLayout layout) -> void;
|
||||
auto remove(sLayout layout) -> void;
|
||||
auto append(sSizable sizable) -> void;
|
||||
auto remove(sSizable sizable) -> void;
|
||||
auto setEnabled(bool enabled) -> void override;
|
||||
auto setFont(const Font& font) -> void override;
|
||||
auto setGeometry(Geometry geometry) -> void override;
|
||||
auto setText(const string& text) -> void;
|
||||
auto setVisible(bool visible) -> void override;
|
||||
|
||||
auto _layout() -> maybe<pLayout&>;
|
||||
auto _sizable() -> maybe<pSizable&>;
|
||||
|
||||
CocoaFrame* cocoaFrame = nullptr;
|
||||
};
|
||||
|
@@ -8,10 +8,10 @@ auto pTabFrameItem::construct() -> void {
|
||||
auto pTabFrameItem::destruct() -> void {
|
||||
}
|
||||
|
||||
auto pTabFrameItem::append(sLayout layout) -> void {
|
||||
auto pTabFrameItem::append(sSizable sizable) -> void {
|
||||
}
|
||||
|
||||
auto pTabFrameItem::remove(sLayout layout) -> void {
|
||||
auto pTabFrameItem::remove(sSizable sizable) -> void {
|
||||
}
|
||||
|
||||
auto pTabFrameItem::setClosable(bool closable) -> void {
|
||||
|
@@ -5,8 +5,8 @@ namespace hiro {
|
||||
struct pTabFrameItem : pObject {
|
||||
Declare(TabFrameItem, Object)
|
||||
|
||||
auto append(sLayout layout) -> void;
|
||||
auto remove(sLayout layout) -> void;
|
||||
auto append(sSizable sizable) -> void;
|
||||
auto remove(sSizable sizable) -> void;
|
||||
auto setClosable(bool closable) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setMovable(bool movable) -> void;
|
||||
|
@@ -213,12 +213,12 @@ auto pWindow::destruct() -> void {
|
||||
}
|
||||
}
|
||||
|
||||
auto pWindow::append(sLayout layout) -> void {
|
||||
layout->setGeometry(self().geometry().setPosition(0, 0));
|
||||
statusBarReposition();
|
||||
auto pWindow::append(sMenuBar menuBar) -> void {
|
||||
}
|
||||
|
||||
auto pWindow::append(sMenuBar menuBar) -> void {
|
||||
auto pWindow::append(sSizable sizable) -> void {
|
||||
layout->setGeometry(self().geometry().setPosition(0, 0));
|
||||
statusBarReposition();
|
||||
}
|
||||
|
||||
auto pWindow::append(sStatusBar statusBar) -> void {
|
||||
@@ -241,15 +241,15 @@ auto pWindow::frameMargin() const -> Geometry {
|
||||
}
|
||||
}
|
||||
|
||||
auto pWindow::remove(sLayout layout) -> void {
|
||||
auto pWindow::remove(sMenuBar menuBar) -> void {
|
||||
}
|
||||
|
||||
auto pWindow::remove(sSizable sizable) -> void {
|
||||
@autoreleasepool {
|
||||
[[cocoaWindow contentView] setNeedsDisplay:YES];
|
||||
}
|
||||
}
|
||||
|
||||
auto pWindow::remove(sMenuBar menuBar) -> void {
|
||||
}
|
||||
|
||||
auto pWindow::remove(sStatusBar statusBar) -> void {
|
||||
@autoreleasepool {
|
||||
[[cocoaWindow statusBar] setHidden:YES];
|
||||
|
@@ -30,13 +30,13 @@ namespace hiro {
|
||||
struct pWindow : pObject {
|
||||
Declare(Window, Object)
|
||||
|
||||
auto append(sLayout layout) -> void;
|
||||
auto append(sMenuBar menuBar) -> void;
|
||||
auto append(sSizable sizable) -> void;
|
||||
auto append(sStatusBar statusBar) -> void;
|
||||
auto focused() const -> bool override;
|
||||
auto frameMargin() const -> Geometry;
|
||||
auto remove(sLayout layout) -> void;
|
||||
auto remove(sMenuBar menuBar) -> void;
|
||||
auto remove(sSizable sizable) -> void;
|
||||
auto remove(sStatusBar statusBar) -> void;
|
||||
auto setBackgroundColor(Color color) -> void;
|
||||
auto setDismissable(bool dismissable) -> void;
|
||||
|
Reference in New Issue
Block a user