Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/teraterm/teraterm/prnabort.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10150 - (show annotations) (download) (as text)
Sat Aug 13 14:01:35 2022 UTC (21 months, 2 weeks ago) by zmatsuo
File MIME type: text/x-c++src
File size: 3524 byte(s)
ダイアログフォント名をUnicode化した

- tttset DialogFontName -> DialogFontNameW
- ChooseFontW() を使用するようにした
  - 変更前は ChooseFontA() (ANSI版)を使用していた
- SetDialogFont() の引数を Unicode に変更
- iniファイルのダイアログフォント名への読み書きをUnicode行うよう修正
  - 従来は ANSI だった
- Unicode化してもつかえないフォントがある
  - 例,日本語環境では次のように指定してもフォントを選択できない
    - DlgFont=돋움,9,1
  - フォントが見つからないのでデフォルトのフォントが使用される
1 /*
2 * Copyright (C) 1994-1998 T. Teranishi
3 * (C) 2007- TeraTerm Project
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 /* TERATERM.EXE, print-abort dialog box */
31 #include <windows.h>
32 #include <windowsx.h>
33 #include "teraterm.h"
34 #include "tttypes.h"
35 #include "ttlib.h"
36 #include "dlglib.h"
37 #include "tt_res.h"
38 #include "prnabort.h"
39
40 LRESULT CALLBACK CPrnAbortDlg::OnDlgProc(HWND hDlgWnd, UINT msg, WPARAM wp, LPARAM lp)
41 {
42 static const DlgTextInfo TextInfos[] = {
43 { IDC_PRNABORT_PRINTING, "DLG_PRNABORT_PRINTING" },
44 { IDCANCEL, "BTN_CANCEL" },
45 };
46
47 CPrnAbortDlg *self = (CPrnAbortDlg *)GetWindowLongPtr(hDlgWnd, DWLP_USER);
48
49 switch (msg) {
50 case WM_INITDIALOG:
51 {
52 self = (CPrnAbortDlg *)lp;
53 SetWindowLongPtr(hDlgWnd, DWLP_USER, (LONG_PTR)self);
54 SetDlgTextsW(hDlgWnd, TextInfos, _countof(TextInfos), self->m_ts->UILanguageFileW);
55 return TRUE;
56 }
57
58 case WM_COMMAND:
59 {
60 const WORD wID = GET_WM_COMMAND_ID(wp, lp);
61 if (wID == IDOK) {
62 self->DestroyWindow();
63 }
64 if (wID == IDCANCEL) {
65 self->OnCancel();
66 }
67 return FALSE;
68 }
69 case WM_NCDESTROY:
70 self->PostNcDestroy();
71 return TRUE;
72
73 default:
74 return FALSE;
75 }
76 return TRUE;
77 }
78
79 BOOL CPrnAbortDlg::Create(HINSTANCE hInstance, HWND hParent, PBOOL AbortFlag, PTTSet pts)
80 {
81 m_pAbort = AbortFlag;
82 m_hParentWnd = hParent;
83 m_ts = pts;
84
85 SetDialogFont(m_ts->DialogFontNameW, m_ts->DialogFontPoint, m_ts->DialogFontCharSet,
86 m_ts->UILanguageFileW, "Tera Term", "DLG_SYSTEM_FONT");
87 HWND hWnd = TTCreateDialogParam(
88 hInstance, MAKEINTRESOURCE(IDD_PRNABORTDLG), hParent,
89 (DLGPROC)OnDlgProc, (LPARAM)this);
90 if (hWnd == NULL)
91 {
92 return FALSE;
93 }
94
95 m_hWnd = hWnd;
96 ::EnableWindow(hParent,FALSE);
97 ::ShowWindow(hWnd, SW_SHOW);
98 ::EnableWindow(m_hWnd,TRUE);
99 return TRUE;
100 }
101
102 void CPrnAbortDlg::OnCancel()
103 {
104 *m_pAbort = TRUE;
105 DestroyWindow();
106 }
107
108 void CPrnAbortDlg::PostNcDestroy()
109 {
110 delete this;
111 }
112
113 BOOL CPrnAbortDlg::DestroyWindow()
114 {
115 ::EnableWindow(m_hParentWnd,TRUE);
116 ::SetFocus(m_hParentWnd);
117 ::DestroyWindow(m_hWnd);
118 return TRUE;
119 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26