summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main-crb.c279
-rw-r--r--src/main-gtk2.c192
2 files changed, 8 insertions, 463 deletions
diff --git a/src/main-crb.c b/src/main-crb.c
index 53761e1a..6defe9f2 100644
--- a/src/main-crb.c
+++ b/src/main-crb.c
@@ -139,8 +139,6 @@
*
* MBAR 128 = array of MENU id's (128, 129, 130, 131, 132, 133, 134)
* MENU 128 = apple (about, -, ...)
- * MENU 129 = File (new, open, close, save, -, score, quit)
- * (If SAVEFILE_SCREEN is defined)
* MENU 129 = File (close, save, -, score, quit)
* MENU 130 = Edit (undo, -, cut, copy, paste, clear)
* MENU 131 = Font (bold, wide, -)
@@ -555,7 +553,6 @@ static bool_ check_create_user_dir(void)
*
* #define ALLOW_BIG_SCREEN (V, Ey, O, T.o.M.E., and Z. Dr's big screen needs
* more work. New S one is too idiosyncratic...)
- * #define SAVEFILE_SCREEN (T.o.M.E.)
* #define HAS_SCORE_MENU (V and T.o.M.E.)
* #define ANGBAND_CREATOR four letter code for your variant, if any.
* or use the default one.
@@ -566,7 +563,6 @@ static bool_ check_create_user_dir(void)
*/
#define USE_DOUBLE_TILES
-#define SAVEFILE_SCREEN
#define ALLOW_BIG_SCREEN
#define HAS_SCORE_MENU
#define ANGBAND_CREATOR 'PrnA'
@@ -3667,195 +3663,6 @@ static void save_pref_file(void)
}
-
-
-#ifndef SAVEFILE_SCREEN
-
-/*
- * Prepare savefile dialogue and set the variable
- * savefile accordingly. Returns true if it succeeds, false (or
- * aborts) otherwise. If all is false, only allow files whose type
- * is 'SAVE'.
- * Originally written by Peter Ammon
- */
-static bool_ select_savefile(bool_ all)
-{
- OSErr err;
- FSSpec theFolderSpec;
- FSSpec savedGameSpec;
- NavDialogOptions dialogOptions;
- NavReplyRecord reply;
- /* Used only when 'all' is true */
- NavTypeList types = {ANGBAND_CREATOR, 1, 1, {'SAVE'}};
- NavTypeListHandle myTypeList;
- AEDesc defaultLocation;
-
-#ifdef MACH_O_CARBON
-
- /* Find the save folder */
- err = path_to_spec(ANGBAND_DIR_SAVE, &theFolderSpec);
-
-#else
-
- /* Find :lib:save: folder */
- err = FSMakeFSSpec(
- app_vol,
- app_dir,
- "\p:lib:save:",
- &theFolderSpec);
-
-#endif
-
- /* Oops */
- if (err != noErr) quit("Unable to find the folder :lib:save:");
-
- /* Get default Navigator dialog options */
- err = NavGetDefaultDialogOptions(&dialogOptions);
-
- /* Clear preview option */
- dialogOptions.dialogOptionFlags &= ~kNavAllowPreviews;
-
- /* Disable multiple file selection */
- dialogOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles;
-
- /* Make descriptor for default location */
- err = AECreateDesc(
- typeFSS,
- &theFolderSpec,
- sizeof(FSSpec),
- &defaultLocation);
-
- /* Oops */
- if (err != noErr) quit("Unable to allocate descriptor");
-
- /* We are indifferent to signature and file types */
- if (all)
- {
- myTypeList = (NavTypeListHandle)nil;
- }
-
- /* Set up type handle */
- else
- {
- err = PtrToHand(&types, (Handle *) & myTypeList, sizeof(NavTypeList));
-
- /* Oops */
- if (err != noErr) quit("Error in PtrToHand. Try enlarging heap");
-
- }
-
- /* Call NavGetFile() with the types list */
- err = NavChooseFile(
- &defaultLocation,
- &reply,
- &dialogOptions,
- nil,
- nil,
- nil,
- myTypeList,
- nil);
-
- /* Free type list */
- DisposeHandle((Handle)myTypeList);
-
- /* Invalid response -- allow the user to cancel */
- if (!reply.validRecord) return (FALSE);
-
- /* Retrieve FSSpec from the reply */
- if (err == noErr)
- {
- AEKeyword theKeyword;
- DescType actualType;
- Size actualSize;
-
- /* Get a pointer to selected file */
- (void)AEGetNthPtr(
- &reply.selection,
- 1,
- typeFSS,
- &theKeyword,
- &actualType,
- &savedGameSpec,
- sizeof(FSSpec),
- &actualSize);
-
- /* Dispose NavReplyRecord, resources and descriptors */
- (void)NavDisposeReply(&reply);
- }
-
- /* Dispose location info */
- AEDisposeDesc(&defaultLocation);
-
-#ifdef MACH_O_CARBON
-
- /* Convert FSSpec to pathname and store it in variable savefile */
- (void)spec_to_path(&savedGameSpec, savefile, sizeof(savefile));
-
-#else
-
- /* Convert FSSpec to pathname and store it in variable savefile */
- refnum_to_name(
- savefile,
- savedGameSpec.parID,
- savedGameSpec.vRefNum,
- (char *)savedGameSpec.name);
-
-#endif
-
- /* Success */
- return (TRUE);
-}
-
-
-/*
- * Handle menu: "File" + "New"
- */
-static void do_menu_file_new(void)
-{
- /* Hack */
- HiliteMenu(0);
-
- /* Game is in progress */
- game_in_progress = 1;
-
- /* Flush input */
- Term_flush();
-
- /* Play a game */
- play_game(TRUE);
-
- /* Hack -- quit */
- quit(NULL);
-}
-
-
-/*
- * Handle menu: "File" + "Open" / "Import"
- */
-static void do_menu_file_open(bool_ all)
-{
- /* Let the player to choose savefile */
- if (!select_savefile(all)) return;
-
- /* Hack */
- HiliteMenu(0);
-
- /* Game is in progress */
- game_in_progress = 1;
-
- /* Flush input */
- flush();
-
- /* Play a game */
- play_game(FALSE);
-
- /* Hack -- quit */
- quit(NULL);
-}
-
-#endif /* !SAVEFILE_SCREEN */
-
-
/*
* Handle the "open_when_ready" flag
*/
@@ -3876,13 +3683,9 @@ static void handle_open_when_ready(void)
/* Flush input */
flush();
-#ifdef SAVEFILE_SCREEN
-
/* User double-clicked savefile; no savefile screen */
no_begin_screen = TRUE;
-#endif /* SAVEFILE_SCREEN */
-
/* Play a game */
play_game(FALSE);
@@ -3900,8 +3703,6 @@ static void handle_open_when_ready(void)
* The standard menus are:
*
* Apple (128) = { About, -, ... }
- * File (129) = { New,Open,Import,Close,Save,-,Score,Quit }
- * (If SAVEFILE_SCREEN is defined, this becomes)
* File (129) = { Close,Save,-,Score,Quit }
* Edit (130) = { Cut, Copy, Paste, Clear } (?)
* Font (131) = { Bold, Extend, -, Monaco, ..., -, ... }
@@ -3918,28 +3719,14 @@ static void handle_open_when_ready(void)
/* File menu */
#define MENU_FILE 129
-#ifndef SAVEFILE_SCREEN
-# define ITEM_NEW 1
-# define ITEM_OPEN 2
-# define ITEM_IMPORT 3
-# define ITEM_CLOSE 4
-# define ITEM_SAVE 5
-# ifdef HAS_SCORE_MENU
-# define ITEM_SCORE 7
-# define ITEM_QUIT 8
-# else
-# define ITEM_QUIT 7
-# endif /* HAS_SCORE_MENU */
-#else /* !SAVEFILE_SCREEN - in-game savefile menu */
-# define ITEM_CLOSE 1
-# define ITEM_SAVE 2
-# ifdef HAS_SCORE_MENU
-# define ITEM_SCORE 4
-# define ITEM_QUIT 5
-# else
-# define ITEM_QUIT 4
-# endif /* HAS_SCORE_MENU */
-#endif /* !SAVEFILE_SCREEN */
+#define ITEM_CLOSE 1
+#define ITEM_SAVE 2
+#ifdef HAS_SCORE_MENU
+#define ITEM_SCORE 4
+#define ITEM_QUIT 5
+#else
+#define ITEM_QUIT 4
+#endif /* HAS_SCORE_MENU */
/* Edit menu */
#define MENU_EDIT 130
@@ -4308,18 +4095,6 @@ static void setup_menus(void)
CheckMenuItem(m, i, FALSE);
}
-#ifndef SAVEFILE_SCREEN
-
- /* Enable "new"/"open..."/"import..." */
- if (initialized && !game_in_progress)
- {
- EnableMenuItem(m, ITEM_NEW);
- EnableMenuItem(m, ITEM_OPEN);
- EnableMenuItem(m, ITEM_IMPORT);
- }
-
-#endif /* !SAVEFILE_SCREEN */
-
/* Enable "close" */
if (initialized)
{
@@ -4712,30 +4487,6 @@ static void menu(long mc)
{
switch (selection)
{
-#ifndef SAVEFILE_SCREEN
-
- /* New */
- case ITEM_NEW:
- {
- do_menu_file_new();
- break;
- }
-
- /* Open... */
- case ITEM_OPEN:
- {
- do_menu_file_open(FALSE);
- break;
- }
-
- /* Import... */
- case ITEM_IMPORT:
- {
- do_menu_file_open(TRUE);
- break;
- }
-
-#endif /* !SAVEFILE_SCREEN */
/* Close */
case ITEM_CLOSE:
@@ -6244,19 +5995,6 @@ int main(void)
/* Handle "open_when_ready" */
handle_open_when_ready();
-#ifndef SAVEFILE_SCREEN
-
- /* Prompt the user - You may have to change this for some variants */
- prt("[Choose 'New' or 'Open' from the 'File' menu]", 23, 15);
-
- /* Flush the prompt */
- Term_fresh();
-
- /* Hack -- Process Events Forever */
- while (TRUE) CheckEvents(TRUE);
-
-#else
-
/* Game is in progress */
game_in_progress = 1;
@@ -6274,7 +6012,6 @@ int main(void)
/* Since it's a int function */
return (0);
-#endif /* !SAVEFILE_SCREEN */
}
#endif /* MACINTOSH || MACH_O_CARBON */
diff --git a/src/main-gtk2.c b/src/main-gtk2.c
index 8567a7a3..678d79eb 100644
--- a/src/main-gtk2.c
+++ b/src/main-gtk2.c
@@ -51,7 +51,6 @@
#define TOME
#ifdef TOME
-# define SAVEFILE_SCREEN /* New/Open integrated into the game */
# define USE_DOUBLE_TILES /* Mogami's bigtile patch */
#endif /* TOME */
@@ -270,18 +269,6 @@ static cptr get_default_font(int term)
}
-# ifndef SAVEFILE_SCREEN
-
-/*
- * In [V]2.9.3, this frees all dynamically allocated memory
- */
-static void cleanup_angband(void)
-{
- /* XXX XXX XXX */
-}
-
-# endif /* !SAVEFILE_SCREEN */
-
/*
* New global flag to indicate if it's safe to save now
*/
@@ -3149,41 +3136,6 @@ static void destroy_sub_event_handler(
}
-#ifndef SAVEFILE_SCREEN
-
-/*
- * Process File-New menu command
- */
-static void new_event_handler(
- gpointer user_data,
- guint user_action,
- GtkWidget *was_clicked)
-{
- if (game_in_progress)
- {
- plog("You can't start a new game while you're still playing!");
- return;
- }
-
- /* The game is in progress */
- game_in_progress = TRUE;
-
- /* Flush input */
- Term_flush();
-
- /* Play game */
- play_game(TRUE);
-
- /* Houseclearing */
- cleanup_angband();
-
- /* Done */
- quit(NULL);
-}
-
-#endif /* !SAVEFILE_SCREEN */
-
-
/*
* Load fond specified by an XLFD fontname and
* set up related term_data members
@@ -3416,92 +3368,6 @@ static void change_trans_mode_event_handler(
#endif /* USE_GRAPHICS */
-#ifndef SAVEFILE_SCREEN
-
-/*
- * Caution: Modal or not, callbacks are called by gtk_main(),
- * so this is the right place to start a game.
- */
-static void file_ok_callback(
- GtkWidget *widget,
- GtkWidget *file_selector)
-{
- strcpy(savefile,
- gtk_file_selection_get_filename(GTK_FILE_SELECTION(file_selector)));
-
- gtk_widget_destroy(file_selector);
-
- /* game is in progress */
- game_in_progress = TRUE;
-
- /* Flush input */
- Term_flush();
-
- /* Play game */
- play_game(FALSE);
-
- /* Free memory allocated by game */
- cleanup_angband();
-
- /* Done */
- quit(NULL);
-}
-
-
-/*
- * Process File-Open menu command
- */
-static void open_event_handler(
- gpointer user_data,
- guint user_action,
- GtkWidget *was_clicked)
-{
- GtkWidget *file_selector;
- char buf[1024];
-
-
- if (game_in_progress)
- {
- plog("You can't open a new game while you're still playing!");
- return;
- }
-
- /* Prepare the savefile path */
- path_build(buf, 1024, ANGBAND_DIR_SAVE, "*");
-
- file_selector = gtk_file_selection_new("Select a savefile");
- gtk_file_selection_set_filename(
- GTK_FILE_SELECTION(file_selector),
- buf);
- gtk_signal_connect(
- GTK_OBJECT(GTK_FILE_SELECTION(file_selector)->ok_button),
- "clicked",
- file_ok_callback,
- (gpointer)file_selector);
-
- /*
- * Ensure that the dialog box is destroyed when the user
- * clicks a button.
- */
- gtk_signal_connect_object(
- GTK_OBJECT(GTK_FILE_SELECTION(file_selector)->ok_button),
- "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- (gpointer)file_selector);
-
- gtk_signal_connect_object(
- GTK_OBJECT(GTK_FILE_SELECTION(file_selector)->cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC(gtk_widget_destroy),
- (gpointer)file_selector);
-
- gtk_window_set_modal(GTK_WINDOW(file_selector), TRUE);
- gtk_widget_show(GTK_WIDGET(file_selector));
-}
-
-#endif /* !SAVEFILE_SCREEN */
-
-
/*
* React to "delete" signal sent to Window widgets
*/
@@ -3935,14 +3801,6 @@ static GtkItemFactoryEntry main_menu_items[] =
{ "/File", NULL,
NULL, 0, "<Branch>", NULL
},
-#ifndef SAVEFILE_SCREEN
- { "/File/New", "<mod1>N",
- new_event_handler, 0, NULL, NULL },
- { "/File/Open", "<mod1>O",
- open_event_handler, 0, NULL, NULL },
- { "/File/sep1", NULL,
- NULL, 0, "<Separator>", NULL },
-#endif /* !SAVEFILE_SCREEN */
{ "/File/Save", "<mod1>S",
save_event_handler, 0, NULL, NULL },
{ "/File/Quit", "<mod1>Q",
@@ -4222,18 +4080,8 @@ static void file_menu_update_handler(
GtkWidget *widget,
gpointer user_data)
{
-#ifndef SAVEFILE_SCREEN
- bool_ game_start_ok;
-#endif /* !SAVEFILE_SCREEN */
bool_ save_ok, quit_ok;
-#ifndef SAVEFILE_SCREEN
-
- /* Can we start a game now? */
- game_start_ok = !game_in_progress;
-
-#endif /* !SAVEFILE_SCREEN */
-
/* Cave we save/quit now? */
if (!character_generated || !game_in_progress)
{
@@ -4247,10 +4095,6 @@ static void file_menu_update_handler(
}
/* Enable / disable menu items according to those conditions */
-#ifndef SAVEFILE_SCREEN
- enable_menu_item("<Angband>/File/New", game_start_ok);
- enable_menu_item("<Angband>/File/Open", game_start_ok);
-#endif /* !SAVEFILE_SCREEN */
enable_menu_item("<Angband>/File/Save", save_ok);
enable_menu_item("<Angband>/File/Quit", quit_ok);
}
@@ -4776,48 +4620,12 @@ errr init_gtk2(int argc, char **argv)
/* Activate the "Angband" window screen */
Term_activate(&data[0].t);
-#ifndef SAVEFILE_SCREEN
-
- /* Set the system suffix */
- ANGBAND_SYS = "gtk";
-
- /* Catch nasty signals */
- signals_init();
-
- /* Initialize */
- init_angband();
-
- /* Hack - because this port has New/Open menus XXX */
- savefile[0] = '\0';
-
- /* Prompt the user */
- prt("[Choose 'New' or 'Open' from the 'File' menu]", 23, 17);
- Term_fresh();
-
- /* Activate more hook */
- plog_aux = hook_plog;
-
-
- /* Processing loop */
- gtk_main();
-
-
- /* Free allocated memory */
- cleanup_angband();
-
- /* Stop now */
- quit(NULL);
-
-#else /* !SAVEFILE_SCREEN */
-
/* Activate more hook */
plog_aux = hook_plog;
/* It's too early to set this, but cannot do so elsewhere XXX XXX */
game_in_progress = TRUE;
-#endif /* !SAVEFILE_SCREEN */
-
/* Success */
return (0);
}