mirror of https://github.com/bsnes-emu/bsnes.git
Update to v077r03 release.
byuu says: Fixed up the geometry calculation code. There is now minimumGeometry() [returns minimum size needed to display a layout, treats MaximumSize as MinimumSize], and minimumLayoutGeometry() [like minimumGeometry(), but it will return MaximumSize if a single container item has that attribute. Used mostly internally for layout sizing.] It looks great on Windows, but it looks visually off on Qt. Not exactly sure what's up there. When I make a test application, everything looks great. Going to have to clone a bsnes window that's having a problem (eg bsnes main debugger checkbox window), and see what's up.
This commit is contained in:
parent
396003e7f6
commit
2bf3dbf375
|
@ -1,5 +1,5 @@
|
||||||
void HorizontalLayout::append(VerticalLayout &layout, unsigned spacing) {
|
void HorizontalLayout::append(VerticalLayout &layout, unsigned spacing) {
|
||||||
children.append({ &layout, 0, 0, 0, spacing });
|
children.append({ &layout, 0, MinimumSize, MinimumSize, spacing });
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizontalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
|
void HorizontalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
|
||||||
|
@ -7,26 +7,81 @@ void HorizontalLayout::append(Widget &widget, unsigned width, unsigned height, u
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry HorizontalLayout::minimumGeometry() {
|
Geometry HorizontalLayout::minimumGeometry() {
|
||||||
|
unsigned width = 0, height = 0;
|
||||||
|
|
||||||
|
foreach(child, children) {
|
||||||
|
width += child.spacing;
|
||||||
|
if(child.width == MinimumSize || child.width == MaximumSize) {
|
||||||
|
if(child.layout) width += child.layout->minimumGeometry().width;
|
||||||
|
if(child.widget) width += child.widget->minimumGeometry().width;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
width += child.width;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(child, children) {
|
||||||
|
if(child.height == MinimumSize || child.height == MaximumSize) {
|
||||||
|
if(child.layout) height = max(height, child.layout->minimumGeometry().height);
|
||||||
|
if(child.widget) height = max(height, child.widget->minimumGeometry().height);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
height = max(height, child.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { 0, 0, margin * 2 + width, margin * 2 + height };
|
||||||
|
}
|
||||||
|
|
||||||
|
Geometry HorizontalLayout::minimumLayoutGeometry() {
|
||||||
|
unsigned width = 0, height = 0;
|
||||||
bool maximumWidth = false;
|
bool maximumWidth = false;
|
||||||
bool maximumHeight = false;
|
bool maximumHeight = false;
|
||||||
|
|
||||||
unsigned width = margin * 2;
|
|
||||||
unsigned height = margin * 2;
|
|
||||||
|
|
||||||
foreach(child, children) {
|
foreach(child, children) {
|
||||||
if(child.width == MaximumSize) maximumWidth = true;
|
if(child.width == MaximumSize) {
|
||||||
if(child.height == MaximumSize) maximumHeight = true;
|
maximumWidth = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(child.width != MaximumSize) width += child.width;
|
if(child.width == MinimumSize) {
|
||||||
if(child.height != MaximumSize) height = max(height, child.height);
|
if(child.layout) width += child.layout->minimumGeometry().width;
|
||||||
|
if(child.widget) width += child.widget->minimumGeometry().width;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
width += child.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
return { 0, 0, maximumWidth ? MaximumSize : width, maximumHeight ? MaximumSize : height };
|
foreach(child, children) {
|
||||||
|
if(child.height == MaximumSize) {
|
||||||
|
maximumHeight = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(child.height == MinimumSize) {
|
||||||
|
if(child.layout) height = max(height, child.layout->minimumGeometry().height);
|
||||||
|
if(child.widget) height = max(height, child.widget->minimumGeometry().height);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
height = max(height, child.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { 0, 0, maximumWidth ? MaximumSize : margin * 2 + width, maximumHeight ? MaximumSize : margin * 2 + height };
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizontalLayout::setGeometry(const Geometry &containerGeometry) {
|
void HorizontalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||||
setMinimumGeometry();
|
auto children = this->children;
|
||||||
setLayoutGeometry();
|
foreach(child, children) {
|
||||||
|
if(child.layout) {
|
||||||
|
child.width = child.layout->minimumLayoutGeometry().width;
|
||||||
|
child.height = child.layout->minimumLayoutGeometry().height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(child.widget) {
|
||||||
|
if(child.width == MinimumSize) child.width = child.widget->minimumGeometry().width;
|
||||||
|
if(child.height == MinimumSize) child.height = child.widget->minimumGeometry().height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Geometry geometry = containerGeometry;
|
Geometry geometry = containerGeometry;
|
||||||
geometry.x += margin;
|
geometry.x += margin;
|
||||||
|
@ -34,9 +89,6 @@ void HorizontalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||||
geometry.width -= margin * 2;
|
geometry.width -= margin * 2;
|
||||||
geometry.height -= margin * 2;
|
geometry.height -= margin * 2;
|
||||||
|
|
||||||
Geometry layoutGeometry = geometry;
|
|
||||||
auto children = this->children;
|
|
||||||
|
|
||||||
unsigned minimumWidth = 0, maximumWidthCounter = 0;
|
unsigned minimumWidth = 0, maximumWidthCounter = 0;
|
||||||
foreach(child, children) {
|
foreach(child, children) {
|
||||||
if(child.width == MaximumSize) maximumWidthCounter++;
|
if(child.width == MaximumSize) maximumWidthCounter++;
|
||||||
|
@ -64,30 +116,10 @@ void HorizontalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HorizontalLayout::setLayoutGeometry() {
|
|
||||||
foreach(child, children) {
|
|
||||||
if(child.layout) {
|
|
||||||
child.width = child.layout->minimumGeometry().width;
|
|
||||||
child.height = child.layout->minimumGeometry().height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HorizontalLayout::setMargin(unsigned margin) {
|
void HorizontalLayout::setMargin(unsigned margin) {
|
||||||
this->margin = margin;
|
this->margin = margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
void HorizontalLayout::setParent(Window &parent) {
|
||||||
foreach(child, children) {
|
foreach(child, children) {
|
||||||
if(child.layout) child.layout->setParent(parent);
|
if(child.layout) child.layout->setParent(parent);
|
||||||
|
|
|
@ -3,11 +3,10 @@ struct VerticalLayout;
|
||||||
struct HorizontalLayout : public Layout {
|
struct HorizontalLayout : public Layout {
|
||||||
void append(VerticalLayout &layout, unsigned spacing = 0);
|
void append(VerticalLayout &layout, unsigned spacing = 0);
|
||||||
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
|
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
|
||||||
|
Geometry minimumLayoutGeometry();
|
||||||
Geometry minimumGeometry();
|
Geometry minimumGeometry();
|
||||||
void setGeometry(const Geometry &geometry);
|
void setGeometry(const Geometry &geometry);
|
||||||
void setLayoutGeometry();
|
|
||||||
void setMargin(unsigned margin);
|
void setMargin(unsigned margin);
|
||||||
void setMinimumGeometry();
|
|
||||||
void setParent(Window &parent);
|
void setParent(Window &parent);
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
HorizontalLayout();
|
HorizontalLayout();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
void VerticalLayout::append(HorizontalLayout &layout, unsigned spacing) {
|
void VerticalLayout::append(HorizontalLayout &layout, unsigned spacing) {
|
||||||
children.append({ &layout, 0, 0, 0, spacing });
|
children.append({ &layout, 0, MinimumSize, MinimumSize, spacing });
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
|
void VerticalLayout::append(Widget &widget, unsigned width, unsigned height, unsigned spacing) {
|
||||||
|
@ -7,26 +7,81 @@ void VerticalLayout::append(Widget &widget, unsigned width, unsigned height, uns
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry VerticalLayout::minimumGeometry() {
|
Geometry VerticalLayout::minimumGeometry() {
|
||||||
|
unsigned width = 0, height = 0;
|
||||||
|
|
||||||
|
foreach(child, children) {
|
||||||
|
if(child.width == MinimumSize || child.width == MaximumSize) {
|
||||||
|
if(child.layout) width = max(width, child.layout->minimumGeometry().width);
|
||||||
|
if(child.widget) width = max(width, child.widget->minimumGeometry().width);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
width = max(width, child.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(child, children) {
|
||||||
|
height += child.spacing;
|
||||||
|
if(child.height == MinimumSize || child.height == MaximumSize) {
|
||||||
|
if(child.layout) height += child.layout->minimumGeometry().height;
|
||||||
|
if(child.widget) height += child.widget->minimumGeometry().height;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
height += child.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { 0, 0, margin * 2 + width, margin * 2 + height };
|
||||||
|
}
|
||||||
|
|
||||||
|
Geometry VerticalLayout::minimumLayoutGeometry() {
|
||||||
|
unsigned width = 0, height = 0;
|
||||||
bool maximumWidth = false;
|
bool maximumWidth = false;
|
||||||
bool maximumHeight = false;
|
bool maximumHeight = false;
|
||||||
|
|
||||||
unsigned width = margin * 2;
|
|
||||||
unsigned height = margin * 2;
|
|
||||||
|
|
||||||
foreach(child, children) {
|
foreach(child, children) {
|
||||||
if(child.width == MaximumSize) maximumWidth = true;
|
if(child.width == MaximumSize) {
|
||||||
if(child.height == MaximumSize) maximumHeight = true;
|
maximumWidth = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(child.width != MaximumSize) width = max(width, child.width);
|
if(child.width == MinimumSize) {
|
||||||
if(child.height != MaximumSize) height += child.height;
|
if(child.layout) width = max(width, child.layout->minimumGeometry().width);
|
||||||
|
if(child.widget) width = max(width, child.widget->minimumGeometry().width);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
width = max(width, child.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { 0, 0, maximumWidth ? MaximumSize : width, maximumHeight ? MaximumSize : height };
|
foreach(child, children) {
|
||||||
|
if(child.height == MaximumSize) {
|
||||||
|
maximumHeight = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(child.height == MinimumSize) {
|
||||||
|
if(child.layout) height += child.layout->minimumGeometry().height;
|
||||||
|
if(child.widget) height += child.widget->minimumGeometry().height;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
height += child.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { 0, 0, maximumWidth ? MaximumSize : margin * 2 + width, maximumHeight ? MaximumSize : margin * 2 + height };
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalLayout::setGeometry(const Geometry &containerGeometry) {
|
void VerticalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||||
setMinimumGeometry();
|
auto children = this->children;
|
||||||
setLayoutGeometry();
|
foreach(child, children) {
|
||||||
|
if(child.layout) {
|
||||||
|
child.width = child.layout->minimumLayoutGeometry().width;
|
||||||
|
child.height = child.layout->minimumLayoutGeometry().height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(child.widget) {
|
||||||
|
if(child.width == MinimumSize) child.width = child.widget->minimumGeometry().width;
|
||||||
|
if(child.height == MinimumSize) child.height = child.widget->minimumGeometry().height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Geometry geometry = containerGeometry;
|
Geometry geometry = containerGeometry;
|
||||||
geometry.x += margin;
|
geometry.x += margin;
|
||||||
|
@ -34,9 +89,6 @@ void VerticalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||||
geometry.width -= margin * 2;
|
geometry.width -= margin * 2;
|
||||||
geometry.height -= margin * 2;
|
geometry.height -= margin * 2;
|
||||||
|
|
||||||
Geometry layoutGeometry = geometry;
|
|
||||||
auto children = this->children;
|
|
||||||
|
|
||||||
unsigned minimumHeight = 0, maximumHeightCounter = 0;
|
unsigned minimumHeight = 0, maximumHeightCounter = 0;
|
||||||
foreach(child, children) {
|
foreach(child, children) {
|
||||||
if(child.height == MaximumSize) maximumHeightCounter++;
|
if(child.height == MaximumSize) maximumHeightCounter++;
|
||||||
|
@ -64,30 +116,10 @@ void VerticalLayout::setGeometry(const Geometry &containerGeometry) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerticalLayout::setLayoutGeometry() {
|
|
||||||
foreach(child, children) {
|
|
||||||
if(child.layout) {
|
|
||||||
child.width = child.layout->minimumGeometry().width;
|
|
||||||
child.height = child.layout->minimumGeometry().height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void VerticalLayout::setMargin(unsigned margin) {
|
void VerticalLayout::setMargin(unsigned margin) {
|
||||||
this->margin = margin;
|
this->margin = margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
void VerticalLayout::setParent(Window &parent) {
|
||||||
foreach(child, children) {
|
foreach(child, children) {
|
||||||
if(child.layout) child.layout->setParent(parent);
|
if(child.layout) child.layout->setParent(parent);
|
||||||
|
|
|
@ -4,10 +4,9 @@ struct VerticalLayout : public Layout {
|
||||||
void append(HorizontalLayout &layout, unsigned spacing = 0);
|
void append(HorizontalLayout &layout, unsigned spacing = 0);
|
||||||
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
|
void append(Widget &widget, unsigned width, unsigned height, unsigned spacing = 0);
|
||||||
Geometry minimumGeometry();
|
Geometry minimumGeometry();
|
||||||
|
Geometry minimumLayoutGeometry();
|
||||||
void setGeometry(const Geometry &geometry);
|
void setGeometry(const Geometry &geometry);
|
||||||
void setLayoutGeometry();
|
|
||||||
void setMargin(unsigned margin);
|
void setMargin(unsigned margin);
|
||||||
void setMinimumGeometry();
|
|
||||||
void setParent(Window &parent);
|
void setParent(Window &parent);
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
VerticalLayout();
|
VerticalLayout();
|
||||||
|
|
|
@ -5,7 +5,7 @@ static void HorizontalSlider_change(HorizontalSlider *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry pHorizontalSlider::minimumGeometry() {
|
Geometry pHorizontalSlider::minimumGeometry() {
|
||||||
return { 0, 0, 100, 20 };
|
return { 0, 0, 0, 20 };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned pHorizontalSlider::position() {
|
unsigned pHorizontalSlider::position() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Geometry pProgressBar::minimumGeometry() {
|
Geometry pProgressBar::minimumGeometry() {
|
||||||
return { 0, 0, 100, 25 };
|
return { 0, 0, 0, 25 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pProgressBar::setPosition(unsigned position) {
|
void pProgressBar::setPosition(unsigned position) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ static void VerticalSlider_change(VerticalSlider *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry pVerticalSlider::minimumGeometry() {
|
Geometry pVerticalSlider::minimumGeometry() {
|
||||||
return { 0, 0, 20, 100 };
|
return { 0, 0, 20, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned pVerticalSlider::position() {
|
unsigned pVerticalSlider::position() {
|
||||||
|
|
|
@ -12,7 +12,7 @@ Font& pWidget::font() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry pWidget::minimumGeometry() {
|
Geometry pWidget::minimumGeometry() {
|
||||||
return { 0, 0, 100, 25 };
|
return { 0, 0, 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
bool pWidget::enabled() {
|
bool pWidget::enabled() {
|
||||||
|
|
|
@ -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 Mar 21 22:59:16 2011
|
** Created: Wed Mar 23 03:03:27 2011
|
||||||
** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0)
|
** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0)
|
||||||
**
|
**
|
||||||
** WARNING! All changes made in this file will be lost!
|
** WARNING! All changes made in this file will be lost!
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Geometry pHorizontalSlider::minimumGeometry() {
|
Geometry pHorizontalSlider::minimumGeometry() {
|
||||||
return { 0, 0, 100, 20 };
|
return { 0, 0, 0, 20 };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned pHorizontalSlider::position() {
|
unsigned pHorizontalSlider::position() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Geometry pProgressBar::minimumGeometry() {
|
Geometry pProgressBar::minimumGeometry() {
|
||||||
return { 0, 0, 100, 25 };
|
return { 0, 0, 0, 25 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pProgressBar::setPosition(unsigned position) {
|
void pProgressBar::setPosition(unsigned position) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Geometry pVerticalSlider::minimumGeometry() {
|
Geometry pVerticalSlider::minimumGeometry() {
|
||||||
return { 0, 0, 20, 100 };
|
return { 0, 0, 20, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned pVerticalSlider::position() {
|
unsigned pVerticalSlider::position() {
|
||||||
|
|
|
@ -4,7 +4,7 @@ Font& pWidget::font() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry pWidget::minimumGeometry() {
|
Geometry pWidget::minimumGeometry() {
|
||||||
return { 0, 0, 100, 25 };
|
return { 0, 0, 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pWidget::setEnabled(bool enabled) {
|
void pWidget::setEnabled(bool enabled) {
|
||||||
|
|
|
@ -15,6 +15,10 @@ Geometry pFont::geometry(const string &text) {
|
||||||
return { 0, 0, rc.right, rc.bottom };
|
return { 0, 0, rc.right, rc.bottom };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned pFont::height() {
|
||||||
|
return geometry(" ").height;
|
||||||
|
}
|
||||||
|
|
||||||
void pFont::setBold(bool bold) {
|
void pFont::setBold(bool bold) {
|
||||||
if(hfont) { DeleteObject(hfont); hfont = 0; }
|
if(hfont) { DeleteObject(hfont); hfont = 0; }
|
||||||
hfont = Font_createFont(font.state.family, font.state.size, font.state.bold, font.state.italic, font.state.underline);
|
hfont = Font_createFont(font.state.family, font.state.size, font.state.bold, font.state.italic, font.state.underline);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Geometry pButton::minimumGeometry() {
|
Geometry pButton::minimumGeometry() {
|
||||||
Font &font = this->font();
|
Font &font = this->font();
|
||||||
Geometry geometry = font.geometry(button.state.text);
|
Geometry geometry = font.geometry(button.state.text);
|
||||||
return { 0, 0, geometry.width + 20, geometry.height + 12 };
|
return { 0, 0, geometry.width + 20, font.p.height() + 12 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pButton::setText(const string &text) {
|
void pButton::setText(const string &text) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ bool pCheckBox::checked() {
|
||||||
Geometry pCheckBox::minimumGeometry() {
|
Geometry pCheckBox::minimumGeometry() {
|
||||||
Font &font = this->font();
|
Font &font = this->font();
|
||||||
Geometry geometry = font.geometry(checkBox.state.text);
|
Geometry geometry = font.geometry(checkBox.state.text);
|
||||||
return { 0, 0, geometry.width + 20, geometry.height + 4 };
|
return { 0, 0, geometry.width + 20, font.p.height() + 4 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pCheckBox::setChecked(bool checked) {
|
void pCheckBox::setChecked(bool checked) {
|
||||||
|
|
|
@ -7,8 +7,7 @@ Geometry pComboBox::minimumGeometry() {
|
||||||
Font &font = this->font();
|
Font &font = this->font();
|
||||||
unsigned maximumWidth = 0;
|
unsigned maximumWidth = 0;
|
||||||
foreach(text, comboBox.state.text) maximumWidth = max(maximumWidth, font.geometry(text).width);
|
foreach(text, comboBox.state.text) maximumWidth = max(maximumWidth, font.geometry(text).width);
|
||||||
Geometry geometry = font.geometry(" ");
|
return { 0, 0, maximumWidth + 24, font.p.height() + 10 };
|
||||||
return { 0, 0, maximumWidth + 24, geometry.height + 10 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pComboBox::reset() {
|
void pComboBox::reset() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Geometry pHorizontalSlider::minimumGeometry() {
|
Geometry pHorizontalSlider::minimumGeometry() {
|
||||||
return { 0, 0, 100, 25 };
|
return { 0, 0, 0, 25 };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned pHorizontalSlider::position() {
|
unsigned pHorizontalSlider::position() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Geometry pLabel::minimumGeometry() {
|
Geometry pLabel::minimumGeometry() {
|
||||||
Font &font = this->font();
|
Font &font = this->font();
|
||||||
Geometry geometry = font.geometry(label.state.text);
|
Geometry geometry = font.geometry(label.state.text);
|
||||||
return { 0, 0, geometry.width, geometry.height };
|
return { 0, 0, geometry.width, font.p.height() };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pLabel::setText(const string &text) {
|
void pLabel::setText(const string &text) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Geometry pLineEdit::minimumGeometry() {
|
Geometry pLineEdit::minimumGeometry() {
|
||||||
Font &font = this->font();
|
Font &font = this->font();
|
||||||
Geometry geometry = font.geometry(lineEdit.state.text);
|
Geometry geometry = font.geometry(lineEdit.state.text);
|
||||||
return { 0, 0, geometry.width + 12, geometry.height + 8 };
|
return { 0, 0, geometry.width + 12, font.p.height() + 8 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pLineEdit::setEditable(bool editable) {
|
void pLineEdit::setEditable(bool editable) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Geometry pProgressBar::minimumGeometry() {
|
Geometry pProgressBar::minimumGeometry() {
|
||||||
return { 0, 0, 100, 25 };
|
return { 0, 0, 0, 25 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pProgressBar::setPosition(unsigned position) {
|
void pProgressBar::setPosition(unsigned position) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ bool pRadioBox::checked() {
|
||||||
Geometry pRadioBox::minimumGeometry() {
|
Geometry pRadioBox::minimumGeometry() {
|
||||||
Font &font = this->font();
|
Font &font = this->font();
|
||||||
Geometry geometry = font.geometry(radioBox.state.text);
|
Geometry geometry = font.geometry(radioBox.state.text);
|
||||||
return { 0, 0, geometry.width + 20, geometry.height + 4 };
|
return { 0, 0, geometry.width + 20, font.p.height() + 4 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pRadioBox::setChecked() {
|
void pRadioBox::setChecked() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Geometry pVerticalSlider::minimumGeometry() {
|
Geometry pVerticalSlider::minimumGeometry() {
|
||||||
return { 0, 0, 25, 100 };
|
return { 0, 0, 25, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned pVerticalSlider::position() {
|
unsigned pVerticalSlider::position() {
|
||||||
|
|
|
@ -8,7 +8,7 @@ Font& pWidget::font() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Geometry pWidget::minimumGeometry() {
|
Geometry pWidget::minimumGeometry() {
|
||||||
return { 0, 0, 100, 25 };
|
return { 0, 0, 0, 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
void pWidget::setEnabled(bool enabled) {
|
void pWidget::setEnabled(bool enabled) {
|
||||||
|
|
|
@ -38,6 +38,7 @@ struct pFont : public pObject {
|
||||||
HFONT hfont;
|
HFONT hfont;
|
||||||
|
|
||||||
Geometry geometry(const string &text);
|
Geometry geometry(const string &text);
|
||||||
|
unsigned height();
|
||||||
void setBold(bool bold);
|
void setBold(bool bold);
|
||||||
void setFamily(const string &family);
|
void setFamily(const string &family);
|
||||||
void setItalic(bool italic);
|
void setItalic(bool italic);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
namespace SNES {
|
namespace SNES {
|
||||||
namespace Info {
|
namespace Info {
|
||||||
static const char Name[] = "bsnes";
|
static const char Name[] = "bsnes";
|
||||||
static const char Version[] = "077.02";
|
static const char Version[] = "077.03";
|
||||||
static const unsigned SerializerVersion = 19;
|
static const unsigned SerializerVersion = 19;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ void Console::create() {
|
||||||
controlLayout.append(clearConsole, 120, 0 );
|
controlLayout.append(clearConsole, 120, 0 );
|
||||||
layout.append(controlLayout );
|
layout.append(controlLayout );
|
||||||
|
|
||||||
setGeometry({ 0, 0, layout.minimumGeometry().width + 580, 350 });
|
setGeometry({ 0, 0, layout.minimumGeometry().width + 585, 350 });
|
||||||
append(layout);
|
append(layout);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
|
|
|
@ -36,7 +36,7 @@ void Debugger::create() {
|
||||||
layout.append(showBreakpointEditor, ~0, 0);
|
layout.append(showBreakpointEditor, ~0, 0);
|
||||||
layout.append(showMemoryEditor, ~0, 0);
|
layout.append(showMemoryEditor, ~0, 0);
|
||||||
|
|
||||||
setGeometry({ 0, 0, 256, layout.minimumGeometry().height });
|
setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height });
|
||||||
append(layout);
|
append(layout);
|
||||||
|
|
||||||
//windows shown by default
|
//windows shown by default
|
||||||
|
|
|
@ -29,7 +29,7 @@ void BreakpointEditor::create() {
|
||||||
layout.append(breakpointLayout[n], 5);
|
layout.append(breakpointLayout[n], 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
setGeometry({ 0, 0, 310, layout.minimumGeometry().height });
|
setGeometry({ 0, 0, layout.minimumGeometry().width, layout.minimumGeometry().height });
|
||||||
append(layout);
|
append(layout);
|
||||||
|
|
||||||
onClose = []() {
|
onClose = []() {
|
||||||
|
|
Loading…
Reference in New Issue