mirror of https://github.com/bsnes-emu/bsnes.git
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:
parent
133d568f76
commit
266495b475
|
@ -2,7 +2,7 @@ include nall/Makefile
|
||||||
snes := snes
|
snes := snes
|
||||||
gameboy := gameboy
|
gameboy := gameboy
|
||||||
profile := compatibility
|
profile := compatibility
|
||||||
ui := ui-gameboy
|
ui := ui
|
||||||
|
|
||||||
# compiler
|
# compiler
|
||||||
c := $(compiler) -std=gnu99
|
c := $(compiler) -std=gnu99
|
||||||
|
|
|
@ -2,9 +2,6 @@ static void Button_tick(Button *self) {
|
||||||
if(self->onTick) self->onTick();
|
if(self->onTick) self->onTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::setParent(Layout &parent) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void Button::setText(const string &text) {
|
void Button::setText(const string &text) {
|
||||||
gtk_button_set_label(GTK_BUTTON(object->widget), text);
|
gtk_button_set_label(GTK_BUTTON(object->widget), text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,6 @@ static void CheckBox_tick(CheckBox *self) {
|
||||||
if(self->onTick && self->object->locked == false) self->onTick();
|
if(self->onTick && self->object->locked == false) self->onTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBox::setParent(Layout &parent) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setText(const string &text) {
|
void CheckBox::setText(const string &text) {
|
||||||
gtk_button_set_label(GTK_BUTTON(object->widget), text);
|
gtk_button_set_label(GTK_BUTTON(object->widget), text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
|
void FixedLayout::setParent(Window &parent) {
|
||||||
fixedLayout->widgets.append({ &widget, x, y, width, height });
|
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) {
|
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||||
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), fixedLayout->container, 0, 0);
|
fixedLayout->children.append({ &widget, x, y, width, height });
|
||||||
gtk_widget_set_size_request(fixedLayout->container, 640, 480);
|
}
|
||||||
|
|
||||||
foreach(widget, fixedLayout->widgets) {
|
void FixedLayout::update(Geometry &geometry) {
|
||||||
gtk_widget_set_size_request(widget.widget->object->widget, widget.width, widget.height);
|
Layout::update(geometry);
|
||||||
gtk_fixed_put(GTK_FIXED(fixedLayout->container), widget.widget->object->widget, widget.x, widget.y);
|
|
||||||
gtk_widget_show(widget.widget->object->widget);
|
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::FixedLayout() {
|
||||||
fixedLayout = new FixedLayout::Data;
|
fixedLayout = new FixedLayout::Data;
|
||||||
fixedLayout->container = gtk_fixed_new();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,12 +78,55 @@ private:
|
||||||
MenuRadioItem *first;
|
MenuRadioItem *first;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Window;
|
|
||||||
struct Layout;
|
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 {
|
struct Widget : Object {
|
||||||
virtual void setParent(Layout &parent) {}
|
|
||||||
|
|
||||||
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
||||||
virtual void setFont(Font &font);
|
virtual void setFont(Font &font);
|
||||||
bool visible();
|
bool visible();
|
||||||
|
@ -98,50 +141,8 @@ struct Widget : Object {
|
||||||
Data *widget;
|
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 {
|
struct Button : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
Button();
|
Button();
|
||||||
};
|
};
|
||||||
|
@ -159,7 +160,6 @@ struct Canvas : Widget {
|
||||||
|
|
||||||
struct CheckBox : Widget {
|
struct CheckBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked(bool checked = true);
|
void setChecked(bool checked = true);
|
||||||
|
@ -218,7 +218,6 @@ struct HorizontalSlider : Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Label : Widget {
|
struct Label : Widget {
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
Label();
|
Label();
|
||||||
};
|
};
|
||||||
|
@ -253,7 +252,6 @@ struct ProgressBar : Widget {
|
||||||
|
|
||||||
struct RadioBox : Widget {
|
struct RadioBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setParent(RadioBox &parent);
|
void setParent(RadioBox &parent);
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
void Label::setParent(Layout &parent) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void Label::setText(const string &text) {
|
void Label::setText(const string &text) {
|
||||||
gtk_label_set_text(GTK_LABEL(object->widget), text);
|
gtk_label_set_text(GTK_LABEL(object->widget), text);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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::Layout() {
|
||||||
layout = new Layout::Data;
|
layout = new Layout::Data;
|
||||||
|
layout->parent = 0;
|
||||||
|
layout->margin = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,18 +35,18 @@ struct Widget::Data {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Layout::Data {
|
struct Layout::Data {
|
||||||
|
Window *parent;
|
||||||
|
unsigned margin;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FixedLayout::Data {
|
struct FixedLayout::Data {
|
||||||
Window *parent;
|
Window *parent;
|
||||||
GtkWidget *container;
|
struct Children {
|
||||||
|
|
||||||
struct Widgets {
|
|
||||||
Widget *widget;
|
Widget *widget;
|
||||||
unsigned x, y;
|
unsigned x, y;
|
||||||
unsigned width, height;
|
unsigned width, height;
|
||||||
};
|
};
|
||||||
linear_vector<Widgets> widgets;
|
linear_vector<Children> children;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Canvas::Data {
|
struct Canvas::Data {
|
||||||
|
|
|
@ -2,10 +2,6 @@ static void RadioBox_tick(RadioBox *self) {
|
||||||
if(self->onTick && self->checked() && self->object->locked == false) self->onTick();
|
if(self->onTick && self->checked() && self->object->locked == false) self->onTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioBox::setParent(Layout &parent) {
|
|
||||||
first = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RadioBox::setParent(RadioBox &parent) {
|
void RadioBox::setParent(RadioBox &parent) {
|
||||||
first = parent.first;
|
first = parent.first;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +21,7 @@ void RadioBox::setChecked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioBox::RadioBox() {
|
RadioBox::RadioBox() {
|
||||||
|
first = this;
|
||||||
object->widget = gtk_radio_button_new_with_label(0, "");
|
object->widget = gtk_radio_button_new_with_label(0, "");
|
||||||
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(RadioBox_tick), (gpointer)this);
|
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(RadioBox_tick), (gpointer)this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,9 @@ void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, con
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setLayout(Layout &layout) {
|
void Window::setLayout(Layout &layout) {
|
||||||
layout.create(*this);
|
layout.setParent(*this);
|
||||||
|
Geometry geom = geometry();
|
||||||
|
layout.update(geom);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Window::focused() {
|
bool Window::focused() {
|
||||||
|
@ -94,6 +96,10 @@ void Window::setStatusText(const string &text) {
|
||||||
gtk_statusbar_push(GTK_STATUSBAR(object->status), 1, 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) {
|
void Window::setMenuVisible(bool visible) {
|
||||||
gtk_widget_set_visible(object->menu, visible);
|
gtk_widget_set_visible(object->menu, visible);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void Button::setParent(Layout &parent) {
|
|
||||||
button->setParent(parent.widget->widget);
|
|
||||||
button->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Button::setText(const string &text) {
|
void Button::setText(const string &text) {
|
||||||
button->setText(QString::fromUtf8(text));
|
button->setText(QString::fromUtf8(text));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
void Canvas::setGeometry(unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||||
delete canvas->image;
|
delete canvas->image;
|
||||||
canvas->image = new QImage(width, height, QImage::Format_RGB32);
|
canvas->image = new QImage(width, height, QImage::Format_RGB32);
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void CheckBox::setParent(Layout &parent) {
|
|
||||||
checkBox->setParent(parent.widget->widget);
|
|
||||||
checkBox->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::setText(const string &text) {
|
void CheckBox::setText(const string &text) {
|
||||||
checkBox->setText(QString::fromUtf8(text));
|
checkBox->setText(QString::fromUtf8(text));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void ComboBox::setParent(Layout &parent) {
|
|
||||||
comboBox->setParent(parent.widget->widget);
|
|
||||||
comboBox->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ComboBox::reset() {
|
void ComboBox::reset() {
|
||||||
while(comboBox->count()) comboBox->removeItem(0);
|
while(comboBox->count()) comboBox->removeItem(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void EditBox::setParent(Layout &parent) {
|
|
||||||
editBox->setParent(parent.widget->widget);
|
|
||||||
editBox->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditBox::setEditable(bool editable) {
|
void EditBox::setEditable(bool editable) {
|
||||||
editBox->setReadOnly(editable == false);
|
editBox->setReadOnly(editable == false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||||
fixedLayout->children.append({ &widget, x, y, width, height });
|
fixedLayout->children.append({ &widget, x, y, width, height });
|
||||||
}
|
}
|
||||||
|
|
||||||
void FixedLayout::create(Window &parentWindow) {
|
void FixedLayout::update(Geometry &geometry) {
|
||||||
fixedLayout->parent = &parentWindow;
|
Layout::update(geometry);
|
||||||
fixedLayout->setParent(parentWindow.window->container);
|
|
||||||
|
|
||||||
foreach(child, fixedLayout->children) {
|
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);
|
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;
|
QWidget *control = child.widget->widget->widget;
|
||||||
control->setFont(*parentWindow.window->defaultFont);
|
control->setFont(*layout->parent->window->defaultFont);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedLayout::FixedLayout() {
|
FixedLayout::FixedLayout() {
|
||||||
fixedLayout = new FixedLayout::Data(*this);
|
fixedLayout = new FixedLayout::Data(*this);
|
||||||
widget->widget = fixedLayout;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void HexEditor::setParent(Layout &parent) {
|
|
||||||
hexEditor->setParent(parent.widget->widget);
|
|
||||||
hexEditor->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HexEditor::setSize(unsigned size) {
|
void HexEditor::setSize(unsigned size) {
|
||||||
hexEditor->size = size;
|
hexEditor->size = size;
|
||||||
bool indivisible = (hexEditor->size % hexEditor->columns) != 0; //add one for incomplete row
|
bool indivisible = (hexEditor->size % hexEditor->columns) != 0; //add one for incomplete row
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -1,8 +1,3 @@
|
||||||
void HorizontalSlider::setParent(Layout &parent) {
|
|
||||||
horizontalSlider->setParent(parent.widget->widget);
|
|
||||||
horizontalSlider->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void HorizontalSlider::setLength(unsigned length) {
|
void HorizontalSlider::setLength(unsigned length) {
|
||||||
length = length + (length == 0);
|
length = length + (length == 0);
|
||||||
horizontalSlider->setRange(0, length - 1);
|
horizontalSlider->setRange(0, length - 1);
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void Label::setParent(Layout &parent) {
|
|
||||||
label->setParent(parent.widget->widget);
|
|
||||||
label->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Label::setText(const string &text) {
|
void Label::setText(const string &text) {
|
||||||
label->setText(QString::fromUtf8(text));
|
label->setText(QString::fromUtf8(text));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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::Layout() {
|
||||||
layout = new Layout::Data(*this);
|
layout = new Layout::Data(*this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void ListBox::setParent(Layout &parent) {
|
|
||||||
listBox->setParent(parent.widget->widget);
|
|
||||||
listBox->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ListBox::setHeaderText(const string &text) {
|
void ListBox::setHeaderText(const string &text) {
|
||||||
lstring list;
|
lstring list;
|
||||||
list.split("\t", text);
|
list.split("\t", text);
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void ProgressBar::setParent(Layout &parent) {
|
|
||||||
progressBar->setParent(parent.widget->widget);
|
|
||||||
progressBar->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProgressBar::setPosition(unsigned position) {
|
void ProgressBar::setPosition(unsigned position) {
|
||||||
progressBar->setValue(position);
|
progressBar->setValue(position);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace phoenix {
|
||||||
#include "widget.cpp"
|
#include "widget.cpp"
|
||||||
#include "layout.cpp"
|
#include "layout.cpp"
|
||||||
#include "fixed-layout.cpp"
|
#include "fixed-layout.cpp"
|
||||||
|
#include "horizontal-layout.cpp"
|
||||||
|
#include "vertical-layout.cpp"
|
||||||
#include "button.cpp"
|
#include "button.cpp"
|
||||||
#include "canvas.cpp"
|
#include "canvas.cpp"
|
||||||
#include "checkbox.cpp"
|
#include "checkbox.cpp"
|
||||||
|
|
|
@ -112,28 +112,13 @@ struct MenuRadioItem : Action {
|
||||||
Data *menuRadioItem;
|
Data *menuRadioItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Window;
|
|
||||||
struct Layout;
|
struct Layout;
|
||||||
|
struct Widget;
|
||||||
|
|
||||||
struct Widget : Object {
|
struct Window : 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 {
|
|
||||||
nall::function<bool ()> onClose;
|
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 create(unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
||||||
void setLayout(Layout &layout);
|
void setLayout(Layout &layout);
|
||||||
Geometry geometry();
|
Geometry geometry();
|
||||||
|
@ -143,6 +128,7 @@ struct Window : Widget {
|
||||||
void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue);
|
void setBackgroundColor(uint8_t red, uint8_t green, uint8_t blue);
|
||||||
void setTitle(const nall::string &text);
|
void setTitle(const nall::string &text);
|
||||||
void setStatusText(const nall::string &text);
|
void setStatusText(const nall::string &text);
|
||||||
|
void setVisible(bool visible = true);
|
||||||
void setMenuVisible(bool visible = true);
|
void setMenuVisible(bool visible = true);
|
||||||
void setStatusVisible(bool visible = true);
|
void setStatusVisible(bool visible = true);
|
||||||
bool focused();
|
bool focused();
|
||||||
|
@ -155,8 +141,10 @@ struct Window : Widget {
|
||||||
static Window None;
|
static Window None;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Layout : Widget {
|
struct Layout : Object {
|
||||||
virtual void create(Window &parent) = 0;
|
virtual void setParent(Window &parent);
|
||||||
|
virtual void update(Geometry &geometry);
|
||||||
|
void setMargin(unsigned margin);
|
||||||
Layout();
|
Layout();
|
||||||
//private:
|
//private:
|
||||||
struct Data;
|
struct Data;
|
||||||
|
@ -164,18 +152,58 @@ struct Layout : Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FixedLayout : Layout {
|
struct FixedLayout : Layout {
|
||||||
|
void setParent(Window &parent);
|
||||||
void append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height);
|
void append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height);
|
||||||
void create(Window &parent);
|
void update(Geometry &geometry);
|
||||||
FixedLayout();
|
FixedLayout();
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
struct Data;
|
struct Data;
|
||||||
Data *fixedLayout;
|
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 {
|
struct Button : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
Button();
|
Button();
|
||||||
//private:
|
//private:
|
||||||
|
@ -184,7 +212,6 @@ struct Button : Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Canvas : Widget {
|
struct Canvas : Widget {
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
||||||
uint32_t* buffer();
|
uint32_t* buffer();
|
||||||
void redraw();
|
void redraw();
|
||||||
|
@ -197,7 +224,6 @@ struct Canvas : Widget {
|
||||||
|
|
||||||
struct CheckBox : Widget {
|
struct CheckBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked(bool checked = true);
|
void setChecked(bool checked = true);
|
||||||
|
@ -209,7 +235,6 @@ struct CheckBox : Widget {
|
||||||
|
|
||||||
struct ComboBox : Widget {
|
struct ComboBox : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void reset();
|
void reset();
|
||||||
void addItem(const nall::string &text);
|
void addItem(const nall::string &text);
|
||||||
unsigned selection();
|
unsigned selection();
|
||||||
|
@ -222,7 +247,6 @@ struct ComboBox : Widget {
|
||||||
|
|
||||||
struct EditBox : Widget {
|
struct EditBox : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setEditable(bool editable = true);
|
void setEditable(bool editable = true);
|
||||||
void setWordWrap(bool wordWrap = true);
|
void setWordWrap(bool wordWrap = true);
|
||||||
nall::string text();
|
nall::string text();
|
||||||
|
@ -237,7 +261,6 @@ struct EditBox : Widget {
|
||||||
struct HexEditor : Widget {
|
struct HexEditor : Widget {
|
||||||
nall::function<uint8_t (unsigned)> onRead;
|
nall::function<uint8_t (unsigned)> onRead;
|
||||||
nall::function<void (unsigned, uint8_t)> onWrite;
|
nall::function<void (unsigned, uint8_t)> onWrite;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setSize(unsigned size);
|
void setSize(unsigned size);
|
||||||
void setOffset(unsigned offset);
|
void setOffset(unsigned offset);
|
||||||
void setColumns(unsigned columns);
|
void setColumns(unsigned columns);
|
||||||
|
@ -251,7 +274,6 @@ struct HexEditor : Widget {
|
||||||
|
|
||||||
struct HorizontalSlider : Widget {
|
struct HorizontalSlider : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setLength(unsigned length);
|
void setLength(unsigned length);
|
||||||
unsigned position();
|
unsigned position();
|
||||||
void setPosition(unsigned position);
|
void setPosition(unsigned position);
|
||||||
|
@ -262,7 +284,6 @@ struct HorizontalSlider : Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Label : Widget {
|
struct Label : Widget {
|
||||||
void setParent(Layout &layout);
|
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
Label();
|
Label();
|
||||||
//private:
|
//private:
|
||||||
|
@ -274,7 +295,6 @@ struct ListBox : Widget {
|
||||||
nall::function<void ()> onActivate;
|
nall::function<void ()> onActivate;
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
nall::function<void (unsigned)> onTick;
|
nall::function<void (unsigned)> onTick;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setHeaderText(const nall::string &text);
|
void setHeaderText(const nall::string &text);
|
||||||
void setHeaderVisible(bool headerVisible = true);
|
void setHeaderVisible(bool headerVisible = true);
|
||||||
void setCheckable(bool checkable = true);
|
void setCheckable(bool checkable = true);
|
||||||
|
@ -293,7 +313,6 @@ struct ListBox : Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProgressBar : Widget {
|
struct ProgressBar : Widget {
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setPosition(unsigned position);
|
void setPosition(unsigned position);
|
||||||
ProgressBar();
|
ProgressBar();
|
||||||
//private:
|
//private:
|
||||||
|
@ -303,7 +322,6 @@ struct ProgressBar : Widget {
|
||||||
|
|
||||||
struct RadioBox : Widget {
|
struct RadioBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setParent(RadioBox &parent);
|
void setParent(RadioBox &parent);
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
|
@ -317,7 +335,6 @@ struct RadioBox : Widget {
|
||||||
struct TextBox : Widget {
|
struct TextBox : Widget {
|
||||||
nall::function<void ()> onActivate;
|
nall::function<void ()> onActivate;
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setEditable(bool editable = true);
|
void setEditable(bool editable = true);
|
||||||
nall::string text();
|
nall::string text();
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
|
@ -329,7 +346,6 @@ struct TextBox : Widget {
|
||||||
|
|
||||||
struct VerticalSlider : Widget {
|
struct VerticalSlider : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void setParent(Layout &parent);
|
|
||||||
void setLength(unsigned length);
|
void setLength(unsigned length);
|
||||||
unsigned position();
|
unsigned position();
|
||||||
void setPosition(unsigned position);
|
void setPosition(unsigned position);
|
||||||
|
@ -340,7 +356,6 @@ struct VerticalSlider : Widget {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Viewport : Widget {
|
struct Viewport : Widget {
|
||||||
void setParent(Layout &parent);
|
|
||||||
uintptr_t handle();
|
uintptr_t handle();
|
||||||
Viewport();
|
Viewport();
|
||||||
//private:
|
//private:
|
||||||
|
|
|
@ -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: 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)
|
** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** 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;
|
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[] = {
|
static const uint qt_meta_data_Window__Data[] = {
|
||||||
|
|
||||||
// content:
|
// content:
|
||||||
|
@ -340,6 +242,202 @@ int Window::Data::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||||
return _id;
|
return _id;
|
||||||
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[] = {
|
static const uint qt_meta_data_Button__Data[] = {
|
||||||
|
|
||||||
// content:
|
// content:
|
||||||
|
|
|
@ -81,26 +81,84 @@ public slots:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Widget::Data {
|
struct Window::Data : public QWidget {
|
||||||
public:
|
Q_OBJECT
|
||||||
Widget &self;
|
|
||||||
QWidget *widget;
|
|
||||||
|
|
||||||
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
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Layout &self;
|
Layout &self;
|
||||||
|
Window *parent;
|
||||||
|
unsigned margin;
|
||||||
|
|
||||||
Data(Layout &self) : self(self) {
|
Data(Layout &self) : self(self) {
|
||||||
|
parent = 0;
|
||||||
|
margin = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FixedLayout::Data : public QWidget {
|
struct FixedLayout::Data : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -117,26 +175,47 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Window::Data : public QWidget {
|
struct HorizontalLayout::Data : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window &self;
|
HorizontalLayout &self;
|
||||||
Layout *layout;
|
struct Children {
|
||||||
QFont *defaultFont;
|
VerticalLayout *layout;
|
||||||
QVBoxLayout *vlayout;
|
Widget *widget;
|
||||||
QMenuBar *menuBar;
|
unsigned width, height, spacing;
|
||||||
QWidget *container;
|
};
|
||||||
QStatusBar *statusBar;
|
linear_vector<Children> children;
|
||||||
|
|
||||||
void closeEvent(QCloseEvent *event) {
|
Data(HorizontalLayout &self) : self(self) {
|
||||||
if(self.onClose) {
|
|
||||||
bool result = self.onClose();
|
|
||||||
if(result == false) event->ignore();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void RadioBox::setParent(Layout &parent) {
|
|
||||||
radioBox->setParent(parent.widget->widget);
|
|
||||||
radioBox->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RadioBox::setParent(RadioBox &parent) {
|
void RadioBox::setParent(RadioBox &parent) {
|
||||||
parent.radioBox->buttonGroup->addButton(radioBox);
|
parent.radioBox->buttonGroup->addButton(radioBox);
|
||||||
parent.radioBox->setChecked(true);
|
parent.radioBox->setChecked(true);
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void TextBox::setParent(Layout &parent) {
|
|
||||||
textBox->setParent(parent.widget->widget);
|
|
||||||
textBox->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextBox::setEditable(bool editable) {
|
void TextBox::setEditable(bool editable) {
|
||||||
textBox->setReadOnly(editable == false);
|
textBox->setReadOnly(editable == false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -1,8 +1,3 @@
|
||||||
void VerticalSlider::setParent(Layout &parent) {
|
|
||||||
verticalSlider->setParent(parent.widget->widget);
|
|
||||||
verticalSlider->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void VerticalSlider::setLength(unsigned length) {
|
void VerticalSlider::setLength(unsigned length) {
|
||||||
length = length + (length == 0);
|
length = length + (length == 0);
|
||||||
verticalSlider->setRange(0, length - 1);
|
verticalSlider->setRange(0, length - 1);
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
void Viewport::setParent(Layout &parent) {
|
|
||||||
viewport->setParent(parent.widget->widget);
|
|
||||||
viewport->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
uintptr_t Viewport::handle() {
|
uintptr_t Viewport::handle() {
|
||||||
return (uintptr_t)viewport->winId();
|
return (uintptr_t)viewport->winId();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
void Widget::setGeometry(unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||||
widget->widget->setGeometry(x, y, width, height);
|
widget->widget->setGeometry(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setFont(Font &font) {
|
void Widget::setFont(Font &font) {
|
||||||
|
widget->font = &font;
|
||||||
widget->widget->setFont(*font.font);
|
widget->widget->setFont(*font.font);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
||||||
window->setWindowTitle(QString::fromUtf8(text));
|
window->setWindowTitle(QString::fromUtf8(text));
|
||||||
window->move(x, y);
|
|
||||||
|
|
||||||
window->vlayout = new QVBoxLayout(window);
|
window->vlayout = new QVBoxLayout(window);
|
||||||
window->vlayout->setAlignment(Qt::AlignTop);
|
|
||||||
window->vlayout->setMargin(0);
|
window->vlayout->setMargin(0);
|
||||||
window->vlayout->setSpacing(0);
|
window->vlayout->setSpacing(0);
|
||||||
window->vlayout->setSizeConstraint(QLayout::SetFixedSize);
|
|
||||||
window->setLayout(window->vlayout);
|
window->setLayout(window->vlayout);
|
||||||
|
|
||||||
window->menuBar = new QMenuBar(window);
|
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->vlayout->addWidget(window->menuBar);
|
||||||
|
|
||||||
window->container = new QWidget(window);
|
window->container = new QWidget(window);
|
||||||
window->container->setFixedSize(width, height);
|
window->container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
window->container->setVisible(true);
|
window->container->setVisible(true);
|
||||||
window->vlayout->addWidget(window->container);
|
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->setSizeGripEnabled(false);
|
||||||
window->statusBar->setVisible(false);
|
window->statusBar->setVisible(false);
|
||||||
window->vlayout->addWidget(window->statusBar);
|
window->vlayout->addWidget(window->statusBar);
|
||||||
|
|
||||||
|
setGeometry(x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setLayout(Layout &layout) {
|
void Window::setLayout(Layout &layout) {
|
||||||
window->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() {
|
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) {
|
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->move(x, y);
|
||||||
|
window->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setDefaultFont(Font &font) {
|
void Window::setDefaultFont(Font &font) {
|
||||||
|
@ -62,12 +72,23 @@ void Window::setStatusText(const string &text) {
|
||||||
window->statusBar->showMessage(QString::fromUtf8(text), 0);
|
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) {
|
void Window::setMenuVisible(bool visible) {
|
||||||
|
window->menuVisible = visible;
|
||||||
if(visible) window->menuBar->show();
|
if(visible) window->menuBar->show();
|
||||||
else window->menuBar->hide();
|
else window->menuBar->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setStatusVisible(bool visible) {
|
void Window::setStatusVisible(bool visible) {
|
||||||
|
window->statusVisible = visible;
|
||||||
if(visible) window->statusBar->show();
|
if(visible) window->statusBar->show();
|
||||||
else window->statusBar->hide();
|
else window->statusBar->hide();
|
||||||
}
|
}
|
||||||
|
@ -81,34 +102,17 @@ bool Window::fullscreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setFullscreen(bool fullscreen) {
|
void Window::setFullscreen(bool fullscreen) {
|
||||||
|
window->fullscreen = fullscreen;
|
||||||
|
|
||||||
if(fullscreen == false) {
|
if(fullscreen == false) {
|
||||||
window->vlayout->setSizeConstraint(QLayout::SetFixedSize);
|
|
||||||
window->showNormal();
|
window->showNormal();
|
||||||
|
window->adjustSize();
|
||||||
} else {
|
} else {
|
||||||
window->vlayout->setSizeConstraint(QLayout::SetNoConstraint);
|
|
||||||
window->container->setFixedSize(OS::desktopWidth(), OS::desktopHeight());
|
|
||||||
window->showFullScreen();
|
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::Window() {
|
||||||
window = new Window::Data(*this);
|
window = new Window::Data(*this);
|
||||||
window->defaultFont = 0;
|
window->defaultFont = 0;
|
||||||
widget->widget = window;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ void Cheat::init() {
|
||||||
Cheat::Cheat() {
|
Cheat::Cheat() {
|
||||||
lookup = new uint8[16 * 1024 * 1024];
|
lookup = new uint8[16 * 1024 * 1024];
|
||||||
system_enabled = true;
|
system_enabled = true;
|
||||||
synchronize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cheat::~Cheat() {
|
Cheat::~Cheat() {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
namespace SNES {
|
namespace SNES {
|
||||||
namespace Info {
|
namespace Info {
|
||||||
static const char Name[] = "bsnes";
|
static const char Name[] = "bsnes";
|
||||||
static const char Version[] = "075.07";
|
static const char Version[] = "075.08";
|
||||||
static const unsigned SerializerVersion = 18;
|
static const unsigned SerializerVersion = 18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DEBUGGER
|
//#define DEBUGGER
|
||||||
|
|
||||||
#include <libco/libco.h>
|
#include <libco/libco.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Console console;
|
Console console;
|
||||||
|
|
||||||
void Console::create() {
|
void Console::create() {
|
||||||
Window::create(0, 0, 256, 256, "Console");
|
Window::create(0, 0, 715, 350, "Console");
|
||||||
application.addWindow(this, "Debugger.Console", "192,192");
|
application.addWindow(this, "Debugger.Console", "192,192");
|
||||||
|
|
||||||
output.setFont(application.monospaceFont);
|
output.setFont(application.monospaceFont);
|
||||||
|
@ -14,7 +14,18 @@ void Console::create() {
|
||||||
traceCPU.setChecked(true);
|
traceCPU.setChecked(true);
|
||||||
clearConsole.setText("Clear console");
|
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(output, x, y, 580, 338); x += 580 + 5;
|
||||||
layout.append(traceToConsole, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
layout.append(traceToConsole, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
layout.append(traceToFile, 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(traceSMP, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
layout.append(clearConsole, x, 348 - Style::ButtonHeight - 5, 120, Style::ButtonHeight);
|
layout.append(clearConsole, x, 348 - Style::ButtonHeight - 5, 120, Style::ButtonHeight);
|
||||||
setGeometry(0, 0, 715, 348);
|
setGeometry(0, 0, 715, 348);
|
||||||
setLayout(layout);
|
setLayout(layout);*/
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
debugger.showConsole.setChecked(false);
|
debugger.showConsole.setChecked(false);
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
struct Console : TopLevelWindow {
|
struct Console : TopLevelWindow {
|
||||||
FixedLayout layout;
|
HorizontalLayout layout;
|
||||||
EditBox output;
|
EditBox output;
|
||||||
|
VerticalLayout controlLayout;
|
||||||
CheckBox traceToConsole;
|
CheckBox traceToConsole;
|
||||||
CheckBox traceToFile;
|
CheckBox traceToFile;
|
||||||
CheckBox traceCPU;
|
CheckBox traceCPU;
|
||||||
CheckBox traceSMP;
|
CheckBox traceSMP;
|
||||||
|
Label spacer;
|
||||||
Button clearConsole;
|
Button clearConsole;
|
||||||
|
|
||||||
string buffer;
|
string buffer;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
CPUDebugger cpuDebugger;
|
CPUDebugger cpuDebugger;
|
||||||
|
|
||||||
void CPUDebugger::create() {
|
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");
|
application.addWindow(this, "Debugger.CPUdebugger", "192,192");
|
||||||
|
|
||||||
output.setFont(application.monospaceFont);
|
output.setFont(application.monospaceFont);
|
||||||
|
@ -11,12 +11,12 @@ void CPUDebugger::create() {
|
||||||
proceed.setText("Proceed");
|
proceed.setText("Proceed");
|
||||||
proceed.setEnabled(false);
|
proceed.setEnabled(false);
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
layout.setMargin(5);
|
||||||
layout.append(output, x, y, 400, 210); x += 400 + 5;
|
layout.append(output, 0, 0, 5);
|
||||||
layout.append(stepInto, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
controlLayout.append(stepInto, 80, Style::ButtonHeight);
|
||||||
layout.append(stepOver, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
controlLayout.append(stepOver, 80, Style::ButtonHeight);
|
||||||
layout.append(proceed, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
controlLayout.append(proceed, 80, Style::ButtonHeight);
|
||||||
setGeometry(0, 0, 495, 220);
|
layout.append(controlLayout, 80, 0);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
struct CPUDebugger : TopLevelWindow {
|
struct CPUDebugger : TopLevelWindow {
|
||||||
FixedLayout layout;
|
HorizontalLayout layout;
|
||||||
EditBox output;
|
EditBox output;
|
||||||
|
VerticalLayout controlLayout;
|
||||||
Button stepInto;
|
Button stepInto;
|
||||||
Button stepOver;
|
Button stepOver;
|
||||||
Button proceed;
|
Button proceed;
|
||||||
|
|
|
@ -18,7 +18,7 @@ void Debugger::create() {
|
||||||
breakpointEditor.create();
|
breakpointEditor.create();
|
||||||
memoryEditor.create();
|
memoryEditor.create();
|
||||||
|
|
||||||
Window::create(0, 0, 256, 256, "Debugger");
|
Window::create(0, 0, 256, 80, "Debugger");
|
||||||
application.addWindow(this, "Debugger", "160,160");
|
application.addWindow(this, "Debugger", "160,160");
|
||||||
|
|
||||||
enableDebugger.setText("Enable debugger");
|
enableDebugger.setText("Enable debugger");
|
||||||
|
@ -28,7 +28,16 @@ void Debugger::create() {
|
||||||
showBreakpointEditor.setText("Breakpoint editor");
|
showBreakpointEditor.setText("Breakpoint editor");
|
||||||
showMemoryEditor.setText("Memory 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(enableDebugger, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
layout.append(showConsole, 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;
|
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(showBreakpointEditor, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
layout.append(showMemoryEditor, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
layout.append(showMemoryEditor, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
setGeometry(0, 0, 250, y);
|
setGeometry(0, 0, 250, y);
|
||||||
setLayout(layout);
|
setLayout(layout);*/
|
||||||
|
|
||||||
//windows shown by default
|
//windows shown by default
|
||||||
showConsole.setChecked();
|
showConsole.setChecked();
|
||||||
|
|
|
@ -12,7 +12,7 @@ struct Debugger : TopLevelWindow {
|
||||||
StepIntoSMP,
|
StepIntoSMP,
|
||||||
} debugMode;
|
} debugMode;
|
||||||
|
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
CheckBox enableDebugger;
|
CheckBox enableDebugger;
|
||||||
CheckBox showConsole;
|
CheckBox showConsole;
|
||||||
CheckBox showCPUDebugger;
|
CheckBox showCPUDebugger;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
SMPDebugger smpDebugger;
|
SMPDebugger smpDebugger;
|
||||||
|
|
||||||
void SMPDebugger::create() {
|
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");
|
application.addWindow(this, "Debugger.SMPDebugger", "192,192");
|
||||||
|
|
||||||
output.setFont(application.monospaceFont);
|
output.setFont(application.monospaceFont);
|
||||||
|
@ -11,12 +11,12 @@ void SMPDebugger::create() {
|
||||||
proceed.setText("Proceed");
|
proceed.setText("Proceed");
|
||||||
proceed.setEnabled(false);
|
proceed.setEnabled(false);
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
layout.setMargin(5);
|
||||||
layout.append(output, x, y, 400, 210); x += 400 + 5;
|
layout.append(output, 0, 0, 5);
|
||||||
layout.append(stepInto, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
controlLayout.append(stepInto, 80, Style::ButtonHeight);
|
||||||
layout.append(stepOver, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
controlLayout.append(stepOver, 80, Style::ButtonHeight);
|
||||||
layout.append(proceed, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
controlLayout.append(proceed, 80, Style::ButtonHeight);
|
||||||
setGeometry(0, 0, 495, 220);
|
layout.append(controlLayout, 80, 0);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
struct SMPDebugger : TopLevelWindow {
|
struct SMPDebugger : TopLevelWindow {
|
||||||
FixedLayout layout;
|
HorizontalLayout layout;
|
||||||
EditBox output;
|
EditBox output;
|
||||||
|
VerticalLayout controlLayout;
|
||||||
Button stepInto;
|
Button stepInto;
|
||||||
Button stepOver;
|
Button stepOver;
|
||||||
Button proceed;
|
Button proceed;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
BreakpointEditor breakpointEditor;
|
BreakpointEditor breakpointEditor;
|
||||||
|
|
||||||
void BreakpointEditor::create() {
|
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");
|
application.addWindow(this, "Debugger.BreakpointEditor", "192,192");
|
||||||
|
|
||||||
runToBreakpoint.setText("Run to breakpoint");
|
runToBreakpoint.setText("Run to breakpoint");
|
||||||
|
@ -18,7 +18,19 @@ void BreakpointEditor::create() {
|
||||||
enableBox[n].onTick = [n]() { breakpointEditor.toggleBreakpoint(n); };
|
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;
|
layout.append(runToBreakpoint, x, y, 295, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
||||||
for(unsigned n = 0; n < Breakpoints; n++) {
|
for(unsigned n = 0; n < Breakpoints; n++) {
|
||||||
layout.append(enableBox[n], x, y, 35, Style::EditBoxHeight);
|
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;
|
layout.append(sourceBox[n], x + 220, y, 80, Style::EditBoxHeight); y += Style::EditBoxHeight + 5;
|
||||||
}
|
}
|
||||||
setGeometry(0, 0, 310, y);
|
setGeometry(0, 0, 310, y);
|
||||||
setLayout(layout);
|
setLayout(layout);*/
|
||||||
|
|
||||||
runToBreakpoint.onTick = []() {
|
runToBreakpoint.onTick = []() {
|
||||||
if(breakpointEditor.runToBreakpoint.checked()) {
|
if(breakpointEditor.runToBreakpoint.checked()) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
struct BreakpointEditor : TopLevelWindow {
|
struct BreakpointEditor : TopLevelWindow {
|
||||||
enum : unsigned { Breakpoints = SNES::Debugger::Breakpoints };
|
enum : unsigned { Breakpoints = SNES::Debugger::Breakpoints };
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
CheckBox runToBreakpoint;
|
CheckBox runToBreakpoint;
|
||||||
|
HorizontalLayout breakpointLayout[Breakpoints];
|
||||||
CheckBox enableBox[Breakpoints];
|
CheckBox enableBox[Breakpoints];
|
||||||
TextBox addressBox[Breakpoints];
|
TextBox addressBox[Breakpoints];
|
||||||
TextBox valueBox[Breakpoints];
|
TextBox valueBox[Breakpoints];
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
MemoryEditor memoryEditor;
|
MemoryEditor memoryEditor;
|
||||||
|
|
||||||
void MemoryEditor::create() {
|
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");
|
application.addWindow(this, "Debugger.MemoryEditor", "192,192");
|
||||||
|
|
||||||
|
editor.setFont(application.monospaceFont);
|
||||||
editor.setColumns(16);
|
editor.setColumns(16);
|
||||||
editor.setRows(16);
|
editor.setRows(16);
|
||||||
sourceBox.addItem("CPU");
|
sourceBox.addItem("CPU");
|
||||||
|
@ -13,16 +14,14 @@ void MemoryEditor::create() {
|
||||||
sourceBox.addItem("CGRAM");
|
sourceBox.addItem("CGRAM");
|
||||||
refreshButton.setText("Refresh");
|
refreshButton.setText("Refresh");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
layout.setMargin(5);
|
||||||
layout.append(editor, x, y, 475, 220); x += 475 + 5;
|
layout.append(editor, 0, 0, 5);
|
||||||
layout.append(sourceBox, x, y, 80, Style::ComboBoxHeight); y += Style::ComboBoxHeight;
|
controlLayout.append(sourceBox, 80, Style::ComboBoxHeight);
|
||||||
layout.append(gotoBox, x, y, 80, Style::TextBoxHeight); y += Style::TextBoxHeight;
|
controlLayout.append(gotoBox, 80, Style::ComboBoxHeight);
|
||||||
layout.append(refreshButton, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
controlLayout.append(refreshButton, 80, Style::ComboBoxHeight);
|
||||||
setGeometry(0, 0, 570, 230);
|
layout.append(controlLayout, 80, 0);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
editor.setFont(application.monospaceFont);
|
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
debugger.showMemoryEditor.setChecked(false);
|
debugger.showMemoryEditor.setChecked(false);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
struct MemoryEditor : TopLevelWindow {
|
struct MemoryEditor : TopLevelWindow {
|
||||||
FixedLayout layout;
|
HorizontalLayout layout;
|
||||||
HexEditor editor;
|
HexEditor editor;
|
||||||
|
VerticalLayout controlLayout;
|
||||||
ComboBox sourceBox;
|
ComboBox sourceBox;
|
||||||
TextBox gotoBox;
|
TextBox gotoBox;
|
||||||
Button refreshButton;
|
Button refreshButton;
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
FileBrowser fileBrowser;
|
FileBrowser fileBrowser;
|
||||||
|
|
||||||
void FileBrowser::create() {
|
void FileBrowser::create() {
|
||||||
Window::create(0, 0, 256, 256);
|
Window::create(0, 0, 640, 400);
|
||||||
application.addWindow(this, "FileBrowser", "160,160");
|
application.addWindow(this, "FileBrowser", "160,160");
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
|
|
||||||
|
|
||||||
browseButton.setText("...");
|
browseButton.setText("...");
|
||||||
upButton.setText("..");
|
upButton.setText("..");
|
||||||
|
|
||||||
layout.append(pathBox, x, y, 630 - height - height - 10, height);
|
layout.setMargin(5);
|
||||||
layout.append(browseButton, x + 630 - height - height - 5, y, height, height);
|
pathLayout.append(pathBox, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(upButton, x + 630 - height, y, height, height); y += height + 5;
|
pathLayout.append(browseButton, Style::TextBoxHeight, Style::TextBoxHeight, 5);
|
||||||
layout.append(contentsBox, x, y, 630, 350); y += 350 + 5;
|
pathLayout.append(upButton, Style::TextBoxHeight, Style::TextBoxHeight);
|
||||||
setGeometry(0, 0, 640, y);
|
layout.append(pathLayout, 0, Style::TextBoxHeight, 5);
|
||||||
|
layout.append(contentsBox, 0, 0);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
pathBox.onActivate = []() {
|
pathBox.onActivate = []() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
struct FileBrowser : TopLevelWindow {
|
struct FileBrowser : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
|
HorizontalLayout pathLayout;
|
||||||
TextBox pathBox;
|
TextBox pathBox;
|
||||||
Button browseButton;
|
Button browseButton;
|
||||||
Button upButton;
|
Button upButton;
|
||||||
|
|
|
@ -2,25 +2,27 @@ SingleSlotLoader singleSlotLoader;
|
||||||
DoubleSlotLoader doubleSlotLoader;
|
DoubleSlotLoader doubleSlotLoader;
|
||||||
|
|
||||||
void SingleSlotLoader::create() {
|
void SingleSlotLoader::create() {
|
||||||
Window::create(0, 0, 256, 256);
|
Window::create(0, 0, 480, 80);
|
||||||
application.addWindow(this, "SingleSlotLoader", "160,160");
|
application.addWindow(this, "SingleSlotLoader", "160,160");
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
|
|
||||||
|
|
||||||
baseLabel.setText("Base:");
|
baseLabel.setText("Base:");
|
||||||
baseBrowse.setText("...");
|
baseBrowse.setText("...");
|
||||||
slotLabel.setText("Slot:");
|
slotLabel.setText("Slot:");
|
||||||
slotBrowse.setText("...");
|
slotBrowse.setText("...");
|
||||||
okButton.setText("Ok");
|
okButton.setText("Ok");
|
||||||
|
|
||||||
layout.append(baseLabel, x, y, 50, height);
|
layout.setMargin(5);
|
||||||
layout.append(basePath, x + 50, y, 300, height);
|
baseLayout.append(baseLabel, 40, Style::TextBoxHeight, 5);
|
||||||
layout.append(baseBrowse, x + 355, y, height, height); y += height + 5;
|
baseLayout.append(basePath, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(slotLabel, x, y, 50, height);
|
baseLayout.append(baseBrowse, Style::TextBoxHeight, Style::TextBoxHeight);
|
||||||
layout.append(slotPath, x + 50, y, 300, height);
|
layout.append(baseLayout, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(slotBrowse, x + 355, y, height, height); y += height + 5;
|
slotLayout.append(slotLabel, 40, Style::TextBoxHeight, 5);
|
||||||
layout.append(okButton, x + width - 90, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
|
slotLayout.append(slotPath, 0, Style::TextBoxHeight, 5);
|
||||||
setGeometry(0, 0, width, y);
|
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);
|
setLayout(layout);
|
||||||
|
|
||||||
baseBrowse.onTick = []() {
|
baseBrowse.onTick = []() {
|
||||||
|
@ -91,11 +93,9 @@ void SingleSlotLoader::load() {
|
||||||
//
|
//
|
||||||
|
|
||||||
void DoubleSlotLoader::create() {
|
void DoubleSlotLoader::create() {
|
||||||
Window::create(0, 0, 256, 256);
|
Window::create(0, 0, 480, 115);
|
||||||
application.addWindow(this, "DoubleSlotLoader", "160,160");
|
application.addWindow(this, "DoubleSlotLoader", "160,160");
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
|
|
||||||
|
|
||||||
baseLabel.setText("Base:");
|
baseLabel.setText("Base:");
|
||||||
baseBrowse.setText("...");
|
baseBrowse.setText("...");
|
||||||
slotALabel.setText("Slot A:");
|
slotALabel.setText("Slot A:");
|
||||||
|
@ -104,17 +104,22 @@ void DoubleSlotLoader::create() {
|
||||||
slotBBrowse.setText("...");
|
slotBBrowse.setText("...");
|
||||||
okButton.setText("Ok");
|
okButton.setText("Ok");
|
||||||
|
|
||||||
layout.append(baseLabel, x, y, 50, height);
|
layout.setMargin(5);
|
||||||
layout.append(basePath, x + 50, y, 300, height);
|
baseLayout.append(baseLabel, 40, Style::TextBoxHeight, 5);
|
||||||
layout.append(baseBrowse, x + 355, y, height, height); y += height + 5;
|
baseLayout.append(basePath, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(slotALabel, x, y, 50, height);
|
baseLayout.append(baseBrowse, Style::TextBoxHeight, Style::TextBoxHeight);
|
||||||
layout.append(slotAPath, x + 50, y, 300, height);
|
layout.append(baseLayout, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(slotABrowse, x + 355, y, height, height); y += height + 5;
|
slotALayout.append(slotALabel, 40, Style::TextBoxHeight, 5);
|
||||||
layout.append(slotBLabel, x, y, 50, height);
|
slotALayout.append(slotAPath, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(slotBPath, x + 50, y, 300, height);
|
slotALayout.append(slotABrowse, Style::TextBoxHeight, Style::TextBoxHeight);
|
||||||
layout.append(slotBBrowse, x + 355, y, height, height); y += height + 5;
|
layout.append(slotALayout, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(okButton, x + width - 90, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
|
slotBLayout.append(slotBLabel, 40, Style::TextBoxHeight, 5);
|
||||||
setGeometry(0, 0, width, y);
|
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);
|
setLayout(layout);
|
||||||
|
|
||||||
baseBrowse.onTick = []() {
|
baseBrowse.onTick = []() {
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
struct SingleSlotLoader : TopLevelWindow {
|
struct SingleSlotLoader : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
|
HorizontalLayout baseLayout;
|
||||||
Label baseLabel;
|
Label baseLabel;
|
||||||
TextBox basePath;
|
TextBox basePath;
|
||||||
Button baseBrowse;
|
Button baseBrowse;
|
||||||
|
HorizontalLayout slotLayout;
|
||||||
Label slotLabel;
|
Label slotLabel;
|
||||||
TextBox slotPath;
|
TextBox slotPath;
|
||||||
Button slotBrowse;
|
Button slotBrowse;
|
||||||
|
HorizontalLayout controlLayout;
|
||||||
|
Label spacer;
|
||||||
Button okButton;
|
Button okButton;
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
@ -18,16 +22,21 @@ struct SingleSlotLoader : TopLevelWindow {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DoubleSlotLoader : TopLevelWindow {
|
struct DoubleSlotLoader : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
|
HorizontalLayout baseLayout;
|
||||||
Label baseLabel;
|
Label baseLabel;
|
||||||
TextBox basePath;
|
TextBox basePath;
|
||||||
Button baseBrowse;
|
Button baseBrowse;
|
||||||
|
HorizontalLayout slotALayout;
|
||||||
Label slotALabel;
|
Label slotALabel;
|
||||||
TextBox slotAPath;
|
TextBox slotAPath;
|
||||||
Button slotABrowse;
|
Button slotABrowse;
|
||||||
|
HorizontalLayout slotBLayout;
|
||||||
Label slotBLabel;
|
Label slotBLabel;
|
||||||
TextBox slotBPath;
|
TextBox slotBPath;
|
||||||
Button slotBBrowse;
|
Button slotBBrowse;
|
||||||
|
HorizontalLayout controlLayout;
|
||||||
|
Label spacer;
|
||||||
Button okButton;
|
Button okButton;
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
|
|
@ -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) {
|
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 interlace = (height >= 240);
|
||||||
bool overscan = (height == 239 || height == 478);
|
bool overscan = (height == 239 || height == 478);
|
||||||
unsigned inpitch = interlace ? 1024 : 2048;
|
unsigned inpitch = interlace ? 1024 : 2048;
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
AdvancedSettings advancedSettings;
|
AdvancedSettings advancedSettings;
|
||||||
|
|
||||||
void AdvancedSettings::create() {
|
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");
|
application.addWindow(this, "AdvancedSettings", "160,160");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
|
||||||
|
|
||||||
driverSelectionLabel.setText("Driver Selection :.");
|
driverSelectionLabel.setText("Driver Selection :.");
|
||||||
driverSelectionLabel.setFont(application.proportionalFontBold);
|
driverSelectionLabel.setFont(application.proportionalFontBold);
|
||||||
videoDriverLabel.setText("Video:");
|
videoDriverLabel.setText("Video:");
|
||||||
|
@ -22,6 +20,23 @@ void AdvancedSettings::create() {
|
||||||
if(config.settings.focusPolicy == 1) focusPolicyIgnore.setChecked();
|
if(config.settings.focusPolicy == 1) focusPolicyIgnore.setChecked();
|
||||||
if(config.settings.focusPolicy == 2) focusPolicyAllow.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(driverSelectionLabel, x, y, 595, Style::LabelHeight); y += Style::LabelHeight + 5;
|
||||||
layout.append(videoDriverLabel, x, y, 45, Style::ComboBoxHeight);
|
layout.append(videoDriverLabel, x, y, 45, Style::ComboBoxHeight);
|
||||||
layout.append(videoDriverBox, x + 45, y, 150, 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(focusPolicyIgnore, x + 200, y, 195, Style::CheckBoxHeight);
|
||||||
layout.append(focusPolicyAllow, x + 400, y, 195, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
layout.append(focusPolicyAllow, x + 400, y, 195, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
||||||
setGeometry(0, 0, 605, y);
|
setGeometry(0, 0, 605, y);
|
||||||
setLayout(layout);
|
setLayout(layout);*/
|
||||||
|
|
||||||
lstring list;
|
lstring list;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
struct AdvancedSettings : TopLevelWindow {
|
struct AdvancedSettings : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
Label driverSelectionLabel;
|
Label driverSelectionLabel;
|
||||||
|
HorizontalLayout driverLayout;
|
||||||
Label videoDriverLabel;
|
Label videoDriverLabel;
|
||||||
ComboBox videoDriverBox;
|
ComboBox videoDriverBox;
|
||||||
Label audioDriverLabel;
|
Label audioDriverLabel;
|
||||||
|
@ -8,6 +9,7 @@ struct AdvancedSettings : TopLevelWindow {
|
||||||
Label inputDriverLabel;
|
Label inputDriverLabel;
|
||||||
ComboBox inputDriverBox;
|
ComboBox inputDriverBox;
|
||||||
Label focusPolicyLabel;
|
Label focusPolicyLabel;
|
||||||
|
HorizontalLayout focusPolicyLayout;
|
||||||
RadioBox focusPolicyPause;
|
RadioBox focusPolicyPause;
|
||||||
RadioBox focusPolicyIgnore;
|
RadioBox focusPolicyIgnore;
|
||||||
RadioBox focusPolicyAllow;
|
RadioBox focusPolicyAllow;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
AudioSettings audioSettings;
|
AudioSettings audioSettings;
|
||||||
|
|
||||||
void AudioSettings::create() {
|
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");
|
application.addWindow(this, "AudioSettings", "160,160");
|
||||||
|
|
||||||
volumeLabel.setText("Volume:");
|
volumeLabel.setText("Volume:");
|
||||||
|
@ -9,7 +9,18 @@ void AudioSettings::create() {
|
||||||
frequencyLabel.setText("Frequency:");
|
frequencyLabel.setText("Frequency:");
|
||||||
frequencySlider.setLength(2001);
|
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(volumeLabel, x, y, 70, Style::SliderHeight);
|
||||||
layout.append(volumeValue, x + 70, y, 60, Style::SliderHeight);
|
layout.append(volumeValue, x + 70, y, 60, Style::SliderHeight);
|
||||||
layout.append(volumeSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
|
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(frequencyValue, x + 70, y, 60, Style::SliderHeight);
|
||||||
layout.append(frequencySlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
|
layout.append(frequencySlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
|
||||||
setGeometry(0, 0, 440, y);
|
setGeometry(0, 0, 440, y);
|
||||||
setLayout(layout);
|
setLayout(layout);*/
|
||||||
|
|
||||||
volumeSlider.onChange = []() {
|
volumeSlider.onChange = []() {
|
||||||
config.audio.volume = audioSettings.volumeSlider.position();
|
config.audio.volume = audioSettings.volumeSlider.position();
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
struct AudioSettings : TopLevelWindow {
|
struct AudioSettings : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
|
HorizontalLayout volumeLayout;
|
||||||
Label volumeLabel;
|
Label volumeLabel;
|
||||||
Label volumeValue;
|
Label volumeValue;
|
||||||
HorizontalSlider volumeSlider;
|
HorizontalSlider volumeSlider;
|
||||||
|
HorizontalLayout frequencyLayout;
|
||||||
Label frequencyLabel;
|
Label frequencyLabel;
|
||||||
Label frequencyValue;
|
Label frequencyValue;
|
||||||
HorizontalSlider frequencySlider;
|
HorizontalSlider frequencySlider;
|
||||||
|
|
|
@ -2,7 +2,7 @@ InputSettings inputSettings;
|
||||||
static InputMapper::AbstractInput *activeInput = 0;
|
static InputMapper::AbstractInput *activeInput = 0;
|
||||||
|
|
||||||
void InputSettings::create() {
|
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");
|
application.addWindow(this, "InputSettings", "160,160");
|
||||||
setFont(application.proportionalFontBold);
|
setFont(application.proportionalFontBold);
|
||||||
setStatusVisible();
|
setStatusVisible();
|
||||||
|
@ -23,19 +23,21 @@ void InputSettings::create() {
|
||||||
mouseRight.setText("Mouse Right");
|
mouseRight.setText("Mouse Right");
|
||||||
clearButton.setText("Clear");
|
clearButton.setText("Clear");
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::ButtonHeight;
|
layout.setMargin(5);
|
||||||
layout.append(portLabel, x, y, 50, Style::ComboBoxHeight);
|
selectionLayout.append(portLabel, 50, Style::ComboBoxHeight, 5);
|
||||||
layout.append(portBox, x + 50, y, 200, Style::ComboBoxHeight);
|
selectionLayout.append(portBox, 0, Style::ComboBoxHeight, 5);
|
||||||
layout.append(deviceLabel, x + 255, y, 50, Style::ComboBoxHeight);
|
selectionLayout.append(deviceLabel, 50, Style::ComboBoxHeight, 5);
|
||||||
layout.append(deviceBox, x + 305, y, 200, Style::ComboBoxHeight); y += Style::ComboBoxHeight + 5;
|
selectionLayout.append(deviceBox, 0, Style::ComboBoxHeight);
|
||||||
layout.append(mappingList, x, y, 505, 265); y += 265 + 5;
|
layout.append(selectionLayout, 0, Style::ComboBoxHeight, 5);
|
||||||
layout.append(mouseXaxis, x, y, 100, height);
|
layout.append(mappingList, 0, 0, 5);
|
||||||
layout.append(mouseYaxis, x + 105, y, 100, height);
|
mapLayout.append(mouseXaxis, 100, Style::ButtonHeight, 5);
|
||||||
layout.append(mouseLeft, x, y, 100, height);
|
mapLayout.append(mouseYaxis, 100, Style::ButtonHeight, 5);
|
||||||
layout.append(mouseMiddle, x + 105, y, 100, height);
|
mapLayout.append(mouseLeft, 100, Style::ButtonHeight, 5);
|
||||||
layout.append(mouseRight, x + 105 + 105, y, 100, height);
|
mapLayout.append(mouseMiddle, 100, Style::ButtonHeight, 5);
|
||||||
layout.append(clearButton, 515 - 85, y, 80, height); y += height + 5;
|
mapLayout.append(mouseRight, 100, Style::ButtonHeight, 5);
|
||||||
setGeometry(0, 0, 515, y);
|
mapLayout.append(spacer, 0, Style::ButtonHeight);
|
||||||
|
mapLayout.append(clearButton, 80, Style::ButtonHeight);
|
||||||
|
layout.append(mapLayout, 0, Style::ButtonHeight);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
mouseXaxis.setVisible(false);
|
mouseXaxis.setVisible(false);
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
struct InputSettings : TopLevelWindow {
|
struct InputSettings : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
|
HorizontalLayout selectionLayout;
|
||||||
Label portLabel;
|
Label portLabel;
|
||||||
ComboBox portBox;
|
ComboBox portBox;
|
||||||
Label deviceLabel;
|
Label deviceLabel;
|
||||||
ComboBox deviceBox;
|
ComboBox deviceBox;
|
||||||
ListBox mappingList;
|
ListBox mappingList;
|
||||||
|
HorizontalLayout mapLayout;
|
||||||
Button mouseXaxis;
|
Button mouseXaxis;
|
||||||
Button mouseYaxis;
|
Button mouseYaxis;
|
||||||
Button mouseLeft;
|
Button mouseLeft;
|
||||||
Button mouseMiddle;
|
Button mouseMiddle;
|
||||||
Button mouseRight;
|
Button mouseRight;
|
||||||
|
Label spacer;
|
||||||
Button clearButton;
|
Button clearButton;
|
||||||
|
|
||||||
void inputEvent(uint16_t scancode, int16_t value);
|
void inputEvent(uint16_t scancode, int16_t value);
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
VideoSettings videoSettings;
|
VideoSettings videoSettings;
|
||||||
|
|
||||||
void VideoSettings::create() {
|
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");
|
application.addWindow(this, "VideoSettings", "160,160");
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
|
|
||||||
|
|
||||||
colorAdjustmentLabel.setText("Color Adjustment :.");
|
colorAdjustmentLabel.setText("Color Adjustment :.");
|
||||||
colorAdjustmentLabel.setFont(application.proportionalFontBold);
|
colorAdjustmentLabel.setFont(application.proportionalFontBold);
|
||||||
brightnessLabel.setText("Brightness:");
|
brightnessLabel.setText("Brightness:");
|
||||||
|
@ -33,30 +31,36 @@ void VideoSettings::create() {
|
||||||
shaderPath.setText(config.video.shader);
|
shaderPath.setText(config.video.shader);
|
||||||
shaderSelect.setText("...");
|
shaderSelect.setText("...");
|
||||||
|
|
||||||
layout.append(colorAdjustmentLabel, x, y, 430, Style::LabelHeight); y += Style::LabelHeight + 5;
|
layout.setMargin(5);
|
||||||
layout.append(brightnessLabel, x, y, 80, Style::SliderHeight);
|
layout.append(colorAdjustmentLabel, 0, Style::LabelHeight);
|
||||||
layout.append(brightnessValue, x + 80, y, 40, Style::SliderHeight);
|
brightnessLayout.append(brightnessLabel, 80, Style::SliderHeight);
|
||||||
layout.append(brightnessSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight;
|
brightnessLayout.append(brightnessValue, 50, Style::SliderHeight);
|
||||||
layout.append(contrastLabel, x, y, 80, Style::SliderHeight);
|
brightnessLayout.append(brightnessSlider, 0, Style::SliderHeight);
|
||||||
layout.append(contrastValue, x + 80, y, 50, Style::SliderHeight);
|
layout.append(brightnessLayout, 0, Style::SliderHeight);
|
||||||
layout.append(contrastSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight;
|
contrastLayout.append(contrastLabel, 80, Style::SliderHeight);
|
||||||
layout.append(gammaLabel, x, y, 80, Style::SliderHeight);
|
contrastLayout.append(contrastValue, 50, Style::SliderHeight);
|
||||||
layout.append(gammaValue, x + 80, y, 50, Style::SliderHeight);
|
contrastLayout.append(contrastSlider, 0, Style::SliderHeight);
|
||||||
layout.append(gammaSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
|
layout.append(contrastLayout, 0, Style::SliderHeight);
|
||||||
layout.append(gammaRampCheck, x, y, 430, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
gammaLayout.append(gammaLabel, 80, Style::SliderHeight);
|
||||||
layout.append(fullscreenLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
|
gammaLayout.append(gammaValue, 50, Style::SliderHeight);
|
||||||
layout.append(fullscreenCenter, x, y, 135, Style::CheckBoxHeight);
|
gammaLayout.append(gammaSlider, 0, Style::SliderHeight);
|
||||||
layout.append(fullscreenScale, x + 140, y, 135, Style::CheckBoxHeight);
|
layout.append(gammaLayout, 0, Style::SliderHeight);
|
||||||
layout.append(fullscreenStretch, x + 280, y, 135, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
layout.append(gammaRampCheck, 0, Style::CheckBoxHeight, 5);
|
||||||
layout.append(filterLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
|
layout.append(fullscreenLabel, 0, Style::LabelHeight);
|
||||||
layout.append(filterPath, x, y, 430 - height - height - 10, height);
|
fullscreenLayout.append(fullscreenCenter, 0, Style::CheckBoxHeight);
|
||||||
layout.append(filterClear, x + 430 - height - height - 5, y, height, height);
|
fullscreenLayout.append(fullscreenScale, 0, Style::CheckBoxHeight);
|
||||||
layout.append(filterSelect, x + 430 - height, y, height, height); y += height + 5;
|
fullscreenLayout.append(fullscreenStretch, 0, Style::CheckBoxHeight);
|
||||||
layout.append(shaderLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
|
layout.append(fullscreenLayout, 0, Style::CheckBoxHeight, 5);
|
||||||
layout.append(shaderPath, x, y, 430 - height - height - 10, height);
|
layout.append(filterLabel, 0, Style::LabelHeight);
|
||||||
layout.append(shaderClear, x + 430 - height - height - 5, y, height, height);
|
filterLayout.append(filterPath, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(shaderSelect, x + 430 - height, y, height, height); y += height + 5;
|
filterLayout.append(filterClear, Style::TextBoxHeight, Style::TextBoxHeight, 5);
|
||||||
setGeometry(0, 0, 440, y);
|
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);
|
setLayout(layout);
|
||||||
|
|
||||||
brightnessSlider.setPosition(config.video.brightness);
|
brightnessSlider.setPosition(config.video.brightness);
|
||||||
|
|
|
@ -1,28 +1,38 @@
|
||||||
struct VideoSettings : TopLevelWindow {
|
struct VideoSettings : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
Label colorAdjustmentLabel;
|
Label colorAdjustmentLabel;
|
||||||
|
|
||||||
Label brightnessLabel;
|
Label brightnessLabel;
|
||||||
|
HorizontalLayout brightnessLayout;
|
||||||
Label brightnessValue;
|
Label brightnessValue;
|
||||||
HorizontalSlider brightnessSlider;
|
HorizontalSlider brightnessSlider;
|
||||||
|
|
||||||
Label contrastLabel;
|
Label contrastLabel;
|
||||||
|
HorizontalLayout contrastLayout;
|
||||||
Label contrastValue;
|
Label contrastValue;
|
||||||
HorizontalSlider contrastSlider;
|
HorizontalSlider contrastSlider;
|
||||||
|
|
||||||
Label gammaLabel;
|
Label gammaLabel;
|
||||||
|
HorizontalLayout gammaLayout;
|
||||||
Label gammaValue;
|
Label gammaValue;
|
||||||
HorizontalSlider gammaSlider;
|
HorizontalSlider gammaSlider;
|
||||||
|
|
||||||
CheckBox gammaRampCheck;
|
CheckBox gammaRampCheck;
|
||||||
|
|
||||||
Label fullscreenLabel;
|
Label fullscreenLabel;
|
||||||
|
HorizontalLayout fullscreenLayout;
|
||||||
RadioBox fullscreenCenter;
|
RadioBox fullscreenCenter;
|
||||||
RadioBox fullscreenScale;
|
RadioBox fullscreenScale;
|
||||||
RadioBox fullscreenStretch;
|
RadioBox fullscreenStretch;
|
||||||
|
|
||||||
Label filterLabel;
|
Label filterLabel;
|
||||||
|
HorizontalLayout filterLayout;
|
||||||
TextBox filterPath;
|
TextBox filterPath;
|
||||||
Button filterClear;
|
Button filterClear;
|
||||||
Button filterSelect;
|
Button filterSelect;
|
||||||
|
|
||||||
Label shaderLabel;
|
Label shaderLabel;
|
||||||
|
HorizontalLayout shaderLayout;
|
||||||
TextBox shaderPath;
|
TextBox shaderPath;
|
||||||
Button shaderClear;
|
Button shaderClear;
|
||||||
Button shaderSelect;
|
Button shaderSelect;
|
||||||
|
|
|
@ -79,7 +79,7 @@ void CheatEditor::save(string filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatEditor::create() {
|
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");
|
application.addWindow(this, "CheatEditor", "160,160");
|
||||||
|
|
||||||
cheatList.setHeaderText("Slot\tCode\tDescription");
|
cheatList.setHeaderText("Slot\tCode\tDescription");
|
||||||
|
@ -91,16 +91,19 @@ void CheatEditor::create() {
|
||||||
clearAllButton.setText("Clear All");
|
clearAllButton.setText("Clear All");
|
||||||
clearButton.setText("Clear");
|
clearButton.setText("Clear");
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::ButtonHeight;
|
layout.setMargin(5);
|
||||||
layout.append(cheatList, x, y, 500, 250); y += 255;
|
layout.append(cheatList, 0, 0, 5);
|
||||||
layout.append(codeLabel, x, y, 80, Style::TextBoxHeight);
|
codeLayout.append(codeLabel, 80, Style::TextBoxHeight, 5);
|
||||||
layout.append(codeEdit, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
|
codeLayout.append(codeEdit, 0, Style::TextBoxHeight);
|
||||||
layout.append(descLabel, x, y, 80, Style::TextBoxHeight);
|
layout.append(codeLayout, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(descEdit, x + 80, y, 420, Style::TextBoxHeight); y+= Style::TextBoxHeight + 5;
|
descLayout.append(descLabel, 80, Style::TextBoxHeight, 5);
|
||||||
layout.append(findButton, x, y, 100, height);
|
descLayout.append(descEdit, 0, Style::TextBoxHeight);
|
||||||
layout.append(clearAllButton, x + 505 - 85 - 85, y, 80, height);
|
layout.append(descLayout, 0, Style::TextBoxHeight, 5);
|
||||||
layout.append(clearButton, x + 505 - 85, y, 80, height); y += height + 5;
|
controlLayout.append(findButton, 100, Style::ButtonHeight);
|
||||||
setGeometry(0, 0, 510, y);
|
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);
|
setLayout(layout);
|
||||||
|
|
||||||
synchronize();
|
synchronize();
|
||||||
|
@ -118,7 +121,7 @@ void CheatEditor::create() {
|
||||||
};
|
};
|
||||||
|
|
||||||
//databaseWindow
|
//databaseWindow
|
||||||
databaseWindow.create(0, 0, 256, 256);
|
databaseWindow.create(0, 0, 600, 360);
|
||||||
application.addWindow(&databaseWindow, "CheatDatabase", "192,192");
|
application.addWindow(&databaseWindow, "CheatDatabase", "192,192");
|
||||||
|
|
||||||
databaseList.setCheckable(true);
|
databaseList.setCheckable(true);
|
||||||
|
@ -126,12 +129,13 @@ void CheatEditor::create() {
|
||||||
databaseUnselectAll.setText("Unselect All");
|
databaseUnselectAll.setText("Unselect All");
|
||||||
databaseOk.setText("Ok");
|
databaseOk.setText("Ok");
|
||||||
|
|
||||||
x = 5, y = 5;
|
databaseLayout.setMargin(5);
|
||||||
databaseLayout.append(databaseList, x, y, 600, 360); y += 365;
|
databaseLayout.append(databaseList, 0, 0, 5);
|
||||||
databaseLayout.append(databaseSelectAll, x, y, 100, height);
|
databaseControlLayout.append(databaseSelectAll, 100, Style::ButtonHeight, 5);
|
||||||
databaseLayout.append(databaseUnselectAll, x + 105, y, 100, height);
|
databaseControlLayout.append(databaseUnselectAll, 100, Style::ButtonHeight);
|
||||||
databaseLayout.append(databaseOk, 605 - 80, y, 80, height); y += height + 5;
|
databaseControlLayout.append(databaseSpacer, 0, Style::ButtonHeight);
|
||||||
databaseWindow.setGeometry(0, 0, 610, y);
|
databaseControlLayout.append(databaseOk, 80, Style::ButtonHeight);
|
||||||
|
databaseLayout.append(databaseControlLayout, 0, Style::ButtonHeight);
|
||||||
databaseWindow.setLayout(databaseLayout);
|
databaseWindow.setLayout(databaseLayout);
|
||||||
|
|
||||||
databaseSelectAll.onTick = []() {
|
databaseSelectAll.onTick = []() {
|
||||||
|
|
|
@ -1,21 +1,27 @@
|
||||||
struct CheatEditor : TopLevelWindow {
|
struct CheatEditor : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
ListBox cheatList;
|
ListBox cheatList;
|
||||||
|
HorizontalLayout codeLayout;
|
||||||
Label codeLabel;
|
Label codeLabel;
|
||||||
TextBox codeEdit;
|
TextBox codeEdit;
|
||||||
|
HorizontalLayout descLayout;
|
||||||
Label descLabel;
|
Label descLabel;
|
||||||
TextBox descEdit;
|
TextBox descEdit;
|
||||||
|
HorizontalLayout controlLayout;
|
||||||
|
Label spacer;
|
||||||
Button findButton;
|
Button findButton;
|
||||||
Button clearAllButton;
|
Button clearAllButton;
|
||||||
Button clearButton;
|
Button clearButton;
|
||||||
|
|
||||||
TopLevelWindow databaseWindow;
|
TopLevelWindow databaseWindow;
|
||||||
FixedLayout databaseLayout;
|
VerticalLayout databaseLayout;
|
||||||
ListBox databaseList;
|
ListBox databaseList;
|
||||||
lstring databaseCode;
|
HorizontalLayout databaseControlLayout;
|
||||||
Button databaseSelectAll;
|
Button databaseSelectAll;
|
||||||
Button databaseUnselectAll;
|
Button databaseUnselectAll;
|
||||||
|
Label databaseSpacer;
|
||||||
Button databaseOk;
|
Button databaseOk;
|
||||||
|
lstring databaseCode;
|
||||||
|
|
||||||
void load(string filename);
|
void load(string filename);
|
||||||
void save(string filename);
|
void save(string filename);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
StateManager stateManager;
|
StateManager stateManager;
|
||||||
|
|
||||||
void StateManager::create() {
|
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");
|
application.addWindow(this, "StateManager", "160,160");
|
||||||
|
|
||||||
stateList.setHeaderText("Slot\tDescription");
|
stateList.setHeaderText("Slot\tDescription");
|
||||||
|
@ -11,7 +11,19 @@ void StateManager::create() {
|
||||||
saveButton.setText("Save");
|
saveButton.setText("Save");
|
||||||
eraseButton.setText("Erase");
|
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(stateList, x, y, 500, 250); y += 255;
|
||||||
layout.append(descLabel, x, y, 80, Style::TextBoxHeight);
|
layout.append(descLabel, x, y, 80, Style::TextBoxHeight);
|
||||||
layout.append(descEdit, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
|
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(saveButton, x + 505 - 85 - 85, y, 80, Style::ButtonHeight);
|
||||||
layout.append(eraseButton, x + 505 - 85, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
|
layout.append(eraseButton, x + 505 - 85, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
|
||||||
setGeometry(0, 0, 510, y);
|
setGeometry(0, 0, 510, y);
|
||||||
setLayout(layout);
|
setLayout(layout);*/
|
||||||
|
|
||||||
synchronize();
|
synchronize();
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
struct StateManager : TopLevelWindow {
|
struct StateManager : TopLevelWindow {
|
||||||
FixedLayout layout;
|
VerticalLayout layout;
|
||||||
ListBox stateList;
|
ListBox stateList;
|
||||||
|
HorizontalLayout descLayout;
|
||||||
Label descLabel;
|
Label descLabel;
|
||||||
TextBox descEdit;
|
TextBox descEdit;
|
||||||
|
HorizontalLayout controlLayout;
|
||||||
|
Label spacer;
|
||||||
Button loadButton;
|
Button loadButton;
|
||||||
Button saveButton;
|
Button saveButton;
|
||||||
Button eraseButton;
|
Button eraseButton;
|
||||||
|
|
|
@ -70,6 +70,12 @@ void Utility::setScale(unsigned scale) {
|
||||||
height = 239 * scale;
|
height = 239 * scale;
|
||||||
if(config.video.aspectRatioCorrection) width *= 32.0 / 23.0;
|
if(config.video.aspectRatioCorrection) width *= 32.0 / 23.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewportX = 0;
|
||||||
|
viewportY = 0;
|
||||||
|
viewportWidth = width;
|
||||||
|
viewportHeight = height;
|
||||||
|
|
||||||
mainWindow.viewport.setGeometry(0, 0, width, height);
|
mainWindow.viewport.setGeometry(0, 0, width, height);
|
||||||
Geometry geom = mainWindow.geometry();
|
Geometry geom = mainWindow.geometry();
|
||||||
mainWindow.setGeometry(geom.x, geom.y, width, height);
|
mainWindow.setGeometry(geom.x, geom.y, width, height);
|
||||||
|
@ -114,11 +120,12 @@ void Utility::setFullscreen(bool fullscreen) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow.viewport.setGeometry(
|
viewportX = (OS::desktopWidth() - width) / 2;
|
||||||
(OS::desktopWidth() - width) / 2,
|
viewportY = (OS::desktopHeight() - height) / 2;
|
||||||
(OS::desktopHeight() - height) / 2,
|
viewportWidth = width;
|
||||||
width, height
|
viewportHeight = height;
|
||||||
);
|
|
||||||
|
mainWindow.viewport.setGeometry(viewportX, viewportY, viewportWidth, viewportHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ struct Utility : property<Utility> {
|
||||||
|
|
||||||
Utility();
|
Utility();
|
||||||
|
|
||||||
|
unsigned viewportX, viewportY;
|
||||||
|
unsigned viewportWidth, viewportHeight;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string statusCurrentText;
|
string statusCurrentText;
|
||||||
string statusText;
|
string statusText;
|
||||||
|
|
Loading…
Reference in New Issue