From c8987da470c733dcabe498e6fc0f9fa1311f12cb Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 14 Jun 2026 16:55:59 +0900 Subject: [PATCH] menu: Remove GTK menu backend Linux and macOS now both build the pure-SDL + microui menu. Remove GTK3 detection, the ENABLE_GTK build branches, and the GTK menu sources. Decouple gettext NLS from ENABLE_GTK so menu labels stay translatable on all desktop builds, and update i18n to the new sources (POTFILES.in, .pot, ja.po). --- .github/workflows/linux.yml | 2 +- CHANGELOG.md | 3 + CMakeLists.txt | 7 +- README.md | 2 +- config.h.in | 1 - modules/NIGHTDLL/nt_event.c | 1 - modules/SACT/sprite_tevent.c | 1 - po/POTFILES.in | 6 +- po/ja.po | 158 ++------- po/xsystem35.pot | 146 ++------- src/CMakeLists.txt | 5 - src/menu.c | 174 ---------- src/menu.h | 2 - src/menu_android.c | 4 - src/menu_callback.c | 244 -------------- src/menu_callback.h | 127 -------- src/menu_emscripten.c | 4 - src/menu_gui.c | 608 ----------------------------------- src/menu_gui.h | 35 -- src/menu_gui_volval.c | 164 ---------- src/menu_sdl.c | 4 - src/nact.c | 3 - 22 files changed, 56 insertions(+), 1645 deletions(-) delete mode 100644 src/menu.c delete mode 100644 src/menu_callback.c delete mode 100644 src/menu_callback.h delete mode 100644 src/menu_gui.c delete mode 100644 src/menu_gui.h delete mode 100644 src/menu_gui_volval.c diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 7bbc0cf..17dbcb3 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -15,7 +15,7 @@ jobs: - name: Install Deps run: | sudo apt update - sudo apt install libgtk-3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libwebp-dev libportmidi-dev libcjson-dev asciidoctor + sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libwebp-dev libportmidi-dev libcjson-dev asciidoctor - name: Build run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 0229fee..f2a0f82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## Unreleased +- Replaced the GTK-based popup menu and dialogs with a pure-SDL implementation. + ## 2.18.0 - 2026-06-23 - Added support for the intro demo of Daiakuji. - Replaced the bundled mincho font with IPA Mincho. diff --git a/CMakeLists.txt b/CMakeLists.txt index cb3f781..ac97fee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,11 +87,6 @@ else() # non-emscripten, non-android add_library(zlib ALIAS ZLIB::ZLIB) include(FindPkgConfig) - optional_pkg_check_modules(GTK3 IMPORTED_TARGET gtk+-3.0) - if (GTK3_FOUND) - set(ENABLE_GTK 1) - endif() - pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2) pkg_check_modules(SDL2TTF REQUIRED IMPORTED_TARGET SDL2_ttf) pkg_check_modules(SDL2MIXER REQUIRED IMPORTED_TARGET SDL2_mixer) @@ -155,7 +150,7 @@ endif() # Menu -if (ENABLE_GTK) +if (NOT EMSCRIPTEN AND NOT ANDROID AND NOT WIN32) # i18n support (currently only menus are translated) include(FindIntl) include(FindGettext) diff --git a/README.md b/README.md index 5151efd..00e8098 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ See [xsystem35 command manual](doc/xsystem35.6.adoc) for detailed usage. ### Linux (Debian / Ubuntu) ```bash -$ sudo apt install build-essential cmake libgtk-3-dev libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libwebp-dev libportmidi-dev libcjson-dev asciidoctor +$ sudo apt install build-essential cmake libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev libwebp-dev libportmidi-dev libcjson-dev asciidoctor $ mkdir -p out/debug $ cd out/debug $ cmake -DCMAKE_BUILD_TYPE=Debug ../../ diff --git a/config.h.in b/config.h.in index 5af3e50..f550cf5 100644 --- a/config.h.in +++ b/config.h.in @@ -4,7 +4,6 @@ #cmakedefine CACHE_TOTALSIZE @CACHE_TOTALSIZE@ #cmakedefine ENABLE_DEBUGGER @ENABLE_DEBUGGER@ -#cmakedefine ENABLE_GTK @ENABLE_GTK@ #cmakedefine ENABLE_MIDI_SDLMIXER @ENABLE_MIDI_SDLMIXER@ #cmakedefine ENABLE_MIDI_PORTMIDI @ENABLE_MIDI_PORTMIDI@ #cmakedefine ENABLE_NLS @ENABLE_NLS@ diff --git a/modules/NIGHTDLL/nt_event.c b/modules/NIGHTDLL/nt_event.c index 607ab10..03a6152 100644 --- a/modules/NIGHTDLL/nt_event.c +++ b/modules/NIGHTDLL/nt_event.c @@ -99,7 +99,6 @@ void ntev_callback(agsevent_t *e) { void ntev_main() { // デフォルトのコールバックのうち、ここで必要なものだけ処理。 if (nact->popupmenu_opened) { - menu_gtkmainiteration(); if (nact->is_quit) sys_exit(0); } } diff --git a/modules/SACT/sprite_tevent.c b/modules/SACT/sprite_tevent.c index 5b3b196..4da4703 100644 --- a/modules/SACT/sprite_tevent.c +++ b/modules/SACT/sprite_tevent.c @@ -121,7 +121,6 @@ void spev_main() { // デフォルトのコールバックのうち、ここで必要なものだけ // 処理。(VAコマンドcallbackはなし) if (nact->popupmenu_opened) { - menu_gtkmainiteration(); if (nact->is_quit) sys_exit(0); } } diff --git a/po/POTFILES.in b/po/POTFILES.in index e995d2e..2653840 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,5 +1 @@ -./src/menu.c -./src/menu_gui.c -./src/menu_gui_volval.c -./src/s39init.c - +./src/menu_sdl.c diff --git a/po/ja.po b/po/ja.po index c49b027..a5f8ac9 100644 --- a/po/ja.po +++ b/po/ja.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: xsystem35 1.7.3pre3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-14 18:38+0900\n" -"PO-Revision-Date: 2004-08-24 14:40+0900\n" +"POT-Creation-Date: 2026-06-14 17:09+0900\n" +"PO-Revision-Date: 2026-06-14 17:09+0900\n" "Last-Translator: CHIKAMA Masaki \n" "Language-Team: Japanese \n" "Language: ja\n" @@ -17,143 +17,39 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/menu_gui.c:127 src/menu_gui.c:137 src/menu_gui.c:147 -msgid "0" -msgstr "" +#: src/menu_sdl.c:151 +msgid "Message Skip" +msgstr "メッセージスキップ" -#: src/menu_gui.c:374 src/menu_gui.c:658 -msgid "About" -msgstr "情報" +#: src/menu_sdl.c:156 +msgid "Mouse Auto Move" +msgstr "マウスカーソル移動" -#: src/menu_gui.c:593 -msgid "CDROM-audio" -msgstr "CDROMオーディオ" +#: src/menu_sdl.c:159 +msgid "Volume" +msgstr "ボリューム" -#: src/menu_gui.c:171 src/menu_gui.c:266 -msgid "Cancel" -msgstr "キャンセル" - -#: src/menu_gui.c:306 src/menu_gui.c:673 +#: src/menu_sdl.c:164 msgid "Exit" msgstr "終了" -#: src/menu_gui.c:317 -msgid "Exit System35 ?" -msgstr "System35を終了しますか?" - -#: src/menu_gui.c:400 -msgid "Information1" -msgstr "情報1" - -#: src/menu_gui.c:410 -msgid "Information2" -msgstr "情報2" - -#: src/menu_gui.c:420 -msgid "Information3" -msgstr "情報3" - -#: src/menu_gui.c:60 -msgid "InputNumber" -msgstr "数値入力" - -#: src/menu_gui.c:214 -msgid "InputString" -msgstr "文字列入力" - -#: src/menu.c:69 -#, c-format -msgid "MAX %d charater" -msgstr "最大 %d 文字" - -#: src/menu_gui.c:241 -msgid "MAX charater" -msgstr "最大文字数" - -#: src/menu_gui.c:621 -msgid "MIDI-audio" -msgstr "MIDIオーディオ" - -#: src/menu_gui.c:764 -#, fuzzy -msgid "MessageBox" -msgstr "メッセージスキップ" - -#: src/menu_gui.c:485 -msgid "MessageSkip" -msgstr "メッセージスキップ" - -#: src/menu_gui.c:774 -#, fuzzy -msgid "Messge" -msgstr "メッセージスキップ" - -#: src/menu_gui.c:521 -msgid "MouseAutoMove" -msgstr "マウスカーソル移動" - -#: src/menu_gui.c:338 -msgid "No" -msgstr "いいえ" - -#: src/menu_gui.c:250 -msgid "Notice) HANKAKU is not available" -msgstr "註)全角文字のみ有効" - -#: src/menu_gui.c:505 src/menu_gui.c:541 src/menu_gui.c:585 src/menu_gui.c:613 -#: src/menu_gui.c:641 -msgid "OFF" -msgstr "無効" - -#: src/menu_gui.c:164 src/menu_gui.c:273 src/menu_gui.c:426 src/menu_gui.c:781 -msgid "OK" -msgstr "OK" - -#: src/menu_gui.c:497 src/menu_gui.c:533 src/menu_gui.c:577 src/menu_gui.c:605 -#: src/menu_gui.c:633 -msgid "ON" -msgstr "有効" - -#: src/menu_gui.c:565 -msgid "PCM-audio" -msgstr "PCMオーディオ" - -#: src/menu_gui.c:557 src/menu_gui_volval.c:43 -msgid "VolumeValance" -msgstr "ボリュームバランス" - -#: src/menu_gui.c:331 -msgid "Yes" -msgstr "はい" - -#: src/menu_gui.c:97 src/menu_gui.c:745 -msgid "default" -msgstr "既定値" - -#: src/menu_gui_volval.c:122 -msgid "large" -msgstr "大" - -#: src/menu_gui.c:117 -msgid "max" -msgstr "最大値" - -#: src/menu_gui.c:107 -msgid "min" -msgstr "最小値" - -#: src/menu_gui_volval.c:89 +#: src/menu_sdl.c:252 msgid "mute" msgstr "ミュート" -#: src/menu_gui_volval.c:114 -msgid "small" -msgstr "小" +#: src/menu_sdl.c:260 +msgid "Close" +msgstr "閉じる" -#: src/menu_gui.c:225 -msgid "title" -msgstr "タイトル" +#: src/menu_sdl.c:378 src/menu_sdl.c:383 src/menu_sdl.c:529 +msgid "OK" +msgstr "OK" -#: src/menu_gui_volval.c:41 -msgid "window1" -msgstr "" +#: src/menu_sdl.c:385 src/menu_sdl.c:533 +msgid "Cancel" +msgstr "キャンセル" + +#: src/menu_sdl.c:521 +#, c-format +msgid "Up to %d characters" +msgstr "最大 %d 文字" diff --git a/po/xsystem35.pot b/po/xsystem35.pot index 5aa2a7c..279c986 100644 --- a/po/xsystem35.pot +++ b/po/xsystem35.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-14 18:38+0900\n" +"POT-Creation-Date: 2026-06-14 17:09+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,141 +17,39 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/menu.c:69 -#, c-format -msgid "MAX %d charater" +#: src/menu_sdl.c:151 +msgid "Message Skip" msgstr "" -#: src/menu_gui.c:60 -msgid "InputNumber" +#: src/menu_sdl.c:156 +msgid "Mouse Auto Move" msgstr "" -#: src/menu_gui.c:97 src/menu_gui.c:745 -msgid "default" +#: src/menu_sdl.c:159 +msgid "Volume" msgstr "" -#: src/menu_gui.c:107 -msgid "min" -msgstr "" - -#: src/menu_gui.c:117 -msgid "max" -msgstr "" - -#: src/menu_gui.c:127 src/menu_gui.c:137 src/menu_gui.c:147 -msgid "0" -msgstr "" - -#: src/menu_gui.c:164 src/menu_gui.c:273 src/menu_gui.c:426 src/menu_gui.c:781 -msgid "OK" -msgstr "" - -#: src/menu_gui.c:171 src/menu_gui.c:266 -msgid "Cancel" -msgstr "" - -#: src/menu_gui.c:214 -msgid "InputString" -msgstr "" - -#: src/menu_gui.c:225 -msgid "title" -msgstr "" - -#: src/menu_gui.c:241 -msgid "MAX charater" -msgstr "" - -#: src/menu_gui.c:250 -msgid "Notice) HANKAKU is not available" -msgstr "" - -#: src/menu_gui.c:306 src/menu_gui.c:673 +#: src/menu_sdl.c:164 msgid "Exit" msgstr "" -#: src/menu_gui.c:317 -msgid "Exit System35 ?" -msgstr "" - -#: src/menu_gui.c:331 -msgid "Yes" -msgstr "" - -#: src/menu_gui.c:338 -msgid "No" -msgstr "" - -#: src/menu_gui.c:374 src/menu_gui.c:658 -msgid "About" -msgstr "" - -#: src/menu_gui.c:400 -msgid "Information1" -msgstr "" - -#: src/menu_gui.c:410 -msgid "Information2" -msgstr "" - -#: src/menu_gui.c:420 -msgid "Information3" -msgstr "" - -#: src/menu_gui.c:485 -msgid "MessageSkip" -msgstr "" - -#: src/menu_gui.c:497 src/menu_gui.c:533 src/menu_gui.c:577 src/menu_gui.c:605 -#: src/menu_gui.c:633 -msgid "ON" -msgstr "" - -#: src/menu_gui.c:505 src/menu_gui.c:541 src/menu_gui.c:585 src/menu_gui.c:613 -#: src/menu_gui.c:641 -msgid "OFF" -msgstr "" - -#: src/menu_gui.c:521 -msgid "MouseAutoMove" -msgstr "" - -#: src/menu_gui.c:557 src/menu_gui_volval.c:43 -msgid "VolumeValance" -msgstr "" - -#: src/menu_gui.c:565 -msgid "PCM-audio" -msgstr "" - -#: src/menu_gui.c:593 -msgid "CDROM-audio" -msgstr "" - -#: src/menu_gui.c:621 -msgid "MIDI-audio" -msgstr "" - -#: src/menu_gui.c:764 -msgid "MessageBox" -msgstr "" - -#: src/menu_gui.c:774 -msgid "Messge" -msgstr "" - -#: src/menu_gui_volval.c:41 -msgid "window1" -msgstr "" - -#: src/menu_gui_volval.c:89 +#: src/menu_sdl.c:252 msgid "mute" msgstr "" -#: src/menu_gui_volval.c:114 -msgid "small" +#: src/menu_sdl.c:260 +msgid "Close" msgstr "" -#: src/menu_gui_volval.c:122 -msgid "large" +#: src/menu_sdl.c:378 src/menu_sdl.c:383 src/menu_sdl.c:529 +msgid "OK" +msgstr "" + +#: src/menu_sdl.c:385 src/menu_sdl.c:533 +msgid "Cancel" +msgstr "" + +#: src/menu_sdl.c:521 +#, c-format +msgid "Up to %d characters" msgstr "" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67dcb85..87f9083 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -122,8 +122,6 @@ if (EMSCRIPTEN) target_sources(xsystem35 PRIVATE menu_emscripten.c) elseif (ANDROID) target_sources(xsystem35 PRIVATE menu_android.c) -elseif (ENABLE_GTK) - target_sources(xsystem35 PRIVATE menu.c menu_callback.c menu_gui.c s39init.c) else () target_sources(xsystem35 PRIVATE menu_sdl.c editor.c modal.c microui/microui.c s39init.c) @@ -182,9 +180,6 @@ else() # non-emscripten, non-android if (TARGET cJSON) target_link_libraries(xsystem35 PRIVATE cJSON) endif() - if (GTK3_FOUND) - target_link_libraries(xsystem35 PRIVATE PkgConfig::GTK3) - endif() if (ENABLE_MIDI_PORTMIDI) target_link_libraries(xsystem35 PRIVATE ${PORTMIDI}) endif() diff --git a/src/menu.c b/src/menu.c deleted file mode 100644 index 5f43c7c..0000000 --- a/src/menu.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * menu.c popup menu - * - * Copyright (C) 2000- Masaki Chikama (Wren) - * - * 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 - * -*/ -/* $Id: menu.c,v 1.14 2002/09/18 13:16:22 chikama Exp $ */ - -#include -#include -#include - -#include "portab.h" -#include "menu.h" -#include "menu_gui.h" -#include "menu_callback.h" -#include "nact.h" -#include "input.h" -#include "msgskip.h" - -static bool menu_initilized = false; - -static int menu_callback() { - sys_getInputInfo(); - return true; -} - - -void menu_open(void) { - if (!menu_initilized) return; - - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item_msgskip_on), msgskip_isActivated()); - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(menu_item_msgskip_off), !msgskip_isActivated()); - GdkDisplay *display = gdk_display_get_default(); - GdkDevice *device = gdk_seat_get_pointer(gdk_display_get_default_seat(display)); - GdkScreen *screen; - gint x, y; - gdk_device_get_position(device, &screen, &x, &y); - GdkRectangle rect = {x, y, 1, 1}; - gtk_menu_popup_at_rect( - GTK_MENU(menu_window_popup), gdk_screen_get_root_window(screen), - &rect, GDK_GRAVITY_NORTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL); - gtk_widget_show(menu_window_popup); - nact->popupmenu_opened = true; -} - -void menu_quitmenu_open(void) { - if (!menu_initilized) return; - - gtk_widget_show(menu_window_exit); - nact->popupmenu_opened = true; -} - -bool menu_inputstring(INPUTSTRING_PARAM *p) { - char s[256]; - - if (!menu_initilized) return false; - - menu_ok_input = false; - gtk_label_set_text(GTK_LABEL(menu_label_inputstring_title), p->title); - - sprintf(s, _("MAX %d charater"), p->max); - gtk_label_set_text(GTK_LABEL(menu_label_inputstring_maxchar), strdup(s)); - - gtk_entry_set_max_length(GTK_ENTRY(menu_textentry), p->max *2); - gtk_entry_set_text(GTK_ENTRY(menu_textentry), p->oldstring); - - gtk_widget_show(menu_window_is); - - g_idle_add(menu_callback, menu_window_is); - gtk_main(); - g_idle_remove_by_data(menu_window_is); - - if (menu_ok_input) { - p->newstring = menu_textentry_string; - } else { - p->newstring = p->oldstring; - } - return true; -} - -bool menu_inputstring2(INPUTSTRING_PARAM *p) { - if (!menu_initilized) return false; - - menu_ok_input = false; - gtk_entry_set_max_length(GTK_ENTRY(menu_textentry2), p->max *2); - gtk_entry_set_text(GTK_ENTRY(menu_textentry2), p->oldstring); - gtk_widget_set_size_request(menu_textentry2, p->h * p->max + 8, p->h + 4); - - gtk_widget_show(menu_window_is2); - - g_idle_add(menu_callback, menu_window_is2); - gtk_main(); - g_idle_remove_by_data(menu_window_is2); - - if (menu_ok_input) { - p->newstring = menu_textentry_string; - } else { - p->newstring = p->oldstring; - } - return true; -} - -bool menu_inputnumber(INPUTNUM_PARAM *p) { - GtkAdjustment *adj; - char s[256]; - - if (!menu_initilized) return false; - - menu_ok_input = false; - - gtk_window_set_title (GTK_WINDOW(menu_window_in), p->title); - sprintf(s, "%d ", p->max); - gtk_label_set_text(GTK_LABEL(menu_label_inputnum_max), s); - sprintf(s, "%d ", p->min); - gtk_label_set_text(GTK_LABEL(menu_label_inputnum_min), s); - sprintf(s, "%d ", p->def); - gtk_label_set_text(GTK_LABEL(menu_label_inputnum_def), s); - - adj = gtk_adjustment_new (p->def, p->min, p->max, 1, 1, 1); - gtk_spin_button_set_adjustment(GTK_SPIN_BUTTON(menu_spinbutton), GTK_ADJUSTMENT(adj)); - /* こうしないと前の value が表示される */ - gtk_spin_button_set_value(GTK_SPIN_BUTTON(menu_spinbutton), p->def); - - gtk_widget_show(menu_window_in); - - g_idle_add(menu_callback, menu_window_in); - gtk_main(); - g_idle_remove_by_data(menu_window_in); - - if (!menu_ok_input) - return false; // cancelled - p->value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(menu_spinbutton)); - return true; -} - -void menu_init() { - menu_initilized = true; - menu_window_popup = create_menu1(); - menu_window_in = create_window1(); - menu_window_is = create_window2(); - menu_window_exit = create_window3(); - menu_window_about = create_window4(); - menu_window_is2 = create_window5(); -} - -void menu_gtkmainiteration() { - if (!menu_initilized) return; - - while (gtk_events_pending()) { - gtk_main_iteration(); - menu_callback(); - } -} - -void menu_render_overlay(void) { -} - -void menu_setSkipState(bool enabled, bool activated) { -} diff --git a/src/menu.h b/src/menu.h index a7943c3..8a0c3fc 100644 --- a/src/menu.h +++ b/src/menu.h @@ -51,9 +51,7 @@ extern void menu_resetmenu_open(void); extern bool menu_inputstring(INPUTSTRING_PARAM *); extern bool menu_inputstring2(INPUTSTRING_PARAM *); extern bool menu_inputnumber(INPUTNUM_PARAM *); -extern void menu_widgetinit(void); extern void menu_init(); -extern void menu_gtkmainiteration(); extern void menu_setSkipState(bool enabled, bool activated); extern void menu_render_overlay(void); diff --git a/src/menu_android.c b/src/menu_android.c index 3b14aff..d150ad6 100644 --- a/src/menu_android.c +++ b/src/menu_android.c @@ -125,10 +125,6 @@ void menu_init(void) { return; } -void menu_gtkmainiteration() { - return; -} - void menu_render_overlay(void) { return; } diff --git a/src/menu_callback.c b/src/menu_callback.c deleted file mode 100644 index 254fabc..0000000 --- a/src/menu_callback.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * menu_callback.c menu callback function - * - * Copyright (C) 2000- Masaki Chikama (Wren) - * - * 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 - * -*/ -/* $Id: menu_callback.c,v 1.11 2003/04/25 17:23:55 chikama Exp $ */ - -#include "config.h" - -#include "portab.h" -#include "menu.h" -#include "menu_callback.h" -#include "menu_gui.h" -#include "nact.h" -#include "msgskip.h" -#include "s39init.h" - -bool menu_ok_exit; /* exit window で OK が押されたかどうか */ -bool menu_ok_input; /* 文字列/数値入力 window で OK が... */ - -GtkWidget *menu_item_msgskip_on; -GtkWidget *menu_item_msgskip_off; - -GtkWidget *menu_label_inputstring_title; -GtkWidget *menu_label_inputstring_maxchar; -GtkWidget *menu_label_inputnum_max; -GtkWidget *menu_label_inputnum_min; -GtkWidget *menu_label_inputnum_def; -GtkWidget *menu_spinbutton; -GtkWidget *menu_textentry; -GtkWidget *menu_textentry2; -const gchar *menu_textentry_string; - -GtkWidget *menu_window_popup; /* popup menu */ -GtkWidget *menu_window_exit; /* exit window */ -GtkWidget *menu_window_is; /* input string window */ -GtkWidget *menu_window_is2; /* input string window no 2*/ -GtkWidget *menu_window_in; /* input number window */ -GtkWidget *menu_window_about; /* about xsystem35 window */ - -void -on_window3_destroy (GObject *object, - gpointer user_data) -{ - -} - -/* message skip on */ -void -on_item2_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - msgskip_activate(true); - gtk_menu_popdown(GTK_MENU(menu_window_popup)); -} - -/* message skip off */ -void -on_item3_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - msgskip_activate(false); - gtk_menu_popdown(GTK_MENU(menu_window_popup)); -} - -/* mouse auto move on */ -void -on_item5_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - nact->ags.mouse_warp_enabled = true; - gtk_menu_popdown(GTK_MENU(menu_window_popup)); -} - - -/* mouse auto move off */ -void -on_item6_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - nact->ags.mouse_warp_enabled = false; - gtk_menu_popdown(GTK_MENU(menu_window_popup)); -} - - -void -on_item7_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - gtk_menu_popdown(GTK_MENU(menu_window_popup)); - s39ini_winopen(); -} - -/* PopupMenu about */ -void -on_item16_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - nact->popupmenu_opened = true; - gtk_widget_show(menu_window_about); -} - -/* PopupMenu exit */ -void -on_item17_activate (GtkMenuItem *menuitem, - gpointer user_data) -{ - nact->popupmenu_opened = true; - gtk_widget_show(menu_window_exit); -} - -/* input number window OK button */ -void -on_button1_clicked (GtkButton *button, - gpointer user_data) -{ - menu_ok_input = true; - gtk_widget_hide(menu_window_in); - gtk_main_quit(); -} - - -/* input number window cancel button */ -void -on_button2_clicked (GtkButton *button, - gpointer user_data) -{ - menu_ok_input = false; - gtk_widget_hide(menu_window_in); - gtk_main_quit(); -} - - -/* input string window cancel button */ -void -on_button4_clicked (GtkButton *button, - gpointer user_data) -{ - menu_ok_input = false; - gtk_widget_hide(menu_window_is); - gtk_main_quit(); -} - - -/* input string window OK button */ -void -on_button3_clicked (GtkButton *button, - gpointer user_data) -{ - menu_textentry_string = gtk_entry_get_text(GTK_ENTRY(menu_textentry)); - menu_ok_input = true; - gtk_widget_hide(menu_window_is); - gtk_main_quit(); -} - -/* Exit Yes */ -void -on_button5_clicked (GtkButton *button, - gpointer user_data) -{ - menu_ok_exit = true; - nact_quit(false); - nact->popupmenu_opened = false; -} - - -/* Exit No */ -void -on_button6_clicked (GtkButton *button, - gpointer user_data) -{ - nact->popupmenu_opened = false; - menu_ok_exit = false; - gtk_widget_hide(menu_window_exit); -} - -/* About OK */ -void -on_button11_clicked (GtkButton *button, - gpointer user_data) -{ - gtk_widget_hide(menu_window_about); - nact->popupmenu_opened = false; -} - -/* menu canceld */ -void -on_menu1_deactivate (GtkMenuShell *menushell, - gpointer user_data) -{ - gtk_menu_popdown(GTK_MENU(menu_window_popup)); - nact->popupmenu_opened = false; -} - -/* get enter in text entry */ -void -on_entry1_activate (GtkEditable *editable, - gpointer user_data) -{ - menu_textentry_string = gtk_entry_get_text(GTK_ENTRY(editable)); - menu_ok_input = true; - gtk_widget_hide(menu_window_is); - gtk_main_quit(); -} - -/* get enter in spin button */ -void -on_spinbutton1_activate (GtkEditable *editable, - gpointer user_data) -{ - GtkAdjustment *adj; - adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(menu_spinbutton)); - if (gtk_adjustment_get_value(adj) >= gtk_adjustment_get_lower(adj) && gtk_adjustment_get_value(adj) <= gtk_adjustment_get_upper(adj)) { - menu_ok_input = true; - gtk_widget_hide(menu_window_in); - gtk_main_quit(); - } -} - -/* get enter in text entry */ -void -on_entry2_activate (GtkEditable *editable, - gpointer user_data) -{ - menu_textentry_string = gtk_entry_get_text(GTK_ENTRY(editable)); - menu_ok_input = true; - gtk_widget_hide(menu_window_is2); - gtk_main_quit(); -} diff --git a/src/menu_callback.h b/src/menu_callback.h deleted file mode 100644 index 7f8e77c..0000000 --- a/src/menu_callback.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * menu_callback.h menu callback function - * - * Copyright (C) 2000- Masaki Chikama (Wren) - * - * 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 - * -*/ -/* $Id: menu_callback.h,v 1.4 2001/04/04 21:55:39 chikama Exp $ */ - -#ifndef __MENU_CALLBACK__ -#define __MENU_CALLBACK__ - -#include - -extern bool menu_ok_exit; -extern bool menu_ok_input; - -extern GtkWidget *menu_item_msgskip_on; -extern GtkWidget *menu_item_msgskip_off; - -extern GtkWidget *menu_label_inputstring_title; -extern GtkWidget *menu_label_inputstring_maxchar; -extern GtkWidget *menu_label_inputnum_max; -extern GtkWidget *menu_label_inputnum_min; -extern GtkWidget *menu_label_inputnum_def; -extern GtkWidget *menu_spinbutton; -extern GtkWidget *menu_textentry; -extern GtkWidget *menu_textentry2; -extern const gchar *menu_textentry_string; - -extern GtkWidget *menu_window_popup; /* popup menu */ -extern GtkWidget *menu_window_exit; /* exit window */ -extern GtkWidget *menu_window_is; /* input string window */ -extern GtkWidget *menu_window_is2; /* input string window no 2*/ -extern GtkWidget *menu_window_in; /* input number window */ -extern GtkWidget *menu_window_about; /* about xsystem35 window */ - - -void -on_window3_destroy (GObject *object, - gpointer user_data); - -void -on_item2_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_item3_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_item5_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_item6_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_item7_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_item16_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_item17_activate (GtkMenuItem *menuitem, - gpointer user_data); - -void -on_button1_clicked (GtkButton *button, - gpointer user_data); - -void -on_button2_clicked (GtkButton *button, - gpointer user_data); - -void -on_button4_clicked (GtkButton *button, - gpointer user_data); - -void -on_button3_clicked (GtkButton *button, - gpointer user_data); - -void -on_button5_clicked (GtkButton *button, - gpointer user_data); - -void -on_button6_clicked (GtkButton *button, - gpointer user_data); - -void -on_button11_clicked (GtkButton *button, - gpointer user_data); - -void -on_menu1_deactivate (GtkMenuShell *menushell, - gpointer user_data); - -void -on_entry1_activate (GtkEditable *editable, - gpointer user_data); - -void -on_spinbutton1_activate (GtkEditable *editable, - gpointer user_data); - -void -on_entry2_activate (GtkEditable *editable, - gpointer user_data); -#endif /* !__MENU_CALLBACK__ */ diff --git a/src/menu_emscripten.c b/src/menu_emscripten.c index 5750eb5..c381d8e 100644 --- a/src/menu_emscripten.c +++ b/src/menu_emscripten.c @@ -70,10 +70,6 @@ void menu_init(void) { return; } -void menu_gtkmainiteration() { - return; -} - void menu_render_overlay(void) { return; } diff --git a/src/menu_gui.c b/src/menu_gui.c deleted file mode 100644 index 150d592..0000000 --- a/src/menu_gui.c +++ /dev/null @@ -1,608 +0,0 @@ -/* - * menu_gui.c menu gui - * - * Copyright (C) 2000- Masaki Chikama (Wren) - * - * 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 - * -*/ -/* $Id: menu_gui.c,v 1.12 2003/04/25 17:23:55 chikama Exp $ */ - -#include "config.h" - -#include -#include -#include -#include - -#include "portab.h" - -#include -#include - -#include "menu_callback.h" -#include "menu_gui.h" - -GtkWidget* -create_window1 (void) -{ - GtkWidget *window1; - GtkWidget *hbox1; - GtkWidget *vbox1; - GtkAdjustment *spinbutton1_adj; - GtkWidget *spinbutton1; - GtkWidget *grid1; - GtkWidget *label3; - GtkWidget *label9; - GtkWidget *label10; - GtkWidget *label11; - GtkWidget *label12; - GtkWidget *label13; - GtkWidget *vbox2; - GtkWidget *button1; - GtkWidget *button2; - GtkWidget *label4; - - window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_object_set_data(G_OBJECT(window1), "window1", window1); - gtk_window_set_title (GTK_WINDOW (window1), _("InputNumber")); - gtk_window_set_resizable(GTK_WINDOW (window1), false); - gtk_window_set_position(GTK_WINDOW (window1), GTK_WIN_POS_MOUSE); - - hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - g_object_ref(hbox1); - g_object_set_data_full(G_OBJECT(window1), "hbox1", hbox1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (hbox1); - gtk_container_add (GTK_CONTAINER (window1), hbox1); - - vbox1 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10); - g_object_ref(vbox1); - g_object_set_data_full(G_OBJECT(window1), "vbox1", vbox1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (vbox1); - gtk_box_pack_start (GTK_BOX (hbox1), vbox1, true, true, 0); - gtk_widget_set_size_request(vbox1, 128, -2); - gtk_container_set_border_width (GTK_CONTAINER (vbox1), 10); - - spinbutton1_adj = gtk_adjustment_new (100, 0, 100, 1, 1, 100); - menu_spinbutton = spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0); - g_object_ref(spinbutton1); - g_object_set_data_full(G_OBJECT(window1), "spinbutton1", spinbutton1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (spinbutton1); - gtk_box_pack_start (GTK_BOX (vbox1), spinbutton1, false, false, 0); - - grid1 = gtk_grid_new(); - g_object_ref(grid1); - g_object_set_data_full(G_OBJECT(window1), "grid1", grid1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (grid1); - gtk_box_pack_start (GTK_BOX (vbox1), grid1, false, false, 0); - gtk_grid_set_row_spacing(GTK_GRID(grid1), 5); - gtk_grid_set_column_spacing(GTK_GRID(grid1), 3); - - label3 = gtk_label_new (_("default")); - g_object_ref(label3); - g_object_set_data_full(G_OBJECT(window1), "label3", label3, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label3); - gtk_grid_attach(GTK_GRID(grid1), label3, 0, 0, 1, 1); - gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT); - - label9 = gtk_label_new (_("min")); - g_object_ref(label9); - g_object_set_data_full(G_OBJECT(window1), "label9", label9, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label9); - gtk_grid_attach(GTK_GRID(grid1), label9, 0, 1, 1, 1); - gtk_label_set_justify (GTK_LABEL (label9), GTK_JUSTIFY_LEFT); - - label10 = gtk_label_new (_("max")); - g_object_ref(label10); - g_object_set_data_full(G_OBJECT(window1), "label10", label10, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label10); - gtk_grid_attach(GTK_GRID(grid1), label10, 0, 2, 1, 1); - gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_LEFT); - - menu_label_inputnum_def = label11 = gtk_label_new (_("0")); - g_object_ref(label11); - g_object_set_data_full(G_OBJECT(window1), "label11", label11, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label11); - gtk_grid_attach(GTK_GRID(grid1), label11, 1, 0, 1, 1); - gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_LEFT); - - menu_label_inputnum_min = label12 = gtk_label_new (_("0")); - g_object_ref(label12); - g_object_set_data_full(G_OBJECT(window1), "label12", label12, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label12); - gtk_grid_attach(GTK_GRID(grid1), label12, 1, 1, 1, 1); - gtk_label_set_justify (GTK_LABEL (label12), GTK_JUSTIFY_LEFT); - - menu_label_inputnum_max = label13 = gtk_label_new (_("0")); - g_object_ref(label13); - g_object_set_data_full(G_OBJECT(window1), "label13", label13, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label13); - gtk_grid_attach(GTK_GRID(grid1), label13, 1, 2, 1, 1); - gtk_label_set_justify (GTK_LABEL (label13), GTK_JUSTIFY_LEFT); - - vbox2 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_set_homogeneous(GTK_BOX(vbox2), true); - g_object_ref(vbox2); - g_object_set_data_full(G_OBJECT(window1), "vbox2", vbox2, - (GDestroyNotify)g_object_unref); - gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (hbox1), vbox2, false, true, 0); - gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10); - button1 = gtk_button_new_with_label (_("OK")); - g_object_ref(button1); - g_object_set_data_full(G_OBJECT(window1), "button1", button1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (button1); - gtk_box_pack_start (GTK_BOX (vbox2), button1, false, false, 0); - - button2 = gtk_button_new_with_label (_("Cancel")); - g_object_ref(button2); - g_object_set_data_full(G_OBJECT(window1), "button2", button2, - (GDestroyNotify)g_object_unref); - gtk_widget_show (button2); - gtk_box_pack_start (GTK_BOX (vbox2), button2, false, false, 0); - - label4 = gtk_label_new (""); - g_object_ref(label4); - g_object_set_data_full(G_OBJECT(window1), "label4", label4, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label4); - gtk_box_pack_start (GTK_BOX (vbox2), label4, false, false, 0); - - g_signal_connect(spinbutton1, "activate", - G_CALLBACK(on_spinbutton1_activate), - NULL); - g_signal_connect(button1, "clicked", - G_CALLBACK(on_button1_clicked), - NULL); - g_signal_connect(button2, "clicked", - G_CALLBACK(on_button2_clicked), - NULL); - - return window1; -} - -GtkWidget* -create_window2 (void) -{ - GtkWidget *window2; - GtkWidget *vbox3; - GtkWidget *label5; - GtkWidget *entry1; - GtkWidget *label6; - GtkWidget *label7; - GtkWidget *hbox2; - GtkWidget *button4; - GtkWidget *button3; - - window2 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_object_set_data(G_OBJECT(window2), "window2", window2); - gtk_container_set_border_width (GTK_CONTAINER (window2), 10); - gtk_window_set_title (GTK_WINDOW (window2), _("InputString")); - gtk_window_set_resizable(GTK_WINDOW (window2), false); - gtk_window_set_position(GTK_WINDOW (window2), GTK_WIN_POS_MOUSE); - - vbox3 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_set_homogeneous(GTK_BOX(vbox3), true); - g_object_ref(vbox3); - g_object_set_data_full(G_OBJECT(window2), "vbox3", vbox3, - (GDestroyNotify)g_object_unref); - gtk_widget_show (vbox3); - gtk_container_add (GTK_CONTAINER (window2), vbox3); - - menu_label_inputstring_title = label5 = gtk_label_new (_("title")); - g_object_ref(label5); - g_object_set_data_full(G_OBJECT(window2), "label5", label5, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label5); - gtk_box_pack_start (GTK_BOX (vbox3), label5, false, false, 0); - gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_LEFT); - gtk_label_set_xalign(GTK_LABEL(label5), 0.00); - - menu_textentry = entry1 = gtk_entry_new (); - g_object_ref(entry1); - g_object_set_data_full(G_OBJECT(window2), "entry1", entry1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (entry1); - gtk_box_pack_start (GTK_BOX (vbox3), entry1, false, false, 0); - - menu_label_inputstring_maxchar = label6 = gtk_label_new (_("MAX charater")); - g_object_ref(label6); - g_object_set_data_full(G_OBJECT(window2), "label6", label6, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label6); - gtk_box_pack_start (GTK_BOX (vbox3), label6, false, false, 0); - gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT); - gtk_label_set_xalign(GTK_LABEL(label6), 0.00); - - label7 = gtk_label_new (_("Notice) HANKAKU is not available")); - g_object_ref(label7); - g_object_set_data_full(G_OBJECT(window2), "label7", label7, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label7); - gtk_box_pack_start (GTK_BOX (vbox3), label7, false, false, 0); - gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_LEFT); - gtk_label_set_xalign(GTK_LABEL(label7), 0.00); - - hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); - g_object_ref(hbox2); - g_object_set_data_full(G_OBJECT(window2), "hbox2", hbox2, - (GDestroyNotify)g_object_unref); - gtk_widget_show (hbox2); - gtk_box_pack_start (GTK_BOX (vbox3), hbox2, true, true, 0); - - button4 = gtk_button_new_with_label (_("Cancel")); - g_object_ref(button4); - g_object_set_data_full(G_OBJECT(window2), "button4", button4, - (GDestroyNotify)g_object_unref); - gtk_widget_show (button4); - gtk_box_pack_end (GTK_BOX (hbox2), button4, false, false, 0); - - button3 = gtk_button_new_with_label (_("OK")); - g_object_ref(button3); - g_object_set_data_full(G_OBJECT(window2), "button3", button3, - (GDestroyNotify)g_object_unref); - gtk_widget_show (button3); - gtk_box_pack_end (GTK_BOX (hbox2), button3, false, false, 0); - - g_signal_connect(button4, "clicked", - G_CALLBACK(on_button4_clicked), - NULL); - g_signal_connect(button3, "clicked", - G_CALLBACK(on_button3_clicked), - NULL); - g_signal_connect(entry1, "activate", - G_CALLBACK(on_entry1_activate), - NULL); - - return window2; -} - -GtkWidget* -create_window3 (void) -{ - GtkWidget *window3; - GtkWidget *vbox4; - GtkWidget *label8; - GtkWidget *hbox3; - GtkWidget *button5; - GtkWidget *button6; - - window3 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_object_set_data(G_OBJECT(window3), "window3", window3); - gtk_container_set_border_width (GTK_CONTAINER (window3), 10); - gtk_window_set_title (GTK_WINDOW (window3), _("Exit")); - gtk_window_set_resizable(GTK_WINDOW (window3), false); - gtk_window_set_position(GTK_WINDOW (window3), GTK_WIN_POS_MOUSE); - - vbox4 = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10); - gtk_box_set_homogeneous(GTK_BOX(vbox4), true); - g_object_ref(vbox4); - g_object_set_data_full(G_OBJECT(window3), "vbox4", vbox4, - (GDestroyNotify)g_object_unref); - gtk_widget_show (vbox4); - gtk_container_add (GTK_CONTAINER (window3), vbox4); - gtk_container_set_border_width (GTK_CONTAINER (vbox4), 5); - label8 = gtk_label_new (_("Exit System35 ?")); - g_object_ref(label8); - g_object_set_data_full(G_OBJECT(window3), "label8", label8, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label8); - gtk_box_pack_start (GTK_BOX (vbox4), label8, false, false, 0); - - hbox3 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 10); - gtk_box_set_homogeneous(GTK_BOX(hbox3), true); - g_object_ref(hbox3); - g_object_set_data_full(G_OBJECT(window3), "hbox3", hbox3, - (GDestroyNotify)g_object_unref); - gtk_widget_show (hbox3); - gtk_box_pack_start (GTK_BOX (vbox4), hbox3, true, true, 0); - - button5 = gtk_button_new_with_label (_("Yes")); - g_object_ref(button5); - g_object_set_data_full(G_OBJECT(window3), "button5", button5, - (GDestroyNotify)g_object_unref); - gtk_widget_show (button5); - gtk_box_pack_start (GTK_BOX (hbox3), button5, false, true, 0); - - button6 = gtk_button_new_with_label (_("No")); - g_object_ref(button6); - g_object_set_data_full(G_OBJECT(window3), "button6", button6, - (GDestroyNotify)g_object_unref); - gtk_widget_show (button6); - gtk_box_pack_start (GTK_BOX (hbox3), button6, false, true, 0); - - g_signal_connect(window3, "destroy", - G_CALLBACK(on_window3_destroy), - NULL); - g_signal_connect(button5, "clicked", - G_CALLBACK(on_button5_clicked), - NULL); - g_signal_connect(button6, "clicked", - G_CALLBACK(on_button6_clicked), - NULL); - - gtk_widget_grab_focus (button5); - return window3; -} - -GtkWidget* -create_window4 (void) -{ - GtkWidget *window4; - GtkWidget *fixed1; - GtkWidget *notebook1; - GtkWidget *label26; - GtkWidget *label23; - GtkWidget *empty_notebook_page; - GtkWidget *label24; - GtkWidget *label25; - GtkWidget *button11; - - window4 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_object_set_data(G_OBJECT(window4), "window4", window4); - gtk_window_set_title (GTK_WINDOW (window4), _("About")); - gtk_window_set_position(GTK_WINDOW (window4), GTK_WIN_POS_MOUSE); - - fixed1 = gtk_fixed_new (); - g_object_ref(fixed1); - g_object_set_data_full(G_OBJECT(window4), "fixed1", fixed1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (fixed1); - gtk_container_add (GTK_CONTAINER (window4), fixed1); - - notebook1 = gtk_notebook_new (); - g_object_ref(notebook1); - g_object_set_data_full(G_OBJECT(window4), "notebook1", notebook1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (notebook1); - gtk_fixed_put (GTK_FIXED (fixed1), notebook1, 0, 0); - gtk_widget_set_size_request(notebook1, 248, 104); - - label26 = gtk_label_new ("System 3.5 scenario decoder\nfor X\nVersion "VERSION" [proj. RainyMoon]"); - g_object_ref(label26); - g_object_set_data_full(G_OBJECT(window4), "label26", label26, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label26); - gtk_container_add (GTK_CONTAINER (notebook1), label26); - - label23 = gtk_label_new (_("Information1")); - g_object_ref(label23); - g_object_set_data_full(G_OBJECT(window4), "label23", label23, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label23); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label23); - empty_notebook_page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_widget_show (empty_notebook_page); - gtk_container_add (GTK_CONTAINER (notebook1), empty_notebook_page); - - label24 = gtk_label_new (_("Information2")); - g_object_ref(label24); - g_object_set_data_full(G_OBJECT(window4), "label24", label24, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label24); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label24); - empty_notebook_page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_widget_show (empty_notebook_page); - gtk_container_add (GTK_CONTAINER (notebook1), empty_notebook_page); - - label25 = gtk_label_new (_("Information3")); - g_object_ref(label25); - g_object_set_data_full(G_OBJECT(window4), "label25", label25, - (GDestroyNotify)g_object_unref); - gtk_widget_show (label25); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 2), label25); - button11 = gtk_button_new_with_label (_("OK")); - g_object_ref(button11); - g_object_set_data_full(G_OBJECT(window4), "button11", button11, - (GDestroyNotify)g_object_unref); - gtk_widget_show (button11); - gtk_fixed_put (GTK_FIXED (fixed1), button11, 184, 104); - gtk_widget_set_size_request(button11, 64, 24); - - g_signal_connect(button11, "clicked", - G_CALLBACK(on_button11_clicked), - NULL); - return window4; -} - -GtkWidget* -create_menu1 (void) -{ - GtkWidget *menu1; - GtkWidget *item1; - GtkWidget *item1_menu; - GSList *msg_group = NULL; - GtkWidget *item2; - GtkWidget *item3; - GtkWidget *__________1; - GtkWidget *item4; - GtkWidget *item4_menu; - GSList *mouse_group = NULL; - GtkWidget *item5; - GtkWidget *item6; - GtkWidget *__________2; - GtkWidget *item7; - GtkWidget *item16; - GtkWidget *__________4; - GtkWidget *item17; - - menu1 = gtk_menu_new (); - g_object_set_data(G_OBJECT(menu1), "menu1", menu1); - item1 = gtk_menu_item_new_with_label (_("MessageSkip")); - g_object_ref(item1); - g_object_set_data_full(G_OBJECT(menu1), "item1", item1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item1); - gtk_container_add (GTK_CONTAINER (menu1), item1); - - item1_menu = gtk_menu_new (); - g_object_ref(item1_menu); - g_object_set_data_full(G_OBJECT(menu1), "item1_menu", item1_menu, - (GDestroyNotify)g_object_unref); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item1), item1_menu); - menu_item_msgskip_on = item2 = gtk_radio_menu_item_new_with_label (msg_group, _("ON")); - msg_group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (item2)); - g_object_ref(item2); - g_object_set_data_full(G_OBJECT(menu1), "item2", item2, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item2); - gtk_container_add (GTK_CONTAINER (item1_menu), item2); - - menu_item_msgskip_off = item3 = gtk_radio_menu_item_new_with_label (msg_group, _("OFF")); - msg_group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (item3)); - g_object_ref(item3); - g_object_set_data_full(G_OBJECT(menu1), "item3", item3, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item3); - gtk_container_add (GTK_CONTAINER (item1_menu), item3); - - __________1 = gtk_menu_item_new (); - g_object_ref(__________1); - g_object_set_data_full(G_OBJECT(menu1), "__________1", __________1, - (GDestroyNotify)g_object_unref); - gtk_widget_show (__________1); - gtk_container_add (GTK_CONTAINER (menu1), __________1); - gtk_widget_set_sensitive (__________1, false); - - item4 = gtk_menu_item_new_with_label (_("MouseAutoMove")); - g_object_ref(item4); - g_object_set_data_full(G_OBJECT(menu1), "item4", item4, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item4); - gtk_container_add (GTK_CONTAINER (menu1), item4); - - item4_menu = gtk_menu_new (); - g_object_ref(item4_menu); - g_object_set_data_full(G_OBJECT(menu1), "item4_menu", item4_menu, - (GDestroyNotify)g_object_unref); - gtk_menu_item_set_submenu (GTK_MENU_ITEM (item4), item4_menu); - item5 = gtk_radio_menu_item_new_with_label (mouse_group, _("ON")); - mouse_group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (item5)); - g_object_ref(item5); - g_object_set_data_full(G_OBJECT(menu1), "item5", item5, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item5); - gtk_container_add (GTK_CONTAINER (item4_menu), item5); - - item6 = gtk_radio_menu_item_new_with_label (mouse_group, _("OFF")); - mouse_group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (item6)); - g_object_ref(item6); - g_object_set_data_full(G_OBJECT(menu1), "item6", item6, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item6); - gtk_container_add (GTK_CONTAINER (item4_menu), item6); - - __________2 = gtk_menu_item_new (); - g_object_ref(__________2); - g_object_set_data_full(G_OBJECT(menu1), "__________2", __________2, - (GDestroyNotify)g_object_unref); - gtk_widget_show (__________2); - gtk_container_add (GTK_CONTAINER (menu1), __________2); - gtk_widget_set_sensitive (__________2, false); - - item7 = gtk_menu_item_new_with_label (_("VolumeValance")); - g_object_ref(item7); - g_object_set_data_full(G_OBJECT(menu1), "item7", item7, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item7); - gtk_container_add (GTK_CONTAINER (menu1), item7); - - item16 = gtk_menu_item_new_with_label (_("About")); - g_object_ref(item16); - g_object_set_data_full(G_OBJECT(menu1), "item16", item16, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item16); - gtk_container_add (GTK_CONTAINER (menu1), item16); - - __________4 = gtk_menu_item_new (); - g_object_ref(__________4); - g_object_set_data_full(G_OBJECT(menu1), "__________4", __________4, - (GDestroyNotify)g_object_unref); - gtk_widget_show (__________4); - gtk_container_add (GTK_CONTAINER (menu1), __________4); - gtk_widget_set_sensitive (__________4, false); - - item17 = gtk_menu_item_new_with_label (_("Exit")); - g_object_ref(item17); - g_object_set_data_full(G_OBJECT(menu1), "item17", item17, - (GDestroyNotify)g_object_unref); - gtk_widget_show (item17); - gtk_container_add (GTK_CONTAINER (menu1), item17); - - g_signal_connect(menu1, "deactivate", - G_CALLBACK(on_menu1_deactivate), - NULL); - g_signal_connect(item2, "toggled", - G_CALLBACK(on_item2_activate), - NULL); - g_signal_connect(item3, "toggled", - G_CALLBACK(on_item3_activate), - NULL); - g_signal_connect(item5, "activate", - G_CALLBACK(on_item5_activate), - NULL); - g_signal_connect(item6, "activate", - G_CALLBACK(on_item6_activate), - NULL); - g_signal_connect(item7, "activate", - G_CALLBACK(on_item7_activate), - NULL); - g_signal_connect(item16, "activate", - G_CALLBACK(on_item16_activate), - NULL); - g_signal_connect(item17, "activate", - G_CALLBACK(on_item17_activate), - NULL); - - return menu1; -} - -GtkWidget* -create_window5 (void) -{ - GtkWidget *window5; - GtkWidget *entry2; - - window5 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_object_set_data(G_OBJECT(window5), "window5", window5); - gtk_window_set_position(GTK_WINDOW (window5), GTK_WIN_POS_MOUSE); - - menu_textentry2 = entry2 = gtk_entry_new(); - gtk_entry_set_max_length(GTK_ENTRY(entry2), 16); - g_object_ref(entry2); - g_object_set_data_full(G_OBJECT(window5), "entry2", entry2, - (GDestroyNotify)g_object_unref); - gtk_widget_show (entry2); - gtk_container_add (GTK_CONTAINER (window5), entry2); - gtk_widget_set_size_request(entry2, 100, 28); - gtk_entry_set_text (GTK_ENTRY (entry2), _("default")); - - g_signal_connect(entry2, "activate", - G_CALLBACK(on_entry2_activate), - NULL); - - return window5; -} diff --git a/src/menu_gui.h b/src/menu_gui.h deleted file mode 100644 index c516c84..0000000 --- a/src/menu_gui.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * menu_gui.h menu gui - * - * Copyright (C) 2000- Masaki Chikama (Wren) - * - * 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 - * -*/ -/* $Id: menu_gui.h,v 1.4 2001/04/04 21:55:40 chikama Exp $ */ - -#ifndef __MENU_GUI__ -#define __MENU_GUI__ - -#include - -GtkWidget* create_window1 (void); -GtkWidget* create_window2 (void); -GtkWidget* create_window3 (void); -GtkWidget* create_window4 (void); -GtkWidget* create_window5 (void); -GtkWidget* create_menu1 (void); - -#endif /* !__MENU_GUI__ */ diff --git a/src/menu_gui_volval.c b/src/menu_gui_volval.c deleted file mode 100644 index 6c7992b..0000000 --- a/src/menu_gui_volval.c +++ /dev/null @@ -1,164 +0,0 @@ -#include "config.h" - -#include -#include -#include -#include - -#include -#include - -static void -on_checkbutton1_toggled (GtkToggleButton *togglebutton, - gpointer user_data); -static void -on_adjustment1_value_changed (GtkAdjustment *adjustment, - gpointer user_data); -static gint -on_window1_destroy (GtkWindow *window, - gpointer user_data); - - - -static GtkWidget* vval_win_open(struct _volval *vval, int max) { - GtkWidget *window1; - GtkWidget *frame1; - GtkWidget *grid2; - GtkWidget *label1; - GtkWidget *hscale1; - GtkWidget *checkbutton1; - GtkAdjustment *adjustment1; - GtkWidget *hbox1; - GtkWidget *label6; - GtkWidget *label7; - int i, j; - - window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_object_set_data(G_OBJECT (window1), "window1", window1); - gtk_widget_set_size_request(window1, 320, -2); - gtk_window_set_title (GTK_WINDOW (window1), _("window1")); - - frame1 = gtk_frame_new (_("VolumeValance")); - g_object_ref(frame1); - g_object_set_data_full(G_OBJECT(window1), "frame1", frame1, - (GDestroyNotify) g_object_unref); - gtk_widget_show (frame1); - gtk_container_add (GTK_CONTAINER (window1), frame1); - gtk_container_set_border_width (GTK_CONTAINER (frame1), 5); - - grid2 = gtk_grid_new(); - g_object_ref(grid2); - g_object_set_data_full(G_OBJECT(window1), "grid2", grid2, - (GDestroyNotify) g_object_unref); - gtk_widget_show(grid2); - gtk_container_add(GTK_CONTAINER(frame1), grid2); - gtk_container_set_border_width(GTK_CONTAINER (grid2), 5); - gtk_grid_set_row_spacing(GTK_GRID(grid2), 2); - gtk_grid_set_column_spacing(GTK_GRID(grid2), 2); - - for (i = 0, j = 0; i <= max; i++) { - if (vval[i].label == NULL) continue; - label1 = gtk_label_new (vval[i].label); - g_object_ref(label1); - g_object_set_data_full(G_OBJECT(window1), "label1", label1, - (GDestroyNotify) g_object_unref); - gtk_widget_show (label1); - gtk_grid_attach(GTK_GRID(grid2), label1, 0, j+1, 1, 1); - gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT); - - adjustment1 = gtk_adjustment_new (vval[i].vol, 0, 100, 0, 10, 0); - g_signal_connect(adjustment1, "value-changed", - G_CALLBACK(on_adjustment1_value_changed), - &(vval[i].vol)); - - hscale1 = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT(adjustment1)); - g_object_ref(hscale1); - g_object_set_data_full(G_OBJECT(window1), "hscale1", hscale1, - (GDestroyNotify) g_object_unref); - gtk_widget_show (hscale1); - gtk_widget_set_hexpand(hscale1, true); - gtk_widget_set_margin_start(hscale1, 5); - gtk_widget_set_margin_end(hscale1, 5); - gtk_widget_set_margin_top(hscale1, 2); - gtk_widget_set_margin_bottom(hscale1, 2); - gtk_grid_attach(GTK_GRID(grid2), hscale1, 1, j+1, 1, 1); - gtk_scale_set_draw_value (GTK_SCALE (hscale1), false); - gtk_scale_set_digits (GTK_SCALE (hscale1), 0); - - checkbutton1 = gtk_check_button_new_with_label (_("mute")); - g_object_ref(checkbutton1); - g_object_set_data_full(G_OBJECT(window1), "checkbutton1", checkbutton1, - (GDestroyNotify) g_object_unref); - gtk_widget_show (checkbutton1); - gtk_grid_attach(GTK_GRID(grid2), checkbutton1, 2, j+1, 1, 1); - g_signal_connect(checkbutton1, "toggled", - G_CALLBACK(on_checkbutton1_toggled), - &(vval[i].mute)); - - j++; - } - - - hbox1 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - g_object_ref(hbox1); - g_object_set_data_full(G_OBJECT(window1), "hbox1", hbox1, - (GDestroyNotify) g_object_unref); - gtk_widget_show (hbox1); - gtk_widget_set_hexpand(hbox1, true); - gtk_widget_set_vexpand(hbox1, true); - gtk_grid_attach(GTK_GRID(grid2), hbox1, 1, 0, 1, 1); - - label6 = gtk_label_new (_("small")); - g_object_ref(label6); - g_object_set_data_full(G_OBJECT(window1), "label6", label6, - (GDestroyNotify) g_object_unref); - gtk_widget_show (label6); - gtk_box_pack_start (GTK_BOX (hbox1), label6, true, false, 3); - gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_LEFT); - - label7 = gtk_label_new (_("large")); - g_object_ref(label7); - g_object_set_data_full(G_OBJECT(window1), "label7", label7, - (GDestroyNotify) g_object_unref); - gtk_widget_show (label7); - gtk_box_pack_start (GTK_BOX (hbox1), label7, true, false, 3); - gtk_label_set_justify (GTK_LABEL (label7), GTK_JUSTIFY_RIGHT); - - g_signal_connect(window1, "delete_event", - G_CALLBACK(on_window1_destroy), - NULL); - - return window1; -} - -static void -on_checkbutton1_toggled (GtkToggleButton *togglebutton, - gpointer user_data) -{ - bool *muted = (bool *)user_data; - - if (gtk_toggle_button_get_active(togglebutton)) { - *muted = true; - } else { - *muted = false; - } - s39ini_setvol(); -} - -static void -on_adjustment1_value_changed (GtkAdjustment *adjustment, - gpointer user_data) -{ - int *vol = (int *)user_data; - *vol = gtk_adjustment_get_value(adjustment); - // printf("value chaned %d\n", *vol); - s39ini_setvol(); -} - -static gint -on_window1_destroy (GtkWindow *window, - gpointer user_data) -{ - s39ini_winclose(); - return true; -} diff --git a/src/menu_sdl.c b/src/menu_sdl.c index 3e2453f..2c40cf5 100644 --- a/src/menu_sdl.c +++ b/src/menu_sdl.c @@ -579,10 +579,6 @@ void menu_init(void) { #endif } -void menu_gtkmainiteration() { - return; -} - #ifndef _WIN32 void menu_setSkipState(bool enabled, bool activated) { skip_enabled = enabled; diff --git a/src/nact.c b/src/nact.c index 512405c..a50d54c 100644 --- a/src/nact.c +++ b/src/nact.c @@ -134,9 +134,6 @@ static void nact_callback() { if (nact->is_cursor_animation) { /* cursor animation */ } - if (nact->popupmenu_opened) { - menu_gtkmainiteration(); - } if (nact->is_quit && !nact->restart) { sys_exit(0); }