diff --git a/bsnes/phoenix/gtk/font.cpp b/bsnes/phoenix/gtk/font.cpp index 93bc0303..9f4f840b 100755 --- a/bsnes/phoenix/gtk/font.cpp +++ b/bsnes/phoenix/gtk/font.cpp @@ -29,4 +29,6 @@ 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); + font.setFamily("Sans"); + font.setSize(8); } diff --git a/bsnes/phoenix/gtk/gtk.cpp b/bsnes/phoenix/gtk/gtk.cpp index 5a30278d..de35e588 100755 --- a/bsnes/phoenix/gtk/gtk.cpp +++ b/bsnes/phoenix/gtk/gtk.cpp @@ -171,7 +171,7 @@ void pOS::initialize() { " GtkComboBox::appears-as-list = 1\n" " GtkTreeView::vertical-separator = 0\n" "}\n" - "class \"GtkComboBox\" style \"phoenix-gtk\"\n" + //"class \"GtkComboBox\" style \"phoenix-gtk\"\n" "class \"GtkTreeView\" style \"phoenix-gtk\"\n" ); } diff --git a/bsnes/phoenix/gtk/widget/button.cpp b/bsnes/phoenix/gtk/widget/button.cpp index 360ccedf..f657bb06 100755 --- a/bsnes/phoenix/gtk/widget/button.cpp +++ b/bsnes/phoenix/gtk/widget/button.cpp @@ -5,7 +5,7 @@ static void Button_tick(Button *self) { Geometry pButton::minimumGeometry() { Font &font = pWidget::font(); Geometry geometry = font.geometry(button.state.text); - return { 0, 0, geometry.width + 24, geometry.height + 14 }; + return { 0, 0, geometry.width + 24, geometry.height + 12 }; } void pButton::setText(const string &text) { diff --git a/bsnes/phoenix/gtk/widget/combo-box.cpp b/bsnes/phoenix/gtk/widget/combo-box.cpp index b8c65fa5..348e95d0 100755 --- a/bsnes/phoenix/gtk/widget/combo-box.cpp +++ b/bsnes/phoenix/gtk/widget/combo-box.cpp @@ -13,7 +13,7 @@ Geometry pComboBox::minimumGeometry() { foreach(item, comboBox.state.text) maximumWidth = max(maximumWidth, font.geometry(item).width); Geometry geometry = font.geometry(" "); - return { 0, 0, maximumWidth + 44, geometry.height + 10 }; + return { 0, 0, maximumWidth + 44, geometry.height + 12 }; } void pComboBox::reset() { diff --git a/bsnes/phoenix/gtk/window.cpp b/bsnes/phoenix/gtk/window.cpp index fb82baab..85beae54 100755 --- a/bsnes/phoenix/gtk/window.cpp +++ b/bsnes/phoenix/gtk/window.cpp @@ -211,6 +211,7 @@ void pWindow::setWidgetFont(Font &font) { } void pWindow::constructor() { + memset(&lastConfigure, 0, sizeof(GdkEventConfigure)); widget = gtk_window_new(GTK_WINDOW_TOPLEVEL); if(gdk_screen_is_composited(gdk_screen_get_default())) { diff --git a/bsnes/phoenix/qt/font.cpp b/bsnes/phoenix/qt/font.cpp index f9c7acb7..4dc21c4b 100755 --- a/bsnes/phoenix/qt/font.cpp +++ b/bsnes/phoenix/qt/font.cpp @@ -20,6 +20,8 @@ void pFont::setUnderline(bool underline) { update(); } void pFont::constructor() { qtFont = new QFont; + font.setFamily("Sans"); + font.setSize(8); } void pFont::update() { diff --git a/bsnes/phoenix/qt/qt.moc b/bsnes/phoenix/qt/qt.moc index 298a5ede..80c33bee 100755 --- a/bsnes/phoenix/qt/qt.moc +++ b/bsnes/phoenix/qt/qt.moc @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'qt.moc.hpp' ** -** Created: Mon Aug 8 00:07:23 2011 +** Created: Mon Aug 8 04:51:19 2011 ** by: The Qt Meta Object Compiler version 62 (Qt 4.7.0) ** ** WARNING! All changes made in this file will be lost! @@ -806,15 +806,16 @@ static const uint qt_meta_data_pListView[] = { // slots: signature, parameters, type, tag, flags 11, 10, 10, 10, 0x0a, - 24, 10, 10, 10, 0x0a, - 40, 35, 10, 10, 0x0a, + 29, 24, 10, 10, 0x0a, + 56, 24, 10, 10, 0x0a, 0 // eod }; static const char qt_meta_stringdata_pListView[] = { - "pListView\0\0onActivate()\0onChange()\0" - "item\0onTick(QTreeWidgetItem*)\0" + "pListView\0\0onActivate()\0item\0" + "onChange(QTreeWidgetItem*)\0" + "onTick(QTreeWidgetItem*)\0" }; const QMetaObject pListView::staticMetaObject = { @@ -849,7 +850,7 @@ int pListView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: onActivate(); break; - case 1: onChange(); break; + case 1: onChange((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; case 2: onTick((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; default: ; } diff --git a/bsnes/phoenix/qt/qt.moc.hpp b/bsnes/phoenix/qt/qt.moc.hpp index 0453363c..36416b46 100755 --- a/bsnes/phoenix/qt/qt.moc.hpp +++ b/bsnes/phoenix/qt/qt.moc.hpp @@ -426,7 +426,7 @@ public: public slots: void onActivate(); - void onChange(); + void onChange(QTreeWidgetItem *item); void onTick(QTreeWidgetItem *item); }; diff --git a/bsnes/phoenix/qt/widget/list-view.cpp b/bsnes/phoenix/qt/widget/list-view.cpp index 4b703d28..6566a94f 100755 --- a/bsnes/phoenix/qt/widget/list-view.cpp +++ b/bsnes/phoenix/qt/widget/list-view.cpp @@ -82,6 +82,7 @@ void pListView::setSelection(unsigned row) { locked = true; QTreeWidgetItem *item = qtListView->currentItem(); if(item) item->setSelected(false); + qtListView->setCurrentItem(0); auto items = qtListView->findItems("", Qt::MatchContains); for(unsigned n = 0; n < items.size(); n++) { if(items[n]->data(0, Qt::UserRole).toUInt() == row) { @@ -100,7 +101,7 @@ void pListView::constructor() { qtListView->setRootIsDecorated(false); connect(qtListView, SIGNAL(itemActivated(QTreeWidgetItem*, int)), SLOT(onActivate())); - connect(qtListView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(onChange())); + connect(qtListView, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(onChange(QTreeWidgetItem*))); connect(qtListView, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(onTick(QTreeWidgetItem*))); } @@ -108,7 +109,9 @@ void pListView::onActivate() { if(locked == false && listView.onActivate) listView.onActivate(); } -void pListView::onChange() { +void pListView::onChange(QTreeWidgetItem *item) { + //Qt bug workaround: clicking items with mouse does not mark items as selected + if(item) item->setSelected(true); listView.state.selected = selected(); if(listView.state.selected) listView.state.selection = selection(); if(locked == false && listView.onChange) listView.onChange(); diff --git a/bsnes/phoenix/windows/font.cpp b/bsnes/phoenix/windows/font.cpp index 60d417ee..4153cc65 100755 --- a/bsnes/phoenix/windows/font.cpp +++ b/bsnes/phoenix/windows/font.cpp @@ -46,4 +46,6 @@ void pFont::setUnderline(bool underline) { void pFont::constructor() { hfont = Font_createFont("Tahoma", 8, false, false, false); + font.setFamily("Tahoma"); + font.setSize(8); } diff --git a/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp b/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp index 0e114e09..cdf93056 100755 --- a/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp +++ b/bsnes/phoenix/windows/widget/horizontal-scroll-bar.cpp @@ -27,6 +27,7 @@ void pHorizontalScrollBar::setParent(Window &parent) { 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0 ); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&horizontalScrollBar); + unsigned position = horizontalScrollBar.state.position; setLength(horizontalScrollBar.state.length); - setPosition(horizontalScrollBar.state.position); + setPosition(position); } diff --git a/bsnes/phoenix/windows/widget/horizontal-slider.cpp b/bsnes/phoenix/windows/widget/horizontal-slider.cpp index c660be1e..5359921c 100755 --- a/bsnes/phoenix/windows/widget/horizontal-slider.cpp +++ b/bsnes/phoenix/windows/widget/horizontal-slider.cpp @@ -28,6 +28,7 @@ void pHorizontalSlider::setParent(Window &parent) { 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0 ); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&horizontalSlider); + unsigned position = horizontalSlider.state.position; setLength(horizontalSlider.state.length); - setPosition(horizontalSlider.state.position); + setPosition(position); } diff --git a/bsnes/phoenix/windows/widget/list-view.cpp b/bsnes/phoenix/windows/widget/list-view.cpp index 484193a1..92a4f751 100755 --- a/bsnes/phoenix/windows/widget/list-view.cpp +++ b/bsnes/phoenix/windows/widget/list-view.cpp @@ -13,8 +13,6 @@ void pListView::append(const lstring &list) { utf16_t wtext(text); ListView_SetItemText(hwnd, row, n, wtext); } - //workaround: when there is only one column, the horizontal scrollbar will always appear without this - if(listView.state.headerText.size() <= 1) ListView_SetColumnWidth(hwnd, 0, LVSCW_AUTOSIZE_USEHEADER); } void pListView::autoSizeColumns() { @@ -32,7 +30,6 @@ void pListView::modify(unsigned row, const lstring &list) { utf16_t wtext(text); ListView_SetItemText(hwnd, row, n, wtext); } - if(listView.state.headerText.size() <= 1) ListView_SetColumnWidth(hwnd, 0, LVSCW_AUTOSIZE_USEHEADER); } void pListView::reset() { @@ -110,6 +107,7 @@ void pListView::setSelection(unsigned row) { void pListView::constructor() { lostFocus = false; setParent(Window::None); + listView.setHeaderText(""); } void pListView::setGeometry(const Geometry &geometry) { diff --git a/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp b/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp index 3d763a51..991c9746 100755 --- a/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp +++ b/bsnes/phoenix/windows/widget/vertical-scroll-bar.cpp @@ -27,6 +27,7 @@ void pVerticalScrollBar::setParent(Window &parent) { 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0 ); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&verticalScrollBar); + unsigned position = verticalScrollBar.state.position; setLength(verticalScrollBar.state.length); - setPosition(verticalScrollBar.state.position); + setPosition(position); } diff --git a/bsnes/phoenix/windows/widget/vertical-slider.cpp b/bsnes/phoenix/windows/widget/vertical-slider.cpp index dc1a7a22..8fa8e569 100755 --- a/bsnes/phoenix/windows/widget/vertical-slider.cpp +++ b/bsnes/phoenix/windows/widget/vertical-slider.cpp @@ -28,6 +28,7 @@ void pVerticalSlider::setParent(Window &parent) { 0, 0, 0, 0, parent.p.hwnd, (HMENU)id, GetModuleHandle(0), 0 ); SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&verticalSlider); + unsigned position = verticalSlider.state.position; setLength(verticalSlider.state.length); - setPosition(verticalSlider.state.position); + setPosition(position); } diff --git a/bsnes/snes/snes.hpp b/bsnes/snes/snes.hpp index fad03203..b7583104 100755 --- a/bsnes/snes/snes.hpp +++ b/bsnes/snes/snes.hpp @@ -1,7 +1,7 @@ namespace SNES { namespace Info { static const char Name[] = "bsnes"; - static const char Version[] = "080.07"; + static const char Version[] = "080.08"; static const unsigned SerializerVersion = 21; } } diff --git a/bsnes/ui/general/file-browser.cpp b/bsnes/ui/general/file-browser.cpp index 601a6b0e..07587bf1 100755 --- a/bsnes/ui/general/file-browser.cpp +++ b/bsnes/ui/general/file-browser.cpp @@ -3,9 +3,7 @@ FileBrowser fileBrowser; void FileBrowser::create() { application.addWindow(this, "FileBrowser", "160,160"); - browseButton.setFont(application.proportionalFont); browseButton.setText("..."); - upButton.setFont(application.proportionalFont); upButton.setText(".."); const unsigned sq = browseButton.minimumGeometry().height; diff --git a/bsnes/ui/general/slot-loader.cpp b/bsnes/ui/general/slot-loader.cpp index 3fd53c88..93efc3f0 100755 --- a/bsnes/ui/general/slot-loader.cpp +++ b/bsnes/ui/general/slot-loader.cpp @@ -5,10 +5,8 @@ void SingleSlotLoader::create() { application.addWindow(this, "SingleSlotLoader", "160,160"); baseLabel.setText("Base:"); - baseBrowse.setFont(application.proportionalFont); baseBrowse.setText("..."); slotLabel.setText("Slot:"); - slotBrowse.setFont(application.proportionalFont); slotBrowse.setText("..."); okButton.setText("Ok"); @@ -100,13 +98,10 @@ void DoubleSlotLoader::create() { application.addWindow(this, "DoubleSlotLoader", "160,160"); baseLabel.setText("Base:"); - baseBrowse.setFont(application.proportionalFont); baseBrowse.setText("..."); slotALabel.setText("Slot A:"); - slotABrowse.setFont(application.proportionalFont); slotABrowse.setText("..."); slotBLabel.setText("Slot B:"); - slotBBrowse.setFont(application.proportionalFont); slotBBrowse.setText("..."); okButton.setText("Ok"); diff --git a/bsnes/ui/settings/input.cpp b/bsnes/ui/settings/input.cpp index 9cf4d51c..c008c676 100755 --- a/bsnes/ui/settings/input.cpp +++ b/bsnes/ui/settings/input.cpp @@ -39,15 +39,19 @@ void InputSettings::create() { controlLayout.append(customButton2, 100, 0, 5); controlLayout.append(customButton3, 100, 0, 5); controlLayout.append(spacer, ~0, 0); - controlLayout.append(clearButton, 100, 0); + controlLayout.append(clearButton, 80, 0); layout.append(controlLayout); settingsWindow.append(panelLayout); + clearButton.setEnabled(false); portBox.onChange = { &InputSettings::portChanged, this }; deviceBox.onChange = { &InputSettings::deviceChanged, this }; mappingList.onActivate = { &InputSettings::assignInput, this }; + mappingList.onChange = [this] { + clearButton.setEnabled(mappingList.selected()); + }; customButton1.onTick = [this]() { manualInput(1); }; customButton2.onTick = [this]() { manualInput(2); }; @@ -95,6 +99,7 @@ void InputSettings::deviceChanged() { mappingList.append(controller[i]->name, mapping); } mappingList.autoSizeColumns(); + clearButton.setEnabled(mappingList.selected()); locked = false; } diff --git a/bsnes/ui/tools/state-manager.cpp b/bsnes/ui/tools/state-manager.cpp index 1a39eab5..76520cfe 100755 --- a/bsnes/ui/tools/state-manager.cpp +++ b/bsnes/ui/tools/state-manager.cpp @@ -37,6 +37,11 @@ void StateManager::create() { void StateManager::synchronize() { descEdit.setText(""); descEdit.setEnabled(false); + + loadButton.setEnabled(stateList.selected()); + saveButton.setEnabled(stateList.selected()); + eraseButton.setEnabled(stateList.selected()); + if(stateList.selected() == false) return; if(slot[stateList.selection()].capacity() > 0) { descEdit.setText(slotLoadDescription(stateList.selection())); @@ -74,6 +79,7 @@ void StateManager::load() { } refresh(); + synchronize(); } void StateManager::save() {