static int running;
static int running_function_tag;
-static GtkWidget *mainwin;
-extern struct app_config_t *cfg;
-
-/* Signal DestroyEvent */
-static void
-WindowDestroyEvent(GtkWidget *widget, gpointer data)
-{
-#ifdef EMU8051_DEBUG
- g_print("emugtk_DestroyEvent(...)\n");
-#endif
+GtkWidget *mainwin;
- gtk_main_quit();
-}
+extern struct app_config_t *cfg;
/* Step out of running state */
static void
/* Adding the 'Help' submenu */
HelpAddMenu(menu_bar);
- gtk_widget_show_all(GTK_WIDGET(menu_bar));
-
return menu_bar;
}
-static void
+static int
mainwin_configure_event(GtkWindow *window, GdkEvent *event, gpointer data)
{
- //event->configure.x;
- //event->configure.y;
cfg->win_width = event->configure.width;
cfg->win_height = event->configure.height;
+
+ /*
+ * Important:
+ * Returning false allows event to propagate to children. If not, they
+ * will not be resized when we resize the main window.
+ */
+ return FALSE;
}
static void
cfg->vpane_pos = gtk_paned_get_position(GTK_PANED(vpaned));
}
+/*
+ * mainwin
+ * +---------------------------------------------------------------------+
+ * | |
+ * | vbox |
+ * | +---------------------------------------------------------------+ |
+ * | | | |
+ * | | menu_bar | |
+ * | | +----------------------+ | |
+ * | | | File View Help | | |
+ * | | +----------------------+ | |
+ * | | | |
+ * | |---------------------------------------------------------------| |
+ * | | | |
+ * | | buttons_bar | |
+ * | | +-----------------------+ | |
+ * | | | RST RUN STOP STEP | | |
+ * | | +-----------------------+ | |
+ * | | | |
+ * | |---------------------------------------------------------------| |
+ * | | | |
+ * | | vpaned | |
+ * | | +---------------------------------------------------------+ | |
+ * | | | | | |
+ * | | | hpaned | | |
+ * | | | +---------------------------------------------------+ | | |
+ * | | | | | | | | |
+ * | | | | scrollwin | scrollwin | | | |
+ * | | | | +------------------+ * +--------------------+ | | | |
+ * | | | | | REGISTERS window | * | Disassembly window | | | | |
+ * | | | | +------------------+ | +--------------------+ | | | |
+ * | | | | | | | | |
+ * | | | +---------------------------------------------------+ | | |
+ * | | | | | |
+ * | | |--------------------------***----------------------------- | |
+ * | | | | | |
+ * | | | scrollwin | | |
+ * | | | +---------------------------------------------------+ | | |
+ * | | | | Memory window | | | |
+ * | | | +---------------------------------------------------+ | | |
+ * | | | | | |
+ * | | +---------------------------------------------------------+ | |
+ * | | | |
+ * | | | |
+ * | +---------------------------------------------------------------+ |
+ * | |
+ * | |
+ * +---------------------------------------------------------------------+
+ */
static void
emugtk_window_init(void)
{
- GtkWidget *main_vbox;
+ GtkWidget *vbox;
GtkWidget *menu_bar;
GtkWidget *buttons_bar;
GtkWidget *scrollwin;
/* Window DESTROY event. */
g_signal_connect(mainwin, "destroy",
- G_CALLBACK(WindowDestroyEvent), NULL);
+ G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(mainwin), "configure-event",
G_CALLBACK(mainwin_configure_event), NULL);
/*
- * main_vbox contains the menu bar and body_vbox (for all remaining
+ * vbox contains the menu bar and body_vbox (for all remaining
* items).
*/
- main_vbox = gtk_vbox_new(FALSE, 1);
+ vbox = gtk_vbox_new(FALSE, 1);
/* Creating the menu bar. */
menu_bar = AddMenu();
- /* Adding menu bar to main_vbox */
- gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, FALSE, 1);
+ /* Adding menu bar to vbox */
+ gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 1);
/* Creating the buttons bar. */
buttons_bar = AddButtons();
- /* Adding buttons bar to main_vbox */
- gtk_box_pack_start(GTK_BOX(main_vbox), buttons_bar, FALSE, FALSE, 1);
+ /* Adding buttons bar to vbox */
+ gtk_box_pack_start(GTK_BOX(vbox), buttons_bar, FALSE, FALSE, 1);
/*
* vpaned will contain:
scrollwin = memwin_init();
gtk_paned_pack2(GTK_PANED(vpaned), scrollwin, TRUE, FALSE);
- /* Adding vpaned window to main_vbox */
- gtk_box_pack_start(GTK_BOX(main_vbox), vpaned, true, true, 1);
+ /* Adding vpaned window to vbox */
+ gtk_box_pack_start(GTK_BOX(vbox), vpaned, true, true, 1);
- /* Adding the main_vbox to the main window. */
- gtk_container_add(GTK_CONTAINER(mainwin), main_vbox);
+ /* Adding the vbox to the main window. */
+ gtk_container_add(GTK_CONTAINER(mainwin), vbox);
gtk_widget_show_all(mainwin);
}
if (hex_file != NULL)
emugtk_new_file(hex_file);
+ else
+ emugtk_Reset();
gtk_main();