Update to v082r01 release.

byuu says:

Changelog:
- if config file window coordinates are >= 30000, it snaps them back to
  128,128; should end the "why aren't windows visible?" posts
- updated GUI code to match new phoenix changes
- phoenix: Layout and Widget inherit from Sizable; directional layouts
  make no distinction between widgets and layouts
- phoenix: individual widgets / layout can maintain visible/hidden
  status in spite of their parents' visibility
This commit is contained in:
Tim Allen
2011-08-22 21:27:04 +10:00
parent e8775319c8
commit d8f9204e18
51 changed files with 281 additions and 174 deletions

View File

@@ -5,6 +5,7 @@ gameboy := gameboy
profile := accuracy profile := accuracy
ui := ui ui := ui
# options += console
# options += debugger # options += debugger
# compiler # compiler
@@ -25,21 +26,20 @@ else ifeq ($(pgo),optimize)
flags += -fprofile-use flags += -fprofile-use
endif endif
flags := $(flags) $(foreach o,$(call strupper,$(options)),-D$o)
# platform # platform
ifeq ($(platform),x) ifeq ($(platform),x)
link += -s -ldl -lX11 -lXext link += -s -ldl -lX11 -lXext
else ifeq ($(platform),osx) else ifeq ($(platform),osx)
else ifeq ($(platform),win) else ifeq ($(platform),win)
link += -mwindows link += $(if $(findstring console,$(options)),-mconsole,-mwindows)
# link += -mconsole
link += -mthreads -s -luuid -lkernel32 -luser32 -lgdi32 -lcomctl32 -lcomdlg32 -lshell32 -lole32 link += -mthreads -s -luuid -lkernel32 -luser32 -lgdi32 -lcomctl32 -lcomdlg32 -lshell32 -lole32
link += -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc link += -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
else else
unknown_platform: help; unknown_platform: help;
endif endif
flags := $(flags) $(foreach o,$(call strupper,$(options)),-D$o)
# implicit rules # implicit rules
compile = \ compile = \
$(strip \ $(strip \

View File

@@ -100,6 +100,8 @@ void Widget::setEnabled(bool enabled) { state.enabled = enabled; return p.setEna
void Widget::setFocused() { return p.setFocused(); } void Widget::setFocused() { return p.setFocused(); }
void Widget::setFont(Font &font) { state.font = &font; return p.setFont(font); } 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::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); } void Widget::setVisible(bool visible) { state.visible = visible; return p.setVisible(visible); }
bool Widget::visible() { return state.visible; } bool Widget::visible() { return state.visible; }
Widget::Widget() : state(*new State), p(*new pWidget(*this)) { state.abstract = true; p.constructor(); } Widget::Widget() : state(*new State), p(*new pWidget(*this)) { state.abstract = true; p.constructor(); }

View File

@@ -223,13 +223,21 @@ struct RadioItem : private nall::base_from_member<pRadioItem&>, Action {
pRadioItem &p; pRadioItem &p;
}; };
struct Layout : Object { struct Layout;
struct Sizable : Object {
virtual Geometry minimumGeometry() = 0;
virtual void setGeometry(const Geometry &geometry) = 0; virtual void setGeometry(const Geometry &geometry) = 0;
virtual void setLayout(Layout &layout) = 0;
virtual void setParent(Window &parent) = 0; virtual void setParent(Window &parent) = 0;
virtual void setVisible(bool visible = true) = 0; virtual void setVisible(bool visible = true) = 0;
virtual bool visible() = 0;
}; };
struct Widget : Object { struct Layout : Sizable {
};
struct Widget : Sizable {
bool enabled(); bool enabled();
Font& font(); Font& font();
Geometry geometry(); Geometry geometry();
@@ -238,6 +246,8 @@ struct Widget : Object {
void setFocused(); void setFocused();
void setFont(Font &font); void setFont(Font &font);
void setGeometry(const Geometry &geometry); void setGeometry(const Geometry &geometry);
void setLayout(Layout &layout);
void setParent(Window &parent);
void setVisible(bool visible = true); void setVisible(bool visible = true);
bool visible(); bool visible();

View File

@@ -1,20 +1,44 @@
void FixedLayout::setParent(Window &parent) { void FixedLayout::setParent(Window &parent) {
foreach(child, children) { foreach(child, children) {
parent.append(*child.widget); child.sizable->setParent(parent);
child.widget->setGeometry(child.geometry); child.sizable->setGeometry(child.geometry);
} }
} }
void FixedLayout::append(Widget &widget, const Geometry &geometry) { void FixedLayout::append(Sizable &sizable, const Geometry &geometry) {
children.append({ &widget, 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::setGeometry(const Geometry &geometry) {
} }
void FixedLayout::setLayout(Layout &layout) {
this->layout = &layout;
}
void FixedLayout::setVisible(bool visible) { void FixedLayout::setVisible(bool visible) {
foreach(child, children) child.widget->setVisible(visible); visible_ = visible;
foreach(child, children) {
child.sizable->setVisible(dynamic_cast<Widget*>(child.sizable) ? child.sizable->visible() : visible);
}
}
bool FixedLayout::visible() {
if(layout) return visible_ && layout->visible();
return visible_;
} }
FixedLayout::FixedLayout() { FixedLayout::FixedLayout() {
layout = 0;
parent = 0;
visible_ = true;
} }

View File

@@ -1,14 +1,19 @@
struct FixedLayout : Layout { 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 setGeometry(const Geometry &geometry);
void setLayout(Layout &layout);
void setParent(Window &parent); void setParent(Window &parent);
void setVisible(bool visible); void setVisible(bool visible);
bool visible();
FixedLayout(); FixedLayout();
//private: //private:
Layout *layout;
Window *parent; Window *parent;
bool visible_;
struct Children { struct Children {
Widget *widget; Sizable *sizable;
Geometry geometry; Geometry geometry;
}; };
nall::linear_vector<Children> children; nall::linear_vector<Children> children;

View File

@@ -1,9 +1,6 @@
void HorizontalLayout::append(VerticalLayout &layout, unsigned spacing) { void HorizontalLayout::append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing) {
children.append({ &layout, 0, MinimumSize, MinimumSize, spacing }); sizable.setLayout(*this);
} children.append({ &sizable, width, height, spacing });
void HorizontalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
children.append({ 0, &widget, width, height, spacing });
} }
Geometry HorizontalLayout::minimumGeometry() { Geometry HorizontalLayout::minimumGeometry() {
@@ -12,8 +9,7 @@ Geometry HorizontalLayout::minimumGeometry() {
foreach(child, children) { foreach(child, children) {
width += child.spacing; width += child.spacing;
if(child.width == MinimumSize || child.width == MaximumSize) { if(child.width == MinimumSize || child.width == MaximumSize) {
if(child.layout) width += child.layout->minimumGeometry().width; width += child.sizable->minimumGeometry().width;
if(child.widget) width += child.widget->minimumGeometry().width;
continue; continue;
} }
width += child.width; width += child.width;
@@ -21,8 +17,7 @@ Geometry HorizontalLayout::minimumGeometry() {
foreach(child, children) { foreach(child, children) {
if(child.height == MinimumSize || child.height == MaximumSize) { if(child.height == MinimumSize || child.height == MaximumSize) {
if(child.layout) height = max(height, child.layout->minimumGeometry().height); height = max(height, child.sizable->minimumGeometry().height);
if(child.widget) height = max(height, child.widget->minimumGeometry().height);
continue; continue;
} }
height = max(height, child.height); height = max(height, child.height);
@@ -43,8 +38,7 @@ Geometry HorizontalLayout::minimumLayoutGeometry() {
} }
if(child.width == MinimumSize) { if(child.width == MinimumSize) {
if(child.layout) width += child.layout->minimumGeometry().width; width += child.sizable->minimumGeometry().width;
if(child.widget) width += child.widget->minimumGeometry().width;
continue; continue;
} }
@@ -58,8 +52,7 @@ Geometry HorizontalLayout::minimumLayoutGeometry() {
} }
if(child.height == MinimumSize) { if(child.height == MinimumSize) {
if(child.layout) height = max(height, child.layout->minimumGeometry().height); height = max(height, child.sizable->minimumGeometry().height);
if(child.widget) height = max(height, child.widget->minimumGeometry().height);
continue; continue;
} }
@@ -69,18 +62,15 @@ Geometry HorizontalLayout::minimumLayoutGeometry() {
return { 0, 0, maximumWidth ? MaximumSize : margin * 2 + width, maximumHeight ? MaximumSize : margin * 2 + height }; 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) { void HorizontalLayout::setGeometry(const Geometry &containerGeometry) {
auto children = this->children; auto children = this->children;
foreach(child, children) { foreach(child, children) {
if(child.layout) { if(child.width == MinimumSize) child.width = child.sizable->minimumGeometry().width;
child.width = child.layout->minimumLayoutGeometry().width; if(child.height == MinimumSize) child.height = child.sizable->minimumGeometry().height;
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;
}
} }
Geometry geometry = containerGeometry; Geometry geometry = containerGeometry;
@@ -105,35 +95,44 @@ void HorizontalLayout::setGeometry(const Geometry &containerGeometry) {
foreach(child, children) maximumHeight = max(maximumHeight, child.height); foreach(child, children) maximumHeight = max(maximumHeight, child.height);
foreach(child, children) { 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 }; Geometry childGeometry = { geometry.x, geometry.y + pivot, child.width, child.height };
child.sizable->setGeometry(childGeometry);
if(child.layout) child.layout->setGeometry(childGeometry);
if(child.widget) child.widget->setGeometry(childGeometry);
geometry.x += child.width + child.spacing; geometry.x += child.width + child.spacing;
geometry.width -= child.width + child.spacing; geometry.width -= child.width + child.spacing;
} }
} }
void HorizontalLayout::setLayout(Layout &layout) {
this->layout = &layout;
}
void HorizontalLayout::setMargin(unsigned margin) { void HorizontalLayout::setMargin(unsigned margin) {
this->margin = margin; this->margin = margin;
} }
void HorizontalLayout::setParent(Window &parent) { void HorizontalLayout::setParent(Window &parent) {
foreach(child, children) { foreach(child, children) {
if(child.layout) child.layout->setParent(parent); child.sizable->setParent(parent);
if(child.widget) parent.append(*child.widget);
} }
} }
void HorizontalLayout::setVisible(bool visible) { void HorizontalLayout::setVisible(bool visible) {
visible_ = visible;
foreach(child, children) { foreach(child, children) {
if(child.layout) child.layout->setVisible(visible); child.sizable->setVisible(dynamic_cast<Widget*>(child.sizable) ? child.sizable->visible() : visible);
if(child.widget) child.widget->setVisible(visible);
} }
} }
HorizontalLayout::HorizontalLayout() { bool HorizontalLayout::visible() {
margin = 0; if(layout) return visible_ && layout->visible();
return visible_;
}
HorizontalLayout::HorizontalLayout() {
alignment = 0.5;
layout = 0;
margin = 0;
visible_ = true;
} }

View File

@@ -1,21 +1,25 @@
struct VerticalLayout; struct VerticalLayout;
struct HorizontalLayout : public Layout { struct HorizontalLayout : public Layout {
void append(VerticalLayout &layout, unsigned spacing = 0); void append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing = 0);
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
Geometry minimumLayoutGeometry();
Geometry minimumGeometry(); Geometry minimumGeometry();
Geometry minimumLayoutGeometry();
void setAlignment(double alignment);
void setGeometry(const Geometry &geometry); void setGeometry(const Geometry &geometry);
void setLayout(Layout &layout);
void setMargin(unsigned margin); void setMargin(unsigned margin);
void setParent(Window &parent); void setParent(Window &parent);
void setVisible(bool visible); void setVisible(bool visible);
bool visible();
HorizontalLayout(); HorizontalLayout();
//private: //private:
double alignment;
Layout *layout;
unsigned margin; unsigned margin;
bool visible_;
struct Children { struct Children {
VerticalLayout *layout; Sizable *sizable;
Widget *widget;
unsigned width, height, spacing; unsigned width, height, spacing;
}; };
nall::linear_vector<Children> children; nall::linear_vector<Children> children;

View File

@@ -1,9 +1,6 @@
void VerticalLayout::append(HorizontalLayout &layout, unsigned spacing) { void VerticalLayout::append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing) {
children.append({ &layout, 0, MinimumSize, MinimumSize, spacing }); sizable.setLayout(*this);
} children.append({ &sizable, width, height, spacing });
void VerticalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
children.append({ 0, &widget, width, height, spacing });
} }
Geometry VerticalLayout::minimumGeometry() { Geometry VerticalLayout::minimumGeometry() {
@@ -11,8 +8,7 @@ Geometry VerticalLayout::minimumGeometry() {
foreach(child, children) { foreach(child, children) {
if(child.width == MinimumSize || child.width == MaximumSize) { if(child.width == MinimumSize || child.width == MaximumSize) {
if(child.layout) width = max(width, child.layout->minimumGeometry().width); width = max(width, child.sizable->minimumGeometry().width);
if(child.widget) width = max(width, child.widget->minimumGeometry().width);
continue; continue;
} }
width = max(width, child.width); width = max(width, child.width);
@@ -21,8 +17,7 @@ Geometry VerticalLayout::minimumGeometry() {
foreach(child, children) { foreach(child, children) {
height += child.spacing; height += child.spacing;
if(child.height == MinimumSize || child.height == MaximumSize) { if(child.height == MinimumSize || child.height == MaximumSize) {
if(child.layout) height += child.layout->minimumGeometry().height; height += child.sizable->minimumGeometry().height;
if(child.widget) height += child.widget->minimumGeometry().height;
continue; continue;
} }
height += child.height; height += child.height;
@@ -43,8 +38,7 @@ Geometry VerticalLayout::minimumLayoutGeometry() {
} }
if(child.width == MinimumSize) { if(child.width == MinimumSize) {
if(child.layout) width = max(width, child.layout->minimumGeometry().width); width = max(width, child.sizable->minimumGeometry().width);
if(child.widget) width = max(width, child.widget->minimumGeometry().width);
continue; continue;
} }
@@ -58,8 +52,7 @@ Geometry VerticalLayout::minimumLayoutGeometry() {
} }
if(child.height == MinimumSize) { if(child.height == MinimumSize) {
if(child.layout) height += child.layout->minimumGeometry().height; height += child.sizable->minimumGeometry().height;
if(child.widget) height += child.widget->minimumGeometry().height;
continue; continue;
} }
@@ -69,18 +62,15 @@ Geometry VerticalLayout::minimumLayoutGeometry() {
return { 0, 0, maximumWidth ? MaximumSize : margin * 2 + width, maximumHeight ? MaximumSize : margin * 2 + height }; 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) { void VerticalLayout::setGeometry(const Geometry &containerGeometry) {
auto children = this->children; auto children = this->children;
foreach(child, children) { foreach(child, children) {
if(child.layout) { if(child.width == MinimumSize) child.width = child.sizable->minimumGeometry().width;
child.width = child.layout->minimumLayoutGeometry().width; if(child.height == MinimumSize) child.height = child.sizable->minimumGeometry().height;
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;
}
} }
Geometry geometry = containerGeometry; Geometry geometry = containerGeometry;
@@ -105,35 +95,44 @@ void VerticalLayout::setGeometry(const Geometry &containerGeometry) {
foreach(child, children) maximumWidth = max(maximumWidth, child.width); foreach(child, children) maximumWidth = max(maximumWidth, child.width);
foreach(child, children) { 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 }; Geometry childGeometry = { geometry.x + pivot, geometry.y, child.width, child.height };
child.sizable->setGeometry(childGeometry);
if(child.layout) child.layout->setGeometry(childGeometry);
if(child.widget) child.widget->setGeometry(childGeometry);
geometry.y += child.height + child.spacing; geometry.y += child.height + child.spacing;
geometry.height -= child.height + child.spacing; geometry.height -= child.height + child.spacing;
} }
} }
void VerticalLayout::setLayout(Layout &layout) {
this->layout = &layout;
}
void VerticalLayout::setMargin(unsigned margin) { void VerticalLayout::setMargin(unsigned margin) {
this->margin = margin; this->margin = margin;
} }
void VerticalLayout::setParent(Window &parent) { void VerticalLayout::setParent(Window &parent) {
foreach(child, children) { foreach(child, children) {
if(child.layout) child.layout->setParent(parent); child.sizable->setParent(parent);
if(child.widget) parent.append(*child.widget);
} }
} }
void VerticalLayout::setVisible(bool visible) { void VerticalLayout::setVisible(bool visible) {
visible_ = visible;
foreach(child, children) { foreach(child, children) {
if(child.layout) child.layout->setVisible(visible); child.sizable->setVisible(dynamic_cast<Widget*>(child.sizable) ? child.sizable->visible() : visible);
if(child.widget) child.widget->setVisible(visible);
} }
} }
VerticalLayout::VerticalLayout() { bool VerticalLayout::visible() {
margin = 0; if(layout) return visible_ && layout->visible();
return visible_;
}
VerticalLayout::VerticalLayout() {
alignment = 0.0;
layout = 0;
margin = 0;
visible_ = true;
} }

View File

@@ -1,21 +1,25 @@
struct HorizontalLayout; struct HorizontalLayout;
struct VerticalLayout : public Layout { struct VerticalLayout : public Layout {
void append(HorizontalLayout &layout, unsigned spacing = 0); void append(Sizable &sizable, unsigned width, unsigned height, unsigned spacing = 0);
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
Geometry minimumGeometry(); Geometry minimumGeometry();
Geometry minimumLayoutGeometry(); Geometry minimumLayoutGeometry();
void setAlignment(double alignment);
void setGeometry(const Geometry &geometry); void setGeometry(const Geometry &geometry);
void setLayout(Layout &layout);
void setMargin(unsigned margin); void setMargin(unsigned margin);
void setParent(Window &parent); void setParent(Window &parent);
void setVisible(bool visible); void setVisible(bool visible);
bool visible();
VerticalLayout(); VerticalLayout();
//private: //private:
double alignment;
Layout *layout;
unsigned margin; unsigned margin;
bool visible_;
struct Children { struct Children {
HorizontalLayout *layout; Sizable *sizable;
Widget *widget;
unsigned width, height, spacing; unsigned width, height, spacing;
}; };
nall::linear_vector<Children> children; nall::linear_vector<Children> children;

View File

@@ -100,6 +100,8 @@ struct Widget::State {
bool enabled; bool enabled;
Font *font; Font *font;
Geometry geometry; Geometry geometry;
Layout *layout;
Window *parent;
bool visible; bool visible;
State() { State() {
@@ -107,6 +109,8 @@ struct Widget::State {
enabled = true; enabled = true;
font = 0; font = 0;
geometry = { 0, 0, 0, 0 }; geometry = { 0, 0, 0, 0 };
layout = 0;
parent = 0;
visible = true; visible = true;
} }
}; };

View File

@@ -186,6 +186,7 @@ struct pWidget : public pObject {
virtual void setFocused(); virtual void setFocused();
virtual void setFont(Font &font); virtual void setFont(Font &font);
virtual void setGeometry(const Geometry &geometry); virtual void setGeometry(const Geometry &geometry);
void setParent(Window &parent);
void setVisible(bool visible); void setVisible(bool visible);
pWidget(Widget &widget) : widget(widget) {} pWidget(Widget &widget) : widget(widget) {}

View File

@@ -15,4 +15,5 @@ void pButton::setText(const string &text) {
void pButton::constructor() { void pButton::constructor() {
gtkWidget = gtk_button_new(); gtkWidget = gtk_button_new();
g_signal_connect_swapped(G_OBJECT(gtkWidget), "clicked", G_CALLBACK(Button_tick), (gpointer)&button); g_signal_connect_swapped(G_OBJECT(gtkWidget), "clicked", G_CALLBACK(Button_tick), (gpointer)&button);
//g_object_ref((gpointer)gtkWidget);
} }

View File

@@ -38,8 +38,20 @@ void pWidget::setGeometry(const Geometry &geometry) {
gtk_widget_set_size_request(gtkWidget, width, height); 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) { void pWidget::setVisible(bool visible) {
if(widget.state.abstract) visible = false; if(widget.state.abstract) visible = false;
if(widget.state.layout && widget.state.layout->visible() == false) visible = false;
gtk_widget_set_visible(gtkWidget, visible); gtk_widget_set_visible(gtkWidget, visible);
} }

View File

@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
** Meta object code from reading C++ file 'qt.moc.hpp' ** 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) ** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0)
** **
** WARNING! All changes made in this file will be lost! ** WARNING! All changes made in this file will be lost!

View File

@@ -219,6 +219,7 @@ struct pWidget : public pObject {
void setFocused(); void setFocused();
void setFont(Font &font); void setFont(Font &font);
virtual void setGeometry(const Geometry &geometry); virtual void setGeometry(const Geometry &geometry);
void setParent(Window &parent);
void setVisible(bool visible); void setVisible(bool visible);
pWidget(Widget &widget) : widget(widget) {} pWidget(Widget &widget) : widget(widget) {}

View File

@@ -23,8 +23,17 @@ void pWidget::setGeometry(const Geometry &geometry) {
qtWidget->setGeometry(geometry.x, geometry.y, geometry.width, geometry.height); 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) { void pWidget::setVisible(bool visible) {
if(widget.state.abstract) visible = false; if(widget.state.abstract) visible = false;
if(widget.state.layout && widget.state.layout->visible() == false) visible = false;
qtWidget->setVisible(visible); qtWidget->setVisible(visible);
} }

View File

@@ -18,4 +18,5 @@ void pButton::setParent(Window &parent) {
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&button); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&button);
setDefaultFont(); setDefaultFont();
setText(button.state.text); setText(button.state.text);
widget.setVisible(widget.visible());
} }

View File

@@ -51,4 +51,5 @@ void pCanvas::setParent(Window &parent) {
if(hwnd) DestroyWindow(hwnd); 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); 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); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&canvas);
widget.setVisible(widget.visible());
} }

View File

@@ -30,4 +30,5 @@ void pCheckBox::setParent(Window &parent) {
setDefaultFont(); setDefaultFont();
if(checkBox.state.checked) setChecked(true); if(checkBox.state.checked) setChecked(true);
setText(checkBox.state.text); setText(checkBox.state.text);
widget.setVisible(widget.visible());
} }

View File

@@ -46,4 +46,5 @@ void pComboBox::setParent(Window &parent) {
setDefaultFont(); setDefaultFont();
foreach(text, comboBox.state.text) append(text); foreach(text, comboBox.state.text) append(text);
setSelection(comboBox.state.selection); setSelection(comboBox.state.selection);
widget.setVisible(widget.visible());
} }

View File

@@ -128,4 +128,5 @@ void pHexEdit::setParent(Window &parent) {
windowProc = (LRESULT CALLBACK (*)(HWND, UINT, LPARAM, WPARAM))GetWindowLongPtr(hwnd, GWLP_WNDPROC); windowProc = (LRESULT CALLBACK (*)(HWND, UINT, LPARAM, WPARAM))GetWindowLongPtr(hwnd, GWLP_WNDPROC);
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)HexEdit_windowProc); SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)HexEdit_windowProc);
widget.setVisible(widget.visible());
} }

View File

@@ -30,4 +30,5 @@ void pHorizontalScrollBar::setParent(Window &parent) {
unsigned position = horizontalScrollBar.state.position; unsigned position = horizontalScrollBar.state.position;
setLength(horizontalScrollBar.state.length); setLength(horizontalScrollBar.state.length);
setPosition(position); setPosition(position);
widget.setVisible(widget.visible());
} }

View File

@@ -31,4 +31,5 @@ void pHorizontalSlider::setParent(Window &parent) {
unsigned position = horizontalSlider.state.position; unsigned position = horizontalSlider.state.position;
setLength(horizontalSlider.state.length); setLength(horizontalSlider.state.length);
setPosition(position); setPosition(position);
widget.setVisible(widget.visible());
} }

View File

@@ -19,6 +19,7 @@ void pLabel::setParent(Window &parent) {
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&label); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&label);
setDefaultFont(); setDefaultFont();
setText(label.state.text); setText(label.state.text);
widget.setVisible(widget.visible());
} }
static LRESULT CALLBACK Label_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { static LRESULT CALLBACK Label_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {

View File

@@ -37,4 +37,5 @@ void pLineEdit::setParent(Window &parent) {
setDefaultFont(); setDefaultFont();
setEditable(lineEdit.state.editable); setEditable(lineEdit.state.editable);
setText(lineEdit.state.text); setText(lineEdit.state.text);
widget.setVisible(widget.visible());
} }

View File

@@ -131,4 +131,5 @@ void pListView::setParent(Window &parent) {
foreach(checked, listView.state.checked, n) setChecked(n, checked); foreach(checked, listView.state.checked, n) setChecked(n, checked);
if(listView.state.selected) setSelection(listView.state.selection); if(listView.state.selected) setSelection(listView.state.selection);
autoSizeColumns(); autoSizeColumns();
widget.setVisible(widget.visible());
} }

View File

@@ -17,4 +17,5 @@ void pProgressBar::setParent(Window &parent) {
SendMessage(hwnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); SendMessage(hwnd, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
SendMessage(hwnd, PBM_SETSTEP, MAKEWPARAM(1, 0), 0); SendMessage(hwnd, PBM_SETSTEP, MAKEWPARAM(1, 0), 0);
setPosition(progressBar.state.position); setPosition(progressBar.state.position);
widget.setVisible(widget.visible());
} }

View File

@@ -35,4 +35,5 @@ void pRadioBox::setParent(Window &parent) {
setDefaultFont(); setDefaultFont();
if(radioBox.state.checked) setChecked(); if(radioBox.state.checked) setChecked();
setText(radioBox.state.text); setText(radioBox.state.text);
widget.setVisible(widget.visible());
} }

View File

@@ -50,4 +50,5 @@ void pTextEdit::setParent(Window &parent) {
setCursorPosition(textEdit.state.cursorPosition); setCursorPosition(textEdit.state.cursorPosition);
setEditable(textEdit.state.editable); setEditable(textEdit.state.editable);
setText(textEdit.state.text); setText(textEdit.state.text);
widget.setVisible(widget.visible());
} }

View File

@@ -30,4 +30,5 @@ void pVerticalScrollBar::setParent(Window &parent) {
unsigned position = verticalScrollBar.state.position; unsigned position = verticalScrollBar.state.position;
setLength(verticalScrollBar.state.length); setLength(verticalScrollBar.state.length);
setPosition(position); setPosition(position);
widget.setVisible(widget.visible());
} }

View File

@@ -31,4 +31,5 @@ void pVerticalSlider::setParent(Window &parent) {
unsigned position = verticalSlider.state.position; unsigned position = verticalSlider.state.position;
setLength(verticalSlider.state.length); setLength(verticalSlider.state.length);
setPosition(position); setPosition(position);
widget.setVisible(widget.visible());
} }

View File

@@ -9,6 +9,7 @@ void pViewport::constructor() {
void pViewport::setParent(Window &parent) { 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); 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); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&viewport);
widget.setVisible(widget.visible());
} }
static LRESULT CALLBACK Viewport_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { static LRESULT CALLBACK Viewport_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {

View File

@@ -29,6 +29,7 @@ void pWidget::setGeometry(const Geometry &geometry) {
void pWidget::setVisible(bool visible) { void pWidget::setVisible(bool visible) {
if(widget.state.abstract) visible = false; if(widget.state.abstract) visible = false;
if(widget.state.layout && widget.state.layout->visible() == false) visible = false;
ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE); ShowWindow(hwnd, visible ? SW_SHOWNORMAL : SW_HIDE);
} }
@@ -49,4 +50,5 @@ void pWidget::setParent(Window &parent) {
if(hwnd) DestroyWindow(hwnd); if(hwnd) DestroyWindow(hwnd);
hwnd = CreateWindow(L"phoenix_label", L"", WS_CHILD, 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0); 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); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&widget);
widget.setVisible(false);
} }

View File

@@ -1,7 +1,7 @@
namespace SNES { namespace SNES {
namespace Info { namespace Info {
static const char Name[] = "bsnes"; static const char Name[] = "bsnes";
static const char Version[] = "082"; static const char Version[] = "082.01";
static const unsigned SerializerVersion = 21; static const unsigned SerializerVersion = 21;
} }
} }

View File

@@ -199,8 +199,12 @@ bool snes_load_cartridge_super_game_boy(
if(rom_data) SNES::cartridge.rom.copy(rom_data, rom_size); 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; string xmlrom = (rom_xml && *rom_xml) ? string(rom_xml) : SNESCartridge(rom_data, rom_size).xmlMemoryMap;
if(dmg_data) { if(dmg_data) {
string xmldmg = (dmg_xml && *dmg_xml) ? string(dmg_xml) : GameBoyCartridge(dmg_data, dmg_size).xml; //GameBoyCartridge needs to modify dmg_data (for MMM01 emulation); so copy data
GameBoy::cartridge.load(xmldmg, dmg_data, dmg_size); 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::cartridge.load(SNES::Cartridge::Mode::SuperGameBoy, { xmlrom, "" });
SNES::system.power(); SNES::system.power();

View File

@@ -22,7 +22,7 @@ void Console::create() {
controlLayout.append(traceSMP, 120, 0 ); controlLayout.append(traceSMP, 120, 0 );
controlLayout.append(spacer, 120, ~0 ); controlLayout.append(spacer, 120, ~0 );
controlLayout.append(clearConsole, 120, 0 ); controlLayout.append(clearConsole, 120, 0 );
layout.append(controlLayout ); layout.append(controlLayout, 0, ~0 );
append(layout); append(layout);
setGeometry({ 0, 0, layout.minimumGeometry().width + 585, 350 }); setGeometry({ 0, 0, layout.minimumGeometry().width + 585, 350 });

View File

@@ -17,7 +17,7 @@ void CPUDebugger::create() {
controlLayout.append(stepOver, 80, 0 ); controlLayout.append(stepOver, 80, 0 );
controlLayout.append(proceed, 80, 0 ); controlLayout.append(proceed, 80, 0 );
controlLayout.append(spacer, 80, ~0 ); controlLayout.append(spacer, 80, ~0 );
layout.append(controlLayout ); layout.append(controlLayout, 0, ~0 );
append(layout); append(layout);
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 }); setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });

View File

@@ -17,7 +17,7 @@ void SMPDebugger::create() {
controlLayout.append(stepOver, 80, 0 ); controlLayout.append(stepOver, 80, 0 );
controlLayout.append(proceed, 80, 0 ); controlLayout.append(proceed, 80, 0 );
controlLayout.append(spacer, 80, ~0 ); controlLayout.append(spacer, 80, ~0 );
layout.append(controlLayout ); layout.append(controlLayout, 0, ~0 );
append(layout); append(layout);
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 }); setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });

View File

@@ -26,7 +26,7 @@ void BreakpointEditor::create() {
breakpointLayout[n].append(valueBox[n], 30, 0, 5); breakpointLayout[n].append(valueBox[n], 30, 0, 5);
breakpointLayout[n].append(typeBox[n], 0, 0, 5); breakpointLayout[n].append(typeBox[n], 0, 0, 5);
breakpointLayout[n].append(sourceBox[n], 0, 0 ); 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); append(layout);

View File

@@ -20,7 +20,7 @@ void MemoryEditor::create() {
controlLayout.append(gotoBox, 80, 0 ); controlLayout.append(gotoBox, 80, 0 );
controlLayout.append(refreshButton, 80, 0 ); controlLayout.append(refreshButton, 80, 0 );
controlLayout.append(spacer, 80, ~0 ); controlLayout.append(spacer, 80, ~0 );
layout.append(controlLayout ); layout.append(controlLayout, 0, ~0 );
append(layout); append(layout);
setGeometry({ 0, 0, layout.minimumGeometry().width + 475, 230 }); setGeometry({ 0, 0, layout.minimumGeometry().width + 475, 230 });

View File

@@ -17,7 +17,7 @@ void AboutWindow::create() {
layout.append(canvas, 720, 180); layout.append(canvas, 720, 180);
informationLayout.append(spacer, ~0, 0); informationLayout.append(spacer, ~0, 0);
informationLayout.append(information, 0, 0); informationLayout.append(information, 0, 0);
layout.append(informationLayout); layout.append(informationLayout, ~0, 0);
append(layout); append(layout);
setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height }); setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height });
} }

