diff --git a/bsnes/Makefile b/bsnes/Makefile index 4064864b..e4f8dd8e 100755 --- a/bsnes/Makefile +++ b/bsnes/Makefile @@ -5,6 +5,7 @@ gameboy := gameboy profile := accuracy ui := ui +# options += console # options += debugger # compiler @@ -25,21 +26,20 @@ else ifeq ($(pgo),optimize) flags += -fprofile-use endif -flags := $(flags) $(foreach o,$(call strupper,$(options)),-D$o) - # platform ifeq ($(platform),x) link += -s -ldl -lX11 -lXext else ifeq ($(platform),osx) else ifeq ($(platform),win) - link += -mwindows -# link += -mconsole + link += $(if $(findstring console,$(options)),-mconsole,-mwindows) link += -mthreads -s -luuid -lkernel32 -luser32 -lgdi32 -lcomctl32 -lcomdlg32 -lshell32 -lole32 link += -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc else unknown_platform: help; endif +flags := $(flags) $(foreach o,$(call strupper,$(options)),-D$o) + # implicit rules compile = \ $(strip \ diff --git a/bsnes/phoenix/core/core.cpp b/bsnes/phoenix/core/core.cpp index 63c152b2..39512f4f 100755 --- a/bsnes/phoenix/core/core.cpp +++ b/bsnes/phoenix/core/core.cpp @@ -100,6 +100,8 @@ void Widget::setEnabled(bool enabled) { state.enabled = enabled; return p.setEna void Widget::setFocused() { return p.setFocused(); } void Widget::setFont(Font &font) { state.font = &font; return p.setFont(font); } void Widget::setGeometry(const Geometry &geometry) { state.geometry = geometry; return p.setGeometry(geometry); } +void Widget::setLayout(Layout &layout) { state.layout = &layout; } +void Widget::setParent(Window &parent) { state.parent = &parent; return p.setParent(parent); } void Widget::setVisible(bool visible) { state.visible = visible; return p.setVisible(visible); } bool Widget::visible() { return state.visible; } Widget::Widget() : state(*new State), p(*new pWidget(*this)) { state.abstract = true; p.constructor(); } diff --git a/bsnes/phoenix/core/core.hpp b/bsnes/phoenix/core/core.hpp index c09909ed..a57328f1 100755 --- a/bsnes/phoenix/core/core.hpp +++ b/bsnes/phoenix/core/core.hpp @@ -223,13 +223,21 @@ struct RadioItem : private nall::base_from_member, Action { pRadioItem &p; }; -struct Layout : Object { +struct Layout; + +struct Sizable : Object { + virtual Geometry minimumGeometry() = 0; virtual void setGeometry(const Geometry &geometry) = 0; + virtual void setLayout(Layout &layout) = 0; virtual void setParent(Window &parent) = 0; virtual void setVisible(bool visible = true) = 0; + virtual bool visible() = 0; }; -struct Widget : Object { +struct Layout : Sizable { +}; + +struct Widget : Sizable { bool enabled(); Font& font(); Geometry geometry(); @@ -238,6 +246,8 @@ struct Widget : Object { void setFocused(); void setFont(Font &font); void setGeometry(const Geometry &geometry); + void setLayout(Layout &layout); + void setParent(Window &parent); void setVisible(bool visible = true); bool visible(); diff --git a/bsnes/phoenix/core/layout/fixed-layout.cpp b/bsnes/phoenix/core/layout/fixed-layout.cpp index a9b9628e..5a28e9f5 100755 --- a/bsnes/phoenix/core/layout/fixed-layout.cpp +++ b/bsnes/phoenix/core/layout/fixed-layout.cpp @@ -1,20 +1,44 @@ void FixedLayout::setParent(Window &parent) { foreach(child, children) { - parent.append(*child.widget); - child.widget->setGeometry(child.geometry); + child.sizable->setParent(parent); + child.sizable->setGeometry(child.geometry); } } -void FixedLayout::append(Widget &widget, const Geometry &geometry) { - children.append({ &widget, geometry }); +void FixedLayout::append(Sizable &sizable, const Geometry &geometry) { + children.append({ &sizable, geometry }); +} + +Geometry FixedLayout::minimumGeometry() { + unsigned width = MinimumSize, height = MinimumSize; + foreach(child, children) { + width = max(width, child.sizable->minimumGeometry().width); + height = max(height, child.sizable->minimumGeometry().height); + } + return { 0, 0, width, height }; } void FixedLayout::setGeometry(const Geometry &geometry) { } +void FixedLayout::setLayout(Layout &layout) { + this->layout = &layout; +} + void FixedLayout::setVisible(bool visible) { - foreach(child, children) child.widget->setVisible(visible); + visible_ = visible; + foreach(child, children) { + child.sizable->setVisible(dynamic_cast(child.sizable) ? child.sizable->visible() : visible); + } +} + +bool FixedLayout::visible() { + if(layout) return visible_ && layout->visible(); + return visible_; } FixedLayout::FixedLayout() { + layout = 0; + parent = 0; + visible_ = true; } diff --git a/bsnes/phoenix/core/layout/fixed-layout.hpp b/bsnes/phoenix/core/layout/fixed-layout.hpp index 9b4be043..f0dc7e23 100755 --- a/bsnes/phoenix/core/layout/fixed-layout.hpp +++ b/bsnes/phoenix/core/layout/fixed-layout.hpp @@ -1,14 +1,19 @@ struct FixedLayout : Layout { - void append(Widget &widget, const Geometry &geometry); + void append(Sizable &sizable, const Geometry &geometry); + Geometry minimumGeometry(); void setGeometry(const Geometry &geometry); + void setLayout(Layout &layout); void setParent(Window &parent); void setVisible(bool visible); + bool visible(); FixedLayout(); //private: + Layout *layout; Window *parent; + bool visible_; struct Children { - Widget *widget; + Sizable *sizable; Geometry geometry; }; nall::linear_vector children; diff --git a/bsnes/phoenix/core/layout/horizontal-layout.cpp b/bsnes/phoenix/core/layout/horizontal-layout.cpp index 7e4336f2..c80ea997 100755 --- a/bsnes/phoenix/core/layout/horizontal-layout.cpp +++ b/bsnes/phoenix/core/layout/horizontal-layout.cpp @@ -1,9 +1,6 @@ -void HorizontalLayout::append(VerticalLayout &layout, unsigned spacing) { - children.append({ &layout, 0, MinimumSize, MinimumSize, spacing }); -} - -void HorizontalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) { - children.append({ 0, &widget, width, height, spacing }); +void HorizontalLayout::append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing) { + sizable.setLayout(*this); + children.append({ &sizable, width, height, spacing }); } Geometry HorizontalLayout::minimumGeometry() { @@ -12,8 +9,7 @@ Geometry HorizontalLayout::minimumGeometry() { foreach(child, children) { width += child.spacing; if(child.width == MinimumSize || child.width == MaximumSize) { - if(child.layout) width += child.layout->minimumGeometry().width; - if(child.widget) width += child.widget->minimumGeometry().width; + width += child.sizable->minimumGeometry().width; continue; } width += child.width; @@ -21,8 +17,7 @@ Geometry HorizontalLayout::minimumGeometry() { foreach(child, children) { if(child.height == MinimumSize || child.height == MaximumSize) { - if(child.layout) height = max(height, child.layout->minimumGeometry().height); - if(child.widget) height = max(height, child.widget->minimumGeometry().height); + height = max(height, child.sizable->minimumGeometry().height); continue; } height = max(height, child.height); @@ -43,8 +38,7 @@ Geometry HorizontalLayout::minimumLayoutGeometry() { } if(child.width == MinimumSize) { - if(child.layout) width += child.layout->minimumGeometry().width; - if(child.widget) width += child.widget->minimumGeometry().width; + width += child.sizable->minimumGeometry().width; continue; } @@ -58,8 +52,7 @@ Geometry HorizontalLayout::minimumLayoutGeometry() { } if(child.height == MinimumSize) { - if(child.layout) height = max(height, child.layout->minimumGeometry().height); - if(child.widget) height = max(height, child.widget->minimumGeometry().height); + height = max(height, child.sizable->minimumGeometry().height); continue; } @@ -69,18 +62,15 @@ Geometry HorizontalLayout::minimumLayoutGeometry() { return { 0, 0, maximumWidth ? MaximumSize : margin * 2 + width, maximumHeight ? MaximumSize : margin * 2 + height }; } +void HorizontalLayout::setAlignment(double alignment) { + this->alignment = max(0.0, min(1.0, alignment)); +} + void HorizontalLayout::setGeometry(const Geometry &containerGeometry) { auto children = this->children; foreach(child, children) { - if(child.layout) { - child.width = child.layout->minimumLayoutGeometry().width; - child.height = child.layout->minimumLayoutGeometry().height; - } - - if(child.widget) { - if(child.width == MinimumSize) child.width = child.widget->minimumGeometry().width; - if(child.height == MinimumSize) child.height = child.widget->minimumGeometry().height; - } + if(child.width == MinimumSize) child.width = child.sizable->minimumGeometry().width; + if(child.height == MinimumSize) child.height = child.sizable->minimumGeometry().height; } Geometry geometry = containerGeometry; @@ -105,35 +95,44 @@ void HorizontalLayout::setGeometry(const Geometry &containerGeometry) { foreach(child, children) maximumHeight = max(maximumHeight, child.height); foreach(child, children) { - unsigned pivot = (maximumHeight - child.height) / 2; + unsigned pivot = (maximumHeight - child.height) * alignment; Geometry childGeometry = { geometry.x, geometry.y + pivot, child.width, child.height }; - - if(child.layout) child.layout->setGeometry(childGeometry); - if(child.widget) child.widget->setGeometry(childGeometry); + child.sizable->setGeometry(childGeometry); geometry.x += child.width + child.spacing; geometry.width -= child.width + child.spacing; } } +void HorizontalLayout::setLayout(Layout &layout) { + this->layout = &layout; +} + void HorizontalLayout::setMargin(unsigned margin) { this->margin = margin; } void HorizontalLayout::setParent(Window &parent) { foreach(child, children) { - if(child.layout) child.layout->setParent(parent); - if(child.widget) parent.append(*child.widget); + child.sizable->setParent(parent); } } void HorizontalLayout::setVisible(bool visible) { + visible_ = visible; foreach(child, children) { - if(child.layout) child.layout->setVisible(visible); - if(child.widget) child.widget->setVisible(visible); + child.sizable->setVisible(dynamic_cast(child.sizable) ? child.sizable->visible() : visible); } } -HorizontalLayout::HorizontalLayout() { - margin = 0; +bool HorizontalLayout::visible() { + if(layout) return visible_ && layout->visible(); + return visible_; +} + +HorizontalLayout::HorizontalLayout() { + alignment = 0.5; + layout = 0; + margin = 0; + visible_ = true; } diff --git a/bsnes/phoenix/core/layout/horizontal-layout.hpp b/bsnes/phoenix/core/layout/horizontal-layout.hpp index d8faf3f5..fa46a727 100755 --- a/bsnes/phoenix/core/layout/horizontal-layout.hpp +++ b/bsnes/phoenix/core/layout/horizontal-layout.hpp @@ -1,21 +1,25 @@ struct VerticalLayout; struct HorizontalLayout : public Layout { - void append(VerticalLayout &layout, unsigned spacing = 0); - void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0); - Geometry minimumLayoutGeometry(); + void append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing = 0); Geometry minimumGeometry(); + Geometry minimumLayoutGeometry(); + void setAlignment(double alignment); void setGeometry(const Geometry &geometry); + void setLayout(Layout &layout); void setMargin(unsigned margin); void setParent(Window &parent); void setVisible(bool visible); + bool visible(); HorizontalLayout(); //private: + double alignment; + Layout *layout; unsigned margin; + bool visible_; struct Children { - VerticalLayout *layout; - Widget *widget; + Sizable *sizable; unsigned width, height, spacing; }; nall::linear_vector children; diff --git a/bsnes/phoenix/core/layout/vertical-layout.cpp b/bsnes/phoenix/core/layout/vertical-layout.cpp index 373c8249..7e5d4528 100755 --- a/bsnes/phoenix/core/layout/vertical-layout.cpp +++ b/bsnes/phoenix/core/layout/vertical-layout.cpp @@ -1,9 +1,6 @@ -void VerticalLayout::append(HorizontalLayout &layout, unsigned spacing) { - children.append({ &layout, 0, MinimumSize, MinimumSize, spacing }); -} - -void VerticalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) { - children.append({ 0, &widget, width, height, spacing }); +void VerticalLayout::append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing) { + sizable.setLayout(*this); + children.append({ &sizable, width, height, spacing }); } Geometry VerticalLayout::minimumGeometry() { @@ -11,8 +8,7 @@ Geometry VerticalLayout::minimumGeometry() { foreach(child, children) { if(child.width == MinimumSize || child.width == MaximumSize) { - if(child.layout) width = max(width, child.layout->minimumGeometry().width); - if(child.widget) width = max(width, child.widget->minimumGeometry().width); + width = max(width, child.sizable->minimumGeometry().width); continue; } width = max(width, child.width); @@ -21,8 +17,7 @@ Geometry VerticalLayout::minimumGeometry() { foreach(child, children) { height += child.spacing; if(child.height == MinimumSize || child.height == MaximumSize) { - if(child.layout) height += child.layout->minimumGeometry().height; - if(child.widget) height += child.widget->minimumGeometry().height; + height += child.sizable->minimumGeometry().height; continue; } height += child.height; @@ -43,8 +38,7 @@ Geometry VerticalLayout::minimumLayoutGeometry() { } if(child.width == MinimumSize) { - if(child.layout) width = max(width, child.layout->minimumGeometry().width); - if(child.widget) width = max(width, child.widget->minimumGeometry().width); + width = max(width, child.sizable->minimumGeometry().width); continue; } @@ -58,8 +52,7 @@ Geometry VerticalLayout::minimumLayoutGeometry() { } if(child.height == MinimumSize) { - if(child.layout) height += child.layout->minimumGeometry().height; - if(child.widget) height += child.widget->minimumGeometry().height; + height += child.sizable->minimumGeometry().height; continue; } @@ -69,18 +62,15 @@ Geometry VerticalLayout::minimumLayoutGeometry() { return { 0, 0, maximumWidth ? MaximumSize : margin * 2 + width, maximumHeight ? MaximumSize : margin * 2 + height }; } +void VerticalLayout::setAlignment(double alignment) { + this->alignment = max(0.0, min(1.0, alignment)); +} + void VerticalLayout::setGeometry(const Geometry &containerGeometry) { auto children = this->children; foreach(child, children) { - if(child.layout) { - child.width = child.layout->minimumLayoutGeometry().width; - child.height = child.layout->minimumLayoutGeometry().height; - } - - if(child.widget) { - if(child.width == MinimumSize) child.width = child.widget->minimumGeometry().width; - if(child.height == MinimumSize) child.height = child.widget->minimumGeometry().height; - } + if(child.width == MinimumSize) child.width = child.sizable->minimumGeometry().width; + if(child.height == MinimumSize) child.height = child.sizable->minimumGeometry().height; } Geometry geometry = containerGeometry; @@ -105,35 +95,44 @@ void VerticalLayout::setGeometry(const Geometry &containerGeometry) { foreach(child, children) maximumWidth = max(maximumWidth, child.width); foreach(child, children) { - unsigned pivot = 0; //(maximumWidth - child.width) / 2; + unsigned pivot = (maximumWidth - child.width) * alignment; Geometry childGeometry = { geometry.x + pivot, geometry.y, child.width, child.height }; - - if(child.layout) child.layout->setGeometry(childGeometry); - if(child.widget) child.widget->setGeometry(childGeometry); + child.sizable->setGeometry(childGeometry); geometry.y += child.height + child.spacing; geometry.height -= child.height + child.spacing; } } +void VerticalLayout::setLayout(Layout &layout) { + this->layout = &layout; +} + void VerticalLayout::setMargin(unsigned margin) { this->margin = margin; } void VerticalLayout::setParent(Window &parent) { foreach(child, children) { - if(child.layout) child.layout->setParent(parent); - if(child.widget) parent.append(*child.widget); + child.sizable->setParent(parent); } } void VerticalLayout::setVisible(bool visible) { + visible_ = visible; foreach(child, children) { - if(child.layout) child.layout->setVisible(visible); - if(child.widget) child.widget->setVisible(visible); + child.sizable->setVisible(dynamic_cast(child.sizable) ? child.sizable->visible() : visible); } } -VerticalLayout::VerticalLayout() { - margin = 0; +bool VerticalLayout::visible() { + if(layout) return visible_ && layout->visible(); + return visible_; +} + +VerticalLayout::VerticalLayout() { + alignment = 0.0; + layout = 0; + margin = 0; + visible_ = true; } diff --git a/bsnes/phoenix/core/layout/vertical-layout.hpp b/bsnes/phoenix/core/layout/vertical-layout.hpp index a280c269..5c9dd95d 100755 --- a/bsnes/phoenix/core/layout/vertical-layout.hpp +++ b/bsnes/phoenix/core/layout/vertical-layout.hpp @@ -1,21 +1,25 @@ struct HorizontalLayout; struct VerticalLayout : public Layout { - void append(HorizontalLayout &layout, unsigned spacing = 0); - void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0); + void append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing = 0); Geometry minimumGeometry(); Geometry minimumLayoutGeometry(); + void setAlignment(double alignment); void setGeometry(const Geometry &geometry); + void setLayout(Layout &layout); void setMargin(unsigned margin); void setParent(Window &parent); void setVisible(bool visible); + bool visible(); VerticalLayout(); //private: + double alignment; + Layout *layout; unsigned margin; + bool visible_; struct Children { - HorizontalLayout *layout; - Widget *widget; + Sizable *sizable; unsigned width, height, spacing; }; nall::linear_vector children; diff --git a/bsnes/phoenix/core/state.hpp b/bsnes/phoenix/core/state.hpp index cbe6970c..37eb01b2 100755 --- a/bsnes/phoenix/core/state.hpp +++ b/bsnes/phoenix/core/state.hpp @@ -100,6 +100,8 @@ struct Widget::State { bool enabled; Font *font; Geometry geometry; + Layout *layout; + Window *parent; bool visible; State() { @@ -107,6 +109,8 @@ struct Widget::State { enabled = true; font = 0; geometry = { 0, 0, 0, 0 }; + layout = 0; + parent = 0; visible = true; } }; diff --git a/bsnes/phoenix/gtk/gtk.hpp b/bsnes/phoenix/gtk/gtk.hpp index bd2f19fd..dffc7c1d 100755 --- a/bsnes/phoenix/gtk/gtk.hpp +++ b/bsnes/phoenix/gtk/gtk.hpp @@ -186,6 +186,7 @@ struct pWidget : public pObject { virtual void setFocused(); virtual void setFont(Font &font); virtual void setGeometry(const Geometry &geometry); + void setParent(Window &parent); void setVisible(bool visible); pWidget(Widget &widget) : widget(widget) {} diff --git a/bsnes/phoenix/gtk/widget/button.cpp b/bsnes/phoenix/gtk/widget/button.cpp index f657bb06..35802d4f 100755 --- a/bsnes/phoenix/gtk/widget/button.cpp +++ b/bsnes/phoenix/gtk/widget/button.cpp @@ -15,4 +15,5 @@ void pButton::setText(const string &text) { void pButton::constructor() { gtkWidget = gtk_button_new(); g_signal_connect_swapped(G_OBJECT(gtkWidget), "clicked", G_CALLBACK(Button_tick), (gpointer)&button); +//g_object_ref((gpointer)gtkWidget); } diff --git a/bsnes/phoenix/gtk/widget/widget.cpp b/bsnes/phoenix/gtk/widget/widget.cpp index 62bb46f4..fe885ce2 100755 --- a/bsnes/phoenix/gtk/widget/widget.cpp +++ b/bsnes/phoenix/gtk/widget/widget.cpp @@ -38,8 +38,20 @@ void pWidget::setGeometry(const Geometry &geometry) { gtk_widget_set_size_request(gtkWidget, width, height); } +void pWidget::setParent(Window &parent) { + parentWindow = &parent.p; + + if(!widget.state.font && parent.state.widgetFont) { + setFont(*parent.state.widgetFont); + } + + gtk_fixed_put(GTK_FIXED(parent.p.formContainer), gtkWidget, 0, 0); + widget.setVisible(widget.visible()); +} + void pWidget::setVisible(bool visible) { if(widget.state.abstract) visible = false; + if(widget.state.layout && widget.state.layout->visible() == false) visible = false; gtk_widget_set_visible(gtkWidget, visible); } diff --git a/bsnes/phoenix/qt/qt.moc b/bsnes/phoenix/qt/qt.moc index 80c33bee..f2d15997 100755 --- a/bsnes/phoenix/qt/qt.moc +++ b/bsnes/phoenix/qt/qt.moc @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'qt.moc.hpp' ** -** Created: Mon Aug 8 04:51:19 2011 +** Created: Mon Aug 22 04:02:58 2011 ** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0) ** ** WARNING! All changes made in this file will be lost! diff --git a/bsnes/phoenix/qt/qt.moc.hpp b/bsnes/phoenix/qt/qt.moc.hpp index 36416b46..c9c5c6da 100755 --- a/bsnes/phoenix/qt/qt.moc.hpp +++ b/bsnes/phoenix/qt/qt.moc.hpp @@ -219,6 +219,7 @@ struct pWidget : public pObject { void setFocused(); void setFont(Font &font); virtual void setGeometry(const Geometry &geometry); + void setParent(Window &parent); void setVisible(bool visible); pWidget(Widget &widget) : widget(widget) {} diff --git a/bsnes/phoenix/qt/widget/widget.cpp b/bsnes/phoenix/qt/widget/widget.cpp index e9723fef..d79fc95f 100755 --- a/bsnes/phoenix/qt/widget/widget.cpp +++ b/bsnes/phoenix/qt/widget/widget.cpp @@ -23,8 +23,17 @@ void pWidget::setGeometry(const Geometry &geometry) { qtWidget->setGeometry(geometry.x, geometry.y, geometry.width, geometry.height); } +void pWidget::setParent(Window &parent) { + if(!widget.state.font && parent.state.widgetFont) { + setFont(*parent.state.widgetFont); + } + qtWidget->setParent(parent.p.qtContainer); + widget.setVisible(widget.visible()); +} + void pWidget::setVisible(bool visible) { if(widget.state.abstract) visible = false; + if(widget.state.layout && widget.state.layout->visible() == false) visible = false; qtWidget->setVisible(visible); } diff --git a/bsnes/phoenix/windows/widget/button.cpp b/bsnes/phoenix/windows/widget/button.cpp index 46696aa3..06b46d74 100755 --- a/bsnes/phoenix/windows/widget/button.cpp +++ b/bsnes/phoenix/windows/widget/button.cpp @@ -18,4 +18,5 @@ void pButton::setParent(Window &parent) { SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&button); setDefaultFont(); setText(button.state.text); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/canvas.cpp b/bsnes/phoenix/windows/widget/canvas.cpp index e5618666..9964b401 100755 --- a/bsnes/phoenix/windows/widget/canvas.cpp +++ b/bsnes/phoenix/windows/widget/canvas.cpp @@ -51,4 +51,5 @@ void pCanvas::setParent(Window &parent) { if(hwnd) DestroyWindow(hwnd); hwnd = CreateWindow(L"phoenix_canvas", L"", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&canvas); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/check-box.cpp b/bsnes/phoenix/windows/widget/check-box.cpp index 0f21b052..769f1870 100755 --- a/bsnes/phoenix/windows/widget/check-box.cpp +++ b/bsnes/phoenix/windows/widget/check-box.cpp @@ -30,4 +30,5 @@ void pCheckBox::setParent(Window &parent) { setDefaultFont(); if(checkBox.state.checked) setChecked(true); setText(checkBox.state.text); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/combo-box.cpp b/bsnes/phoenix/windows/widget/combo-box.cpp index 88d81264..b2cf049a 100755 --- a/bsnes/phoenix/windows/widget/combo-box.cpp +++ b/bsnes/phoenix/windows/widget/combo-box.cpp @@ -46,4 +46,5 @@ void pComboBox::setParent(Window &parent) { setDefaultFont(); foreach(text, comboBox.state.text) append(text); setSelection(comboBox.state.selection); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/hex-edit.cpp b/bsnes/phoenix/windows/widget/hex-edit.cpp index a9936e1b..5c5d2117 100755 --- a/bsnes/phoenix/windows/widget/hex-edit.cpp +++ b/bsnes/phoenix/windows/widget/hex-edit.cpp @@ -128,4 +128,5 @@ void pHexEdit::setParent(Window &parent) { windowProc = (LRESULT CALLBACK (*)(HWND, UINT, LPARAM, WPARAM))GetWindowLongPtr(hwnd, GWLP_WNDPROC); SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)HexEdit_windowProc); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp b/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp index cdf93056..e55490fd 100755 --- a/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp +++ b/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp @@ -30,4 +30,5 @@ void pHorizontalScrollBar::setParent(Window &parent) { unsigned position = horizontalScrollBar.state.position; setLength(horizontalScrollBar.state.length); setPosition(position); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/horizontal-slider.cpp b/bsnes/phoenix/windows/widget/horizontal-slider.cpp index 5359921c..a242a9c1 100755 --- a/bsnes/phoenix/windows/widget/horizontal-slider.cpp +++ b/bsnes/phoenix/windows/widget/horizontal-slider.cpp @@ -31,4 +31,5 @@ void pHorizontalSlider::setParent(Window &parent) { unsigned position = horizontalSlider.state.position; setLength(horizontalSlider.state.length); setPosition(position); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/label.cpp b/bsnes/phoenix/windows/widget/label.cpp index dc40ed61..1e30636d 100755 --- a/bsnes/phoenix/windows/widget/label.cpp +++ b/bsnes/phoenix/windows/widget/label.cpp @@ -19,6 +19,7 @@ void pLabel::setParent(Window &parent) { SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&label); setDefaultFont(); setText(label.state.text); + widget.setVisible(widget.visible()); } static LRESULT CALLBACK Label_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { diff --git a/bsnes/phoenix/windows/widget/line-edit.cpp b/bsnes/phoenix/windows/widget/line-edit.cpp index de54470d..35802104 100755 --- a/bsnes/phoenix/windows/widget/line-edit.cpp +++ b/bsnes/phoenix/windows/widget/line-edit.cpp @@ -37,4 +37,5 @@ void pLineEdit::setParent(Window &parent) { setDefaultFont(); setEditable(lineEdit.state.editable); setText(lineEdit.state.text); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/list-view.cpp b/bsnes/phoenix/windows/widget/list-view.cpp index 92a4f751..925bbeda 100755 --- a/bsnes/phoenix/windows/widget/list-view.cpp +++ b/bsnes/phoenix/windows/widget/list-view.cpp @@ -131,4 +131,5 @@ void pListView::setParent(Window &parent) { foreach(checked, listView.state.checked, n) setChecked(n, checked); if(listView.state.selected) setSelection(listView.state.selection); autoSizeColumns(); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/progress-bar.cpp b/bsnes/phoenix/windows/widget/progress-bar.cpp index 46e65d18..fdd3ef4e 100755 --- a/bsnes/phoenix/windows/widget/progress-bar.cpp +++ b/bsnes/phoenix/windows/widget/progress-bar.cpp @@ -17,4 +17,5 @@ void pProgressBar::setParent(Window &parent) { SendMessage(hwnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); SendMessage(hwnd, PBM_SETSTEP, MAKEWPARAM(1, 0), 0); setPosition(progressBar.state.position); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/radio-box.cpp b/bsnes/phoenix/windows/widget/radio-box.cpp index b135f87e..e24afcbe 100755 --- a/bsnes/phoenix/windows/widget/radio-box.cpp +++ b/bsnes/phoenix/windows/widget/radio-box.cpp @@ -35,4 +35,5 @@ void pRadioBox::setParent(Window &parent) { setDefaultFont(); if(radioBox.state.checked) setChecked(); setText(radioBox.state.text); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/text-edit.cpp b/bsnes/phoenix/windows/widget/text-edit.cpp index a1a42fe5..f0552ca1 100755 --- a/bsnes/phoenix/windows/widget/text-edit.cpp +++ b/bsnes/phoenix/windows/widget/text-edit.cpp @@ -50,4 +50,5 @@ void pTextEdit::setParent(Window &parent) { setCursorPosition(textEdit.state.cursorPosition); setEditable(textEdit.state.editable); setText(textEdit.state.text); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp b/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp index 991c9746..025eb127 100755 --- a/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp +++ b/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp @@ -30,4 +30,5 @@ void pVerticalScrollBar::setParent(Window &parent) { unsigned position = verticalScrollBar.state.position; setLength(verticalScrollBar.state.length); setPosition(position); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/vertical-slider.cpp b/bsnes/phoenix/windows/widget/vertical-slider.cpp index 8fa8e569..1e520b7c 100755 --- a/bsnes/phoenix/windows/widget/vertical-slider.cpp +++ b/bsnes/phoenix/windows/widget/vertical-slider.cpp @@ -31,4 +31,5 @@ void pVerticalSlider::setParent(Window &parent) { unsigned position = verticalSlider.state.position; setLength(verticalSlider.state.length); setPosition(position); + widget.setVisible(widget.visible()); } diff --git a/bsnes/phoenix/windows/widget/viewport.cpp b/bsnes/phoenix/windows/widget/viewport.cpp index 0c139ef8..fea7f2a3 100755 --- a/bsnes/phoenix/windows/widget/viewport.cpp +++ b/bsnes/phoenix/windows/widget/viewport.cpp @@ -9,6 +9,7 @@ void pViewport::constructor() { void pViewport::setParent(Window &parent) { hwnd = CreateWindow(L"phoenix_viewport", L"", WS_CHILD | WS_VISIBLE | WS_DISABLED, 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&viewport); + widget.setVisible(widget.visible()); } static LRESULT CALLBACK Viewport_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { diff --git a/bsnes/phoenix/windows/widget/widget.cpp b/bsnes/phoenix/windows/widget/widget.cpp index 81f984f7..50423b74 100755 --- a/bsnes/phoenix/windows/widget/widget.cpp +++ b/bsnes/phoenix/windows/widget/widget.cpp @@ -29,6 +29,7 @@ void pWidget::setGeometry(const Geometry &geometry) { void pWidget::setVisible(bool visible) { if(widget.state.abstract) visible = false; + if(widget.state.layout && widget.state.layout->visible() == false) visible = false; ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE); } @@ -49,4 +50,5 @@ void pWidget::setParent(Window &parent) { if(hwnd) DestroyWindow(hwnd); hwnd = CreateWindow(L"phoenix_label", L"", WS_CHILD, 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&widget); + widget.setVisible(false); } diff --git a/bsnes/snes/snes.hpp b/bsnes/snes/snes.hpp index befdc5ab..a401dd69 100755 --- a/bsnes/snes/snes.hpp +++ b/bsnes/snes/snes.hpp @@ -1,7 +1,7 @@ namespace SNES { namespace Info { static const char Name[] = "bsnes"; - static const char Version[] = "082"; + static const char Version[] = "082.01"; static const unsigned SerializerVersion = 21; } } diff --git a/bsnes/ui-libsnes/libsnes.cpp b/bsnes/ui-libsnes/libsnes.cpp index c3cc3b16..4b4dd373 100755 --- a/bsnes/ui-libsnes/libsnes.cpp +++ b/bsnes/ui-libsnes/libsnes.cpp @@ -199,8 +199,12 @@ bool snes_load_cartridge_super_game_boy( if(rom_data) SNES::cartridge.rom.copy(rom_data, rom_size); string xmlrom = (rom_xml && *rom_xml) ? string(rom_xml) : SNESCartridge(rom_data, rom_size).xmlMemoryMap; if(dmg_data) { - string xmldmg = (dmg_xml && *dmg_xml) ? string(dmg_xml) : GameBoyCartridge(dmg_data, dmg_size).xml; - GameBoy::cartridge.load(xmldmg, dmg_data, dmg_size); + //GameBoyCartridge needs to modify dmg_data (for MMM01 emulation); so copy data + uint8_t *data = new uint8_t[dmg_size]; + memcpy(data, dmg_data, dmg_size); + string xmldmg = (dmg_xml && *dmg_xml) ? string(dmg_xml) : GameBoyCartridge(data, dmg_size).xml; + GameBoy::cartridge.load(xmldmg, data, dmg_size); + delete[] data; } SNES::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, { xmlrom, "" }); SNES::system.power(); diff --git a/bsnes/ui/debugger/console.cpp b/bsnes/ui/debugger/console.cpp index 09e75e75..17063b88 100755 --- a/bsnes/ui/debugger/console.cpp +++ b/bsnes/ui/debugger/console.cpp @@ -22,7 +22,7 @@ void Console::create() { controlLayout.append(traceSMP, 120, 0 ); controlLayout.append(spacer, 120, ~0 ); controlLayout.append(clearConsole, 120, 0 ); - layout.append(controlLayout ); + layout.append(controlLayout, 0, ~0 ); append(layout); setGeometry({ 0, 0, layout.minimumGeometry().width + 585, 350 }); diff --git a/bsnes/ui/debugger/cpu/debugger.cpp b/bsnes/ui/debugger/cpu/debugger.cpp index bcdf8392..f6507290 100755 --- a/bsnes/ui/debugger/cpu/debugger.cpp +++ b/bsnes/ui/debugger/cpu/debugger.cpp @@ -17,7 +17,7 @@ void CPUDebugger::create() { controlLayout.append(stepOver, 80, 0 ); controlLayout.append(proceed, 80, 0 ); controlLayout.append(spacer, 80, ~0 ); - layout.append(controlLayout ); + layout.append(controlLayout, 0, ~0 ); append(layout); setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 }); diff --git a/bsnes/ui/debugger/smp/debugger.cpp b/bsnes/ui/debugger/smp/debugger.cpp index 2eb98599..efda728d 100755 --- a/bsnes/ui/debugger/smp/debugger.cpp +++ b/bsnes/ui/debugger/smp/debugger.cpp @@ -17,7 +17,7 @@ void SMPDebugger::create() { controlLayout.append(stepOver, 80, 0 ); controlLayout.append(proceed, 80, 0 ); controlLayout.append(spacer, 80, ~0 ); - layout.append(controlLayout ); + layout.append(controlLayout, 0, ~0 ); append(layout); setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 }); diff --git a/bsnes/ui/debugger/tools/breakpoint-editor.cpp b/bsnes/ui/debugger/tools/breakpoint-editor.cpp index edffcc0d..5da7c98f 100755 --- a/bsnes/ui/debugger/tools/breakpoint-editor.cpp +++ b/bsnes/ui/debugger/tools/breakpoint-editor.cpp @@ -26,7 +26,7 @@ void BreakpointEditor::create() { breakpointLayout[n].append(valueBox[n], 30, 0, 5); breakpointLayout[n].append(typeBox[n], 0, 0, 5); breakpointLayout[n].append(sourceBox[n], 0, 0 ); - layout.append(breakpointLayout[n], n < Breakpoints - 1 ? 5 : 0); + layout.append(breakpointLayout[n], ~0, 0, n < Breakpoints - 1 ? 5 : 0); } append(layout); diff --git a/bsnes/ui/debugger/tools/memory-editor.cpp b/bsnes/ui/debugger/tools/memory-editor.cpp index ed92d9a9..a59ba846 100755 --- a/bsnes/ui/debugger/tools/memory-editor.cpp +++ b/bsnes/ui/debugger/tools/memory-editor.cpp @@ -20,7 +20,7 @@ void MemoryEditor::create() { controlLayout.append(gotoBox, 80, 0 ); controlLayout.append(refreshButton, 80, 0 ); controlLayout.append(spacer, 80, ~0 ); - layout.append(controlLayout ); + layout.append(controlLayout, 0, ~0 ); append(layout); setGeometry({ 0, 0, layout.minimumGeometry().width + 475, 230 }); diff --git a/bsnes/ui/general/about-window.cpp b/bsnes/ui/general/about-window.cpp index 0f6cdd93..b4216c7c 100755 --- a/bsnes/ui/general/about-window.cpp +++ b/bsnes/ui/general/about-window.cpp @@ -17,7 +17,7 @@ void AboutWindow::create() { layout.append(canvas, 720, 180); informationLayout.append(spacer, ~0, 0); informationLayout.append(information, 0, 0); - layout.append(informationLayout); + layout.append(informationLayout, ~0, 0); append(layout); setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height }); } diff --git a/bsnes/ui/general/file-browser.cpp b/bsnes/ui/general/file-browser.cpp index 07587bf1..479d77c1 100755 --- a/bsnes/ui/general/file-browser.cpp +++ b/bsnes/ui/general/file-browser.cpp @@ -12,7 +12,7 @@ void FileBrowser::create() { pathLayout.append(pathBox, ~0, 0, 5); pathLayout.append(browseButton, sq, sq, 5); pathLayout.append(upButton, sq, sq ); - layout.append(pathLayout, 5); + layout.append(pathLayout, ~0, 0, 5); layout.append(contentsBox, ~0, ~0 ); append(layout); setGeometry({ 0, 0, 640, layout.minimumGeometry().height + 400 }); diff --git a/bsnes/ui/general/slot-loader.cpp b/bsnes/ui/general/slot-loader.cpp index 93efc3f0..3adf9fd8 100755 --- a/bsnes/ui/general/slot-loader.cpp +++ b/bsnes/ui/general/slot-loader.cpp @@ -16,14 +16,14 @@ void SingleSlotLoader::create() { baseLayout.append(baseLabel, 40, 0, 5); baseLayout.append(basePath, ~0, 0, 5); baseLayout.append(baseBrowse, sq, sq ); - layout.append(baseLayout, 5); + layout.append(baseLayout, ~0, 0, 5); slotLayout.append(slotLabel, 40, 0, 5); slotLayout.append(slotPath, ~0, 0, 5); slotLayout.append(slotBrowse, sq, sq ); - layout.append(slotLayout, 5); + layout.append(slotLayout, ~0, 0, 5); controlLayout.append(spacer, ~0, 0 ); controlLayout.append(okButton, 80, 0 ); - layout.append(controlLayout); + layout.append(controlLayout, ~0, 0 ); append(layout); setGeometry({ 0, 0, 480, layout.minimumGeometry().height }); @@ -111,18 +111,18 @@ void DoubleSlotLoader::create() { baseLayout.append(baseLabel, 40, 0, 5); baseLayout.append(basePath, ~0, 0, 5); baseLayout.append(baseBrowse, sq, sq ); - layout.append(baseLayout, 5); + layout.append(baseLayout, ~0, 0, 5); slotALayout.append(slotALabel, 40, 0, 5); slotALayout.append(slotAPath, ~0, 0, 5); slotALayout.append(slotABrowse, sq, sq ); - layout.append(slotALayout, 5); + layout.append(slotALayout, ~0, 0, 5); slotBLayout.append(slotBLabel, 40, 0, 5); slotBLayout.append(slotBPath, ~0, 0, 5); slotBLayout.append(slotBBrowse, sq, sq ); - layout.append(slotBLayout, 5); + layout.append(slotBLayout, ~0, 0, 5); controlLayout.append(spacer, ~0, 0 ); controlLayout.append(okButton, 80, 0 ); - layout.append(controlLayout); + layout.append(controlLayout, ~0, 0 ); append(layout); setGeometry({ 0, 0, 480, layout.minimumGeometry().height }); diff --git a/bsnes/ui/main.cpp b/bsnes/ui/main.cpp index bb8310d8..8391d119 100755 --- a/bsnes/ui/main.cpp +++ b/bsnes/ui/main.cpp @@ -188,11 +188,21 @@ void Application::loadGeometry() { foreach(window, windows) { lstring position; position.split(",", window->position); - Geometry geom = window->geometry(); - window->setGeometry({ + Geometry configGeometry = { (signed)integer(position[0]), (signed)integer(position[1]), - geom.width, geom.height - //(unsigned)decimal(position[2]), (unsigned)decimal(position[3]) + (unsigned)decimal(position[2]), (unsigned)decimal(position[3]) + }; + Geometry windowGeometry = window->geometry(); + + //Windows places minimized windows offscreen at 32000,32000 + //this is a fix for older releases that did not compensate for this + if(configGeometry.x >= 30000) configGeometry.x = 128; + if(configGeometry.y >= 30000) configGeometry.y = 128; + + window->setGeometry({ + configGeometry.x, configGeometry.y, + windowGeometry.width, windowGeometry.height + //configGeometry.width, configGeometry.height }); } } diff --git a/bsnes/ui/settings/advanced.cpp b/bsnes/ui/settings/advanced.cpp index a074f7d9..21a70180 100755 --- a/bsnes/ui/settings/advanced.cpp +++ b/bsnes/ui/settings/advanced.cpp @@ -31,7 +31,7 @@ void AdvancedSettings::create() { panelLayout.setMargin(5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); - panelLayout.append(layout); + panelLayout.append(layout, ~0, ~0); layout.append(title, ~0, 0, 5); @@ -41,18 +41,18 @@ void AdvancedSettings::create() { driverLayout.append(audioDriverLabel, 0, 0, 5); driverLayout.append(audioDriverBox, ~0, 0, 5); driverLayout.append(inputDriverLabel, 0, 0, 5); - driverLayout.append(inputDriverBox, ~0, 0 ); - layout.append(driverLayout, 5); - layout.append(focusPolicyLabel, ~0, 0 ); + driverLayout.append(inputDriverBox, ~0, 0); + layout.append(driverLayout, ~0, 0, 5); + layout.append(focusPolicyLabel, ~0, 0); focusPolicyLayout.append(focusPolicyPause, ~0, 0, 5); focusPolicyLayout.append(focusPolicyIgnore, ~0, 0, 5); focusPolicyLayout.append(focusPolicyAllow, ~0, 0); - layout.append(focusPolicyLayout, 5); + layout.append(focusPolicyLayout, ~0, 0, 5); layout.append(compositorPolicyLabel, ~0, 0); compositorPolicyLayout.append(compositorPolicyNever, ~0, 0, 5); compositorPolicyLayout.append(compositorPolicyFullScreen, ~0, 0, 5); compositorPolicyLayout.append(compositorPolicyAlways, ~0, 0); - layout.append(compositorPolicyLayout); + layout.append(compositorPolicyLayout, ~0, 0); layout.append(spacer, ~0, ~0); settingsWindow.append(panelLayout); diff --git a/bsnes/ui/settings/audio.cpp b/bsnes/ui/settings/audio.cpp index 20fc6b6a..dca723e6 100755 --- a/bsnes/ui/settings/audio.cpp +++ b/bsnes/ui/settings/audio.cpp @@ -13,24 +13,24 @@ void AudioSettings::create() { panelLayout.setMargin(5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); - panelLayout.append(layout); + panelLayout.append(layout, ~0, ~0); layout.append(title, ~0, 0, 5); frequencyLayout.append(frequencyLabel, 70, 0); frequencyLayout.append(frequencyValue, 60, 0); frequencyLayout.append(frequencySlider, ~0, 0); - layout.append(frequencyLayout); + layout.append(frequencyLayout, ~0, 0); volumeLayout.append(volumeLabel, 70, 0); volumeLayout.append(volumeValue, 60, 0); volumeLayout.append(volumeSlider, ~0, 0); - layout.append(volumeLayout); + layout.append(volumeLayout, ~0, 0); balanceLayout.append(balanceLabel, 70, 0); balanceLayout.append(balanceValue, 60, 0); balanceLayout.append(balanceSlider, ~0, 0); - layout.append(balanceLayout); + layout.append(balanceLayout, ~0, 0); layout.append(spacer, ~0, ~0); settingsWindow.append(panelLayout); diff --git a/bsnes/ui/settings/input.cpp b/bsnes/ui/settings/input.cpp index c008c676..1fd6bfb7 100755 --- a/bsnes/ui/settings/input.cpp +++ b/bsnes/ui/settings/input.cpp @@ -23,7 +23,7 @@ void InputSettings::create() { panelLayout.setMargin(5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); - panelLayout.append(layout); + panelLayout.append(layout, ~0, ~0); layout.append(title, ~0, 0, 5); @@ -31,7 +31,7 @@ void InputSettings::create() { selectionLayout.append(portBox, ~0, 0, 5); selectionLayout.append(deviceLabel, 0, 0, 5); selectionLayout.append(deviceBox, ~0, 0); - layout.append(selectionLayout, 5); + layout.append(selectionLayout, ~0, 0, 5); layout.append(mappingList, ~0, ~0, 5); @@ -40,7 +40,7 @@ void InputSettings::create() { controlLayout.append(customButton3, 100, 0, 5); controlLayout.append(spacer, ~0, 0); controlLayout.append(clearButton, 80, 0); - layout.append(controlLayout); + layout.append(controlLayout, ~0, 0); settingsWindow.append(panelLayout); clearButton.setEnabled(false); diff --git a/bsnes/ui/settings/video.cpp b/bsnes/ui/settings/video.cpp index 6824341c..53243ad8 100755 --- a/bsnes/ui/settings/video.cpp +++ b/bsnes/ui/settings/video.cpp @@ -22,7 +22,7 @@ void VideoSettings::create() { panelLayout.setMargin(5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); - panelLayout.append(layout); + panelLayout.append(layout, ~0, ~0); layout.append(title, ~0, 0, 5); @@ -30,21 +30,21 @@ void VideoSettings::create() { brightnessLayout.append(brightnessLabel, 80, 0 ); brightnessLayout.append(brightnessValue, 50, 0 ); brightnessLayout.append(brightnessSlider, ~0, 0 ); - layout.append(brightnessLayout ); + layout.append(brightnessLayout, ~0, 0 ); contrastLayout.append(contrastLabel, 80, 0 ); contrastLayout.append(contrastValue, 50, 0 ); contrastLayout.append(contrastSlider, ~0, 0 ); - layout.append(contrastLayout ); + layout.append(contrastLayout, ~0, 0 ); gammaLayout.append(gammaLabel, 80, 0 ); gammaLayout.append(gammaValue, 50, 0 ); gammaLayout.append(gammaSlider, ~0, 0 ); - layout.append(gammaLayout ); + layout.append(gammaLayout, ~0, 0 ); layout.append(gammaRampCheck, ~0, 0, 5); layout.append(fullscreenLabel, ~0, 0 ); fullscreenLayout.append(fullscreenCenter, ~0, 0, 5); fullscreenLayout.append(fullscreenScale, ~0, 0, 5); fullscreenLayout.append(fullscreenStretch, ~0, 0 ); - layout.append(fullscreenLayout); + layout.append(fullscreenLayout, ~0, 0 ); layout.append(spacer, ~0, ~0); settingsWindow.append(panelLayout); diff --git a/bsnes/ui/tools/cheat-database.cpp b/bsnes/ui/tools/cheat-database.cpp index a09ddbd9..81af960f 100755 --- a/bsnes/ui/tools/cheat-database.cpp +++ b/bsnes/ui/tools/cheat-database.cpp @@ -14,7 +14,7 @@ void CheatDatabase::create() { controlLayout.append(unselectAllButton, 100, 0 ); controlLayout.append(spacerWidget, ~0, 0 ); controlLayout.append(okButton, 80, 0 ); - layout.append(controlLayout ); + layout.append(controlLayout, ~0, 0 ); append(layout); setGeometry({ 0, 0, 600, layout.minimumGeometry().height + 350 }); diff --git a/bsnes/ui/tools/cheat-editor.cpp b/bsnes/ui/tools/cheat-editor.cpp index 38d00296..9693bbec 100755 --- a/bsnes/ui/tools/cheat-editor.cpp +++ b/bsnes/ui/tools/cheat-editor.cpp @@ -1,5 +1,48 @@ CheatEditor cheatEditor; +void CheatEditor::create() { + setTitle("Cheat Editor"); + application.addWindow(this, "CheatEditor", "160,160"); + + cheatList.setHeaderText("Slot", "Code", "Description"); + cheatList.setHeaderVisible(); + cheatList.setCheckable(); + codeLabel.setText("Code(s):"); + descLabel.setText("Description:"); + findButton.setText("Find Codes ..."); + clearAllButton.setText("Clear All"); + clearButton.setText("Clear"); + + layout.setMargin(5); + layout.append(cheatList, ~0, ~0, 5); + codeLayout.append(codeLabel, 80, 0, 5); + codeLayout.append(codeEdit, ~0, 0 ); + layout.append(codeLayout, ~0, 0, 5); + descLayout.append(descLabel, 80, 0, 5); + descLayout.append(descEdit, ~0, 0 ); + layout.append(descLayout, ~0, 0, 5); + controlLayout.append(findButton, 100, 0 ); + controlLayout.append(spacerWidget, ~0, 0 ); + controlLayout.append(clearAllButton, 80, 0, 5); + controlLayout.append(clearButton, 80, 0 ); + layout.append(controlLayout, ~0, 0 ); + append(layout); + setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 }); + + synchronize(); + + cheatList.onChange = { &CheatEditor::synchronize, this }; + cheatList.onTick = { &CheatEditor::toggle, this }; + codeEdit.onChange = descEdit.onChange = { &CheatEditor::bind, this }; + findButton.onTick = { &CheatDatabase::findCodes, &cheatDatabase }; + clearAllButton.onTick = { &CheatEditor::clearAll, this }; + clearButton.onTick = { &CheatEditor::clear, this }; + + onClose = []() { + cheatDatabase.setVisible(false); + }; +} + void CheatEditor::load() { SNES::cheat.reset(); cheatList.reset(); @@ -78,49 +121,6 @@ void CheatEditor::save() { cheatList.autoSizeColumns(); } -void CheatEditor::create() { - setTitle("Cheat Editor"); - application.addWindow(this, "CheatEditor", "160,160"); - - cheatList.setHeaderText("Slot", "Code", "Description"); - cheatList.setHeaderVisible(); - cheatList.setCheckable(); - codeLabel.setText("Code(s):"); - descLabel.setText("Description:"); - findButton.setText("Find Codes ..."); - clearAllButton.setText("Clear All"); - clearButton.setText("Clear"); - - layout.setMargin(5); - layout.append(cheatList, ~0, ~0, 5); - codeLayout.append(codeLabel, 80, 0, 5); - codeLayout.append(codeEdit, ~0, 0 ); - layout.append(codeLayout, 5); - descLayout.append(descLabel, 80, 0, 5); - descLayout.append(descEdit, ~0, 0 ); - layout.append(descLayout, 5); - controlLayout.append(findButton, 100, 0 ); - controlLayout.append(spacerWidget, ~0, 0 ); - controlLayout.append(clearAllButton, 80, 0, 5); - controlLayout.append(clearButton, 80, 0 ); - layout.append(controlLayout); - append(layout); - setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 }); - - synchronize(); - - cheatList.onChange = { &CheatEditor::synchronize, this }; - cheatList.onTick = { &CheatEditor::toggle, this }; - codeEdit.onChange = descEdit.onChange = { &CheatEditor::bind, this }; - findButton.onTick = { &CheatDatabase::findCodes, &cheatDatabase }; - clearAllButton.onTick = { &CheatEditor::clearAll, this }; - clearButton.onTick = { &CheatEditor::clear, this }; - - onClose = []() { - cheatDatabase.setVisible(false); - }; -} - void CheatEditor::synchronize() { findButton.setEnabled(SNES::cartridge.loaded()); clearAllButton.setEnabled(SNES::cartridge.loaded()); diff --git a/bsnes/ui/tools/state-manager.cpp b/bsnes/ui/tools/state-manager.cpp index 39d95d20..ad515c7e 100755 --- a/bsnes/ui/tools/state-manager.cpp +++ b/bsnes/ui/tools/state-manager.cpp @@ -15,12 +15,12 @@ void StateManager::create() { layout.append(stateList, ~0, ~0, 5); descLayout.append(descLabel, 80, 0, 5); descLayout.append(descEdit, ~0, 0 ); - layout.append(descLayout, 5); + layout.append(descLayout, ~0, 0, 5); controlLayout.append(spacer, 0, 0 ); controlLayout.append(loadButton, 80, 0, 5); controlLayout.append(saveButton, 80, 0, 5); controlLayout.append(eraseButton, 80, 0 ); - layout.append(controlLayout ); + layout.append(controlLayout, ~0, 0 ); append(layout); setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });