From: <sp...@us...> - 2008-07-21 21:49:57
|
Revision: 3721 http://fuse-emulator.svn.sourceforge.net/fuse-emulator/?rev=3721&view=rev Author: specu Date: 2008-07-21 21:50:06 +0000 (Mon, 21 Jul 2008) Log Message: ----------- Win32: fixed confirmation dialog box and moved it to confirm.c similarly to gtk ui (Marek) Modified Paths: -------------- trunk/fuse/hacking/ChangeLog trunk/fuse/ui/win32/Makefile.am trunk/fuse/ui/win32/win32internals.h trunk/fuse/ui/win32/win32ui.c Added Paths: ----------- trunk/fuse/ui/win32/confirm.c Modified: trunk/fuse/hacking/ChangeLog =================================================================== --- trunk/fuse/hacking/ChangeLog 2008-07-21 20:09:50 UTC (rev 3720) +++ trunk/fuse/hacking/ChangeLog 2008-07-21 21:50:06 UTC (rev 3721) @@ -2786,3 +2786,6 @@ 20080721 ui/win32/{win32ui.c,memorybrowser.c,binary.c,debugger.c,win32display.c, browse.c,picture.c,roms.c,pokefinder.c}: Win32: make functions and variables static wherever applicable (Marek). +20080721 ui/win32/{win32ui.c,win32internals.h,confirm.c,Makefile.am}: Win32: + fixed confirmation dialog box and moved it to confirm.c similarly to + gtk ui (Marek). Modified: trunk/fuse/ui/win32/Makefile.am =================================================================== --- trunk/fuse/ui/win32/Makefile.am 2008-07-21 20:09:50 UTC (rev 3720) +++ trunk/fuse/ui/win32/Makefile.am 2008-07-21 21:50:06 UTC (rev 3721) @@ -33,6 +33,7 @@ binary.rc \ browse.c \ browse.rc \ + confirm.c \ debugger.c \ debugger.rc \ keysyms.c \ Added: trunk/fuse/ui/win32/confirm.c =================================================================== --- trunk/fuse/ui/win32/confirm.c (rev 0) +++ trunk/fuse/ui/win32/confirm.c 2008-07-21 21:50:06 UTC (rev 3721) @@ -0,0 +1,85 @@ +/* confirm.c: Confirmation dialog box + Copyright (c) 2008 Marek Januszewski + + $Id: confirm.c 3288 2007-11-09 18:12:45Z zubzero $ + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + Author contact information: + + E-mail: phi...@sh... + +*/ + +#include <config.h> + +#include <windows.h> + +#include "fuse.h" +#include "win32internals.h" +#include "settings.h" +#include "ui/ui.h" + +int +win32ui_confirm( const char *string ) +{ + int confirm; + int result; + + /* Return value isn't an error code, but signifies whether to undertake + the action */ + if( !settings_current.confirm_actions ) return 1; + + fuse_emulation_pause(); + + confirm = 0; + + result = MessageBox( fuse_hWnd, string, "Fuse - Confirm", + MB_OKCANCEL | MB_ICONQUESTION ); + if( result == IDOK ) confirm = 1; + + fuse_emulation_unpause(); + + return confirm; +} + +ui_confirm_save_t +ui_confirm_save_specific( const char *message ) +{ + ui_confirm_save_t confirm; + int result; + + if( !settings_current.confirm_actions ) return UI_CONFIRM_SAVE_DONTSAVE; + + fuse_emulation_pause(); + + confirm = UI_CONFIRM_SAVE_CANCEL; + + result = MessageBox( fuse_hWnd, message, "Fuse - Confirm", + MB_YESNOCANCEL | MB_ICONQUESTION ); + switch( result ) + { + case IDYES: + confirm = UI_CONFIRM_SAVE_SAVE; + break; + case IDNO: + confirm = UI_CONFIRM_SAVE_DONTSAVE; + break; + } + + fuse_emulation_unpause(); + + return confirm; +} Property changes on: trunk/fuse/ui/win32/confirm.c ___________________________________________________________________ Added: svn:executable + * Modified: trunk/fuse/ui/win32/win32internals.h =================================================================== --- trunk/fuse/ui/win32/win32internals.h 2008-07-21 20:09:50 UTC (rev 3720) +++ trunk/fuse/ui/win32/win32internals.h 2008-07-21 21:50:06 UTC (rev 3721) @@ -68,6 +68,12 @@ void win32mouse_button( int button, int down ); /* + * General user interface routines (win32ui.c) + */ + +int win32ui_confirm( const char *string ); + +/* * Dialog box reset */ Modified: trunk/fuse/ui/win32/win32ui.c =================================================================== --- trunk/fuse/ui/win32/win32ui.c 2008-07-21 20:09:50 UTC (rev 3720) +++ trunk/fuse/ui/win32/win32ui.c 2008-07-21 21:50:06 UTC (rev 3721) @@ -66,18 +66,6 @@ #define STUB do { printf("STUB: %s()\n", __func__); fflush(stdout); } while(0) -static int -win32ui_confirm( const char *string ) -{ - int result; - - fuse_emulation_pause(); - result = MessageBox( fuse_hWnd, string, "Fuse - Confirm", - MB_YESNO|MB_ICONQUESTION ) == IDYES; - fuse_emulation_unpause(); - return result; -} - static void handle_drop( HDROP hDrop ) { @@ -589,13 +577,6 @@ return win32ui_get_filename( title, 1 ); } -ui_confirm_save_t -ui_confirm_save_specific( const char *message ) -{ - STUB; - return UI_CONFIRM_SAVE_CANCEL; -} - ui_confirm_joystick_t ui_confirm_joystick( libspectrum_joystick libspectrum_type, int inputs ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |