Update to v094r27 release.

byuu says:

Added AWJ's fixes for alt/cpu (Tetris Attack framelines issue) and
alt/dsp (Thread::clock reset)

Added fix so that the taskbar entry appears when the application first
starts on Windows.

Fixed checkbox toggling inside of list views on Windows.

Updated nall/image to properly protect variables that should not be
written externally.

New Object syntax for hiro is in.

Fixed the backwards-typing on Windows with the state manager.
NOTE: the list view isn't redrawing when you change the description
text. It does so on the cheat editor because of the resizeColumns call;
but that shouldn't be necessary. I'll try and fix this for the next WIP.
This commit is contained in:
Tim Allen
2015-06-18 20:48:53 +10:00
parent a21ff570ee
commit 20cc6148cb
62 changed files with 1580 additions and 1569 deletions

View File

@@ -11,22 +11,21 @@ static auto CreateColor(const Color& color) -> GdkColor {
}
#endif
static auto CreatePixbuf(const nall::image& image, bool scale = false) -> GdkPixbuf* {
if(!image) return nullptr;
static auto CreatePixbuf(image icon, bool scale = false) -> GdkPixbuf* {
if(!icon) return nullptr;
nall::image gdkImage = image;
gdkImage.transform(0, 32, 255u << 24, 255u << 0, 255u << 8, 255u << 16);
if(scale) gdkImage.scale(15, 15);
if(scale) icon.scale(15, 15);
icon.transform(0, 32, 255u << 24, 255u << 0, 255u << 8, 255u << 16); //GTK stores images in ABGR format
GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, gdkImage.width, gdkImage.height);
memcpy(gdk_pixbuf_get_pixels(pixbuf), gdkImage.data, gdkImage.width * gdkImage.height * 4);
auto pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, icon.width(), icon.height());
memory::copy(gdk_pixbuf_get_pixels(pixbuf), icon.data(), icon.size());
return pixbuf;
}
static auto CreateImage(const nall::image& image, bool scale = false) -> GtkImage* {
GdkPixbuf* pixbuf = CreatePixbuf(image, scale);
GtkImage* gtkImage = (GtkImage*)gtk_image_new_from_pixbuf(pixbuf);
auto pixbuf = CreatePixbuf(image, scale);
auto gtkImage = (GtkImage*)gtk_image_new_from_pixbuf(pixbuf);
g_object_unref(pixbuf);
return gtkImage;
}

View File

@@ -26,13 +26,13 @@ auto pButton::minimumSize() const -> Size {
Size size = pFont::size(self().font(true), state().text);
if(state().orientation == Orientation::Horizontal) {
size.setWidth(size.width() + state().icon.width);
size.setHeight(max(size.height(), state().icon.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().icon.width));
size.setHeight(size.height() + state().icon.height);
size.setWidth(max(size.width(), state().icon.width()));
size.setHeight(size.height() + state().icon.height());
}
return {size.width() + (state().text ? 24 : 12), size.height() + 12};

View File

@@ -174,14 +174,14 @@ auto pCanvas::_rasterize() -> void {
fill.gradient(
state().gradient[0].value(), state().gradient[1].value(), state().gradient[2].value(), state().gradient[3].value()
);
memory::copy(buffer, fill.data, fill.size);
memory::copy(buffer, fill.data(), fill.size());
}
if(mode == Mode::Icon) {
auto icon = state().icon;
icon.scale(width, height);
icon.transform(0, 32, 255u << 24, 255u << 16, 255u << 8, 255u << 0);
memory::copy(buffer, icon.data, icon.size);
icon.transform();
memory::copy(buffer, icon.data(), icon.size());
}
if(mode == Mode::Data) {

View File

@@ -29,13 +29,13 @@ auto pCheckButton::minimumSize() const -> Size {
Size size = pFont::size(self().font(true), state().text);
if(state().orientation == Orientation::Horizontal) {
size.setWidth(size.width() + state().icon.width);
size.setHeight(max(size.height(), state().icon.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().icon.width));
size.setHeight(size.height() + state().icon.height);
size.setWidth(max(size.width(), state().icon.width()));
size.setHeight(size.height() + state().icon.height());
}
return {size.width() + 24, size.height() + 12};

View File

@@ -224,7 +224,7 @@ auto pListView::_cellWidth(unsigned _row, unsigned _column) -> unsigned {
if(auto item = self().item(_row)) {
if(auto cell = item->cell(_column)) {
if(auto& icon = cell->state.icon) {
width += icon.width + 2;
width += icon.width() + 2;
}
if(auto& text = cell->state.text) {
width += Font::size(cell->font(true), text).width();
@@ -243,7 +243,7 @@ auto pListView::_columnWidth(unsigned _column) -> unsigned {
unsigned width = 8; //margin
if(auto column = self().column(_column)) {
if(auto& icon = column->state.icon) {
width += icon.width + 2;
width += icon.width() + 2;
}
if(auto& text = column->state.text) {
width += Font::size(column->font(true), text).width();

View File

@@ -30,13 +30,13 @@ auto pRadioButton::minimumSize() const -> Size {
Size size = pFont::size(self().font(true), state().text);
if(state().orientation == Orientation::Horizontal) {
size.setWidth(size.width() + state().icon.width);
size.setHeight(max(size.height(), state().icon.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().icon.width));
size.setHeight(size.height() + state().icon.height);
size.setWidth(max(size.width(), state().icon.width()));
size.setHeight(size.height() + state().icon.height());
}
return {size.width() + 24, size.height() + 12};

View File

@@ -369,9 +369,9 @@ auto pWindow::_setIcon(const string& pathname) -> bool {
filename = {pathname, Application::state.name, ".png"};
if(file::exists(filename)) {
//maximum image size GTK+ supports is 256x256; scale image down if necessary to prevent error
nall::image icon(filename);
icon.scale(min(256u, icon.width), min(256u, icon.height), true);
GdkPixbuf* pixbuf = CreatePixbuf(icon);
image icon(filename);
icon.scale(min(256u, icon.width()), min(256u, icon.height()), true);
auto pixbuf = CreatePixbuf(icon);
gtk_window_set_icon(GTK_WINDOW(widget), pixbuf);
g_object_unref(G_OBJECT(pixbuf));
return true;