Search
lxdream.org :: lxdream/src/gui/main_win.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gui/main_win.c
changeset 437:2c259474b474
prev435:7a5d71e8560b
next440:d9bd9b7a283f
author nkeynes
date Thu Oct 11 08:22:03 2007 +0000 (12 years ago)
permissions -rw-r--r--
last change Add speed meter to main window
Add sunken border around video area
Add debugger menu item
Move logging out to util.c
file annotate diff log raw
1.1 --- a/src/gui/main_win.c Wed Oct 10 11:02:04 2007 +0000
1.2 +++ b/src/gui/main_win.c Thu Oct 11 08:22:03 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: main_win.c,v 1.1 2007-10-10 11:02:04 nkeynes Exp $
1.6 + * $Id: main_win.c,v 1.2 2007-10-11 08:22:03 nkeynes Exp $
1.7 *
1.8 * Define the main (emu) GTK window, along with its menubars,
1.9 * toolbars, etc.
1.10 @@ -44,6 +44,7 @@
1.11 { "Run", GTK_STOCK_MEDIA_PLAY, "Resume", NULL, "Resume", G_CALLBACK(resume_action_callback) },
1.12 { "LoadState", GTK_STOCK_REVERT_TO_SAVED, "_Load state...", "F4", "Load an lxdream save state", G_CALLBACK(load_state_action_callback) },
1.13 { "SaveState", GTK_STOCK_SAVE_AS, "_Save state...", "F3", "Create an lxdream save state", G_CALLBACK(save_state_action_callback) },
1.14 + { "Debugger", NULL, "_Debugger", NULL, "Open debugger window", G_CALLBACK(debugger_action_callback) },
1.15 { "Exit", GTK_STOCK_QUIT, "E_xit", NULL, "Exit lxdream", G_CALLBACK(exit_action_callback) },
1.16 { "AudioSettings", NULL, "_Audio...", NULL, "Configure audio output", G_CALLBACK(audio_settings_callback) },
1.17 { "ControllerSettings", NULL, "_Controllers...", NULL, "Configure controllers", G_CALLBACK(controller_settings_callback) },
1.18 @@ -68,6 +69,7 @@
1.19 " <separator/>"
1.20 " <menuitem action='LoadState'/>"
1.21 " <menuitem action='SaveState'/>"
1.22 + " <menuitem action='Debugger'/>"
1.23 " <separator/>"
1.24 " <menuitem action='Exit'/>"
1.25 " </menu>"
1.26 @@ -109,6 +111,7 @@
1.27 GtkWidget *vbox;
1.28 GtkUIManager *ui_manager;
1.29 GtkAccelGroup *accel_group;
1.30 + GtkWidget *frame;
1.31 GError *error = NULL;
1.32 main_window_t win = g_malloc0( sizeof(struct main_window_info) );
1.33
1.34 @@ -141,17 +144,22 @@
1.35 win->video = gtk_drawing_area_new();
1.36 GTK_WIDGET_SET_FLAGS(win->video, GTK_CAN_FOCUS|GTK_CAN_DEFAULT);
1.37 gtk_widget_set_size_request( win->video, 640, 480 );
1.38 + frame = gtk_frame_new(NULL);
1.39 + gtk_frame_set_shadow_type( GTK_FRAME(frame), GTK_SHADOW_IN );
1.40 + gtk_container_add( GTK_CONTAINER(frame), win->video );
1.41 +
1.42 win->statusbar = gtk_statusbar_new();
1.43
1.44 vbox = gtk_vbox_new(FALSE, 0);
1.45 gtk_container_add( GTK_CONTAINER(win->window), vbox );
1.46 gtk_box_pack_start( GTK_BOX(vbox), win->menubar, FALSE, FALSE, 0 );
1.47 gtk_box_pack_start( GTK_BOX(vbox), win->toolbar, FALSE, FALSE, 0 );
1.48 - gtk_box_pack_start( GTK_BOX(vbox), win->video, TRUE, TRUE, 1 );
1.49 + gtk_box_pack_start( GTK_BOX(vbox), frame, TRUE, TRUE, 0 );
1.50 gtk_box_pack_start( GTK_BOX(vbox), win->statusbar, FALSE, FALSE, 0 );
1.51 gtk_widget_show_all( win->window );
1.52 gtk_widget_grab_focus( win->video );
1.53
1.54 + gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, "Stopped" );
1.55 return win;
1.56 }
1.57
1.58 @@ -159,6 +167,8 @@
1.59 {
1.60 SET_ACTION_ENABLED( win, "Pause", running );
1.61 SET_ACTION_ENABLED( win, "Run", !running );
1.62 + gtk_statusbar_pop( GTK_STATUSBAR(win->statusbar), 1 );
1.63 + gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, running ? "Running" : "Stopped" );
1.64 }
1.65
1.66 void main_window_set_framerate( main_window_t win, float rate )
1.67 @@ -167,6 +177,17 @@
1.68
1.69 }
1.70
1.71 +void main_window_set_speed( main_window_t win, double speed )
1.72 +{
1.73 + char buf[32];
1.74 +
1.75 + snprintf( buf, 32, "Running (%2.4f%)", speed );
1.76 + gtk_statusbar_pop( GTK_STATUSBAR(win->statusbar), 1 );
1.77 + gtk_statusbar_push( GTK_STATUSBAR(win->statusbar), 1, buf );
1.78 +
1.79 +
1.80 +}
1.81 +
1.82 GtkWidget *main_window_get_renderarea( main_window_t win )
1.83 {
1.84 return win->video;
.