From: Hugo Villeneuve Date: Tue, 1 Oct 2013 01:28:04 +0000 (-0400) Subject: Eliminate all fixed size windows X-Git-Tag: v2.0.0~162 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=bd7fa9a1fba21965467664b72772dddc5e9e0884;p=emu8051.git Eliminate all fixed size windows --- diff --git a/src/emugtk.c b/src/emugtk.c index d0a4582..7d05a69 100644 --- a/src/emugtk.c +++ b/src/emugtk.c @@ -258,20 +258,12 @@ emugtk_window_init(void) mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(mainwin), PACKAGE); - gtk_window_set_default_size(GTK_WINDOW(mainwin), - MAIN_WIN_WIDTH, MAIN_WIN_HEIGHT); gtk_container_set_border_width(GTK_CONTAINER(mainwin), 0); /* Window DESTROY event. */ g_signal_connect(mainwin, "destroy", G_CALLBACK(WindowDestroyEvent), NULL); - /* - * Setting main window geometry based on command line options - * (if specified). - */ - /*MainWindowSetGeometry();*/ - /* * main_vbox contains the menu bar and body_vbox (for all remaining * items). @@ -292,18 +284,18 @@ emugtk_window_init(void) hbox = gtk_hbox_new(FALSE, 1); /* 8051 registers frame. */ - fixed_frame = regwin_init(REG_WIN_WIDTH, REG_WIN_HEIGHT); + fixed_frame = regwin_init(); gtk_box_pack_start(GTK_BOX(hbox), fixed_frame, true, true, 1); /* Program disassembly frame. */ - fixed_frame = pgmwin_init(PGM_WIN_WIDTH, PGM_WIN_HEIGHT); + fixed_frame = pgmwin_init(); gtk_box_pack_start(GTK_BOX(hbox), fixed_frame, true, true, 1); /* Adding hbox window to main_vbox */ gtk_box_pack_start(GTK_BOX(main_vbox), hbox, true, true, 1); /* Memory dump frame. */ - fixed_frame = memwin_init(MEM_WIN_WIDTH, MEM_WIN_HEIGHT); + fixed_frame = memwin_init(); /* Adding memory dump window to main_vbox */ gtk_box_pack_start(GTK_BOX(main_vbox), fixed_frame, true, true, 1); diff --git a/src/gtksizes.h b/src/gtksizes.h index 1b36e06..69e296f 100644 --- a/src/gtksizes.h +++ b/src/gtksizes.h @@ -22,28 +22,4 @@ #ifndef _GTKSIZES_H_ #define _GTKSIZES_H_ -/* Width, in pixels, of a fixed font symbol. */ -#define FIXED_FONT_SYMBOL_WIDTH 10 - -/* Height, in pixels, of a fixed font symbol. */ -#define FIXED_FONT_SYMBOL_HEIGHT 22 - -#define BUTTON_HEIGHT 60 -#define BUTTONS_BAR_HEIGHT BUTTON_HEIGHT - -/* 12 symbols + border. */ -#define REG_WIN_WIDTH (FIXED_FONT_SYMBOL_WIDTH * 13) -#define REG_WIN_HEIGHT (FIXED_FONT_SYMBOL_HEIGHT * 24) - -#define MEM_WIN_WIDTH (FIXED_FONT_SYMBOL_WIDTH * 68) /* 68 symbols. */ -#define MEM_WIN_HEIGHT (FIXED_FONT_SYMBOL_HEIGHT * 17) - -#define PGM_WIN_WIDTH (MEM_WIN_WIDTH - REG_WIN_WIDTH) -#define PGM_WIN_HEIGHT REG_WIN_HEIGHT - -#define MENU_BAR_HEIGHT 0 - -#define MAIN_WIN_WIDTH MEM_WIN_WIDTH -#define MAIN_WIN_HEIGHT (BUTTONS_BAR_HEIGHT + REG_WIN_HEIGHT + MEM_WIN_HEIGHT) - #endif /* _GTKSIZES_H_ */ diff --git a/src/memwin.c b/src/memwin.c index baed752..042b3ec 100644 --- a/src/memwin.c +++ b/src/memwin.c @@ -35,7 +35,7 @@ static GtkWidget *memclist; GtkWidget * -memwin_init(int width, int height) +memwin_init(void) { int i; GtkWidget *scrollwin; @@ -52,27 +52,14 @@ memwin_init(int width, int height) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_size_request(GTK_WIDGET(scrollwin), width, height); - memclist = gtk_clist_new(18); gtk_clist_set_selection_mode(GTK_CLIST(memclist), GTK_SELECTION_SINGLE); - gtk_widget_set_size_request(GTK_WIDGET(memclist), 620, 250); for (i = 0; i < 18; i++) { gtk_clist_set_column_justification( GTK_CLIST(memclist), i, GTK_JUSTIFY_LEFT); } - gtk_clist_set_column_width(GTK_CLIST(memclist), 0, - 5 * FIXED_FONT_SYMBOL_WIDTH); - - for (i = 1; i < 17; i++) - gtk_clist_set_column_width(GTK_CLIST(memclist), i, - 2 * FIXED_FONT_SYMBOL_WIDTH); - - gtk_clist_set_column_width(GTK_CLIST(memclist), 17, - 16 * FIXED_FONT_SYMBOL_WIDTH); - pango_font = pango_font_description_from_string(FIXED_FONT); gtk_widget_modify_font(memclist, pango_font); diff --git a/src/memwin.h b/src/memwin.h index b2108b2..cd4700b 100644 --- a/src/memwin.h +++ b/src/memwin.h @@ -25,7 +25,7 @@ #include GtkWidget * -memwin_init(int width, int height); +memwin_init(void); void memwin_DumpD(char *Address); diff --git a/src/pgmwin.c b/src/pgmwin.c index cacc8a3..7bf0eb9 100644 --- a/src/pgmwin.c +++ b/src/pgmwin.c @@ -80,7 +80,7 @@ pgmwin_ButtonPressEvent(GtkWidget *widget, GdkEvent *event, gpointer data) GtkWidget * -pgmwin_init(int width, int height) +pgmwin_init(void) { int i; GtkWidget *scrollwin; @@ -94,14 +94,10 @@ pgmwin_init(int width, int height) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_size_request(GTK_WIDGET(scrollwin), width, height); - pgmclist = gtk_clist_new(1); gtk_clist_set_selection_mode(GTK_CLIST(pgmclist), GTK_SELECTION_SINGLE); - gtk_widget_set_size_request(GTK_WIDGET(pgmclist), width, height); gtk_clist_set_column_justification(GTK_CLIST(pgmclist), 0, GTK_JUSTIFY_LEFT); - gtk_clist_set_column_width(GTK_CLIST(pgmclist), 0, width-10); PangoFontDescription *pango_font; pango_font = pango_font_description_from_string(FIXED_FONT); diff --git a/src/pgmwin.h b/src/pgmwin.h index dca55e7..3b44466 100644 --- a/src/pgmwin.h +++ b/src/pgmwin.h @@ -26,7 +26,7 @@ #include "gtksizes.h" GtkWidget * -pgmwin_init(int width, int height); +pgmwin_init(void); void pgmwin_Disasm(void); diff --git a/src/regwin.c b/src/regwin.c index 0e7a356..4094562 100644 --- a/src/regwin.c +++ b/src/regwin.c @@ -33,7 +33,7 @@ static GtkWidget *regclist; GtkWidget * -regwin_init(int width, int height) +regwin_init(void) { int i; GtkWidget *scrollwin; @@ -49,15 +49,10 @@ regwin_init(int width, int height) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_widget_set_size_request(GTK_WIDGET(scrollwin), width, height); - regclist = gtk_clist_new(1); gtk_clist_set_selection_mode(GTK_CLIST(regclist), GTK_SELECTION_SINGLE); - gtk_widget_set_size_request(GTK_WIDGET(regclist), width, height); gtk_clist_set_column_justification(GTK_CLIST(regclist), 0, GTK_JUSTIFY_LEFT); - gtk_clist_set_column_width(GTK_CLIST(regclist), 0, width); - pango_font = pango_font_description_from_string(FIXED_FONT); gtk_widget_modify_font(regclist, pango_font); diff --git a/src/regwin.h b/src/regwin.h index 1b24e10..228a1d9 100644 --- a/src/regwin.h +++ b/src/regwin.h @@ -26,7 +26,7 @@ #include "gtksizes.h" GtkWidget * -regwin_init(int width, int height); +regwin_init(void); void regwin_Show(void);