[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx:[753] trunk
                
                Brought to you by:
                
                    fredm
                    
                
            
            
        
        
        
    | 
     
      
      
      From: <fr...@us...> - 2013-05-19 12:37:11
      
     
   | 
Revision: 753
          http://sourceforge.net/p/fuse-for-macosx/code/753
Author:   fredm
Date:     2013-05-19 12:37:08 +0000 (Sun, 19 May 2013)
Log Message:
-----------
Merge up to vendor 1.1.0 release branches r4964.
Revision Links:
--------------
    http://sourceforge.net/p/fuse-for-macosx/code/4964
Modified Paths:
--------------
    trunk/fuse/fusepb/controllers/FuseController.m
    trunk/fuse/fusepb/main.m
    trunk/fuse/fusepb/models/Emulator.h
    trunk/fuse/fusepb/models/Emulator.m
    trunk/fuse/fusepb/settings-header.pl
    trunk/fuse/fusepb/views/DisplayOpenGLView.h
    trunk/fuse/fusepb/views/DisplayOpenGLView.m
    trunk/fuse/hacking/ChangeLog
    trunk/fuse/periph.c
    trunk/fuse/periph.h
    trunk/fuse/perl/Fuse/Dialog.pm
    trunk/fuse/settings-header.pl
    trunk/fuse/settings.pl
    trunk/fuse/ui/gtk/binary.c
    trunk/fuse/ui/gtk/confirm.c
    trunk/fuse/ui/gtk/gtkinternals.h
    trunk/fuse/ui/gtk/gtkjoystick.c
    trunk/fuse/ui/gtk/gtkui.c
    trunk/fuse/ui/gtk/options.pl
    trunk/fuse/ui/gtk/pokemem.c
    trunk/fuse/ui/gtk/rollback.c
    trunk/fuse/ui/gtk/roms.c
    trunk/fuse/ui/gtk/stock.c
    trunk/fuse/ui/options.dat
    trunk/fuse/ui/widget/options.pl
    trunk/fuse/ui/widget/roms.c
    trunk/fuse/ui/win32/options.pl
    trunk/libspectrum/libspectrum/doc/libspectrum.txt
    trunk/libspectrum/libspectrum/hacking/ChangeLog
Property Changed:
----------------
    trunk/fuse/
    trunk/libspectrum/libspectrum/
Index: trunk/fuse
===================================================================
--- trunk/fuse	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse	2013-05-19 12:37:08 UTC (rev 753)
Property changes on: trunk/fuse
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
 /vendor/fuse-emulator/0.10.0/fuse:556-557
 /vendor/fuse-emulator/0.10.0-pre1/fuse:545-546
-/vendor/fuse-emulator/current/fuse:530-749
+/vendor/fuse-emulator/current/fuse:530-752
 /vendor/fuse-emulator/fuse-1.0.0a/fuse:668-669
 /vendor/fuse-emulator/fuse-r4617/fuse:686
\ No newline at end of property
Modified: trunk/fuse/fusepb/controllers/FuseController.m
===================================================================
--- trunk/fuse/fusepb/controllers/FuseController.m	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/fusepb/controllers/FuseController.m	2013-05-19 12:37:08 UTC (rev 753)
@@ -1172,8 +1172,7 @@
 
   if( error != NSAlertAlternateReturn ) return;
 
-  error = [[DisplayOpenGLView instance] settingsResetDefaults];
-  if( error ) ui_error( UI_ERROR_ERROR, "Error resetting preferences" );
+  [[DisplayOpenGLView instance] settingsResetDefaults];
 }
 
 - (void)dealloc
Modified: trunk/fuse/fusepb/main.m
===================================================================
--- trunk/fuse/fusepb/main.m	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/fusepb/main.m	2013-05-19 12:37:08 UTC (rev 753)
@@ -41,8 +41,7 @@
   
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     
-  int error = settings_defaults( &settings_current );
-  if( error ) return error;
+  settings_defaults( &settings_current );
 
   /* This is passed if we are launched by double-clicking */
   if ( argc >= 2 && strncmp( argv[1], "-psn", 4 ) == 0 ) {
Modified: trunk/fuse/fusepb/models/Emulator.h
===================================================================
--- trunk/fuse/fusepb/models/Emulator.h	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/fusepb/models/Emulator.h	2013-05-19 12:37:08 UTC (rev 753)
@@ -131,7 +131,7 @@
 -(void) profileFinish:(const char *)filename;
 
 -(void) settingsSave;
--(int) settingsResetDefaults;
+-(void) settingsResetDefaults;
 
 -(void) fullscreen;
 
Modified: trunk/fuse/fusepb/models/Emulator.m
===================================================================
--- trunk/fuse/fusepb/models/Emulator.m	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/fusepb/models/Emulator.m	2013-05-19 12:37:08 UTC (rev 753)
@@ -495,10 +495,10 @@
   settings_write_config( &settings_current );
 }
 
--(int) settingsResetDefaults
+-(void) settingsResetDefaults
 {
   [NSUserDefaults resetStandardUserDefaults];
-  return settings_defaults( &settings_current );
+  settings_defaults( &settings_current );
 }
 
 -(void) fullscreen
Modified: trunk/fuse/fusepb/settings-header.pl
===================================================================
--- trunk/fuse/fusepb/settings-header.pl	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/fusepb/settings-header.pl	2013-05-19 12:37:08 UTC (rev 753)
@@ -106,8 +106,8 @@
 extern settings_info settings_default;
 
 int settings_init( int *first_arg, int argc, char **argv );
-int settings_defaults( settings_info *settings );
-int settings_copy( settings_info *dest, settings_info *src );
+void settings_defaults( settings_info *settings );
+void settings_copy( settings_info *dest, settings_info *src );
 
 #define SETTINGS_ROM_COUNT 32
 extern const char *settings_rom_name[ SETTINGS_ROM_COUNT ];
