Update to v106r56 release.

byuu says:

I fixed all outstanding bugs that I'm aware of, including all of the
errata I listed yesterday.

And now it's time for lots of regression testing.

After that, I need to add Talarubi's XAudio2 DRC code, and then get a
new public bsnes WIP out for final testing.

New errata: when setting an icon (nall::image) larger than a Canvas on
Windows, it's not centering the image, so you end up seeing the overscan
area in the state manager previews, and the bottom of the image gets cut
off. I also need to forcefully disable the Xlib screensaver disable
support. I think I'll remove the GUI option to bypass it as well, and
just force screensaver disable always on with Windows. I'll improve it
in the future to toggle the effect between emulator pauses.
This commit is contained in:
Tim Allen
2018-08-06 17:46:00 +10:00
parent b2b51d544f
commit 3b4e8b6d75
29 changed files with 318 additions and 267 deletions

View File

@@ -349,6 +349,8 @@ auto pWindow::setMaximized(bool maximized) -> void {
}
auto pWindow::setMaximumSize(Size size) -> void {
if(!state().resizable) size = state().geometry.size();
//TODO: this doesn't have any effect in GTK2 or GTK3
GdkGeometry geometry;
if(size.height()) size.setHeight(size.height() + _menuHeight() + _statusHeight());
@@ -367,8 +369,12 @@ auto pWindow::setMinimized(bool minimized) -> void {
}
auto pWindow::setMinimumSize(Size size) -> void {
gtk_widget_set_size_request(formContainer, size.width(), size.height()); //for GTK3
if(!state().resizable) size = state().geometry.size();
//for GTK3
gtk_widget_set_size_request(formContainer, size.width(), size.height());
//for GTK2
GdkGeometry geometry;
if(size.height()) size.setHeight(size.height() + _menuHeight() + _statusHeight());
geometry.min_width = !state().resizable ? state().geometry.width() : size.width() ? size.width() : 1;
@@ -400,6 +406,9 @@ auto pWindow::setResizable(bool resizable) -> void {
if(auto statusBar = state().statusBar) statusBarVisible = statusBar->visible();
gtk_window_set_has_resize_grip(GTK_WINDOW(widget), resizable && statusBarVisible);
#endif
setMaximumSize(state().maximumSize);
setMinimumSize(state().minimumSize);
}
auto pWindow::setTitle(const string& title) -> void {

View File

@@ -184,6 +184,16 @@ public slots:
};
#endif
#if defined(Hiro_Label)
struct QtLabel : public QWidget {
Q_OBJECT
public:
QtLabel(pLabel& p) : p(p) {}
auto paintEvent(QPaintEvent*) -> void;
pLabel& p;
};
#endif
#if defined(Hiro_LineEdit)
struct QtLineEdit : public QLineEdit {
Q_OBJECT

View File

@@ -954,6 +954,67 @@ int hiro::QtHorizontalSlider::qt_metacall(QMetaObject::Call _c, int _id, void **
}
return _id;
}
static const uint qt_meta_data_hiro__QtLabel[] = {
// content:
6, // 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_hiro__QtLabel[] = {
"hiro::QtLabel\0"
};
void hiro::QtLabel::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
Q_UNUSED(_o);
Q_UNUSED(_id);
Q_UNUSED(_c);
Q_UNUSED(_a);
}
const QMetaObjectExtraData hiro::QtLabel::staticMetaObjectExtraData = {
0, qt_static_metacall
};
const QMetaObject hiro::QtLabel::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_hiro__QtLabel,
qt_meta_data_hiro__QtLabel, &staticMetaObjectExtraData }
};
#ifdef Q_NO_DATA_RELOCATION
const QMetaObject &hiro::QtLabel::getStaticMetaObject() { return staticMetaObject; }
#endif //Q_NO_DATA_RELOCATION
const QMetaObject *hiro::QtLabel::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject;
}
void *hiro::QtLabel::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_hiro__QtLabel))
return static_cast<void*>(const_cast< QtLabel*>(this));
return QWidget::qt_metacast(_clname);
}
int hiro::QtLabel::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_hiro__QtLineEdit[] = {
// content:

View File

@@ -3,13 +3,10 @@
namespace hiro {
auto pLabel::construct() -> void {
qtWidget = qtLabel = new QLabel;
qtWidget = qtLabel = new QtLabel(*this);
pWidget::construct();
setAlignment(state().alignment);
setBackgroundColor(state().backgroundColor);
setForegroundColor(state().foregroundColor);
setText(state().text);
qtLabel->update();
}
auto pLabel::destruct() -> void {
@@ -23,29 +20,40 @@ auto pLabel::minimumSize() const -> Size {
}
auto pLabel::setAlignment(Alignment alignment) -> void {
if(!alignment) alignment = {0.0, 0.5};
qtLabel->setAlignment((Qt::Alignment)CalculateAlignment(alignment));
qtLabel->update();
}
auto pLabel::setBackgroundColor(Color color) -> void {
static auto defaultColor = qtLabel->palette().color(QPalette::Base);
qtLabel->update();
}
auto palette = qtLabel->palette();
palette.setColor(QPalette::Base, CreateColor(color, defaultColor));
qtLabel->setPalette(palette);
qtLabel->setAutoFillBackground((bool)color);
auto pLabel::setFont(const Font& font) -> void {
pWidget::setFont(font);
qtLabel->update();
}
auto pLabel::setForegroundColor(Color color) -> void {
static auto defaultColor = qtLabel->palette().color(QPalette::Text);
auto palette = qtLabel->palette();
palette.setColor(QPalette::Text, CreateColor(color, defaultColor));
qtLabel->setPalette(palette);
qtLabel->update();
}
auto pLabel::setText(const string& text) -> void {
qtLabel->setText(QString::fromUtf8(text));
qtLabel->update();
}
//QLabel ignores QPalette ... so we have to implement our own Label class atop QWidget ...
auto QtLabel::paintEvent(QPaintEvent* event) -> void {
QPainter painter(p.qtLabel);
if(auto& color = p.state().backgroundColor) {
painter.fillRect(event->rect(), CreateColor(color));
}
if(auto& text = p.state().text) {
if(auto& color = p.state().foregroundColor) {
QPen pen(CreateColor(color));
painter.setPen(pen);
}
auto alignment = p.state().alignment ? p.state().alignment : Alignment{0.0, 0.5};
painter.drawText(event->rect(), CalculateAlignment(alignment), QString::fromUtf8(text));
}
}
}

View File

@@ -8,10 +8,11 @@ struct pLabel : pWidget {
auto minimumSize() const -> Size override;
auto setAlignment(Alignment alignment) -> void;
auto setBackgroundColor(Color color) -> void;
auto setFont(const Font& font) -> void override;
auto setForegroundColor(Color color) -> void;
auto setText(const string& text) -> void;
QLabel* qtLabel = nullptr;
QtLabel* qtLabel = nullptr;
};
}

View File

@@ -54,9 +54,6 @@ auto pWidget::setFont(const Font& font) -> void {
auto pWidget::setGeometry(Geometry geometry) -> void {
if(!qtWidget) return;
// Position displacement = GetDisplacement(&widget);
// geometry.x -= displacement.x;
// geometry.y -= displacement.y;
qtWidget->setGeometry(geometry.x(), geometry.y(), geometry.width(), geometry.height());
self().doSize();
}
@@ -66,12 +63,6 @@ auto pWidget::setVisible(bool visible) -> void {
qtWidget->setVisible(visible);
}
//pWidget::constructor() called before p{Derived}::constructor(); ergo qtWidget is not yet valid
//pWidget::synchronizeState() is called to finish construction of p{Derived}::constructor()
//void pWidget::synchronizeState() {
// setFont(widget.font());
//}
}
#endif

View File

@@ -168,6 +168,7 @@ auto pWindow::setMaximized(bool maximized) -> void {
auto pWindow::setMaximumSize(Size size) -> void {
static auto maximumSize = qtWindow->maximumSize();
if(!state().resizable) size = state().geometry.size();
if(size) {
qtWindow->setMaximumSize(size.width(), size.height() + _menuHeight() + _statusHeight());
} else {
@@ -180,6 +181,7 @@ auto pWindow::setMinimized(bool minimized) -> void {
}
auto pWindow::setMinimumSize(Size size) -> void {
if(!state().resizable) size = state().geometry.size();
qtWindow->setMinimumSize(size.width(), size.height() + _menuHeight() + _statusHeight());
}
@@ -204,12 +206,15 @@ auto pWindow::setModal(bool modal) -> void {
auto pWindow::setResizable(bool resizable) -> void {
if(resizable) {
qtLayout->setSizeConstraint(QLayout::SetDefaultConstraint);
qtContainer->setMinimumSize(state().geometry.width(), state().geometry.height());
//qtContainer->setMinimumSize(state().geometry.width(), state().geometry.height());
} else {
qtLayout->setSizeConstraint(QLayout::SetFixedSize);
qtContainer->setFixedSize(state().geometry.width(), state().geometry.height());
//qtContainer->setFixedSize(state().geometry.width(), state().geometry.height());
}
qtStatusBar->setSizeGripEnabled(resizable);
setMaximumSize(state().maximumSize);
setMinimumSize(state().minimumSize);
}
auto pWindow::setTitle(const string& text) -> void {

View File

@@ -205,20 +205,6 @@ static auto CALLBACK Shared_windowProc(WindowProc windowProc, HWND hwnd, UINT ms
break;
}
case WM_DRAWITEM: {
auto drawItem = (LPDRAWITEMSTRUCT)lparam;
auto object = (mObject*)GetWindowLongPtr((HWND)drawItem->hwndItem, GWLP_USERDATA);
if(!object) break;
#if defined(Hiro_TabFrame)
if(auto tabFrame = dynamic_cast<mTabFrame*>(object)) {
return tabFrame->self()->onDrawItem(lparam), true;
}
#endif
break;
}
case WM_GETMINMAXINFO: {
auto info = (LPMINMAXINFO)lparam;
auto frameMargin = pWindow->frameMargin();

View File

@@ -105,45 +105,28 @@ auto pTabFrame::_buildImageList() -> void {
}
}
//hide all TabFrameItems, and then display the selected TabFrameItem
auto pTabFrame::_synchronizeSizable() -> void {
for(auto& item : state().items) {
if(auto& sizable = item->state.sizable) {
sizable->setVisible(item->selected());
}
if(auto& sizable = item->state.sizable) sizable->setVisible(false);
}
//without this call, widgets from the previous tab will remain visible
//alongside widgets from the newly selected tab for about one frame ...
Application::processEvents();
uint selected = TabCtrl_GetCurSel(hwnd);
if(auto item = self().item(selected)) {
if(auto& sizable = item->state.sizable) sizable->setVisible(true);
}
}
auto pTabFrame::onChange() -> void {
unsigned selected = TabCtrl_GetCurSel(hwnd);
uint selected = TabCtrl_GetCurSel(hwnd);
for(auto& item : state().items) item->state.selected = false;
if(auto item = self().item(selected)) item->state.selected = true;
_synchronizeSizable();
self().doChange();
}
//called only if TCS_OWNERDRAWFIXED style is used
//this style disables XP/Vista theming of the TabFrame
auto pTabFrame::onDrawItem(LPARAM lparam) -> void {
/*
auto item = (LPDRAWITEMSTRUCT)lparam;
FillRect(item->hDC, &item->rcItem, GetSysColorBrush(COLOR_3DFACE));
SetBkMode(item->hDC, TRANSPARENT);
SetTextColor(item->hDC, GetSysColor(COLOR_BTNTEXT));
unsigned selection = item->itemID;
if(selection < tabFrame.state.text.size()) {
string text = tabFrame.state.text[selection];
Size size = pFont::size(hfont, text);
unsigned width = item->rcItem.right - item->rcItem.left + 1;
if(tabFrame.state.image[selection]) {
width += size.height + 2;
ImageList_Draw(imageList, selection, item->hDC, item->rcItem.left + (width - size.width) / 2 - (size.height + 3), item->rcItem.top + 2, ILD_NORMAL);
}
TextOut(item->hDC, item->rcItem.left + (width - size.width) / 2, item->rcItem.top + 2, utf16_t(text), text.size());
}
*/
}
}
#endif

View File

@@ -13,7 +13,6 @@ struct pTabFrame : pWidget {
auto setVisible(bool visible) -> void override;
auto onChange() -> void;
auto onDrawItem(LPARAM lparam) -> void;
auto _buildImageList() -> void;
auto _synchronizeSizable() -> void;