diff --git a/Makefile b/Makefile index fce9235..fc21db3 100644 --- a/Makefile +++ b/Makefile @@ -80,7 +80,7 @@ QEMU_INC=-I$(QEMU_INCDIR)/target-arm \ -I$(QEMU_INCDIR)/fpu \ -I$(QEMU_INCDIR)/arm-softmmu -X49GP_INCLUDES = -I./src/include \ +X49GP_INCLUDES = -I./src \ -I./src/bitmaps $(QEMU_INC) INCLUDES = $(GDB_INCLUDES) $(X49GP_INCLUDES) diff --git a/src/include/bitmap_font.h b/src/bitmap_font.h similarity index 100% rename from src/include/bitmap_font.h rename to src/bitmap_font.h diff --git a/src/bitmaps.h b/src/bitmaps.h new file mode 100644 index 0000000..e22923f --- /dev/null +++ b/src/bitmaps.h @@ -0,0 +1,21 @@ +/* $Id: bitmaps.h,v 1.9 2008/12/11 12:18:17 ecd Exp $ + */ + +#ifndef _X49GP_BITMAPS_H +#define _X49GP_BITMAPS_H 1 + +#include "bitmaps/ann_left.xbm" +#include "bitmaps/ann_right.xbm" +#include "bitmaps/ann_alpha.xbm" +#include "bitmaps/ann_battery.xbm" +#include "bitmaps/ann_busy.xbm" +#include "bitmaps/ann_io.xbm" + +#include "bitmaps/button_tiny.xbm" +#include "bitmaps/button_small.xbm" +#include "bitmaps/button_normal.xbm" +#include "bitmaps/button_large.xbm" +#include "bitmaps/button_round.xbm" +#include "bitmaps/button_round.pix" + +#endif /* !(_X49GP_BITMAPS_H) */ diff --git a/src/block-qcow.c b/src/block-qcow.c index 7522908..800c4e1 100644 --- a/src/block-qcow.c +++ b/src/block-qcow.c @@ -22,8 +22,8 @@ * THE SOFTWARE. */ #include "qemu-git/qemu-common.h" -#include "include/block.h" -#include "include/block_int.h" +#include "block.h" +#include "block_int.h" #include #if 0 #include "aes.h" diff --git a/src/block-raw.c b/src/block-raw.c index bc3c6cc..b991304 100644 --- a/src/block-raw.c +++ b/src/block-raw.c @@ -22,8 +22,8 @@ * THE SOFTWARE. */ #include "qemu-git/qemu-common.h" -#include "include/block.h" -#include "include/block_int.h" +#include "block.h" +#include "block_int.h" #include #ifndef _WIN32 diff --git a/src/block.c b/src/block.c index 5d90038..d4b865d 100644 --- a/src/block.c +++ b/src/block.c @@ -9,8 +9,8 @@ #include #include "qemu-git/qemu-common.h" -#include "include/block.h" -#include "include/block_int.h" +#include "block.h" +#include "block_int.h" #define SECTOR_BITS 9 #define SECTOR_SIZE (1 << SECTOR_BITS) diff --git a/src/include/block.h b/src/block.h similarity index 100% rename from src/include/block.h rename to src/block.h diff --git a/src/include/block_int.h b/src/block_int.h similarity index 92% rename from src/include/block_int.h rename to src/block_int.h index 581679a..abeec9c 100644 --- a/src/include/block_int.h +++ b/src/block_int.h @@ -1,8 +1,8 @@ /* * QEMU System Emulator block driver - * + * * Copyright (c) 2003 Fabrice Bellard - * + * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights @@ -24,17 +24,20 @@ #ifndef BLOCK_INT_H #define BLOCK_INT_H +# include "qemu-git/qemu-common.h" +# include "block.h" + struct BlockDriver { const char *format_name; int instance_size; int (*bdrv_probe)(const uint8_t *buf, int buf_size, const char *filename); int (*bdrv_open)(BlockDriverState *bs, const char *filename, int flags); - int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num, + int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors); - int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num, + int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); void (*bdrv_close)(BlockDriverState *bs); - int (*bdrv_create)(const char *filename, int64_t total_sectors, + int (*bdrv_create)(const char *filename, int64_t total_sectors, const char *backing_file, int flags); void (*bdrv_flush)(BlockDriverState *bs); int (*bdrv_is_allocated)(BlockDriverState *bs, int64_t sector_num, @@ -43,13 +46,13 @@ struct BlockDriver { int (*bdrv_make_empty)(BlockDriverState *bs); const char *protocol_name; - int (*bdrv_pread)(BlockDriverState *bs, int64_t offset, + int (*bdrv_pread)(BlockDriverState *bs, int64_t offset, uint8_t *buf, int count); - int (*bdrv_pwrite)(BlockDriverState *bs, int64_t offset, + int (*bdrv_pwrite)(BlockDriverState *bs, int64_t offset, const uint8_t *buf, int count); int (*bdrv_truncate)(BlockDriverState *bs, int64_t offset); int64_t (*bdrv_getlength)(BlockDriverState *bs); - int (*bdrv_write_compressed)(BlockDriverState *bs, int64_t sector_num, + int (*bdrv_write_compressed)(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi); @@ -59,7 +62,7 @@ struct BlockDriver { int (*bdrv_media_changed)(BlockDriverState *bs); int (*bdrv_eject)(BlockDriverState *bs, int eject_flag); int (*bdrv_set_locked)(BlockDriverState *bs, int locked); - + struct BlockDriver *next; }; @@ -90,7 +93,7 @@ struct BlockDriverState { /* async read/write emulation */ void *sync_aiocb; - + /* NOTE: the following infos are only hints for real hardware drivers. They are not used by the block driver */ int cyls, heads, secs, translation; diff --git a/src/include/byteorder.h b/src/byteorder.h similarity index 100% rename from src/include/byteorder.h rename to src/byteorder.h diff --git a/src/flash.c b/src/flash.c index 44fc379..2e3d766 100644 --- a/src/flash.c +++ b/src/flash.c @@ -15,9 +15,9 @@ #include #include -#include "include/x49gp.h" -#include "include/x49gp_ui.h" -#include "include/byteorder.h" +#include "x49gp.h" +#include "x49gp_ui.h" +#include "byteorder.h" #define FLASH_STATE_NORMAL 0 diff --git a/src/gdbstub.c b/src/gdbstub.c index 018d7a1..cb39e0f 100644 --- a/src/gdbstub.c +++ b/src/gdbstub.c @@ -29,7 +29,7 @@ #include #include -#include "include/x49gp.h" +#include "x49gp.h" #include "gdbstub.h" #define MAX_PACKET_LENGTH 4096 diff --git a/src/include/glyphname.h b/src/glyphname.h similarity index 100% rename from src/include/glyphname.h rename to src/glyphname.h diff --git a/src/include/bitmaps.h b/src/include/bitmaps.h deleted file mode 100644 index de8e25d..0000000 --- a/src/include/bitmaps.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $Id: bitmaps.h,v 1.9 2008/12/11 12:18:17 ecd Exp $ - */ - -#ifndef _X49GP_BITMAPS_H -#define _X49GP_BITMAPS_H 1 - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#endif /* !(_X49GP_BITMAPS_H) */ diff --git a/src/include/list.h b/src/list.h similarity index 100% rename from src/include/list.h rename to src/list.h diff --git a/src/main.c b/src/main.c index 894a139..d0b4268 100644 --- a/src/main.c +++ b/src/main.c @@ -17,12 +17,12 @@ #include -#include "include/x49gp.h" -#include "include/x49gp_ui.h" -#include "include/s3c2410.h" -#include "include/s3c2410_power.h" -#include "include/s3c2410_timer.h" -#include "include/x49gp_timer.h" +#include "x49gp.h" +#include "x49gp_ui.h" +#include "s3c2410.h" +#include "s3c2410_power.h" +#include "s3c2410_timer.h" +#include "x49gp_timer.h" #include "gdbstub.h" diff --git a/src/module.c b/src/module.c index 9d48e6a..ecc6ea7 100644 --- a/src/module.c +++ b/src/module.c @@ -9,7 +9,7 @@ #include #include -#include "include/x49gp.h" +#include "x49gp.h" int x49gp_modules_init(x49gp_t *x49gp) diff --git a/src/s3c2410.c b/src/s3c2410.c index ba01617..2a1674c 100644 --- a/src/s3c2410.c +++ b/src/s3c2410.c @@ -10,8 +10,8 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "s3c2410.h" /* * Boot SRAM: 0x40000000 diff --git a/src/include/s3c2410.h b/src/s3c2410.h similarity index 99% rename from src/include/s3c2410.h rename to src/s3c2410.h index e06ab49..bccbe36 100644 --- a/src/include/s3c2410.h +++ b/src/s3c2410.h @@ -4,7 +4,7 @@ #ifndef _X49GP_S3C2410_H #define _X49GP_S3C2410_H 1 -#include +#include "x49gp_types.h" typedef struct { const char *name; diff --git a/src/s3c2410_adc.c b/src/s3c2410_adc.c index 9e21474..ebd47f3 100644 --- a/src/s3c2410_adc.c +++ b/src/s3c2410_adc.c @@ -9,8 +9,8 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "s3c2410.h" typedef struct { diff --git a/src/s3c2410_arm.c b/src/s3c2410_arm.c index d820c4e..9e4ad2e 100644 --- a/src/s3c2410_arm.c +++ b/src/s3c2410_arm.c @@ -10,8 +10,8 @@ #include "qemu-git/target-arm/cpu.h" -#include "include/x49gp.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "s3c2410.h" #include "qemu-git/cpu-all.h" diff --git a/src/s3c2410_intc.c b/src/s3c2410_intc.c index 43ff9d0..e89a913 100644 --- a/src/s3c2410_intc.c +++ b/src/s3c2410_intc.c @@ -7,11 +7,11 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_intc.h" -#include "include/s3c2410_power.h" -#include "include/byteorder.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_intc.h" +#include "s3c2410_power.h" +#include "byteorder.h" extern int do_trace; diff --git a/src/include/s3c2410_intc.h b/src/s3c2410_intc.h similarity index 100% rename from src/include/s3c2410_intc.h rename to src/s3c2410_intc.h diff --git a/src/s3c2410_io_port.c b/src/s3c2410_io_port.c index 94ef903..5fee298 100644 --- a/src/s3c2410_io_port.c +++ b/src/s3c2410_io_port.c @@ -7,10 +7,10 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_intc.h" -#include "include/byteorder.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_intc.h" +#include "byteorder.h" typedef struct { diff --git a/src/s3c2410_lcd.c b/src/s3c2410_lcd.c index bafdb44..3ac63c6 100644 --- a/src/s3c2410_lcd.c +++ b/src/s3c2410_lcd.c @@ -11,9 +11,9 @@ #include -#include "include/x49gp.h" -#include "include/x49gp_ui.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "x49gp_ui.h" +#include "s3c2410.h" typedef struct { diff --git a/src/s3c2410_memc.c b/src/s3c2410_memc.c index d491403..95c89e6 100644 --- a/src/s3c2410_memc.c +++ b/src/s3c2410_memc.c @@ -9,8 +9,8 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "s3c2410.h" typedef struct { diff --git a/src/include/s3c2410_mmu.h b/src/s3c2410_mmu.h similarity index 100% rename from src/include/s3c2410_mmu.h rename to src/s3c2410_mmu.h diff --git a/src/s3c2410_nand.c b/src/s3c2410_nand.c index 6d9bf86..63f3ffb 100644 --- a/src/s3c2410_nand.c +++ b/src/s3c2410_nand.c @@ -9,8 +9,8 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "s3c2410.h" typedef struct { diff --git a/src/s3c2410_power.c b/src/s3c2410_power.c index 06c975f..2081b6c 100644 --- a/src/s3c2410_power.c +++ b/src/s3c2410_power.c @@ -9,9 +9,9 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_power.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_power.h" static const uint32_t EXTCLK = 12000000; diff --git a/src/include/s3c2410_power.h b/src/s3c2410_power.h similarity index 100% rename from src/include/s3c2410_power.h rename to src/s3c2410_power.h diff --git a/src/s3c2410_rtc.c b/src/s3c2410_rtc.c index 6e43101..a6c8918 100644 --- a/src/s3c2410_rtc.c +++ b/src/s3c2410_rtc.c @@ -10,9 +10,9 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_intc.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_intc.h" typedef struct { diff --git a/src/s3c2410_sdi.c b/src/s3c2410_sdi.c index b1d9159..7f7e3dc 100644 --- a/src/s3c2410_sdi.c +++ b/src/s3c2410_sdi.c @@ -10,10 +10,10 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "s3c2410.h" -#include "include/block.h" +#include "block.h" //#define DEBUG_S3C2410_SDI 1 diff --git a/src/s3c2410_spi.c b/src/s3c2410_spi.c index cc5945e..0958400 100644 --- a/src/s3c2410_spi.c +++ b/src/s3c2410_spi.c @@ -9,9 +9,9 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_intc.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_intc.h" typedef struct { diff --git a/src/s3c2410_sram.c b/src/s3c2410_sram.c index f8ae46d..7bca21c 100644 --- a/src/s3c2410_sram.c +++ b/src/s3c2410_sram.c @@ -9,9 +9,9 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/byteorder.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "byteorder.h" typedef struct { void *data; diff --git a/src/s3c2410_timer.c b/src/s3c2410_timer.c index eed1890..ce5f0c0 100644 --- a/src/s3c2410_timer.c +++ b/src/s3c2410_timer.c @@ -9,10 +9,10 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_timer.h" -#include "include/s3c2410_intc.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_timer.h" +#include "s3c2410_intc.h" typedef struct { diff --git a/src/include/s3c2410_timer.h b/src/s3c2410_timer.h similarity index 98% rename from src/include/s3c2410_timer.h rename to src/s3c2410_timer.h index 5fcfe25..9ad6d6d 100644 --- a/src/include/s3c2410_timer.h +++ b/src/s3c2410_timer.h @@ -4,7 +4,7 @@ #ifndef _S3C2410_TIMER_H #define _S3C2410_TIMER_H 1 -#include +#include "x49gp_types.h" #define TCFG0_DEAD_SHIFT 16 #define TCFG0_DEAD_MASK 0xff diff --git a/src/s3c2410_uart.c b/src/s3c2410_uart.c index e74ae7f..51c230e 100644 --- a/src/s3c2410_uart.c +++ b/src/s3c2410_uart.c @@ -9,9 +9,9 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_intc.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_intc.h" typedef struct { diff --git a/src/s3c2410_usbdev.c b/src/s3c2410_usbdev.c index 23b1640..8796929 100644 --- a/src/s3c2410_usbdev.c +++ b/src/s3c2410_usbdev.c @@ -9,8 +9,8 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "s3c2410.h" typedef struct { diff --git a/src/s3c2410_watchdog.c b/src/s3c2410_watchdog.c index 5510696..9714e9f 100644 --- a/src/s3c2410_watchdog.c +++ b/src/s3c2410_watchdog.c @@ -9,9 +9,9 @@ #include #include -#include "include/x49gp.h" -#include "include/s3c2410.h" -#include "include/s3c2410_intc.h" +#include "x49gp.h" +#include "s3c2410.h" +#include "s3c2410_intc.h" typedef struct { diff --git a/src/include/saturn.h b/src/saturn.h similarity index 100% rename from src/include/saturn.h rename to src/saturn.h diff --git a/src/sram.c b/src/sram.c index 62ec688..353885c 100644 --- a/src/sram.c +++ b/src/sram.c @@ -11,10 +11,10 @@ #include -#include "include/x49gp.h" -#include "include/byteorder.h" +#include "x49gp.h" +#include "byteorder.h" -#include "include/saturn.h" +#include "saturn.h" typedef struct { void *data; diff --git a/src/symbol.c b/src/symbol.c index 85016a7..b17d018 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -7,7 +7,7 @@ #include #include -#include "include/symbol.h" +#include "symbol.h" static const cairo_path_data_t symbol_square_path_data[] = { diff --git a/src/include/symbol.h b/src/symbol.h similarity index 100% rename from src/include/symbol.h rename to src/symbol.h diff --git a/src/timer.c b/src/timer.c index 43b157d..60d370b 100644 --- a/src/timer.c +++ b/src/timer.c @@ -16,9 +16,9 @@ #include -#include "include/x49gp.h" -#include "include/x49gp_timer.h" -#include "include/s3c2410.h" +#include "x49gp.h" +#include "x49gp_timer.h" +#include "s3c2410.h" #include "gdbstub.h" diff --git a/src/tiny_font.c b/src/tiny_font.c index f50c264..6dbce1f 100644 --- a/src/tiny_font.c +++ b/src/tiny_font.c @@ -3,7 +3,7 @@ #include -#include "include/bitmap_font.h" +#include "bitmap_font.h" #include "bitmaps/tiny_notdef.xbm" diff --git a/src/ui.c b/src/ui.c index 2d62c02..c95f9e6 100644 --- a/src/ui.c +++ b/src/ui.c @@ -18,13 +18,13 @@ #include #include -#include "include/x49gp.h" -#include "include/x49gp_ui.h" -#include "include/s3c2410.h" -#include "include/bitmaps.h" -#include "include/bitmap_font.h" -#include "include/symbol.h" -#include "include/glyphname.h" +#include "x49gp.h" +#include "x49gp_ui.h" +#include "s3c2410.h" +#include "bitmaps.h" +#include "bitmap_font.h" +#include "symbol.h" +#include "glyphname.h" #include "gdbstub.h" @@ -1541,11 +1541,11 @@ static void x49gp_ui_color_init( GdkColor* color, u8 red, u8 green, u8 blue ) static void x49gp_ui_style_init( GtkStyle* style, GtkWidget* widget, GdkColor* fg, GdkColor* bg ) { for ( int i = 0; i < 5; i++ ) { - style->fg[ i ] = *fg; - style->bg[ i ] = *bg; + style->fg[ i ] = *fg; + style->bg[ i ] = *bg; - style->text[ i ] = style->fg[ i ]; - style->base[ i ] = style->bg[ i ]; + style->text[ i ] = style->fg[ i ]; + style->base[ i ] = style->bg[ i ]; } style->xthickness = 0; @@ -1571,14 +1571,14 @@ static GdkPixbuf* x49gp_pixbuf_new_from_inline( gint data_length, const guint8* magic = ntohl( pbd->magic ); if ( magic != PIXBUF_MAGIC ) - return NULL; + return NULL; length = ntohl( pbd->length ); /* The data comes from a C string, which contains a trailing \0. */ /* This will be counted by sizeof(), but the embedded header */ /* specifies the true size. Compensate by adding 1 to it. */ if ( length + 1 != data_length ) - return NULL; + return NULL; width = ntohl( pbd->width ); height = ntohl( pbd->height ); @@ -1599,33 +1599,33 @@ static int x49gp_ui_button_pixmaps_init( x49gp_t* x49gp, x49gp_ui_button_t* butt x49gp_ui_style_init( style, button->button, &ui->colors[ button->key->color ], &ui->colors[ UI_COLOR_BLACK ] ); for ( int i = 0; i < 5; i++ ) { - style->bg_pixmap[ i ] = gdk_pixmap_new( ui->window->window, button->key->width, button->key->height, -1 ); + style->bg_pixmap[ i ] = gdk_pixmap_new( ui->window->window, button->key->width, button->key->height, -1 ); - if ( i == GTK_STATE_ACTIVE ) { - if ( color == UI_COLOR_SILVER ) { - src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y, - button->key->width, button->key->height ); - dst = gdk_pixbuf_copy( src ); - g_object_unref( src ); + if ( i == GTK_STATE_ACTIVE ) { + if ( color == UI_COLOR_SILVER ) { + src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y, + button->key->width, button->key->height ); + dst = gdk_pixbuf_copy( src ); + g_object_unref( src ); - src = x49gp_pixbuf_new_from_inline( sizeof( button_round ), button_round ); + src = x49gp_pixbuf_new_from_inline( sizeof( button_round ), button_round ); - gdk_pixbuf_composite( src, dst, 0, 0, button->key->width, button->key->height, 0.0, 0.0, 1.0, 1.0, GDK_INTERP_HYPER, 0xff ); + gdk_pixbuf_composite( src, dst, 0, 0, button->key->width, button->key->height, 0.0, 0.0, 1.0, 1.0, GDK_INTERP_HYPER, 0xff ); - g_object_unref( src ); - src = dst; - } else - src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y + 1, - button->key->width, button->key->height ); + g_object_unref( src ); + src = dst; + } else + src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y + 1, + button->key->width, button->key->height ); - } else - src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y, - button->key->width, button->key->height ); + } else + src = gdk_pixbuf_new_subpixbuf( ui->bg_pixbuf, ui->kb_x_offset + button->key->x, ui->kb_y_offset + button->key->y, + button->key->width, button->key->height ); - gdk_draw_pixbuf( style->bg_pixmap[ i ], ui->window->style->black_gc, src, 0, 0, 0, 0, button->key->width, button->key->height, - GDK_RGB_DITHER_NORMAL, 0, 0 ); + gdk_draw_pixbuf( style->bg_pixmap[ i ], ui->window->style->black_gc, src, 0, 0, 0, 0, button->key->width, button->key->height, + GDK_RGB_DITHER_NORMAL, 0, 0 ); - g_object_unref( src ); + g_object_unref( src ); } gtk_widget_set_style( button->button, style ); @@ -1640,57 +1640,57 @@ static void x49gp_ui_symbol_path( cairo_t* cr, double size, double xoffset, doub path = symbol->path; if ( NULL == path ) - return; + return; cairo_move_to( cr, xoffset, yoffset ); for ( int i = 0; i < path->num_data; i += path->data[ i ].header.length ) { - data = &path->data[ i ]; + data = &path->data[ i ]; - switch ( data->header.type ) { - case CAIRO_PATH_MOVE_TO: - cairo_rel_move_to( cr, size * data[ 1 ].point.x, -size * data[ 1 ].point.y ); - break; - case CAIRO_PATH_LINE_TO: - cairo_rel_line_to( cr, size * data[ 1 ].point.x, -size * data[ 1 ].point.y ); - break; - case CAIRO_PATH_CURVE_TO: - cairo_rel_curve_to( cr, size * data[ 1 ].point.x, -size * data[ 1 ].point.y, size * data[ 2 ].point.x, - -size * data[ 2 ].point.y, size * data[ 3 ].point.x, -size * data[ 3 ].point.y ); - break; - case CAIRO_PATH_CLOSE_PATH: - cairo_close_path( cr ); - break; - } + switch ( data->header.type ) { + case CAIRO_PATH_MOVE_TO: + cairo_rel_move_to( cr, size * data[ 1 ].point.x, -size * data[ 1 ].point.y ); + break; + case CAIRO_PATH_LINE_TO: + cairo_rel_line_to( cr, size * data[ 1 ].point.x, -size * data[ 1 ].point.y ); + break; + case CAIRO_PATH_CURVE_TO: + cairo_rel_curve_to( cr, size * data[ 1 ].point.x, -size * data[ 1 ].point.y, size * data[ 2 ].point.x, + -size * data[ 2 ].point.y, size * data[ 3 ].point.x, -size * data[ 3 ].point.y ); + break; + case CAIRO_PATH_CLOSE_PATH: + cairo_close_path( cr ); + break; + } } } static void x49gp_ui_draw_symbol( cairo_t* cr, GdkColor* color, double size, double line_width, gboolean fill, double xoffset, - double yoffset, const x49gp_symbol_t* symbol ) + double yoffset, const x49gp_symbol_t* symbol ) { cairo_set_line_cap( cr, CAIRO_LINE_CAP_BUTT ); cairo_set_line_join( cr, CAIRO_LINE_JOIN_MITER ); cairo_set_line_width( cr, line_width ); cairo_set_source_rgb( cr, ( ( double )color->red ) / 65535.0, ( ( double )color->green ) / 65535.0, - ( ( double )color->blue ) / 65535.0 ); + ( ( double )color->blue ) / 65535.0 ); x49gp_ui_symbol_path( cr, size, xoffset, yoffset, symbol ); if ( fill ) - cairo_fill( cr ); + cairo_fill( cr ); else - cairo_stroke( cr ); + cairo_stroke( cr ); } static int x49gp_ui_lookup_glyph( const char* name, int namelen, gunichar* glyph ) { for ( int i = 0; i < NR_GLYPHNAMES; i++ ) { - if ( ( strlen( x49gp_glyphs[ i ].name ) == namelen ) && !strncmp( x49gp_glyphs[ i ].name, name, namelen ) ) { - if ( glyph ) - *glyph = x49gp_glyphs[ i ].unichar; + if ( ( strlen( x49gp_glyphs[ i ].name ) == namelen ) && !strncmp( x49gp_glyphs[ i ].name, name, namelen ) ) { + if ( glyph ) + *glyph = x49gp_glyphs[ i ].unichar; - return 1; - } + return 1; + } } return 0; @@ -1705,43 +1705,43 @@ static int x49gp_text_strlen( const char* text ) p = text; while ( ( c = *p++ ) ) { - if ( c != '\\' ) { - n++; - continue; - } + if ( c != '\\' ) { + n++; + continue; + } - q = p; - while ( *q ) { - if ( ( *q == '\\' ) || ( *q == ' ' ) ) - break; - q++; - } - if ( q == p ) { - n++; - p++; - continue; - } - namelen = q - p; - if ( *q == ' ' ) - q++; + q = p; + while ( *q ) { + if ( ( *q == '\\' ) || ( *q == ' ' ) ) + break; + q++; + } + if ( q == p ) { + n++; + p++; + continue; + } + namelen = q - p; + if ( *q == ' ' ) + q++; - if ( symbol_lookup_glyph_by_name( p, namelen, NULL ) ) { - p = q; - n++; - continue; - } + if ( symbol_lookup_glyph_by_name( p, namelen, NULL ) ) { + p = q; + n++; + continue; + } - if ( x49gp_ui_lookup_glyph( p, namelen, NULL ) ) { - p = q; - n++; - continue; - } + if ( x49gp_ui_lookup_glyph( p, namelen, NULL ) ) { + p = q; + n++; + continue; + } - /* - * Insert symbol .notdef here... - */ - p = q; - n++; + /* + * Insert symbol .notdef here... + */ + p = q; + n++; } return n; @@ -1758,7 +1758,7 @@ static int x49gp_text_to_ucs4( const char* text, gunichar** ucs4p ) int n = x49gp_text_strlen( text ); if ( n <= 0 ) - return n; + return n; ucs4 = malloc( n * sizeof( gunichar ) ); @@ -1766,47 +1766,47 @@ static int x49gp_text_to_ucs4( const char* text, gunichar** ucs4p ) p = text; while ( ( c = *p++ ) ) { - if ( i == n ) { - free( ucs4 ); - return -1; - } + if ( i == n ) { + free( ucs4 ); + return -1; + } - if ( c != '\\' ) { - ucs4[ i++ ] = c; - continue; - } + if ( c != '\\' ) { + ucs4[ i++ ] = c; + continue; + } - q = p; - while ( *q ) { - if ( ( *q == '\\' ) || ( *q == ' ' ) ) - break; - q++; - } - if ( q == p ) { - ucs4[ i++ ] = *p++; - continue; - } - namelen = q - p; - if ( *q == ' ' ) - q++; + q = p; + while ( *q ) { + if ( ( *q == '\\' ) || ( *q == ' ' ) ) + break; + q++; + } + if ( q == p ) { + ucs4[ i++ ] = *p++; + continue; + } + namelen = q - p; + if ( *q == ' ' ) + q++; - if ( symbol_lookup_glyph_by_name( p, namelen, &glyph ) ) { - ucs4[ i++ ] = glyph; - p = q; - continue; - } + if ( symbol_lookup_glyph_by_name( p, namelen, &glyph ) ) { + ucs4[ i++ ] = glyph; + p = q; + continue; + } - if ( x49gp_ui_lookup_glyph( p, namelen, &glyph ) ) { - ucs4[ i++ ] = glyph; - p = q; - continue; - } + if ( x49gp_ui_lookup_glyph( p, namelen, &glyph ) ) { + ucs4[ i++ ] = glyph; + p = q; + continue; + } - /* - * Insert symbol .notdef here... - */ - ucs4[ i++ ] = 0xe000; - p = q; + /* + * Insert symbol .notdef here... + */ + ucs4[ i++ ] = 0xe000; + p = q; } *ucs4p = ucs4; @@ -1827,61 +1827,61 @@ static void x49gp_ui_vtext_path( cairo_t* cr, const char* family, double size, d int len; for ( int i = 0; i < n; i++ ) { - slant = va_arg( ap, cairo_font_slant_t ); - weight = va_arg( ap, cairo_font_weight_t ); - text = va_arg( ap, const char* ); + slant = va_arg( ap, cairo_font_slant_t ); + weight = va_arg( ap, cairo_font_weight_t ); + text = va_arg( ap, const char* ); - cairo_select_font_face( cr, family, slant, weight ); - cairo_set_font_size( cr, size ); + cairo_select_font_face( cr, family, slant, weight ); + cairo_set_font_size( cr, size ); - ucs4 = NULL; - len = x49gp_text_to_ucs4( text, &ucs4 ); - if ( len <= 0 ) - continue; + ucs4 = NULL; + len = x49gp_text_to_ucs4( text, &ucs4 ); + if ( len <= 0 ) + continue; - for ( int j = 0; j < len; j++ ) { - if ( g_unichar_type( ucs4[ j ] ) == G_UNICODE_PRIVATE_USE ) { - /* - * Draw Symbol, Increment x... - */ - symbol = symbol_get_by_glyph( ucs4[ j ] ); - if ( NULL == symbol ) - symbol = symbol_get_by_glyph( 0xe000 ); + for ( int j = 0; j < len; j++ ) { + if ( g_unichar_type( ucs4[ j ] ) == G_UNICODE_PRIVATE_USE ) { + /* + * Draw Symbol, Increment x... + */ + symbol = symbol_get_by_glyph( ucs4[ j ] ); + if ( NULL == symbol ) + symbol = symbol_get_by_glyph( 0xe000 ); - size *= symbol->prescale; + size *= symbol->prescale; - x49gp_ui_symbol_path( cr, size, x, y, symbol ); + x49gp_ui_symbol_path( cr, size, x, y, symbol ); - x += size * symbol->x_advance; - y -= size * symbol->y_advance; + x += size * symbol->x_advance; + y -= size * symbol->y_advance; - size *= symbol->postscale; + size *= symbol->postscale; - if ( symbol->prescale * symbol->postscale != 1. ) - cairo_set_font_size( cr, size ); + if ( symbol->prescale * symbol->postscale != 1. ) + cairo_set_font_size( cr, size ); - continue; - } + continue; + } - bytes = g_unichar_to_utf8( ucs4[ j ], out ); - out[ bytes ] = '\0'; + bytes = g_unichar_to_utf8( ucs4[ j ], out ); + out[ bytes ] = '\0'; - cairo_text_extents( cr, out, &extents ); + cairo_text_extents( cr, out, &extents ); - cairo_move_to( cr, x, y ); + cairo_move_to( cr, x, y ); - cairo_text_path( cr, out ); + cairo_text_path( cr, out ); - x += extents.x_advance; - y += extents.y_advance; - } + x += extents.x_advance; + y += extents.y_advance; + } - free( ucs4 ); + free( ucs4 ); } } static void x49gp_ui_text_size( cairo_t* cr, const char* family, double size, double* x_bearing, double* y_bearing, double* width, - double* height, double* ascent, double* descent, int n, ... ) + double* height, double* ascent, double* descent, int n, ... ) { va_list ap0, ap1; cairo_font_extents_t font_extents; @@ -1891,7 +1891,7 @@ static void x49gp_ui_text_size( cairo_t* cr, const char* family, double size, do const char* text; if ( n < 1 ) - return; + return; va_start( ap0, n ); va_copy( ap1, ap0 ); @@ -1903,30 +1903,30 @@ static void x49gp_ui_text_size( cairo_t* cr, const char* family, double size, do cairo_fill_extents( cr, &x1, &y1, &x2, &y2 ); if ( y2 < 0.0 ) - y2 = 0.0; + y2 = 0.0; a = 0.0; d = 0.0; for ( int i = 0; i < n; i++ ) { - slant = va_arg( ap1, cairo_font_slant_t ); - weight = va_arg( ap1, cairo_font_weight_t ); - text = va_arg( ap1, const char* ); - ( void )text; + slant = va_arg( ap1, cairo_font_slant_t ); + weight = va_arg( ap1, cairo_font_weight_t ); + text = va_arg( ap1, const char* ); + ( void )text; - cairo_select_font_face( cr, family, slant, weight ); - cairo_set_font_size( cr, size ); + cairo_select_font_face( cr, family, slant, weight ); + cairo_set_font_size( cr, size ); - cairo_font_extents( cr, &font_extents ); + cairo_font_extents( cr, &font_extents ); - /* - * Cairo seems to return overall height in ascent, - * so fix this by calculating ascent = height - descent. - */ - if ( font_extents.ascent - font_extents.descent > a ) - a = font_extents.ascent - font_extents.descent; - if ( font_extents.descent > -d ) - d = -font_extents.descent; + /* + * Cairo seems to return overall height in ascent, + * so fix this by calculating ascent = height - descent. + */ + if ( font_extents.ascent - font_extents.descent > a ) + a = font_extents.ascent - font_extents.descent; + if ( font_extents.descent > -d ) + d = -font_extents.descent; } *x_bearing = x1; @@ -1940,25 +1940,25 @@ static void x49gp_ui_text_size( cairo_t* cr, const char* family, double size, do } static void x49gp_ui_draw_text( cairo_t* cr, GdkColor* color, const char* family, double size, double line_width, int xoffset, int yoffset, - int n, ... ) + int n, ... ) { va_list ap; if ( n < 1 ) - return; + return; va_start( ap, n ); cairo_set_line_width( cr, line_width ); cairo_set_source_rgb( cr, ( ( double )color->red ) / 65535.0, ( ( double )color->green ) / 65535.0, - ( ( double )color->blue ) / 65535.0 ); + ( ( double )color->blue ) / 65535.0 ); x49gp_ui_vtext_path( cr, family, size, xoffset, yoffset, n, ap ); if ( line_width == 0.0 ) - cairo_fill( cr ); + cairo_fill( cr ); else - cairo_stroke( cr ); + cairo_stroke( cr ); va_end( ap ); } @@ -2017,8 +2017,8 @@ x49gp_ui_dump_path(cairo_t *cr, const char *family, int n, ...) static unsigned char bitmap_font_lookup_glyph( const bitmap_font_t* font, const char* name, int namelen ) { for ( int i = 0; font->glyphs[ i ].name; i++ ) - if ( ( strlen( font->glyphs[ i ].name ) == namelen ) && !strncmp( font->glyphs[ i ].name, name, namelen ) ) - return i; + if ( ( strlen( font->glyphs[ i ].name ) == namelen ) && !strncmp( font->glyphs[ i ].name, name, namelen ) ) + return i; return 0; } @@ -2029,140 +2029,140 @@ static unsigned char bitmap_font_lookup_ascii( const bitmap_font_t* font, char c char* name; switch ( c ) { - case ' ': - name = "space"; - break; - case '!': - name = "exclam"; - break; - case '"': - name = "quotedbl"; - break; - case '#': - name = "numbersign"; - break; - case '$': - name = "dollar"; - break; - case '%': - name = "percent"; - break; - case '&': - name = "ampersand"; - break; - case '(': - name = "parenleft"; - break; - case ')': - name = "parenright"; - break; - case '*': - name = "asterisk"; - break; - case '+': - name = "plus"; - break; - case ',': - name = "comma"; - break; - case '-': - name = "hyphen"; - break; - case '.': - name = "period"; - break; - case '/': - name = "slash"; - break; - case '0': - name = "zero"; - break; - case '1': - name = "one"; - break; - case '2': - name = "two"; - break; - case '3': - name = "three"; - break; - case '4': - name = "four"; - break; - case '5': - name = "five"; - break; - case '6': - name = "six"; - break; - case '7': - name = "seven"; - break; - case '8': - name = "eight"; - break; - case '9': - name = "nine"; - break; - case ':': - name = "colon"; - break; - case ';': - name = "semicolon"; - break; - case '<': - name = "less"; - break; - case '=': - name = "equal"; - break; - case '>': - name = "greater"; - break; - case '?': - name = "question"; - break; - case '@': - name = "at"; - break; - case '[': - name = "bracketleft"; - break; - case '\\': - name = "backslash"; - break; - case ']': - name = "bracketright"; - break; - case '^': - name = "asciicircum"; - break; - case '_': - name = "underscore"; - break; - case '`': - name = "quoteleft"; - break; - case '{': - name = "braceleft"; - break; - case '|': - name = "bar"; - break; - case '}': - name = "braceright"; - break; - case '~': - name = "asciitilde"; - break; - default: - name = &c; - namelen = 1; - break; + case ' ': + name = "space"; + break; + case '!': + name = "exclam"; + break; + case '"': + name = "quotedbl"; + break; + case '#': + name = "numbersign"; + break; + case '$': + name = "dollar"; + break; + case '%': + name = "percent"; + break; + case '&': + name = "ampersand"; + break; + case '(': + name = "parenleft"; + break; + case ')': + name = "parenright"; + break; + case '*': + name = "asterisk"; + break; + case '+': + name = "plus"; + break; + case ',': + name = "comma"; + break; + case '-': + name = "hyphen"; + break; + case '.': + name = "period"; + break; + case '/': + name = "slash"; + break; + case '0': + name = "zero"; + break; + case '1': + name = "one"; + break; + case '2': + name = "two"; + break; + case '3': + name = "three"; + break; + case '4': + name = "four"; + break; + case '5': + name = "five"; + break; + case '6': + name = "six"; + break; + case '7': + name = "seven"; + break; + case '8': + name = "eight"; + break; + case '9': + name = "nine"; + break; + case ':': + name = "colon"; + break; + case ';': + name = "semicolon"; + break; + case '<': + name = "less"; + break; + case '=': + name = "equal"; + break; + case '>': + name = "greater"; + break; + case '?': + name = "question"; + break; + case '@': + name = "at"; + break; + case '[': + name = "bracketleft"; + break; + case '\\': + name = "backslash"; + break; + case ']': + name = "bracketright"; + break; + case '^': + name = "asciicircum"; + break; + case '_': + name = "underscore"; + break; + case '`': + name = "quoteleft"; + break; + case '{': + name = "braceleft"; + break; + case '|': + name = "bar"; + break; + case '}': + name = "braceright"; + break; + case '~': + name = "asciitilde"; + break; + default: + name = &c; + namelen = 1; + break; } if ( 0 == namelen ) - namelen = strlen( name ); + namelen = strlen( name ); return bitmap_font_lookup_glyph( font, name, namelen ); } @@ -2175,27 +2175,27 @@ static int bitmap_font_strlen( const char* text ) p = text; while ( ( c = *p++ ) ) { - if ( c != '\\' ) { - n++; - continue; - } + if ( c != '\\' ) { + n++; + continue; + } - q = p; - while ( *q ) { - if ( ( *q == '\\' ) || ( *q == ' ' ) ) - break; - q++; - } - if ( q == p ) { - n++; - p++; - continue; - } - if ( *q == ' ' ) - q++; + q = p; + while ( *q ) { + if ( ( *q == '\\' ) || ( *q == ' ' ) ) + break; + q++; + } + if ( q == p ) { + n++; + p++; + continue; + } + if ( *q == ' ' ) + q++; - n++; - p = q; + n++; + p = q; } return n; @@ -2211,7 +2211,7 @@ static int bitmap_font_text_to_glyphs( const bitmap_font_t* font, const char* te n = bitmap_font_strlen( text ); if ( n <= 0 ) - return n; + return n; glyphs = malloc( n ); @@ -2219,32 +2219,32 @@ static int bitmap_font_text_to_glyphs( const bitmap_font_t* font, const char* te p = text; while ( ( c = *p++ ) ) { - if ( i == n ) { - free( glyphs ); - return -1; - } + if ( i == n ) { + free( glyphs ); + return -1; + } - if ( c != '\\' ) { - glyphs[ i++ ] = bitmap_font_lookup_ascii( font, c ); - continue; - } + if ( c != '\\' ) { + glyphs[ i++ ] = bitmap_font_lookup_ascii( font, c ); + continue; + } - q = p; - while ( *q ) { - if ( ( *q == '\\' ) || ( *q == ' ' ) ) - break; - q++; - } - if ( q == p ) { - glyphs[ i++ ] = bitmap_font_lookup_ascii( font, *p++ ); - continue; - } - namelen = q - p; - if ( *q == ' ' ) - q++; + q = p; + while ( *q ) { + if ( ( *q == '\\' ) || ( *q == ' ' ) ) + break; + q++; + } + if ( q == p ) { + glyphs[ i++ ] = bitmap_font_lookup_ascii( font, *p++ ); + continue; + } + namelen = q - p; + if ( *q == ' ' ) + q++; - glyphs[ i++ ] = bitmap_font_lookup_glyph( font, p, namelen ); - p = q; + glyphs[ i++ ] = bitmap_font_lookup_glyph( font, p, namelen ); + p = q; } *glyphp = glyphs; @@ -2264,14 +2264,14 @@ static void bitmap_font_text_size( const bitmap_font_t* font, const char* text, n = bitmap_font_text_to_glyphs( font, text, &glyphs ); for ( int i = 0; i < n; i++ ) { - glyph = &font->glyphs[ glyphs[ i ] ]; + glyph = &font->glyphs[ glyphs[ i ] ]; - w += glyph->width; + w += glyph->width; - if ( glyph->ascent > a ) - a = glyph->ascent; - if ( glyph->descent < d ) - d = glyph->descent; + if ( glyph->ascent > a ) + a = glyph->ascent; + if ( glyph->descent < d ) + d = glyph->descent; } *width = w - 1; @@ -2280,7 +2280,7 @@ static void bitmap_font_text_size( const bitmap_font_t* font, const char* text, *descent = d; if ( n > 0 ) - free( glyphs ); + free( glyphs ); } static void bitmap_font_draw_text( GdkDrawable* drawable, GdkColor* color, const bitmap_font_t* font, int x, int y, const char* text ) @@ -2297,33 +2297,33 @@ static void bitmap_font_draw_text( GdkDrawable* drawable, GdkColor* color, const n = bitmap_font_text_to_glyphs( font, text, &glyphs ); for ( int i = 0; i < n; i++ ) { - glyph = &font->glyphs[ glyphs[ i ] ]; + glyph = &font->glyphs[ glyphs[ i ] ]; - w = glyph->width - glyph->kern; - h = glyph->ascent - glyph->descent; + w = glyph->width - glyph->kern; + h = glyph->ascent - glyph->descent; - if ( w <= 0 || h <= 0 ) { - x += glyph->width; - continue; - } + if ( w <= 0 || h <= 0 ) { + x += glyph->width; + continue; + } - bitmap = gdk_bitmap_create_from_data( NULL, ( char* )glyph->bits, w, h ); + bitmap = gdk_bitmap_create_from_data( NULL, ( char* )glyph->bits, w, h ); - gdk_gc_set_ts_origin( gc, x + glyph->kern, y + font->ascent - glyph->ascent ); - gdk_gc_set_stipple( gc, bitmap ); - gdk_gc_set_fill( gc, GDK_STIPPLED ); + gdk_gc_set_ts_origin( gc, x + glyph->kern, y + font->ascent - glyph->ascent ); + gdk_gc_set_stipple( gc, bitmap ); + gdk_gc_set_fill( gc, GDK_STIPPLED ); - gdk_draw_rectangle( drawable, gc, TRUE, x + glyph->kern, y + font->ascent - glyph->ascent, w, h ); + gdk_draw_rectangle( drawable, gc, TRUE, x + glyph->kern, y + font->ascent - glyph->ascent, w, h ); - g_object_unref( bitmap ); + g_object_unref( bitmap ); - x += glyph->width; + x += glyph->width; } g_object_unref( gc ); if ( n > 0 ) - free( glyphs ); + free( glyphs ); } void x49gp_ui_show_error( x49gp_t* x49gp, const char* text ) @@ -2332,7 +2332,7 @@ void x49gp_ui_show_error( x49gp_t* x49gp, const char* text ) x49gp_ui_t* ui = x49gp->ui; dialog = - gtk_message_dialog_new( GTK_WINDOW( ui->window ), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", text ); + gtk_message_dialog_new( GTK_WINDOW( ui->window ), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", text ); gtk_dialog_run( GTK_DIALOG( dialog ) ); gtk_widget_destroy( dialog ); @@ -2344,15 +2344,15 @@ static void x49gp_ui_choose_file( x49gp_t* x49gp, const char* prompt, GtkFileCho x49gp_ui_t* ui = x49gp->ui; dialog = gtk_file_chooser_dialog_new( prompt, GTK_WINDOW( ui->window ), action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, - GTK_RESPONSE_ACCEPT, NULL ); + GTK_RESPONSE_ACCEPT, NULL ); gtk_file_chooser_set_local_only( GTK_FILE_CHOOSER( dialog ), TRUE ); gtk_file_chooser_set_select_multiple( GTK_FILE_CHOOSER( dialog ), FALSE ); if ( gtk_dialog_run( GTK_DIALOG( dialog ) ) == GTK_RESPONSE_ACCEPT ) - *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) ); + *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ) ); else - *filename = NULL; + *filename = NULL; gtk_widget_destroy( dialog ); } @@ -2374,35 +2374,35 @@ static gboolean x49gp_ui_button_press( GtkWidget* widget, GdkEventButton* event, #endif if ( event->type != GDK_BUTTON_PRESS ) - return FALSE; + return FALSE; switch ( event->button ) { - case 1: - ui->buttons_down++; - if ( button->down ) - return FALSE; - button->down = TRUE; - break; - case 3: - button->hold = TRUE; - if ( button->down ) - return FALSE; - gtk_button_pressed( GTK_BUTTON( button->button ) ); - button->down = TRUE; - break; - default: - return TRUE; + case 1: + ui->buttons_down++; + if ( button->down ) + return FALSE; + button->down = TRUE; + break; + case 3: + button->hold = TRUE; + if ( button->down ) + return FALSE; + gtk_button_pressed( GTK_BUTTON( button->button ) ); + button->down = TRUE; + break; + default: + return TRUE; } #ifdef DEBUG_X49GP_UI printf( "%s: button %u: col %u, row %u, eint %u\n", __FUNCTION__, event->button, button->key->column, button->key->row, - button->key->eint ); + button->key->eint ); #endif if ( key->rowbit ) - s3c2410_io_port_g_update( x49gp, key->column, key->row, key->columnbit, key->rowbit, 1 ); + s3c2410_io_port_g_update( x49gp, key->column, key->row, key->columnbit, key->rowbit, 1 ); else - s3c2410_io_port_f_set_bit( x49gp, key->eint, 1 ); + s3c2410_io_port_f_set_bit( x49gp, key->eint, 1 ); return FALSE; } @@ -2415,7 +2415,7 @@ static void x49gp_release_single_button( x49gp_ui_button_t* button, x49gp_ui_but #ifdef DEBUG_X49GP_UI printf( "%s: button %u: col %u, row %u, eint %u\n", __FUNCTION__, event->button, button->key->column, button->key->row, - button->key->eint ); + button->key->eint ); #endif button->down = FALSE; @@ -2424,15 +2424,15 @@ static void x49gp_release_single_button( x49gp_ui_button_t* button, x49gp_ui_but gtkbutton = GTK_BUTTON( button->button ); if ( button != cause ) - gtkbutton->in_button = FALSE; + gtkbutton->in_button = FALSE; gtk_button_released( gtkbutton ); key = button->key; if ( key->rowbit ) - s3c2410_io_port_g_update( x49gp, key->column, key->row, key->columnbit, key->rowbit, 0 ); + s3c2410_io_port_g_update( x49gp, key->column, key->row, key->columnbit, key->rowbit, 0 ); else - s3c2410_io_port_f_set_bit( x49gp, key->eint, 0 ); + s3c2410_io_port_f_set_bit( x49gp, key->eint, 0 ); } static void x49gp_release_all_buttons( x49gp_t* x49gp, x49gp_ui_button_t* cause ) @@ -2441,12 +2441,12 @@ static void x49gp_release_all_buttons( x49gp_t* x49gp, x49gp_ui_button_t* cause x49gp_ui_t* ui = x49gp->ui; for ( int i = 0; i < ui->nr_buttons; i++ ) { - button = &ui->buttons[ i ]; + button = &ui->buttons[ i ]; - if ( !button->down ) - continue; + if ( !button->down ) + continue; - x49gp_release_single_button( button, cause ); + x49gp_release_single_button( button, cause ); } } @@ -2457,22 +2457,22 @@ static gboolean x49gp_ui_button_release( GtkWidget* widget, GdkEventButton* even x49gp_ui_t* ui = x49gp->ui; if ( event->type != GDK_BUTTON_RELEASE ) - return FALSE; + return FALSE; switch ( event->button ) { - case 1: - break; - default: - return TRUE; + case 1: + break; + default: + return TRUE; } if ( ui->buttons_down > 0 ) - ui->buttons_down--; + ui->buttons_down--; if ( ui->buttons_down == 0 ) - x49gp_release_all_buttons( x49gp, button ); + x49gp_release_all_buttons( x49gp, button ); else - x49gp_release_single_button( button, button ); + x49gp_release_single_button( button, button ); return FALSE; } @@ -2484,11 +2484,11 @@ static gboolean x49gp_ui_show_menu( GtkWidget* widget, GdkEventButton* event, gp gtk_widget_set_sensitive( ui->menu_unmount, s3c2410_sdi_is_mounted( x49gp ) ); if ( ui->menu_debug ) - gtk_widget_set_sensitive( ui->menu_debug, !gdbserver_isactive() ); + gtk_widget_set_sensitive( ui->menu_debug, !gdbserver_isactive() ); if ( event->type == GDK_BUTTON_PRESS && event->button == 3 ) { - gtk_menu_popup( GTK_MENU( ui->menu ), NULL, NULL, NULL, NULL, event->button, event->time ); - return TRUE; + gtk_menu_popup( GTK_MENU( ui->menu ), NULL, NULL, NULL, NULL, event->button, event->time ); + return TRUE; } return FALSE; @@ -2499,10 +2499,10 @@ static gboolean x49gp_ui_button_leave( GtkWidget* widget, GdkEventCrossing* even x49gp_ui_button_t* button = user_data; if ( event->type != GDK_LEAVE_NOTIFY ) - return FALSE; + return FALSE; if ( !button->hold ) - return FALSE; + return FALSE; return TRUE; } @@ -2513,7 +2513,7 @@ static gboolean x49gp_ui_focus_lost( GtkWidget* widget, GdkEventFocus* event, gp x49gp_ui_t* ui = x49gp->ui; if ( event->type != GDK_FOCUS_CHANGE ) - return FALSE; + return FALSE; ui->buttons_down = 0; x49gp_release_all_buttons( x49gp, NULL ); @@ -2537,7 +2537,7 @@ static void x49gp_ui_mount_sd_folder( GtkMenuItem* menuitem, gpointer user_data x49gp_ui_choose_file( x49gp, "Choose SD folder ...", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, &filename ); if ( filename != NULL ) - s3c2410_sdi_mount( x49gp, filename ); + s3c2410_sdi_mount( x49gp, filename ); } static void x49gp_ui_mount_sd_image( GtkMenuItem* menuitem, gpointer user_data ) @@ -2547,7 +2547,7 @@ static void x49gp_ui_mount_sd_image( GtkMenuItem* menuitem, gpointer user_data ) x49gp_ui_choose_file( x49gp, "Choose SD image ...", GTK_FILE_CHOOSER_ACTION_OPEN, &filename ); if ( filename != NULL ) - s3c2410_sdi_mount( x49gp, filename ); + s3c2410_sdi_mount( x49gp, filename ); } static void x49gp_ui_debug( GtkMenuItem* menuitem, gpointer user_data ) @@ -2555,8 +2555,8 @@ static void x49gp_ui_debug( GtkMenuItem* menuitem, gpointer user_data ) x49gp_t* x49gp = user_data; if ( x49gp->debug_port != 0 && !gdbserver_isactive() ) { - gdbserver_start( x49gp->debug_port ); - gdb_handlesig( x49gp->env, 0 ); + gdbserver_start( x49gp->debug_port ); + gdb_handlesig( x49gp->env, 0 ); } } @@ -2586,259 +2586,259 @@ static gboolean x49gp_ui_key_event( GtkWidget* widget, GdkEventKey* event, gpoin /* However, there is one modifier we do care about: NumLock, */ /* which normally is represented by MOD2. */ if ( !gdk_keymap_translate_keyboard_state( gdk_keymap_get_default(), event->hardware_keycode, event->state & GDK_MOD2_MASK, - event->group, &keyval, NULL, NULL, NULL ) ) - return FALSE; + event->group, &keyval, NULL, NULL, NULL ) ) + return FALSE; #ifdef DEBUG_X49GP_UI fprintf( stderr, "%s:%u: state %u, base keyval %04x\n", __FUNCTION__, __LINE__, event->state, keyval ); #endif switch ( keyval ) { - case GDK_KEY_a: - case GDK_KEY_F1: - index = 0; - break; - case GDK_KEY_b: - case GDK_KEY_F2: - index = 1; - break; - case GDK_KEY_c: - case GDK_KEY_F3: - index = 2; - break; - case GDK_KEY_d: - case GDK_KEY_F4: - index = 3; - break; - case GDK_KEY_e: - case GDK_KEY_F5: - index = 4; - break; - case GDK_KEY_f: - case GDK_KEY_F6: - index = 5; - break; - case GDK_KEY_g: - index = 6; - break; - case GDK_KEY_h: - index = 7; - break; - case GDK_KEY_i: - index = 8; - break; - case GDK_KEY_j: - index = 9; - break; - case GDK_KEY_k: - index = 10; - break; - case GDK_KEY_l: - index = 11; - break; - case GDK_KEY_Up: - case GDK_KEY_KP_Up: - index = 12; - break; - case GDK_KEY_Left: - case GDK_KEY_KP_Left: - index = 13; - break; - case GDK_KEY_Down: - case GDK_KEY_KP_Down: - index = 14; - break; - case GDK_KEY_Right: - case GDK_KEY_KP_Right: - index = 15; - break; - case GDK_KEY_m: - index = 16; - break; - case GDK_KEY_n: - index = 17; - break; - case GDK_KEY_o: - case GDK_KEY_apostrophe: - index = 18; - break; - case GDK_KEY_p: - index = 19; - break; - case GDK_KEY_BackSpace: - case GDK_KEY_Delete: - case GDK_KEY_KP_Delete: - index = 20; - break; - case GDK_KEY_dead_circumflex: - case GDK_KEY_asciicircum: - case GDK_KEY_q: - case GDK_KEY_caret: - index = 21; - break; - case GDK_KEY_r: - index = 22; - break; - case GDK_KEY_s: - index = 23; - break; - case GDK_KEY_t: - index = 24; - break; - case GDK_KEY_u: - index = 25; - break; - case GDK_KEY_v: - index = 26; - break; - case GDK_KEY_w: - index = 27; - break; - case GDK_KEY_x: - index = 28; - break; - case GDK_KEY_y: - index = 29; - break; - case GDK_KEY_z: - case GDK_KEY_slash: - case GDK_KEY_KP_Divide: - index = 30; - break; - case GDK_KEY_Tab: - index = 31; - break; + case GDK_KEY_a: + case GDK_KEY_F1: + index = 0; + break; + case GDK_KEY_b: + case GDK_KEY_F2: + index = 1; + break; + case GDK_KEY_c: + case GDK_KEY_F3: + index = 2; + break; + case GDK_KEY_d: + case GDK_KEY_F4: + index = 3; + break; + case GDK_KEY_e: + case GDK_KEY_F5: + index = 4; + break; + case GDK_KEY_f: + case GDK_KEY_F6: + index = 5; + break; + case GDK_KEY_g: + index = 6; + break; + case GDK_KEY_h: + index = 7; + break; + case GDK_KEY_i: + index = 8; + break; + case GDK_KEY_j: + index = 9; + break; + case GDK_KEY_k: + index = 10; + break; + case GDK_KEY_l: + index = 11; + break; + case GDK_KEY_Up: + case GDK_KEY_KP_Up: + index = 12; + break; + case GDK_KEY_Left: + case GDK_KEY_KP_Left: + index = 13; + break; + case GDK_KEY_Down: + case GDK_KEY_KP_Down: + index = 14; + break; + case GDK_KEY_Right: + case GDK_KEY_KP_Right: + index = 15; + break; + case GDK_KEY_m: + index = 16; + break; + case GDK_KEY_n: + index = 17; + break; + case GDK_KEY_o: + case GDK_KEY_apostrophe: + index = 18; + break; + case GDK_KEY_p: + index = 19; + break; + case GDK_KEY_BackSpace: + case GDK_KEY_Delete: + case GDK_KEY_KP_Delete: + index = 20; + break; + case GDK_KEY_dead_circumflex: + case GDK_KEY_asciicircum: + case GDK_KEY_q: + case GDK_KEY_caret: + index = 21; + break; + case GDK_KEY_r: + index = 22; + break; + case GDK_KEY_s: + index = 23; + break; + case GDK_KEY_t: + index = 24; + break; + case GDK_KEY_u: + index = 25; + break; + case GDK_KEY_v: + index = 26; + break; + case GDK_KEY_w: + index = 27; + break; + case GDK_KEY_x: + index = 28; + break; + case GDK_KEY_y: + index = 29; + break; + case GDK_KEY_z: + case GDK_KEY_slash: + case GDK_KEY_KP_Divide: + index = 30; + break; + case GDK_KEY_Tab: + index = 31; + break; #ifndef __APPLE__ - // case GDK_KEY_Alt_L: case GDK_KEY_Alt_R: - // case GDK_KEY_Meta_L: case GDK_KEY_Meta_R: - case GDK_KEY_Mode_switch: - index = 31; - break; + // case GDK_KEY_Alt_L: case GDK_KEY_Alt_R: + // case GDK_KEY_Meta_L: case GDK_KEY_Meta_R: + case GDK_KEY_Mode_switch: + index = 31; + break; #endif - case GDK_KEY_7: - case GDK_KEY_KP_7: - index = 32; - break; - case GDK_KEY_8: - case GDK_KEY_KP_8: - index = 33; - break; - case GDK_KEY_9: - case GDK_KEY_KP_9: - index = 34; - break; - case GDK_KEY_multiply: - case GDK_KEY_KP_Multiply: - index = 35; - break; - case GDK_KEY_Shift_L: - case GDK_KEY_Shift_R: - index = 36; - break; - case GDK_KEY_4: - case GDK_KEY_KP_4: - index = 37; - break; - case GDK_KEY_5: - case GDK_KEY_KP_5: - index = 38; - break; - case GDK_KEY_6: - case GDK_KEY_KP_6: - index = 39; - break; - case GDK_KEY_minus: - case GDK_KEY_KP_Subtract: - index = 40; - break; - case GDK_KEY_Control_L: - case GDK_KEY_Control_R: - index = 41; - break; - case GDK_KEY_1: - case GDK_KEY_KP_1: - index = 42; - break; - case GDK_KEY_2: - case GDK_KEY_KP_2: - index = 43; - break; - case GDK_KEY_3: - case GDK_KEY_KP_3: - index = 44; - break; - case GDK_KEY_plus: - case GDK_KEY_KP_Add: - index = 45; - break; - case GDK_KEY_Escape: - index = 46; - break; - case GDK_KEY_0: - case GDK_KEY_KP_0: - index = 47; - break; - case GDK_KEY_period: - case GDK_KEY_comma: - case GDK_KEY_KP_Decimal: - case GDK_KP_Separator: - index = 48; - break; - case GDK_KEY_space: - case GDK_KEY_KP_Space: - index = 49; - break; - case GDK_KEY_Return: - case GDK_KEY_KP_Enter: - index = 50; - break; + case GDK_KEY_7: + case GDK_KEY_KP_7: + index = 32; + break; + case GDK_KEY_8: + case GDK_KEY_KP_8: + index = 33; + break; + case GDK_KEY_9: + case GDK_KEY_KP_9: + index = 34; + break; + case GDK_KEY_multiply: + case GDK_KEY_KP_Multiply: + index = 35; + break; + case GDK_KEY_Shift_L: + case GDK_KEY_Shift_R: + index = 36; + break; + case GDK_KEY_4: + case GDK_KEY_KP_4: + index = 37; + break; + case GDK_KEY_5: + case GDK_KEY_KP_5: + index = 38; + break; + case GDK_KEY_6: + case GDK_KEY_KP_6: + index = 39; + break; + case GDK_KEY_minus: + case GDK_KEY_KP_Subtract: + index = 40; + break; + case GDK_KEY_Control_L: + case GDK_KEY_Control_R: + index = 41; + break; + case GDK_KEY_1: + case GDK_KEY_KP_1: + index = 42; + break; + case GDK_KEY_2: + case GDK_KEY_KP_2: + index = 43; + break; + case GDK_KEY_3: + case GDK_KEY_KP_3: + index = 44; + break; + case GDK_KEY_plus: + case GDK_KEY_KP_Add: + index = 45; + break; + case GDK_KEY_Escape: + index = 46; + break; + case GDK_KEY_0: + case GDK_KEY_KP_0: + index = 47; + break; + case GDK_KEY_period: + case GDK_KEY_comma: + case GDK_KEY_KP_Decimal: + case GDK_KP_Separator: + index = 48; + break; + case GDK_KEY_space: + case GDK_KEY_KP_Space: + index = 49; + break; + case GDK_KEY_Return: + case GDK_KEY_KP_Enter: + index = 50; + break; - /* QWERTY compat: US English, UK English, International English */ - case GDK_KEY_backslash: - index = 35; - break; - case GDK_KEY_equal: - index = 45; - break; + /* QWERTY compat: US English, UK English, International English */ + case GDK_KEY_backslash: + index = 35; + break; + case GDK_KEY_equal: + index = 45; + break; - /* QWERTZ compat: German */ - case GDK_KEY_ssharp: - index = 30; - break; - case GDK_KEY_numbersign: - index = 35; - break; + /* QWERTZ compat: German */ + case GDK_KEY_ssharp: + index = 30; + break; + case GDK_KEY_numbersign: + index = 35; + break; - case GDK_KEY_F7: - case GDK_KEY_F10: - x49gp->arm_exit = 1; - cpu_exit( x49gp->env ); - return FALSE; + case GDK_KEY_F7: + case GDK_KEY_F10: + x49gp->arm_exit = 1; + cpu_exit( x49gp->env ); + return FALSE; - case GDK_KEY_F12: - switch ( event->type ) { - case GDK_KEY_PRESS: - x49gp_modules_reset( x49gp, X49GP_RESET_POWER_ON ); - cpu_reset( x49gp->env ); - x49gp_set_idle( x49gp, 1 ); - break; - case GDK_KEY_RELEASE: - x49gp_set_idle( x49gp, 0 ); - break; - default: - break; - } - return FALSE; + case GDK_KEY_F12: + switch ( event->type ) { + case GDK_KEY_PRESS: + x49gp_modules_reset( x49gp, X49GP_RESET_POWER_ON ); + cpu_reset( x49gp->env ); + x49gp_set_idle( x49gp, 1 ); + break; + case GDK_KEY_RELEASE: + x49gp_set_idle( x49gp, 0 ); + break; + default: + break; + } + return FALSE; - case GDK_KEY_Menu: - gtk_widget_set_sensitive( ui->menu_unmount, s3c2410_sdi_is_mounted( x49gp ) ); - if ( ui->menu_debug ) - gtk_widget_set_sensitive( ui->menu_debug, !gdbserver_isactive() ); + case GDK_KEY_Menu: + gtk_widget_set_sensitive( ui->menu_unmount, s3c2410_sdi_is_mounted( x49gp ) ); + if ( ui->menu_debug ) + gtk_widget_set_sensitive( ui->menu_debug, !gdbserver_isactive() ); - gtk_menu_popup( GTK_MENU( ui->menu ), NULL, NULL, x49gp_ui_popup_at_widget, ui->lcd_canvas, 0, event->time ); - return FALSE; + gtk_menu_popup( GTK_MENU( ui->menu ), NULL, NULL, x49gp_ui_popup_at_widget, ui->lcd_canvas, 0, event->time ); + return FALSE; - default: - return FALSE; + default: + return FALSE; } button = &ui->buttons[ index ]; @@ -2852,22 +2852,22 @@ static gboolean x49gp_ui_key_event( GtkWidget* widget, GdkEventKey* event, gpoin save_in = GTK_BUTTON( button->button )->in_button; switch ( event->type ) { - case GDK_KEY_PRESS: - bev.type = GDK_BUTTON_PRESS; - x49gp_ui_button_press( button->button, &bev, button ); - GTK_BUTTON( button->button )->in_button = TRUE; - gtk_button_pressed( GTK_BUTTON( button->button ) ); - GTK_BUTTON( button->button )->in_button = save_in; - break; - case GDK_KEY_RELEASE: - bev.type = GDK_BUTTON_RELEASE; - GTK_BUTTON( button->button )->in_button = TRUE; - gtk_button_released( GTK_BUTTON( button->button ) ); - GTK_BUTTON( button->button )->in_button = save_in; - x49gp_ui_button_release( button->button, &bev, button ); - break; - default: - return FALSE; + case GDK_KEY_PRESS: + bev.type = GDK_BUTTON_PRESS; + x49gp_ui_button_press( button->button, &bev, button ); + GTK_BUTTON( button->button )->in_button = TRUE; + gtk_button_pressed( GTK_BUTTON( button->button ) ); + GTK_BUTTON( button->button )->in_button = save_in; + break; + case GDK_KEY_RELEASE: + bev.type = GDK_BUTTON_RELEASE; + GTK_BUTTON( button->button )->in_button = TRUE; + gtk_button_released( GTK_BUTTON( button->button ) ); + GTK_BUTTON( button->button )->in_button = save_in; + x49gp_ui_button_release( button->button, &bev, button ); + break; + default: + return FALSE; } return TRUE; @@ -2882,10 +2882,10 @@ static int x49gp_button_expose_event( GtkWidget* widget, GdkEventExpose* event, y = widget->allocation.y; if ( GTK_WIDGET_STATE( widget ) == GTK_STATE_ACTIVE ) - y -= 1; + y -= 1; gdk_draw_drawable( widget->window, widget->style->black_gc, button->pixmap, 0, 0, x, y, widget->allocation.width, - widget->allocation.height ); + widget->allocation.height ); return FALSE; } @@ -2908,7 +2908,7 @@ static void x49gp_button_realize( GtkWidget* widget, gpointer user_data ) button->pixmap = gdk_pixmap_new( widget->style->bg_pixmap[ 0 ], w, h, -1 ); gdk_draw_drawable( button->pixmap, widget->style->black_gc, widget->style->bg_pixmap[ 0 ], xoffset, yoffset, 0, 0, button->key->width, - button->key->height ); + button->key->height ); xoffset += 2; yoffset += 2; @@ -2931,39 +2931,39 @@ static void x49gp_button_realize( GtkWidget* widget, gpointer user_data ) #endif if ( key->letter ) { - x49gp_ui_text_size( cr, X49GP_UI_NORMAL_FONT, key->letter_size, &xoff, &yoff, &width, &height, &ascent, &descent, 1, - CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->letter ); + x49gp_ui_text_size( cr, X49GP_UI_NORMAL_FONT, key->letter_size, &xoff, &yoff, &width, &height, &ascent, &descent, 1, + CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->letter ); - switch ( key->layout ) { - case UI_LAYOUT_LEFT: - default: - x = ( int )floor( w - 1.0 - width - xoff + 0.5 ); - y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 ); - w -= width; - break; - case UI_LAYOUT_LEFT_NO_SPACE: - x = ( int )floor( w - 1.0 - width - xoff + 0.5 ); - y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 ); - break; - case UI_LAYOUT_BELOW: - x = ( int )floor( ( w - 1.0 - width ) / 2.0 - xoff + 0.5 ); - y = ( int )h - 1.0; - h -= ascent; - break; - } + switch ( key->layout ) { + case UI_LAYOUT_LEFT: + default: + x = ( int )floor( w - 1.0 - width - xoff + 0.5 ); + y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 ); + w -= width; + break; + case UI_LAYOUT_LEFT_NO_SPACE: + x = ( int )floor( w - 1.0 - width - xoff + 0.5 ); + y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 ); + break; + case UI_LAYOUT_BELOW: + x = ( int )floor( ( w - 1.0 - width ) / 2.0 - xoff + 0.5 ); + y = ( int )h - 1.0; + h -= ascent; + break; + } - x49gp_ui_draw_text( cr, &ui->colors[ UI_COLOR_YELLOW ], X49GP_UI_NORMAL_FONT, key->letter_size, 0.0, x + xoffset, y + yoffset, 1, - CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->letter ); + x49gp_ui_draw_text( cr, &ui->colors[ UI_COLOR_YELLOW ], X49GP_UI_NORMAL_FONT, key->letter_size, 0.0, x + xoffset, y + yoffset, 1, + CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->letter ); } x49gp_ui_text_size( cr, X49GP_UI_NORMAL_FONT, key->font_size, &xoff, &yoff, &width, &height, &ascent, &descent, 1, - CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->label ); + CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->label ); x = ( int )floor( ( w - 1.0 - width ) / 2.0 - xoff + 0.5 ); y = ( int )floor( ( h - 1.0 + ascent ) / 2.0 + 0.5 ); x49gp_ui_draw_text( cr, &widget->style->text[ 0 ], X49GP_UI_NORMAL_FONT, key->font_size, 0.0, x + xoffset, y + yoffset, 1, - CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->label ); + CAIRO_FONT_SLANT_NORMAL, key->font_weight, key->label ); cairo_destroy( cr ); } @@ -2977,8 +2977,8 @@ static int x49gp_lcd_expose_event( GtkWidget* widget, GdkEventExpose* event, gpo gdk_region_get_rectangles( event->region, &rects, &n ); for ( int i = 0; i < n; i++ ) { - gdk_draw_drawable( widget->window, widget->style->black_gc, ui->lcd_pixmap, rects[ i ].x, rects[ i ].y, rects[ i ].x, rects[ i ].y, - rects[ i ].width, rects[ i ].height ); + gdk_draw_drawable( widget->window, widget->style->black_gc, ui->lcd_pixmap, rects[ i ].x, rects[ i ].y, rects[ i ].x, rects[ i ].y, + rects[ i ].width, rects[ i ].height ); } g_free( rects ); @@ -2992,13 +2992,13 @@ static int x49gp_lcd_configure_event( GtkWidget* widget, GdkEventConfigure* even x49gp_ui_t* ui = x49gp->ui; if ( NULL != ui->lcd_pixmap ) - return FALSE; + return FALSE; ui->ann_left = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_left_bits, ann_left_width, ann_left_height ); ui->ann_right = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_right_bits, ann_right_width, ann_right_height ); ui->ann_alpha = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_alpha_bits, ann_alpha_width, ann_alpha_height ); ui->ann_battery = - gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_battery_bits, ann_battery_width, ann_battery_height ); + gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_battery_bits, ann_battery_width, ann_battery_height ); ui->ann_busy = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_busy_bits, ann_busy_width, ann_busy_height ); ui->ann_io = gdk_bitmap_create_from_data( ui->lcd_canvas->window, ( char* )ann_io_bits, ann_io_width, ann_io_height ); @@ -3065,7 +3065,7 @@ static int x49gp_lcd_configure_event( GtkWidget* widget, GdkEventConfigure* even #endif gdk_draw_drawable( ui->lcd_pixmap, widget->style->black_gc, ui->bg_pixmap, ui->lcd_x_offset, ui->lcd_y_offset, 0, 0, ui->lcd_width, - ui->lcd_height ); + ui->lcd_height ); return FALSE; } @@ -3085,103 +3085,103 @@ static int x49gp_window_configure_event( GtkWidget* widget, GdkEventConfigure* e int dl = 0, dr = 0; if ( NULL != ui->bg_pixmap ) - return FALSE; + return FALSE; ui->bg_pixmap = gdk_pixmap_new( widget->window, ui->width, ui->height, -1 ); gdk_draw_pixbuf( ui->bg_pixmap, widget->style->black_gc, ui->bg_pixbuf, 0, 0, 0, 0, ui->width, ui->height, GDK_RGB_DITHER_NORMAL, 0, - 0 ); + 0 ); cr = gdk_cairo_create( ui->bg_pixmap ); cairo_set_line_cap( cr, CAIRO_LINE_CAP_BUTT ); cairo_set_line_join( cr, CAIRO_LINE_JOIN_MITER ); switch ( ui->calculator ) { - case UI_CALCULATOR_HP49GP: - case UI_CALCULATOR_HP49GP_NEWRPL: - x49gp_ui_draw_text( cr, &widget->style->black, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2, - CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD, "hp", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, - " 49g+" ); + case UI_CALCULATOR_HP49GP: + case UI_CALCULATOR_HP49GP_NEWRPL: + x49gp_ui_draw_text( cr, &widget->style->black, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2, + CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD, "hp", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, + " 49g+" ); - x49gp_ui_draw_text( cr, &widget->style->black, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1, - CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "graphing calculator" ); + x49gp_ui_draw_text( cr, &widget->style->black, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1, + CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "graphing calculator" ); - x49gp_ui_draw_symbol( cr, &widget->style->black, 10.0, 0.0, TRUE, 114 /* 138 */, 8 /* 25 */, - symbol_get_by_name( "triangleup" ) ); + x49gp_ui_draw_symbol( cr, &widget->style->black, 10.0, 0.0, TRUE, 114 /* 138 */, 8 /* 25 */, + symbol_get_by_name( "triangleup" ) ); - left_color = UI_COLOR_GREEN; - right_color = UI_COLOR_RED; - below_color = UI_COLOR_BLACK; - break; + left_color = UI_COLOR_GREEN; + right_color = UI_COLOR_RED; + below_color = UI_COLOR_BLACK; + break; - default: - ui->calculator = UI_CALCULATOR_HP50G; - /* fall through */ + default: + ui->calculator = UI_CALCULATOR_HP50G; + /* fall through */ - case UI_CALCULATOR_HP50G: - case UI_CALCULATOR_HP50G_NEWRPL: - x49gp_ui_draw_text( cr, &widget->style->white, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2, - CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "HP", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, - " 50g" ); + case UI_CALCULATOR_HP50G: + case UI_CALCULATOR_HP50G_NEWRPL: + x49gp_ui_draw_text( cr, &widget->style->white, X49GP_UI_NORMAL_FONT, 15.0, 0.0, 14 /* 38 */, 20 /* 42 */, 2, + CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "HP", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, + " 50g" ); - x49gp_ui_draw_text( cr, &widget->style->white, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1, - CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "Graphing Calculator" ); + x49gp_ui_draw_text( cr, &widget->style->white, X49GP_UI_NORMAL_FONT, 13.0, 0.0, 14 /* 38 */, 34 /* 56 */, 1, + CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL, "Graphing Calculator" ); - x49gp_ui_draw_symbol( cr, &widget->style->white, 10.0, 0.0, TRUE, 134 /* 168 */, 8 /* 25 */, - symbol_get_by_name( "triangleup" ) ); + x49gp_ui_draw_symbol( cr, &widget->style->white, 10.0, 0.0, TRUE, 134 /* 168 */, 8 /* 25 */, + symbol_get_by_name( "triangleup" ) ); - left_color = UI_COLOR_WHITE; - right_color = UI_COLOR_ORANGE; - below_color = UI_COLOR_BLUE; - break; + left_color = UI_COLOR_WHITE; + right_color = UI_COLOR_ORANGE; + below_color = UI_COLOR_BLUE; + break; } cairo_destroy( cr ); for ( int i = 0; i < ui->nr_buttons; i++ ) { - key = ui->buttons[ i ].key; + key = ui->buttons[ i ].key; - if ( key->left ) { - bitmap_font_text_size( &tiny_font, key->left, &wl, &hl, &a, &dl ); - if ( !key->right ) { - xl = key->x + ( key->width - wl ) / 2; - bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], &tiny_font, ui->kb_x_offset + xl, - ui->kb_y_offset + key->y - hl + dl + 1, key->left ); - } - } + if ( key->left ) { + bitmap_font_text_size( &tiny_font, key->left, &wl, &hl, &a, &dl ); + if ( !key->right ) { + xl = key->x + ( key->width - wl ) / 2; + bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], &tiny_font, ui->kb_x_offset + xl, + ui->kb_y_offset + key->y - hl + dl + 1, key->left ); + } + } - if ( key->right ) { - bitmap_font_text_size( &tiny_font, key->right, &wr, &hr, &a, &dr ); - if ( !key->left ) { - xr = key->x + ( key->width - wr ) / 2; - bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], &tiny_font, ui->kb_x_offset + xr, - ui->kb_y_offset + key->y - hr + dr + 1, key->right ); - } - } + if ( key->right ) { + bitmap_font_text_size( &tiny_font, key->right, &wr, &hr, &a, &dr ); + if ( !key->left ) { + xr = key->x + ( key->width - wr ) / 2; + bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], &tiny_font, ui->kb_x_offset + xr, + ui->kb_y_offset + key->y - hr + dr + 1, key->right ); + } + } - if ( key->left && key->right ) { - xl = key->x; - xr = key->x + key->width - 1 - wr; + if ( key->left && key->right ) { + xl = key->x; + xr = key->x + key->width - 1 - wr; - if ( wl + wr > key->width - 4 ) { - xl += ( key->width - 4 - ( wl + wr ) ) / 2; - xr -= ( key->width - 4 - ( wl + wr ) ) / 2; - } + if ( wl + wr > key->width - 4 ) { + xl += ( key->width - 4 - ( wl + wr ) ) / 2; + xr -= ( key->width - 4 - ( wl + wr ) ) / 2; + } - bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], &tiny_font, ui->kb_x_offset + xl, - ui->kb_y_offset + key->y - hl + dl + 1, key->left ); + bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ left_color ], &tiny_font, ui->kb_x_offset + xl, + ui->kb_y_offset + key->y - hl + dl + 1, key->left ); - bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], &tiny_font, ui->kb_x_offset + xr, - ui->kb_y_offset + key->y - hr + dr + 1, key->right ); - } + bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ right_color ], &tiny_font, ui->kb_x_offset + xr, + ui->kb_y_offset + key->y - hr + dr + 1, key->right ); + } - if ( key->below ) { - bitmap_font_text_size( &tiny_font, key->below, &wl, &hl, &a, &dl ); - xl = key->x + ( key->width - wl ) / 2; + if ( key->below ) { + bitmap_font_text_size( &tiny_font, key->below, &wl, &hl, &a, &dl ); + xl = key->x + ( key->width - wl ) / 2; - bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ below_color ], &tiny_font, ui->kb_x_offset + xl, - ui->kb_y_offset + key->y + key->height + 2, key->below ); - } + bitmap_font_draw_text( ui->bg_pixmap, &ui->colors[ below_color ], &tiny_font, ui->kb_x_offset + xl, + ui->kb_y_offset + key->y + key->height + 2, key->below ); + } #if 0 /* Debug Button Layout */ gdk_draw_rectangle(ui->bg_pixmap, ui->window->style->white_gc, @@ -3207,10 +3207,10 @@ static gboolean x49gp_window_button_press( GtkWidget* widget, GdkEventButton* ev gdk_window_raise( widget->window ); if ( event->type != GDK_BUTTON_PRESS ) - return FALSE; + return FALSE; if ( event->button != 1 ) - return FALSE; + return FALSE; gdk_window_begin_move_drag( widget->window, event->button, event->x_root, event->y_root, event->time ); @@ -3237,17 +3237,17 @@ static int gui_init( x49gp_module_t* module ) ui = malloc( sizeof( x49gp_ui_t ) ); if ( NULL == ui ) { - fprintf( stderr, "%s: %s:%u: Out of memory\n", x49gp->progname, __FUNCTION__, __LINE__ ); - return -ENOMEM; + fprintf( stderr, "%s: %s:%u: Out of memory\n", x49gp->progname, __FUNCTION__, __LINE__ ); + return -ENOMEM; } memset( ui, 0, sizeof( x49gp_ui_t ) ); ui->nr_buttons = X49GP_UI_NR_KEYS; ui->buttons = malloc( ui->nr_buttons * sizeof( x49gp_ui_button_t ) ); if ( NULL == ui->buttons ) { - fprintf( stderr, "%s: %s:%u: Out of memory\n", x49gp->progname, __FUNCTION__, __LINE__ ); - free( ui ); - return -ENOMEM; + fprintf( stderr, "%s: %s:%u: Out of memory\n", x49gp->progname, __FUNCTION__, __LINE__ ); + free( ui ); + return -ENOMEM; } memset( ui->buttons, 0, ui->nr_buttons * sizeof( x49gp_ui_button_t ) ); @@ -3278,32 +3278,32 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile ) x49gp_module_get_string( module, keyfile, "type", "hp50g", &typestr ); if ( !strcmp( typestr, "hp49g+" ) ) - ui->calculator = UI_CALCULATOR_HP49GP; + ui->calculator = UI_CALCULATOR_HP49GP; else if ( !strcmp( typestr, "hp49g+/newrpl" ) ) - ui->calculator = UI_CALCULATOR_HP49GP_NEWRPL; + ui->calculator = UI_CALCULATOR_HP49GP_NEWRPL; else if ( !strcmp( typestr, "hp50g" ) ) - ui->calculator = UI_CALCULATOR_HP50G; + ui->calculator = UI_CALCULATOR_HP50G; else if ( !strcmp( typestr, "hp50g/newrpl" ) ) - ui->calculator = UI_CALCULATOR_HP50G_NEWRPL; + ui->calculator = UI_CALCULATOR_HP50G_NEWRPL; else { - fprintf( stderr, "Invalid calculator type, reverting to default\n" ); - ui->calculator = UI_CALCULATOR_HP50G; + fprintf( stderr, "Invalid calculator type, reverting to default\n" ); + ui->calculator = UI_CALCULATOR_HP50G; } x49gp_module_get_string( module, keyfile, "name", - ui->calculator == UI_CALCULATOR_HP49GP ? "HP 49g+" - : ui->calculator == UI_CALCULATOR_HP49GP_NEWRPL ? "HP 49g+ / newRPL" - : ui->calculator == UI_CALCULATOR_HP50G ? "HP 50g" - : "HP 50g / newRPL", - &( ui->name ) ); + ui->calculator == UI_CALCULATOR_HP49GP ? "HP 49g+" + : ui->calculator == UI_CALCULATOR_HP49GP_NEWRPL ? "HP 49g+ / newRPL" + : ui->calculator == UI_CALCULATOR_HP50G ? "HP 50g" + : "HP 50g / newRPL", + &( ui->name ) ); fd = x49gp_module_open_rodata( module, - ui->calculator == UI_CALCULATOR_HP49GP || ui->calculator == UI_CALCULATOR_HP49GP_NEWRPL - ? "hp49g+-cropped.png" - : "hp50g-cropped.png", - &imagefile ); + ui->calculator == UI_CALCULATOR_HP49GP || ui->calculator == UI_CALCULATOR_HP49GP_NEWRPL + ? "hp49g+-cropped.png" + : "hp50g-cropped.png", + &imagefile ); if ( fd < 0 ) - return fd; + return fd; gdk_pixbuf_get_file_info( imagefile, &ui->width, &ui->height ); @@ -3342,15 +3342,15 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile ) gtk_widget_realize( ui->window ); ui->shapes[ UI_SHAPE_BUTTON_TINY ] = - gdk_bitmap_create_from_data( NULL, ( char* )button_tiny_bits, button_tiny_width, button_tiny_height ); + gdk_bitmap_create_from_data( NULL, ( char* )button_tiny_bits, button_tiny_width, button_tiny_height ); ui->shapes[ UI_SHAPE_BUTTON_SMALL ] = - gdk_bitmap_create_from_data( NULL, ( char* )button_small_bits, button_small_width, button_small_height ); + gdk_bitmap_create_from_data( NULL, ( char* )button_small_bits, button_small_width, button_small_height ); ui->shapes[ UI_SHAPE_BUTTON_NORMAL ] = - gdk_bitmap_create_from_data( NULL, ( char* )button_normal_bits, button_normal_width, button_normal_height ); + gdk_bitmap_create_from_data( NULL, ( char* )button_normal_bits, button_normal_width, button_normal_height ); ui->shapes[ UI_SHAPE_BUTTON_LARGE ] = - gdk_bitmap_create_from_data( NULL, ( char* )button_large_bits, button_large_width, button_large_height ); + gdk_bitmap_create_from_data( NULL, ( char* )button_large_bits, button_large_width, button_large_height ); ui->shapes[ UI_SHAPE_BUTTON_ROUND ] = - gdk_bitmap_create_from_data( NULL, ( char* )button_round_bits, button_round_width, button_round_height ); + gdk_bitmap_create_from_data( NULL, ( char* )button_round_bits, button_round_width, button_round_height ); ui->fixed = gtk_fixed_new(); gtk_container_add( GTK_CONTAINER( ui->window ), ui->fixed ); @@ -3394,60 +3394,60 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile ) x49gp_ui_place_at( x49gp, GTK_FIXED( ui->fixed ), screen_box, ui->lcd_x_offset, ui->lcd_y_offset, ui->lcd_width, ui->lcd_height ); for ( int i = 0; i < ui->nr_buttons; i++ ) { - switch ( ui->calculator ) { - case UI_CALCULATOR_HP49GP: - key = &x49gp_ui_keys[ i ]; - break; - case UI_CALCULATOR_HP49GP_NEWRPL: - key = &x49gp_newrpl_ui_keys[ i ]; - break; - default: - ui->calculator = UI_CALCULATOR_HP50G; - /* fall through */ - case UI_CALCULATOR_HP50G: - key = &x50g_ui_keys[ i ]; - break; - case UI_CALCULATOR_HP50G_NEWRPL: - key = &x50g_newrpl_ui_keys[ i ]; - break; - } - button = &ui->buttons[ i ]; + switch ( ui->calculator ) { + case UI_CALCULATOR_HP49GP: + key = &x49gp_ui_keys[ i ]; + break; + case UI_CALCULATOR_HP49GP_NEWRPL: + key = &x49gp_newrpl_ui_keys[ i ]; + break; + default: + ui->calculator = UI_CALCULATOR_HP50G; + /* fall through */ + case UI_CALCULATOR_HP50G: + key = &x50g_ui_keys[ i ]; + break; + case UI_CALCULATOR_HP50G_NEWRPL: + key = &x50g_newrpl_ui_keys[ i ]; + break; + } + button = &ui->buttons[ i ]; - button->x49gp = x49gp; - button->key = key; + button->x49gp = x49gp; + button->key = key; - button->button = gtk_button_new(); - gtk_widget_set_size_request( button->button, key->width, key->height ); - gtk_widget_set( button->button, "can-focus", FALSE, NULL ); + button->button = gtk_button_new(); + gtk_widget_set_size_request( button->button, key->width, key->height ); + gtk_widget_set( button->button, "can-focus", FALSE, NULL ); - x49gp_ui_button_pixmaps_init( x49gp, button, key->color ); + x49gp_ui_button_pixmaps_init( x49gp, button, key->color ); - if ( key->label ) { - button->label = gtk_label_new( "" ); - gtk_widget_set_style( button->label, button->button->style ); - gtk_container_add( GTK_CONTAINER( button->button ), button->label ); + if ( key->label ) { + button->label = gtk_label_new( "" ); + gtk_widget_set_style( button->label, button->button->style ); + gtk_container_add( GTK_CONTAINER( button->button ), button->label ); - g_signal_connect( G_OBJECT( button->label ), "expose-event", G_CALLBACK( x49gp_button_expose_event ), button ); + g_signal_connect( G_OBJECT( button->label ), "expose-event", G_CALLBACK( x49gp_button_expose_event ), button ); - g_signal_connect_after( G_OBJECT( button->label ), "realize", G_CALLBACK( x49gp_button_realize ), button ); - } + g_signal_connect_after( G_OBJECT( button->label ), "realize", G_CALLBACK( x49gp_button_realize ), button ); + } - button->box = gtk_event_box_new(); - gtk_event_box_set_visible_window( GTK_EVENT_BOX( button->box ), TRUE ); - gtk_event_box_set_above_child( GTK_EVENT_BOX( button->box ), FALSE ); - gtk_widget_shape_combine_mask( button->box, ui->shapes[ key->shape ], 0, 0 ); - gtk_container_add( GTK_CONTAINER( button->box ), button->button ); + button->box = gtk_event_box_new(); + gtk_event_box_set_visible_window( GTK_EVENT_BOX( button->box ), TRUE ); + gtk_event_box_set_above_child( GTK_EVENT_BOX( button->box ), FALSE ); + gtk_widget_shape_combine_mask( button->box, ui->shapes[ key->shape ], 0, 0 ); + gtk_container_add( GTK_CONTAINER( button->box ), button->button ); - x49gp_ui_place_at( x49gp, GTK_FIXED( ui->fixed ), button->box, ui->kb_x_offset + key->x, ui->kb_y_offset + key->y, key->width, - key->height ); + x49gp_ui_place_at( x49gp, GTK_FIXED( ui->fixed ), button->box, ui->kb_x_offset + key->x, ui->kb_y_offset + key->y, key->width, + key->height ); - g_signal_connect( G_OBJECT( button->button ), "button-press-event", G_CALLBACK( x49gp_ui_button_press ), button ); + g_signal_connect( G_OBJECT( button->button ), "button-press-event", G_CALLBACK( x49gp_ui_button_press ), button ); - g_signal_connect( G_OBJECT( button->button ), "button-release-event", G_CALLBACK( x49gp_ui_button_release ), button ); + g_signal_connect( G_OBJECT( button->button ), "button-release-event", G_CALLBACK( x49gp_ui_button_release ), button ); - g_signal_connect( G_OBJECT( button->button ), "leave-notify-event", G_CALLBACK( x49gp_ui_button_leave ), button ); + g_signal_connect( G_OBJECT( button->button ), "leave-notify-event", G_CALLBACK( x49gp_ui_button_leave ), button ); - gtk_widget_add_events( button->button, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK ); + gtk_widget_add_events( button->button, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK ); } ui->menu = gtk_menu_new(); @@ -3464,13 +3464,13 @@ static int gui_load( x49gp_module_t* module, GKeyFile* keyfile ) ui->menu_unmount = menu_unmount; if ( x49gp->debug_port != 0 ) { - gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), gtk_separator_menu_item_new() ); - menu_debug = gtk_menu_item_new_with_label( "Start debugger" ); - gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_debug ); - g_signal_connect( G_OBJECT( menu_debug ), "activate", G_CALLBACK( x49gp_ui_debug ), x49gp ); - ui->menu_debug = menu_debug; + gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), gtk_separator_menu_item_new() ); + menu_debug = gtk_menu_item_new_with_label( "Start debugger" ); + gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), menu_debug ); + g_signal_connect( G_OBJECT( menu_debug ), "activate", G_CALLBACK( x49gp_ui_debug ), x49gp ); + ui->menu_debug = menu_debug; } else - ui->menu_debug = NULL; + ui->menu_debug = NULL; gtk_menu_shell_append( GTK_MENU_SHELL( ui->menu ), gtk_separator_menu_item_new() ); menu_reset = gtk_menu_item_new_with_label( "Reset" ); @@ -3510,10 +3510,10 @@ static int gui_save( x49gp_module_t* module, GKeyFile* keyfile ) x49gp_ui_t* ui = module->user_data; x49gp_module_set_string( module, keyfile, "type", - ui->calculator == UI_CALCULATOR_HP49GP ? "hp49g+" - : ui->calculator == UI_CALCULATOR_HP49GP_NEWRPL ? "hp49g+/newrpl" - : ui->calculator == UI_CALCULATOR_HP50G ? "hp50g" - : "hp50g/newrpl" ); + ui->calculator == UI_CALCULATOR_HP49GP ? "hp49g+" + : ui->calculator == UI_CALCULATOR_HP49GP_NEWRPL ? "hp49g+/newrpl" + : ui->calculator == UI_CALCULATOR_HP50G ? "hp50g" + : "hp50g/newrpl" ); x49gp_module_set_string( module, keyfile, "name", ui->name ); return 0; @@ -3523,9 +3523,8 @@ int x49gp_ui_init( x49gp_t* x49gp ) { x49gp_module_t* module; - if ( x49gp_module_init( x49gp, "gui", gui_init, gui_exit, gui_reset, gui_load, gui_save, NULL, &module ) ) { - return -1; - } + if ( x49gp_module_init( x49gp, "gui", gui_init, gui_exit, gui_reset, gui_load, gui_save, NULL, &module ) ) + return -1; return x49gp_module_register( module ); } diff --git a/src/include/x49gp.h b/src/x49gp.h similarity index 97% rename from src/include/x49gp.h rename to src/x49gp.h index 23d36a9..201452f 100644 --- a/src/include/x49gp.h +++ b/src/x49gp.h @@ -10,13 +10,14 @@ #include -#include - -#include -#include -#include #include -#include + +#include "qemu-git/target-arm/cpu.h" + +#include "x49gp_types.h" +#include "x49gp_timer.h" +#include "s3c2410_mmu.h" +#include "list.h" /* LD TEMPO HACK */ extern uint8_t *phys_ram_base; diff --git a/src/include/x49gp_timer.h b/src/x49gp_timer.h similarity index 97% rename from src/include/x49gp_timer.h rename to src/x49gp_timer.h index e5acdcb..109f736 100644 --- a/src/include/x49gp_timer.h +++ b/src/x49gp_timer.h @@ -5,7 +5,8 @@ #define _X49GP_TIMER_H 1 #include -#include + +#include "list.h" #define X49GP_TIMER_VIRTUAL 0 #define X49GP_TIMER_REALTIME 1 diff --git a/src/include/x49gp_types.h b/src/x49gp_types.h similarity index 100% rename from src/include/x49gp_types.h rename to src/x49gp_types.h diff --git a/src/include/x49gp_ui.h b/src/x49gp_ui.h similarity index 99% rename from src/include/x49gp_ui.h rename to src/x49gp_ui.h index 7172e97..106dd3b 100644 --- a/src/include/x49gp_ui.h +++ b/src/x49gp_ui.h @@ -4,7 +4,7 @@ #ifndef _X49GP_UI_H #define _X49GP_UI_H 1 -#include +#include "x49gp_types.h" typedef enum { UI_COLOR_BLACK = 0,