mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-21 20:45:30 +02:00
Update to v075r07 release.
byuu says: This has the phoenix changes applied. Instead of widgets attaching directly to windows, you now attach them to layouts, which can then be attached to windows. Layouts are widgets themselves, so adding layouts to layouts is trivial. It also allows for multi-widget show/hide, etc. Right now there is only FixedLayout, but of course the plan is to support a BoxLayout, that lets you add HorizontalLayout and VerticalLayout containers to it, thus enabling auto-resize and simpler form layout. So far only phoenix/Qt is 100% moved over. phoenix/GTK+ has about 1/3rd ported, and phoenix/Windows only has one control ported over as a proof-of-concept. On the user side, bsnes, bgameboy, snespurify and curse have been moved to this new layout system. All of bsnes works great with it, as far as I can tell. Fullscreen, debugger, etc are good.
This commit is contained in:
@@ -2,7 +2,7 @@ include nall/Makefile
|
|||||||
snes := snes
|
snes := snes
|
||||||
gameboy := gameboy
|
gameboy := gameboy
|
||||||
profile := compatibility
|
profile := compatibility
|
||||||
ui := ui
|
ui := ui-gameboy
|
||||||
|
|
||||||
# compiler
|
# compiler
|
||||||
c := $(compiler) -std=gnu99
|
c := $(compiler) -std=gnu99
|
||||||
|
@@ -39,6 +39,7 @@ void APU::Master::run() {
|
|||||||
case 4: left = (left >> 1) + (left >> 3); break; // 62.5%
|
case 4: left = (left >> 1) + (left >> 3); break; // 62.5%
|
||||||
case 5: left -= (left >> 2); break; // 75.0%
|
case 5: left -= (left >> 2); break; // 75.0%
|
||||||
case 6: left -= (left >> 3); break; // 87.5%
|
case 6: left -= (left >> 3); break; // 87.5%
|
||||||
|
//case 7: break; //100.0%
|
||||||
}
|
}
|
||||||
if(left_enable == false) left = 0;
|
if(left_enable == false) left = 0;
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ void APU::Master::run() {
|
|||||||
case 4: right = (right >> 1) + (right >> 3); break; // 62.5%
|
case 4: right = (right >> 1) + (right >> 3); break; // 62.5%
|
||||||
case 5: right -= (right >> 2); break; // 75.0%
|
case 5: right -= (right >> 2); break; // 75.0%
|
||||||
case 6: right -= (right >> 3); break; // 87.5%
|
case 6: right -= (right >> 3); break; // 87.5%
|
||||||
|
//case 7: break; //100.0%
|
||||||
}
|
}
|
||||||
if(right_enable == false) right = 0;
|
if(right_enable == false) right = 0;
|
||||||
}
|
}
|
||||||
|
@@ -2,12 +2,14 @@ static void Button_tick(Button *self) {
|
|||||||
if(self->onTick) self->onTick();
|
if(self->onTick) self->onTick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void Button::setParent(Layout &parent) {
|
||||||
object->widget = gtk_button_new_with_label(text);
|
}
|
||||||
widget->parent = &parent;
|
|
||||||
gtk_widget_set_size_request(object->widget, width, height);
|
void Button::setText(const string &text) {
|
||||||
g_signal_connect_swapped(G_OBJECT(object->widget), "clicked", G_CALLBACK(Button_tick), (gpointer)this);
|
gtk_button_set_label(GTK_BUTTON(object->widget), text);
|
||||||
if(parent.window->defaultFont) setFont(*parent.window->defaultFont);
|
}
|
||||||
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), object->widget, x, y);
|
|
||||||
gtk_widget_show(object->widget);
|
Button::Button() {
|
||||||
|
object->widget = gtk_button_new();
|
||||||
|
g_signal_connect_swapped(G_OBJECT(object->widget), "clicked", G_CALLBACK(Button_tick), (gpointer)this);
|
||||||
}
|
}
|
||||||
|
@@ -2,14 +2,11 @@ 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::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void CheckBox::setParent(Layout &parent) {
|
||||||
object->widget = gtk_check_button_new_with_label(text);
|
}
|
||||||
widget->parent = &parent;
|
|
||||||
gtk_widget_set_size_request(object->widget, width, height);
|
void CheckBox::setText(const string &text) {
|
||||||
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(CheckBox_tick), (gpointer)this);
|
gtk_button_set_label(GTK_BUTTON(object->widget), text);
|
||||||
if(parent.window->defaultFont) setFont(*parent.window->defaultFont);
|
|
||||||
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), object->widget, x, y);
|
|
||||||
gtk_widget_show(object->widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckBox::checked() {
|
bool CheckBox::checked() {
|
||||||
@@ -21,3 +18,8 @@ void CheckBox::setChecked(bool checked) {
|
|||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(object->widget), checked);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(object->widget), checked);
|
||||||
object->locked = false;
|
object->locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckBox::CheckBox() {
|
||||||
|
object->widget = gtk_check_button_new_with_label("");
|
||||||
|
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(CheckBox_tick), (gpointer)this);
|
||||||
|
}
|
||||||
|
21
bsnes/phoenix/gtk/fixed-layout.cpp
Executable file
21
bsnes/phoenix/gtk/fixed-layout.cpp
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||||
|
fixedLayout->widgets.append({ &widget, x, y, width, height });
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedLayout::create(Window &parent) {
|
||||||
|
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), fixedLayout->container, 0, 0);
|
||||||
|
gtk_widget_set_size_request(fixedLayout->container, 640, 480);
|
||||||
|
|
||||||
|
foreach(widget, fixedLayout->widgets) {
|
||||||
|
gtk_widget_set_size_request(widget.widget->object->widget, widget.width, widget.height);
|
||||||
|
gtk_fixed_put(GTK_FIXED(fixedLayout->container), widget.widget->object->widget, widget.x, widget.y);
|
||||||
|
gtk_widget_show(widget.widget->object->widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_widget_show(fixedLayout->container);
|
||||||
|
}
|
||||||
|
|
||||||
|
FixedLayout::FixedLayout() {
|
||||||
|
fixedLayout = new FixedLayout::Data;
|
||||||
|
fixedLayout->container = gtk_fixed_new();
|
||||||
|
}
|
@@ -22,6 +22,8 @@ namespace phoenix {
|
|||||||
#include "menu.cpp"
|
#include "menu.cpp"
|
||||||
#include "widget.cpp"
|
#include "widget.cpp"
|
||||||
#include "window.cpp"
|
#include "window.cpp"
|
||||||
|
#include "layout.cpp"
|
||||||
|
#include "fixed-layout.cpp"
|
||||||
#include "button.cpp"
|
#include "button.cpp"
|
||||||
#include "canvas.cpp"
|
#include "canvas.cpp"
|
||||||
#include "checkbox.cpp"
|
#include "checkbox.cpp"
|
||||||
|
@@ -78,7 +78,13 @@ private:
|
|||||||
MenuRadioItem *first;
|
MenuRadioItem *first;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Window;
|
||||||
|
struct Layout;
|
||||||
|
|
||||||
struct Widget : Object {
|
struct Widget : Object {
|
||||||
|
virtual void setParent(Layout &parent) {}
|
||||||
|
|
||||||
|
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();
|
||||||
void setVisible(bool visible = true);
|
void setVisible(bool visible = true);
|
||||||
@@ -86,7 +92,6 @@ struct Widget : Object {
|
|||||||
void setEnabled(bool enabled = true);
|
void setEnabled(bool enabled = true);
|
||||||
virtual bool focused();
|
virtual bool focused();
|
||||||
virtual void setFocused();
|
virtual void setFocused();
|
||||||
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
|
||||||
Widget();
|
Widget();
|
||||||
//private:
|
//private:
|
||||||
struct Data;
|
struct Data;
|
||||||
@@ -96,6 +101,7 @@ struct Widget : Object {
|
|||||||
struct Window : Widget {
|
struct Window : Widget {
|
||||||
nall::function<bool ()> onClose;
|
nall::function<bool ()> onClose;
|
||||||
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);
|
||||||
bool focused();
|
bool focused();
|
||||||
void setFocused();
|
void setFocused();
|
||||||
Geometry geometry();
|
Geometry geometry();
|
||||||
@@ -116,9 +122,28 @@ struct Window : Widget {
|
|||||||
static Window None;
|
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 create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
|
void setText(const nall::string &text);
|
||||||
|
Button();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Canvas : Widget {
|
struct Canvas : Widget {
|
||||||
@@ -134,9 +159,11 @@ struct Canvas : Widget {
|
|||||||
|
|
||||||
struct CheckBox : Widget {
|
struct CheckBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked(bool checked = true);
|
void setChecked(bool checked = true);
|
||||||
|
CheckBox();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ComboBox : Widget {
|
struct ComboBox : Widget {
|
||||||
@@ -191,8 +218,9 @@ struct HorizontalSlider : Widget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Label : Widget {
|
struct Label : Widget {
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
|
Label();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ListBox : Widget {
|
struct ListBox : Widget {
|
||||||
@@ -225,10 +253,12 @@ struct ProgressBar : Widget {
|
|||||||
|
|
||||||
struct RadioBox : Widget {
|
struct RadioBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
void create(RadioBox &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(RadioBox &parent);
|
||||||
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked();
|
void setChecked();
|
||||||
|
RadioBox();
|
||||||
private:
|
private:
|
||||||
RadioBox *first;
|
RadioBox *first;
|
||||||
};
|
};
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
void Label::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void Label::setParent(Layout &parent) {
|
||||||
object->widget = gtk_label_new(text);
|
|
||||||
widget->parent = &parent;
|
|
||||||
gtk_misc_set_alignment(GTK_MISC(object->widget), 0.0, 0.5);
|
|
||||||
gtk_widget_set_size_request(object->widget, width, height);
|
|
||||||
if(parent.window->defaultFont) setFont(*parent.window->defaultFont);
|
|
||||||
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), object->widget, x, y);
|
|
||||||
gtk_widget_show(object->widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label::Label() {
|
||||||
|
object->widget = gtk_label_new("");
|
||||||
|
gtk_misc_set_alignment(GTK_MISC(object->widget), 0.0, 0.5);
|
||||||
|
}
|
||||||
|
3
bsnes/phoenix/gtk/layout.cpp
Executable file
3
bsnes/phoenix/gtk/layout.cpp
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
Layout::Layout() {
|
||||||
|
layout = new Layout::Data;
|
||||||
|
}
|
@@ -21,10 +21,6 @@ struct Action::Data {
|
|||||||
Font *font;
|
Font *font;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Widget::Data {
|
|
||||||
Window *parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Window::Data {
|
struct Window::Data {
|
||||||
Font *defaultFont;
|
Font *defaultFont;
|
||||||
bool isFullscreen;
|
bool isFullscreen;
|
||||||
@@ -34,6 +30,25 @@ struct Window::Data {
|
|||||||
unsigned height;
|
unsigned height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Widget::Data {
|
||||||
|
Window *parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Layout::Data {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FixedLayout::Data {
|
||||||
|
Window *parent;
|
||||||
|
GtkWidget *container;
|
||||||
|
|
||||||
|
struct Widgets {
|
||||||
|
Widget *widget;
|
||||||
|
unsigned x, y;
|
||||||
|
unsigned width, height;
|
||||||
|
};
|
||||||
|
linear_vector<Widgets> widgets;
|
||||||
|
};
|
||||||
|
|
||||||
struct Canvas::Data {
|
struct Canvas::Data {
|
||||||
uint32_t *bufferRGB;
|
uint32_t *bufferRGB;
|
||||||
uint32_t *bufferBGR;
|
uint32_t *bufferBGR;
|
||||||
|
@@ -2,27 +2,16 @@ 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::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void RadioBox::setParent(Layout &parent) {
|
||||||
first = this;
|
first = this;
|
||||||
object->parentWindow = &parent;
|
|
||||||
object->widget = gtk_radio_button_new_with_label(0, text);
|
|
||||||
widget->parent = &parent;
|
|
||||||
gtk_widget_set_size_request(object->widget, width, height);
|
|
||||||
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(RadioBox_tick), (gpointer)this);
|
|
||||||
if(parent.window->defaultFont) setFont(*parent.window->defaultFont);
|
|
||||||
gtk_fixed_put(GTK_FIXED(parent.object->formContainer), object->widget, x, y);
|
|
||||||
gtk_widget_show(object->widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioBox::create(RadioBox &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void RadioBox::setParent(RadioBox &parent) {
|
||||||
first = parent.first;
|
first = parent.first;
|
||||||
object->parentWindow = parent.object->parentWindow;
|
}
|
||||||
object->widget = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(parent.object->widget), text);
|
|
||||||
gtk_widget_set_size_request(object->widget, width, height);
|
void RadioBox::setText(const string &text) {
|
||||||
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(RadioBox_tick), (gpointer)this);
|
gtk_button_set_label(GTK_BUTTON(object->widget), text);
|
||||||
if(object->parentWindow->window->defaultFont) setFont(*object->parentWindow->window->defaultFont);
|
|
||||||
gtk_fixed_put(GTK_FIXED(object->parentWindow->object->formContainer), object->widget, x, y);
|
|
||||||
gtk_widget_show(object->widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadioBox::checked() {
|
bool RadioBox::checked() {
|
||||||
@@ -34,3 +23,8 @@ void RadioBox::setChecked() {
|
|||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(object->widget), true);
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(object->widget), true);
|
||||||
object->locked = false;
|
object->locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RadioBox::RadioBox() {
|
||||||
|
object->widget = gtk_radio_button_new_with_label(0, "");
|
||||||
|
g_signal_connect_swapped(G_OBJECT(object->widget), "toggled", G_CALLBACK(RadioBox_tick), (gpointer)this);
|
||||||
|
}
|
||||||
|
@@ -44,6 +44,10 @@ void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, con
|
|||||||
gtk_widget_realize(object->widget);
|
gtk_widget_realize(object->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::setLayout(Layout &layout) {
|
||||||
|
layout.create(*this);
|
||||||
|
}
|
||||||
|
|
||||||
bool Window::focused() {
|
bool Window::focused() {
|
||||||
return gtk_window_is_active(GTK_WINDOW(object->widget));
|
return gtk_window_is_active(GTK_WINDOW(object->widget));
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
void Button::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void Button::setParent(Layout &parent) {
|
||||||
button->setParent(parent.window->container);
|
button->setParent(parent.widget->widget);
|
||||||
button->setGeometry(x, y, width, height);
|
|
||||||
button->setText(QString::fromUtf8(text));
|
|
||||||
if(parent.window->defaultFont) button->setFont(*parent.window->defaultFont);
|
|
||||||
button->show();
|
button->show();
|
||||||
button->connect(button, SIGNAL(released()), SLOT(onTick()));
|
}
|
||||||
|
|
||||||
|
void Button::setText(const string &text) {
|
||||||
|
button->setText(QString::fromUtf8(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
Button::Button() {
|
Button::Button() {
|
||||||
button = new Button::Data(*this);
|
button = new Button::Data(*this);
|
||||||
widget->widget = button;
|
widget->widget = button;
|
||||||
|
button->connect(button, SIGNAL(released()), SLOT(onTick()));
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,5 @@
|
|||||||
void Canvas::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height) {
|
void Canvas::setParent(Layout &parent) {
|
||||||
canvas->image = new QImage(width, height, QImage::Format_RGB32);
|
canvas->setParent(parent.widget->widget);
|
||||||
canvas->image->fill(0);
|
|
||||||
canvas->setParent(parent.window->container);
|
|
||||||
canvas->setGeometry(x, y, width, height);
|
|
||||||
canvas->show();
|
canvas->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,6 +23,8 @@ Canvas::Canvas() {
|
|||||||
canvas = new Canvas::Data(*this);
|
canvas = new Canvas::Data(*this);
|
||||||
canvas->image = 0;
|
canvas->image = 0;
|
||||||
widget->widget = canvas;
|
widget->widget = canvas;
|
||||||
|
canvas->image = new QImage(64, 64, QImage::Format_RGB32);
|
||||||
|
canvas->image->fill(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Canvas::~Canvas() {
|
Canvas::~Canvas() {
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
void CheckBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void CheckBox::setParent(Layout &parent) {
|
||||||
checkBox->setParent(parent.window->container);
|
checkBox->setParent(parent.widget->widget);
|
||||||
checkBox->setGeometry(x, y, width, height);
|
|
||||||
checkBox->setText(QString::fromUtf8(text));
|
|
||||||
if(parent.window->defaultFont) checkBox->setFont(*parent.window->defaultFont);
|
|
||||||
checkBox->show();
|
checkBox->show();
|
||||||
checkBox->connect(checkBox, SIGNAL(stateChanged(int)), SLOT(onTick()));
|
}
|
||||||
|
|
||||||
|
void CheckBox::setText(const string &text) {
|
||||||
|
checkBox->setText(QString::fromUtf8(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckBox::checked() {
|
bool CheckBox::checked() {
|
||||||
@@ -18,4 +18,5 @@ void CheckBox::setChecked(bool checked) {
|
|||||||
CheckBox::CheckBox() {
|
CheckBox::CheckBox() {
|
||||||
checkBox = new CheckBox::Data(*this);
|
checkBox = new CheckBox::Data(*this);
|
||||||
widget->widget = checkBox;
|
widget->widget = checkBox;
|
||||||
|
checkBox->connect(checkBox, SIGNAL(stateChanged(int)), SLOT(onTick()));
|
||||||
}
|
}
|
||||||
|
@@ -1,15 +1,5 @@
|
|||||||
void ComboBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void ComboBox::setParent(Layout &parent) {
|
||||||
comboBox->setParent(parent.window->container);
|
comboBox->setParent(parent.widget->widget);
|
||||||
comboBox->setGeometry(x, y, width, height);
|
|
||||||
|
|
||||||
if(*text) {
|
|
||||||
lstring list;
|
|
||||||
list.split("\n", text);
|
|
||||||
foreach(item, list) addItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
comboBox->connect(comboBox, SIGNAL(currentIndexChanged(int)), SLOT(onChange()));
|
|
||||||
if(parent.window->defaultFont) comboBox->setFont(*parent.window->defaultFont);
|
|
||||||
comboBox->show();
|
comboBox->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,4 +25,5 @@ void ComboBox::setSelection(unsigned row) {
|
|||||||
ComboBox::ComboBox() {
|
ComboBox::ComboBox() {
|
||||||
comboBox = new ComboBox::Data(*this);
|
comboBox = new ComboBox::Data(*this);
|
||||||
widget->widget = comboBox;
|
widget->widget = comboBox;
|
||||||
|
comboBox->connect(comboBox, SIGNAL(currentIndexChanged(int)), SLOT(onChange()));
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,6 @@
|
|||||||
void EditBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void EditBox::setParent(Layout &parent) {
|
||||||
editBox->setParent(parent.window->container);
|
editBox->setParent(parent.widget->widget);
|
||||||
editBox->setGeometry(x, y, width, height);
|
|
||||||
editBox->setPlainText(QString::fromUtf8(text));
|
|
||||||
if(parent.window->defaultFont) editBox->setFont(*parent.window->defaultFont);
|
|
||||||
editBox->show();
|
editBox->show();
|
||||||
editBox->connect(editBox, SIGNAL(textChanged()), SLOT(onChange()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditBox::setEditable(bool editable) {
|
void EditBox::setEditable(bool editable) {
|
||||||
@@ -33,4 +29,5 @@ void EditBox::setCursorPosition(unsigned position) {
|
|||||||
EditBox::EditBox() {
|
EditBox::EditBox() {
|
||||||
editBox = new EditBox::Data(*this);
|
editBox = new EditBox::Data(*this);
|
||||||
widget->widget = editBox;
|
widget->widget = editBox;
|
||||||
|
editBox->connect(editBox, SIGNAL(textChanged()), SLOT(onChange()));
|
||||||
}
|
}
|
||||||
|
22
bsnes/phoenix/qt/fixed-layout.cpp
Executable file
22
bsnes/phoenix/qt/fixed-layout.cpp
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||||
|
fixedLayout->children.append({ &widget, x, y, width, height });
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedLayout::create(Window &parentWindow) {
|
||||||
|
fixedLayout->parent = &parentWindow;
|
||||||
|
fixedLayout->setParent(parentWindow.window->container);
|
||||||
|
|
||||||
|
foreach(child, fixedLayout->children) {
|
||||||
|
child.widget->setParent(*this);
|
||||||
|
child.widget->setGeometry(child.x, child.y, child.width, child.height);
|
||||||
|
if(parentWindow.window->defaultFont) {
|
||||||
|
QWidget *control = child.widget->widget->widget;
|
||||||
|
control->setFont(*parentWindow.window->defaultFont);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FixedLayout::FixedLayout() {
|
||||||
|
fixedLayout = new FixedLayout::Data(*this);
|
||||||
|
widget->widget = fixedLayout;
|
||||||
|
}
|
@@ -1,24 +1,5 @@
|
|||||||
void HexEditor::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height) {
|
void HexEditor::setParent(Layout &parent) {
|
||||||
hexEditor->setParent(parent.window->container);
|
hexEditor->setParent(parent.widget->widget);
|
||||||
hexEditor->setGeometry(x, y, width, height);
|
|
||||||
if(parent.window->defaultFont) hexEditor->setFont(*parent.window->defaultFont);
|
|
||||||
|
|
||||||
hexEditor->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
hexEditor->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
||||||
|
|
||||||
hexEditor->layout = new QHBoxLayout;
|
|
||||||
hexEditor->layout->setAlignment(Qt::AlignRight);
|
|
||||||
hexEditor->layout->setMargin(0);
|
|
||||||
hexEditor->layout->setSpacing(0);
|
|
||||||
hexEditor->setLayout(hexEditor->layout);
|
|
||||||
|
|
||||||
hexEditor->scrollBar = new QScrollBar(Qt::Vertical);
|
|
||||||
hexEditor->scrollBar->setSingleStep(1);
|
|
||||||
hexEditor->layout->addWidget(hexEditor->scrollBar);
|
|
||||||
|
|
||||||
hexEditor->scrollBar->connect(
|
|
||||||
hexEditor->scrollBar, SIGNAL(actionTriggered(int)), hexEditor, SLOT(scrollEvent())
|
|
||||||
);
|
|
||||||
hexEditor->show();
|
hexEditor->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,4 +153,21 @@ HexEditor::HexEditor() {
|
|||||||
hexEditor->offset = 0;
|
hexEditor->offset = 0;
|
||||||
hexEditor->columns = 16;
|
hexEditor->columns = 16;
|
||||||
hexEditor->rows = 16;
|
hexEditor->rows = 16;
|
||||||
|
|
||||||
|
hexEditor->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
hexEditor->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
hexEditor->layout = new QHBoxLayout;
|
||||||
|
hexEditor->layout->setAlignment(Qt::AlignRight);
|
||||||
|
hexEditor->layout->setMargin(0);
|
||||||
|
hexEditor->layout->setSpacing(0);
|
||||||
|
hexEditor->setLayout(hexEditor->layout);
|
||||||
|
|
||||||
|
hexEditor->scrollBar = new QScrollBar(Qt::Vertical);
|
||||||
|
hexEditor->scrollBar->setSingleStep(1);
|
||||||
|
hexEditor->layout->addWidget(hexEditor->scrollBar);
|
||||||
|
|
||||||
|
hexEditor->scrollBar->connect(
|
||||||
|
hexEditor->scrollBar, SIGNAL(actionTriggered(int)), hexEditor, SLOT(scrollEvent())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
void HorizontalSlider::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, unsigned length) {
|
void HorizontalSlider::setParent(Layout &parent) {
|
||||||
length += (length == 0);
|
horizontalSlider->setParent(parent.widget->widget);
|
||||||
horizontalSlider->setParent(parent.window->container);
|
horizontalSlider->show();
|
||||||
horizontalSlider->setGeometry(x, y, width, height);
|
}
|
||||||
|
|
||||||
|
void HorizontalSlider::setLength(unsigned length) {
|
||||||
|
length = length + (length == 0);
|
||||||
horizontalSlider->setRange(0, length - 1);
|
horizontalSlider->setRange(0, length - 1);
|
||||||
horizontalSlider->setPageStep(length >> 3);
|
horizontalSlider->setPageStep(length >> 3);
|
||||||
horizontalSlider->connect(horizontalSlider, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
|
||||||
horizontalSlider->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned HorizontalSlider::position() {
|
unsigned HorizontalSlider::position() {
|
||||||
@@ -19,4 +20,5 @@ void HorizontalSlider::setPosition(unsigned position) {
|
|||||||
HorizontalSlider::HorizontalSlider() {
|
HorizontalSlider::HorizontalSlider() {
|
||||||
horizontalSlider = new HorizontalSlider::Data(*this);
|
horizontalSlider = new HorizontalSlider::Data(*this);
|
||||||
widget->widget = horizontalSlider;
|
widget->widget = horizontalSlider;
|
||||||
|
horizontalSlider->connect(horizontalSlider, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,5 @@
|
|||||||
void Label::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void Label::setParent(Layout &parent) {
|
||||||
label->setParent(parent.window->container);
|
label->setParent(parent.widget->widget);
|
||||||
label->setGeometry(x, y, width, height);
|
|
||||||
label->setText(QString::fromUtf8(text));
|
|
||||||
if(parent.window->defaultFont) label->setFont(*parent.window->defaultFont);
|
|
||||||
label->show();
|
label->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
bsnes/phoenix/qt/layout.cpp
Executable file
3
bsnes/phoenix/qt/layout.cpp
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
Layout::Layout() {
|
||||||
|
layout = new Layout::Data(*this);
|
||||||
|
}
|
@@ -1,9 +1,9 @@
|
|||||||
void ListBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void ListBox::setParent(Layout &parent) {
|
||||||
listBox->setParent(parent.window->container);
|
listBox->setParent(parent.widget->widget);
|
||||||
listBox->setGeometry(x, y, width, height);
|
listBox->show();
|
||||||
listBox->setAllColumnsShowFocus(true);
|
}
|
||||||
listBox->setRootIsDecorated(false);
|
|
||||||
|
|
||||||
|
void ListBox::setHeaderText(const string &text) {
|
||||||
lstring list;
|
lstring list;
|
||||||
list.split("\t", text);
|
list.split("\t", text);
|
||||||
QStringList labels;
|
QStringList labels;
|
||||||
@@ -11,14 +11,7 @@ void ListBox::create(Window &parent, unsigned x, unsigned y, unsigned width, uns
|
|||||||
listBox->setColumnCount(list.size());
|
listBox->setColumnCount(list.size());
|
||||||
listBox->setHeaderLabels(labels);
|
listBox->setHeaderLabels(labels);
|
||||||
for(unsigned i = 0; i < list.size(); i++) listBox->resizeColumnToContents(i);
|
for(unsigned i = 0; i < list.size(); i++) listBox->resizeColumnToContents(i);
|
||||||
|
|
||||||
listBox->setHeaderHidden(true);
|
|
||||||
listBox->setAlternatingRowColors(list.size() >= 2);
|
listBox->setAlternatingRowColors(list.size() >= 2);
|
||||||
listBox->connect(listBox, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onActivate()));
|
|
||||||
listBox->connect(listBox, SIGNAL(itemSelectionChanged()), SLOT(onChange()));
|
|
||||||
listBox->connect(listBox, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onTick(QTreeWidgetItem*)));
|
|
||||||
if(parent.window->defaultFont) listBox->setFont(*parent.window->defaultFont);
|
|
||||||
listBox->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBox::setHeaderVisible(bool headerVisible) {
|
void ListBox::setHeaderVisible(bool headerVisible) {
|
||||||
@@ -99,4 +92,11 @@ void ListBox::setSelection(unsigned row) {
|
|||||||
ListBox::ListBox() {
|
ListBox::ListBox() {
|
||||||
listBox = new ListBox::Data(*this);
|
listBox = new ListBox::Data(*this);
|
||||||
widget->widget = listBox;
|
widget->widget = listBox;
|
||||||
|
|
||||||
|
listBox->setAllColumnsShowFocus(true);
|
||||||
|
listBox->setRootIsDecorated(false);
|
||||||
|
listBox->setHeaderHidden(true);
|
||||||
|
listBox->connect(listBox, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onActivate()));
|
||||||
|
listBox->connect(listBox, SIGNAL(itemSelectionChanged()), SLOT(onChange()));
|
||||||
|
listBox->connect(listBox, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onTick(QTreeWidgetItem*)));
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,5 @@
|
|||||||
void ProgressBar::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height) {
|
void ProgressBar::setParent(Layout &parent) {
|
||||||
progressBar->setParent(parent.window->container);
|
progressBar->setParent(parent.widget->widget);
|
||||||
progressBar->setGeometry(x, y, width, height);
|
|
||||||
progressBar->setRange(0, 100);
|
|
||||||
progressBar->setTextVisible(false);
|
|
||||||
progressBar->show();
|
progressBar->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,4 +10,6 @@ void ProgressBar::setPosition(unsigned position) {
|
|||||||
ProgressBar::ProgressBar() {
|
ProgressBar::ProgressBar() {
|
||||||
progressBar = new ProgressBar::Data(*this);
|
progressBar = new ProgressBar::Data(*this);
|
||||||
widget->widget = progressBar;
|
widget->widget = progressBar;
|
||||||
|
progressBar->setRange(0, 100);
|
||||||
|
progressBar->setTextVisible(false);
|
||||||
}
|
}
|
||||||
|
@@ -10,8 +10,10 @@ namespace phoenix {
|
|||||||
#include "object.cpp"
|
#include "object.cpp"
|
||||||
#include "font.cpp"
|
#include "font.cpp"
|
||||||
#include "menu.cpp"
|
#include "menu.cpp"
|
||||||
#include "widget.cpp"
|
|
||||||
#include "window.cpp"
|
#include "window.cpp"
|
||||||
|
#include "widget.cpp"
|
||||||
|
#include "layout.cpp"
|
||||||
|
#include "fixed-layout.cpp"
|
||||||
#include "button.cpp"
|
#include "button.cpp"
|
||||||
#include "canvas.cpp"
|
#include "canvas.cpp"
|
||||||
#include "checkbox.cpp"
|
#include "checkbox.cpp"
|
||||||
|
@@ -112,7 +112,12 @@ struct MenuRadioItem : Action {
|
|||||||
Data *menuRadioItem;
|
Data *menuRadioItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Window;
|
||||||
|
struct Layout;
|
||||||
|
|
||||||
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();
|
||||||
@@ -130,6 +135,7 @@ struct Widget : Object {
|
|||||||
struct Window : Widget {
|
struct Window : Widget {
|
||||||
nall::function<bool ()> onClose;
|
nall::function<bool ()> onClose;
|
||||||
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);
|
||||||
Geometry geometry();
|
Geometry geometry();
|
||||||
void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
||||||
void setDefaultFont(Font &font);
|
void setDefaultFont(Font &font);
|
||||||
@@ -149,9 +155,28 @@ struct Window : Widget {
|
|||||||
static Window None;
|
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 create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
|
void setText(const nall::string &text);
|
||||||
Button();
|
Button();
|
||||||
//private:
|
//private:
|
||||||
struct Data;
|
struct Data;
|
||||||
@@ -159,7 +184,7 @@ struct Button : Widget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Canvas : Widget {
|
struct Canvas : Widget {
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height);
|
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();
|
||||||
@@ -172,7 +197,8 @@ struct Canvas : Widget {
|
|||||||
|
|
||||||
struct CheckBox : Widget {
|
struct CheckBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked(bool checked = true);
|
void setChecked(bool checked = true);
|
||||||
CheckBox();
|
CheckBox();
|
||||||
@@ -183,7 +209,7 @@ struct CheckBox : Widget {
|
|||||||
|
|
||||||
struct ComboBox : Widget {
|
struct ComboBox : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
void reset();
|
void reset();
|
||||||
void addItem(const nall::string &text);
|
void addItem(const nall::string &text);
|
||||||
unsigned selection();
|
unsigned selection();
|
||||||
@@ -196,7 +222,7 @@ struct ComboBox : Widget {
|
|||||||
|
|
||||||
struct EditBox : Widget {
|
struct EditBox : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
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();
|
||||||
@@ -211,7 +237,7 @@ 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 create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height);
|
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);
|
||||||
@@ -225,7 +251,8 @@ struct HexEditor : Widget {
|
|||||||
|
|
||||||
struct HorizontalSlider : Widget {
|
struct HorizontalSlider : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, unsigned length);
|
void setParent(Layout &parent);
|
||||||
|
void setLength(unsigned length);
|
||||||
unsigned position();
|
unsigned position();
|
||||||
void setPosition(unsigned position);
|
void setPosition(unsigned position);
|
||||||
HorizontalSlider();
|
HorizontalSlider();
|
||||||
@@ -235,7 +262,7 @@ struct HorizontalSlider : Widget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Label : Widget {
|
struct Label : Widget {
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &layout);
|
||||||
void setText(const nall::string &text);
|
void setText(const nall::string &text);
|
||||||
Label();
|
Label();
|
||||||
//private:
|
//private:
|
||||||
@@ -247,7 +274,8 @@ 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 create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
|
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);
|
||||||
void reset();
|
void reset();
|
||||||
@@ -265,7 +293,7 @@ struct ListBox : Widget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ProgressBar : Widget {
|
struct ProgressBar : Widget {
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height);
|
void setParent(Layout &parent);
|
||||||
void setPosition(unsigned position);
|
void setPosition(unsigned position);
|
||||||
ProgressBar();
|
ProgressBar();
|
||||||
//private:
|
//private:
|
||||||
@@ -275,8 +303,9 @@ struct ProgressBar : Widget {
|
|||||||
|
|
||||||
struct RadioBox : Widget {
|
struct RadioBox : Widget {
|
||||||
nall::function<void ()> onTick;
|
nall::function<void ()> onTick;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
void create(RadioBox &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(RadioBox &parent);
|
||||||
|
void setText(const nall::string &text);
|
||||||
bool checked();
|
bool checked();
|
||||||
void setChecked();
|
void setChecked();
|
||||||
RadioBox();
|
RadioBox();
|
||||||
@@ -288,7 +317,7 @@ 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 create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
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);
|
||||||
@@ -300,7 +329,8 @@ struct TextBox : Widget {
|
|||||||
|
|
||||||
struct VerticalSlider : Widget {
|
struct VerticalSlider : Widget {
|
||||||
nall::function<void ()> onChange;
|
nall::function<void ()> onChange;
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, unsigned length);
|
void setParent(Layout &parent);
|
||||||
|
void setLength(unsigned length);
|
||||||
unsigned position();
|
unsigned position();
|
||||||
void setPosition(unsigned position);
|
void setPosition(unsigned position);
|
||||||
VerticalSlider();
|
VerticalSlider();
|
||||||
@@ -310,7 +340,7 @@ struct VerticalSlider : Widget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Viewport : Widget {
|
struct Viewport : Widget {
|
||||||
void create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height);
|
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: Mon Jan 31 08:47:12 2011
|
** Created: Thu Feb 3 18:21:19 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,6 +193,104 @@ 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:
|
||||||
|
@@ -90,13 +90,41 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Layout::Data : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
Layout &self;
|
||||||
|
|
||||||
|
Data(Layout &self) : self(self) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FixedLayout::Data : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
FixedLayout &self;
|
||||||
|
Window *parent;
|
||||||
|
struct Children {
|
||||||
|
Widget *widget;
|
||||||
|
unsigned x, y;
|
||||||
|
unsigned width, height;
|
||||||
|
};
|
||||||
|
linear_vector<Children> children;
|
||||||
|
|
||||||
|
Data(FixedLayout &self) : self(self) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct Window::Data : public QWidget {
|
struct Window::Data : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window &self;
|
Window &self;
|
||||||
|
Layout *layout;
|
||||||
QFont *defaultFont;
|
QFont *defaultFont;
|
||||||
QVBoxLayout *layout;
|
QVBoxLayout *vlayout;
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QWidget *container;
|
QWidget *container;
|
||||||
QStatusBar *statusBar;
|
QStatusBar *statusBar;
|
||||||
|
@@ -1,26 +1,15 @@
|
|||||||
void RadioBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void RadioBox::setParent(Layout &parent) {
|
||||||
radioBox->parent = &parent;
|
radioBox->setParent(parent.widget->widget);
|
||||||
radioBox->buttonGroup = new QButtonGroup;
|
|
||||||
radioBox->buttonGroup->addButton(radioBox);
|
|
||||||
radioBox->setParent(radioBox->parent->window->container);
|
|
||||||
radioBox->setGeometry(x, y, width, height);
|
|
||||||
radioBox->setText(QString::fromUtf8(text));
|
|
||||||
radioBox->setChecked(true);
|
|
||||||
if(parent.window->defaultFont) radioBox->setFont(*parent.window->defaultFont);
|
|
||||||
radioBox->show();
|
radioBox->show();
|
||||||
radioBox->connect(radioBox, SIGNAL(toggled(bool)), SLOT(onTick()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioBox::create(RadioBox &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void RadioBox::setParent(RadioBox &parent) {
|
||||||
radioBox->parent = parent.radioBox->parent;
|
parent.radioBox->buttonGroup->addButton(radioBox);
|
||||||
radioBox->buttonGroup = parent.radioBox->buttonGroup;
|
parent.radioBox->setChecked(true);
|
||||||
radioBox->buttonGroup->addButton(radioBox);
|
}
|
||||||
radioBox->setParent(radioBox->parent->window->container);
|
|
||||||
radioBox->setGeometry(x, y, width, height);
|
void RadioBox::setText(const string &text) {
|
||||||
radioBox->setText(QString::fromUtf8(text));
|
radioBox->setText(QString::fromUtf8(text));
|
||||||
if(radioBox->parent->window->defaultFont) radioBox->setFont(*radioBox->parent->window->defaultFont);
|
|
||||||
radioBox->show();
|
|
||||||
radioBox->connect(radioBox, SIGNAL(toggled(bool)), SLOT(onTick()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RadioBox::checked() {
|
bool RadioBox::checked() {
|
||||||
@@ -34,4 +23,8 @@ void RadioBox::setChecked() {
|
|||||||
RadioBox::RadioBox() {
|
RadioBox::RadioBox() {
|
||||||
radioBox = new RadioBox::Data(*this);
|
radioBox = new RadioBox::Data(*this);
|
||||||
widget->widget = radioBox;
|
widget->widget = radioBox;
|
||||||
|
radioBox->buttonGroup = new QButtonGroup;
|
||||||
|
radioBox->buttonGroup->addButton(radioBox);
|
||||||
|
radioBox->setChecked(true);
|
||||||
|
radioBox->connect(radioBox, SIGNAL(toggled(bool)), SLOT(onTick()));
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,6 @@
|
|||||||
void TextBox::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void TextBox::setParent(Layout &parent) {
|
||||||
textBox->setParent(parent.window->container);
|
textBox->setParent(parent.widget->widget);
|
||||||
textBox->setGeometry(x, y, width, height);
|
|
||||||
textBox->setText(QString::fromUtf8(text));
|
|
||||||
if(parent.window->defaultFont) textBox->setFont(*parent.window->defaultFont);
|
|
||||||
textBox->show();
|
textBox->show();
|
||||||
textBox->connect(textBox, SIGNAL(returnPressed()), SLOT(onActivate()));
|
|
||||||
textBox->connect(textBox, SIGNAL(textEdited(const QString&)), SLOT(onChange()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBox::setEditable(bool editable) {
|
void TextBox::setEditable(bool editable) {
|
||||||
@@ -23,4 +18,6 @@ void TextBox::setText(const string &text) {
|
|||||||
TextBox::TextBox() {
|
TextBox::TextBox() {
|
||||||
textBox = new TextBox::Data(*this);
|
textBox = new TextBox::Data(*this);
|
||||||
widget->widget = textBox;
|
widget->widget = textBox;
|
||||||
|
textBox->connect(textBox, SIGNAL(returnPressed()), SLOT(onActivate()));
|
||||||
|
textBox->connect(textBox, SIGNAL(textEdited(const QString&)), SLOT(onChange()));
|
||||||
}
|
}
|
||||||
|
@@ -1,13 +1,12 @@
|
|||||||
void VerticalSlider::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, unsigned length) {
|
void VerticalSlider::setParent(Layout &parent) {
|
||||||
length += (length == 0);
|
verticalSlider->setParent(parent.widget->widget);
|
||||||
verticalSlider->setParent(parent.window->container);
|
verticalSlider->show();
|
||||||
verticalSlider->setGeometry(x, y, width, height);
|
}
|
||||||
verticalSlider->setInvertedAppearance(true);
|
|
||||||
verticalSlider->setInvertedControls(true);
|
void VerticalSlider::setLength(unsigned length) {
|
||||||
|
length = length + (length == 0);
|
||||||
verticalSlider->setRange(0, length - 1);
|
verticalSlider->setRange(0, length - 1);
|
||||||
verticalSlider->setPageStep(length >> 3);
|
verticalSlider->setPageStep(length >> 3);
|
||||||
verticalSlider->connect(verticalSlider, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
|
||||||
verticalSlider->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned VerticalSlider::position() {
|
unsigned VerticalSlider::position() {
|
||||||
@@ -21,4 +20,7 @@ void VerticalSlider::setPosition(unsigned position) {
|
|||||||
VerticalSlider::VerticalSlider() {
|
VerticalSlider::VerticalSlider() {
|
||||||
verticalSlider = new VerticalSlider::Data(*this);
|
verticalSlider = new VerticalSlider::Data(*this);
|
||||||
widget->widget = verticalSlider;
|
widget->widget = verticalSlider;
|
||||||
|
verticalSlider->setInvertedAppearance(true);
|
||||||
|
verticalSlider->setInvertedControls(true);
|
||||||
|
verticalSlider->connect(verticalSlider, SIGNAL(valueChanged(int)), SLOT(onChange()));
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,5 @@
|
|||||||
void Viewport::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height) {
|
void Viewport::setParent(Layout &parent) {
|
||||||
viewport->setParent(parent.window->container);
|
viewport->setParent(parent.widget->widget);
|
||||||
viewport->setGeometry(x, y, width, height);
|
|
||||||
viewport->setAttribute(Qt::WA_PaintOnScreen, true);
|
|
||||||
viewport->setStyleSheet("background: #000000");
|
|
||||||
viewport->show();
|
viewport->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13,4 +10,6 @@ uintptr_t Viewport::handle() {
|
|||||||
Viewport::Viewport() {
|
Viewport::Viewport() {
|
||||||
viewport = new Viewport::Data(*this);
|
viewport = new Viewport::Data(*this);
|
||||||
widget->widget = viewport;
|
widget->widget = viewport;
|
||||||
|
viewport->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||||
|
viewport->setStyleSheet("background: #000000");
|
||||||
}
|
}
|
||||||
|
@@ -2,26 +2,31 @@ void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, con
|
|||||||
window->setWindowTitle(QString::fromUtf8(text));
|
window->setWindowTitle(QString::fromUtf8(text));
|
||||||
window->move(x, y);
|
window->move(x, y);
|
||||||
|
|
||||||
window->layout = new QVBoxLayout(window);
|
window->vlayout = new QVBoxLayout(window);
|
||||||
window->layout->setAlignment(Qt::AlignTop);
|
window->vlayout->setAlignment(Qt::AlignTop);
|
||||||
window->layout->setMargin(0);
|
window->vlayout->setMargin(0);
|
||||||
window->layout->setSpacing(0);
|
window->vlayout->setSpacing(0);
|
||||||
window->layout->setSizeConstraint(QLayout::SetFixedSize);
|
window->vlayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
window->setLayout(window->layout);
|
window->setLayout(window->vlayout);
|
||||||
|
|
||||||
window->menuBar = new QMenuBar(window);
|
window->menuBar = new QMenuBar(window);
|
||||||
window->menuBar->setVisible(false);
|
window->menuBar->setVisible(false);
|
||||||
window->layout->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->setFixedSize(width, height);
|
||||||
window->container->setVisible(true);
|
window->container->setVisible(true);
|
||||||
window->layout->addWidget(window->container);
|
window->vlayout->addWidget(window->container);
|
||||||
|
|
||||||
window->statusBar = new QStatusBar(window);
|
window->statusBar = new QStatusBar(window);
|
||||||
window->statusBar->setSizeGripEnabled(false);
|
window->statusBar->setSizeGripEnabled(false);
|
||||||
window->statusBar->setVisible(false);
|
window->statusBar->setVisible(false);
|
||||||
window->layout->addWidget(window->statusBar);
|
window->vlayout->addWidget(window->statusBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::setLayout(Layout &layout) {
|
||||||
|
window->layout = &layout;
|
||||||
|
layout.create(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry Window::geometry() {
|
Geometry Window::geometry() {
|
||||||
@@ -77,10 +82,10 @@ bool Window::fullscreen() {
|
|||||||
|
|
||||||
void Window::setFullscreen(bool fullscreen) {
|
void Window::setFullscreen(bool fullscreen) {
|
||||||
if(fullscreen == false) {
|
if(fullscreen == false) {
|
||||||
window->layout->setSizeConstraint(QLayout::SetFixedSize);
|
window->vlayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
window->showNormal();
|
window->showNormal();
|
||||||
} else {
|
} else {
|
||||||
window->layout->setSizeConstraint(QLayout::SetNoConstraint);
|
window->vlayout->setSizeConstraint(QLayout::SetNoConstraint);
|
||||||
window->container->setFixedSize(OS::desktopWidth(), OS::desktopHeight());
|
window->container->setFixedSize(OS::desktopWidth(), OS::desktopHeight());
|
||||||
window->showFullScreen();
|
window->showFullScreen();
|
||||||
}
|
}
|
||||||
@@ -94,6 +99,12 @@ void Window::setFullscreen(bool fullscreen) {
|
|||||||
geom = geometry();
|
geom = geometry();
|
||||||
if(startTime - time(0) > 3) break;
|
if(startTime - time(0) > 3) break;
|
||||||
} while((signed)geom.x < 0 || (signed)geom.y < 0);
|
} 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() {
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
|
void Button::setParent(Layout &layout) {
|
||||||
|
SetParent(widget->window, layout.widget->window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Button::setText(const string &text) {
|
||||||
|
SetWindowText(widget->window, utf16_t(text));
|
||||||
|
}
|
||||||
|
|
||||||
|
Button::Button() {
|
||||||
|
widget->window = CreateWindow(
|
||||||
|
L"BUTTON", L"",
|
||||||
|
WS_CHILD | WS_TABSTOP | WS_VISIBLE,
|
||||||
|
0, 0, 64, 64,
|
||||||
|
OS::os->nullWindow, (HMENU)object->id, GetModuleHandle(0), 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void Button::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
void Button::create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const string &text) {
|
||||||
widget->window = CreateWindow(
|
widget->window = CreateWindow(
|
||||||
L"BUTTON", utf16_t(text),
|
L"BUTTON", utf16_t(text),
|
||||||
@@ -8,3 +26,4 @@ void Button::create(Window &parent, unsigned x, unsigned y, unsigned width, unsi
|
|||||||
SetWindowLongPtr(widget->window, GWLP_USERDATA, (LONG_PTR)this);
|
SetWindowLongPtr(widget->window, GWLP_USERDATA, (LONG_PTR)this);
|
||||||
SendMessage(widget->window, WM_SETFONT, (WPARAM)(parent.window->defaultFont ? parent.window->defaultFont : OS::os->proportionalFont), 0);
|
SendMessage(widget->window, WM_SETFONT, (WPARAM)(parent.window->defaultFont ? parent.window->defaultFont : OS::os->proportionalFont), 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
23
bsnes/phoenix/windows/fixed-layout.cpp
Executable file
23
bsnes/phoenix/windows/fixed-layout.cpp
Executable file
@@ -0,0 +1,23 @@
|
|||||||
|
void FixedLayout::append(Widget &widget, unsigned x, unsigned y, unsigned width, unsigned height) {
|
||||||
|
fixedLayout->widgets.append({ &widget, x, y, width, height });
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedLayout::create(Window &parent_) {
|
||||||
|
SetParent(widget->window, parent_.widget->window);
|
||||||
|
setGeometry(0, 0, 640, 480);
|
||||||
|
|
||||||
|
foreach(control, fixedLayout->widgets) {
|
||||||
|
SetParent(control.widget->widget->window, widget->window);
|
||||||
|
control.widget->setGeometry(control.x, control.y, control.width, control.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FixedLayout::FixedLayout() {
|
||||||
|
fixedLayout = new FixedLayout::Data;
|
||||||
|
widget->window = CreateWindow(
|
||||||
|
L"phoenix_window", L"",
|
||||||
|
WS_CHILD | WS_TABSTOP | WS_VISIBLE,
|
||||||
|
0, 0, 64, 64,
|
||||||
|
OS::os->nullWindow, 0, GetModuleHandle(0), 0
|
||||||
|
);
|
||||||
|
}
|
3
bsnes/phoenix/windows/layout.cpp
Executable file
3
bsnes/phoenix/windows/layout.cpp
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
Layout::Layout() {
|
||||||
|
layout = new Layout::Data;
|
||||||
|
}
|
@@ -15,11 +15,6 @@ struct Action::Data {
|
|||||||
array<MenuRadioItem*> items;
|
array<MenuRadioItem*> items;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Widget::Data {
|
|
||||||
HWND window;
|
|
||||||
HFONT font;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Window::Data {
|
struct Window::Data {
|
||||||
HFONT defaultFont;
|
HFONT defaultFont;
|
||||||
HBRUSH brush;
|
HBRUSH brush;
|
||||||
@@ -33,6 +28,25 @@ struct Window::Data {
|
|||||||
unsigned height;
|
unsigned height;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Widget::Data {
|
||||||
|
HWND window;
|
||||||
|
HFONT font;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Layout::Data {
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FixedLayout::Data {
|
||||||
|
Window *parent;
|
||||||
|
|
||||||
|
struct Widgets {
|
||||||
|
Widget *widget;
|
||||||
|
unsigned x, y;
|
||||||
|
unsigned width, height;
|
||||||
|
};
|
||||||
|
linear_vector<Widgets> widgets;
|
||||||
|
};
|
||||||
|
|
||||||
struct Canvas::Data {
|
struct Canvas::Data {
|
||||||
uint32_t *buffer;
|
uint32_t *buffer;
|
||||||
BITMAPINFO bmi;
|
BITMAPINFO bmi;
|
||||||
@@ -82,6 +96,7 @@ struct VerticalSlider::Data {
|
|||||||
|
|
||||||
struct OS::Data {
|
struct OS::Data {
|
||||||
nall::array<Object*> objects;
|
nall::array<Object*> objects;
|
||||||
|
HWND nullWindow;
|
||||||
HFONT proportionalFont;
|
HFONT proportionalFont;
|
||||||
HFONT monospaceFont;
|
HFONT monospaceFont;
|
||||||
};
|
};
|
||||||
|
@@ -18,6 +18,10 @@ void Window::create(unsigned x, unsigned y, unsigned width, unsigned height, con
|
|||||||
SetWindowLongPtr(widget->window, GWLP_USERDATA, (LONG_PTR)this);
|
SetWindowLongPtr(widget->window, GWLP_USERDATA, (LONG_PTR)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::setLayout(Layout &layout) {
|
||||||
|
layout.create(*this);
|
||||||
|
}
|
||||||
|
|
||||||
void Window::setDefaultFont(Font &font) {
|
void Window::setDefaultFont(Font &font) {
|
||||||
window->defaultFont = font.font->font;
|
window->defaultFont = font.font->font;
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,8 @@ namespace phoenix {
|
|||||||
#include "menu.cpp"
|
#include "menu.cpp"
|
||||||
#include "widget.cpp"
|
#include "widget.cpp"
|
||||||
#include "window.cpp"
|
#include "window.cpp"
|
||||||
|
#include "layout.cpp"
|
||||||
|
#include "fixed-layout.cpp"
|
||||||
#include "button.cpp"
|
#include "button.cpp"
|
||||||
#include "canvas.cpp"
|
#include "canvas.cpp"
|
||||||
#include "checkbox.cpp"
|
#include "checkbox.cpp"
|
||||||
@@ -97,6 +99,9 @@ void OS::initialize() {
|
|||||||
wc.lpszMenuName = 0;
|
wc.lpszMenuName = 0;
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
RegisterClass(&wc);
|
RegisterClass(&wc);
|
||||||
|
|
||||||
|
//default window to attach all controls to during construction (prior to attaching to layout)
|
||||||
|
os->nullWindow = CreateWindow(L"phoenix_window", L"", WS_POPUP, 0, 0, 640, 480, 0, 0, GetModuleHandle(0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OS::pending() {
|
bool OS::pending() {
|
||||||
|
@@ -85,15 +85,20 @@ struct MenuRadioItem : Action {
|
|||||||
void setChecked();
|
void setChecked();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Window;
|
||||||
|
struct Layout;
|
||||||
|
|
||||||
struct Widget : Object {
|
struct Widget : Object {
|
||||||
|
virtual void setParent(Layout &parent) {}
|
||||||
|
|
||||||
virtual void setFont(Font &font);
|
virtual void setFont(Font &font);
|
||||||
|
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
||||||
bool visible();
|
bool visible();
|
||||||
void setVisible(bool visible = true);
|
void setVisible(bool visible = true);
|
||||||
bool enabled();
|
bool enabled();
|
||||||
void setEnabled(bool enabled = true);
|
void setEnabled(bool enabled = true);
|
||||||
bool focused();
|
bool focused();
|
||||||
void setFocused();
|
void setFocused();
|
||||||
virtual void setGeometry(unsigned x, unsigned y, unsigned width, unsigned height);
|
|
||||||
Widget();
|
Widget();
|
||||||
//private:
|
//private:
|
||||||
struct Data;
|
struct Data;
|
||||||
@@ -103,6 +108,7 @@ struct Widget : Object {
|
|||||||
struct Window : Widget {
|
struct Window : Widget {
|
||||||
nall::function<bool ()> onClose;
|
nall::function<bool ()> onClose;
|
||||||
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 setDefaultFont(Font &font);
|
void setDefaultFont(Font &font);
|
||||||
void setFont(Font &font);
|
void setFont(Font &font);
|
||||||
Geometry geometry();
|
Geometry geometry();
|
||||||
@@ -122,9 +128,28 @@ struct Window : Widget {
|
|||||||
void resize(unsigned width, unsigned height);
|
void resize(unsigned width, unsigned height);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 create(Window &parent, unsigned x, unsigned y, unsigned width, unsigned height, const nall::string &text = "");
|
void setParent(Layout &parent);
|
||||||
|
void setText(const nall::string &text);
|
||||||
|
Button();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Canvas : Widget {
|
struct Canvas : Widget {
|
||||||
|
@@ -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.06";
|
static const char Version[] = "075.07";
|
||||||
static const unsigned SerializerVersion = 18;
|
static const unsigned SerializerVersion = 18;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#define DEBUGGER
|
#define DEBUGGER
|
||||||
|
|
||||||
#include <libco/libco.h>
|
#include <libco/libco.h>
|
||||||
|
|
||||||
|
@@ -35,7 +35,8 @@ void MainWindow::create() {
|
|||||||
help.create(*this, "Help");
|
help.create(*this, "Help");
|
||||||
helpAbout.create(help, "About ...");
|
helpAbout.create(help, "About ...");
|
||||||
|
|
||||||
viewport.create(*this, 0, 0, 160 * 2, 144 * 2);
|
layout.append(viewport, 0, 0, 160 * 2, 144 * 2);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
setMenuVisible(true);
|
setMenuVisible(true);
|
||||||
setStatusVisible(true);
|
setStatusVisible(true);
|
||||||
|
@@ -27,6 +27,7 @@ struct MainWindow : Window {
|
|||||||
Menu help;
|
Menu help;
|
||||||
MenuItem helpAbout;
|
MenuItem helpAbout;
|
||||||
|
|
||||||
|
FixedLayout layout;
|
||||||
Viewport viewport;
|
Viewport viewport;
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
@@ -4,21 +4,25 @@ void Console::create() {
|
|||||||
Window::create(0, 0, 256, 256, "Console");
|
Window::create(0, 0, 256, 256, "Console");
|
||||||
application.addWindow(this, "Debugger.Console", "192,192");
|
application.addWindow(this, "Debugger.Console", "192,192");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
|
||||||
output.create(*this, x, y, 580, 338); x += 580 + 5;
|
|
||||||
output.setFont(application.monospaceFont);
|
output.setFont(application.monospaceFont);
|
||||||
output.setEditable(false);
|
output.setEditable(false);
|
||||||
|
traceToConsole.setText("Trace to console");
|
||||||
traceToConsole.create(*this, x, y, 120, Style::CheckBoxHeight, "Trace to console"); y += Style::CheckBoxHeight;
|
traceToFile.setText("Trace to file");
|
||||||
|
traceCPU.setText("Trace CPU");
|
||||||
|
traceSMP.setText("Trace SMP");
|
||||||
traceToConsole.setChecked(true);
|
traceToConsole.setChecked(true);
|
||||||
traceToFile.create(*this, x, y, 120, Style::CheckBoxHeight, "Trace to file"); y += Style::CheckBoxHeight;
|
|
||||||
traceCPU.create(*this, x, y, 120, Style::CheckBoxHeight, "Trace S-CPU"); y += Style::CheckBoxHeight;
|
|
||||||
traceCPU.setChecked(true);
|
traceCPU.setChecked(true);
|
||||||
traceSMP.create(*this, x, y, 120, Style::CheckBoxHeight, "Trace S-SMP"); y += Style::CheckBoxHeight;
|
clearConsole.setText("Clear console");
|
||||||
|
|
||||||
clearConsole.create(*this, x, 348 - Style::ButtonHeight - 5, 120, Style::ButtonHeight, "Clear console");
|
|
||||||
|
|
||||||
|
unsigned x = 5, y = 5;
|
||||||
|
layout.append(output, x, y, 580, 338); x += 580 + 5;
|
||||||
|
layout.append(traceToConsole, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
|
layout.append(traceToFile, x, y, 120, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
|
layout.append(traceCPU, 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);
|
||||||
setGeometry(0, 0, 715, 348);
|
setGeometry(0, 0, 715, 348);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
debugger.showConsole.setChecked(false);
|
debugger.showConsole.setChecked(false);
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct Console : TopLevelWindow {
|
struct Console : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
EditBox output;
|
EditBox output;
|
||||||
CheckBox traceToConsole;
|
CheckBox traceToConsole;
|
||||||
CheckBox traceToFile;
|
CheckBox traceToFile;
|
||||||
|
@@ -4,17 +4,20 @@ void CPUDebugger::create() {
|
|||||||
Window::create(0, 0, 256, 256, "CPU Debugger");
|
Window::create(0, 0, 256, 256, "CPU Debugger");
|
||||||
application.addWindow(this, "Debugger.CPUdebugger", "192,192");
|
application.addWindow(this, "Debugger.CPUdebugger", "192,192");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
|
||||||
output.create(*this, x, y, 400, 210); x += 400 + 5;
|
|
||||||
output.setFont(application.monospaceFont);
|
output.setFont(application.monospaceFont);
|
||||||
output.setEditable(false);
|
output.setEditable(false);
|
||||||
|
stepInto.setText("Step Into");
|
||||||
stepInto.create(*this, x, y, 80, Style::ButtonHeight, "Step Into"); y += Style::ButtonHeight;
|
stepOver.setText("Step Over");
|
||||||
stepOver.create(*this, x, y, 80, Style::ButtonHeight, "Step Over"); y += Style::ButtonHeight;
|
proceed.setText("Proceed");
|
||||||
proceed.create(*this, x, y, 80, Style::ButtonHeight, "Proceed"); y += Style::ButtonHeight;
|
|
||||||
proceed.setEnabled(false);
|
proceed.setEnabled(false);
|
||||||
|
|
||||||
|
unsigned x = 5, y = 5;
|
||||||
|
layout.append(output, x, y, 400, 210); x += 400 + 5;
|
||||||
|
layout.append(stepInto, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
||||||
|
layout.append(stepOver, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
||||||
|
layout.append(proceed, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
||||||
setGeometry(0, 0, 495, 220);
|
setGeometry(0, 0, 495, 220);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
debugger.showCPUDebugger.setChecked(false);
|
debugger.showCPUDebugger.setChecked(false);
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct CPUDebugger : TopLevelWindow {
|
struct CPUDebugger : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
EditBox output;
|
EditBox output;
|
||||||
Button stepInto;
|
Button stepInto;
|
||||||
Button stepOver;
|
Button stepOver;
|
||||||
|
@@ -21,13 +21,22 @@ void Debugger::create() {
|
|||||||
Window::create(0, 0, 256, 256, "Debugger");
|
Window::create(0, 0, 256, 256, "Debugger");
|
||||||
application.addWindow(this, "Debugger", "160,160");
|
application.addWindow(this, "Debugger", "160,160");
|
||||||
|
|
||||||
|
enableDebugger.setText("Enable debugger");
|
||||||
|
showConsole.setText("Console");
|
||||||
|
showCPUDebugger.setText("CPU debugger");
|
||||||
|
showSMPDebugger.setText("SMP debugger");
|
||||||
|
showBreakpointEditor.setText("Breakpoint editor");
|
||||||
|
showMemoryEditor.setText("Memory editor");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
unsigned x = 5, y = 5;
|
||||||
enableDebugger.create(*this, x, y, 240, Style::CheckBoxHeight, "Enable debugger"); y += Style::CheckBoxHeight;
|
layout.append(enableDebugger, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
showConsole.create(*this, x, y, 240, Style::CheckBoxHeight, "Console"); y += Style::CheckBoxHeight;
|
layout.append(showConsole, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
showCPUDebugger.create(*this, x, y, 240, Style::CheckBoxHeight, "CPU debugger"); y += Style::CheckBoxHeight;
|
layout.append(showCPUDebugger, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
showSMPDebugger.create(*this, x, y, 240, Style::CheckBoxHeight, "SMP debugger"); y += Style::CheckBoxHeight;
|
layout.append(showSMPDebugger, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
showBreakpointEditor.create(*this, x, y, 240, Style::CheckBoxHeight, "Breakpoint editor"); y += Style::CheckBoxHeight;
|
layout.append(showBreakpointEditor, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
showMemoryEditor.create(*this, x, y, 240, Style::CheckBoxHeight, "Memory editor"); y += Style::CheckBoxHeight;
|
layout.append(showMemoryEditor, x, y, 240, Style::CheckBoxHeight); y += Style::CheckBoxHeight;
|
||||||
|
setGeometry(0, 0, 250, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
//windows shown by default
|
//windows shown by default
|
||||||
showConsole.setChecked();
|
showConsole.setChecked();
|
||||||
@@ -35,8 +44,6 @@ void Debugger::create() {
|
|||||||
showSMPDebugger.setChecked();
|
showSMPDebugger.setChecked();
|
||||||
showBreakpointEditor.setChecked();
|
showBreakpointEditor.setChecked();
|
||||||
|
|
||||||
setGeometry(0, 0, 250, y);
|
|
||||||
|
|
||||||
enableDebugger.onTick = []() {
|
enableDebugger.onTick = []() {
|
||||||
debugger.enable(debugger.enableDebugger.checked());
|
debugger.enable(debugger.enableDebugger.checked());
|
||||||
};
|
};
|
||||||
|
@@ -12,6 +12,7 @@ struct Debugger : TopLevelWindow {
|
|||||||
StepIntoSMP,
|
StepIntoSMP,
|
||||||
} debugMode;
|
} debugMode;
|
||||||
|
|
||||||
|
FixedLayout layout;
|
||||||
CheckBox enableDebugger;
|
CheckBox enableDebugger;
|
||||||
CheckBox showConsole;
|
CheckBox showConsole;
|
||||||
CheckBox showCPUDebugger;
|
CheckBox showCPUDebugger;
|
||||||
|
@@ -4,17 +4,20 @@ void SMPDebugger::create() {
|
|||||||
Window::create(0, 0, 256, 256, "SMP Debugger");
|
Window::create(0, 0, 256, 256, "SMP Debugger");
|
||||||
application.addWindow(this, "Debugger.SMPDebugger", "192,192");
|
application.addWindow(this, "Debugger.SMPDebugger", "192,192");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
|
||||||
output.create(*this, x, y, 400, 210); x += 400 + 5;
|
|
||||||
output.setFont(application.monospaceFont);
|
output.setFont(application.monospaceFont);
|
||||||
output.setEditable(false);
|
output.setEditable(false);
|
||||||
|
stepInto.setText("Step Into");
|
||||||
stepInto.create(*this, x, y, 80, Style::ButtonHeight, "Step Into"); y += Style::ButtonHeight;
|
stepOver.setText("Step Over");
|
||||||
stepOver.create(*this, x, y, 80, Style::ButtonHeight, "Step Over"); y += Style::ButtonHeight;
|
proceed.setText("Proceed");
|
||||||
proceed.create(*this, x, y, 80, Style::ButtonHeight, "Proceed"); y += Style::ButtonHeight;
|
|
||||||
proceed.setEnabled(false);
|
proceed.setEnabled(false);
|
||||||
|
|
||||||
|
unsigned x = 5, y = 5;
|
||||||
|
layout.append(output, x, y, 400, 210); x += 400 + 5;
|
||||||
|
layout.append(stepInto, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
||||||
|
layout.append(stepOver, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
||||||
|
layout.append(proceed, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
||||||
setGeometry(0, 0, 495, 220);
|
setGeometry(0, 0, 495, 220);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
debugger.showSMPDebugger.setChecked(false);
|
debugger.showSMPDebugger.setChecked(false);
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct SMPDebugger : TopLevelWindow {
|
struct SMPDebugger : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
EditBox output;
|
EditBox output;
|
||||||
Button stepInto;
|
Button stepInto;
|
||||||
Button stepOver;
|
Button stepOver;
|
||||||
|
@@ -4,23 +4,31 @@ void BreakpointEditor::create() {
|
|||||||
Window::create(0, 0, 256, 256, "Breakpoint Editor");
|
Window::create(0, 0, 256, 256, "Breakpoint Editor");
|
||||||
application.addWindow(this, "Debugger.BreakpointEditor", "192,192");
|
application.addWindow(this, "Debugger.BreakpointEditor", "192,192");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
runToBreakpoint.setText("Run to breakpoint");
|
||||||
|
|
||||||
runToBreakpoint.create(*this, x, y, 295, Style::CheckBoxHeight, "Run to breakpoint");
|
|
||||||
y += Style::CheckBoxHeight + 5;
|
|
||||||
|
|
||||||
for(unsigned n = 0; n < Breakpoints; n++) {
|
for(unsigned n = 0; n < Breakpoints; n++) {
|
||||||
enableBox[n].create(*this, x, y, 35, Style::EditBoxHeight, { n + 1 });
|
enableBox[n].setText({ n + 1 });
|
||||||
addressBox[n].create(*this, x + 35, y, 60, Style::EditBoxHeight);
|
typeBox[n].addItem("Exec");
|
||||||
valueBox[n].create(*this, x + 100, y, 30, Style::EditBoxHeight);
|
typeBox[n].addItem("Read");
|
||||||
typeBox[n].create(*this, x + 135, y, 80, Style::EditBoxHeight, "Exec\nRead\nWrite");
|
typeBox[n].addItem("Write");
|
||||||
sourceBox[n].create(*this, x + 220, y, 80, Style::EditBoxHeight, "CPU\nAPU\nVRAM\nOAM\nCGRAM");
|
sourceBox[n].addItem("CPU");
|
||||||
y += Style::EditBoxHeight + 5;
|
sourceBox[n].addItem("APU");
|
||||||
|
sourceBox[n].addItem("VRAM");
|
||||||
|
sourceBox[n].addItem("OAM");
|
||||||
|
sourceBox[n].addItem("CGRAM");
|
||||||
enableBox[n].onTick = [n]() { breakpointEditor.toggleBreakpoint(n); };
|
enableBox[n].onTick = [n]() { breakpointEditor.toggleBreakpoint(n); };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned x = 5, y = 5;
|
||||||
|
layout.append(runToBreakpoint, x, y, 295, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
||||||
|
for(unsigned n = 0; n < Breakpoints; n++) {
|
||||||
|
layout.append(enableBox[n], x, y, 35, Style::EditBoxHeight);
|
||||||
|
layout.append(addressBox[n], x + 35, y, 60, Style::EditBoxHeight);
|
||||||
|
layout.append(valueBox[n], x + 100, y, 30, Style::EditBoxHeight);
|
||||||
|
layout.append(typeBox[n], x + 135, y, 80, Style::EditBoxHeight);
|
||||||
|
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);
|
||||||
|
|
||||||
runToBreakpoint.onTick = []() {
|
runToBreakpoint.onTick = []() {
|
||||||
if(breakpointEditor.runToBreakpoint.checked()) {
|
if(breakpointEditor.runToBreakpoint.checked()) {
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
struct BreakpointEditor : TopLevelWindow {
|
struct BreakpointEditor : TopLevelWindow {
|
||||||
enum : unsigned { Breakpoints = SNES::Debugger::Breakpoints };
|
enum : unsigned { Breakpoints = SNES::Debugger::Breakpoints };
|
||||||
|
FixedLayout layout;
|
||||||
CheckBox runToBreakpoint;
|
CheckBox runToBreakpoint;
|
||||||
CheckBox enableBox[Breakpoints];
|
CheckBox enableBox[Breakpoints];
|
||||||
TextBox addressBox[Breakpoints];
|
TextBox addressBox[Breakpoints];
|
||||||
|
@@ -4,24 +4,24 @@ void MemoryEditor::create() {
|
|||||||
Window::create(0, 0, 256, 256, "Memory Editor");
|
Window::create(0, 0, 256, 256, "Memory Editor");
|
||||||
application.addWindow(this, "Debugger.MemoryEditor", "192,192");
|
application.addWindow(this, "Debugger.MemoryEditor", "192,192");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
|
||||||
editor.create(*this, x, y, 475, 220); x += 475 + 5;
|
|
||||||
editor.setFont(application.monospaceFont);
|
|
||||||
editor.setColumns(16);
|
editor.setColumns(16);
|
||||||
editor.setRows(16);
|
editor.setRows(16);
|
||||||
|
|
||||||
sourceBox.create(*this, x, y, 80, Style::ComboBoxHeight); y += Style::ComboBoxHeight;
|
|
||||||
sourceBox.addItem("CPU");
|
sourceBox.addItem("CPU");
|
||||||
sourceBox.addItem("APU");
|
sourceBox.addItem("APU");
|
||||||
sourceBox.addItem("VRAM");
|
sourceBox.addItem("VRAM");
|
||||||
sourceBox.addItem("OAM");
|
sourceBox.addItem("OAM");
|
||||||
sourceBox.addItem("CGRAM");
|
sourceBox.addItem("CGRAM");
|
||||||
|
refreshButton.setText("Refresh");
|
||||||
|
|
||||||
gotoBox.create(*this, x, y, 80, Style::TextBoxHeight); y += Style::TextBoxHeight;
|
unsigned x = 5, y = 5;
|
||||||
|
layout.append(editor, x, y, 475, 220); x += 475 + 5;
|
||||||
refreshButton.create(*this, x, y, 80, Style::ButtonHeight, "Refresh"); y += Style::ButtonHeight;
|
layout.append(sourceBox, x, y, 80, Style::ComboBoxHeight); y += Style::ComboBoxHeight;
|
||||||
|
layout.append(gotoBox, x, y, 80, Style::TextBoxHeight); y += Style::TextBoxHeight;
|
||||||
|
layout.append(refreshButton, x, y, 80, Style::ButtonHeight); y += Style::ButtonHeight;
|
||||||
setGeometry(0, 0, 570, 230);
|
setGeometry(0, 0, 570, 230);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
editor.setFont(application.monospaceFont);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
debugger.showMemoryEditor.setChecked(false);
|
debugger.showMemoryEditor.setChecked(false);
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct MemoryEditor : TopLevelWindow {
|
struct MemoryEditor : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
HexEditor editor;
|
HexEditor editor;
|
||||||
ComboBox sourceBox;
|
ComboBox sourceBox;
|
||||||
TextBox gotoBox;
|
TextBox gotoBox;
|
||||||
|
@@ -6,13 +6,15 @@ void FileBrowser::create() {
|
|||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
|
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
|
||||||
|
|
||||||
pathBox.create(*this, x, y, 630 - height - height - 10, height);
|
browseButton.setText("...");
|
||||||
browseButton.create(*this, x + 630 - height - height - 5, y, height, height, "...");
|
upButton.setText("..");
|
||||||
upButton.create(*this, x + 630 - height, y, height, height, ".."); y += height + 5;
|
|
||||||
|
|
||||||
contentsBox.create(*this, x, y, 630, 350); y += 350 + 5;
|
|
||||||
|
|
||||||
|
layout.append(pathBox, x, y, 630 - height - height - 10, height);
|
||||||
|
layout.append(browseButton, x + 630 - height - height - 5, y, height, height);
|
||||||
|
layout.append(upButton, x + 630 - height, y, height, height); y += height + 5;
|
||||||
|
layout.append(contentsBox, x, y, 630, 350); y += 350 + 5;
|
||||||
setGeometry(0, 0, 640, y);
|
setGeometry(0, 0, 640, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
pathBox.onActivate = []() {
|
pathBox.onActivate = []() {
|
||||||
string path = fileBrowser.pathBox.text();
|
string path = fileBrowser.pathBox.text();
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct FileBrowser : TopLevelWindow {
|
struct FileBrowser : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
TextBox pathBox;
|
TextBox pathBox;
|
||||||
Button browseButton;
|
Button browseButton;
|
||||||
Button upButton;
|
Button upButton;
|
||||||
|
@@ -101,7 +101,9 @@ void MainWindow::create() {
|
|||||||
help.create(*this, "Help");
|
help.create(*this, "Help");
|
||||||
helpAbout.create(help, "About ...");
|
helpAbout.create(help, "About ...");
|
||||||
|
|
||||||
viewport.create(*this, 0, 0, 595, 448);
|
layout.append(viewport, 0, 0, 595, 448);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
utility.setStatus("");
|
utility.setStatus("");
|
||||||
setMenuVisible(true);
|
setMenuVisible(true);
|
||||||
setStatusVisible(true);
|
setStatusVisible(true);
|
||||||
|
@@ -71,6 +71,7 @@ struct MainWindow : TopLevelWindow {
|
|||||||
Menu help;
|
Menu help;
|
||||||
MenuItem helpAbout;
|
MenuItem helpAbout;
|
||||||
|
|
||||||
|
FixedLayout layout;
|
||||||
Viewport viewport;
|
Viewport viewport;
|
||||||
|
|
||||||
void create();
|
void create();
|
||||||
|
@@ -7,17 +7,21 @@ void SingleSlotLoader::create() {
|
|||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
|
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
|
||||||
|
|
||||||
baseLabel.create(*this, x, y, 50, height, "Base:");
|
baseLabel.setText("Base:");
|
||||||
basePath.create(*this, x + 50, y, 300, height);
|
baseBrowse.setText("...");
|
||||||
baseBrowse.create(*this, x + 355, y, height, height, "..."); y += height + 5;
|
slotLabel.setText("Slot:");
|
||||||
|
slotBrowse.setText("...");
|
||||||
slotLabel.create(*this, x, y, 50, height, "Slot:");
|
okButton.setText("Ok");
|
||||||
slotPath.create(*this, x + 50, y, 300, height);
|
|
||||||
slotBrowse.create(*this, x + 355, y, height, height, "..."); y += height + 5;
|
|
||||||
|
|
||||||
okButton.create(*this, x + width - 90, y, 80, Style::ButtonHeight, "Ok"); y += Style::ButtonHeight + 5;
|
|
||||||
|
|
||||||
|
layout.append(baseLabel, x, y, 50, height);
|
||||||
|
layout.append(basePath, x + 50, y, 300, height);
|
||||||
|
layout.append(baseBrowse, x + 355, y, height, height); y += height + 5;
|
||||||
|
layout.append(slotLabel, x, y, 50, height);
|
||||||
|
layout.append(slotPath, x + 50, y, 300, height);
|
||||||
|
layout.append(slotBrowse, x + 355, y, height, height); y += height + 5;
|
||||||
|
layout.append(okButton, x + width - 90, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
|
||||||
setGeometry(0, 0, width, y);
|
setGeometry(0, 0, width, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
baseBrowse.onTick = []() {
|
baseBrowse.onTick = []() {
|
||||||
fileBrowser.fileOpen(FileBrowser::Mode::Cartridge, [](string filename) {
|
fileBrowser.fileOpen(FileBrowser::Mode::Cartridge, [](string filename) {
|
||||||
@@ -92,21 +96,26 @@ void DoubleSlotLoader::create() {
|
|||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
|
unsigned x = 5, y = 5, height = Style::TextBoxHeight, width = 365 + height;
|
||||||
|
|
||||||
baseLabel.create(*this, x, y, 50, height, "Base:");
|
baseLabel.setText("Base:");
|
||||||
basePath.create(*this, x + 50, y, 300, height);
|
baseBrowse.setText("...");
|
||||||
baseBrowse.create(*this, x + 355, y, height, height, "..."); y += height + 5;
|
slotALabel.setText("Slot A:");
|
||||||
|
slotABrowse.setText("...");
|
||||||
slotALabel.create(*this, x, y, 50, height, "Slot A:");
|
slotBLabel.setText("Slot B:");
|
||||||
slotAPath.create(*this, x + 50, y, 300, height);
|
slotBBrowse.setText("...");
|
||||||
slotABrowse.create(*this, x + 355, y, height, height, "..."); y += height + 5;
|
okButton.setText("Ok");
|
||||||
|
|
||||||
slotBLabel.create(*this, x, y, 50, height, "Slot B:");
|
|
||||||
slotBPath.create(*this, x + 50, y, 300, height);
|
|
||||||
slotBBrowse.create(*this, x + 355, y, height, height, "..."); y += height + 5;
|
|
||||||
|
|
||||||
okButton.create(*this, x + width - 90, y, 80, Style::ButtonHeight, "Ok"); y += Style::ButtonHeight + 5;
|
|
||||||
|
|
||||||
|
layout.append(baseLabel, x, y, 50, height);
|
||||||
|
layout.append(basePath, x + 50, y, 300, height);
|
||||||
|
layout.append(baseBrowse, x + 355, y, height, height); y += height + 5;
|
||||||
|
layout.append(slotALabel, x, y, 50, height);
|
||||||
|
layout.append(slotAPath, x + 50, y, 300, height);
|
||||||
|
layout.append(slotABrowse, x + 355, y, height, height); y += height + 5;
|
||||||
|
layout.append(slotBLabel, x, y, 50, height);
|
||||||
|
layout.append(slotBPath, x + 50, y, 300, height);
|
||||||
|
layout.append(slotBBrowse, x + 355, y, height, height); y += height + 5;
|
||||||
|
layout.append(okButton, x + width - 90, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
|
||||||
setGeometry(0, 0, width, y);
|
setGeometry(0, 0, width, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
baseBrowse.onTick = []() {
|
baseBrowse.onTick = []() {
|
||||||
fileBrowser.fileOpen(FileBrowser::Mode::Cartridge, [](string filename) {
|
fileBrowser.fileOpen(FileBrowser::Mode::Cartridge, [](string filename) {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct SingleSlotLoader : TopLevelWindow {
|
struct SingleSlotLoader : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
Label baseLabel;
|
Label baseLabel;
|
||||||
TextBox basePath;
|
TextBox basePath;
|
||||||
Button baseBrowse;
|
Button baseBrowse;
|
||||||
@@ -17,6 +18,7 @@ struct SingleSlotLoader : TopLevelWindow {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct DoubleSlotLoader : TopLevelWindow {
|
struct DoubleSlotLoader : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
Label baseLabel;
|
Label baseLabel;
|
||||||
TextBox basePath;
|
TextBox basePath;
|
||||||
Button baseBrowse;
|
Button baseBrowse;
|
||||||
|
@@ -6,27 +6,35 @@ void AdvancedSettings::create() {
|
|||||||
|
|
||||||
unsigned x = 5, y = 5;
|
unsigned x = 5, y = 5;
|
||||||
|
|
||||||
driverSelectionLabel.create(*this, x, y, 595, Style::LabelHeight, "Driver Selection :."); y += Style::LabelHeight + 5;
|
driverSelectionLabel.setText("Driver Selection :.");
|
||||||
driverSelectionLabel.setFont(application.proportionalFontBold);
|
driverSelectionLabel.setFont(application.proportionalFontBold);
|
||||||
|
videoDriverLabel.setText("Video:");
|
||||||
videoDriverLabel.create(*this, x, y, 45, Style::ComboBoxHeight, "Video:");
|
audioDriverLabel.setText("Audio:");
|
||||||
videoDriverBox.create (*this, x + 45, y, 150, Style::ComboBoxHeight);
|
inputDriverLabel.setText("Input:");
|
||||||
audioDriverLabel.create(*this, x + 200, y, 45, Style::ComboBoxHeight, "Audio:");
|
focusPolicyLabel.setText("Focus Policy :.");
|
||||||
audioDriverBox.create (*this, x + 245, y, 150, Style::ComboBoxHeight);
|
|
||||||
inputDriverLabel.create(*this, x + 400, y, 45, Style::ComboBoxHeight, "Input:");
|
|
||||||
inputDriverBox.create (*this, x + 445, y, 150, Style::ComboBoxHeight); y += Style::ComboBoxHeight + 5;
|
|
||||||
|
|
||||||
focusPolicyLabel.create(*this, x, y, 595, Style::LabelHeight, "Focus Policy :."); y += Style::LabelHeight + 5;
|
|
||||||
focusPolicyLabel.setFont(application.proportionalFontBold);
|
focusPolicyLabel.setFont(application.proportionalFontBold);
|
||||||
|
focusPolicyPause.setText("Pause emulator when inactive");
|
||||||
focusPolicyPause.create(*this, x, y, 195, Style::CheckBoxHeight, "Pause emulator when inactive");
|
focusPolicyIgnore.setText("Ignore input when inactive");
|
||||||
focusPolicyIgnore.create(focusPolicyPause, x + 200, y, 195, Style::CheckBoxHeight, "Ignore input when inactive");
|
focusPolicyAllow.setText("Always allow input");
|
||||||
focusPolicyAllow.create(focusPolicyPause, x + 400, y, 195, Style::CheckBoxHeight, "Always allow input"); y += Style::CheckBoxHeight + 5;
|
focusPolicyIgnore.setParent(focusPolicyPause);
|
||||||
|
focusPolicyAllow.setParent(focusPolicyPause);
|
||||||
if(config.settings.focusPolicy == 0) focusPolicyPause.setChecked();
|
if(config.settings.focusPolicy == 0) focusPolicyPause.setChecked();
|
||||||
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.append(driverSelectionLabel, x, y, 595, Style::LabelHeight); y += Style::LabelHeight + 5;
|
||||||
|
layout.append(videoDriverLabel, x, y, 45, Style::ComboBoxHeight);
|
||||||
|
layout.append(videoDriverBox, x + 45, y, 150, Style::ComboBoxHeight);
|
||||||
|
layout.append(audioDriverLabel, x + 200, y, 45, Style::ComboBoxHeight);
|
||||||
|
layout.append(audioDriverBox, x + 245, y, 150, Style::ComboBoxHeight);
|
||||||
|
layout.append(inputDriverLabel, x + 400, y, 45, Style::ComboBoxHeight);
|
||||||
|
layout.append(inputDriverBox, x + 445, y, 150, Style::ComboBoxHeight); y += Style::ComboBoxHeight + 5;
|
||||||
|
layout.append(focusPolicyLabel, x, y, 595, Style::LabelHeight); y += Style::LabelHeight + 5;
|
||||||
|
layout.append(focusPolicyPause, x, 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;
|
||||||
setGeometry(0, 0, 605, y);
|
setGeometry(0, 0, 605, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
lstring list;
|
lstring list;
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct AdvancedSettings : TopLevelWindow {
|
struct AdvancedSettings : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
Label driverSelectionLabel;
|
Label driverSelectionLabel;
|
||||||
Label videoDriverLabel;
|
Label videoDriverLabel;
|
||||||
ComboBox videoDriverBox;
|
ComboBox videoDriverBox;
|
||||||
|
@@ -4,15 +4,20 @@ void AudioSettings::create() {
|
|||||||
Window::create(0, 0, 256, 256, "Audio Settings");
|
Window::create(0, 0, 256, 256, "Audio Settings");
|
||||||
application.addWindow(this, "AudioSettings", "160,160");
|
application.addWindow(this, "AudioSettings", "160,160");
|
||||||
|
|
||||||
|
volumeLabel.setText("Volume:");
|
||||||
|
volumeSlider.setLength(201);
|
||||||
|
frequencyLabel.setText("Frequency:");
|
||||||
|
frequencySlider.setLength(2001);
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
unsigned x = 5, y = 5;
|
||||||
|
layout.append(volumeLabel, x, y, 70, Style::SliderHeight);
|
||||||
volumeLabel.create(*this, x, y, 70, Style::SliderHeight, "Volume:");
|
layout.append(volumeValue, x + 70, y, 60, Style::SliderHeight);
|
||||||
volumeValue.create(*this, x + 70, y, 60, Style::SliderHeight);
|
layout.append(volumeSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
|
||||||
volumeSlider.create(*this, x + 130, y, 300, Style::SliderHeight, 201); y += Style::SliderHeight + 5;
|
layout.append(frequencyLabel, x, y, 70, Style::SliderHeight);
|
||||||
|
layout.append(frequencyValue, x + 70, y, 60, Style::SliderHeight);
|
||||||
frequencyLabel.create(*this, x, y, 70, Style::SliderHeight, "Frequency:");
|
layout.append(frequencySlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
|
||||||
frequencyValue.create(*this, x + 70, y, 60, Style::SliderHeight);
|
setGeometry(0, 0, 440, y);
|
||||||
frequencySlider.create(*this, x + 130, y, 300, Style::SliderHeight, 2001); y += Style::SliderHeight + 5;
|
setLayout(layout);
|
||||||
|
|
||||||
volumeSlider.onChange = []() {
|
volumeSlider.onChange = []() {
|
||||||
config.audio.volume = audioSettings.volumeSlider.position();
|
config.audio.volume = audioSettings.volumeSlider.position();
|
||||||
@@ -26,8 +31,6 @@ void AudioSettings::create() {
|
|||||||
audioSettings.frequencyValue.setText({ config.audio.inputFrequency, "hz" });
|
audioSettings.frequencyValue.setText({ config.audio.inputFrequency, "hz" });
|
||||||
};
|
};
|
||||||
|
|
||||||
setGeometry(0, 0, 440, y);
|
|
||||||
|
|
||||||
volumeSlider.setPosition(config.audio.volume);
|
volumeSlider.setPosition(config.audio.volume);
|
||||||
volumeValue.setText({ config.audio.volume, "%" });
|
volumeValue.setText({ config.audio.volume, "%" });
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct AudioSettings : TopLevelWindow {
|
struct AudioSettings : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
Label volumeLabel;
|
Label volumeLabel;
|
||||||
Label volumeValue;
|
Label volumeValue;
|
||||||
HorizontalSlider volumeSlider;
|
HorizontalSlider volumeSlider;
|
||||||
|
@@ -10,33 +10,39 @@ void InputSettings::create() {
|
|||||||
activeInput = 0;
|
activeInput = 0;
|
||||||
activeMouse = 0;
|
activeMouse = 0;
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::ButtonHeight;
|
portLabel.setText("Port:");
|
||||||
|
|
||||||
portLabel.create(*this, x, y, 50, Style::ComboBoxHeight, "Port:");
|
|
||||||
portBox.create(*this, x + 50, y, 200, Style::ComboBoxHeight);
|
|
||||||
portBox.addItem(inputMapper.port1.name);
|
portBox.addItem(inputMapper.port1.name);
|
||||||
portBox.addItem(inputMapper.port2.name);
|
portBox.addItem(inputMapper.port2.name);
|
||||||
deviceLabel.create(*this, x + 255, y, 50, Style::ComboBoxHeight, "Device:");
|
deviceLabel.setText("Device:");
|
||||||
deviceBox.create(*this, x + 305, y, 200, Style::ComboBoxHeight); y += Style::ComboBoxHeight + 5;
|
mappingList.setHeaderText("Name\tMapping");
|
||||||
|
mappingList.setHeaderVisible(true);
|
||||||
mappingList.create(*this, x, y, 505, 265, "Name\tMapping"); y += 265 + 5;
|
mouseXaxis.setText("Mouse X-axis");
|
||||||
mappingList.setHeaderVisible();
|
mouseYaxis.setText("Mouse Y-axis");
|
||||||
mappingList.setFocused();
|
mouseLeft.setText("Mouse Left");
|
||||||
|
mouseMiddle.setText("Mouse Middle");
|
||||||
mouseXaxis.create(*this, x, y, 100, height, "Mouse X-axis");
|
mouseRight.setText("Mouse Right");
|
||||||
mouseXaxis.setVisible(false);
|
clearButton.setText("Clear");
|
||||||
mouseYaxis.create(*this, x + 105, y, 100, height, "Mouse Y-axis");
|
|
||||||
mouseYaxis.setVisible(false);
|
|
||||||
mouseLeft.create(*this, x, y, 100, height, "Mouse Left");
|
|
||||||
mouseLeft.setVisible(false);
|
|
||||||
mouseMiddle.create(*this, x + 105, y, 100, height, "Mouse Middle");
|
|
||||||
mouseMiddle.setVisible(false);
|
|
||||||
mouseRight.create(*this, x + 105 + 105, y, 100, height, "Mouse Right");
|
|
||||||
mouseRight.setVisible(false);
|
|
||||||
clearButton.create(*this, 515 - 85, y, 80, height, "Clear");
|
|
||||||
y += height + 5;
|
|
||||||
|
|
||||||
|
unsigned x = 5, y = 5, height = Style::ButtonHeight;
|
||||||
|
layout.append(portLabel, x, y, 50, Style::ComboBoxHeight);
|
||||||
|
layout.append(portBox, x + 50, y, 200, Style::ComboBoxHeight);
|
||||||
|
layout.append(deviceLabel, x + 255, y, 50, Style::ComboBoxHeight);
|
||||||
|
layout.append(deviceBox, x + 305, y, 200, Style::ComboBoxHeight); y += Style::ComboBoxHeight + 5;
|
||||||
|
layout.append(mappingList, x, y, 505, 265); y += 265 + 5;
|
||||||
|
layout.append(mouseXaxis, x, y, 100, height);
|
||||||
|
layout.append(mouseYaxis, x + 105, y, 100, height);
|
||||||
|
layout.append(mouseLeft, x, y, 100, height);
|
||||||
|
layout.append(mouseMiddle, x + 105, y, 100, height);
|
||||||
|
layout.append(mouseRight, x + 105 + 105, y, 100, height);
|
||||||
|
layout.append(clearButton, 515 - 85, y, 80, height); y += height + 5;
|
||||||
setGeometry(0, 0, 515, y);
|
setGeometry(0, 0, 515, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
|
mouseXaxis.setVisible(false);
|
||||||
|
mouseYaxis.setVisible(false);
|
||||||
|
mouseLeft.setVisible(false);
|
||||||
|
mouseMiddle.setVisible(false);
|
||||||
|
mouseRight.setVisible(false);
|
||||||
|
|
||||||
portChanged();
|
portChanged();
|
||||||
portBox.onChange = { &InputSettings::portChanged, this };
|
portBox.onChange = { &InputSettings::portChanged, this };
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct InputSettings : TopLevelWindow {
|
struct InputSettings : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
Label portLabel;
|
Label portLabel;
|
||||||
ComboBox portBox;
|
ComboBox portBox;
|
||||||
Label deviceLabel;
|
Label deviceLabel;
|
||||||
|
@@ -6,49 +6,58 @@ void VideoSettings::create() {
|
|||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
|
unsigned x = 5, y = 5, height = Style::TextBoxHeight;
|
||||||
|
|
||||||
colorAdjustmentLabel.create(*this, x, y, 430, Style::LabelHeight, "Color Adjustment :."); y += Style::LabelHeight + 5;
|
colorAdjustmentLabel.setText("Color Adjustment :.");
|
||||||
colorAdjustmentLabel.setFont(application.proportionalFontBold);
|
colorAdjustmentLabel.setFont(application.proportionalFontBold);
|
||||||
|
brightnessLabel.setText("Brightness:");
|
||||||
brightnessLabel.create (*this, x, y, 80, Style::SliderHeight, "Brightness:");
|
brightnessSlider.setLength(201);
|
||||||
brightnessValue.create (*this, x + 80, y, 40, Style::SliderHeight);
|
contrastLabel.setText("Contrast:");
|
||||||
brightnessSlider.create(*this, x + 130, y, 300, Style::SliderHeight, 201); y += Style::SliderHeight;
|
contrastSlider.setLength(201);
|
||||||
|
gammaLabel.setText("Gamma:");
|
||||||
contrastLabel.create (*this, x, y, 80, Style::SliderHeight, "Contrast:");
|
gammaSlider.setLength(201);
|
||||||
contrastValue.create (*this, x + 80, y, 50, Style::SliderHeight);
|
gammaRampCheck.setText("Enable NTSC gamma ramp simulation");
|
||||||
contrastSlider.create (*this, x + 130, y, 300, Style::SliderHeight, 201); y += Style::SliderHeight;
|
fullscreenLabel.setText("Fullscreen :.");
|
||||||
|
|
||||||
gammaLabel.create (*this, x, y, 80, Style::SliderHeight, "Gamma:");
|
|
||||||
gammaValue.create (*this, x + 80, y, 50, Style::SliderHeight);
|
|
||||||
gammaSlider.create (*this, x + 130, y, 300, Style::SliderHeight, 201); y += Style::SliderHeight + 5;
|
|
||||||
|
|
||||||
gammaRampCheck.create (*this, x, y, 430, Style::CheckBoxHeight, "Enable NTSC gamma ramp simulation"); y += Style::CheckBoxHeight + 5;
|
|
||||||
|
|
||||||
fullscreenLabel.create(*this, x, y, 340, Style::LabelHeight, "Fullscreen :."); y += Style::LabelHeight + 5;
|
|
||||||
fullscreenLabel.setFont(application.proportionalFontBold);
|
fullscreenLabel.setFont(application.proportionalFontBold);
|
||||||
|
fullscreenCenter.setText("Center");
|
||||||
fullscreenCenter.create (*this, x, y, 135, Style::CheckBoxHeight, "Center");
|
fullscreenScale.setText("Scale");
|
||||||
fullscreenScale.create (fullscreenCenter, x + 140, y, 135, Style::CheckBoxHeight, "Scale");
|
fullscreenStretch.setText("Stretch");
|
||||||
fullscreenStretch.create(fullscreenCenter, x + 280, y, 135, Style::CheckBoxHeight, "Stretch"); y += Style::CheckBoxHeight + 5;
|
fullscreenScale.setParent(fullscreenCenter);
|
||||||
|
fullscreenStretch.setParent(fullscreenCenter);
|
||||||
filterLabel.create(*this, x, y, 340, Style::LabelHeight, "Video Filter :."); y += Style::LabelHeight + 5;
|
filterLabel.setText("Video Filter :.");
|
||||||
filterLabel.setFont(application.proportionalFontBold);
|
filterLabel.setFont(application.proportionalFontBold);
|
||||||
|
|
||||||
filterPath.create(*this, x, y, 430 - height - height - 10, height);
|
|
||||||
filterPath.setEditable(false);
|
filterPath.setEditable(false);
|
||||||
filterPath.setText(config.video.filter);
|
filterPath.setText(config.video.filter);
|
||||||
filterClear.create(*this, x + 430 - height - height - 5, y, height, height, "");
|
filterSelect.setText("...");
|
||||||
filterSelect.create(*this, x + 430 - height, y, height, height, "..."); y += height + 5;
|
shaderLabel.setText("Pixel Shader :.");
|
||||||
|
|
||||||
shaderLabel.create(*this, x, y, 340, Style::LabelHeight, "Pixel Shader :."); y += Style::LabelHeight + 5;
|
|
||||||
shaderLabel.setFont(application.proportionalFontBold);
|
shaderLabel.setFont(application.proportionalFontBold);
|
||||||
|
|
||||||
shaderPath.create(*this, x, y, 430 - height - height - 10, height);
|
|
||||||
shaderPath.setEditable(false);
|
shaderPath.setEditable(false);
|
||||||
shaderPath.setText(config.video.shader);
|
shaderPath.setText(config.video.shader);
|
||||||
shaderClear.create(*this, x + 430 - height - height - 5, y, height, height, "");
|
shaderSelect.setText("...");
|
||||||
shaderSelect.create(*this, x + 430 - height, y, height, height, "..."); y += height + 5;
|
|
||||||
|
|
||||||
|
layout.append(colorAdjustmentLabel, x, y, 430, Style::LabelHeight); y += Style::LabelHeight + 5;
|
||||||
|
layout.append(brightnessLabel, x, y, 80, Style::SliderHeight);
|
||||||
|
layout.append(brightnessValue, x + 80, y, 40, Style::SliderHeight);
|
||||||
|
layout.append(brightnessSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight;
|
||||||
|
layout.append(contrastLabel, x, y, 80, Style::SliderHeight);
|
||||||
|
layout.append(contrastValue, x + 80, y, 50, Style::SliderHeight);
|
||||||
|
layout.append(contrastSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight;
|
||||||
|
layout.append(gammaLabel, x, y, 80, Style::SliderHeight);
|
||||||
|
layout.append(gammaValue, x + 80, y, 50, Style::SliderHeight);
|
||||||
|
layout.append(gammaSlider, x + 130, y, 300, Style::SliderHeight); y += Style::SliderHeight + 5;
|
||||||
|
layout.append(gammaRampCheck, x, y, 430, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
||||||
|
layout.append(fullscreenLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
|
||||||
|
layout.append(fullscreenCenter, x, y, 135, Style::CheckBoxHeight);
|
||||||
|
layout.append(fullscreenScale, x + 140, y, 135, Style::CheckBoxHeight);
|
||||||
|
layout.append(fullscreenStretch, x + 280, y, 135, Style::CheckBoxHeight); y += Style::CheckBoxHeight + 5;
|
||||||
|
layout.append(filterLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
|
||||||
|
layout.append(filterPath, x, y, 430 - height - height - 10, height);
|
||||||
|
layout.append(filterClear, x + 430 - height - height - 5, y, height, height);
|
||||||
|
layout.append(filterSelect, x + 430 - height, y, height, height); y += height + 5;
|
||||||
|
layout.append(shaderLabel, x, y, 340, Style::LabelHeight); y += Style::LabelHeight + 5;
|
||||||
|
layout.append(shaderPath, x, y, 430 - height - height - 10, height);
|
||||||
|
layout.append(shaderClear, x + 430 - height - height - 5, y, height, height);
|
||||||
|
layout.append(shaderSelect, x + 430 - height, y, height, height); y += height + 5;
|
||||||
setGeometry(0, 0, 440, y);
|
setGeometry(0, 0, 440, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
brightnessSlider.setPosition(config.video.brightness);
|
brightnessSlider.setPosition(config.video.brightness);
|
||||||
brightnessValue.setText({ config.video.brightness, "%" });
|
brightnessValue.setText({ config.video.brightness, "%" });
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct VideoSettings : TopLevelWindow {
|
struct VideoSettings : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
Label colorAdjustmentLabel;
|
Label colorAdjustmentLabel;
|
||||||
Label brightnessLabel;
|
Label brightnessLabel;
|
||||||
Label brightnessValue;
|
Label brightnessValue;
|
||||||
|
@@ -82,23 +82,27 @@ void CheatEditor::create() {
|
|||||||
Window::create(0, 0, 256, 256, "Cheat Editor");
|
Window::create(0, 0, 256, 256, "Cheat Editor");
|
||||||
application.addWindow(this, "CheatEditor", "160,160");
|
application.addWindow(this, "CheatEditor", "160,160");
|
||||||
|
|
||||||
unsigned x = 5, y = 5, height = Style::ButtonHeight;
|
cheatList.setHeaderText("Slot\tCode\tDescription");
|
||||||
|
|
||||||
cheatList.create(*this, x, y, 500, 250, "Slot\tCode\tDescription"); y += 255;
|
|
||||||
cheatList.setHeaderVisible();
|
cheatList.setHeaderVisible();
|
||||||
cheatList.setCheckable();
|
cheatList.setCheckable();
|
||||||
|
codeLabel.setText("Code(s):");
|
||||||
|
descLabel.setText("Description:");
|
||||||
|
findButton.setText("Find Codes ...");
|
||||||
|
clearAllButton.setText("Clear All");
|
||||||
|
clearButton.setText("Clear");
|
||||||
|
|
||||||
codeLabel.create(*this, x, y, 80, Style::TextBoxHeight, "Code(s):");
|
unsigned x = 5, y = 5, height = Style::ButtonHeight;
|
||||||
codeEdit.create (*this, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
|
layout.append(cheatList, x, y, 500, 250); y += 255;
|
||||||
|
layout.append(codeLabel, x, y, 80, Style::TextBoxHeight);
|
||||||
descLabel.create(*this, x, y, 80, Style::TextBoxHeight, "Description:");
|
layout.append(codeEdit, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
|
||||||
descEdit.create (*this, x + 80, y, 420, Style::TextBoxHeight); y+= Style::TextBoxHeight + 5;
|
layout.append(descLabel, x, y, 80, Style::TextBoxHeight);
|
||||||
|
layout.append(descEdit, x + 80, y, 420, Style::TextBoxHeight); y+= Style::TextBoxHeight + 5;
|
||||||
findButton.create(*this, x, y, 100, height, "Find Codes ...");
|
layout.append(findButton, x, y, 100, height);
|
||||||
clearAllButton.create(*this, x + 505 - 85 - 85, y, 80, height, "Clear All");
|
layout.append(clearAllButton, x + 505 - 85 - 85, y, 80, height);
|
||||||
clearButton.create(*this, x + 505 - 85, y, 80, height, "Clear"); y += height + 5;
|
layout.append(clearButton, x + 505 - 85, y, 80, height); y += height + 5;
|
||||||
|
|
||||||
setGeometry(0, 0, 510, y);
|
setGeometry(0, 0, 510, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
synchronize();
|
synchronize();
|
||||||
|
|
||||||
cheatList.onChange = { &CheatEditor::synchronize, this };
|
cheatList.onChange = { &CheatEditor::synchronize, this };
|
||||||
@@ -117,16 +121,18 @@ void CheatEditor::create() {
|
|||||||
databaseWindow.create(0, 0, 256, 256);
|
databaseWindow.create(0, 0, 256, 256);
|
||||||
application.addWindow(&databaseWindow, "CheatDatabase", "192,192");
|
application.addWindow(&databaseWindow, "CheatDatabase", "192,192");
|
||||||
|
|
||||||
x = 5, y = 5;
|
|
||||||
|
|
||||||
databaseList.create(databaseWindow, x, y, 600, 360); y += 365;
|
|
||||||
databaseList.setCheckable(true);
|
databaseList.setCheckable(true);
|
||||||
|
databaseSelectAll.setText("Select All");
|
||||||
|
databaseUnselectAll.setText("Unselect All");
|
||||||
|
databaseOk.setText("Ok");
|
||||||
|
|
||||||
databaseSelectAll.create(databaseWindow, x, y, 100, height, "Select All");
|
x = 5, y = 5;
|
||||||
databaseUnselectAll.create(databaseWindow, x + 105, y, 100, height, "Unselect All");
|
databaseLayout.append(databaseList, x, y, 600, 360); y += 365;
|
||||||
databaseOk.create(databaseWindow, 605 - 80, y, 80, height, "Ok"); y += height + 5;
|
databaseLayout.append(databaseSelectAll, x, y, 100, height);
|
||||||
|
databaseLayout.append(databaseUnselectAll, x + 105, y, 100, height);
|
||||||
|
databaseLayout.append(databaseOk, 605 - 80, y, 80, height); y += height + 5;
|
||||||
databaseWindow.setGeometry(0, 0, 610, y);
|
databaseWindow.setGeometry(0, 0, 610, y);
|
||||||
|
databaseWindow.setLayout(databaseLayout);
|
||||||
|
|
||||||
databaseSelectAll.onTick = []() {
|
databaseSelectAll.onTick = []() {
|
||||||
for(unsigned i = 0; i < cheatEditor.databaseCode.size(); i++) {
|
for(unsigned i = 0; i < cheatEditor.databaseCode.size(); i++) {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct CheatEditor : TopLevelWindow {
|
struct CheatEditor : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
ListBox cheatList;
|
ListBox cheatList;
|
||||||
Label codeLabel;
|
Label codeLabel;
|
||||||
TextBox codeEdit;
|
TextBox codeEdit;
|
||||||
@@ -9,6 +10,7 @@ struct CheatEditor : TopLevelWindow {
|
|||||||
Button clearButton;
|
Button clearButton;
|
||||||
|
|
||||||
TopLevelWindow databaseWindow;
|
TopLevelWindow databaseWindow;
|
||||||
|
FixedLayout databaseLayout;
|
||||||
ListBox databaseList;
|
ListBox databaseList;
|
||||||
lstring databaseCode;
|
lstring databaseCode;
|
||||||
Button databaseSelectAll;
|
Button databaseSelectAll;
|
||||||
|
@@ -4,19 +4,23 @@ void StateManager::create() {
|
|||||||
Window::create(0, 0, 256, 256, "State Manager");
|
Window::create(0, 0, 256, 256, "State Manager");
|
||||||
application.addWindow(this, "StateManager", "160,160");
|
application.addWindow(this, "StateManager", "160,160");
|
||||||
|
|
||||||
unsigned x = 5, y = 5;
|
stateList.setHeaderText("Slot\tDescription");
|
||||||
|
|
||||||
stateList.create(*this, x, y, 500, 250, "Slot\tDescription"); y += 255;
|
|
||||||
stateList.setHeaderVisible();
|
stateList.setHeaderVisible();
|
||||||
|
descLabel.setText("Description:");
|
||||||
|
loadButton.setText("Load");
|
||||||
|
saveButton.setText("Save");
|
||||||
|
eraseButton.setText("Erase");
|
||||||
|
|
||||||
descLabel.create(*this, x, y, 80, Style::TextBoxHeight, "Description:");
|
unsigned x = 5, y = 5;
|
||||||
descEdit.create(*this, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
|
layout.append(stateList, x, y, 500, 250); y += 255;
|
||||||
|
layout.append(descLabel, x, y, 80, Style::TextBoxHeight);
|
||||||
loadButton.create(*this, x + 505 - 85 - 85 - 85, y, 80, Style::ButtonHeight, "Load");
|
layout.append(descEdit, x + 80, y, 420, Style::TextBoxHeight); y += Style::TextBoxHeight + 5;
|
||||||
saveButton.create(*this, x + 505 - 85 - 85, y, 80, Style::ButtonHeight, "Save");
|
layout.append(loadButton, x + 505 - 85 - 85 - 85, y, 80, Style::ButtonHeight);
|
||||||
eraseButton.create(*this, x + 505 - 85, y, 80, Style::ButtonHeight, "Erase"); y += Style::ButtonHeight + 5;
|
layout.append(saveButton, x + 505 - 85 - 85, y, 80, Style::ButtonHeight);
|
||||||
|
layout.append(eraseButton, x + 505 - 85, y, 80, Style::ButtonHeight); y += Style::ButtonHeight + 5;
|
||||||
setGeometry(0, 0, 510, y);
|
setGeometry(0, 0, 510, y);
|
||||||
|
setLayout(layout);
|
||||||
|
|
||||||
synchronize();
|
synchronize();
|
||||||
|
|
||||||
stateList.onActivate = { &StateManager::slotLoad, this };
|
stateList.onActivate = { &StateManager::slotLoad, this };
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
struct StateManager : TopLevelWindow {
|
struct StateManager : TopLevelWindow {
|
||||||
|
FixedLayout layout;
|
||||||
ListBox stateList;
|
ListBox stateList;
|
||||||
Label descLabel;
|
Label descLabel;
|
||||||
TextBox descEdit;
|
TextBox descEdit;
|
||||||
|
Reference in New Issue
Block a user