Modified: trunk/fuse/fusepb/views/DisplayOpenGLView.h
===================================================================
--- trunk/fuse/fusepb/views/DisplayOpenGLView.h	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/fusepb/views/DisplayOpenGLView.h	2013-05-19 12:37:08 UTC (rev 753)
@@ -166,7 +166,7 @@
 -(void) profileFinish:(const char *)filename;
 
 -(void) settingsSave;
--(int) settingsResetDefaults;
+-(void) settingsResetDefaults;
 
 -(void) fullscreen;
 
Modified: trunk/fuse/fusepb/views/DisplayOpenGLView.m
===================================================================
--- trunk/fuse/fusepb/views/DisplayOpenGLView.m	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/fusepb/views/DisplayOpenGLView.m	2013-05-19 12:37:08 UTC (rev 753)
@@ -952,9 +952,9 @@
   [proxy_emulator settingsSave];
 }
 
--(int) settingsResetDefaults
+-(void) settingsResetDefaults
 {
-  return [proxy_emulator settingsResetDefaults];
+  [proxy_emulator settingsResetDefaults];
 }
 
 -(void) fullscreen
Modified: trunk/fuse/hacking/ChangeLog
===================================================================
--- trunk/fuse/hacking/ChangeLog	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/hacking/ChangeLog	2013-05-19 12:37:08 UTC (rev 753)
@@ -4480,7 +4480,17 @@
          complete some missing field initializers (Sergio).
 20130505 peripherals/if1.c: put braces around empty body in ‘do’ statements
          (Sergio).
+20130512 ui/win32/options.pl: refactor options dialogs to split *_init and
+         *_done functions out of *_proc function (Sergio).
+20130513 settings-header.pl,settings.pl: change settings_defaults(),
+         settings_copy() and settings_copy_internal() to void functions (Fred).
+20130513 ui/widget/{options.pl,roms.c}: change settings_copy() to void function
+         on widget UIs (Sergio).
 20130516 man/fuse.1: update date and version for 1.1 release.
 20130516 ChangeLog: update date in main changelog.
+20130517 periph.[c|h],perl/Fuse/Dialog.pm,ui/gtk/{binary.c,confirm.c,
+         gtkinternals.h,gtkjoystick.c,gtkui.c,options.pl,pokemem.c,rollback.c,
+         roms.c,stock.c},ui/options.dat,ui/win32/options.pl: display
+         confirmation dialogue for reset due to peripheral changes (Sergio).
 20130517 README: update date for 1.1 release.
 20130518 README: mention DISCiPLE support (Stuart).
Modified: trunk/fuse/periph.c
===================================================================
--- trunk/fuse/periph.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/periph.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* periph.c: code for handling peripherals
    Copyright (c) 2005-2011 Philip Kendall
 
-   $Id: periph.c 4906 2013-03-10 11:21:37Z fredm $
+   $Id: periph.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -169,6 +169,28 @@
     *needs_hard_reset;
 }
 
+/* Work out whether a peripheral needs a hard reset without (de)activate */
+static void
+get_hard_reset( gpointer key, gpointer value, gpointer user_data )
+{
+  periph_private_t *private = value;
+  int active = 0;
+  int *machine_hard_reset = (int *)user_data;
+  int periph_hard_reset = 0;
+
+  switch ( private->present ) {
+  case PERIPH_PRESENT_NEVER: active = 0; break;
+  case PERIPH_PRESENT_OPTIONAL:
+    active = private->periph->option ? *(private->periph->option) : 0; break;
+  case PERIPH_PRESENT_ALWAYS: active = 1; break;
+  }
+
+  periph_hard_reset = ( private && ( private->active != active ) &&
+                        private->periph->hard_reset );
+
+  *machine_hard_reset = ( periph_hard_reset || *machine_hard_reset );
+}
+
 /* Free the memory used by a peripheral-port response pair */
 static void
 free_peripheral( gpointer data, gpointer user_data GCC_UNUSED )
@@ -426,6 +448,17 @@
   }
 }
 
+int
+periph_postcheck( void )
+{
+  int needs_hard_reset = 0;
+
+  /* Detect if a hard reset is needed without (de)activating peripherals */
+  g_hash_table_foreach( peripherals, get_hard_reset, &needs_hard_reset );
+
+  return needs_hard_reset;
+}
+
 /* Register debugger page/unpage events for a peripheral */
 void
 periph_register_paging_events( const char *type_string, int *page_event,
Modified: trunk/fuse/periph.h
===================================================================
--- trunk/fuse/periph.h	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/periph.h	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* periph.h: code for handling peripherals
    Copyright (c) 2004-2011 Philip Kendall
 
-   $Id: periph.h 4906 2013-03-10 11:21:37Z fredm $
+   $Id: periph.h 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -154,6 +154,8 @@
 
 void periph_posthook( void );
 
+int periph_postcheck( void );
+
 /* Register debugger page/unpage events for a peripheral */
 void periph_register_paging_events( const char *type_string, int *page_event,
 				    int *unpage_event );
Modified: trunk/fuse/perl/Fuse/Dialog.pm
===================================================================
--- trunk/fuse/perl/Fuse/Dialog.pm	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/perl/Fuse/Dialog.pm	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 # Fuse::Dialog: routines for creating Fuse dialog boxes
 # Copyright (c) 2003-2005 Philip Kendall
 
-# $Id: Dialog.pm 2889 2007-05-26 17:45:08Z zubzero $
+# $Id: Dialog.pm 4962 2013-05-19 05:25:15Z sbaldovi $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -49,6 +49,7 @@
 	my( $name, $title, @widgets ) = split /\n/;
 
 	my @widget_data;
+	my $postcheck;
 	my $posthook;
 
 	foreach( @widgets ) {
@@ -56,6 +57,11 @@
 	    my( $widget_type, $text, $value, $key, $data1, $data2 ) =
 		split /\s*,\s*/;
 
+	    if( lc $widget_type eq 'postcheck' ) {
+		$postcheck = $text;
+		next;
+	    }
+
 	    if( lc $widget_type eq 'posthook' ) {
 		$posthook = $text;
 		next;
@@ -72,6 +78,7 @@
 
 	push @dialogs, { name => $name,
 			 title => $title,
+			 postcheck => $postcheck,
 			 posthook => $posthook,
 			 widgets => \@widget_data };
     }
Modified: trunk/fuse/settings-header.pl
===================================================================
--- trunk/fuse/settings-header.pl	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/settings-header.pl	2013-05-19 12:37:08 UTC (rev 753)
@@ -3,7 +3,7 @@
 # settings-header.pl: generate settings.h from settings.dat
 # Copyright (c) 2002-2003 Philip Kendall
 
-# $Id: settings-header.pl 4924 2013-05-05 07:40:02Z sbaldovi $
+# $Id: settings-header.pl 4961 2013-05-19 05:17:30Z sbaldovi $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -102,8 +102,8 @@
 extern settings_info settings_default;
 
 int settings_init( int *first_arg, int argc, char **argv );
-int settings_defaults( settings_info *settings );
-int settings_copy( settings_info *dest, settings_info *src );
+void settings_defaults( settings_info *settings );
+void settings_copy( settings_info *dest, settings_info *src );
 
 #define SETTINGS_ROM_COUNT 30
 char **settings_get_rom_setting( settings_info *settings, size_t which );
Modified: trunk/fuse/settings.pl
===================================================================
--- trunk/fuse/settings.pl	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/settings.pl	2013-05-19 12:37:08 UTC (rev 753)
@@ -3,7 +3,7 @@
 # settings.pl: generate settings.c from settings.dat
 # Copyright (c) 2002-2005 Philip Kendall, Fredrick Meunier
 
-# $Id: settings.pl 4841 2013-01-02 01:55:24Z zubzero $
+# $Id: settings.pl 4961 2013-05-19 05:17:30Z sbaldovi $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -123,7 +123,7 @@
 static int settings_command_line( settings_info *settings, int *first_arg,
 				  int argc, char **argv );
 
-static int settings_copy_internal( settings_info *dest, settings_info *src );
+static void settings_copy_internal( settings_info *dest, settings_info *src );
 
 /* Called on emulator startup */
 int
@@ -141,14 +141,13 @@
 }
 
 /* Fill the settings structure with sensible defaults */
-int settings_defaults( settings_info *settings )
+void settings_defaults( settings_info *settings )
 {
-  int retval;
   BOOL value;
 
   NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
 
-  retval = settings_copy_internal( settings, &settings_default );
+  settings_copy_internal( settings, &settings_default );
 
 CODE
 
@@ -193,8 +192,6 @@
   [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];
 
   [[NSUserDefaultsController sharedUserDefaultsController] setInitialValues:defaultValues];
-
-  return retval;
 }
 
 /* Read options from the config file */
@@ -457,7 +454,7 @@
 }
 
 /* Copy one settings object to another */
-static int
+static void
 settings_copy_internal( settings_info *dest, settings_info *src )
 {
   settings_free( dest );
@@ -483,7 +480,7 @@
 	print << "CODE";
   if( src->cocoa && src->cocoa->$name ) {
     dest->cocoa->$name = [NSMutableArray arrayWithArray:src->cocoa->$name];
-    if( !dest->cocoa->$name ) { settings_free( dest ); return 1; }
+    if( !dest->cocoa->$name ) { settings_free( dest ); }
   } else {
     dest->cocoa->$name = [NSMutableArray arrayWithCapacity:NUM_RECENT_ITEMS];
   }
@@ -492,8 +489,6 @@
 }
 
 print << 'CODE';
-
-  return 0;
 }
 
 int
@@ -551,10 +546,10 @@
 }
 
 /* Copy one settings object to another */
-int settings_copy( settings_info *dest, settings_info *src )
+void settings_copy( settings_info *dest, settings_info *src )
 {
-  if( settings_defaults( dest ) ) return 1;
-  return settings_copy_internal( dest, src );
+  settings_defaults( dest );
+  settings_copy_internal( dest, src );
 }
 
 char **
Modified: trunk/fuse/ui/gtk/binary.c
===================================================================
--- trunk/fuse/ui/gtk/binary.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/binary.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* binary.c: GTK+ routines to load/save chunks of binary data
    Copyright (c) 2003-2005 Philip Kendall
 
-   $Id: binary.c 4908 2013-03-10 22:13:57Z sbaldovi $
+   $Id: binary.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -146,7 +146,7 @@
 
   /* Command buttons */
   gtkstock_create_ok_cancel( info->dialog, NULL, info->activate_data, info,
-                             NULL );
+                             DEFAULT_DESTROY, DEFAULT_DESTROY );
 }
 
 void
Modified: trunk/fuse/ui/gtk/confirm.c
===================================================================
--- trunk/fuse/ui/gtk/confirm.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/confirm.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* confirm.c: Confirmation dialog box
    Copyright (c) 2000-2003 Philip Kendall, Russell Marks
 
-   $Id: confirm.c 4723 2012-07-08 13:26:15Z fredm $
+   $Id: confirm.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@
   gtk_box_pack_start( GTK_BOX( content_area ), label, TRUE, TRUE, 5 );
 
   gtkstock_create_ok_cancel( dialog, NULL, G_CALLBACK( set_confirmed ),
-			     &confirm, NULL );
+                             &confirm, DEFAULT_DESTROY, DEFAULT_DESTROY );
 
   gtk_widget_show_all( dialog );
   gtk_main();
Modified: trunk/fuse/ui/gtk/gtkinternals.h
===================================================================
--- trunk/fuse/ui/gtk/gtkinternals.h	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/gtkinternals.h	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* gtkinternals.h: stuff internal to the GTK+ UI
    Copyright (c) 2003-2005 Philip Kendall
 
-   $Id: gtkinternals.h 4723 2012-07-08 13:26:15Z fredm $
+   $Id: gtkinternals.h 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -108,7 +108,8 @@
 					  GtkAccelGroup *accel,
 	/* for OK button -> */	          GCallback action,
 				          gpointer actiondata,
-	/* for both buttons -> */         GCallback destroy );
+	/* for both buttons -> */         GCallback destroy_ok,
+	                                  GCallback destroy_cancel );
 GtkAccelGroup* gtkstock_create_close( GtkWidget *widget, GtkAccelGroup *accel,
 				      GCallback destroy,
 				      gboolean esconly );
Modified: trunk/fuse/ui/gtk/gtkjoystick.c
===================================================================
--- trunk/fuse/ui/gtk/gtkjoystick.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/gtkjoystick.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* gtkjoystick.c: Joystick emulation
    Copyright (c) 2003-2004 Darren Salt, Philip Kendall
 
-   $Id: gtkjoystick.c 4915 2013-04-07 05:32:09Z fredm $
+   $Id: gtkjoystick.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -231,7 +231,7 @@
   g_object_unref( model );
 
   gtkstock_create_ok_cancel( dialog, NULL, G_CALLBACK( joystick_done ),
-			     &info, NULL );
+                             &info, DEFAULT_DESTROY, DEFAULT_DESTROY );
 
   gtk_widget_show_all( dialog );
   gtk_main();
Modified: trunk/fuse/ui/gtk/gtkui.c
===================================================================
--- trunk/fuse/ui/gtk/gtkui.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/gtkui.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* gtkui.c: GTK+ routines for dealing with the user interface
    Copyright (c) 2000-2005 Philip Kendall, Russell Marks
 
-   $Id: gtkui.c 4740 2012-10-10 12:48:21Z fredm $
+   $Id: gtkui.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -456,8 +456,9 @@
 
   /* Create and add the actions buttons to the dialog box */
   gtkstock_create_ok_cancel( dialog.dialog, NULL,
-			     G_CALLBACK( menu_options_filter_done ),
-			     (gpointer) &dialog, NULL );
+                             G_CALLBACK( menu_options_filter_done ),
+                             (gpointer) &dialog, DEFAULT_DESTROY,
+                             DEFAULT_DESTROY );
 
   gtk_widget_show_all( dialog.dialog );
 
@@ -589,8 +590,9 @@
 
   /* Create and add the actions buttons to the dialog box */
   gtkstock_create_ok_cancel( dialog.dialog, NULL,
-			     G_CALLBACK( menu_machine_select_done ),
-			     (gpointer) &dialog, NULL );
+                             G_CALLBACK( menu_machine_select_done ),
+                             (gpointer) &dialog, DEFAULT_DESTROY,
+                             DEFAULT_DESTROY );
 
   gtk_widget_show_all( dialog.dialog );
 
@@ -749,8 +751,9 @@
 
   /* Create and add the actions buttons to the dialog box */
   gtkstock_create_ok_cancel( dialog.dialog, NULL,
-			     G_CALLBACK( confirm_joystick_done ),
-			     (gpointer) &dialog, NULL );
+                             G_CALLBACK( confirm_joystick_done ),
+                             (gpointer) &dialog, DEFAULT_DESTROY,
+                             DEFAULT_DESTROY );
 
   gtk_widget_show_all( dialog.dialog );
 
Modified: trunk/fuse/ui/gtk/options.pl
===================================================================
--- trunk/fuse/ui/gtk/options.pl	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/options.pl	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,9 +1,9 @@
 #!/usr/bin/perl -w
 
 # options.pl: generate options dialog boxes
-# $Id: options.pl 4723 2012-07-08 13:26:15Z fredm $
+# $Id: options.pl 4962 2013-05-19 05:25:15Z sbaldovi $
 
-# Copyright (c) 2002-2004 Philip Kendall
+# Copyright (c) 2002-2013 Philip Kendall
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -36,14 +36,14 @@
 my %combo_default;
 
 print Fuse::GPL( 'options.c: options dialog boxes',
-		 '2001-2004 Philip Kendall' ) . << "CODE";
+                 '2001-2013 Philip Kendall' ) . << "CODE";
 
 /* This file is autogenerated from options.dat by options.pl.
    Do not edit unless you know what you\'re doing! */
 
 #include <config.h>
 
-#ifdef UI_GTK		/* Use this file iff we're using GTK+ */
+#ifdef UI_GTK                /* Use this file if we're using GTK+ */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -65,8 +65,9 @@
 
 static int
 option_enumerate_combo( const char **options, char *value, guint count,
-			int def ) {
-  int i;
+                        int def )
+{
+  guint i;
   if( value != NULL ) {
     for( i = 0; i < count; i++) {
       if( !strcmp( value, options[ i ] ) )
@@ -126,11 +127,12 @@
 		}
 		print << "CODE";
 int
-option_enumerate_$_->{name}_$widget->{value}( void ) {
+option_enumerate_$_->{name}_$widget->{value}( void )
+{
   return option_enumerate_combo( $_->{name}_$widget->{value}_combo,
-				 settings_current.$widget->{value},
-				 $_->{name}_$widget->{value}_combo_count,
-				 $combo_default{$widget->{value}} );
+                                 settings_current.$widget->{value},
+                                 $_->{name}_$widget->{value}_combo_count,
+                                 $combo_default{$widget->{value}} );
 }
 
 CODE
@@ -171,7 +173,7 @@
   dialog.$widget->{value} =
     gtk_check_button_new_with_label( "$text" );
   gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( dialog.$widget->{value} ),
-				settings_current.$widget->{value} );
+                                settings_current.$widget->{value} );
   gtk_container_add( GTK_CONTAINER( content_area ), dialog.$widget->{value} );
 
 CODE
@@ -187,7 +189,7 @@
     gchar buffer[80];
 
     gtk_box_pack_start( GTK_BOX( content_area ), frame, TRUE, TRUE, 0 );
-				    
+
     gtk_container_set_border_width( GTK_CONTAINER( hbox ), 4 );
     gtk_container_add( GTK_CONTAINER( frame ), hbox );
 