View File

@@ -12,7 +12,7 @@ void FileBrowser::create() {
pathLayout.append(pathBox, ~0, 0, 5); pathLayout.append(pathBox, ~0, 0, 5);
pathLayout.append(browseButton, sq, sq, 5); pathLayout.append(browseButton, sq, sq, 5);
pathLayout.append(upButton, sq, sq ); pathLayout.append(upButton, sq, sq );
layout.append(pathLayout, 5); layout.append(pathLayout, ~0, 0, 5);
layout.append(contentsBox, ~0, ~0 ); layout.append(contentsBox, ~0, ~0 );
append(layout); append(layout);
setGeometry({ 0, 0, 640, layout.minimumGeometry().height + 400 }); setGeometry({ 0, 0, 640, layout.minimumGeometry().height + 400 });

View File

@@ -16,14 +16,14 @@ void SingleSlotLoader::create() {
baseLayout.append(baseLabel, 40, 0, 5); baseLayout.append(baseLabel, 40, 0, 5);
baseLayout.append(basePath, ~0, 0, 5); baseLayout.append(basePath, ~0, 0, 5);
baseLayout.append(baseBrowse, sq, sq ); baseLayout.append(baseBrowse, sq, sq );
layout.append(baseLayout, 5); layout.append(baseLayout, ~0, 0, 5);
slotLayout.append(slotLabel, 40, 0, 5); slotLayout.append(slotLabel, 40, 0, 5);
slotLayout.append(slotPath, ~0, 0, 5); slotLayout.append(slotPath, ~0, 0, 5);
slotLayout.append(slotBrowse, sq, sq ); slotLayout.append(slotBrowse, sq, sq );
layout.append(slotLayout, 5); layout.append(slotLayout, ~0, 0, 5);
controlLayout.append(spacer, ~0, 0 ); controlLayout.append(spacer, ~0, 0 );
controlLayout.append(okButton, 80, 0 ); controlLayout.append(okButton, 80, 0 );
layout.append(controlLayout); layout.append(controlLayout, ~0, 0 );
append(layout); append(layout);
setGeometry({ 0, 0, 480, layout.minimumGeometry().height }); setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
@@ -111,18 +111,18 @@ void DoubleSlotLoader::create() {
baseLayout.append(baseLabel, 40, 0, 5); baseLayout.append(baseLabel, 40, 0, 5);
baseLayout.append(basePath, ~0, 0, 5); baseLayout.append(basePath, ~0, 0, 5);
baseLayout.append(baseBrowse, sq, sq ); baseLayout.append(baseBrowse, sq, sq );
layout.append(baseLayout, 5); layout.append(baseLayout, ~0, 0, 5);
slotALayout.append(slotALabel, 40, 0, 5); slotALayout.append(slotALabel, 40, 0, 5);
slotALayout.append(slotAPath, ~0, 0, 5); slotALayout.append(slotAPath, ~0, 0, 5);
slotALayout.append(slotABrowse, sq, sq ); slotALayout.append(slotABrowse, sq, sq );
layout.append(slotALayout, 5); layout.append(slotALayout, ~0, 0, 5);
slotBLayout.append(slotBLabel, 40, 0, 5); slotBLayout.append(slotBLabel, 40, 0, 5);
slotBLayout.append(slotBPath, ~0, 0, 5); slotBLayout.append(slotBPath, ~0, 0, 5);
slotBLayout.append(slotBBrowse, sq, sq ); slotBLayout.append(slotBBrowse, sq, sq );
layout.append(slotBLayout, 5); layout.append(slotBLayout, ~0, 0, 5);
controlLayout.append(spacer, ~0, 0 ); controlLayout.append(spacer, ~0, 0 );
controlLayout.append(okButton, 80, 0 ); controlLayout.append(okButton, 80, 0 );
layout.append(controlLayout); layout.append(controlLayout, ~0, 0 );
append(layout); append(layout);
setGeometry({ 0, 0, 480, layout.minimumGeometry().height }); setGeometry({ 0, 0, 480, layout.minimumGeometry().height });

View File

@@ -188,11 +188,21 @@ void Application::loadGeometry() {
foreach(window, windows) { foreach(window, windows) {
lstring position; lstring position;
position.split(",", window->position); position.split(",", window->position);
Geometry geom = window->geometry(); Geometry configGeometry = {
window->setGeometry({
(signed)integer(position[0]), (signed)integer(position[1]), (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
}); });
} }
} }

View File

@@ -31,7 +31,7 @@ void AdvancedSettings::create() {
panelLayout.setMargin(5); panelLayout.setMargin(5);
panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5);
panelLayout.append(layout); panelLayout.append(layout, ~0, ~0);
layout.append(title, ~0, 0, 5); layout.append(title, ~0, 0, 5);
@@ -41,18 +41,18 @@ void AdvancedSettings::create() {
driverLayout.append(audioDriverLabel, 0, 0, 5); driverLayout.append(audioDriverLabel, 0, 0, 5);
driverLayout.append(audioDriverBox, ~0, 0, 5); driverLayout.append(audioDriverBox, ~0, 0, 5);
driverLayout.append(inputDriverLabel, 0, 0, 5); driverLayout.append(inputDriverLabel, 0, 0, 5);
driverLayout.append(inputDriverBox, ~0, 0 ); driverLayout.append(inputDriverBox, ~0, 0);
layout.append(driverLayout, 5); layout.append(driverLayout, ~0, 0, 5);
layout.append(focusPolicyLabel, ~0, 0 ); layout.append(focusPolicyLabel, ~0, 0);
focusPolicyLayout.append(focusPolicyPause, ~0, 0, 5); focusPolicyLayout.append(focusPolicyPause, ~0, 0, 5);
focusPolicyLayout.append(focusPolicyIgnore, ~0, 0, 5); focusPolicyLayout.append(focusPolicyIgnore, ~0, 0, 5);
focusPolicyLayout.append(focusPolicyAllow, ~0, 0); focusPolicyLayout.append(focusPolicyAllow, ~0, 0);
layout.append(focusPolicyLayout, 5); layout.append(focusPolicyLayout, ~0, 0, 5);
layout.append(compositorPolicyLabel, ~0, 0); layout.append(compositorPolicyLabel, ~0, 0);
compositorPolicyLayout.append(compositorPolicyNever, ~0, 0, 5); compositorPolicyLayout.append(compositorPolicyNever, ~0, 0, 5);
compositorPolicyLayout.append(compositorPolicyFullScreen, ~0, 0, 5); compositorPolicyLayout.append(compositorPolicyFullScreen, ~0, 0, 5);
compositorPolicyLayout.append(compositorPolicyAlways, ~0, 0); compositorPolicyLayout.append(compositorPolicyAlways, ~0, 0);
layout.append(compositorPolicyLayout); layout.append(compositorPolicyLayout, ~0, 0);
layout.append(spacer, ~0, ~0); layout.append(spacer, ~0, ~0);
settingsWindow.append(panelLayout); settingsWindow.append(panelLayout);

View File

@@ -13,24 +13,24 @@ void AudioSettings::create() {
panelLayout.setMargin(5); panelLayout.setMargin(5);
panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5);
panelLayout.append(layout); panelLayout.append(layout, ~0, ~0);
layout.append(title, ~0, 0, 5); layout.append(title, ~0, 0, 5);
frequencyLayout.append(frequencyLabel, 70, 0); frequencyLayout.append(frequencyLabel, 70, 0);
frequencyLayout.append(frequencyValue, 60, 0); frequencyLayout.append(frequencyValue, 60, 0);
frequencyLayout.append(frequencySlider, ~0, 0); frequencyLayout.append(frequencySlider, ~0, 0);
layout.append(frequencyLayout); layout.append(frequencyLayout, ~0, 0);
volumeLayout.append(volumeLabel, 70, 0); volumeLayout.append(volumeLabel, 70, 0);
volumeLayout.append(volumeValue, 60, 0); volumeLayout.append(volumeValue, 60, 0);
volumeLayout.append(volumeSlider, ~0, 0); volumeLayout.append(volumeSlider, ~0, 0);
layout.append(volumeLayout); layout.append(volumeLayout, ~0, 0);
balanceLayout.append(balanceLabel, 70, 0); balanceLayout.append(balanceLabel, 70, 0);
balanceLayout.append(balanceValue, 60, 0); balanceLayout.append(balanceValue, 60, 0);
balanceLayout.append(balanceSlider, ~0, 0); balanceLayout.append(balanceSlider, ~0, 0);
layout.append(balanceLayout); layout.append(balanceLayout, ~0, 0);
layout.append(spacer, ~0, ~0); layout.append(spacer, ~0, ~0);
settingsWindow.append(panelLayout); settingsWindow.append(panelLayout);

View File

@@ -23,7 +23,7 @@ void InputSettings::create() {
panelLayout.setMargin(5); panelLayout.setMargin(5);
panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5);
panelLayout.append(layout); panelLayout.append(layout, ~0, ~0);
layout.append(title, ~0, 0, 5); layout.append(title, ~0, 0, 5);
@@ -31,7 +31,7 @@ void InputSettings::create() {
selectionLayout.append(portBox, ~0, 0, 5); selectionLayout.append(portBox, ~0, 0, 5);
selectionLayout.append(deviceLabel, 0, 0, 5); selectionLayout.append(deviceLabel, 0, 0, 5);
selectionLayout.append(deviceBox, ~0, 0); selectionLayout.append(deviceBox, ~0, 0);
layout.append(selectionLayout, 5); layout.append(selectionLayout, ~0, 0, 5);
layout.append(mappingList, ~0, ~0, 5); layout.append(mappingList, ~0, ~0, 5);
@@ -40,7 +40,7 @@ void InputSettings::create() {
controlLayout.append(customButton3, 100, 0, 5); controlLayout.append(customButton3, 100, 0, 5);
controlLayout.append(spacer, ~0, 0); controlLayout.append(spacer, ~0, 0);
controlLayout.append(clearButton, 80, 0); controlLayout.append(clearButton, 80, 0);
layout.append(controlLayout); layout.append(controlLayout, ~0, 0);
settingsWindow.append(panelLayout); settingsWindow.append(panelLayout);
clearButton.setEnabled(false); clearButton.setEnabled(false);

View File

@@ -22,7 +22,7 @@ void VideoSettings::create() {
panelLayout.setMargin(5); panelLayout.setMargin(5);
panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5); panelLayout.append(panel, SettingsWindow::PanelWidth, ~0, 5);
panelLayout.append(layout); panelLayout.append(layout, ~0, ~0);
layout.append(title, ~0, 0, 5); layout.append(title, ~0, 0, 5);
@@ -30,21 +30,21 @@ void VideoSettings::create() {
brightnessLayout.append(brightnessLabel, 80, 0 ); brightnessLayout.append(brightnessLabel, 80, 0 );
brightnessLayout.append(brightnessValue, 50, 0 ); brightnessLayout.append(brightnessValue, 50, 0 );
brightnessLayout.append(brightnessSlider, ~0, 0 ); brightnessLayout.append(brightnessSlider, ~0, 0 );
layout.append(brightnessLayout ); layout.append(brightnessLayout, ~0, 0 );
contrastLayout.append(contrastLabel, 80, 0 ); contrastLayout.append(contrastLabel, 80, 0 );
contrastLayout.append(contrastValue, 50, 0 ); contrastLayout.append(contrastValue, 50, 0 );
contrastLayout.append(contrastSlider, ~0, 0 ); contrastLayout.append(contrastSlider, ~0, 0 );
layout.append(contrastLayout ); layout.append(contrastLayout, ~0, 0 );
gammaLayout.append(gammaLabel, 80, 0 ); gammaLayout.append(gammaLabel, 80, 0 );
gammaLayout.append(gammaValue, 50, 0 ); gammaLayout.append(gammaValue, 50, 0 );
gammaLayout.append(gammaSlider, ~0, 0 ); gammaLayout.append(gammaSlider, ~0, 0 );
layout.append(gammaLayout ); layout.append(gammaLayout, ~0, 0 );
layout.append(gammaRampCheck, ~0, 0, 5); layout.append(gammaRampCheck, ~0, 0, 5);
layout.append(fullscreenLabel, ~0, 0 ); layout.append(fullscreenLabel, ~0, 0 );
fullscreenLayout.append(fullscreenCenter, ~0, 0, 5); fullscreenLayout.append(fullscreenCenter, ~0, 0, 5);
fullscreenLayout.append(fullscreenScale, ~0, 0, 5); fullscreenLayout.append(fullscreenScale, ~0, 0, 5);
fullscreenLayout.append(fullscreenStretch, ~0, 0 ); fullscreenLayout.append(fullscreenStretch, ~0, 0 );
layout.append(fullscreenLayout); layout.append(fullscreenLayout, ~0, 0 );
layout.append(spacer, ~0, ~0); layout.append(spacer, ~0, ~0);
settingsWindow.append(panelLayout); settingsWindow.append(panelLayout);

View File

@@ -14,7 +14,7 @@ void CheatDatabase::create() {
controlLayout.append(unselectAllButton, 100, 0 ); controlLayout.append(unselectAllButton, 100, 0 );
controlLayout.append(spacerWidget, ~0, 0 ); controlLayout.append(spacerWidget, ~0, 0 );
controlLayout.append(okButton, 80, 0 ); controlLayout.append(okButton, 80, 0 );
layout.append(controlLayout ); layout.append(controlLayout, ~0, 0 );
append(layout); append(layout);
setGeometry({ 0, 0, 600, layout.minimumGeometry().height + 350 }); setGeometry({ 0, 0, 600, layout.minimumGeometry().height + 350 });

View File

@@ -1,5 +1,48 @@
CheatEditor cheatEditor; 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() { void CheatEditor::load() {
SNES::cheat.reset(); SNES::cheat.reset();
cheatList.reset(); cheatList.reset();
@@ -78,49 +121,6 @@ void CheatEditor::save() {
cheatList.autoSizeColumns(); 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() { void CheatEditor::synchronize() {
findButton.setEnabled(SNES::cartridge.loaded()); findButton.setEnabled(SNES::cartridge.loaded());
clearAllButton.setEnabled(SNES::cartridge.loaded()); clearAllButton.setEnabled(SNES::cartridge.loaded());

View File

@@ -15,12 +15,12 @@ void StateManager::create() {
layout.append(stateList, ~0, ~0, 5); layout.append(stateList, ~0, ~0, 5);
descLayout.append(descLabel, 80, 0, 5); descLayout.append(descLabel, 80, 0, 5);
descLayout.append(descEdit, ~0, 0 ); descLayout.append(descEdit, ~0, 0 );
layout.append(descLayout, 5); layout.append(descLayout, ~0, 0, 5);
controlLayout.append(spacer, 0, 0 ); controlLayout.append(spacer, 0, 0 );
controlLayout.append(loadButton, 80, 0, 5); controlLayout.append(loadButton, 80, 0, 5);
controlLayout.append(saveButton, 80, 0, 5); controlLayout.append(saveButton, 80, 0, 5);
controlLayout.append(eraseButton, 80, 0 ); controlLayout.append(eraseButton, 80, 0 );
layout.append(controlLayout ); layout.append(controlLayout, ~0, 0 );
append(layout); append(layout);
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 }); setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });