OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / main-win.c
index 9913fd8..d31b397 100644 (file)
 * <p>\r
 * The "Term_xtra_win_clear()" function should probably do a low-level\r
 * clear of the current window, and redraw the borders and other things,\r
-* if only for efficiency.  XXX XXX XXX\r
+* if only for efficiency.  \r
 * </p>\r
 *\r
 * <p>\r
 * A simpler method is needed for selecting the "tile size" for windows.\r
-* XXX XXX XXX\r
 * </p>\r
 *\r
 * <p>\r
 * window, I think, and only a few calls actually check for its existance,\r
 * this may be okay since "NULL" means "on top of all windows". (?)  The\r
 * user must never be allowed to "hide" the main window, or the "menubar"\r
-* will disappear.  XXX XXX XXX\r
+* will disappear.  \r
 * </p>\r
 *\r
 * <p>\r
 * Special "Windows Help Files" can be placed into "lib/xtra/help/" for\r
 * use with the "winhelp.exe" program.  These files *may* be available\r
-* at the ftp site somewhere, but I have not seen them.  XXX XXX XXX\r
+* at the ftp site somewhere, but I have not seen them.  \r
 * </p>\r
 *\r
 * <p>\r
 \r
 #define IDM_HELP_CONTENTS       901\r
 \r
-\r
-\r
-/*\r
- * This may need to be removed for some compilers XXX XXX XXX\r
- */\r
-#if 0\r
-#define STRICT\r
-#endif\r
-\r
 /*\r
  * Exclude parts of WINDOWS.H that are not needed\r
  */\r
 #endif\r
 \r
 /*\r
- * Hack -- Fake declarations from "dos.h" XXX XXX XXX\r
+ * Hack -- Fake declarations from "dos.h" \r
  */\r
 #ifdef WIN32\r
 #define INVALID_FILE_NAME (DWORD)0xFFFFFFFF\r
@@ -401,18 +391,14 @@ typedef struct _term_data term_data;
 struct _term_data\r
 {\r
        term t;\r
-\r
        cptr s;\r
-\r
        HWND w;\r
-\r
        DWORD dwStyle;\r
        DWORD dwExStyle;\r
 \r
        uint keys;\r
-\r
-       TERM_POSITION rows;     /* int -> uint */\r
-       TERM_POSITION cols;\r
+       TERM_LEN rows;  /* int -> uint */\r
+       TERM_LEN cols;\r
 \r
        uint pos_x; //!< タームの左上X座標\r
        uint pos_y; //!< タームの左上Y座標\r
@@ -424,22 +410,14 @@ struct _term_data
        uint size_oh2;\r
 \r
        bool size_hack;\r
-\r
        bool xtra_hack;\r
-\r
        bool visible;\r
-\r
        bool bizarre;\r
-\r
        cptr font_want;\r
-\r
        cptr font_file;\r
-\r
        HFONT font_id;\r
-\r
        int font_wid;  //!< フォント横幅\r
        int font_hgt;  //!< フォント縦幅\r
-\r
        int tile_wid;  //!< タイル横幅\r
        int tile_hgt;  //!< タイル縦幅\r
 \r
@@ -453,33 +431,13 @@ struct _term_data
 \r
        bool posfix;\r
 \r
-/* bg */\r
-#if 0\r
-       char *bgfile;\r
-       int use_bg;\r
-#endif\r
 };\r
 \r
+#define MAX_TERM_DATA 8        //!< Maximum number of windows \r
 \r
-/*\r
- * Maximum number of windows XXX XXX XXX\r
- */\r
-#define MAX_TERM_DATA 8\r
-\r
-/*\r
- * An array of term_data's\r
- */\r
-static term_data data[MAX_TERM_DATA];\r
-\r
-/*\r
- * Hack -- global "window creation" pointer\r
- */\r
-static term_data *my_td;\r
-\r
-/*\r
- * Remember normal size of main window when maxmized\r
- */\r
-POINT normsize;\r
+static term_data data[MAX_TERM_DATA]; //!< An array of term_data's\r
+static term_data *my_td; //!< Hack -- global "window creation" pointer\r
+POINT normsize; //!< Remember normal size of main window when maxmized\r
 \r
 /*\r
  * was main window maximized on previous playing\r
@@ -643,17 +601,15 @@ static bool Term_no_press = FALSE;
  */\r
 static bool mouse_down = FALSE;\r
 static bool paint_rect = FALSE;\r