@@ -210,7 +212,7 @@
     GtkWidget *hbox = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
     GtkWidget *combo = gtk_combo_box_text_new();
     GtkWidget *text = gtk_label_new( "$text" );
-    int i;
+    guint i;
 
     gtk_box_pack_start( GTK_BOX( hbox ), text, FALSE, FALSE, 5 );
     text = gtk_label_new( " " );
@@ -244,8 +246,8 @@
     print << "CODE";
   /* Create the OK and Cancel buttons */
   gtkstock_create_ok_cancel( dialog.dialog, NULL,
-			     G_CALLBACK( menu_options_$_->{name}_done ),
-			     (gpointer) &dialog, NULL );
+                             G_CALLBACK( menu_options_$_->{name}_done ),
+                             (gpointer) &dialog, NULL, DEFAULT_DESTROY );
 
   /* Display the window */
   gtk_widget_show_all( dialog.dialog );
@@ -265,6 +267,18 @@
 
 CODE
 
+    if( $_->{postcheck} ) {
+
+      print << "CODE";
+  /* Get a copy of current settings */
+  settings_info original_settings;
+  memset( &original_settings, 0, sizeof( settings_info ) );
+  settings_copy( &original_settings, &settings_current );
+
+CODE
+
+    }
+
     foreach my $widget ( @{ $_->{widgets} } ) {
 
 	if( $widget->{type} eq "Checkbox" ) {
@@ -286,7 +300,7 @@
 	    print << "CODE";
   free( settings_current.$widget->{value} );
   settings_current.$widget->{value} = utils_safe_strdup( $_->{name}_$widget->{value}_combo[
-	gtk_combo_box_get_active( GTK_COMBO_BOX( ptr->$widget->{value} ) ) ] );
+    gtk_combo_box_get_active( GTK_COMBO_BOX( ptr->$widget->{value} ) ) ] );
 
 CODE
     	} else {
@@ -294,6 +308,26 @@
 	}
     }
 
+    if( $_->{postcheck} ) {
+
+      print << "CODE";
+  int needs_hard_reset = $_->{postcheck}();
+
+  /* Confirm reset */
+  if( needs_hard_reset && !gtkui_confirm("Some options need to reset the machine. Reset?" ) ) {
+
+    /* Cancel new settings */
+    settings_copy( &settings_current, &original_settings );
+    settings_free( &original_settings );
+    return;
+  }
+
+  settings_free( &original_settings );
+
+CODE
+
+    }
+
     print << "CODE";
   gtk_widget_destroy( ptr->dialog );
 
@@ -307,6 +341,7 @@
 
   gtk_main_quit();
 }
+
 CODE
 
 }
Modified: trunk/fuse/ui/gtk/pokemem.c
===================================================================
--- trunk/fuse/ui/gtk/pokemem.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/pokemem.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* pokemem.c: GTK+ interface that handles pok files
    Copyright (c) 2011 Philip Kendall, Sergio Baldoví
 
-   $Id: pokemem.c 4769 2012-11-22 12:42:08Z fredm $
+   $Id: pokemem.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -182,6 +182,7 @@
   gtkstock_create_ok_cancel( dialog, accel_group,
                              G_CALLBACK( pokemem_update_list ),
                              (gpointer) &dialog,
+                             G_CALLBACK( pokemem_close ),
                              G_CALLBACK( pokemem_close ) );
   gtk_accel_group_disconnect_key( accel_group, GDK_KEY_Return, 0 );
 
Modified: trunk/fuse/ui/gtk/rollback.c
===================================================================
--- trunk/fuse/ui/gtk/rollback.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/rollback.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* rollback.c: select a rollback point
    Copyright (c) 2004 Philip Kendall
 
-   $Id: rollback.c 4708 2012-05-25 12:14:50Z fredm $
+   $Id: rollback.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -100,7 +100,7 @@
   list = create_rollback_list();
 
   gtkstock_create_ok_cancel( dialog, NULL, G_CALLBACK( select_row ), list,
-                             NULL );
+                             DEFAULT_DESTROY, DEFAULT_DESTROY );
 
   content_area = gtk_dialog_get_content_area( GTK_DIALOG( dialog ) );
   gtk_box_pack_start( GTK_BOX( content_area ), list, TRUE, TRUE, 0 );
Modified: trunk/fuse/ui/gtk/roms.c
===================================================================
--- trunk/fuse/ui/gtk/roms.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/roms.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* roms.c: ROM selector dialog box
    Copyright (c) 2003-2004 Philip Kendall
 
-   $Id: roms.c 4723 2012-07-08 13:26:15Z fredm $
+   $Id: roms.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -75,7 +75,7 @@
 
   /* Create the OK and Cancel buttons */
   gtkstock_create_ok_cancel( dialog, NULL, G_CALLBACK( roms_done ), &info,
-			     NULL );
+                             DEFAULT_DESTROY, DEFAULT_DESTROY );
 
   /* And the current values of each of the ROMs */
   vbox = GTK_BOX( gtk_dialog_get_content_area( GTK_DIALOG( dialog ) ) );
Modified: trunk/fuse/ui/gtk/stock.c
===================================================================
--- trunk/fuse/ui/gtk/stock.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/gtk/stock.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* stock.c: 'standard' GTK+ widgets etc
    Copyright (c) 2004 Darren Salt, Philip Kendall
 
