mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-30 01:09:58 +02:00
Update to v106r55 release.
byuu says: Everything *should* be working again, but of course that won't actually be the case. Here's where things stand: - bsnes, higan, icarus, and genius compile and run fine on FreeBSD with GTK - ruby video and audio drivers are untested on Windows, macOS, and Linux - hiro is untested on macOS - bsnes' status bar is not showing up properly with hiro/qt - bsnes and higan's about screen is not showing up properly with hiro/qt (1x1 window size) - bsnes on Windows crashes often when saving states, and I'm not sure why ... it happens inside Encode::RLE - bsnes on Windows crashes with ruby.input.windows (unsure why) - bsnes on Windows fails to show the verified emblem on the status bar properly - hiro on Windows flickers when changing tabs To build the Windows bsnes and higan ports, use ruby="video.gdi audio.directsound" Compilation error logs for Linux will help me fix the inevitable list of typos there. I can fix the typos on other platforms, I just haven't gotten to it yet.
This commit is contained in:
@@ -4,7 +4,7 @@ namespace hiro {
|
||||
|
||||
auto pTableViewColumn::construct() -> void {
|
||||
@autoreleasepool {
|
||||
if(auto tableView = _grandparent()) {
|
||||
if(auto tableView = _parent()) {
|
||||
[tableView->cocoaView reloadColumns];
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ auto pTableViewColumn::construct() -> void {
|
||||
|
||||
auto pTableViewColumn::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
if(auto tableView = _grandparent()) {
|
||||
if(auto tableView = _parent()) {
|
||||
[tableView->cocoaView reloadColumns];
|
||||
}
|
||||
}
|
||||
@@ -43,20 +43,25 @@ auto pTableViewColumn::setHorizontalAlignment(double alignment) -> void {
|
||||
}
|
||||
|
||||
auto pTableViewColumn::setIcon(const image& icon) -> void {
|
||||
//TODO
|
||||
}
|
||||
|
||||
auto pTableViewColumn::setResizable(bool resizable) -> void {
|
||||
}
|
||||
|
||||
auto pTableViewColumn::setSortable(bool sortable) -> void {
|
||||
auto pTableViewColumn::setSorting(Sort sorting) -> void {
|
||||
setText(state().text);
|
||||
}
|
||||
|
||||
auto pTableViewColumn::setText(const string& text) -> void {
|
||||
@autoreleasepool {
|
||||
if(auto pTableView = _grandparent()) {
|
||||
NSTableColumn* tableColumn = [[pTableView->cocoaView content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:self().offset()] stringValue]];
|
||||
[[tableColumn headerCell] setStringValue:[NSString stringWithUTF8STring:text]];
|
||||
[[pTableView->cocoaView headerView] setNeedsDisplay:YES];
|
||||
if(auto parent = _parent()) {
|
||||
string label = text;
|
||||
if(state().sorting == Sort::Ascending ) label.append(" \u25b4");
|
||||
if(state().sorting == Sort::Descending) label.append(" \u25be");
|
||||
NSTableColumn* tableColumn = [[parent->cocoaView content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:self().offset()] stringValue]];
|
||||
[[tableColumn headerCell] setStringValue:[NSString stringWithUTF8STring:label]];
|
||||
[[parent->cocoaView headerView] setNeedsDisplay:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,16 +75,11 @@ auto pTableViewColumn::setVisible(bool visible) -> void {
|
||||
auto pTableViewColumn::setWidth(signed width) -> void {
|
||||
}
|
||||
|
||||
auto pTableViewColumn::_grandparent() -> maybe<pTableView&> {
|
||||
if(auto parent = _parent()) return parent->_parent();
|
||||
return nothing;
|
||||
}
|
||||
|
||||
auto pTableViewColumn::_parent() -> maybe<pTableViewHeader&> {
|
||||
auto pTableViewColumn::_parent() -> maybe<pTableView&> {
|
||||
if(auto parent = self().parentTableViewHeader()) {
|
||||
if(auto self = parent->self()) return *self;
|
||||
}
|
||||
return nothing;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -15,14 +15,13 @@ struct pTableViewColumn : pObject {
|
||||
auto setHorizontalAlignment(double) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setResizable(bool resizable) -> void;
|
||||
auto setSortable(bool sortable) -> void;
|
||||
auto setSorting(Sort sorting) -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
auto setVerticalAlignment(double) -> void;
|
||||
auto setVisible(bool visible) -> void override;
|
||||
auto setWidth(signed width) -> void;
|
||||
|
||||
auto _grandparent() -> maybe<pTableView&>;
|
||||
auto _parent() -> maybe<pTableViewHeader&>;
|
||||
auto _parent() -> maybe<pTableView&>;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -1,38 +0,0 @@
|
||||
#if defined(Hiro_TableView)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
auto pTableViewHeader::construct() -> void {
|
||||
}
|
||||
|
||||
auto pTableViewHeader::destruct() -> void {
|
||||
}
|
||||
|
||||
auto pTableViewHeader::append(sTableViewColumn column) -> void {
|
||||
}
|
||||
|
||||
auto pTableViewHeader::remove(sTableViewColumn column) -> void {
|
||||
}
|
||||
|
||||
auto pTableViewHeader::setVisible(bool visible) -> void {
|
||||
@autoreleasepool {
|
||||
if(auto pTableView = _parent()) {
|
||||
if(visible) {
|
||||
[[pTableView->cocoaView content] setHeaderView:[[[NSTableHeaderView alloc] init] autorelease]];
|
||||
} else {
|
||||
[[pTableView->cocoaView content] setHeaderView:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto pTableViewHeader::_parent() -> maybe<pTableView&> {
|
||||
if(auto parent = self().parentTableView()) {
|
||||
if(auto self = parent->self()) return *self;
|
||||
}
|
||||
return nothing;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,17 +0,0 @@
|
||||
#if defined(Hiro_TableView)
|
||||
|
||||
namespace hiro {
|
||||
|
||||
struct pTableViewHeader : pObject {
|
||||
Declare(TableViewHeader, Object)
|
||||
|
||||
auto append(sTableViewColumn column) -> void;
|
||||
auto remove(sTableViewColumn column) -> void;
|
||||
auto setVisible(bool visible) -> void override;
|
||||
|
||||
auto _parent() -> maybe<pTableView&>;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -267,6 +267,8 @@ auto pTableView::construct() -> void {
|
||||
setBordered(state().bordered);
|
||||
setFont(self().font(true));
|
||||
setForegroundColor(state().foregroundColor);
|
||||
setHeadered(state().headered);
|
||||
setSortable(state().sortable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,12 +279,10 @@ auto pTableView::destruct() -> void {
|
||||
}
|
||||
}
|
||||
|
||||
auto pTableView::append(sTableViewHeader header) -> void {
|
||||
auto pTableView::append(sTableViewColumn column) -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView reloadColumns];
|
||||
resizeColumns();
|
||||
|
||||
header->setVisible(header->visible());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ auto pTableView::append(sTableViewItem item) -> void {
|
||||
}
|
||||
}
|
||||
|
||||
auto pTableView::remove(sTableViewHeader header) -> void {
|
||||
auto pTableView::remove(sTableViewColumn column) -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView reloadColumns];
|
||||
resizeColumns();
|
||||
@@ -307,30 +307,28 @@ auto pTableView::remove(sTableViewItem item) -> void {
|
||||
|
||||
auto pTableView::resizeColumns() -> void {
|
||||
@autoreleasepool {
|
||||
if(auto& header = state().header) {
|
||||
vector<int> widths;
|
||||
int minimumWidth = 0;
|
||||
int expandable = 0;
|
||||
for(auto column : range(header->columnCount())) {
|
||||
int width = _width(column);
|
||||
widths.append(width);
|
||||
minimumWidth += width;
|
||||
if(header->column(column).expandable()) expandable++;
|
||||
}
|
||||
vector<int> widths;
|
||||
int minimumWidth = 0;
|
||||
int expandable = 0;
|
||||
for(uint column : range(self().columnCount())) {
|
||||
int width = _width(column);
|
||||
widths.append(width);
|
||||
minimumWidth += width;
|
||||
if(state().columns[column]->expandable()) expandable++;
|
||||
}
|
||||
|
||||
int maximumWidth = self().geometry().width() - 18; //include margin for vertical scroll bar
|
||||
int expandWidth = 0;
|
||||
if(expandable && maximumWidth > minimumWidth) {
|
||||
expandWidth = (maximumWidth - minimumWidth) / expandable;
|
||||
}
|
||||
int maximumWidth = self().geometry().width() - 18; //include margin for vertical scroll bar
|
||||
int expandWidth = 0;
|
||||
if(expandable && maximumWidth > minimumWidth) {
|
||||
expandWidth = (maximumWidth - minimumWidth) / expandable;
|
||||
}
|
||||
|
||||
for(auto column : range(header->columnCount())) {
|
||||
if(auto self = header->state.columns[column]->self()) {
|
||||
int width = widths[column];
|
||||
if(self->state().expandable) width += expandWidth;
|
||||
NSTableColumn* tableColumn = [[cocoaView content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:column] stringValue]];
|
||||
[tableColumn setWidth:width];
|
||||
}
|
||||
for(uint column : range(self().columnCount())) {
|
||||
if(auto self = state().columns[column]->self()) {
|
||||
int width = widths[column];
|
||||
if(self->state().expandable) width += expandWidth;
|
||||
NSTableColumn* tableColumn = [[cocoaView content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:column] stringValue]];
|
||||
[tableColumn setWidth:width];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -367,6 +365,17 @@ auto pTableView::setFont(const Font& font) -> void {
|
||||
auto pTableView::setForegroundColor(Color color) -> void {
|
||||
}
|
||||
|
||||
auto pTableView::setHeadered(bool headered) -> void {
|
||||
@autoreleasepool {
|
||||
if(headered == state().headered) return;
|
||||
if(headered) {
|
||||
[[pTableView->cocoaView content] setHeaderView:[[[NSTableHeaderView alloc] init] autorelease]];
|
||||
} else {
|
||||
[[pTableView->cocoaView content] setHeaderView:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto pTableView::_cellWidth(uint row, uint column) -> uint {
|
||||
uint width = 8;
|
||||
if(auto pTableViewItem = self().item(row)) {
|
||||
@@ -387,57 +396,32 @@ auto pTableView::_cellWidth(uint row, uint column) -> uint {
|
||||
|
||||
auto pTableView::_columnWidth(uint column) -> uint {
|
||||
uint width = 8;
|
||||
if(auto& header = state().header) {
|
||||
if(auto pTableViewColumn = header->column(column)) {
|
||||
if(auto& icon = pTableViewColumn->state.icon) {
|
||||
width += icon.width() + 2;
|
||||
}
|
||||
if(auto& text = pTableViewColumn->state.text) {
|
||||
width += pFont::size(pTableViewColumn->font(true), text).width();
|
||||
}
|
||||
if(auto column = self().column(column)) {
|
||||
if(auto& icon = column->state.icon) {
|
||||
width += icon.width() + 2;
|
||||
}
|
||||
if(auto& text = column->state.text) {
|
||||
width += pFont::size(column->font(true), text).width();
|
||||
}
|
||||
if(column->state.sorting != Sort::None) {
|
||||
width += 16;
|
||||
}
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
auto pTableView::_width(uint column) -> uint {
|
||||
if(auto& header = state().header) {
|
||||
if(auto width = header->column(column).width()) return width;
|
||||
uint width = 1;
|
||||
if(!header->column(column).visible()) return width;
|
||||
if(header->visible()) width = max(width, _columnWidth(column));
|
||||
for(auto row : range(state().items.size())) {
|
||||
width = max(width, _cellWidth(row, column));
|
||||
}
|
||||
return width;
|
||||
if(auto width = self().column(column).width()) return width;
|
||||
uint width = 1;
|
||||
if(!self().column(column).visible()) return width;
|
||||
if(state().headered) width = max(width, _columnWidth(column));
|
||||
for(auto row : range(state().items.size())) {
|
||||
width = max(width, _cellWidth(row, column));
|
||||
}
|
||||
return 1;
|
||||
return width;
|
||||
}
|
||||
|
||||
/*
|
||||
auto pTableView::autoSizeColumns() -> void {
|
||||
@autoreleasepool {
|
||||
if(tableView.state.checkable) {
|
||||
NSTableColumn* tableColumn = [[cocoaView content] tableColumnWithIdentifier:@"check"];
|
||||
[tableColumn setWidth:20.0];
|
||||
}
|
||||
|
||||
unsigned height = [[cocoaView content] rowHeight];
|
||||
for(unsigned column = 0; column < max(1u, tableView.state.headerText.size()); column++) {
|
||||
NSTableColumn* tableColumn = [[cocoaView content] tableColumnWithIdentifier:[[NSNumber numberWithInteger:column] stringValue]];
|
||||
unsigned minimumWidth = pFont::size([[tableColumn headerCell] font], tableView.state.headerText(column)).width + 4;
|
||||
for(unsigned row = 0; row < tableView.state.text.size(); row++) {
|
||||
unsigned width = pFont::size([cocoaView font], tableView.state.text(row)(column)).width + 2;
|
||||
if(tableView.state.image(row)(height)) width += height + 2;
|
||||
if(width > minimumWidth) minimumWidth = width;
|
||||
}
|
||||
[tableColumn setWidth:minimumWidth];
|
||||
}
|
||||
|
||||
[[cocoaView content] sizeLastColumnToFit];
|
||||
}
|
||||
}
|
||||
|
||||
auto pTableView::setSelected(bool selected) -> void {
|
||||
@autoreleasepool {
|
||||
if(selected == false) {
|
||||
|
@@ -46,9 +46,9 @@ namespace hiro {
|
||||
struct pTableView : pWidget {
|
||||
Declare(TableView, Widget)
|
||||
|
||||
auto append(sTableViewHeader header) -> void;
|
||||
auto append(sTableViewColumn column) -> void;
|
||||
auto append(sTableViewItem item) -> void;
|
||||
auto remove(sTableViewHeader header) -> void;
|
||||
auto remove(sTableViewColumn column) -> void;
|
||||
auto remove(sTableViewItem item) -> void;
|
||||
auto resizeColumns() -> void;
|
||||
auto setAlignment(Alignment alignment) -> void;
|
||||
@@ -58,6 +58,8 @@ struct pTableView : pWidget {
|
||||
auto setEnabled(bool enabled) -> void override;
|
||||
auto setFont(const Font& font) -> void override;
|
||||
auto setForegroundColor(Color color) -> void;
|
||||
auto setHeadered(bool headered) -> void;
|
||||
auto setSortable(bool sortable) -> void;
|
||||
|
||||
auto _cellWidth(uint row, uint column) -> uint;
|
||||
auto _columnWidth(uint column) -> uint;
|
||||
|
Reference in New Issue
Block a user