X-Git-Url: http://git.draconx.ca/gitweb/liblbx.git/blobdiff_plain/7db3d5624cfb59506bc01339ac682c456266ac56..c02dcc9610e66ebe6154e60dcd2f109c90eb09df:/src/gui/lbxgui.c
diff --git a/src/gui/lbxgui.c b/src/gui/lbxgui.c
index be629fd..da03cfb 100644
--- a/src/gui/lbxgui.c
+++ b/src/gui/lbxgui.c
@@ -1,3 +1,21 @@
+/*
+ * 2ooM: The Master of Orion II Reverse Engineering Project
+ * Graphical tool for inspecting LBX archives.
+ * Copyright (C) 2010 Nick Bowler
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
#include
#include
#include
@@ -11,13 +29,15 @@
#include "bg.xbm"
+extern char lbxgui_xml[];
+
static GtkTreeStore *archives;
static GtkBuilder *builder;
static GtkWidget *canvas;
static GdkGC *bg_gc;
-static LBX_IMG *image;
+static LBXimg *image;
static GdkPixbuf *framebuf;
@@ -130,7 +150,7 @@ gboolean canvas_expose(GtkWidget *canvas, GdkEventExpose *event, gpointer data)
return TRUE;
}
-static int alloc_framebuffer(LBX_IMG *image)
+static int alloc_framebuffer(LBXimg *image)
{
struct lbx_imginfo info;
GtkSpinButton *spin;
@@ -157,11 +177,10 @@ static int close_image(void *handle)
return 0;
}
-static LBX_IMG *
-load_lbx_image(LBX *archive, unsigned index)
+static LBXimg *load_lbx_image(LBX *archive, unsigned index)
{
LBXfile *file;
- LBX_IMG *image;
+ LBXimg *image;
file = lbx_file_open(archive, index);
g_return_val_if_fail(file, NULL);
@@ -177,7 +196,7 @@ void set_override(GtkComboBox *combo)
GtkTreeIter iter;
gpointer lbx;
guint index;
- LBX_IMG *img;
+ LBXimg *img;
memset(palette_override, 0, sizeof palette_override);
if (!gtk_combo_box_get_active_iter(combo, &iter))
@@ -227,7 +246,7 @@ void set_image(GtkComboBox *combo)
GtkTreeIter iter;
gpointer lbx;
guint index;
- LBX_IMG *img;
+ LBXimg *img;
if (image) {
lbximg_close(image);
@@ -314,7 +333,7 @@ static int load_archive(const char *path)
for (unsigned i = 0; i < nfiles; i++) {
struct lbx_statbuf stat;
- lbx_stat(lbx, i, &stat);
+ lbx_file_stat(lbx, i, &stat);
gtk_tree_store_append(archives, &iter2, &iter1);
gtk_tree_store_set(archives, &iter2,
0, stat.name,
@@ -435,7 +454,7 @@ static void init_background(GdkDrawable *drawable)
bg_gc = gdk_gc_new(canvas->window);
- bitmap = gdk_bitmap_create_from_data(drawable, bg_bits,
+ bitmap = gdk_bitmap_create_from_data(drawable, (gchar *)bg_bits,
bg_width, bg_height);
gdk_gc_set_stipple(bg_gc, bitmap);
@@ -462,7 +481,7 @@ int main(int argc, char **argv)
load_archive(*argv++);
builder = gtk_builder_new();
- if (!gtk_builder_add_from_file(builder, "src/gui/lbxgui.glade", &err)) {
+ if (!gtk_builder_add_from_string(builder, lbxgui_xml, -1, &err)) {
fprintf(stderr, "%s\n", err->message);
return EXIT_FAILURE;
}