-static TERM_POSITION mousex = 0, mousey = 0;\r
-static TERM_POSITION oldx, oldy;\r
+static TERM_LEN mousex = 0, mousey = 0;\r
+static TERM_LEN oldx, oldy;\r
 \r
 \r
-/*\r
- * The "simple" color values\r
- *\r
+/*!\r
+ * @brief The "simple" color values\r
+ * @details\r
  * See "main-ibm.c" for original table information\r
- *\r
  * The entries below are taken from the "color bits" defined above.\r
- *\r
  * Note that many of the choices below suck, but so do crappy monitors.\r
  */\r
 static BYTE win_pal[256] =\r
@@ -943,8 +899,6 @@ static char *analyze_font(char *path, int *wp, int *hp)
        /* Save results */\r
        (*wp) = wid;\r
        (*hp) = hgt;\r
-\r
-       /* Result */\r
        return (p);\r
 }\r
 #endif\r
@@ -1091,14 +1045,13 @@ static void validate_dir(cptr s, bool vital)
 }\r
 \r
 \r
-/*\r
- * Get the "size" for a window\r
+/*!\r
+ * @brief (Windows版固有実装)Get the "size" for a window\r
  */\r
 static void term_getsize(term_data *td)\r
 {\r
        RECT rc;\r
-\r
-       int wid, hgt;\r
+       TERM_LEN wid, hgt;\r
 \r
        /* Paranoia */\r
        if (td->cols < 1) td->cols = 1;\r
@@ -1114,7 +1067,6 @@ static void term_getsize(term_data *td)
        rc.top = 0;\r
        rc.bottom = rc.top + hgt;\r
 \r
-       /* XXX XXX XXX */\r
        /* rc.right += 1; */\r
        /* rc.bottom += 1; */\r
 \r
@@ -1241,7 +1193,6 @@ static void save_prefs_aux(int i)
 \r
 /*\r
  * Write the "prefs"\r
- *\r
  * We assume that the windows have all been initialized\r
  */\r
 static void save_prefs(void)\r
@@ -1403,7 +1354,7 @@ static void load_prefs(void)
 #if defined(USE_SOUND) || defined(USE_MUSIC)\r
 \r
 /*\r
- * XXX XXX XXX - Taken from files.c.\r
+ * - Taken from files.c.\r
  *\r
  * Extract "tokens" from a buffer\r
  *\r
@@ -1825,17 +1776,14 @@ static bool init_graphics(void)
        /* Activate a palette */\r
        if (!new_palette())\r
        {\r
-               /* Free bitmap XXX XXX XXX */\r
+               /* Free bitmap */\r
 \r
-               /* Oops */\r
                plog(_("パレットを実現できません!", "Cannot activate palette!"));\r
                return (FALSE);\r
        }\r
 \r
        /* Graphics available */\r
        current_graphics_mode = arg_graphics;\r
-\r
-       /* Result */\r
        return (current_graphics_mode);\r
 }\r
 #endif /* USE_GRAPHICS */\r
@@ -1856,8 +1804,6 @@ static bool init_music(void)
                /* Sound available */\r
                can_use_music = TRUE;\r
        }\r
-\r
-       /* Result */\r
        return (can_use_music);\r
 }\r
 \r
@@ -1887,8 +1833,6 @@ static bool init_sound(void)
                /* Sound available */\r
                can_use_sound = TRUE;\r
        }\r
-\r
-       /* Result */\r
        return (can_use_sound);\r
 }\r
 #endif /* USE_SOUND */\r
@@ -2201,8 +2145,8 @@ static void Term_nuke_win(term *t)
 #endif\r
 \r
 \r
