Update to v075r08 release.

byuu says:

Eleven hours of work. Window is now a base type (inherits from Object,
not Widget), same for Layout. FixedLayout still inherits from Layout.
Added HorizontalLayout and VerticalLayout types, that can append each
other to themselves to create box layouts. Layout margins are supported,
spacing is specified inline (I find this a much better way to fine-grain
spacing than Qt's single setSpacing function), and alignment is handled
strictly via padding widgets (insert a zero-sized label and it will
automatically grow to consume all extra space.)

Overall, my box packing model is slightly less powerful than Qt's, but
it is a good deal simpler and and easier to use in 90% of cases. The one
limitation I hit was with my input settings window, I'm not currently
able to embed two different layouts and toggle one on and the other off
to show only either { mouse x-axis, y-axis } or { mouse left, middle,
right }, so they instead just space out differently and I had to grow
the input window width a bit to compensate.

Resizing works great, pretty cool seeing that this is the first time
I've ever written my own resizer. I had to fight with Qt for several
hours to the point of potentially developing an aneurysm, but I finally
got it to properly handle geometry and sizing stuff. Some weird issue
with the bsnes viewport widget, I tell it to resize and for some reason
it doesn't. Cheap hack, I just make it constantly resize every video
refresh and it eventually takes. Wish I knew what was up with that.

All of bsnes now uses dynamic layouts sans the main window, so you can
resize them however you like.

This is still all Qt-only, I'm afraid. The other two ports are
in-progress.
This commit is contained in:
Tim Allen 2011-02-07 20:15:43 +11:00
parent 133d568f76
commit 266495b475
67 changed files with 950 additions and 499 deletions

View File

@ -2,7 +2,7 @@ include nall/Makefile
snes := snes
gameboy := gameboy
profile := compatibility
ui := ui-gameboy
ui := ui
# compiler
c := $(compiler) -std=gnu99

View File

@ -2,9 +2,6 @@ static void Button_tick(Button *self) {
if(self->onTick) self->onTick();
}
void Button::setParent(Layout &parent) {
}
void Button::setText(const string &text) {
gtk_button_set_label(GTK_BUTTON(object->widget), text);
}

View File

@ -2,9 +2,6 @@ static void CheckBox_tick(CheckBox *self) {
if(self->onTick && self->object->locked == false) self->onTick();
}
void CheckBox::setParent(Layout &parent) {
}
void CheckBox::setText(const string &text) {
gtk_button_set_label(GTK_BUTTON(object->widget), text);
}

View File

@ -1,21 +1,24 @@
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
fixedLayout->widgets.append({ &widget, x, y, width, height });
void FixedLayout::setParent(Window &parent) {
Layout::setParent(parent);
foreach(child, fixedLayout->children) {
gtk_fixed_put(GTK_FIXED(layout->parent->object->formContainer), child.widget->object->widget, 0, 0);
}
}
void FixedLayout::create(Window &parent) {
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), fixedLayout->container, 0, 0);
gtk_widget_set_size_request(fixedLayout->container, 640, 480);
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
fixedLayout->children.append({ &widget, x, y, width, height });
}
foreach(widget, fixedLayout->widgets) {
gtk_widget_set_size_request(widget.widget->object->widget, widget.width, widget.height);
gtk_fixed_put(GTK_FIXED(fixedLayout->container), widget.widget->object->widget, widget.x, widget.y);
gtk_widget_show(widget.widget->object->widget);
void FixedLayout::update(Geometry &geometry) {
Layout::update(geometry);
foreach(child, fixedLayout->children) {
gtk_fixed_move(GTK_FIXED(layout->parent->object->formContainer), child.widget->object->widget, child.x, child.y);
gtk_widget_set_size_request(child.widget->object->widget, child.width, child.height);
gtk_widget_show(child.widget->object->widget);
}
gtk_widget_show(fixedLayout->container);
}
FixedLayout::FixedLayout() {
fixedLayout = new FixedLayout::Data;
fixedLayout->container = gtk_fixed_new();
}

View File

@ -78,12 +78,55 @@ private:
MenuRadioItem *first;
};
struct Window;
struct Layout;
struct Widget;
struct Window : Object {
nall::function<bool ()> onClose;
void create(unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
void setLayout(Layout &layout);
bool focused();
void setFocused();
Geometry geometry();
void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
void setDefaultFont(Font &font);
void setFont(Font &font);
void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue);
void setTitle(const nall::string &text);
void setStatusText(const nall::string &text);
void setVisible(bool visible = true);
void setMenuVisible(bool visible = true);
void setStatusVisible(bool visible = true);
bool fullscreen();
void setFullscreen(bool fullscreen = true);
Window();
//private:
struct Data;
Data *window;
static Window None;
};
struct Layout : Object {
virtual void setParent(Window &parent);
virtual void update(Geometry &geometry);
void setMargin(unsigned margin);
Layout();
//private:
struct Data;
Data *layout;
};
struct FixedLayout : Layout {
void setParent(Window &parent);
void append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height);
void update(Geometry &geometry);
FixedLayout();
//private:
struct Data;
Data *fixedLayout;
};
struct Widget : Object {
virtual void setParent(Layout &parent) {}
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
virtual void setFont(Font &font);
bool visible();
@ -98,50 +141,8 @@ struct Widget : Object {
Data *widget;
};
struct Window : Widget {
nall::function<bool ()> onClose;
void create(unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
void setLayout(Layout &layout);
bool focused();
void setFocused();
Geometry geometry();
void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
void setDefaultFont(Font &font);
void setFont(Font &font);
void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue);
void setTitle(const nall::string &text);
void setStatusText(const nall::string &text);
void setMenuVisible(bool visible = true);
void setStatusVisible(bool visible = true);
bool fullscreen();
void setFullscreen(bool fullscreen = true);
Window();
//private:
struct Data;
Data *window;
static Window None;
};
struct Layout : Widget {
virtual void create(Window &parent) = 0;
Layout();
//private:
struct Data;
Data *layout;
};
struct FixedLayout : Layout {
void append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height);
void create(Window &parent);
FixedLayout();
//private:
struct Data;
Data *fixedLayout;
};
struct Button : Widget {
nall::function<void ()> onTick;
void setParent(Layout &parent);
void setText(const nall::string &text);
Button();
};
@ -159,7 +160,6 @@ struct Canvas : Widget {
struct CheckBox : Widget {
nall::function<void ()> onTick;
void setParent(Layout &parent);
void setText(const nall::string &text);
bool checked();
void setChecked(bool checked = true);
@ -218,7 +218,6 @@ struct HorizontalSlider : Widget {
};
struct Label : Widget {
void setParent(Layout &parent);
void setText(const nall::string &text);
Label();
};
@ -253,7 +252,6 @@ struct ProgressBar : Widget {
struct RadioBox : Widget {
nall::function<void ()> onTick;
void setParent(Layout &parent);
void setParent(RadioBox &parent);
void setText(const nall::string &text);
bool checked();

View File

@ -1,6 +1,3 @@
void Label::setParent(Layout &parent) {
}
void Label::setText(const string &text) {
gtk_label_set_text(GTK_LABEL(object->widget), text);
}

View File

@ -1,3 +1,20 @@
void Layout::setParent(Window &parent) {
layout->parent = &parent;
}
void Layout::update(Geometry &geometry) {
geometry.x += layout->margin;
geometry.y += layout->margin;
geometry.width -= layout->margin * 2;
geometry.height -= layout->margin * 2;
}
void Layout::setMargin(unsigned margin) {
layout->margin = margin;
}
Layout::Layout() {
layout = new Layout::Data;
layout->parent = 0;
layout->margin = 0;
}

View File

@ -35,18 +35,18 @@ struct Widget::Data {
};
struct Layout::Data {
Window *parent;
unsigned margin;
};
struct FixedLayout::Data {
Window *parent;
GtkWidget *container;
struct Widgets {
struct Children {
Widget *widget;
unsigned x, y;
unsigned width, height;
};
linear_vector<Widgets> widgets;
linear_vector<Children> children;
};
struct Canvas::Data {

View File

@ -2,10 +2,6 @@ static void RadioBox_tick(RadioBox *self) {
if(self->onTick && self->checked() && self->object->locked == false) self->onTick();
}
void RadioBox::setParent(Layout &parent) {
first = this;
}
void RadioBox::setParent(RadioBox &parent) {
first = parent.first;
}
@ -25,6 +21,7 @@ void RadioBox::setChecked() {
}
RadioBox::RadioBox() {
first = this;
object->widget = gtk_radio_button_new_with_label(0, "");
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(RadioBox_tick), (gpointer)this);
}

View File

@ -45,7 +45,9 @@ void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, con
}
void Window::setLayout(Layout &layout) {
layout.create(*this);
layout.setParent(*this);
Geometry geom = geometry();
layout.update(geom);
}
bool Window::focused() {
@ -94,6 +96,10 @@ void Window::setStatusText(const string &text) {
gtk_statusbar_push(GTK_STATUSBAR(object->status), 1, text);
}
void Window::setVisible(bool visible) {
gtk_widget_set_visible(object->widget, visible);
}
void Window::setMenuVisible(bool visible) {
gtk_widget_set_visible(object->menu, visible);
}

View File

@ -1,8 +1,3 @@
void Button::setParent(Layout &parent) {
button->setParent(parent.widget->widget);
button->show();
}
void Button::setText(const string &text) {
button->setText(QString::fromUtf8(text));
}

View File

@ -1,8 +1,3 @@
void Canvas::setParent(Layout &parent) {
canvas->setParent(parent.widget->widget);
canvas->show();
}
void Canvas::setGeometry(unsigned x, unsigned y, unsigned width, unsigned height) {
delete canvas->image;
canvas->image = new QImage(width, height, QImage::Format_RGB32);

View File

@ -1,8 +1,3 @@
void CheckBox::setParent(Layout &parent) {
checkBox->setParent(parent.widget->widget);
checkBox->show();
}
void CheckBox::setText(const string &text) {
checkBox->setText(QString::fromUtf8(text));
}

View File

@ -1,8 +1,3 @@
void ComboBox::setParent(Layout &parent) {
comboBox->setParent(parent.widget->widget);
comboBox->show();
}
void ComboBox::reset() {
while(comboBox->count()) comboBox->removeItem(0);
}

View File

@ -1,8 +1,3 @@
void EditBox::setParent(Layout &parent) {
editBox->setParent(parent.widget->widget);
editBox->show();
}
void EditBox::setEditable(bool editable) {
editBox->setReadOnly(editable == false);
}

View File

@ -1,22 +1,31 @@
void FixedLayout::setParent(Window &parent) {
Layout::setParent(parent);
foreach(child, fixedLayout->children) {
child.widget->widget->widget->setParent(layout->parent->window->container);
if(!child.widget->widget->font && layout->parent->window->defaultFont) {
QWidget *control = child.widget->widget->widget;
control->setFont(*layout->parent->window->defaultFont);
}
}
}
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
fixedLayout->children.append({ &widget, x, y, width, height });
}
void FixedLayout::create(Window &parentWindow) {
fixedLayout->parent = &parentWindow;
fixedLayout->setParent(parentWindow.window->container);
void FixedLayout::update(Geometry &geometry) {
Layout::update(geometry);
foreach(child, fixedLayout->children) {
child.widget->setParent(*this);
child.widget->widget->widget->setParent(layout->parent->window->container);
child.widget->setGeometry(child.x, child.y, child.width, child.height);
if(parentWindow.window->defaultFont) {
if(layout->parent->window->defaultFont) {
QWidget *control = child.widget->widget->widget;
control->setFont(*parentWindow.window->defaultFont);
control->setFont(*layout->parent->window->defaultFont);
}
}
}
FixedLayout::FixedLayout() {
fixedLayout = new FixedLayout::Data(*this);
widget->widget = fixedLayout;
}

View File

@ -1,8 +1,3 @@
void HexEditor::setParent(Layout &parent) {
hexEditor->setParent(parent.widget->widget);
hexEditor->show();
}
void HexEditor::setSize(unsigned size) {
hexEditor->size = size;
bool indivisible = (hexEditor->size % hexEditor->columns) != 0; //add one for incomplete row

View File

@ -0,0 +1,70 @@
void HorizontalLayout::setParent(Window &parent) {
Layout::setParent(parent);
foreach(child, horizontalLayout->children) {
if(child.layout) {
child.layout->setParent(parent);
}
if(child.widget) {
child.widget->widget->widget->setParent(layout->parent->window->container);
if(!child.widget->widget->font && layout->parent->window->defaultFont) {
QWidget *control = child.widget->widget->widget;
control->setFont(*layout->parent->window->defaultFont);
}
}
}
}
void HorizontalLayout::append(VerticalLayout &layout, unsigned width, unsigned height, unsigned spacing) {
horizontalLayout->children.append({ &layout, 0, width, height, spacing });
}
void HorizontalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
horizontalLayout->children.append({ 0, &widget, width, height, spacing });
}
void HorizontalLayout::update(Geometry &geometry) {
Layout::update(geometry);
Geometry baseGeometry = geometry;
linear_vector<HorizontalLayout::Data::Children> children = horizontalLayout->children;
unsigned minimumWidth = 0;
foreach(child, children) minimumWidth += child.width + child.spacing;
unsigned autosizeWidgets = 0;
foreach(child, children) {
if(child.width == 0) autosizeWidgets++;
}
foreach(child, children) {
if(child.width == 0) child.width = (geometry.width - minimumWidth) / autosizeWidgets;
if(child.height == 0) child.height = geometry.height;
}
unsigned maxHeight = 0;
foreach(child, children) {
maxHeight = max(maxHeight, child.height);
}
foreach(child, children) {
if(child.layout) {
child.layout->update(geometry);
geometry.x += child.spacing;
geometry.width -= child.spacing;
geometry.y = baseGeometry.y;
geometry.height = baseGeometry.height;
}
if(child.widget) {
child.widget->setGeometry(geometry.x, geometry.y, child.width, child.height);
geometry.x += child.width + child.spacing;
geometry.width -= child.width + child.spacing;
}
}
geometry.y += maxHeight;
geometry.height -= maxHeight;
}
HorizontalLayout::HorizontalLayout() {
horizontalLayout = new HorizontalLayout::Data(*this);
}

View File

@ -1,8 +1,3 @@
void HorizontalSlider::setParent(Layout &parent) {
horizontalSlider->setParent(parent.widget->widget);
horizontalSlider->show();
}
void HorizontalSlider::setLength(unsigned length) {
length = length + (length == 0);
horizontalSlider->setRange(0, length - 1);

View File

@ -1,8 +1,3 @@
void Label::setParent(Layout &parent) {
label->setParent(parent.widget->widget);
label->show();
}
void Label::setText(const string &text) {
label->setText(QString::fromUtf8(text));
}

View File

@ -1,3 +1,18 @@
void Layout::setParent(Window &parent) {
layout->parent = &parent;
}
void Layout::update(Geometry &geometry) {
geometry.x += layout->margin;
geometry.y += layout->margin;
geometry.width -= layout->margin * 2;
geometry.height -= layout->margin * 2;
}
void Layout::setMargin(unsigned margin) {
layout->margin = margin;
}
Layout::Layout() {
layout = new Layout::Data(*this);
}

View File

@ -1,8 +1,3 @@
void ListBox::setParent(Layout &parent) {
listBox->setParent(parent.widget->widget);
listBox->show();
}
void ListBox::setHeaderText(const string &text) {
lstring list;
list.split("\t", text);

View File

@ -1,8 +1,3 @@
void ProgressBar::setParent(Layout &parent) {
progressBar->setParent(parent.widget->widget);
progressBar->show();
}
void ProgressBar::setPosition(unsigned position) {
progressBar->setValue(position);
}

View File

@ -14,6 +14,8 @@ namespace phoenix {
#include "widget.cpp"
#include "layout.cpp"
#include "fixed-layout.cpp"
#include "horizontal-layout.cpp"
#include "vertical-layout.cpp"
#include "button.cpp"
#include "canvas.cpp"
#include "checkbox.cpp"

View File

@ -112,28 +112,13 @@ struct MenuRadioItem : Action {
Data *menuRadioItem;
};
struct Window;
struct Layout;
struct Widget;
struct Widget : Object {
virtual void setParent(Layout &parent) {}
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
virtual void setFont(Font &font);
bool visible();
void setVisible(bool visible = true);
bool enabled();
void setEnabled(bool enabled = true);
virtual bool focused();
virtual void setFocused();
Widget();
//private:
struct Data;
Data *widget;
};
struct Window : Widget {
struct Window : Object {
nall::function<bool ()> onClose;
nall::function<void ()> onMove;
nall::function<void ()> onResize;
void create(unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
void setLayout(Layout &layout);
Geometry geometry();
@ -143,6 +128,7 @@ struct Window : Widget {
void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue);
void setTitle(const nall::string &text);
void setStatusText(const nall::string &text);
void setVisible(bool visible = true);
void setMenuVisible(bool visible = true);
void setStatusVisible(bool visible = true);
bool focused();
@ -155,8 +141,10 @@ struct Window : Widget {
static Window None;
};
struct Layout : Widget {
virtual void create(Window &parent) = 0;
struct Layout : Object {
virtual void setParent(Window &parent);
virtual void update(Geometry &geometry);
void setMargin(unsigned margin);
Layout();
//private:
struct Data;
@ -164,18 +152,58 @@ struct Layout : Widget {
};
struct FixedLayout : Layout {
void setParent(Window &parent);
void append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height);
void create(Window &parent);
void update(Geometry &geometry);
FixedLayout();
//private:
struct Data;
Data *fixedLayout;
};
struct HorizontalLayout;
struct VerticalLayout;
struct HorizontalLayout : Layout {
void setParent(Window &parent);
void append(VerticalLayout &layout, unsigned width, unsigned height, unsigned spacing = 0);
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
void update(Geometry &geometry);
HorizontalLayout();
//private:
struct Data;
Data *horizontalLayout;
};
struct VerticalLayout : Layout {
void setParent(Window &parent);
void append(HorizontalLayout &layout, unsigned width, unsigned height, unsigned spacing = 0);
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
void update(Geometry &geometry);
VerticalLayout();
//private:
struct Data;
Data *verticalLayout;
};
struct Widget : Object {
virtual Geometry geometry();
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
void setFont(Font &font);
bool visible();
void setVisible(bool visible = true);
bool enabled();
void setEnabled(bool enabled = true);
bool focused();
void setFocused();
Widget();
//private:
struct Data;
Data *widget;
};
struct Button : Widget {
nall::function<void ()> onTick;
void setParent(Layout &parent);
void setText(const nall::string &text);
Button();
//private:
@ -184,7 +212,6 @@ struct Button : Widget {
};
struct Canvas : Widget {
void setParent(Layout &parent);
void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
uint32_t* buffer();
void redraw();
@ -197,7 +224,6 @@ struct Canvas : Widget {
struct CheckBox : Widget {
nall::function<void ()> onTick;
void setParent(Layout &parent);
void setText(const nall::string &text);
bool checked();
void setChecked(bool checked = true);
@ -209,7 +235,6 @@ struct CheckBox : Widget {
struct ComboBox : Widget {
nall::function<void ()> onChange;
void setParent(Layout &parent);
void reset();
void addItem(const nall::string &text);
unsigned selection();
@ -222,7 +247,6 @@ struct ComboBox : Widget {
struct EditBox : Widget {
nall::function<void ()> onChange;
void setParent(Layout &parent);
void setEditable(bool editable = true);
void setWordWrap(bool wordWrap = true);
nall::string text();
@ -237,7 +261,6 @@ struct EditBox : Widget {
struct HexEditor : Widget {
nall::function<uint8_t (unsigned)> onRead;
nall::function<void (unsigned, uint8_t)> onWrite;
void setParent(Layout &parent);
void setSize(unsigned size);
void setOffset(unsigned offset);
void setColumns(unsigned columns);
@ -251,7 +274,6 @@ struct HexEditor : Widget {
struct HorizontalSlider : Widget {
nall::function<void ()> onChange;
void setParent(Layout &parent);
void setLength(unsigned length);
unsigned position();
void setPosition(unsigned position);
@ -262,7 +284,6 @@ struct HorizontalSlider : Widget {
};
struct Label : Widget {
void setParent(Layout &layout);
void setText(const nall::string &text);
Label();
//private:
@ -274,7 +295,6 @@ struct ListBox : Widget {
nall::function<void ()> onActivate;
nall::function<void ()> onChange;
nall::function<void (unsigned)> onTick;
void setParent(Layout &parent);
void setHeaderText(const nall::string &text);
void setHeaderVisible(bool headerVisible = true);
void setCheckable(bool checkable = true);
@ -293,7 +313,6 @@ struct ListBox : Widget {
};
struct ProgressBar : Widget {
void setParent(Layout &parent);
void setPosition(unsigned position);
ProgressBar();
//private:
@ -303,7 +322,6 @@ struct ProgressBar : Widget {
struct RadioBox : Widget {
nall::function<void ()> onTick;
void setParent(Layout &parent);
void setParent(RadioBox &parent);
void setText(const nall::string &text);
bool checked();
@ -317,7 +335,6 @@ struct RadioBox : Widget {
struct TextBox : Widget {
nall::function<void ()> onActivate;
nall::function<void ()> onChange;
void setParent(Layout &parent);
void setEditable(bool editable = true);
nall::string text();
void setText(const nall::string &text);
@ -329,7 +346,6 @@ struct TextBox : Widget {
struct VerticalSlider : Widget {
nall::function<void ()> onChange;
void setParent(Layout &parent);
void setLength(unsigned length);
unsigned position();
void setPosition(unsigned position);
@ -340,7 +356,6 @@ struct VerticalSlider : Widget {
};
struct Viewport : Widget {
void setParent(Layout &parent);
uintptr_t handle();
Viewport();
//private:

View File

@ -1,7 +1,7 @@
/****************************************************************************
** Meta object code from reading C++ file 'qt.moc.hpp'
**
** Created: Thu Feb 3 18:21:19 2011
** Created: Fri Feb 4 22:10:00 2011
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
**
** WARNING! All changes made in this file will be lost!
@ -193,104 +193,6 @@ int MenuRadioItem::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
}
return _id;
}
static const uint qt_meta_data_Layout__Data[] = {
// content:
4, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_Layout__Data[] = {
"Layout::Data\0"
};
const QMetaObject Layout::Data::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_Layout__Data,
qt_meta_data_Layout__Data, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &Layout::Data::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *Layout::Data::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *Layout::Data::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_Layout__Data))
return static_cast<void*>(const_cast< Data*>(this));
return QWidget::qt_metacast(_clname);
}
int Layout::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
static const uint qt_meta_data_FixedLayout__Data[] = {
// content:
4, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_FixedLayout__Data[] = {
"FixedLayout::Data\0"
};
const QMetaObject FixedLayout::Data::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_FixedLayout__Data,
qt_meta_data_FixedLayout__Data, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &FixedLayout::Data::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *FixedLayout::Data::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *FixedLayout::Data::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_FixedLayout__Data))
return static_cast<void*>(const_cast< Data*>(this));
return QWidget::qt_metacast(_clname);
}
int FixedLayout::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
static const uint qt_meta_data_Window__Data[] = {
// content:
@ -340,6 +242,202 @@ int Window::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
return _id;
return _id;
}
static const uint qt_meta_data_Layout__Data[] = {
// content:
4, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_Layout__Data[] = {
"Layout::Data\0"
};
const QMetaObject Layout::Data::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_Layout__Data,
qt_meta_data_Layout__Data, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &Layout::Data::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *Layout::Data::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *Layout::Data::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_Layout__Data))
return static_cast<void*>(const_cast< Data*>(this));
return QObject::qt_metacast(_clname);
}
int Layout::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
static const uint qt_meta_data_FixedLayout__Data[] = {
// content:
4, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_FixedLayout__Data[] = {
"FixedLayout::Data\0"
};
const QMetaObject FixedLayout::Data::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_FixedLayout__Data,
qt_meta_data_FixedLayout__Data, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &FixedLayout::Data::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *FixedLayout::Data::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *FixedLayout::Data::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_FixedLayout__Data))
return static_cast<void*>(const_cast< Data*>(this));
return QObject::qt_metacast(_clname);
}
int FixedLayout::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
static const uint qt_meta_data_HorizontalLayout__Data[] = {
// content:
4, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_HorizontalLayout__Data[] = {
"HorizontalLayout::Data\0"
};
const QMetaObject HorizontalLayout::Data::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_HorizontalLayout__Data,
qt_meta_data_HorizontalLayout__Data, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &HorizontalLayout::Data::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *HorizontalLayout::Data::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *HorizontalLayout::Data::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_HorizontalLayout__Data))
return static_cast<void*>(const_cast< Data*>(this));
return QObject::qt_metacast(_clname);
}
int HorizontalLayout::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
static const uint qt_meta_data_VerticalLayout__Data[] = {
// content:
4, // revision
0, // classname
0, 0, // classinfo
0, 0, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
0 // eod
};
static const char qt_meta_stringdata_VerticalLayout__Data[] = {
"VerticalLayout::Data\0"
};
const QMetaObject VerticalLayout::Data::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_VerticalLayout__Data,
qt_meta_data_VerticalLayout__Data, 0 }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &VerticalLayout::Data::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *VerticalLayout::Data::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *VerticalLayout::Data::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_VerticalLayout__Data))
return static_cast<void*>(const_cast< Data*>(this));
return QObject::qt_metacast(_clname);
}
int VerticalLayout::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
return _id;
}
static const uint qt_meta_data_Button__Data[] = {
// content:

View File

@ -81,26 +81,84 @@ public slots:
}
};
struct Widget::Data {
public:
Widget &self;
QWidget *widget;
struct Window::Data : public QWidget {
Q_OBJECT
Data(Widget &self) : self(self) {
public:
Window &self;
unsigned x, y, width, height;
bool fullscreen, menuVisible, statusVisible;
Layout *layout;
QFont *defaultFont;
QVBoxLayout *vlayout;
QMenuBar *menuBar;
QStatusBar *statusBar;
QWidget *container;
QSize sizeHint() const {
unsigned actualHeight = height;
if(menuVisible) actualHeight += menuBar->height();
if(statusVisible) actualHeight += statusBar->height();
return QSize(width, actualHeight);
}
void closeEvent(QCloseEvent *event) {
if(self.onClose) {
bool result = self.onClose();
if(result == false) event->ignore();
}
}
void moveEvent(QMoveEvent *event) {
if(fullscreen == false && isVisible() == true) {
x = frameGeometry().x();
y = frameGeometry().y();
}
if(self.onMove) {
self.onMove();
}
}
void resizeEvent(QResizeEvent *event) {
if(fullscreen == false && isVisible() == true) {
width = container->geometry().width();
height = container->geometry().height();
}
if(layout) {
Geometry geom = self.geometry();
geom.x = geom.y = 0;
layout->update(geom);
}
if(self.onResize) {
self.onResize();
}
}
Data(Window &self) : self(self) {
fullscreen = false;
menuVisible = false;
statusVisible = false;
}
};
struct Layout::Data : public QWidget {
struct Layout::Data : public QObject {
Q_OBJECT
public:
Layout &self;
Window *parent;
unsigned margin;
Data(Layout &self) : self(self) {
parent = 0;
margin = 0;
}
};
struct FixedLayout::Data : public QWidget {
struct FixedLayout::Data : public QObject {
Q_OBJECT
public:
@ -117,26 +175,47 @@ public:
}
};
struct Window::Data : public QWidget {
struct HorizontalLayout::Data : public QObject {
Q_OBJECT
public:
Window &self;
Layout *layout;
QFont *defaultFont;
QVBoxLayout *vlayout;
QMenuBar *menuBar;
QWidget *container;
QStatusBar *statusBar;
HorizontalLayout &self;
struct Children {
VerticalLayout *layout;
Widget *widget;
unsigned width, height, spacing;
};
linear_vector<Children> children;
void closeEvent(QCloseEvent *event) {
if(self.onClose) {
bool result = self.onClose();
if(result == false) event->ignore();
}
Data(HorizontalLayout &self) : self(self) {
}
};
Data(Window &self) : self(self) {
struct VerticalLayout::Data : public QObject {
Q_OBJECT
public:
VerticalLayout &self;
struct Children {
HorizontalLayout *layout;
Widget *widget;
unsigned width, height, spacing;
};
linear_vector<Children> children;
Data(VerticalLayout &self) : self(self) {
}
};
struct Widget::Data {
public:
Widget &self;
QWidget *widget;
Font *font;
Data(Widget &self) : self(self) {
widget = 0;
font = 0;
}
};

View File

@ -1,8 +1,3 @@
void RadioBox::setParent(Layout &parent) {
radioBox->setParent(parent.widget->widget);
radioBox->show();
}
void RadioBox::setParent(RadioBox &parent) {
parent.radioBox->buttonGroup->addButton(radioBox);
parent.radioBox->setChecked(true);

View File

@ -1,8 +1,3 @@
void TextBox::setParent(Layout &parent) {
textBox->setParent(parent.widget->widget);
textBox->show();
}
void TextBox::setEditable(bool editable) {
textBox->setReadOnly(editable == false);
}

View File

@ -0,0 +1,70 @@
void VerticalLayout::setParent(Window &parent) {
Layout::setParent(parent);
foreach(child, verticalLayout->children) {
if(child.layout) {
child.layout->setParent(parent);
}
if(child.widget) {
child.widget->widget->widget->setParent(layout->parent->window->container);
if(!child.widget->widget->font && layout->parent->window->defaultFont) {
QWidget *control = child.widget->widget->widget;
control->setFont(*layout->parent->window->defaultFont);
}
}
}
}
void VerticalLayout::append(HorizontalLayout &layout, unsigned width, unsigned height, unsigned spacing) {
verticalLayout->children.append({ &layout, 0, width, height, spacing });
}
void VerticalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
verticalLayout->children.append({ 0, &widget, width, height, spacing });
}
void VerticalLayout::update(Geometry &geometry) {
Layout::update(geometry);
Geometry baseGeometry = geometry;
linear_vector<VerticalLayout::Data::Children> children = verticalLayout->children;
unsigned minimumHeight = 0;
foreach(child, children) minimumHeight += child.height + child.spacing;
unsigned autosizeWidgets = 0;
foreach(child, children) {
if(child.height == 0) autosizeWidgets++;
}
foreach(child, children) {
if(child.width == 0) child.width = geometry.width;
if(child.height == 0) child.height = (geometry.height - minimumHeight) / autosizeWidgets;
}
unsigned maxWidth = 0;
foreach(child, children) {
maxWidth = max(maxWidth, child.width);
}
foreach(child, children) {
if(child.layout) {
child.layout->update(geometry);
geometry.x = baseGeometry.x;
geometry.width = baseGeometry.width;
geometry.y += child.spacing;
geometry.height -= child.spacing;
}
if(child.widget) {
child.widget->setGeometry(geometry.x, geometry.y, child.width, child.height);
geometry.y += child.height + child.spacing;
geometry.height -= child.height + child.spacing;
}
}
geometry.x += maxWidth;
geometry.width -= maxWidth;
}
VerticalLayout::VerticalLayout() {
verticalLayout = new VerticalLayout::Data(*this);
}

View File

@ -1,8 +1,3 @@
void VerticalSlider::setParent(Layout &parent) {
verticalSlider->setParent(parent.widget->widget);
verticalSlider->show();
}
void VerticalSlider::setLength(unsigned length) {
length = length + (length == 0);
verticalSlider->setRange(0, length - 1);

View File

@ -1,8 +1,3 @@
void Viewport::setParent(Layout &parent) {
viewport->setParent(parent.widget->widget);
viewport->show();
}
uintptr_t Viewport::handle() {
return (uintptr_t)viewport->winId();
}

View File

@ -1,8 +1,16 @@
Geometry Widget::geometry() {
return {
widget->widget->x(), widget->widget->y(),
widget->widget->width(), widget->widget->height()
};
}
void Widget::setGeometry(unsigned x, unsigned y, unsigned width, unsigned height) {
widget->widget->setGeometry(x, y, width, height);
}
void Widget::setFont(Font &font) {
widget->font = &font;
widget->widget->setFont(*font.font);
}

View File

@ -1,12 +1,9 @@
void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
window->setWindowTitle(QString::fromUtf8(text));
window->move(x, y);
window->vlayout = new QVBoxLayout(window);
window->vlayout->setAlignment(Qt::AlignTop);
window->vlayout->setMargin(0);
window->vlayout->setSpacing(0);
window->vlayout->setSizeConstraint(QLayout::SetFixedSize);
window->setLayout(window->vlayout);
window->menuBar = new QMenuBar(window);
@ -14,7 +11,7 @@ void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, con
window->vlayout->addWidget(window->menuBar);
window->container = new QWidget(window);
window->container->setFixedSize(width, height);
window->container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
window->container->setVisible(true);
window->vlayout->addWidget(window->container);
@ -22,20 +19,33 @@ void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, con
window->statusBar->setSizeGripEnabled(false);
window->statusBar->setVisible(false);
window->vlayout->addWidget(window->statusBar);
setGeometry(x, y, width, height);
}
void Window::setLayout(Layout &layout) {
window->layout = &layout;
layout.create(*this);
Geometry geom = geometry();
geom.x = geom.y = 0;
layout.setParent(*this);
layout.update(geom);
}
Geometry Window::geometry() {
return Geometry(window->x(), window->y(), window->container->width(), window->container->height());
//QWidget::geometry() is not at all reliable
if(window->fullscreen == false) return { window->x, window->y, window->width, window->height };
return { 0, 0, OS::desktopWidth(), OS::desktopHeight() };
}
void Window::setGeometry(unsigned x, unsigned y, unsigned width, unsigned height) {
window->container->setFixedSize(width, height);
window->x = x;
window->y = y;
window->width = width;
window->height = height;
window->move(x, y);
window->adjustSize();
}
void Window::setDefaultFont(Font &font) {
@ -62,12 +72,23 @@ void Window::setStatusText(const string &text) {
window->statusBar->showMessage(QString::fromUtf8(text), 0);
}
void Window::setVisible(bool visible) {
if(visible) {
window->show();
window->adjustSize();
} else {
window->hide();
}
}
void Window::setMenuVisible(bool visible) {
window->menuVisible = visible;
if(visible) window->menuBar->show();
else window->menuBar->hide();
}
void Window::setStatusVisible(bool visible) {
window->statusVisible = visible;
if(visible) window->statusBar->show();
else window->statusBar->hide();
}
@ -81,34 +102,17 @@ bool Window::fullscreen() {
}
void Window::setFullscreen(bool fullscreen) {
window->fullscreen = fullscreen;
if(fullscreen == false) {
window->vlayout->setSizeConstraint(QLayout::SetFixedSize);
window->showNormal();
window->adjustSize();
} else {
window->vlayout->setSizeConstraint(QLayout::SetNoConstraint);
window->container->setFixedSize(OS::desktopWidth(), OS::desktopHeight());
window->showFullScreen();
}
//Qt returns negative coordinates for x,y immediately after setFullscreen(false)
//wait for Qt to return sane values, or until timeout occurs
Geometry geom;
time_t startTime = time(0);
do {
OS::run();
geom = geometry();
if(startTime - time(0) > 3) break;
} while((signed)geom.x < 0 || (signed)geom.y < 0);
if(fullscreen == false) {
window->layout->setGeometry(0, 0, geometry().width, geometry().height);
} else {
window->layout->setGeometry(0, 0, OS::desktopWidth(), OS::desktopHeight());
}
}
Window::Window() {
window = new Window::Data(*this);
window->defaultFont = 0;
widget->widget = window;
}

View File

@ -77,7 +77,6 @@ void Cheat::init() {
Cheat::Cheat() {
lookup = new uint8[16 * 1024 * 1024];
system_enabled = true;
synchronize();
}
Cheat::~Cheat() {

View File

@ -1,12 +1,12 @@
namespace SNES {
namespace Info {
static const char Name[] = "bsnes";
static const char Version[] = "075.07";
static const char Version[] = "075.08";
static const unsigned SerializerVersion = 18;
}
}
#define DEBUGGER
//#define DEBUGGER
#include <libco/libco.h>

View File

@ -1,7 +1,7 @@
Console console;
void Console::create() {
Window::create(0, 0, 256, 256, "Console");
Window::create(0, 0, 715, 350, "Console");
application.addWindow(this, "Debugger.Console", "192,192");
output.setFont(application.monospaceFont);
@ -14,7 +14,18 @@ void Console::create() {
traceCPU.setChecked(true);
clearConsole.setText("Clear console");
unsigned x = 5, y = 5;
layout.setMargin(5);
layout.append(output, 0, 0, 5);
controlLayout.append(traceToConsole, 120, Style::CheckBoxHeight);
controlLayout.append(traceToFile, 120, Style::CheckBoxHeight);
controlLayout.append(traceCPU, 120, Style::CheckBoxHeight);
controlLayout.append(traceSMP, 120, Style::CheckBoxHeight);
controlLayout.append(spacer, 120, 0, Style::CheckBoxHeight);
controlLayout.append(clearConsole, 120, Style::ButtonHeight);
layout.append(controlLayout, 120, 0);
setLayout(layout);
/*unsigned x = 5, y = 5;
layout.append(output, x, y, 580, 338); x += 580 + 5;
layout.append(traceToConsole, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
layout.append(traceToFile, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
@ -22,7 +33,7 @@ void Console::create() {
layout.append(traceSMP, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
layout.append(clearConsole, x, 348 - Style::ButtonHeight - 5, 120, Style::ButtonHeight);
setGeometry(0, 0, 715, 348);
setLayout(layout);
setLayout(layout);*/
onClose = []() {
debugger.showConsole.setChecked(false);

View File

@ -1,10 +1,12 @@
struct Console : TopLevelWindow {
FixedLayout layout;
HorizontalLayout layout;
EditBox output;
VerticalLayout controlLayout;
CheckBox traceToConsole;
CheckBox traceToFile;
CheckBox traceCPU;
CheckBox traceSMP;
Label spacer;
Button clearConsole;
string buffer;

View File

@ -1,7 +1,7 @@
CPUDebugger cpuDebugger;
void CPUDebugger::create() {
Window::create(0, 0, 256, 256, "CPU Debugger");
Window::create(0, 0, 495, 220, "CPU Debugger");
application.addWindow(this, "Debugger.CPUdebugger", "192,192");
output.setFont(application.monospaceFont);
@ -11,12 +11,12 @@ void CPUDebugger::create() {
proceed.setText("Proceed");
proceed.setEnabled(false);
unsigned x = 5, y = 5;
layout.append(output, x, y, 400, 210); x += 400 + 5;
layout.append(stepInto, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
layout.append(stepOver, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
layout.append(proceed, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
setGeometry(0, 0, 495, 220);
layout.setMargin(5);
layout.append(output, 0, 0, 5);
controlLayout.append(stepInto, 80, Style::ButtonHeight);
controlLayout.append(stepOver, 80, Style::ButtonHeight);
controlLayout.append(proceed, 80, Style::ButtonHeight);
layout.append(controlLayout, 80, 0);
setLayout(layout);
onClose = []() {

View File

@ -1,6 +1,7 @@
struct CPUDebugger : TopLevelWindow {
FixedLayout layout;
HorizontalLayout layout;
EditBox output;
VerticalLayout controlLayout;
Button stepInto;
Button stepOver;
Button proceed;

View File

@ -18,7 +18,7 @@ void Debugger::create() {
breakpointEditor.create();
memoryEditor.create();
Window::create(0, 0, 256, 256, "Debugger");
Window::create(0, 0, 256, 80, "Debugger");
application.addWindow(this, "Debugger", "160,160");
enableDebugger.setText("Enable debugger");
@ -28,7 +28,16 @@ void Debugger::create() {
showBreakpointEditor.setText("Breakpoint editor");
showMemoryEditor.setText("Memory editor");
unsigned x = 5, y = 5;
layout.setMargin(5);
layout.append(enableDebugger, 0, Style::CheckBoxHeight);
layout.append(showConsole, 0, Style::CheckBoxHeight);
layout.append(showCPUDebugger, 0, Style::CheckBoxHeight);
layout.append(showSMPDebugger, 0, Style::CheckBoxHeight);
layout.append(showBreakpointEditor, 0, Style::CheckBoxHeight);
layout.append(showMemoryEditor, 0, Style::CheckBoxHeight);
setLayout(layout);
/*unsigned x = 5, y = 5;
layout.append(enableDebugger, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
layout.append(showConsole, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
layout.append(showCPUDebugger, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
@ -36,7 +45,7 @@ void Debugger::create() {
layout.append(showBreakpointEditor, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
layout.append(showMemoryEditor, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
setGeometry(0, 0, 250, y);
setLayout(layout);
setLayout(layout);*/
//windows shown by default
showConsole.setChecked();

View File

@ -12,7 +12,7 @@ struct Debugger : TopLevelWindow {
StepIntoSMP,
} debugMode;
FixedLayout layout;
VerticalLayout layout;
CheckBox enableDebugger;
CheckBox showConsole;
CheckBox showCPUDebugger;

View File

@ -1,7 +1,7 @@
SMPDebugger smpDebugger;
void SMPDebugger::create() {
Window::create(0, 0, 256, 256, "SMP Debugger");
Window::create(0, 0, 495, 220, "SMP Debugger");
application.addWindow(this, "Debugger.SMPDebugger", "192,192");
output.setFont(application.monospaceFont);
@ -11,12 +11,12 @@ void SMPDebugger::create() {
proceed.setText("Proceed");
proceed.setEnabled(false);
unsigned x = 5, y = 5;
layout.append(output, x, y, 400, 210); x += 400 + 5;
layout.append(stepInto, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
layout.append(stepOver, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
layout.append(proceed, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
setGeometry(0, 0, 495, 220);
layout.setMargin(5);
layout.append(output, 0, 0, 5);
controlLayout.append(stepInto, 80, Style::ButtonHeight);
controlLayout.append(stepOver, 80, Style::ButtonHeight);
controlLayout.append(proceed, 80, Style::ButtonHeight);
layout.append(controlLayout, 80, 0);
setLayout(layout);
onClose = []() {

View File

@ -1,6 +1,7 @@
struct SMPDebugger : TopLevelWindow {
FixedLayout layout;
HorizontalLayout layout;
EditBox output;
VerticalLayout controlLayout;
Button stepInto;
Button stepOver;
Button proceed;

View File

@ -1,7 +1,7 @@
BreakpointEditor breakpointEditor;
void BreakpointEditor::create() {
Window::create(0, 0, 256, 256, "Breakpoint Editor");
Window::create(0, 0, 310, 240, "Breakpoint Editor");
application.addWindow(this, "Debugger.BreakpointEditor", "192,192");
runToBreakpoint.setText("Run to breakpoint");
@ -18,7 +18,19 @@ void BreakpointEditor::create() {
enableBox[n].onTick = [n]() { breakpointEditor.toggleBreakpoint(n); };
}
unsigned x = 5, y = 5;
layout.setMargin(5);
layout.append(runToBreakpoint, 0, Style::CheckBoxHeight, 5);
for(unsigned n = 0; n < Breakpoints; n++) {
breakpointLayout[n].append(enableBox[n], 35, Style::EditBoxHeight);
breakpointLayout[n].append(addressBox[n], 60, Style::EditBoxHeight, 5);
breakpointLayout[n].append(valueBox[n], 30, Style::EditBoxHeight, 5);
breakpointLayout[n].append(typeBox[n], 80, Style::EditBoxHeight, 5);
breakpointLayout[n].append(sourceBox[n], 80, Style::EditBoxHeight);
layout.append(breakpointLayout[n], 0, Style::EditBoxHeight, 5);
}
setLayout(layout);
/*unsigned x = 5, y = 5;
layout.append(runToBreakpoint, x, y, 295, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
for(unsigned n = 0; n < Breakpoints; n++) {
layout.append(enableBox[n], x, y, 35, Style::EditBoxHeight);
@ -28,7 +40,7 @@ void BreakpointEditor::create() {
layout.append(sourceBox[n], x + 220, y, 80, Style::EditBoxHeight); y += Style::EditBoxHeight + 5;
}
setGeometry(0, 0, 310, y);
setLayout(layout);
setLayout(layout);*/
runToBreakpoint.onTick = []() {
if(breakpointEditor.runToBreakpoint.checked()) {

View File

@ -1,7 +1,8 @@
struct BreakpointEditor : TopLevelWindow {
enum : unsigned { Breakpoints = SNES::Debugger::Breakpoints };
FixedLayout layout;
VerticalLayout layout;
CheckBox runToBreakpoint;
HorizontalLayout breakpointLayout[Breakpoints];
CheckBox enableBox[Breakpoints];
TextBox addressBox[Breakpoints];
TextBox valueBox[Breakpoints];

View File

@ -1,9 +1,10 @@
MemoryEditor memoryEditor;
void MemoryEditor::create() {
Window::create(0, 0, 256, 256, "Memory Editor");
Window::create(0, 0, 570, 230, "Memory Editor");
application.addWindow(this, "Debugger.MemoryEditor", "192,192");
editor.setFont(application.monospaceFont);
editor.setColumns(16);
editor.setRows(16);
sourceBox.addItem("CPU");
@ -13,16 +14,14 @@ void MemoryEditor::create() {
sourceBox.addItem("CGRAM");
refreshButton.setText("Refresh");
unsigned x = 5, y = 5;
layout.append(editor, x, y, 475, 220); x += 475 + 5;
layout.append(sourceBox, x, y, 80, Style::ComboBoxHeight); y += Style::ComboBoxHeight;
layout.append(gotoBox, x, y, 80, Style::TextBoxHeight); y += Style::TextBoxHeight;
layout.append(refreshButton, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
setGeometry(0, 0, 570, 230);
layout.setMargin(5);
layout.append(editor, 0, 0, 5);
controlLayout.append(sourceBox, 80, Style::ComboBoxHeight);
controlLayout.append(gotoBox, 80, Style::ComboBoxHeight);
controlLayout.append(refreshButton, 80, Style::ComboBoxHeight);
layout.append(controlLayout, 80, 0);
setLayout(layout);
editor.setFont(application.monospaceFont);
onClose = []() {
debugger.showMemoryEditor.setChecked(false);
return true;

View File

@ -1,6 +1,7 @@
struct MemoryEditor : TopLevelWindow {
FixedLayout layout;
HorizontalLayout layout;
HexEditor editor;
VerticalLayout controlLayout;
ComboBox sourceBox;
TextBox gotoBox;
Button refreshButton;

View File

@ -1,19 +1,18 @@
FileBrowser fileBrowser;
void FileBrowser::create() {
Window::create(0, 0, 256, 256);
Window::create(0, 0, 640, 400);
application.addWindow(this, "FileBrowser", "160,160");
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
browseButton.setText("...");
upButton.setText("..");
layout.append(pathBox, x, y, 630 - height - height - 10, height);
layout.append(browseButton, x + 630 - height - height - 5, y, height, height);
layout.append(upButton, x + 630 - height, y, height, height); y += height + 5;
layout.append(contentsBox, x, y, 630, 350); y += 350 + 5;
setGeometry(0, 0, 640, y);
layout.setMargin(5);
pathLayout.append(pathBox, 0, Style::TextBoxHeight, 5);
pathLayout.append(browseButton, Style::TextBoxHeight, Style::TextBoxHeight, 5);
pathLayout.append(upButton, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(pathLayout, 0, Style::TextBoxHeight, 5);
layout.append(contentsBox, 0, 0);
setLayout(layout);
pathBox.onActivate = []() {

View File

@ -1,5 +1,6 @@
struct FileBrowser : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
HorizontalLayout pathLayout;
TextBox pathBox;
Button browseButton;
Button upButton;

View File

@ -2,25 +2,27 @@ SingleSlotLoader singleSlotLoader;
DoubleSlotLoader doubleSlotLoader;
void SingleSlotLoader::create() {
Window::create(0, 0, 256, 256);
Window::create(0, 0, 480, 80);
application.addWindow(this, "SingleSlotLoader", "160,160");
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
baseLabel.setText("Base:");
baseBrowse.setText("...");
slotLabel.setText("Slot:");
slotBrowse.setText("...");
okButton.setText("Ok");
layout.append(baseLabel, x, y, 50, height);
layout.append(basePath, x + 50, y, 300, height);
layout.append(baseBrowse, x + 355, y, height, height); y += height + 5;
layout.append(slotLabel, x, y, 50, height);
layout.append(slotPath, x + 50, y, 300, height);
layout.append(slotBrowse, x + 355, y, height, height); y += height + 5;
layout.append(okButton, x + width - 90, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
setGeometry(0, 0, width, y);
layout.setMargin(5);
baseLayout.append(baseLabel, 40, Style::TextBoxHeight, 5);
baseLayout.append(basePath, 0, Style::TextBoxHeight, 5);
baseLayout.append(baseBrowse, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(baseLayout, 0, Style::TextBoxHeight, 5);
slotLayout.append(slotLabel, 40, Style::TextBoxHeight, 5);
slotLayout.append(slotPath, 0, Style::TextBoxHeight, 5);
slotLayout.append(slotBrowse, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(slotLayout, 0, Style::TextBoxHeight, 5);
controlLayout.append(spacer, 0, Style::ButtonHeight);
controlLayout.append(okButton, 80, Style::ButtonHeight);
layout.append(controlLayout, 0, Style::ButtonHeight);
setLayout(layout);
baseBrowse.onTick = []() {
@ -91,11 +93,9 @@ void SingleSlotLoader::load() {
//
void DoubleSlotLoader::create() {
Window::create(0, 0, 256, 256);
Window::create(0, 0, 480, 115);
application.addWindow(this, "DoubleSlotLoader", "160,160");
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
baseLabel.setText("Base:");
baseBrowse.setText("...");
slotALabel.setText("Slot A:");
@ -104,17 +104,22 @@ void DoubleSlotLoader::create() {
slotBBrowse.setText("...");
okButton.setText("Ok");
layout.append(baseLabel, x, y, 50, height);
layout.append(basePath, x + 50, y, 300, height);
layout.append(baseBrowse, x + 355, y, height, height); y += height + 5;
layout.append(slotALabel, x, y, 50, height);
layout.append(slotAPath, x + 50, y, 300, height);
layout.append(slotABrowse, x + 355, y, height, height); y += height + 5;
layout.append(slotBLabel, x, y, 50, height);
layout.append(slotBPath, x + 50, y, 300, height);
layout.append(slotBBrowse, x + 355, y, height, height); y += height + 5;
layout.append(okButton, x + width - 90, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
setGeometry(0, 0, width, y);
layout.setMargin(5);
baseLayout.append(baseLabel, 40, Style::TextBoxHeight, 5);
baseLayout.append(basePath, 0, Style::TextBoxHeight, 5);
baseLayout.append(baseBrowse, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(baseLayout, 0, Style::TextBoxHeight, 5);
slotALayout.append(slotALabel, 40, Style::TextBoxHeight, 5);
slotALayout.append(slotAPath, 0, Style::TextBoxHeight, 5);
slotALayout.append(slotABrowse, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(slotALayout, 0, Style::TextBoxHeight, 5);
slotBLayout.append(slotBLabel, 40, Style::TextBoxHeight, 5);
slotBLayout.append(slotBPath, 0, Style::TextBoxHeight, 5);
slotBLayout.append(slotBBrowse, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(slotBLayout, 0, Style::TextBoxHeight, 5);
controlLayout.append(spacer, 0, Style::ButtonHeight);
controlLayout.append(okButton, 80, Style::ButtonHeight);
layout.append(controlLayout, 0, Style::ButtonHeight);
setLayout(layout);
baseBrowse.onTick = []() {

View File

@ -1,11 +1,15 @@
struct SingleSlotLoader : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
HorizontalLayout baseLayout;
Label baseLabel;
TextBox basePath;
Button baseBrowse;
HorizontalLayout slotLayout;
Label slotLabel;
TextBox slotPath;
Button slotBrowse;
HorizontalLayout controlLayout;
Label spacer;
Button okButton;
void create();
@ -18,16 +22,21 @@ struct SingleSlotLoader : TopLevelWindow {
};
struct DoubleSlotLoader : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
HorizontalLayout baseLayout;
Label baseLabel;
TextBox basePath;
Button baseBrowse;
HorizontalLayout slotALayout;
Label slotALabel;
TextBox slotAPath;
Button slotABrowse;
HorizontalLayout slotBLayout;
Label slotBLabel;
TextBox slotBPath;
Button slotBBrowse;
HorizontalLayout controlLayout;
Label spacer;
Button okButton;
void create();

View File

@ -79,6 +79,11 @@ void Filter::render(uint32_t *output, unsigned outpitch, const uint16_t *input,
}
void Interface::video_refresh(const uint16_t *data, unsigned width, unsigned height) {
//TODO: this should not be necessary ... somehow window is not updated otherwise
mainWindow.viewport.setGeometry(
utility.viewportX, utility.viewportY, utility.viewportWidth, utility.viewportHeight
);
bool interlace = (height >= 240);
bool overscan = (height == 239 || height == 478);
unsigned inpitch = interlace ? 1024 : 2048;

View File

@ -1,11 +1,9 @@
AdvancedSettings advancedSettings;
void AdvancedSettings::create() {
Window::create(0, 0, 256, 256, "Advanced Settings");
Window::create(0, 0, 640, 80, "Advanced Settings");
application.addWindow(this, "AdvancedSettings", "160,160");
unsigned x = 5, y = 5;
driverSelectionLabel.setText("Driver Selection :.");
driverSelectionLabel.setFont(application.proportionalFontBold);
videoDriverLabel.setText("Video:");
@ -22,6 +20,23 @@ void AdvancedSettings::create() {
if(config.settings.focusPolicy == 1) focusPolicyIgnore.setChecked();
if(config.settings.focusPolicy == 2) focusPolicyAllow.setChecked();
layout.setMargin(5);
layout.append(driverSelectionLabel, 0, Style::LabelHeight);
driverLayout.append(videoDriverLabel, 40, Style::ComboBoxHeight, 5);
driverLayout.append(videoDriverBox, 0, Style::ComboBoxHeight, 5);
driverLayout.append(audioDriverLabel, 40, Style::ComboBoxHeight, 5);
driverLayout.append(audioDriverBox, 0, Style::ComboBoxHeight, 5);
driverLayout.append(inputDriverLabel, 40, Style::ComboBoxHeight, 5);
driverLayout.append(inputDriverBox, 0, Style::ComboBoxHeight);
layout.append(driverLayout, 0, Style::ComboBoxHeight, 5);
layout.append(focusPolicyLabel, 0, Style::LabelHeight);
focusPolicyLayout.append(focusPolicyPause, 0, Style::CheckBoxHeight, 5);
focusPolicyLayout.append(focusPolicyIgnore, 0, Style::CheckBoxHeight, 5);
focusPolicyLayout.append(focusPolicyAllow, 0, Style::CheckBoxHeight);
layout.append(focusPolicyLayout, 0, Style::CheckBoxHeight);
setLayout(layout);
/*unsigned x = 5, y = 5;
layout.append(driverSelectionLabel, x, y, 595, Style::LabelHeight); y += Style::LabelHeight + 5;
layout.append(videoDriverLabel, x, y, 45, Style::ComboBoxHeight);
layout.append(videoDriverBox, x + 45, y, 150, Style::ComboBoxHeight);
@ -34,7 +49,7 @@ void AdvancedSettings::create() {
layout.append(focusPolicyIgnore, x + 200, y, 195, Style::CheckBoxHeight);
layout.append(focusPolicyAllow, x + 400, y, 195, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
setGeometry(0, 0, 605, y);
setLayout(layout);
setLayout(layout);*/
lstring list;

View File

@ -1,6 +1,7 @@
struct AdvancedSettings : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
Label driverSelectionLabel;
HorizontalLayout driverLayout;
Label videoDriverLabel;
ComboBox videoDriverBox;
Label audioDriverLabel;
@ -8,6 +9,7 @@ struct AdvancedSettings : TopLevelWindow {
Label inputDriverLabel;
ComboBox inputDriverBox;
Label focusPolicyLabel;
HorizontalLayout focusPolicyLayout;
RadioBox focusPolicyPause;
RadioBox focusPolicyIgnore;
RadioBox focusPolicyAllow;

View File

@ -1,7 +1,7 @@
AudioSettings audioSettings;
void AudioSettings::create() {
Window::create(0, 0, 256, 256, "Audio Settings");
Window::create(0, 0, 480, 50, "Audio Settings");
application.addWindow(this, "AudioSettings", "160,160");
volumeLabel.setText("Volume:");
@ -9,7 +9,18 @@ void AudioSettings::create() {
frequencyLabel.setText("Frequency:");
frequencySlider.setLength(2001);
unsigned x = 5, y = 5;
layout.setMargin(5);
volumeLayout.append(volumeLabel, 70, Style::SliderHeight);
volumeLayout.append(volumeValue, 60, Style::SliderHeight);
volumeLayout.append(volumeSlider, 0, Style::SliderHeight);
layout.append(volumeLayout, 0, Style::SliderHeight);
frequencyLayout.append(frequencyLabel, 70, Style::SliderHeight);
frequencyLayout.append(frequencyValue, 60, Style::SliderHeight);
frequencyLayout.append(frequencySlider, 0, Style::SliderHeight);
layout.append(frequencyLayout, 0, Style::SliderHeight);
setLayout(layout);
/*unsigned x = 5, y = 5;
layout.append(volumeLabel, x, y, 70, Style::SliderHeight);
layout.append(volumeValue, x + 70, y, 60, Style::SliderHeight);
layout.append(volumeSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
@ -17,7 +28,7 @@ void AudioSettings::create() {
layout.append(frequencyValue, x + 70, y, 60, Style::SliderHeight);
layout.append(frequencySlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
setGeometry(0, 0, 440, y);
setLayout(layout);
setLayout(layout);*/
volumeSlider.onChange = []() {
config.audio.volume = audioSettings.volumeSlider.position();

View File

@ -1,8 +1,10 @@
struct AudioSettings : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
HorizontalLayout volumeLayout;
Label volumeLabel;
Label volumeValue;
HorizontalSlider volumeSlider;
HorizontalLayout frequencyLayout;
Label frequencyLabel;
Label frequencyValue;
HorizontalSlider frequencySlider;

View File

@ -2,7 +2,7 @@ InputSettings inputSettings;
static InputMapper::AbstractInput *activeInput = 0;
void InputSettings::create() {
Window::create(0, 0, 256, 256, "Input Settings");
Window::create(0, 0, 640, 300, "Input Settings");
application.addWindow(this, "InputSettings", "160,160");
setFont(application.proportionalFontBold);
setStatusVisible();
@ -23,19 +23,21 @@ void InputSettings::create() {
mouseRight.setText("Mouse Right");
clearButton.setText("Clear");
unsigned x = 5, y = 5, height = Style::ButtonHeight;
layout.append(portLabel, x, y, 50, Style::ComboBoxHeight);
layout.append(portBox, x + 50, y, 200, Style::ComboBoxHeight);
layout.append(deviceLabel, x + 255, y, 50, Style::ComboBoxHeight);
layout.append(deviceBox, x + 305, y, 200, Style::ComboBoxHeight); y += Style::ComboBoxHeight + 5;
layout.append(mappingList, x, y, 505, 265); y += 265 + 5;
layout.append(mouseXaxis, x, y, 100, height);
layout.append(mouseYaxis, x + 105, y, 100, height);
layout.append(mouseLeft, x, y, 100, height);
layout.append(mouseMiddle, x + 105, y, 100, height);
layout.append(mouseRight, x + 105 + 105, y, 100, height);
layout.append(clearButton, 515 - 85, y, 80, height); y += height + 5;
setGeometry(0, 0, 515, y);
layout.setMargin(5);
selectionLayout.append(portLabel, 50, Style::ComboBoxHeight, 5);
selectionLayout.append(portBox, 0, Style::ComboBoxHeight, 5);
selectionLayout.append(deviceLabel, 50, Style::ComboBoxHeight, 5);
selectionLayout.append(deviceBox, 0, Style::ComboBoxHeight);
layout.append(selectionLayout, 0, Style::ComboBoxHeight, 5);
layout.append(mappingList, 0, 0, 5);
mapLayout.append(mouseXaxis, 100, Style::ButtonHeight, 5);
mapLayout.append(mouseYaxis, 100, Style::ButtonHeight, 5);
mapLayout.append(mouseLeft, 100, Style::ButtonHeight, 5);
mapLayout.append(mouseMiddle, 100, Style::ButtonHeight, 5);
mapLayout.append(mouseRight, 100, Style::ButtonHeight, 5);
mapLayout.append(spacer, 0, Style::ButtonHeight);
mapLayout.append(clearButton, 80, Style::ButtonHeight);
layout.append(mapLayout, 0, Style::ButtonHeight);
setLayout(layout);
mouseXaxis.setVisible(false);

View File

@ -1,15 +1,18 @@
struct InputSettings : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
HorizontalLayout selectionLayout;
Label portLabel;
ComboBox portBox;
Label deviceLabel;
ComboBox deviceBox;
ListBox mappingList;
HorizontalLayout mapLayout;
Button mouseXaxis;
Button mouseYaxis;
Button mouseLeft;
Button mouseMiddle;
Button mouseRight;
Label spacer;
Button clearButton;
void inputEvent(uint16_t scancode, int16_t value);

View File

@ -1,11 +1,9 @@
VideoSettings videoSettings;
void VideoSettings::create() {
Window::create(0, 0, 256, 256, "Video Settings");
Window::create(0, 0, 480, 225, "Video Settings");
application.addWindow(this, "VideoSettings", "160,160");
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
colorAdjustmentLabel.setText("Color Adjustment :.");
colorAdjustmentLabel.setFont(application.proportionalFontBold);
brightnessLabel.setText("Brightness:");
@ -33,30 +31,36 @@ void VideoSettings::create() {
shaderPath.setText(config.video.shader);
shaderSelect.setText("...");
layout.append(colorAdjustmentLabel, x, y, 430, Style::LabelHeight); y += Style::LabelHeight + 5;
layout.append(brightnessLabel, x, y, 80, Style::SliderHeight);
layout.append(brightnessValue, x + 80, y, 40, Style::SliderHeight);
layout.append(brightnessSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight;
layout.append(contrastLabel, x, y, 80, Style::SliderHeight);
layout.append(contrastValue, x + 80, y, 50, Style::SliderHeight);
layout.append(contrastSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight;
layout.append(gammaLabel, x, y, 80, Style::SliderHeight);
layout.append(gammaValue, x + 80, y, 50, Style::SliderHeight);
layout.append(gammaSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
layout.append(gammaRampCheck, x, y, 430, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
layout.append(fullscreenLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
layout.append(fullscreenCenter, x, y, 135, Style::CheckBoxHeight);
layout.append(fullscreenScale, x + 140, y, 135, Style::CheckBoxHeight);
layout.append(fullscreenStretch, x + 280, y, 135, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
layout.append(filterLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
layout.append(filterPath, x, y, 430 - height - height - 10, height);
layout.append(filterClear, x + 430 - height - height - 5, y, height, height);
layout.append(filterSelect, x + 430 - height, y, height, height); y += height + 5;
layout.append(shaderLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
layout.append(shaderPath, x, y, 430 - height - height - 10, height);
layout.append(shaderClear, x + 430 - height - height - 5, y, height, height);
layout.append(shaderSelect, x + 430 - height, y, height, height); y += height + 5;
setGeometry(0, 0, 440, y);
layout.setMargin(5);
layout.append(colorAdjustmentLabel, 0, Style::LabelHeight);
brightnessLayout.append(brightnessLabel, 80, Style::SliderHeight);
brightnessLayout.append(brightnessValue, 50, Style::SliderHeight);
brightnessLayout.append(brightnessSlider, 0, Style::SliderHeight);
layout.append(brightnessLayout, 0, Style::SliderHeight);
contrastLayout.append(contrastLabel, 80, Style::SliderHeight);
contrastLayout.append(contrastValue, 50, Style::SliderHeight);
contrastLayout.append(contrastSlider, 0, Style::SliderHeight);
layout.append(contrastLayout, 0, Style::SliderHeight);
gammaLayout.append(gammaLabel, 80, Style::SliderHeight);
gammaLayout.append(gammaValue, 50, Style::SliderHeight);
gammaLayout.append(gammaSlider, 0, Style::SliderHeight);
layout.append(gammaLayout, 0, Style::SliderHeight);
layout.append(gammaRampCheck, 0, Style::CheckBoxHeight, 5);
layout.append(fullscreenLabel, 0, Style::LabelHeight);
fullscreenLayout.append(fullscreenCenter, 0, Style::CheckBoxHeight);
fullscreenLayout.append(fullscreenScale, 0, Style::CheckBoxHeight);
fullscreenLayout.append(fullscreenStretch, 0, Style::CheckBoxHeight);
layout.append(fullscreenLayout, 0, Style::CheckBoxHeight, 5);
layout.append(filterLabel, 0, Style::LabelHeight);
filterLayout.append(filterPath, 0, Style::TextBoxHeight, 5);
filterLayout.append(filterClear, Style::TextBoxHeight, Style::TextBoxHeight, 5);
filterLayout.append(filterSelect, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(filterLayout, 0, Style::TextBoxHeight, 5);
layout.append(shaderLabel, 0, Style::LabelHeight);
shaderLayout.append(shaderPath, 0, Style::TextBoxHeight, 5);
shaderLayout.append(shaderClear, Style::TextBoxHeight, Style::TextBoxHeight, 5);
shaderLayout.append(shaderSelect, Style::TextBoxHeight, Style::TextBoxHeight);
layout.append(shaderLayout, 0, Style::TextBoxHeight);
setLayout(layout);
brightnessSlider.setPosition(config.video.brightness);

View File

@ -1,28 +1,38 @@
struct VideoSettings : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
Label colorAdjustmentLabel;
Label brightnessLabel;
HorizontalLayout brightnessLayout;
Label brightnessValue;
HorizontalSlider brightnessSlider;
Label contrastLabel;
HorizontalLayout contrastLayout;
Label contrastValue;
HorizontalSlider contrastSlider;
Label gammaLabel;
HorizontalLayout gammaLayout;
Label gammaValue;
HorizontalSlider gammaSlider;
CheckBox gammaRampCheck;
Label fullscreenLabel;
HorizontalLayout fullscreenLayout;
RadioBox fullscreenCenter;
RadioBox fullscreenScale;
RadioBox fullscreenStretch;
Label filterLabel;
HorizontalLayout filterLayout;
TextBox filterPath;
Button filterClear;
Button filterSelect;
Label shaderLabel;
HorizontalLayout shaderLayout;
TextBox shaderPath;
Button shaderClear;
Button shaderSelect;

View File

@ -79,7 +79,7 @@ void CheatEditor::save(string filename) {
}
void CheatEditor::create() {
Window::create(0, 0, 256, 256, "Cheat Editor");
Window::create(0, 0, 480, 325, "Cheat Editor");
application.addWindow(this, "CheatEditor", "160,160");
cheatList.setHeaderText("Slot\tCode\tDescription");
@ -91,16 +91,19 @@ void CheatEditor::create() {
clearAllButton.setText("Clear All");
clearButton.setText("Clear");
unsigned x = 5, y = 5, height = Style::ButtonHeight;
layout.append(cheatList, x, y, 500, 250); y += 255;
layout.append(codeLabel, x, y, 80, Style::TextBoxHeight);
layout.append(codeEdit, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
layout.append(descLabel, x, y, 80, Style::TextBoxHeight);
layout.append(descEdit, x + 80, y, 420, Style::TextBoxHeight); y+= Style::TextBoxHeight + 5;
layout.append(findButton, x, y, 100, height);
layout.append(clearAllButton, x + 505 - 85 - 85, y, 80, height);
layout.append(clearButton, x + 505 - 85, y, 80, height); y += height + 5;
setGeometry(0, 0, 510, y);
layout.setMargin(5);
layout.append(cheatList, 0, 0, 5);
codeLayout.append(codeLabel, 80, Style::TextBoxHeight, 5);
codeLayout.append(codeEdit, 0, Style::TextBoxHeight);
layout.append(codeLayout, 0, Style::TextBoxHeight, 5);
descLayout.append(descLabel, 80, Style::TextBoxHeight, 5);
descLayout.append(descEdit, 0, Style::TextBoxHeight);
layout.append(descLayout, 0, Style::TextBoxHeight, 5);
controlLayout.append(findButton, 100, Style::ButtonHeight);
controlLayout.append(spacer, 0, Style::ButtonHeight);
controlLayout.append(clearAllButton, 80, Style::ButtonHeight, 5);
controlLayout.append(clearButton, 80, Style::ButtonHeight);
layout.append(controlLayout, 0, Style::ButtonHeight);
setLayout(layout);
synchronize();
@ -118,7 +121,7 @@ void CheatEditor::create() {
};
//databaseWindow
databaseWindow.create(0, 0, 256, 256);
databaseWindow.create(0, 0, 600, 360);
application.addWindow(&databaseWindow, "CheatDatabase", "192,192");
databaseList.setCheckable(true);
@ -126,12 +129,13 @@ void CheatEditor::create() {
databaseUnselectAll.setText("Unselect All");
databaseOk.setText("Ok");
x = 5, y = 5;
databaseLayout.append(databaseList, x, y, 600, 360); y += 365;
databaseLayout.append(databaseSelectAll, x, y, 100, height);
databaseLayout.append(databaseUnselectAll, x + 105, y, 100, height);
databaseLayout.append(databaseOk, 605 - 80, y, 80, height); y += height + 5;
databaseWindow.setGeometry(0, 0, 610, y);
databaseLayout.setMargin(5);
databaseLayout.append(databaseList, 0, 0, 5);
databaseControlLayout.append(databaseSelectAll, 100, Style::ButtonHeight, 5);
databaseControlLayout.append(databaseUnselectAll, 100, Style::ButtonHeight);
databaseControlLayout.append(databaseSpacer, 0, Style::ButtonHeight);
databaseControlLayout.append(databaseOk, 80, Style::ButtonHeight);
databaseLayout.append(databaseControlLayout, 0, Style::ButtonHeight);
databaseWindow.setLayout(databaseLayout);
databaseSelectAll.onTick = []() {

View File

@ -1,21 +1,27 @@
struct CheatEditor : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
ListBox cheatList;
HorizontalLayout codeLayout;
Label codeLabel;
TextBox codeEdit;
HorizontalLayout descLayout;
Label descLabel;
TextBox descEdit;
HorizontalLayout controlLayout;
Label spacer;
Button findButton;
Button clearAllButton;
Button clearButton;
TopLevelWindow databaseWindow;
FixedLayout databaseLayout;
VerticalLayout databaseLayout;
ListBox databaseList;
lstring databaseCode;
HorizontalLayout databaseControlLayout;
Button databaseSelectAll;
Button databaseUnselectAll;
Label databaseSpacer;
Button databaseOk;
lstring databaseCode;
void load(string filename);
void save(string filename);

View File

@ -1,7 +1,7 @@
StateManager stateManager;
void StateManager::create() {
Window::create(0, 0, 256, 256, "State Manager");
Window::create(0, 0, 480, 300, "State Manager");
application.addWindow(this, "StateManager", "160,160");
stateList.setHeaderText("Slot\tDescription");
@ -11,7 +11,19 @@ void StateManager::create() {
saveButton.setText("Save");
eraseButton.setText("Erase");
unsigned x = 5, y = 5;
layout.setMargin(5);
layout.append(stateList, 0, 0, 5);
descLayout.append(descLabel, 80, Style::TextBoxHeight, 5);
descLayout.append(descEdit, 0, Style::TextBoxHeight);
layout.append(descLayout, 0, Style::TextBoxHeight, 5);
controlLayout.append(spacer, 0, Style::ButtonHeight);
controlLayout.append(loadButton, 80, Style::ButtonHeight, 5);
controlLayout.append(saveButton, 80, Style::ButtonHeight, 5);
controlLayout.append(eraseButton, 80, Style::ButtonHeight);
layout.append(controlLayout, 0, Style::ButtonHeight);
setLayout(layout);
/*unsigned x = 5, y = 5;
layout.append(stateList, x, y, 500, 250); y += 255;
layout.append(descLabel, x, y, 80, Style::TextBoxHeight);
layout.append(descEdit, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
@ -19,7 +31,7 @@ void StateManager::create() {
layout.append(saveButton, x + 505 - 85 - 85, y, 80, Style::ButtonHeight);
layout.append(eraseButton, x + 505 - 85, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
setGeometry(0, 0, 510, y);
setLayout(layout);
setLayout(layout);*/
synchronize();

View File

@ -1,8 +1,11 @@
struct StateManager : TopLevelWindow {
FixedLayout layout;
VerticalLayout layout;
ListBox stateList;
HorizontalLayout descLayout;
Label descLabel;
TextBox descEdit;
HorizontalLayout controlLayout;
Label spacer;
Button loadButton;
Button saveButton;
Button eraseButton;

View File

@ -70,6 +70,12 @@ void Utility::setScale(unsigned scale) {
height = 239 * scale;
if(config.video.aspectRatioCorrection) width *= 32.0 / 23.0;
}
viewportX = 0;
viewportY = 0;
viewportWidth = width;
viewportHeight = height;
mainWindow.viewport.setGeometry(0, 0, width, height);
Geometry geom = mainWindow.geometry();
mainWindow.setGeometry(geom.x, geom.y, width, height);
@ -114,11 +120,12 @@ void Utility::setFullscreen(bool fullscreen) {
}
}
mainWindow.viewport.setGeometry(
(OS::desktopWidth() - width) / 2,
(OS::desktopHeight() - height) / 2,
width, height
);
viewportX = (OS::desktopWidth() - width) / 2;
viewportY = (OS::desktopHeight() - height) / 2;
viewportWidth = width;
viewportHeight = height;
mainWindow.viewport.setGeometry(viewportX, viewportY, viewportWidth, viewportHeight);
}
}

View File

@ -18,6 +18,9 @@ struct Utility : property<Utility> {
Utility();
unsigned viewportX, viewportY;
unsigned viewportWidth, viewportHeight;
private:
string statusCurrentText;
string statusText;