-   $Id: stock.c 4723 2012-07-08 13:26:15Z fredm $
+   $Id: stock.c 4962 2013-05-19 05:25:15Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -147,14 +147,15 @@
 
 GtkAccelGroup*
 gtkstock_create_ok_cancel( GtkWidget *widget, GtkAccelGroup *accel,
-			   GCallback action, gpointer actiondata,
-			   GCallback destroy )
+                           GCallback action, gpointer actiondata,
+                           GCallback destroy_ok, GCallback destroy_cancel )
 {
   gtkstock_button btn[] = {
     { GTK_STOCK_CANCEL, NULL, NULL, NULL, 0, 0, 0, 0 },
     { GTK_STOCK_OK, NULL, NULL, NULL, 0, 0, 0, 0 },
   };
-  btn[1].destroy = btn[0].destroy = destroy ? destroy : DEFAULT_DESTROY;
+  btn[0].destroy = destroy_cancel ? destroy_cancel : NULL;
+  btn[1].destroy = destroy_ok ? destroy_ok : NULL;
   btn[1].action = action;
   btn[1].actiondata = actiondata;
 
Modified: trunk/fuse/ui/options.dat
===================================================================
--- trunk/fuse/ui/options.dat	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/options.dat	2013-05-19 12:37:08 UTC (rev 753)
@@ -46,6 +46,7 @@
 Checkbox, Spectra(n)et, spectranet, INPUT_KEY_n
 Checkbox, Spe(c)tranet disable, spectranet_disable, INPUT_KEY_c
 #endif
+Postcheck, periph_postcheck
 Posthook, periph_posthook
 
 peripherals_disk
@@ -63,6 +64,7 @@
 Checkbox, (B)eta 128 interface, beta128, INPUT_KEY_b
 Checkbox, Beta 128 (a)uto-boot in 48K machines, beta128_48boot, INPUT_KEY_a
 Checkbox, (O)pus Discovery interface, opus, INPUT_KEY_o
+Postcheck, periph_postcheck
 Posthook, periph_posthook
 
 rzx
Modified: trunk/fuse/ui/widget/options.pl
===================================================================
--- trunk/fuse/ui/widget/options.pl	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/widget/options.pl	2013-05-19 12:37:08 UTC (rev 753)
@@ -3,7 +3,7 @@
 # options.pl: generate options dialog boxes
 # Copyright (c) 2001-2008 Philip Kendall, Fredrick Meunier
 
-# $Id: options.pl 4913 2013-03-25 11:00:51Z fredm $
+# $Id: options.pl 4961 2013-05-19 05:17:30Z sbaldovi $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -363,11 +363,9 @@
 int
 widget_options_finish( widget_finish_state finished )
 {
-  int error = 0;
-
   /* If we exited normally, actually set the options */
   if( finished == WIDGET_FINISHED_OK ) {
-    error = settings_copy( &settings_current, &widget_options_settings );
+    settings_copy( &settings_current, &widget_options_settings );
     /* Bring the peripherals list into sync with the new options */
     periph_posthook();
     /* make the needed UI changes */
@@ -375,7 +373,6 @@
   }
   settings_free( &widget_options_settings );
   memset( &widget_options_settings, 0, sizeof( settings_info ) );
-  if( error ) return error;
 
   return 0;
 }
@@ -434,8 +431,7 @@
   if( !widget_$_->{name}_running ) {		/* we want to copy settings, only when start up */
     highlight_line = 0;
     /* Get a copy of the current settings */
-    error = settings_copy( &widget_options_settings, &settings_current );
-    if( error ) { settings_free( &widget_options_settings ); return error; }
+    settings_copy( &widget_options_settings, &settings_current );
     widget_$_->{name}_running = 1;
   }
 
Modified: trunk/fuse/ui/widget/roms.c
===================================================================
--- trunk/fuse/ui/widget/roms.c	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/widget/roms.c	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,7 +1,7 @@
 /* roms.c: select ROMs widget
    Copyright (c) 2003-2004 Philip Kendall
 
-   $Id: roms.c 4633 2012-01-19 23:26:10Z pak21 $
+   $Id: roms.c 4961 2013-05-19 05:17:30Z sbaldovi $
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@
 int
 widget_roms_draw( void *data )
 {
-  int i, error;
+  int i;
   char buffer[32];
   char key[] = "\x0A ";
 
@@ -59,11 +59,7 @@
       ui_error( UI_ERROR_ERROR, "out of memory at %s:%d", __FILE__, __LINE__ );
       return 1;
     }
-    error = settings_copy( widget_settings, &settings_current );
-    if( error ) {
-      settings_free( widget_settings ); free( widget_settings );
-      return error;
-    }
+    settings_copy( widget_settings, &settings_current );
 
     info->initialised = 1;
   }
@@ -158,11 +154,8 @@
 int
 widget_roms_finish( widget_finish_state finished )
 {
-  int error;
-
   if( finished == WIDGET_FINISHED_OK ) {
-    error = settings_copy( &settings_current, widget_settings );
-    if( error ) return error;
+    settings_copy( &settings_current, widget_settings );
   }
 
   settings_free( widget_settings ); free( widget_settings );
Modified: trunk/fuse/ui/win32/options.pl
===================================================================
--- trunk/fuse/ui/win32/options.pl	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/fuse/ui/win32/options.pl	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,9 +1,9 @@
 #!/usr/bin/perl -w
 
 # options.pl: generate options dialog boxes
-# $Id: options.pl 4643 2012-01-21 16:12:10Z pak21 $
+# $Id: options.pl 4962 2013-05-19 05:25:15Z sbaldovi $
 
-# Copyright (c) 2001-2007 Philip Kendall, Marek Januszewski, Stuart Brady
+# Copyright (c) 2001-2013 Philip Kendall, Marek Januszewski, Stuart Brady
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -35,14 +35,14 @@
 my @dialogs = Fuse::Dialog::read( shift @ARGV );
 
 print Fuse::GPL( 'options.c: options dialog boxes',
-		 '2001-2009 Philip Kendall, Marek Januszewski, Stuart Brady' ) . << "CODE";
+                 '2001-2013 Philip Kendall, Marek Januszewski, Stuart Brady' ) . << "CODE";
 
 /* This file is autogenerated from options.dat by options.pl.
    Do not edit unless you know what you\'re doing! */
 
 #include <config.h>
 
-#ifdef UI_WIN32		/* Use this file iff we're using WIN32 */
+#ifdef UI_WIN32                /* Use this file if we're using WIN32 */
 
 #include <libspectrum.h>
 
@@ -57,7 +57,7 @@
 
 static int
 option_enumerate_combo( const char **options, char *value, int count,
-			int def ) {
+                        int def ) {
   int i;
   if( value != NULL ) {
     for( i = 0; i < count; i++) {
@@ -120,9 +120,9 @@
 int
 option_enumerate_$_->{name}_$widget->{value}( void ) {
   return option_enumerate_combo( $_->{name}_$widget->{value}_combo,
-				 settings_current.$widget->{value},
-				 $_->{name}_$widget->{value}_combo_count,
-				 $combo_default{$widget->{value}} );
+                                 settings_current.$widget->{value},
+                                 $_->{name}_$widget->{value}_combo_count,
+                                 $combo_default{$widget->{value}} );
 }
 
 CODE
@@ -134,67 +134,54 @@
     my $optname = uc( "OPT_$_->{name}" );
 
 print << "CODE";
-static BOOL CALLBACK
-menu_options_$_->{name}_proc( HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
+static void
+menu_options_$_->{name}_init( HWND hwndDlg )
 {
   char buffer[80];
   int i;
-  
+
   i = 0;
-  buffer[0] = '\\0';		/* Shut gcc up */
-  
-  switch( msg )
-  {
-    case WM_INITDIALOG:
-    {
-      /* FIXME: save the handle returned by LoadIcon() in win32ui.c */
-      SendMessage( hwndDlg, WM_SETICON, ICON_SMALL,
-        (LPARAM)LoadIcon( fuse_hInstance, "win32_icon" ) );
+  buffer[0] = '\\0';          /* Shut gcc up */
 
-      /* initialize the controls with current settings */
-
-      /* FIXME split *_init and *_done functions out of *_proc function */
 CODE
-
     foreach my $widget ( @{ $_->{widgets} } ) {
 	my $type = $widget->{type};
 
 	if( $type eq "Checkbox" ) {
 	    my $idcname = uc( "$widget->{value}" );
         print << "CODE";
-      SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, BM_SETCHECK,
-        settings_current.$widget->{value} ? BST_CHECKED : BST_UNCHECKED, 0 );
+  SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, BM_SETCHECK,
+    settings_current.$widget->{value} ? BST_CHECKED : BST_UNCHECKED, 0 );
 
 CODE
 	} elsif( $widget->{type} eq "Entry" ) {
 	    my $idcname = uc( "$widget->{value}" );
         print << "CODE";
-      /* FIXME This is asuming SendDlgItemMessage is not UNICODE */
-      snprintf( buffer, 80, "%d", settings_current.$widget->{value} );
-      SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, WM_SETTEXT,
-        0, (LPARAM) buffer );
+  /* FIXME This is asuming SendDlgItemMessage is not UNICODE */
+  snprintf( buffer, 80, "%d", settings_current.$widget->{value} );
+  SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, WM_SETTEXT,
+                      0, (LPARAM) buffer );
 
 CODE
 	} elsif( $type eq "Combo" ) {
           my $idcname = uc( "$widget->{value}" );
           print << "CODE";
-      for( i = 0; i < $_->{name}_$widget->{value}_combo_count; i++ ) {
-        /* FIXME This is asuming SendDlgItemMessage is not UNICODE */
-        SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, CB_ADDSTRING,
-          0, (LPARAM) $_->{name}_$widget->{value}_combo[i] );
+  for( i = 0; i < $_->{name}_$widget->{value}_combo_count; i++ ) {
+    /* FIXME This is asuming SendDlgItemMessage is not UNICODE */
+    SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, CB_ADDSTRING,
+                        0, (LPARAM) $_->{name}_$widget->{value}_combo[i] );
+  }
+  SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, CB_SETCURSEL,
+                      (LPARAM) $combo_default{$widget->{value}}, 0 );
+  if( settings_current.$widget->{value} != NULL ) {
+    for( i = 0; i < $_->{name}_$widget->{value}_combo_count; i++ ) {
+      if( !strcmp( settings_current.$widget->{value},
+                   $_->{name}_$widget->{value}_combo[i] ) ) {
+        SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname},
+                            CB_SETCURSEL, i, 0 );
       }
-      SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, CB_SETCURSEL,
-        (LPARAM) $combo_default{$widget->{value}}, 0 );
-      if( settings_current.$widget->{value} != NULL ) {
-        for( i = 0; i < $_->{name}_$widget->{value}_combo_count; i++ ) {
-          if( !strcmp( settings_current.$widget->{value},
-                       $_->{name}_$widget->{value}_combo[i] ) ) {
-            SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname},
-              CB_SETCURSEL, i, 0 );
-          }
-        }
-      }
-
+    }
+  }
 CODE
 	} else {
           die "Unknown type `$type'";
@@ -202,16 +189,29 @@
     }
 
 print << "CODE";
-      return FALSE;
+}
+
+static void
+menu_options_$_->{name}_done( HWND hwndDlg )
+{
+  char buffer[80];
+
+  buffer[0] = '\\0';          /* Shut gcc up */
+
+CODE
+
+    if( $_->{postcheck} ) {
+
+      print << "CODE";
+  /* Get a copy of current settings */
+  settings_info original_settings;
+  memset( &original_settings, 0, sizeof( settings_info ) );
+  settings_copy( &original_settings, &settings_current );
+
+CODE
+
     }
 
-    case WM_COMMAND:
-      switch( LOWORD( wParam ) )
-      {
-        case IDOK:
-        {
-          /* Read the controls and apply the settings */
-CODE
     foreach my $widget ( @{ $_->{widgets} } ) {
 	my $type = $widget->{type};
 
@@ -219,25 +219,26 @@
 	    my $idcname = uc( "$widget->{value}" );
 
 	    print << "CODE";
-          settings_current.$widget->{value} =
-            IsDlgButtonChecked( hwndDlg, IDC_${optname}_${idcname} );
+  settings_current.$widget->{value} =
+    IsDlgButtonChecked( hwndDlg, IDC_${optname}_${idcname} );
 
 CODE
 	} elsif( $widget->{type} eq "Entry" ) {
 	    my $idcname = uc( "$widget->{value}" );
         print << "CODE";
-          /* FIXME This is asuming SendDlgItemMessage is not UNICODE */
-          SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, WM_GETTEXT, 80, (LPARAM) buffer );
-          settings_current.$widget->{value} = atoi( buffer );  
+  /* FIXME This is asuming SendDlgItemMessage is not UNICODE */
+  SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, WM_GETTEXT,
+                      80, (LPARAM) buffer );
+  settings_current.$widget->{value} = atoi( buffer );
 
 CODE
 	} elsif( $widget->{type} eq "Combo" ) {
 	    my $idcname = uc( "$widget->{value}" );
 	    print << "CODE";
-          free( settings_current.$widget->{value} );
-          settings_current.$widget->{value} =
-            utils_safe_strdup( $_->{name}_$widget->{value}_combo[
-            SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, CB_GETCURSEL, 0, 0 ) ] );
+  free( settings_current.$widget->{value} );
+  settings_current.$widget->{value} =
+    utils_safe_strdup( $_->{name}_$widget->{value}_combo[
+    SendDlgItemMessage( hwndDlg, IDC_${optname}_${idcname}, CB_GETCURSEL, 0, 0 ) ] );
 
 CODE
         } else {
@@ -245,21 +246,70 @@
         }
     }
 
