From: S?bastien G. <kx...@us...> - 2004-05-05 16:01:21
|
Update of /cvsroot/vba/VisualBoyAdvance/src/gtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17105/src/gtk Modified Files: intl.h main.cpp system.cpp window.cpp window.h windowcallbacks.cpp Log Message: Extended the gettext support to the core. Minor fixes. French translation is now almost complete. Index: main.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** main.cpp 1 May 2004 14:03:59 -0000 1.3 --- main.cpp 5 May 2004 16:01:12 -0000 1.4 *************** *** 49,53 **** #endif // ! GTKMM20 Gtk::MESSAGE_ERROR, ! Gtk::BUTTONS_CLOSE); oDialog.run(); return 1; --- 49,53 ---- #endif // ! GTKMM20 Gtk::MESSAGE_ERROR, ! Gtk::BUTTONS_OK); oDialog.run(); return 1; Index: system.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/system.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** system.cpp 1 May 2004 14:03:59 -0000 1.6 --- system.cpp 5 May 2004 16:01:12 -0000 1.7 *************** *** 31,34 **** --- 31,35 ---- #include "window.h" + #include "intl.h" // Required vars, used by the emulator core *************** *** 74,88 **** va_list args; va_start(args, _csFormat); - char * csMsg = g_strdup_vprintf(_csFormat, args); - va_end(args); ! Gtk::MessageDialog oDialog(*GUI(), csMsg, ! #ifndef GTKMM20 ! false, ! #endif // ! GTKMM20 ! Gtk::MESSAGE_ERROR, ! Gtk::BUTTONS_OK); ! oDialog.run(); ! free(csMsg); } --- 75,82 ---- va_list args; va_start(args, _csFormat); ! GUI()->vPopupErrorV(_(_csFormat), args); ! ! va_end(args); } Index: intl.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/intl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** intl.h 29 Mar 2004 22:08:40 -0000 1.1 --- intl.h 5 May 2004 16:01:12 -0000 1.2 *************** *** 1,26 **** // -*- C++ -*- ! /* ! * VisualBoyAdvanced - Nintendo Gameboy/GameboyAdvance (TM) emulator ! * Copyrigh(c) 1999-2002 Forgotten (vb...@em...) ! * ! * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ! */ #ifndef __VBA_INTL_H__ #define __VBA_INTL_H__ - #ifndef GETTEXT_PACKAGE # error "GETTEXT_PACKAGE must be defined" --- 1,24 ---- // -*- C++ -*- ! // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. ! // Copyright (C) 1999-2003 Forgotten ! // Copyright (C) 2004 Forgotten and the VBA development team ! ! // 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef __VBA_INTL_H__ #define __VBA_INTL_H__ #ifndef GETTEXT_PACKAGE # error "GETTEXT_PACKAGE must be defined" Index: window.h =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/window.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** window.h 5 May 2004 01:34:31 -0000 1.15 --- window.h 5 May 2004 16:01:12 -0000 1.16 *************** *** 22,25 **** --- 22,26 ---- #include <sys/types.h> + #include <stdarg.h> #include <libglademm.h> *************** *** 67,70 **** --- 68,73 ---- const int m_iGBAScreenHeight; + void vPopupError(const char * _csFormat, ...); + void vPopupErrorV(const char * _csFormat, va_list _args); void vDrawScreen(); void vComputeFrameskip(int _iRate); Index: window.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/window.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** window.cpp 5 May 2004 01:34:31 -0000 1.15 --- window.cpp 5 May 2004 16:01:12 -0000 1.16 *************** *** 1060,1071 **** catch (const Glib::Error & e) { ! Gtk::MessageDialog oDialog(*this, ! e.what(), ! #ifndef GTKMM20 ! false, ! #endif // ! GTKMM20 ! Gtk::MESSAGE_ERROR, ! Gtk::BUTTONS_CLOSE); ! oDialog.run(); } } --- 1060,1064 ---- catch (const Glib::Error & e) { ! vPopupError(e.what().c_str()); } } *************** *** 1079,1090 **** catch (const Glib::Error & e) { ! Gtk::MessageDialog oDialog(*this, ! e.what(), ! #ifndef GTKMM20 ! false, ! #endif // ! GTKMM20 ! Gtk::MESSAGE_ERROR, ! Gtk::BUTTONS_CLOSE); ! oDialog.run(); } } --- 1072,1076 ---- catch (const Glib::Error & e) { ! vPopupError(e.what().c_str()); } } *************** *** 1234,1237 **** --- 1220,1256 ---- } + void Window::vPopupError(const char * _csFormat, ...) + { + va_list args; + va_start(args, _csFormat); + char * csMsg = g_strdup_vprintf(_csFormat, args); + va_end(args); + + Gtk::MessageDialog oDialog(*this, + csMsg, + #ifndef GTKMM20 + false, + #endif // ! GTKMM20 + Gtk::MESSAGE_ERROR, + Gtk::BUTTONS_OK); + oDialog.run(); + g_free(csMsg); + } + + void Window::vPopupErrorV(const char * _csFormat, va_list _args) + { + char * csMsg = g_strdup_vprintf(_csFormat, _args); + + Gtk::MessageDialog oDialog(*this, + csMsg, + #ifndef GTKMM20 + false, + #endif // ! GTKMM20 + Gtk::MESSAGE_ERROR, + Gtk::BUTTONS_OK); + oDialog.run(); + g_free(csMsg); + } + void Window::vDrawScreen() { *************** *** 1394,1398 **** if (! bLoaded) { - systemMessage(0, _("Failed to load file %s"), csFile); return false; } --- 1413,1416 ---- Index: windowcallbacks.cpp =================================================================== RCS file: /cvsroot/vba/VisualBoyAdvance/src/gtk/windowcallbacks.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** windowcallbacks.cpp 5 May 2004 01:34:31 -0000 1.4 --- windowcallbacks.cpp 5 May 2004 16:01:12 -0000 1.5 *************** *** 381,385 **** void Window::vOnImportBatteryFile() { ! std::string sSaveDir = m_poDirConfig->sGetKey("saves"); #ifdef GTKMM20 --- 381,385 ---- void Window::vOnImportBatteryFile() { ! std::string BatteryDir = m_poDirConfig->sGetKey("batteries"); #ifdef GTKMM20 *************** *** 388,392 **** oDialog.set_transient_for(*this); ! if (sSaveDir == "") { oDialog.set_filename(Glib::path_get_dirname(m_sRomFile) + "/"); --- 388,392 ---- oDialog.set_transient_for(*this); ! if (BatteryDir == "") { oDialog.set_filename(Glib::path_get_dirname(m_sRomFile) + "/"); *************** *** 394,398 **** else { ! oDialog.set_filename(sSaveDir + "/"); } --- 394,398 ---- else { ! oDialog.set_filename(BatteryDir + "/"); } *************** *** 403,407 **** oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); ! if (sSaveDir == "") { oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); --- 403,407 ---- oDialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); ! if (BatteryDir == "") { oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); *************** *** 409,414 **** else { ! oDialog.set_current_folder(sSaveDir); ! oDialog.add_shortcut_folder(sSaveDir); } --- 409,414 ---- else { ! oDialog.set_current_folder(BatteryDir); ! oDialog.add_shortcut_folder(BatteryDir); } *************** *** 447,458 **** else { ! Gtk::MessageDialog oErrorDialog(*this, ! _("Importing the battery file failed."), ! #ifndef GTKMM20 ! false, ! #endif // ! GTKMM20 ! Gtk::MESSAGE_ERROR, ! Gtk::BUTTONS_CLOSE); ! oErrorDialog.run(); } } --- 447,452 ---- else { ! vPopupError(_("Failed to import battery file %s."), ! oDialog.get_filename().c_str()); } } *************** *** 461,465 **** void Window::vOnExportBatteryFile() { ! std::string sSaveDir = m_poDirConfig->sGetKey("saves"); #ifdef GTKMM20 --- 455,459 ---- void Window::vOnExportBatteryFile() { ! std::string sBatteryDir = m_poDirConfig->sGetKey("batteries"); #ifdef GTKMM20 *************** *** 468,472 **** oDialog.set_transient_for(*this); ! if (sSaveDir == "") { oDialog.set_filename(Glib::path_get_dirname(m_sRomFile) + "/"); --- 462,466 ---- oDialog.set_transient_for(*this); ! if (sBatteryDir == "") { oDialog.set_filename(Glib::path_get_dirname(m_sRomFile) + "/"); *************** *** 474,478 **** else { ! oDialog.set_filename(sSaveDir + "/"); } --- 468,472 ---- else { ! oDialog.set_filename(sBatteryDir + "/"); } *************** *** 484,488 **** oDialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); ! if (sSaveDir == "") { oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); --- 478,482 ---- oDialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); ! if (sBatteryDir == "") { oDialog.set_current_folder(Glib::path_get_dirname(m_sRomFile)); *************** *** 490,495 **** else { ! oDialog.set_current_folder(sSaveDir); ! oDialog.add_shortcut_folder(sSaveDir); } --- 484,489 ---- else { ! oDialog.set_current_folder(sBatteryDir); ! oDialog.add_shortcut_folder(sBatteryDir); } *************** *** 565,576 **** else { ! Gtk::MessageDialog oErrorDialog(*this, ! _("Exporting the battery file failed."), ! #ifndef GTKMM20 ! false, ! #endif // ! GTKMM20 ! Gtk::MESSAGE_ERROR, ! Gtk::BUTTONS_CLOSE); ! oErrorDialog.run(); } } --- 559,564 ---- else { ! vPopupError(_("Failed to export battery file %s."), ! sFile.c_str()); } } |