mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-31 01:40:01 +02:00
Update to 20160106 OS X Preview for Developers release.
byuu says: New update. Most of the work today went into eliminating hiro::Image from all objects in all ports, replacing with nall::image. That took an eternity. Changelog: - fixed crashing bug when loading games [thanks endrift!!] - toggling "show status bar" option adjusts window geometry (not supposed to recenter the window, though) - button sizes improved; icon-only button icons no longer being cut off
This commit is contained in:
@@ -27,7 +27,7 @@ auto pButton::construct() -> void {
|
||||
pWidget::construct();
|
||||
|
||||
setBordered(state().bordered);
|
||||
setImage(state().image);
|
||||
setIcon(state().icon);
|
||||
setOrientation(state().orientation);
|
||||
setText(state().text);
|
||||
}
|
||||
@@ -35,6 +35,7 @@ auto pButton::construct() -> void {
|
||||
|
||||
auto pButton::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
@@ -43,16 +44,16 @@ auto pButton::minimumSize() const -> Size {
|
||||
Size size = pFont::size(self().font(true), state().text);
|
||||
|
||||
if(state().orientation == Orientation::Horizontal) {
|
||||
size.setWidth(size.width() + state().image.width());
|
||||
size.setHeight(max(size.height(), state().image.height()));
|
||||
size.setWidth(size.width() + state().icon.width());
|
||||
size.setHeight(max(size.height(), state().icon.height()));
|
||||
}
|
||||
|
||||
if(state().orientation == Orientation::Vertical) {
|
||||
size.setWidth(max(size.width(), state().image.width()));
|
||||
size.setHeight(size.height() + state().image.height());
|
||||
size.setWidth(max(size.width(), state().icon.width()));
|
||||
size.setHeight(size.height() + state().icon.height());
|
||||
}
|
||||
|
||||
return {size.width() + (state().text ? 20 : 4), size.height() + 4};
|
||||
return {size.width() + (state().text ? 20 : 8), size.height() + 8};
|
||||
}
|
||||
|
||||
auto pButton::setBordered(bool bordered) -> void {
|
||||
@@ -65,14 +66,9 @@ auto pButton::setGeometry(Geometry geometry) -> void {
|
||||
});
|
||||
}
|
||||
|
||||
auto pButton::setImage(const Image& image) -> void {
|
||||
auto pButton::setIcon(const image& icon) -> void {
|
||||
@autoreleasepool {
|
||||
if(!image) {
|
||||
[cocoaView setImage:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
[cocoaView setImage:NSMakeImage(image)];
|
||||
[cocoaView setImage:NSMakeImage(icon)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@ struct pButton : pWidget {
|
||||
auto minimumSize() const -> Size override;
|
||||
auto setBordered(bool bordered) -> void;
|
||||
auto setGeometry(Geometry geometry) -> void override;
|
||||
auto setImage(const Image& image) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setOrientation(Orientation orientation) -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
||||
|
@@ -99,6 +99,7 @@ auto pCanvas::construct() -> void {
|
||||
|
||||
auto pCanvas::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
@@ -146,7 +147,7 @@ auto pCanvas::setGeometry(Geometry geometry) -> void {
|
||||
auto pCanvas::setGradient(Gradient gradient) -> void {
|
||||
}
|
||||
|
||||
auto pCanvas::setImage(const Image& image) -> void {
|
||||
auto pCanvas::setIcon(const image& icon) -> void {
|
||||
}
|
||||
|
||||
auto pCanvas::update() -> void {
|
||||
|
@@ -31,7 +31,7 @@ struct pCanvas : pWidget {
|
||||
auto setDroppable(bool droppable) -> void;
|
||||
auto setGeometry(Geometry geometry) -> void override;
|
||||
auto setGradient(Gradient gradient) -> void;
|
||||
auto setImage(const Image& image) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto update() -> void;
|
||||
|
||||
auto _rasterize() -> void;
|
||||
|
@@ -30,7 +30,7 @@ auto pCheckButton::construct() -> void {
|
||||
|
||||
setBordered(state().bordered);
|
||||
setChecked(state().checked);
|
||||
setImage(state().image);
|
||||
setIcon(state().icon);
|
||||
setOrientation(state().orientation);
|
||||
setText(state().text);
|
||||
}
|
||||
@@ -38,6 +38,7 @@ auto pCheckButton::construct() -> void {
|
||||
|
||||
auto pCheckButton::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
@@ -46,16 +47,16 @@ auto pCheckButton::minimumSize() const -> Size {
|
||||
Size size = pFont::size(self().font(true), state().text);
|
||||
|
||||
if(state().orientation == Orientation::Horizontal) {
|
||||
size.setWidth(size.width() + state().image.width());
|
||||
size.setHeight(max(size.height(), state().image.height()));
|
||||
size.setWidth(size.width() + state().icon.width());
|
||||
size.setHeight(max(size.height(), state().icon.height()));
|
||||
}
|
||||
|
||||
if(state().orientation == Orientation::Vertical) {
|
||||
size.setWidth(max(size.width(), state().image.width()));
|
||||
size.setHeight(size.height() + state().image.height());
|
||||
size.setWidth(max(size.width(), state().icon.width()));
|
||||
size.setHeight(size.height() + state().icon.height());
|
||||
}
|
||||
|
||||
return {size.width() + 20, size.height() + 4};
|
||||
return {size.width() + (state().text ? 20 : 8), size.height() + 8};
|
||||
}
|
||||
|
||||
auto pCheckButton::setBordered(bool bordered) -> void {
|
||||
@@ -74,14 +75,9 @@ auto pCheckButton::setGeometry(Geometry geometry) -> void {
|
||||
});
|
||||
}
|
||||
|
||||
auto pCheckButton::setImage(const Image& image) -> void {
|
||||
auto pCheckButton::setIcon(const image& icon) -> void {
|
||||
@autoreleasepool {
|
||||
if(!image) {
|
||||
[cocoaView setImage:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
[cocoaView setImage:NSMakeImage(image)];
|
||||
[cocoaView setImage:NSMakeImage(icon)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ struct pCheckButton : pWidget {
|
||||
auto setBordered(bool bordered) -> void;
|
||||
auto setChecked(bool checked) -> void;
|
||||
auto setGeometry(Geometry geometry) -> void override;
|
||||
auto setImage(const Image& image) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setOrientation(Orientation orientation) -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
||||
|
@@ -34,6 +34,7 @@ auto pCheckLabel::construct() -> void {
|
||||
|
||||
auto pCheckLabel::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ auto pComboButtonItem::construct() -> void {
|
||||
auto pComboButtonItem::destruct() -> void {
|
||||
}
|
||||
|
||||
auto pComboButtonItem::setImage(const Image& icon) -> void {
|
||||
auto pComboButtonItem::setIcon(const image& icon) -> void {
|
||||
}
|
||||
|
||||
auto pComboButtonItem::setSelected() -> void {
|
||||
|
@@ -5,7 +5,7 @@ namespace hiro {
|
||||
struct pComboButtonItem : pObject {
|
||||
Declare(ComboButtonItem, Object)
|
||||
|
||||
auto setImage(const Image& icon) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setSelected() -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
||||
|
@@ -30,6 +30,7 @@ auto pComboButton::construct() -> void {
|
||||
|
||||
auto pComboButton::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -36,6 +36,7 @@ void pConsole::constructor() {
|
||||
|
||||
void pConsole::destructor() {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ auto pFrame::construct() -> void {
|
||||
|
||||
auto pFrame::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ void pHexEdit::constructor() {
|
||||
|
||||
void pHexEdit::destructor() {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -66,6 +66,7 @@ auto pHorizontalScrollBar::construct() -> void {
|
||||
|
||||
auto pHorizontalScrollBar::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ auto pHorizontalSlider::construct() -> void {
|
||||
|
||||
auto pHorizontalSlider::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ auto pLabel::construct() -> void {
|
||||
|
||||
auto pLabel::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ auto pLineEdit::construct() -> void {
|
||||
|
||||
auto pLineEdit::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ auto pListViewCell::setChecked(bool checked) -> void {
|
||||
auto pListViewCell::setForegroundColor(Color color) -> void {
|
||||
}
|
||||
|
||||
auto pListViewCell::setImage(const Image& image) -> void {
|
||||
auto pListViewCell::setIcon(const image& icon) -> void {
|
||||
}
|
||||
|
||||
auto pListViewCell::setText(const string& text) -> void {
|
||||
|
@@ -10,7 +10,7 @@ struct pListViewCell : pObject {
|
||||
auto setCheckable(bool checkable) -> void;
|
||||
auto setChecked(bool checked) -> void;
|
||||
auto setForegroundColor(Color color) -> void;
|
||||
auto setImage(const Image& image) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
||||
auto _grandparent() -> maybe<pListView&>;
|
||||
|
@@ -42,7 +42,7 @@ auto pListViewColumn::setForegroundColor(Color color) -> void {
|
||||
auto pListViewColumn::setHorizontalAlignment(double alignment) -> void {
|
||||
}
|
||||
|
||||
auto pListViewColumn::setImage(const Image& image) -> void {
|
||||
auto pListViewColumn::setIcon(const image& icon) -> void {
|
||||
}
|
||||
|
||||
auto pListViewColumn::setResizable(bool resizable) -> void {
|
||||
|
@@ -13,7 +13,7 @@ struct pListViewColumn : pObject {
|
||||
auto setFont(const Font& font) -> void override;
|
||||
auto setForegroundColor(Color color) -> void;
|
||||
auto setHorizontalAlignment(double) -> void;
|
||||
auto setImage(const Image& image) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setResizable(bool resizable) -> void;
|
||||
auto setSortable(bool sortable) -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
@@ -177,8 +177,8 @@
|
||||
frame.size.width -= frame.size.height + 2;
|
||||
}
|
||||
|
||||
if(listViewCell->state.image) {
|
||||
NSImage* image = NSMakeImage(listViewCell->state.image, frame.size.height, frame.size.height);
|
||||
if(listViewCell->state.icon) {
|
||||
NSImage* image = NSMakeImage(listViewCell->state.icon, frame.size.height, frame.size.height);
|
||||
[[NSGraphicsContext currentContext] saveGraphicsState];
|
||||
NSRect targetRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.height, frame.size.height);
|
||||
NSRect sourceRect = NSMakeRect(0, 0, [image size].width, [image size].height);
|
||||
@@ -269,6 +269,7 @@ auto pListView::construct() -> void {
|
||||
|
||||
auto pListView::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
@@ -361,8 +362,8 @@ auto pListView::_cellWidth(uint row, uint column) -> uint {
|
||||
if(pListViewCell->state.checkable) {
|
||||
width += 24;
|
||||
}
|
||||
if(auto& image = pListViewCell->state.image) {
|
||||
width += image.width() + 2;
|
||||
if(auto& icon = pListViewCell->state.icon) {
|
||||
width += icon.width() + 2;
|
||||
}
|
||||
if(auto& text = pListViewCell->state.text) {
|
||||
width += pFont::size(pListViewCell->font(true), text).width();
|
||||
@@ -376,8 +377,8 @@ auto pListView::_columnWidth(uint column) -> uint {
|
||||
uint width = 8;
|
||||
if(auto& header = state().header) {
|
||||
if(auto pListViewColumn = header->column(column)) {
|
||||
if(auto& image = pListViewColumn->state.image) {
|
||||
width += image.width() + 2;
|
||||
if(auto& icon = pListViewColumn->state.icon) {
|
||||
width += icon.width() + 2;
|
||||
}
|
||||
if(auto& text = pListViewColumn->state.text) {
|
||||
width += pFont::size(pListViewColumn->font(true), text).width();
|
||||
|
@@ -28,6 +28,7 @@ auto pProgressBar::construct() -> void {
|
||||
|
||||
auto pProgressBar::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ auto pRadioButton::construct() -> void {
|
||||
|
||||
setBordered(state().bordered);
|
||||
if(state().checked) setChecked();
|
||||
setImage(state().image);
|
||||
setIcon(state().icon);
|
||||
setOrientation(state().orientation);
|
||||
setText(state().text);
|
||||
}
|
||||
@@ -39,6 +39,7 @@ auto pRadioButton::construct() -> void {
|
||||
|
||||
auto pRadioButton::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
@@ -47,16 +48,16 @@ auto pRadioButton::minimumSize() const -> Size {
|
||||
Size size = pFont::size(self().font(true), state().text);
|
||||
|
||||
if(state().orientation == Orientation::Horizontal) {
|
||||
size.setWidth(size.width() + state().image.width());
|
||||
size.setHeight(max(size.height(), state().image.height()));
|
||||
size.setWidth(size.width() + state().icon.width());
|
||||
size.setHeight(max(size.height(), state().icon.height()));
|
||||
}
|
||||
|
||||
if(state().orientation == Orientation::Vertical) {
|
||||
size.setWidth(max(size.width(), state().image.width()));
|
||||
size.setHeight(size.height() + state().image.height());
|
||||
size.setWidth(max(size.width(), state().icon.width()));
|
||||
size.setHeight(size.height() + state().icon.height());
|
||||
}
|
||||
|
||||
return {size.width() + 20, size.height() + 4};
|
||||
return {size.width() + (state().text ? 20 : 8), size.height() + 8};
|
||||
}
|
||||
|
||||
auto pRadioButton::setBordered(bool bordered) -> void {
|
||||
@@ -89,14 +90,9 @@ auto pRadioButton::setGeometry(Geometry geometry) -> void {
|
||||
auto pRadioButton::setGroup(sGroup group) -> void {
|
||||
}
|
||||
|
||||
auto pRadioButton::setImage(const Image& image) -> void {
|
||||
auto pRadioButton::setIcon(const image& icon) -> void {
|
||||
@autoreleasepool {
|
||||
if(!image) {
|
||||
[cocoaView setImage:nil];
|
||||
return;
|
||||
}
|
||||
|
||||
[cocoaView setImage:NSMakeImage(image)];
|
||||
[cocoaView setImage:NSMakeImage(icon)];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@ struct pRadioButton : pWidget {
|
||||
auto setChecked() -> void;
|
||||
auto setGeometry(Geometry geometry) -> void override;
|
||||
auto setGroup(sGroup group) -> void;
|
||||
auto setImage(const Image& image) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setOrientation(Orientation orientation) -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
||||
|
@@ -34,6 +34,7 @@ auto pRadioLabel::construct() -> void {
|
||||
|
||||
auto pRadioLabel::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ auto pTabFrameItem::remove(sLayout layout) -> void {
|
||||
auto pTabFrameItem::setClosable(bool closable) -> void {
|
||||
}
|
||||
|
||||
auto pTabFrameItem::setImage(const Image& image) -> void {
|
||||
auto pTabFrameItem::setIcon(const image& icon) -> void {
|
||||
}
|
||||
|
||||
auto pTabFrameItem::setMovable(bool movable) -> void {
|
||||
|
@@ -8,7 +8,7 @@ struct pTabFrameItem : pObject {
|
||||
auto append(sLayout layout) -> void;
|
||||
auto remove(sLayout layout) -> void;
|
||||
auto setClosable(bool closable) -> void;
|
||||
auto setImage(const Image& image) -> void;
|
||||
auto setIcon(const image& icon) -> void;
|
||||
auto setMovable(bool movable) -> void;
|
||||
auto setSelected() -> void;
|
||||
auto setText(const string& text) -> void;
|
||||
|
@@ -33,7 +33,7 @@
|
||||
int selection = [cocoaTabFrame indexOfTabViewItem:self];
|
||||
if(selection >= 0) {
|
||||
if(auto item = tabFrame->item(selection)) {
|
||||
if(item->state.image) {
|
||||
if(item->state.icon) {
|
||||
uint iconSize = hiro::pFont::size(tabFrame->font(true), " ").height();
|
||||
sizeOfLabel.width += iconSize + 2;
|
||||
}
|
||||
@@ -46,9 +46,9 @@
|
||||
int selection = [cocoaTabFrame indexOfTabViewItem:self];
|
||||
if(selection >= 0) {
|
||||
if(auto item = tabFrame->item(selection)) {
|
||||
if(item->state.image) {
|
||||
if(item->state.icon) {
|
||||
uint iconSize = hiro::pFont::size(tabFrame->font(true), " ").height();
|
||||
NSImage* image = NSMakeImage(item->state.image);
|
||||
NSImage* image = NSMakeImage(item->state.icon);
|
||||
|
||||
[[NSGraphicsContext currentContext] saveGraphicsState];
|
||||
NSRect targetRect = NSMakeRect(tabRect.origin.x, tabRect.origin.y + 2, iconSize, iconSize);
|
||||
@@ -78,6 +78,7 @@ auto pTabFrame::construct() -> void {
|
||||
|
||||
auto pTabFrame::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -59,6 +59,7 @@ auto pTextEdit::construct() -> void {
|
||||
|
||||
auto pTextEdit::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -66,6 +66,7 @@ auto pVerticalScrollBar::construct() -> void {
|
||||
|
||||
auto pVerticalScrollBar::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ auto pVerticalSlider::construct() -> void {
|
||||
|
||||
auto pVerticalSlider::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -48,6 +48,7 @@ auto pViewport::construct() -> void {
|
||||
|
||||
auto pViewport::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
@@ -21,18 +21,11 @@ auto pWidget::construct() -> void {
|
||||
|
||||
auto pWidget::destruct() -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView removeFromSuperview];
|
||||
[cocoaView release];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool pWidget::enabled() {
|
||||
@autoreleasepool {
|
||||
return [cocoaView respondsToSelector:@selector(enabled)] && [cocoaView enabled];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
auto pWidget::focused() const -> bool {
|
||||
@autoreleasepool {
|
||||
return cocoaView == [[cocoaView window] firstResponder];
|
||||
@@ -80,6 +73,14 @@ auto pWidget::setVisible(bool visible) -> void {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool pWidget::enabled() {
|
||||
@autoreleasepool {
|
||||
return [cocoaView respondsToSelector:@selector(enabled)] && [cocoaView enabled];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user