-    print "          $_->{posthook}();\n\n" if $_->{posthook};
+    if( $_->{postcheck} ) {
 
+      print << "CODE";
+  int needs_hard_reset = $_->{postcheck}();
+
+  /* Confirm reset */
+  if( needs_hard_reset ) {
+    ShowWindow( hwndDlg, SW_HIDE );
+
+    if( !win32ui_confirm("Some options need to reset the machine. Reset?" ) ) {
+      /* Cancel new settings */
+      settings_copy( &settings_current, &original_settings );
+      settings_free( &original_settings );
+
+      ShowWindow( hwndDlg, SW_SHOW );
+      return;
+    }
+  }
+
+  settings_free( &original_settings );
+
+CODE
+    }
+
+    print "  $_->{posthook}();\n\n" if $_->{posthook};
+
     print << "CODE";
-          win32statusbar_set_visibility( settings_current.statusbar );
-          display_refresh_all();
+  win32statusbar_set_visibility( settings_current.statusbar );
+  display_refresh_all();
 
-          EndDialog( hwndDlg, 0 );
+  EndDialog( hwndDlg, 0 );
+}
+
+static BOOL CALLBACK
+menu_options_$_->{name}_proc( HWND hwndDlg, UINT msg, WPARAM wParam GCC_UNUSED,
+                              LPARAM lParam GCC_UNUSED )
+{
+  switch( msg )
+  {
+    case WM_INITDIALOG:
+    {
+      /* FIXME: save the handle returned by LoadIcon() in win32ui.c */
+      SendMessage( hwndDlg, WM_SETICON, ICON_SMALL,
+                   (LPARAM)LoadIcon( fuse_hInstance, "win32_icon" ) );
+
+      /* initialize the controls with current settings */
+      menu_options_$_->{name}_init( hwndDlg );
+
+      return TRUE;
+    }
+
+    case WM_COMMAND:
+      switch( LOWORD( wParam ) )
+      {
+        case IDOK:
+          /* Read the controls and apply the settings */
+          menu_options_$_->{name}_done( hwndDlg );
           return 0;
-        }
 
         case IDCANCEL:
           EndDialog( hwndDlg, 0 );
           return 0;
-        }
-        break;
+      }
+      break;
 
     case WM_CLOSE:
       EndDialog( hwndDlg, 0 );
@@ -270,7 +320,7 @@
 }
 
 void
-menu_options_$_->{name}( int action )
+menu_options_$_->{name}( int action GCC_UNUSED )
 {
   fuse_emulation_pause();
 
Index: trunk/libspectrum/libspectrum
===================================================================
--- trunk/libspectrum/libspectrum	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/libspectrum/libspectrum	2013-05-19 12:37:08 UTC (rev 753)
Property changes on: trunk/libspectrum/libspectrum
___________________________________________________________________
Modified: svn:mergeinfo
## -1,5 +1,5 ##
 /vendor/fuse-emulator/0.10.0/libspectrum:556-557
 /vendor/fuse-emulator/0.10.0-pre1/libspectrum:545-546
-/vendor/fuse-emulator/current/libspectrum:530-749
+/vendor/fuse-emulator/current/libspectrum:530-752
 /vendor/fuse-emulator/fuse-1.0.0a/libspectrum:668-669
 /vendor/fuse-emulator/fuse-r4617/libspectrum:686
\ No newline at end of property
Modified: trunk/libspectrum/libspectrum/doc/libspectrum.txt
===================================================================
--- trunk/libspectrum/libspectrum/doc/libspectrum.txt	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/libspectrum/libspectrum/doc/libspectrum.txt	2013-05-19 12:37:08 UTC (rev 753)
@@ -1,4 +1,4 @@
-libspectrum 1.0.0
+libspectrum 1.1.0
 =================
 
 libspectrum is a fairly simple library designed to make the handling
@@ -1826,4 +1826,4 @@
 
 Write `data' to register `reg' of the IDE channel `chn'.
 
-$Id: libspectrum.txt 4860 2013-01-26 11:33:25Z fredm $
+$Id: libspectrum.txt 4964 2013-05-19 05:30:32Z sbaldovi $
Modified: trunk/libspectrum/libspectrum/hacking/ChangeLog
===================================================================
--- trunk/libspectrum/libspectrum/hacking/ChangeLog	2013-05-19 11:10:39 UTC (rev 752)
+++ trunk/libspectrum/libspectrum/hacking/ChangeLog	2013-05-19 12:37:08 UTC (rev 753)
@@ -946,3 +946,4 @@
 20130516 doc/libspectrum.3: update version number and date for 1.1 release.
 20130516 ChangeLog: update date in main changelog.
 20130517 README: update one more date for the 1.1 release.
+20130518 doc/libspectrum.txt: update version number for 1.1 release (Sergio).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |