mirror of https://github.com/bsnes-emu/bsnes.git
Update to v077r02 release.
byuu says: Wouldn't recommend using this, but it has bsnes ported to the new auto-size calculating phoenix API. Known issues: - minimumWidth/Height on layouts isn't working right, windows that use it are usually too small - Windows gives 0,0 size for empty text string sizes, which messes up a lot of default sizes for LineEdit controls
This commit is contained in:
parent
a92a554d7b
commit
396003e7f6
|
@ -1,11 +1,11 @@
|
|||
include nall/Makefile
|
||||
snes := snes
|
||||
gameboy := gameboy
|
||||
profile := accuracy
|
||||
profile := compatibility
|
||||
ui := ui
|
||||
|
||||
# debugger
|
||||
options := debugger
|
||||
options :=
|
||||
|
||||
# compiler
|
||||
c := $(compiler) -std=gnu99
|
||||
|
|
|
@ -26,6 +26,7 @@ void OS::processEvents() { return pOS::processEvents(); }
|
|||
void OS::quit() { return pOS::quit(); }
|
||||
void OS::initialize() { static bool initialized = false; if(initialized == false) { initialized = true; return pOS::initialize(); } }
|
||||
|
||||
Geometry Font::geometry(const string &text) { return p.geometry(text); }
|
||||
void Font::setBold(bool bold) { state.bold = bold; return p.setBold(bold); }
|
||||
void Font::setFamily(const string &family) { state.family = family; return p.setFamily(family); }
|
||||
void Font::setItalic(bool italic) { state.italic = italic; return p.setItalic(italic); }
|
||||
|
@ -87,6 +88,8 @@ void RadioItem::setText(const string &text) { state.text = text; return p.setTex
|
|||
RadioItem::RadioItem() : state(*new State), base_from_member<pRadioItem&>(*new pRadioItem(*this)), Action(base_from_member<pRadioItem&>::value), p(base_from_member<pRadioItem&>::value) { p.constructor(); }
|
||||
|
||||
bool Widget::enabled() { return state.enabled; }
|
||||
Font& Widget::font() { return p.font(); }
|
||||
Geometry Widget::minimumGeometry() { return p.minimumGeometry(); }
|
||||
void Widget::setEnabled(bool enabled) { state.enabled = enabled; return p.setEnabled(enabled); }
|
||||
void Widget::setFocused() { return p.setFocused(); }
|
||||
void Widget::setFont(Font &font) { state.font = &font; return p.setFont(font); }
|
||||
|
|
|
@ -29,6 +29,11 @@ struct pTextEdit;
|
|||
struct pVerticalSlider;
|
||||
struct pViewport;
|
||||
|
||||
enum : unsigned {
|
||||
MaximumSize = ~0u,
|
||||
MinimumSize = 0u,
|
||||
};
|
||||
|
||||
struct Geometry {
|
||||
signed x, y;
|
||||
unsigned width, height;
|
||||
|
@ -63,6 +68,7 @@ private:
|
|||
};
|
||||
|
||||
struct Font : Object {
|
||||
Geometry geometry(const nall::string &text);
|
||||
void setBold(bool bold = true);
|
||||
void setFamily(const nall::string &family);
|
||||
void setItalic(bool italic = true);
|
||||
|
@ -195,13 +201,15 @@ struct RadioItem : private nall::base_from_member<pRadioItem&>, Action {
|
|||
};
|
||||
|
||||
struct Layout : Object {
|
||||
virtual void setGeometry(Geometry &geometry) = 0;
|
||||
virtual void setGeometry(const Geometry &geometry) = 0;
|
||||
virtual void setParent(Window &parent) = 0;
|
||||
virtual void setVisible(bool visible = true) = 0;
|
||||
};
|
||||
|
||||
struct Widget : Object {
|
||||
bool enabled();
|
||||
Font& font();
|
||||
Geometry minimumGeometry();
|
||||
void setEnabled(bool enabled = true);
|
||||
void setFocused();
|
||||
void setFont(Font &font);
|
||||
|
|
|
@ -9,7 +9,7 @@ void FixedLayout::append(Widget &widget, const Geometry &geometry) {
|
|||
children.append({ &widget, geometry });
|
||||
}
|
||||
|
||||
void FixedLayout::setGeometry(Geometry &geometry) {
|
||||
void FixedLayout::setGeometry(const Geometry &geometry) {
|
||||
}
|
||||
|
||||
void FixedLayout::setVisible(bool visible) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
struct FixedLayout : Layout {
|
||||
void append(Widget &widget, const Geometry &geometry);
|
||||
void setGeometry(Geometry &geometry);
|
||||
void setGeometry(const Geometry &geometry);
|
||||
void setParent(Window &parent);
|
||||
void setVisible(bool visible);
|
||||
FixedLayout();
|
||||
|
|
|
@ -1,77 +1,98 @@
|
|||
void HorizontalLayout::setParent(Window &parent) {
|
||||
foreach(child, children) {
|
||||
if(child.layout) child.layout->setParent(parent);
|
||||
if(child.widget) parent.append(*child.widget);
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalLayout::append(VerticalLayout &layout, unsigned width, unsigned height, unsigned spacing) {
|
||||
layout.width = width;
|
||||
layout.height = height;
|
||||
children.append({ &layout, 0, width, height, spacing });
|
||||
void HorizontalLayout::append(VerticalLayout &layout, unsigned spacing) {
|
||||
children.append({ &layout, 0, 0, 0, spacing });
|
||||
}
|
||||
|
||||
void HorizontalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
|
||||
children.append({ 0, &widget, width, height, spacing });
|
||||
}
|
||||
|
||||
void HorizontalLayout::setGeometry(Geometry &geometry) {
|
||||
geometry.x += margin;
|
||||
geometry.y += margin;
|
||||
geometry.width -= margin * 2;
|
||||
Geometry HorizontalLayout::minimumGeometry() {
|
||||
bool maximumWidth = false;
|
||||
bool maximumHeight = false;
|
||||
|
||||
unsigned width = margin * 2;
|
||||
unsigned height = margin * 2;
|
||||
|
||||
foreach(child, children) {
|
||||
if(child.width == MaximumSize) maximumWidth = true;
|
||||
if(child.height == MaximumSize) maximumHeight = true;
|
||||
|
||||
if(child.width != MaximumSize) width += child.width;
|
||||
if(child.height != MaximumSize) height = max(height, child.height);
|
||||
}
|
||||
|
||||
return { 0, 0, maximumWidth ? MaximumSize : width, maximumHeight ? MaximumSize : height };
|
||||
}
|
||||
|
||||
void HorizontalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||
setMinimumGeometry();
|
||||
setLayoutGeometry();
|
||||
|
||||
Geometry geometry = containerGeometry;
|
||||
geometry.x += margin;
|
||||
geometry.y += margin;
|
||||
geometry.width -= margin * 2;
|
||||
geometry.height -= margin * 2;
|
||||
|
||||
unsigned geometryWidth = width ? width : geometry.width;
|
||||
unsigned geometryHeight = height ? height : geometry.height;
|
||||
Geometry layoutGeometry = geometry;
|
||||
auto children = this->children;
|
||||
|
||||
Geometry baseGeometry = geometry;
|
||||
linear_vector<HorizontalLayout::Children> children = this->children;
|
||||
|
||||
unsigned minimumWidth = 0;
|
||||
foreach(child, children) minimumWidth += child.width + child.spacing;
|
||||
|
||||
unsigned autosizeWidgets = 0;
|
||||
unsigned minimumWidth = 0, maximumWidthCounter = 0;
|
||||
foreach(child, children) {
|
||||
if(child.width == 0) autosizeWidgets++;
|
||||
}
|
||||
foreach(child, children) {
|
||||
if(child.width == 0) child.width = (geometryWidth - minimumWidth) / autosizeWidgets;
|
||||
if(child.height == 0) child.height = geometryHeight;
|
||||
if(child.width == MaximumSize) maximumWidthCounter++;
|
||||
if(child.width != MaximumSize) minimumWidth += child.width;
|
||||
minimumWidth += child.spacing;
|
||||
}
|
||||
|
||||
unsigned maxHeight = 0;
|
||||
foreach(child, children) {
|
||||
maxHeight = max(maxHeight, child.height);
|
||||
if(child.width == MaximumSize) child.width = (geometry.width - minimumWidth) / maximumWidthCounter;
|
||||
if(child.height == MaximumSize) child.height = geometry.height;
|
||||
}
|
||||
|
||||
unsigned maximumHeight = 0;
|
||||
foreach(child, children) maximumHeight = max(maximumHeight, child.height);
|
||||
|
||||
foreach(child, children) {
|
||||
unsigned pivot = (maximumHeight - child.height) / 2;
|
||||
Geometry childGeometry = { geometry.x, geometry.y + pivot, child.width, child.height };
|
||||
|
||||
if(child.layout) child.layout->setGeometry(childGeometry);
|
||||
if(child.widget) child.widget->setGeometry(childGeometry);
|
||||
|
||||
geometry.x += child.width + child.spacing;
|
||||
geometry.width -= child.width + child.spacing;
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalLayout::setLayoutGeometry() {
|
||||
foreach(child, children) {
|
||||
if(child.layout) {
|
||||
child.layout->setGeometry(geometry);
|
||||
geometry.x += child.spacing;
|
||||
geometry.width -= child.spacing;
|
||||
geometry.y = baseGeometry.y;
|
||||
geometry.height = baseGeometry.height;
|
||||
}
|
||||
|
||||
if(child.widget) {
|
||||
child.widget->setGeometry({ geometry.x, geometry.y, child.width, child.height });
|
||||
geometry.x += child.width + child.spacing;
|
||||
geometry.width -= child.width + child.spacing;
|
||||
child.width = child.layout->minimumGeometry().width;
|
||||
child.height = child.layout->minimumGeometry().height;
|
||||
}
|
||||
}
|
||||
|
||||
geometry.y += maxHeight;
|
||||
geometry.height -= maxHeight;
|
||||
}
|
||||
|
||||
void HorizontalLayout::setMargin(unsigned margin_) {
|
||||
margin = margin_;
|
||||
void HorizontalLayout::setMargin(unsigned margin) {
|
||||
this->margin = margin;
|
||||
}
|
||||
|
||||
unsigned HorizontalLayout::minimumWidth() {
|
||||
unsigned width = margin * 2;
|
||||
foreach(child, children) width += child.width + child.spacing;
|
||||
return width;
|
||||
void HorizontalLayout::setMinimumGeometry() {
|
||||
foreach(child, children) {
|
||||
if(child.layout) child.layout->setMinimumGeometry();
|
||||
if(child.widget) {
|
||||
Geometry minimumGeometry = child.widget->minimumGeometry();
|
||||
if(child.width == MinimumSize) child.width = minimumGeometry.width;
|
||||
if(child.height == MinimumSize) child.height = minimumGeometry.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalLayout::setParent(Window &parent) {
|
||||
foreach(child, children) {
|
||||
if(child.layout) child.layout->setParent(parent);
|
||||
if(child.widget) parent.append(*child.widget);
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalLayout::setVisible(bool visible) {
|
||||
|
@ -83,6 +104,4 @@ void HorizontalLayout::setVisible(bool visible) {
|
|||
|
||||
HorizontalLayout::HorizontalLayout() {
|
||||
margin = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
struct VerticalLayout;
|
||||
|
||||
struct HorizontalLayout : public Layout {
|
||||
void append(VerticalLayout &layout, unsigned width, unsigned height, unsigned spacing = 0);
|
||||
void append(VerticalLayout &layout, unsigned spacing = 0);
|
||||
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
|
||||
unsigned minimumWidth();
|
||||
void setGeometry(Geometry &geometry);
|
||||
Geometry minimumGeometry();
|
||||
void setGeometry(const Geometry &geometry);
|
||||
void setLayoutGeometry();
|
||||
void setMargin(unsigned margin);
|
||||
void setMinimumGeometry();
|
||||
void setParent(Window &parent);
|
||||
void setVisible(bool visible);
|
||||
HorizontalLayout();
|
||||
|
||||
//private:
|
||||
unsigned margin;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
struct Children {
|
||||
VerticalLayout *layout;
|
||||
Widget *widget;
|
||||
|
|
|
@ -1,77 +1,98 @@
|
|||
void VerticalLayout::setParent(Window &parent) {
|
||||
foreach(child, children) {
|
||||
if(child.layout) child.layout->setParent(parent);
|
||||
if(child.widget) parent.append(*child.widget);
|
||||
}
|
||||
}
|
||||
|
||||
void VerticalLayout::append(HorizontalLayout &layout, unsigned width, unsigned height, unsigned spacing) {
|
||||
layout.width = width;
|
||||
layout.height = height;
|
||||
children.append({ &layout, 0, width, height, spacing });
|
||||
void VerticalLayout::append(HorizontalLayout &layout, unsigned spacing) {
|
||||
children.append({ &layout, 0, 0, 0, spacing });
|
||||
}
|
||||
|
||||
void VerticalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
|
||||
children.append({ 0, &widget, width, height, spacing });
|
||||
}
|
||||
|
||||
void VerticalLayout::setGeometry(Geometry &geometry) {
|
||||
geometry.x += margin;
|
||||
geometry.y += margin;
|
||||
geometry.width -= margin * 2;
|
||||
Geometry VerticalLayout::minimumGeometry() {
|
||||
bool maximumWidth = false;
|
||||
bool maximumHeight = false;
|
||||
|
||||
unsigned width = margin * 2;
|
||||
unsigned height = margin * 2;
|
||||
|
||||
foreach(child, children) {
|
||||
if(child.width == MaximumSize) maximumWidth = true;
|
||||
if(child.height == MaximumSize) maximumHeight = true;
|
||||
|
||||
if(child.width != MaximumSize) width = max(width, child.width);
|
||||
if(child.height != MaximumSize) height += child.height;
|
||||
}
|
||||
|
||||
return { 0, 0, maximumWidth ? MaximumSize : width, maximumHeight ? MaximumSize : height };
|
||||
}
|
||||
|
||||
void VerticalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||
setMinimumGeometry();
|
||||
setLayoutGeometry();
|
||||
|
||||
Geometry geometry = containerGeometry;
|
||||
geometry.x += margin;
|
||||
geometry.y += margin;
|
||||
geometry.width -= margin * 2;
|
||||
geometry.height -= margin * 2;
|
||||
|
||||
unsigned geometryWidth = width ? width : geometry.width;
|
||||
unsigned geometryHeight = height ? height : geometry.height;
|
||||
Geometry layoutGeometry = geometry;
|
||||
auto children = this->children;
|
||||
|
||||
Geometry baseGeometry = geometry;
|
||||
linear_vector<VerticalLayout::Children> children = this->children;
|
||||
|
||||
unsigned minimumHeight = 0;
|
||||
foreach(child, children) minimumHeight += child.height + child.spacing;
|
||||
|
||||
unsigned autosizeWidgets = 0;
|
||||
unsigned minimumHeight = 0, maximumHeightCounter = 0;
|
||||
foreach(child, children) {
|
||||
if(child.height == 0) autosizeWidgets++;
|
||||
}
|
||||
foreach(child, children) {
|
||||
if(child.width == 0) child.width = geometryWidth;
|
||||
if(child.height == 0) child.height = (geometryHeight - minimumHeight) / autosizeWidgets;
|
||||
if(child.height == MaximumSize) maximumHeightCounter++;
|
||||
if(child.height != MaximumSize) minimumHeight += child.height;
|
||||
minimumHeight += child.spacing;
|
||||
}
|
||||
|
||||
unsigned maxWidth = 0;
|
||||
foreach(child, children) {
|
||||
maxWidth = max(maxWidth, child.width);
|
||||
if(child.width == MaximumSize) child.width = geometry.width;
|
||||
if(child.height == MaximumSize) child.height = (geometry.height - minimumHeight) / maximumHeightCounter;
|
||||
}
|
||||
|
||||
unsigned maximumWidth = 0;
|
||||
foreach(child, children) maximumWidth = max(maximumWidth, child.width);
|
||||
|
||||
foreach(child, children) {
|
||||
unsigned pivot = 0; //(maximumWidth - child.width) / 2;
|
||||
Geometry childGeometry = { geometry.x + pivot, geometry.y, child.width, child.height };
|
||||
|
||||
if(child.layout) child.layout->setGeometry(childGeometry);
|
||||
if(child.widget) child.widget->setGeometry(childGeometry);
|
||||
|
||||
geometry.y += child.height + child.spacing;
|
||||
geometry.height -= child.height + child.spacing;
|
||||
}
|
||||
}
|
||||
|
||||
void VerticalLayout::setLayoutGeometry() {
|
||||
foreach(child, children) {
|
||||
if(child.layout) {
|
||||
child.layout->setGeometry(geometry);
|
||||
geometry.x = baseGeometry.x;
|
||||
geometry.width = baseGeometry.width;
|
||||
geometry.y += child.spacing;
|
||||
geometry.height -= child.spacing;
|
||||
}
|
||||
|
||||
if(child.widget) {
|
||||
child.widget->setGeometry({ geometry.x, geometry.y, child.width, child.height });
|
||||
geometry.y += child.height + child.spacing;
|
||||
geometry.height -= child.height + child.spacing;
|
||||
child.width = child.layout->minimumGeometry().width;
|
||||
child.height = child.layout->minimumGeometry().height;
|
||||
}
|
||||
}
|
||||
|
||||
geometry.x += maxWidth;
|
||||
geometry.width -= maxWidth;
|
||||
}
|
||||
|
||||
void VerticalLayout::setMargin(unsigned margin_) {
|
||||
margin = margin_;
|
||||
void VerticalLayout::setMargin(unsigned margin) {
|
||||
this->margin = margin;
|
||||
}
|
||||
|
||||
unsigned VerticalLayout::minimumHeight() {
|
||||
unsigned height = margin * 2;
|
||||
foreach(child, children) height += child.height + child.spacing;
|
||||
return height;
|
||||
void VerticalLayout::setMinimumGeometry() {
|
||||
foreach(child, children) {
|
||||
if(child.layout) child.layout->setMinimumGeometry();
|
||||
if(child.widget) {
|
||||
Geometry minimumGeometry = child.widget->minimumGeometry();
|
||||
if(child.width == MinimumSize) child.width = minimumGeometry.width;
|
||||
if(child.height == MinimumSize) child.height = minimumGeometry.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VerticalLayout::setParent(Window &parent) {
|
||||
foreach(child, children) {
|
||||
if(child.layout) child.layout->setParent(parent);
|
||||
if(child.widget) parent.append(*child.widget);
|
||||
}
|
||||
}
|
||||
|
||||
void VerticalLayout::setVisible(bool visible) {
|
||||
|
@ -83,6 +104,4 @@ void VerticalLayout::setVisible(bool visible) {
|
|||
|
||||
VerticalLayout::VerticalLayout() {
|
||||
margin = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
struct HorizontalLayout;
|
||||
|
||||
struct VerticalLayout : public Layout {
|
||||
void append(HorizontalLayout &layout, unsigned width, unsigned height, unsigned spacing = 0);
|
||||
void append(HorizontalLayout &layout, unsigned spacing = 0);
|
||||
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
|
||||
unsigned minimumHeight();
|
||||
void setGeometry(Geometry &geometry);
|
||||
Geometry minimumGeometry();
|
||||
void setGeometry(const Geometry &geometry);
|
||||
void setLayoutGeometry();
|
||||
void setMargin(unsigned margin);
|
||||
void setMinimumGeometry();
|
||||
void setParent(Window &parent);
|
||||
void setVisible(bool visible);
|
||||
VerticalLayout();
|
||||
|
||||
//private:
|
||||
unsigned margin;
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
struct Children {
|
||||
HorizontalLayout *layout;
|
||||
Widget *widget;
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
Geometry pFont::geometry(const string &text) {
|
||||
pango_layout_set_font_description(gtkLayout, gtkFont);
|
||||
pango_layout_set_text(gtkLayout, text, -1);
|
||||
int width = 0, height = 0;
|
||||
pango_layout_get_pixel_size(gtkLayout, &width, &height);
|
||||
return { 0, 0, width, height };
|
||||
}
|
||||
|
||||
void pFont::setBold(bool bold) {
|
||||
pango_font_description_set_weight(gtkFont, bold ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
|
||||
}
|
||||
|
@ -19,4 +27,6 @@ void pFont::setUnderline(bool underline) {
|
|||
|
||||
void pFont::constructor() {
|
||||
gtkFont = pango_font_description_new();
|
||||
PangoContext *context = gdk_pango_context_get_for_screen(gdk_screen_get_default());
|
||||
gtkLayout = pango_layout_new(context);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "widget/vertical-slider.cpp"
|
||||
#include "widget/viewport.cpp"
|
||||
|
||||
Font pOS::defaultFont;
|
||||
|
||||
Geometry pOS::availableGeometry() {
|
||||
//TODO: is there a GTK+ function for this?
|
||||
//should return desktopGeometry() sans panels, toolbars, docks, etc.
|
||||
|
|
|
@ -26,6 +26,8 @@ struct pObject {
|
|||
};
|
||||
|
||||
struct pOS : public pObject {
|
||||
static Font defaultFont;
|
||||
|
||||
static Geometry availableGeometry();
|
||||
static Geometry desktopGeometry();
|
||||
static string fileLoad(Window &parent, const string &path, const lstring &filter);
|
||||
|
@ -42,7 +44,9 @@ struct pOS : public pObject {
|
|||
struct pFont : public pObject {
|
||||
Font &font;
|
||||
PangoFontDescription *gtkFont;
|
||||
PangoLayout *gtkLayout;
|
||||
|
||||
Geometry geometry(const string &text);
|
||||
void setBold(bool bold);
|
||||
void setFamily(const string &family);
|
||||
void setItalic(bool italic);
|
||||
|
@ -164,6 +168,8 @@ struct pWidget : public pObject {
|
|||
pWindow *parentWindow;
|
||||
|
||||
bool enabled();
|
||||
Font& font();
|
||||
virtual Geometry minimumGeometry();
|
||||
void setEnabled(bool enabled);
|
||||
virtual void setFocused();
|
||||
virtual void setFont(Font &font);
|
||||
|
@ -177,6 +183,7 @@ struct pWidget : public pObject {
|
|||
struct pButton : public pWidget {
|
||||
Button &button;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setText(const string &text);
|
||||
|
||||
pButton(Button &button) : pWidget(button), button(button) {}
|
||||
|
@ -187,6 +194,7 @@ struct pCheckBox : public pWidget {
|
|||
CheckBox &checkBox;
|
||||
|
||||
bool checked();
|
||||
Geometry minimumGeometry();
|
||||
void setChecked(bool checked);
|
||||
void setText(const string &text);
|
||||
|
||||
|
@ -199,6 +207,7 @@ struct pComboBox : public pWidget {
|
|||
unsigned itemCounter;
|
||||
|
||||
void append(const string &text);
|
||||
Geometry minimumGeometry();
|
||||
void reset();
|
||||
unsigned selection();
|
||||
void setSelection(unsigned row);
|
||||
|
@ -234,6 +243,7 @@ struct pHexEdit : public pWidget {
|
|||
struct pHorizontalSlider : public pWidget {
|
||||
HorizontalSlider &horizontalSlider;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
unsigned position();
|
||||
void setLength(unsigned length);
|
||||
void setPosition(unsigned position);
|
||||
|
@ -245,6 +255,7 @@ struct pHorizontalSlider : public pWidget {
|
|||
struct pLabel : public pWidget {
|
||||
Label &label;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setText(const string &text);
|
||||
|
||||
pLabel(Label &label) : pWidget(label), label(label) {}
|
||||
|
@ -254,6 +265,7 @@ struct pLabel : public pWidget {
|
|||
struct pLineEdit : public pWidget {
|
||||
LineEdit &lineEdit;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setEditable(bool editable);
|
||||
void setText(const string &text);
|
||||
string text();
|
||||
|
@ -297,6 +309,7 @@ struct pListView : public pWidget {
|
|||
struct pProgressBar : public pWidget {
|
||||
ProgressBar &progressBar;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setPosition(unsigned position);
|
||||
|
||||
pProgressBar(ProgressBar &progressBar) : pWidget(progressBar), progressBar(progressBar) {}
|
||||
|
@ -307,6 +320,7 @@ struct pRadioBox : public pWidget {
|
|||
RadioBox &radioBox;
|
||||
|
||||
bool checked();
|
||||
Geometry minimumGeometry();
|
||||
void setChecked();
|
||||
void setGroup(const reference_array<RadioBox&> &group);
|
||||
void setText(const string &text);
|
||||
|
@ -333,6 +347,7 @@ struct pTextEdit : public pWidget {
|
|||
struct pVerticalSlider : public pWidget {
|
||||
VerticalSlider &verticalSlider;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
unsigned position();
|
||||
void setLength(unsigned length);
|
||||
void setPosition(unsigned position);
|
||||
|
|
|
@ -2,6 +2,12 @@ static void Button_tick(Button *self) {
|
|||
if(self->onTick) self->onTick();
|
||||
}
|
||||
|
||||
Geometry pButton::minimumGeometry() {
|
||||
Font &font = pWidget::font();
|
||||
Geometry geometry = font.geometry(button.state.text);
|
||||
return { 0, 0, geometry.width + 24, geometry.height + 14 };
|
||||
}
|
||||
|
||||
void pButton::setText(const string &text) {
|
||||
gtk_button_set_label(GTK_BUTTON(gtkWidget), text);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@ bool pCheckBox::checked() {
|
|||
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkWidget));
|
||||
}
|
||||
|
||||
Geometry pCheckBox::minimumGeometry() {
|
||||
Font &font = pWidget::font();
|
||||
Geometry geometry = font.geometry(checkBox.state.text);
|
||||
return { 0, 0, geometry.width + 28, geometry.height + 4 };
|
||||
}
|
||||
|
||||
void pCheckBox::setChecked(bool checked) {
|
||||
locked = true;
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkWidget), checked);
|
||||
|
|
|
@ -7,6 +7,15 @@ void pComboBox::append(const string &text) {
|
|||
if(itemCounter++ == 0) setSelection(0);
|
||||
}
|
||||
|
||||
Geometry pComboBox::minimumGeometry() {
|
||||
Font &font = pWidget::font();
|
||||
unsigned maximumWidth = 0;
|
||||
foreach(item, comboBox.state.text) maximumWidth = max(maximumWidth, font.geometry(item).width);
|
||||
|
||||
Geometry geometry = font.geometry(" ");
|
||||
return { 0, 0, maximumWidth + 44, geometry.height + 10 };
|
||||
}
|
||||
|
||||
void pComboBox::reset() {
|
||||
locked = true;
|
||||
for(signed n = itemCounter - 1; n >= 0; n--) {
|
||||
|
|
|
@ -4,6 +4,10 @@ static void HorizontalSlider_change(HorizontalSlider *self) {
|
|||
if(self->onChange) self->onChange();
|
||||
}
|
||||
|
||||
Geometry pHorizontalSlider::minimumGeometry() {
|
||||
return { 0, 0, 100, 20 };
|
||||
}
|
||||
|
||||
unsigned pHorizontalSlider::position() {
|
||||
return (unsigned)gtk_range_get_value(GTK_RANGE(gtkWidget));
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Geometry pLabel::minimumGeometry() {
|
||||
Font &font = pWidget::font();
|
||||
Geometry geometry = font.geometry(label.state.text);
|
||||
return { 0, 0, geometry.width, geometry.height };
|
||||
}
|
||||
|
||||
void pLabel::setText(const string &text) {
|
||||
gtk_label_set_text(GTK_LABEL(gtkWidget), text);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@ static void LineEdit_change(LineEdit *self) {
|
|||
if(self->p.locked == false && self->onChange) self->onChange();
|
||||
}
|
||||
|
||||
Geometry pLineEdit::minimumGeometry() {
|
||||
Font &font = pWidget::font();
|
||||
Geometry geometry = font.geometry(lineEdit.state.text);
|
||||
return { 0, 0, geometry.width + 10, geometry.height + 10 };
|
||||
}
|
||||
|
||||
void pLineEdit::setEditable(bool editable) {
|
||||
gtk_entry_set_editable(GTK_ENTRY(gtkWidget), editable);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Geometry pProgressBar::minimumGeometry() {
|
||||
return { 0, 0, 100, 25 };
|
||||
}
|
||||
|
||||
void pProgressBar::setPosition(unsigned position) {
|
||||
position = position <= 100 ? position : 0;
|
||||
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gtkWidget), (double)position / 100.0);
|
||||
|
|
|
@ -6,6 +6,12 @@ bool pRadioBox::checked() {
|
|||
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtkWidget));
|
||||
}
|
||||
|
||||
Geometry pRadioBox::minimumGeometry() {
|
||||
Font &font = pWidget::font();
|
||||
Geometry geometry = font.geometry(radioBox.state.text);
|
||||
return { 0, 0, geometry.width + 28, geometry.height + 4 };
|
||||
}
|
||||
|
||||
void pRadioBox::setChecked() {
|
||||
locked = true;
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkWidget), true);
|
||||
|
|
|
@ -4,6 +4,10 @@ static void VerticalSlider_change(VerticalSlider *self) {
|
|||
if(self->onChange) self->onChange();
|
||||
}
|
||||
|
||||
Geometry pVerticalSlider::minimumGeometry() {
|
||||
return { 0, 0, 20, 100 };
|
||||
}
|
||||
|
||||
unsigned pVerticalSlider::position() {
|
||||
return (unsigned)gtk_range_get_value(GTK_RANGE(gtkWidget));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,15 @@ static void Widget_setFont(GtkWidget *widget, gpointer font) {
|
|||
}
|
||||
}
|
||||
|
||||
Font& pWidget::font() {
|
||||
if(widget.state.font) return *widget.state.font;
|
||||
return pOS::defaultFont;
|
||||
}
|
||||
|
||||
Geometry pWidget::minimumGeometry() {
|
||||
return { 0, 0, 100, 25 };
|
||||
}
|
||||
|
||||
bool pWidget::enabled() {
|
||||
return gtk_widget_get_sensitive(gtkWidget);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,17 @@
|
|||
Geometry pFont::geometry(const string &text) {
|
||||
QFontMetrics metrics(*qtFont);
|
||||
|
||||
lstring lines;
|
||||
lines.split("\n", text);
|
||||
|
||||
unsigned maxWidth = 0;
|
||||
foreach(line, lines) {
|
||||
maxWidth = max(maxWidth, metrics.width(line));
|
||||
}
|
||||
|
||||
return { 0, 0, maxWidth, metrics.height() * lines.size() };
|
||||
}
|
||||
|
||||
void pFont::setBold(bool bold) { update(); }
|
||||
void pFont::setFamily(const string &family) { update(); }
|
||||
void pFont::setItalic(bool italic) { update(); }
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "widget/viewport.cpp"
|
||||
|
||||
QApplication *pOS::application = 0;
|
||||
Font pOS::defaultFont;
|
||||
|
||||
Geometry pOS::availableGeometry() {
|
||||
QRect rect = QApplication::desktop()->availableGeometry();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/****************************************************************************
|
||||
** Meta object code from reading C++ file 'qt.moc.hpp'
|
||||
**
|
||||
** Created: Tue Mar 15 13:54:13 2011
|
||||
** Created: Mon Mar 21 22:59:16 2011
|
||||
** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
|
|
|
@ -25,6 +25,7 @@ struct pObject {
|
|||
|
||||
struct pOS : public pObject {
|
||||
static QApplication *application;
|
||||
static Font defaultFont;
|
||||
|
||||
static Geometry availableGeometry();
|
||||
static Geometry desktopGeometry();
|
||||
|
@ -43,6 +44,7 @@ struct pFont : public pObject {
|
|||
Font &font;
|
||||
QFont *qtFont;
|
||||
|
||||
Geometry geometry(const string &text);
|
||||
void setBold(bool bold);
|
||||
void setFamily(const string &family);
|
||||
void setItalic(bool italic);
|
||||
|
@ -193,6 +195,8 @@ struct pWidget : public pObject {
|
|||
Widget &widget;
|
||||
QWidget *qtWidget;
|
||||
|
||||
Font& font();
|
||||
virtual Geometry minimumGeometry();
|
||||
void setEnabled(bool enabled);
|
||||
void setFocused();
|
||||
void setFont(Font &font);
|
||||
|
@ -210,6 +214,7 @@ public:
|
|||
Button &button;
|
||||
QPushButton *qtButton;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setText(const string &text);
|
||||
|
||||
pButton(Button &button) : pWidget(button), button(button) {}
|
||||
|
@ -227,6 +232,7 @@ public:
|
|||
QCheckBox *qtCheckBox;
|
||||
|
||||
bool checked();
|
||||
Geometry minimumGeometry();
|
||||
void setChecked(bool checked);
|
||||
void setText(const string &text);
|
||||
|
||||
|
@ -245,6 +251,7 @@ public:
|
|||
QComboBox *qtComboBox;
|
||||
|
||||
void append(const string &text);
|
||||
Geometry minimumGeometry();
|
||||
void reset();
|
||||
unsigned selection();
|
||||
void setSelection(unsigned row);
|
||||
|
@ -291,6 +298,7 @@ public:
|
|||
HorizontalSlider &horizontalSlider;
|
||||
QSlider *qtSlider;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
unsigned position();
|
||||
void setLength(unsigned length);
|
||||
void setPosition(unsigned position);
|
||||
|
@ -306,6 +314,7 @@ struct pLabel : public pWidget {
|
|||
Label &label;
|
||||
QLabel *qtLabel;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setText(const string &text);
|
||||
|
||||
pLabel(Label &label) : pWidget(label), label(label) {}
|
||||
|
@ -319,6 +328,7 @@ public:
|
|||
LineEdit &lineEdit;
|
||||
QLineEdit *qtLineEdit;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setEditable(bool editable);
|
||||
void setText(const string &text);
|
||||
string text();
|
||||
|
@ -365,6 +375,7 @@ struct pProgressBar : public pWidget {
|
|||
ProgressBar &progressBar;
|
||||
QProgressBar *qtProgressBar;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setPosition(unsigned position);
|
||||
|
||||
pProgressBar(ProgressBar &progressBar) : pWidget(progressBar), progressBar(progressBar) {}
|
||||
|
@ -380,6 +391,7 @@ public:
|
|||
QButtonGroup *qtGroup;
|
||||
|
||||
bool checked();
|
||||
Geometry minimumGeometry();
|
||||
void setChecked();
|
||||
void setGroup(const reference_array<RadioBox&> &group);
|
||||
void setText(const string &text);
|
||||
|
@ -418,6 +430,7 @@ public:
|
|||
VerticalSlider &verticalSlider;
|
||||
QSlider *qtSlider;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
unsigned position();
|
||||
void setLength(unsigned length);
|
||||
void setPosition(unsigned position);
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Geometry pButton::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(button.state.text);
|
||||
return { 0, 0, geometry.width + 20, geometry.height + 12 };
|
||||
}
|
||||
|
||||
void pButton::setText(const string &text) {
|
||||
qtButton->setText(QString::fromUtf8(text));
|
||||
}
|
||||
|
|
|
@ -2,6 +2,12 @@ bool pCheckBox::checked() {
|
|||
return qtCheckBox->isChecked();
|
||||
}
|
||||
|
||||
Geometry pCheckBox::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(checkBox.state.text);
|
||||
return { 0, 0, geometry.width + 26, geometry.height + 6 };
|
||||
}
|
||||
|
||||
void pCheckBox::setChecked(bool checked) {
|
||||
locked = true;
|
||||
qtCheckBox->setChecked(checked);
|
||||
|
|
|
@ -2,6 +2,14 @@ void pComboBox::append(const string &text) {
|
|||
qtComboBox->addItem(QString::fromUtf8(text));
|
||||
}
|
||||
|
||||
Geometry pComboBox::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
unsigned maximumWidth = 0;
|
||||
foreach(text, comboBox.state.text) maximumWidth = max(maximumWidth, font.geometry(text).width);
|
||||
Geometry geometry = font.geometry(" ");
|
||||
return { 0, 0, maximumWidth + 32, geometry.height + 12 };
|
||||
}
|
||||
|
||||
void pComboBox::reset() {
|
||||
while(qtComboBox->count()) qtComboBox->removeItem(0);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Geometry pHorizontalSlider::minimumGeometry() {
|
||||
return { 0, 0, 100, 20 };
|
||||
}
|
||||
|
||||
unsigned pHorizontalSlider::position() {
|
||||
return qtSlider->value();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Geometry pLabel::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(label.state.text);
|
||||
return { 0, 0, geometry.width, geometry.height };
|
||||
}
|
||||
|
||||
void pLabel::setText(const string &text) {
|
||||
qtLabel->setText(QString::fromUtf8(text));
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Geometry pLineEdit::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(lineEdit.state.text);
|
||||
return { 0, 0, geometry.width + 12, geometry.height + 12 };
|
||||
}
|
||||
|
||||
void pLineEdit::setEditable(bool editable) {
|
||||
qtLineEdit->setReadOnly(!editable);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Geometry pProgressBar::minimumGeometry() {
|
||||
return { 0, 0, 100, 25 };
|
||||
}
|
||||
|
||||
void pProgressBar::setPosition(unsigned position) {
|
||||
qtProgressBar->setValue(position);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,12 @@ bool pRadioBox::checked() {
|
|||
return qtRadioBox->isChecked();
|
||||
}
|
||||
|
||||
Geometry pRadioBox::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(radioBox.state.text);
|
||||
return { 0, 0, geometry.width + 26, geometry.height + 6 };
|
||||
}
|
||||
|
||||
void pRadioBox::setChecked() {
|
||||
locked = true;
|
||||
foreach(item, radioBox.state.group) {
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Geometry pVerticalSlider::minimumGeometry() {
|
||||
return { 0, 0, 20, 100 };
|
||||
}
|
||||
|
||||
unsigned pVerticalSlider::position() {
|
||||
return qtSlider->value();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
Font& pWidget::font() {
|
||||
if(widget.state.font) return *widget.state.font;
|
||||
return pOS::defaultFont;
|
||||
}
|
||||
|
||||
Geometry pWidget::minimumGeometry() {
|
||||
return { 0, 0, 100, 25 };
|
||||
}
|
||||
|
||||
void pWidget::setEnabled(bool enabled) {
|
||||
qtWidget->setEnabled(enabled);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,15 @@ static HFONT Font_createFont(const string &family, unsigned size, bool bold, boo
|
|||
);
|
||||
}
|
||||
|
||||
Geometry pFont::geometry(const string &text) {
|
||||
HDC hdc = GetDC(0);
|
||||
SelectObject(hdc, hfont);
|
||||
RECT rc = { 0, 0, 0, 0 };
|
||||
DrawText(hdc, utf16_t(text), -1, &rc, DT_CALCRECT);
|
||||
ReleaseDC(0, hdc);
|
||||
return { 0, 0, rc.right, rc.bottom };
|
||||
}
|
||||
|
||||
void pFont::setBold(bool bold) {
|
||||
if(hfont) { DeleteObject(hfont); hfont = 0; }
|
||||
hfont = Font_createFont(font.state.family, font.state.size, font.state.bold, font.state.italic, font.state.underline);
|
||||
|
@ -32,5 +41,5 @@ void pFont::setUnderline(bool underline) {
|
|||
}
|
||||
|
||||
void pFont::constructor() {
|
||||
hfont = 0;
|
||||
hfont = Font_createFont("Tahoma", 8, false, false, false);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Geometry pButton::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(button.state.text);
|
||||
return { 0, 0, geometry.width + 20, geometry.height + 12 };
|
||||
}
|
||||
|
||||
void pButton::setText(const string &text) {
|
||||
SetWindowText(hwnd, utf16_t(text));
|
||||
}
|
||||
|
|
|
@ -2,6 +2,12 @@ bool pCheckBox::checked() {
|
|||
return SendMessage(hwnd, BM_GETCHECK, 0, 0);
|
||||
}
|
||||
|
||||
Geometry pCheckBox::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(checkBox.state.text);
|
||||
return { 0, 0, geometry.width + 20, geometry.height + 4 };
|
||||
}
|
||||
|
||||
void pCheckBox::setChecked(bool checked) {
|
||||
SendMessage(hwnd, BM_SETCHECK, (WPARAM)checked, 0);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,14 @@ void pComboBox::append(const string &text) {
|
|||
if(SendMessage(hwnd, CB_GETCOUNT, 0, 0) == 1) setSelection(0);
|
||||
}
|
||||
|
||||
Geometry pComboBox::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
unsigned maximumWidth = 0;
|
||||
foreach(text, comboBox.state.text) maximumWidth = max(maximumWidth, font.geometry(text).width);
|
||||
Geometry geometry = font.geometry(" ");
|
||||
return { 0, 0, maximumWidth + 24, geometry.height + 10 };
|
||||
}
|
||||
|
||||
void pComboBox::reset() {
|
||||
SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Geometry pHorizontalSlider::minimumGeometry() {
|
||||
return { 0, 0, 100, 25 };
|
||||
}
|
||||
|
||||
unsigned pHorizontalSlider::position() {
|
||||
return SendMessage(hwnd, TBM_GETPOS, 0, 0);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Geometry pLabel::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(label.state.text);
|
||||
return { 0, 0, geometry.width, geometry.height };
|
||||
}
|
||||
|
||||
void pLabel::setText(const string &text) {
|
||||
SetWindowText(hwnd, utf16_t(text));
|
||||
InvalidateRect(hwnd, 0, false);
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
Geometry pLineEdit::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(lineEdit.state.text);
|
||||
return { 0, 0, geometry.width + 12, geometry.height + 8 };
|
||||
}
|
||||
|
||||
void pLineEdit::setEditable(bool editable) {
|
||||
SendMessage(hwnd, EM_SETREADONLY, editable == false, 0);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Geometry pProgressBar::minimumGeometry() {
|
||||
return { 0, 0, 100, 25 };
|
||||
}
|
||||
|
||||
void pProgressBar::setPosition(unsigned position) {
|
||||
SendMessage(hwnd, PBM_SETPOS, (WPARAM)position, 0);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,12 @@ bool pRadioBox::checked() {
|
|||
return SendMessage(hwnd, BM_GETCHECK, 0, 0);
|
||||
}
|
||||
|
||||
Geometry pRadioBox::minimumGeometry() {
|
||||
Font &font = this->font();
|
||||
Geometry geometry = font.geometry(radioBox.state.text);
|
||||
return { 0, 0, geometry.width + 20, geometry.height + 4 };
|
||||
}
|
||||
|
||||
void pRadioBox::setChecked() {
|
||||
foreach(item, radioBox.state.group) {
|
||||
SendMessage(item.p.hwnd, BM_SETCHECK, (WPARAM)(&item == &radioBox), 0);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
Geometry pVerticalSlider::minimumGeometry() {
|
||||
return { 0, 0, 25, 100 };
|
||||
}
|
||||
|
||||
unsigned pVerticalSlider::position() {
|
||||
return SendMessage(hwnd, TBM_GETPOS, 0, 0);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,15 @@ bool pWidget::enabled() {
|
|||
return IsWindowEnabled(hwnd);
|
||||
}
|
||||
|
||||
Font& pWidget::font() {
|
||||
if(widget.state.font) return *widget.state.font;
|
||||
return pOS::state->defaultFont;
|
||||
}
|
||||
|
||||
Geometry pWidget::minimumGeometry() {
|
||||
return { 0, 0, 100, 25 };
|
||||
}
|
||||
|
||||
void pWidget::setEnabled(bool enabled) {
|
||||
EnableWindow(hwnd, enabled);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ struct pFont : public pObject {
|
|||
Font &font;
|
||||
HFONT hfont;
|
||||
|
||||
Geometry geometry(const string &text);
|
||||
void setBold(bool bold);
|
||||
void setFamily(const string &family);
|
||||
void setItalic(bool italic);
|
||||
|
@ -155,6 +156,8 @@ struct pWidget : public pObject {
|
|||
HWND hwnd;
|
||||
|
||||
bool enabled();
|
||||
Font& font();
|
||||
virtual Geometry minimumGeometry();
|
||||
void setEnabled(bool enabled);
|
||||
void setFocused();
|
||||
void setFont(Font &font);
|
||||
|
@ -170,6 +173,7 @@ struct pWidget : public pObject {
|
|||
struct pButton : public pWidget {
|
||||
Button &button;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setText(const string &text);
|
||||
|
||||
pButton(Button &button) : pWidget(button), button(button) {}
|
||||
|
@ -181,6 +185,7 @@ struct pCheckBox : public pWidget {
|
|||
CheckBox &checkBox;
|
||||
|
||||
bool checked();
|
||||
Geometry minimumGeometry();
|
||||
void setChecked(bool checked);
|
||||
void setText(const string &text);
|
||||
|
||||
|
@ -193,6 +198,7 @@ struct pComboBox : public pWidget {
|
|||
ComboBox &comboBox;
|
||||
|
||||
void append(const string &text);
|
||||
Geometry minimumGeometry();
|
||||
void reset();
|
||||
unsigned selection();
|
||||
void setSelection(unsigned row);
|
||||
|
@ -222,6 +228,7 @@ struct pHexEdit : public pWidget {
|
|||
struct pHorizontalSlider : public pWidget {
|
||||
HorizontalSlider &horizontalSlider;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
unsigned position();
|
||||
void setLength(unsigned length);
|
||||
void setPosition(unsigned position);
|
||||
|
@ -234,6 +241,7 @@ struct pHorizontalSlider : public pWidget {
|
|||
struct pLabel : public pWidget {
|
||||
Label &label;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setText(const string &text);
|
||||
|
||||
pLabel(Label &label) : pWidget(label), label(label) {}
|
||||
|
@ -244,6 +252,7 @@ struct pLabel : public pWidget {
|
|||
struct pLineEdit : public pWidget {
|
||||
LineEdit &lineEdit;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setEditable(bool editable);
|
||||
void setText(const string &text);
|
||||
string text();
|
||||
|
@ -280,6 +289,7 @@ struct pListView : public pWidget {
|
|||
struct pProgressBar : public pWidget {
|
||||
ProgressBar &progressBar;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
void setPosition(unsigned position);
|
||||
|
||||
pProgressBar(ProgressBar &progressBar) : pWidget(progressBar), progressBar(progressBar) {}
|
||||
|
@ -291,6 +301,7 @@ struct pRadioBox : public pWidget {
|
|||
RadioBox &radioBox;
|
||||
|
||||
bool checked();
|
||||
Geometry minimumGeometry();
|
||||
void setChecked();
|
||||
void setGroup(const reference_array<RadioBox&> &group);
|
||||
void setText(const string &text);
|
||||
|
@ -317,6 +328,7 @@ struct pTextEdit : public pWidget {
|
|||
struct pVerticalSlider : public pWidget {
|
||||
VerticalSlider &verticalSlider;
|
||||
|
||||
Geometry minimumGeometry();
|
||||
unsigned position();
|
||||
void setLength(unsigned length);
|
||||
void setPosition(unsigned position);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
namespace SNES {
|
||||
namespace Info {
|
||||
static const char Name[] = "bsnes";
|
||||
static const char Version[] = "077.01";
|
||||
static const char Version[] = "077.02";
|
||||
static const unsigned SerializerVersion = 19;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,16 +15,16 @@ void Console::create() {
|
|||
clearConsole.setText("Clear console");
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(output, 0, 0, 5);
|
||||
controlLayout.append(traceToConsole, 120, Style::CheckBoxHeight);
|
||||
controlLayout.append(traceToFile, 120, Style::CheckBoxHeight);
|
||||
controlLayout.append(traceCPU, 120, Style::CheckBoxHeight);
|
||||
controlLayout.append(traceSMP, 120, Style::CheckBoxHeight);
|
||||
controlLayout.append(spacer, 120, 0, Style::CheckBoxHeight);
|
||||
controlLayout.append(clearConsole, 120, Style::ButtonHeight);
|
||||
layout.append(controlLayout, 120, 0);
|
||||
layout.append(output, ~0, ~0, 5);
|
||||
controlLayout.append(traceToConsole, 120, 0 );
|
||||
controlLayout.append(traceToFile, 120, 0 );
|
||||
controlLayout.append(traceCPU, 120, 0 );
|
||||
controlLayout.append(traceSMP, 120, 0 );
|
||||
controlLayout.append(spacer, 120, ~0 );
|
||||
controlLayout.append(clearConsole, 120, 0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumWidth() + 580, 350 });
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 580, 350 });
|
||||
append(layout);
|
||||
|
||||
onClose = []() {
|
||||
|
|
|
@ -12,13 +12,14 @@ void CPUDebugger::create() {
|
|||
proceed.setEnabled(false);
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(output, 0, 0, 5);
|
||||
controlLayout.append(stepInto, 80, Style::ButtonHeight);
|
||||
controlLayout.append(stepOver, 80, Style::ButtonHeight);
|
||||
controlLayout.append(proceed, 80, Style::ButtonHeight);
|
||||
layout.append(controlLayout, 80, 0);
|
||||
layout.append(output, ~0, ~0, 5);
|
||||
controlLayout.append(stepInto, 80, 0 );
|
||||
controlLayout.append(stepOver, 80, 0 );
|
||||
controlLayout.append(proceed, 80, 0 );
|
||||
controlLayout.append(spacer, 80, ~0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumWidth() + 300, 220 });
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });
|
||||
append(layout);
|
||||
|
||||
onClose = []() {
|
||||
|
|
|
@ -5,6 +5,7 @@ struct CPUDebugger : TopLevelWindow {
|
|||
Button stepInto;
|
||||
Button stepOver;
|
||||
Button proceed;
|
||||
Widget spacer;
|
||||
|
||||
void create();
|
||||
void synchronize();
|
||||
|
|
|
@ -29,14 +29,14 @@ void Debugger::create() {
|
|||
showMemoryEditor.setText("Memory editor");
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(enableDebugger, 0, Style::CheckBoxHeight);
|
||||
layout.append(showConsole, 0, Style::CheckBoxHeight);
|
||||
layout.append(showCPUDebugger, 0, Style::CheckBoxHeight);
|
||||
layout.append(showSMPDebugger, 0, Style::CheckBoxHeight);
|
||||
layout.append(showBreakpointEditor, 0, Style::CheckBoxHeight);
|
||||
layout.append(showMemoryEditor, 0, Style::CheckBoxHeight);
|
||||
layout.append(enableDebugger, ~0, 0);
|
||||
layout.append(showConsole, ~0, 0);
|
||||
layout.append(showCPUDebugger, ~0, 0);
|
||||
layout.append(showSMPDebugger, ~0, 0);
|
||||
layout.append(showBreakpointEditor, ~0, 0);
|
||||
layout.append(showMemoryEditor, ~0, 0);
|
||||
|
||||
setGeometry({ 0, 0, 256, layout.minimumHeight() });
|
||||
setGeometry({ 0, 0, 256, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
|
||||
//windows shown by default
|
||||
|
|
|
@ -12,13 +12,14 @@ void SMPDebugger::create() {
|
|||
proceed.setEnabled(false);
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(output, 0, 0, 5);
|
||||
controlLayout.append(stepInto, 80, Style::ButtonHeight);
|
||||
controlLayout.append(stepOver, 80, Style::ButtonHeight);
|
||||
controlLayout.append(proceed, 80, Style::ButtonHeight);
|
||||
layout.append(controlLayout, 80, 0);
|
||||
layout.append(output, ~0, ~0, 5);
|
||||
controlLayout.append(stepInto, 80, 0 );
|
||||
controlLayout.append(stepOver, 80, 0 );
|
||||
controlLayout.append(proceed, 80, 0 );
|
||||
controlLayout.append(spacer, 80, ~0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumWidth() + 300, 220 });
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 300, 220 });
|
||||
append(layout);
|
||||
|
||||
onClose = []() {
|
||||
|
|
|
@ -5,6 +5,7 @@ struct SMPDebugger : TopLevelWindow {
|
|||
Button stepInto;
|
||||
Button stepOver;
|
||||
Button proceed;
|
||||
Widget spacer;
|
||||
|
||||
void create();
|
||||
void synchronize();
|
||||
|
|
|
@ -19,17 +19,17 @@ void BreakpointEditor::create() {
|
|||
}
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(runToBreakpoint, 0, Style::CheckBoxHeight, 5);
|
||||
layout.append(runToBreakpoint, ~0, 0, 5);
|
||||
for(unsigned n = 0; n < Breakpoints; n++) {
|
||||
breakpointLayout[n].append(enableBox[n], 35, Style::LineEditHeight);
|
||||
breakpointLayout[n].append(addressBox[n], 60, Style::LineEditHeight, 5);
|
||||
breakpointLayout[n].append(valueBox[n], 30, Style::LineEditHeight, 5);
|
||||
breakpointLayout[n].append(typeBox[n], 80, Style::LineEditHeight, 5);
|
||||
breakpointLayout[n].append(sourceBox[n], 80, Style::LineEditHeight);
|
||||
layout.append(breakpointLayout[n], 0, Style::LineEditHeight, 5);
|
||||
breakpointLayout[n].append(enableBox[n], 35, 0 );
|
||||
breakpointLayout[n].append(addressBox[n], 60, 0, 5);
|
||||
breakpointLayout[n].append(valueBox[n], 30, 0, 5);
|
||||
breakpointLayout[n].append(typeBox[n], 0, 0, 5);
|
||||
breakpointLayout[n].append(sourceBox[n], 0, 0 );
|
||||
layout.append(breakpointLayout[n], 5);
|
||||
}
|
||||
|
||||
setGeometry({ 0, 0, 310, layout.minimumHeight() });
|
||||
setGeometry({ 0, 0, 310, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
|
||||
onClose = []() {
|
||||
|
|
|
@ -15,13 +15,14 @@ void MemoryEditor::create() {
|
|||
refreshButton.setText("Refresh");
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(editor, 0, 0, 5);
|
||||
controlLayout.append(sourceBox, 80, Style::ComboBoxHeight);
|
||||
controlLayout.append(gotoBox, 80, Style::ComboBoxHeight);
|
||||
controlLayout.append(refreshButton, 80, Style::ComboBoxHeight);
|
||||
layout.append(controlLayout, 80, 0);
|
||||
layout.append(editor, ~0, ~0, 5);
|
||||
controlLayout.append(sourceBox, 80, 0 );
|
||||
controlLayout.append(gotoBox, 80, 0 );
|
||||
controlLayout.append(refreshButton, 80, 0 );
|
||||
controlLayout.append(spacer, 80, ~0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, layout.minimumWidth() + 475, 230 });
|
||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 475, 230 });
|
||||
append(layout);
|
||||
|
||||
onClose = []() {
|
||||
|
|
|
@ -5,6 +5,7 @@ struct MemoryEditor : TopLevelWindow {
|
|||
ComboBox sourceBox;
|
||||
LineEdit gotoBox;
|
||||
Button refreshButton;
|
||||
Widget spacer;
|
||||
|
||||
SNES::Debugger::MemorySource source;
|
||||
unsigned size;
|
||||
|
|
|
@ -7,13 +7,13 @@ void FileBrowser::create() {
|
|||
upButton.setText("..");
|
||||
|
||||
layout.setMargin(5);
|
||||
pathLayout.append(pathBox, 0, 0, 5);
|
||||
pathLayout.append(browseButton, Style::LineEditHeight, 0, 5);
|
||||
pathLayout.append(upButton, Style::LineEditHeight, 0);
|
||||
layout.append(pathLayout, 0, Style::LineEditHeight, 5);
|
||||
layout.append(contentsBox, 0, 0);
|
||||
pathLayout.append(pathBox, ~0, 0, 5);
|
||||
pathLayout.append(browseButton, 25, 25, 5);
|
||||
pathLayout.append(upButton, 25, 25 );
|
||||
layout.append(pathLayout, 5);
|
||||
layout.append(contentsBox, ~0, ~0 );
|
||||
|
||||
setGeometry({ 0, 0, 640, layout.minimumHeight() + 400 });
|
||||
setGeometry({ 0, 0, 640, layout.minimumGeometry().height + 400 });
|
||||
append(layout);
|
||||
|
||||
pathBox.onActivate = []() {
|
||||
|
|
|
@ -11,19 +11,19 @@ void SingleSlotLoader::create() {
|
|||
okButton.setText("Ok");
|
||||
|
||||
layout.setMargin(5);
|
||||
baseLayout.append(baseLabel, 40, 0, 5);
|
||||
baseLayout.append(basePath, 0, 0, 5);
|
||||
baseLayout.append(baseBrowse, Style::LineEditHeight, 0);
|
||||
layout.append(baseLayout, 0, Style::LineEditHeight, 5);
|
||||
slotLayout.append(slotLabel, 40, 0, 5);
|
||||
slotLayout.append(slotPath, 0, 0, 5);
|
||||
slotLayout.append(slotBrowse, Style::LineEditHeight, 0);
|
||||
layout.append(slotLayout, 0, Style::LineEditHeight, 5);
|
||||
controlLayout.append(spacer, 0, 0);
|
||||
controlLayout.append(okButton, 80, 0);
|
||||
layout.append(controlLayout, 0, Style::ButtonHeight);
|
||||
baseLayout.append(baseLabel, 40, 0, 5);
|
||||
baseLayout.append(basePath, ~0, 0, 5);
|
||||
baseLayout.append(baseBrowse, 25, 25 );
|
||||
layout.append(baseLayout, 5);
|
||||
slotLayout.append(slotLabel, 40, 0, 5);
|
||||
slotLayout.append(slotPath, ~0, 0, 5);
|
||||
slotLayout.append(slotBrowse, 25, 25 );
|
||||
layout.append(slotLayout, 5);
|
||||
controlLayout.append(spacer, ~0, 0 );
|
||||
controlLayout.append(okButton, 80, 0 );
|
||||
layout.append(controlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumHeight() });
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
|
||||
baseBrowse.onTick = []() {
|
||||
|
@ -105,23 +105,23 @@ void DoubleSlotLoader::create() {
|
|||
okButton.setText("Ok");
|
||||
|
||||
layout.setMargin(5);
|
||||
baseLayout.append(baseLabel, 40, 0, 5);
|
||||
baseLayout.append(basePath, 0, 0, 5);
|
||||
baseLayout.append(baseBrowse, Style::LineEditHeight, 0);
|
||||
layout.append(baseLayout, 0, Style::LineEditHeight, 5);
|
||||
slotALayout.append(slotALabel, 40, 0, 5);
|
||||
slotALayout.append(slotAPath, 0, 0, 5);
|
||||
slotALayout.append(slotABrowse, Style::LineEditHeight, 0);
|
||||
layout.append(slotALayout, 0, Style::LineEditHeight, 5);
|
||||
slotBLayout.append(slotBLabel, 40, 0, 5);
|
||||
slotBLayout.append(slotBPath, 0, 0, 5);
|
||||
slotBLayout.append(slotBBrowse, Style::LineEditHeight, 0);
|
||||
layout.append(slotBLayout, 0, Style::LineEditHeight, 5);
|
||||
controlLayout.append(spacer, 0, 0);
|
||||
controlLayout.append(okButton, 80, 0);
|
||||
layout.append(controlLayout, 0, Style::ButtonHeight);
|
||||
baseLayout.append(baseLabel, 40, 0, 5);
|
||||
baseLayout.append(basePath, ~0, 0, 5);
|
||||
baseLayout.append(baseBrowse, 25, 25 );
|
||||
layout.append(baseLayout, 5);
|
||||
slotALayout.append(slotALabel, 40, 0, 5);
|
||||
slotALayout.append(slotAPath, ~0, 0, 5);
|
||||
slotALayout.append(slotABrowse, 25, 25 );
|
||||
layout.append(slotALayout, 5);
|
||||
slotBLayout.append(slotBLabel, 40, 0, 5);
|
||||
slotBLayout.append(slotBPath, ~0, 0, 5);
|
||||
slotBLayout.append(slotBBrowse, 25, 25 );
|
||||
layout.append(slotBLayout, 5);
|
||||
controlLayout.append(spacer, ~0, 0 );
|
||||
controlLayout.append(okButton, 80, 0 );
|
||||
layout.append(controlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumHeight() });
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
|
||||
baseBrowse.onTick = []() {
|
||||
|
|
|
@ -20,21 +20,21 @@ void AdvancedSettings::create() {
|
|||
if(config.settings.focusPolicy == 2) focusPolicyAllow.setChecked();
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(driverSelectionLabel, 0, Style::LabelHeight);
|
||||
driverLayout.append(videoDriverLabel, 40, 0, 5);
|
||||
driverLayout.append(videoDriverBox, 0, 0, 5);
|
||||
driverLayout.append(audioDriverLabel, 40, 0, 5);
|
||||
driverLayout.append(audioDriverBox, 0, 0, 5);
|
||||
driverLayout.append(inputDriverLabel, 40, 0, 5);
|
||||
driverLayout.append(inputDriverBox, 0, 0);
|
||||
layout.append(driverLayout, 0, Style::ComboBoxHeight, 5);
|
||||
layout.append(focusPolicyLabel, 0, Style::LabelHeight);
|
||||
focusPolicyLayout.append(focusPolicyPause, 0, 0, 5);
|
||||
focusPolicyLayout.append(focusPolicyIgnore, 0, 0, 5);
|
||||
focusPolicyLayout.append(focusPolicyAllow, 0, 0);
|
||||
layout.append(focusPolicyLayout, 0, Style::CheckBoxHeight);
|
||||
layout.append(driverSelectionLabel, ~0, 0 );
|
||||
driverLayout.append(videoDriverLabel, 0, 0, 5);
|
||||
driverLayout.append(videoDriverBox, ~0, 0, 5);
|
||||
driverLayout.append(audioDriverLabel, 0, 0, 5);
|
||||
driverLayout.append(audioDriverBox, ~0, 0, 5);
|
||||
driverLayout.append(inputDriverLabel, 0, 0, 5);
|
||||
driverLayout.append(inputDriverBox, ~0, 0 );
|
||||
layout.append(driverLayout, 5);
|
||||
layout.append(focusPolicyLabel, ~0, 0 );
|
||||
focusPolicyLayout.append(focusPolicyPause, ~0, 0, 5);
|
||||
focusPolicyLayout.append(focusPolicyIgnore, ~0, 0, 5);
|
||||
focusPolicyLayout.append(focusPolicyAllow, ~0, 0);
|
||||
layout.append(focusPolicyLayout);
|
||||
|
||||
setGeometry({ 0, 0, 640, layout.minimumHeight() });
|
||||
setGeometry({ 0, 0, 640, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
|
||||
lstring list;
|
||||
|
|
|
@ -10,16 +10,16 @@ void AudioSettings::create() {
|
|||
frequencySlider.setLength(2001);
|
||||
|
||||
layout.setMargin(5);
|
||||
volumeLayout.append(volumeLabel, 70, 0);
|
||||
volumeLayout.append(volumeValue, 60, 0);
|
||||
volumeLayout.append(volumeSlider, 0, 0);
|
||||
layout.append(volumeLayout, 0, Style::SliderHeight);
|
||||
frequencyLayout.append(frequencyLabel, 70, 0);
|
||||
frequencyLayout.append(frequencyValue, 60, 0);
|
||||
frequencyLayout.append(frequencySlider, 0, 0);
|
||||
layout.append(frequencyLayout, 0, Style::SliderHeight);
|
||||
volumeLayout.append(volumeLabel, 70, 0);
|
||||
volumeLayout.append(volumeValue, 60, 0);
|
||||
volumeLayout.append(volumeSlider, ~0, 0);
|
||||
layout.append(volumeLayout );
|
||||
frequencyLayout.append(frequencyLabel, 70, 0);
|
||||
frequencyLayout.append(frequencyValue, 60, 0);
|
||||
frequencyLayout.append(frequencySlider, ~0, 0);
|
||||
layout.append(frequencyLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumHeight() });
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
|
||||
volumeSlider.onChange = []() {
|
||||
|
|
|
@ -24,30 +24,30 @@ void InputSettings::create() {
|
|||
mouseRight.setText("Mouse Right");
|
||||
|
||||
layout.setMargin(5);
|
||||
selectionLayout.append(portLabel, 50, 0, 5);
|
||||
selectionLayout.append(portBox, 0, 0, 5);
|
||||
selectionLayout.append(deviceLabel, 50, 0, 5);
|
||||
selectionLayout.append(deviceBox, 0, 0);
|
||||
layout.append(selectionLayout, 0, Style::ComboBoxHeight, 5);
|
||||
layout.append(mappingList, 0, 0, 5);
|
||||
mapLayout.append(spacer, 0, 0);
|
||||
mapLayout.append(clearButton, 80, 0);
|
||||
layout.append(mapLayout, 0, Style::ButtonHeight);
|
||||
selectionLayout.append(portLabel, 0, 0, 5);
|
||||
selectionLayout.append(portBox, ~0, 0, 5);
|
||||
selectionLayout.append(deviceLabel, 0, 0, 5);
|
||||
selectionLayout.append(deviceBox, ~0, 0 );
|
||||
layout.append(selectionLayout, 5);
|
||||
layout.append(mappingList, ~0, ~0, 5);
|
||||
mapLayout.append(spacer, ~0, 0 );
|
||||
mapLayout.append(clearButton, 80, 0 );
|
||||
layout.append(mapLayout);
|
||||
|
||||
axisLayout.setMargin(5);
|
||||
axisLayout.append(axisSpacer, 0, 0);
|
||||
axisControlLayout.append(mouseXaxis, 100, 0, 5);
|
||||
axisControlLayout.append(mouseYaxis, 100, 0, 5);
|
||||
axisLayout.append(axisControlLayout, 0, Style::ButtonHeight);
|
||||
axisLayout.append(axisSpacer, ~0, ~0 );
|
||||
axisControlLayout.append(mouseXaxis, 100, 0, 5);
|
||||
axisControlLayout.append(mouseYaxis, 100, 0, 5);
|
||||
axisLayout.append(axisControlLayout);
|
||||
|
||||
buttonLayout.setMargin(5);
|
||||
buttonLayout.append(buttonSpacer, 0, 0);
|
||||
buttonControlLayout.append(mouseLeft, 100, 0, 5);
|
||||
buttonControlLayout.append(mouseMiddle, 100, 0, 5);
|
||||
buttonControlLayout.append(mouseRight, 100, 0, 5);
|
||||
buttonLayout.append(buttonControlLayout, 0, Style::ButtonHeight);
|
||||
buttonLayout.append(buttonSpacer, ~0, ~0 );
|
||||
buttonControlLayout.append(mouseLeft, 100, 0, 5);
|
||||
buttonControlLayout.append(mouseMiddle, 100, 0, 5);
|
||||
buttonControlLayout.append(mouseRight, 100, 0, 5);
|
||||
buttonLayout.append(buttonControlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumHeight() + 250 });
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
append(layout);
|
||||
append(axisLayout);
|
||||
append(buttonLayout);
|
||||
|
|
|
@ -21,27 +21,27 @@ void VideoSettings::create() {
|
|||
RadioBox::group(fullscreenCenter, fullscreenScale, fullscreenStretch);
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(colorAdjustmentLabel, 0, Style::LabelHeight);
|
||||
brightnessLayout.append(brightnessLabel, 80, 0);
|
||||
brightnessLayout.append(brightnessValue, 50, 0);
|
||||
brightnessLayout.append(brightnessSlider, 0, 0);
|
||||
layout.append(brightnessLayout, 0, Style::SliderHeight);
|
||||
contrastLayout.append(contrastLabel, 80, 0);
|
||||
contrastLayout.append(contrastValue, 50, 0);
|
||||
contrastLayout.append(contrastSlider, 0, 0);
|
||||
layout.append(contrastLayout, 0, Style::SliderHeight);
|
||||
gammaLayout.append(gammaLabel, 80, 0);
|
||||
gammaLayout.append(gammaValue, 50, 0);
|
||||
gammaLayout.append(gammaSlider, 0, 0);
|
||||
layout.append(gammaLayout, 0, Style::SliderHeight);
|
||||
layout.append(gammaRampCheck, 0, Style::CheckBoxHeight, 5);
|
||||
layout.append(fullscreenLabel, 0, Style::LabelHeight);
|
||||
fullscreenLayout.append(fullscreenCenter, 0, 0);
|
||||
fullscreenLayout.append(fullscreenScale, 0, 0);
|
||||
fullscreenLayout.append(fullscreenStretch, 0, 0);
|
||||
layout.append(fullscreenLayout, 0, Style::CheckBoxHeight);
|
||||
layout.append(colorAdjustmentLabel, ~0, 0 );
|
||||
brightnessLayout.append(brightnessLabel, 80, 0 );
|
||||
brightnessLayout.append(brightnessValue, 50, 0 );
|
||||
brightnessLayout.append(brightnessSlider, ~0, 0 );
|
||||
layout.append(brightnessLayout );
|
||||
contrastLayout.append(contrastLabel, 80, 0 );
|
||||
contrastLayout.append(contrastValue, 50, 0 );
|
||||
contrastLayout.append(contrastSlider, ~0, 0 );
|
||||
layout.append(contrastLayout );
|
||||
gammaLayout.append(gammaLabel, 80, 0 );
|
||||
gammaLayout.append(gammaValue, 50, 0 );
|
||||
gammaLayout.append(gammaSlider, ~0, 0 );
|
||||
layout.append(gammaLayout );
|
||||
layout.append(gammaRampCheck, ~0, 0, 5);
|
||||
layout.append(fullscreenLabel, ~0, 0 );
|
||||
fullscreenLayout.append(fullscreenCenter, ~0, 0, 5);
|
||||
fullscreenLayout.append(fullscreenScale, ~0, 0, 5);
|
||||
fullscreenLayout.append(fullscreenStretch, ~0, 0 );
|
||||
layout.append(fullscreenLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumHeight() });
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height });
|
||||
append(layout);
|
||||
|
||||
brightnessSlider.setPosition(config.video.brightness);
|
||||
|
|
|
@ -9,13 +9,13 @@ void CheatDatabase::create() {
|
|||
okButton.setText("Ok");
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(listView, 0, 0, 5);
|
||||
controlLayout.append(selectAllButton, 100, 0, 5);
|
||||
controlLayout.append(unselectAllButton, 100, 0);
|
||||
controlLayout.append(spacerWidget, 0, 0);
|
||||
controlLayout.append(okButton, 80, 0);
|
||||
layout.append(controlLayout, 0, Style::ButtonHeight);
|
||||
setGeometry({ 0, 0, 600, layout.minimumHeight() + 350 });
|
||||
layout.append(listView, ~0, ~0, 5);
|
||||
controlLayout.append(selectAllButton, 100, 0, 5);
|
||||
controlLayout.append(unselectAllButton, 100, 0 );
|
||||
controlLayout.append(spacerWidget, ~0, 0 );
|
||||
controlLayout.append(okButton, 80, 0 );
|
||||
layout.append(controlLayout );
|
||||
setGeometry({ 0, 0, 600, layout.minimumGeometry().height + 350 });
|
||||
append(layout);
|
||||
|
||||
selectAllButton.onTick = [this]() {
|
||||
|
|
|
@ -92,20 +92,20 @@ void CheatEditor::create() {
|
|||
clearButton.setText("Clear");
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(cheatList, 0, 0, 5);
|
||||
codeLayout.append(codeLabel, 80, 0, 5);
|
||||
codeLayout.append(codeEdit, 0, 0);
|
||||
layout.append(codeLayout, 0, Style::LineEditHeight, 5);
|
||||
descLayout.append(descLabel, 80, 0, 5);
|
||||
descLayout.append(descEdit, 0, 0);
|
||||
layout.append(descLayout, 0, Style::LineEditHeight, 5);
|
||||
controlLayout.append(findButton, 100, 0);
|
||||
controlLayout.append(spacerWidget, 0, 0);
|
||||
layout.append(cheatList, ~0, ~0, 5);
|
||||
codeLayout.append(codeLabel, 80, 0, 5);
|
||||
codeLayout.append(codeEdit, ~0, 0 );
|
||||
layout.append(codeLayout, 5);
|
||||
descLayout.append(descLabel, 80, 0, 5);
|
||||
descLayout.append(descEdit, ~0, 0 );
|
||||
layout.append(descLayout, 5);
|
||||
controlLayout.append(findButton, 100, 0 );
|
||||
controlLayout.append(spacerWidget, ~0, 0 );
|
||||
controlLayout.append(clearAllButton, 80, 0, 5);
|
||||
controlLayout.append(clearButton, 80, 0);
|
||||
layout.append(controlLayout, 0, Style::ButtonHeight);
|
||||
controlLayout.append(clearButton, 80, 0 );
|
||||
layout.append(controlLayout);
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumHeight() + 250 });
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
append(layout);
|
||||
|
||||
synchronize();
|
||||
|
|
|
@ -12,17 +12,17 @@ void StateManager::create() {
|
|||
eraseButton.setText("Erase");
|
||||
|
||||
layout.setMargin(5);
|
||||
layout.append(stateList, 0, 0, 5);
|
||||
descLayout.append(descLabel, 80, 0, 5);
|
||||
descLayout.append(descEdit, 0, 0);
|
||||
layout.append(descLayout, 0, Style::LineEditHeight, 5);
|
||||
controlLayout.append(spacer, 0, 0);
|
||||
controlLayout.append(loadButton, 80, 0, 5);
|
||||
controlLayout.append(saveButton, 80, 0, 5);
|
||||
controlLayout.append(eraseButton, 80, 0);
|
||||
layout.append(controlLayout, 0, Style::ButtonHeight);
|
||||
layout.append(stateList, ~0, ~0, 5);
|
||||
descLayout.append(descLabel, 80, 0, 5);
|
||||
descLayout.append(descEdit, ~0, 0 );
|
||||
layout.append(descLayout, 5);
|
||||
controlLayout.append(spacer, 0, 0 );
|
||||
controlLayout.append(loadButton, 80, 0, 5);
|
||||
controlLayout.append(saveButton, 80, 0, 5);
|
||||
controlLayout.append(eraseButton, 80, 0 );
|
||||
layout.append(controlLayout );
|
||||
|
||||
setGeometry({ 0, 0, 480, layout.minimumHeight() + 250 });
|
||||
setGeometry({ 0, 0, 480, layout.minimumGeometry().height + 250 });
|
||||
append(layout);
|
||||
|
||||
synchronize();
|
||||
|
|
Loading…
Reference in New Issue