Skip to content

Commit

Permalink
Merge 0d2090f into bb83d9d
Browse files Browse the repository at this point in the history
  • Loading branch information
suconbu authored Oct 13, 2020
2 parents bb83d9d + 0d2090f commit 1b00f2d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
26 changes: 15 additions & 11 deletions sakura_core/util/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,19 @@ static LRESULT CALLBACK PropSheetWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, L
*/
static int CALLBACK PropSheetProc( HWND hwndDlg, UINT uMsg, LPARAM lParam )
{
// プロパティシートの初期化時にボタン追加、プロパティシートのサブクラス化を行う
// プロパティシートの初期化時にシステムフォント設定、ボタン追加、プロパティシートのサブクラス化を行う
if( uMsg == PSCB_INITIALIZED ){
s_pOldPropSheetWndProc = (WNDPROC)::SetWindowLongPtr( hwndDlg, GWLP_WNDPROC, (LONG_PTR)PropSheetWndProc );
HINSTANCE hInstance = (HINSTANCE)::GetModuleHandle( NULL );
HWND hwndBtn = ::CreateWindowEx( 0, WC_BUTTON, LS(STR_SHELL_INIFOLDER), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 140, 20, hwndDlg, (HMENU)0x02000, hInstance, NULL );
::SendMessage( hwndBtn, WM_SETFONT, (WPARAM)::SendMessage( hwndDlg, WM_GETFONT, 0, 0 ), MAKELPARAM( FALSE, 0 ) );
::SetWindowPos( hwndBtn, ::GetDlgItem( hwndDlg, IDHELP), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
// システムフォント設定は言語設定に関係なく実施(force=TRUE)
HFONT hFont = UpdateDialogFont( hwndDlg, TRUE );

if( CShareData::getInstance()->IsPrivateSettings() ){
// 個人設定フォルダを使用するときは「設定フォルダ」ボタンを追加する
s_pOldPropSheetWndProc = (WNDPROC)::SetWindowLongPtr( hwndDlg, GWLP_WNDPROC, (LONG_PTR)PropSheetWndProc );
HINSTANCE hInstance = (HINSTANCE)::GetModuleHandle( NULL );
HWND hwndBtn = ::CreateWindowEx( 0, WC_BUTTON, LS(STR_SHELL_INIFOLDER), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 140, 20, hwndDlg, (HMENU)0x02000, hInstance, NULL );
::SendMessage( hwndBtn, WM_SETFONT, (WPARAM)hFont, MAKELPARAM( FALSE, 0 ) );
::SetWindowPos( hwndBtn, ::GetDlgItem( hwndDlg, IDHELP), 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
}
}
return 0;
}
Expand All @@ -274,11 +280,9 @@ static int CALLBACK PropSheetProc( HWND hwndDlg, UINT uMsg, LPARAM lParam )
*/
INT_PTR MyPropertySheet( LPPROPSHEETHEADER lppsph )
{
// 個人設定フォルダを使用するときは「設定フォルダ」ボタンを追加する
if( CShareData::getInstance()->IsPrivateSettings() ){
lppsph->dwFlags |= PSH_USECALLBACK;
lppsph->pfnCallback = PropSheetProc;
}
lppsph->dwFlags |= PSH_USECALLBACK;
lppsph->pfnCallback = PropSheetProc;

return ::PropertySheet( lppsph );
}

Expand Down
7 changes: 4 additions & 3 deletions sakura_core/util/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,16 @@ void SetFontRecursive( HWND hwnd, HFONT hFont )
}

/*!
ダイアログボックス用のフォントを設定(日本語以外では何もしない)
ダイアログボックス用のフォントを設定
@param[in] hwnd 設定対象ダイアログボックスのウィンドウハンドル
@param[in] force 強制設定有無(TRUE:必ず設定 FALSE:日本語の場合は設定しそれ以外では設定しない)
@return ダイアログボックスに設定されたフォントハンドル(破棄禁止)
*/
HFONT UpdateDialogFont( HWND hwnd )
HFONT UpdateDialogFont( HWND hwnd, BOOL force )
{
HFONT hFontDialog = (HFONT)::SendMessageAny( hwnd, WM_GETFONT, 0, (LPARAM)NULL );

if( wcsncmp_literal( CSelectLang::getDefaultLangString(), _T("Japanese") ) != 0 ){
if( !force && wcsncmp_literal( CSelectLang::getDefaultLangString(), _T("Japanese") ) != 0 ){
return hFontDialog;
}

Expand Down
2 changes: 1 addition & 1 deletion sakura_core/util/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,6 @@ class CDCFont
HFONT m_hFont;
};

HFONT UpdateDialogFont( HWND hwnd );
HFONT UpdateDialogFont( HWND hwnd, BOOL force = FALSE );

#endif /* SAKURA_WINDOW_A0833476_5E32_46BE_87B6_ECD55F10D34A_H_ */

0 comments on commit 1b00f2d

Please sign in to comment.