-/*\r
- * Interact with the User\r
+/*!\r
+ * @brief //!< Windows版ユーザ設定項目実装部(実装必須) /Interact with the User\r
  */\r
 static errr Term_user_win(int n)\r
 {\r
@@ -2221,7 +2165,6 @@ static errr Term_xtra_win_react(void)
 {\r
        int i;\r
 \r
-\r
        /* Simple color */\r
        if (colors16)\r
        {\r
@@ -2430,7 +2373,7 @@ static errr Term_xtra_win_flush(void)
 /*\r
  * Hack -- clear the screen\r
  *\r
- * Make this more efficient XXX XXX XXX\r
+ * Make this more efficient \r
  */\r
 static errr Term_xtra_win_clear(void)\r
 {\r
@@ -2519,7 +2462,6 @@ static errr Term_xtra_win_sound(int v)
 \r
 #else /* USE_SOUND */\r
 \r
-       /* Oops */\r
        return (1);\r
 \r
 #endif /* USE_SOUND */\r
@@ -2741,7 +2683,6 @@ static errr Term_xtra_win(int n, int v)
                }\r
        }\r
 \r
-       /* Oops */\r
        return 1;\r
 }\r
 \r
@@ -2872,9 +2813,9 @@ static errr Term_wipe_win(int x, int y, int n)
  *\r
  * One would think there is a more efficient method for telling a window\r
  * what color it should be using to draw with, but perhaps simply changing\r
- * it every time is not too inefficient.  XXX XXX XXX\r
+ * it every time is not too inefficient.  \r
  */\r
-static errr Term_text_win(int x, int y, int n, byte a, const char *s)\r
+static errr Term_text_win(int x, int y, int n, TERM_COLOR a, const char *s)\r
 {\r
        term_data *td = (term_data*)(Term->data);\r
        RECT rc;\r
@@ -3067,16 +3008,16 @@ static errr Term_text_win(int x, int y, int n, byte a, const char *s)
  *\r
  * If "graphics" is not available, we simply "wipe" the given grids.\r
  */\r
-static errr Term_pict_win(int x, int y, int n, const byte *ap, const char *cp, const byte *tap, const char *tcp)\r
+static errr Term_pict_win(TERM_LEN x, TERM_LEN y, int n, const TERM_COLOR *ap, const char *cp, const TERM_COLOR *tap, const char *tcp)\r
 {\r
        term_data *td = (term_data*)(Term->data);\r
 \r
 #ifdef USE_GRAPHICS\r
 \r
        int i;\r
-       int x1, y1, w1, h1, tw1, th1;\r
-       int x2, y2, w2, h2, tw2 = 0;\r
-       int x3, y3;\r
+       TERM_LEN x1, y1, w1, h1, tw1, th1;\r
+       TERM_LEN x2, y2, w2, h2, tw2 = 0;\r
+       TERM_LEN x3, y3;\r
 \r
        HDC hdcMask = NULL;\r
 \r
@@ -3133,7 +3074,7 @@ static errr Term_pict_win(int x, int y, int n, const byte *ap, const char *cp, c
        /* Draw attr/char pairs */\r
        for (i = 0; i < n; i++, x2 += w2)\r
        {\r
-               byte a = ap[i];\r
+               TERM_COLOR a = ap[i];\r
                char c = cp[i];\r
 \r
 \r
@@ -3237,12 +3178,12 @@ static errr Term_pict_win(int x, int y, int n, const byte *ap, const char *cp, c
 static void windows_map(void)\r
 {\r
        term_data *td = &data[0];\r
-       byte a;\r
+       TERM_COLOR a;\r
        char c;\r
-       int x, min_x, max_x;\r
-       int y, min_y, max_y;\r
+       TERM_LEN x, min_x, max_x;\r
+       TERM_LEN y, min_y, max_y;\r
 \r
-       byte ta;\r
+       TERM_COLOR ta;\r
        char tc;\r
 \r
        /* Only in graphics mode */\r
@@ -3343,7 +3284,7 @@ static void term_data_link(term_data *td)
  * to over-ride selected values, then create the windows, and fonts.\r
  *\r
  * Must use SW_SHOW not SW_SHOWNA, since on 256 color display\r
- * must make active to realize the palette.  XXX XXX XXX\r
+ * must make active to realize the palette.  \r
  */\r
 static void init_windows(void)\r
 {\r
@@ -3448,7 +3389,6 @@ static void init_windows(void)
                        /* Force the use of that font */\r
                        (void)term_force_font(td, buf);\r
 \r
-                       /* Oops */\r
                        td->tile_wid = 8;\r
                        td->tile_hgt = 13;\r
 \r
@@ -3533,7 +3473,7 @@ static void init_windows(void)
        SetWindowPos(td->w, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);\r
 \r
 \r
-       /* New palette XXX XXX XXX */\r
+       /* New palette */\r
        (void)new_palette();\r
 \r
 \r
@@ -3961,7 +3901,6 @@ static void process_menus(WORD wCmd)
                        }\r
                        else\r
                        {\r
-                               /* Save Screen */\r
                                screen_save();\r
 \r
                                /* Clear screen */\r
@@ -4503,7 +4442,7 @@ static void process_menus(WORD wCmd)
 \r
                                if (hwndSaver)\r
                                {\r
-                                       /* Push the window to the bottom XXX XXX XXX */\r
+                                       /* Push the window to the bottom */\r
                                        SetWindowPos(hwndSaver, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);\r
                                }\r
                                else\r
@@ -4533,14 +4472,8 @@ static void process_menus(WORD wCmd)
                        }\r
                        else\r
                        {\r
-#ifdef JP\r
-                               plog_fmt("ヘルプファイル[%s]が見付かりません。", tmp);\r
-                               plog("代わりにオンラインヘルプを使用してください。");\r
-#else\r
-                               plog_fmt("Cannot find help file: %s", tmp);\r
-                               plog("Use the online help files instead.");\r
-#endif\r
-\r
+                               plog_fmt(_("ヘルプファイル[%s]が見付かりません。", "Cannot find help file: %s"), tmp);\r
+                               plog(_("代わりにオンラインヘルプを使用してください。", "Use the online help files instead."));\r
                        }\r
                        break;\r
 #else /* HTML_HELP */\r
@@ -4554,13 +4487,8 @@ static void process_menus(WORD wCmd)
                        }\r
                        else\r
                        {\r
-#ifdef JP\r
-                               plog_fmt("ヘルプファイル[%s]が見付かりません。", tmp);\r
-                               plog("代わりにオンラインヘルプを使用してください。");\r
-#else\r
-                               plog_fmt("Cannot find help file: %s", tmp);\r
-                               plog("Use the online help files instead.");\r
-#endif\r
+                               plog_fmt(_("ヘルプファイル[%s]が見付かりません。", "Cannot find help file: %s"), tmp);\r
+                               plog(_("代わりにオンラインヘルプを使用してください。", "Use the online help files instead."));\r
 \r
                        }\r
                        break;\r
@@ -4667,8 +4595,7 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
 LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,\r
                                  WPARAM wParam, LPARAM lParam)\r
 #else /* __MWERKS__ */\r
-LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,\r
-                                         WPARAM wParam, LPARAM lParam)\r
+LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r
 #endif /* __MWERKS__ */\r
 {\r
        PAINTSTRUCT ps;\r
@@ -4687,14 +4614,12 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
        /* Handle message */\r
        switch (uMsg)\r
        {\r
-               /* XXX XXX XXX */\r
                case WM_NCCREATE:\r
                {\r
                        SetWindowLong(hWnd, 0, (LONG)(my_td));\r
                        break;\r
                }\r
 \r
-               /* XXX XXX XXX */\r
                case WM_CREATE:\r
                {\r
 #ifdef USE_MUSIC\r
@@ -4779,10 +4704,10 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
                        HGLOBAL hGlobal;\r
                        LPSTR lpStr;\r
                        int j, sz;\r
-                       TERM_POSITION dx = abs(oldx - mousex) + 1;\r
-                       TERM_POSITION dy = abs(oldy - mousey) + 1;\r
-                       TERM_POSITION ox = (oldx > mousex) ? mousex : oldx;\r
-                       TERM_POSITION oy = (oldy > mousey) ? mousey : oldy;\r
+                       TERM_LEN dx = abs(oldx - mousex) + 1;\r
+                       TERM_LEN dy = abs(oldy - mousey) + 1;\r
+                       TERM_LEN ox = (oldx > mousex) ? mousex : oldx;\r
+                       TERM_LEN oy = (oldy > mousey) ? mousey : oldy;\r
 \r
                        mouse_down = FALSE;\r
                        paint_rect = FALSE;\r
@@ -4982,13 +4907,13 @@ LRESULT FAR PASCAL AngbandWndProc(HWND hWnd, UINT uMsg,
 \r
                                case SIZE_MAXIMIZED:\r
                                {\r
-                                       /* fall through XXX XXX XXX */\r
+                                       /* fall through */\r
                                }\r
 \r
                                case SIZE_RESTORED:\r
                                {\r
-                                       TERM_POSITION cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;\r
-                                       TERM_POSITION rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;\r
+                                       TERM_LEN cols = (LOWORD(lParam) - td->size_ow1) / td->tile_wid;\r
+                                       TERM_LEN rows = (HIWORD(lParam) - td->size_oh1) / td->tile_hgt;\r
 \r
                                        /* New size */\r
                                        if ((td->cols != cols) || (td->rows != rows))\r
@@ -5125,14 +5050,12 @@ LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg,
        /* Process message */\r
        switch (uMsg)\r
        {\r
-               /* XXX XXX XXX */\r
                case WM_NCCREATE:\r
                {\r
                        SetWindowLong(hWnd, 0, (LONG)(my_td));\r
                        break;\r
                }\r
 \r
-               /* XXX XXX XXX */\r
                case WM_CREATE:\r
                {\r
                        return 0;\r
@@ -5165,8 +5088,8 @@ LRESULT FAR PASCAL AngbandListProc(HWND hWnd, UINT uMsg,
 \r
                case WM_SIZE:\r
                {\r
-                       TERM_POSITION cols;\r
-                       TERM_POSITION rows;\r
+                       TERM_LEN cols;\r
+                       TERM_LEN rows;\r
                        \r
                        /* this message was sent before WM_NCCREATE */\r
                        if (!td) return 1;\r
@@ -5306,7 +5229,6 @@ LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg,
        /* Process */\r
        switch (uMsg)\r
        {\r
-               /* XXX XXX XXX */\r
                case WM_NCCREATE:\r
                {\r
                        break;\r
@@ -5368,7 +5290,6 @@ LRESULT FAR PASCAL AngbandSaverProc(HWND hWnd, UINT uMsg,
                }\r
        }\r
 \r
-       /* Oops */\r
        return DefWindowProc(hWnd, uMsg, wParam, lParam);\r
 }\r
 \r
@@ -5480,7 +5401,7 @@ static void hook_quit(cptr str)
        save_prefs();\r
 \r
 \r
-       /*** Could use 'Term_nuke_win()' XXX XXX XXX */\r
+       /*** Could use 'Term_nuke_win()' */\r
 \r
        /* Destroy all windows */\r
        for (i = MAX_TERM_DATA - 1; i >= 0; --i)\r
@@ -5535,7 +5456,7 @@ static void init_stuff(void)
        /* Get program name with full path */\r
        GetModuleFileName(hInstance, path, 512);\r
 \r
-       /* Save the "program name" XXX XXX XXX */\r
+       /* Save the "program name" */\r
        argv0 = path;\r
 \r
        /* Get the name of the "*.ini" file */\r
@@ -5665,6 +5586,9 @@ static void init_stuff(void)
        /* validate_dir(ANGBAND_DIR_XTRA_HELP); */\r
 }\r
 \r
+/*!\r
+ * @brief (Windows固有)変愚蛮怒が起動済かどうかのチェック\r
+ */\r
 static bool is_already_running(void)\r
 {\r
        bool result = FALSE;\r
@@ -5679,6 +5603,9 @@ static bool is_already_running(void)
 }\r
 \r
 \r
+/*!\r
+ * @brief (Windows固有)Windowsアプリケーションとしてのエントリポイント\r
+ */\r
 int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,\r
                       LPSTR lpCmdLine, int nCmdShow)\r
 {\r
@@ -5707,7 +5634,6 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
                return FALSE;\r
        }\r
 \r
-       /* Initialize */\r
        if (hPrevInst == NULL)\r
        {\r
                wc.style         = CS_CLASSDC;\r
@@ -5822,7 +5748,6 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst,
        /* Catch nasty signals */\r
        signals_init();\r
 \r
-       /* Initialize */\r
        Term_activate(term_screen);\r
        init_angband();\r
 \r