Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ダイアログフォント美化 #1421

Merged
merged 16 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sakura_core/dlg/CDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "util/os.h"
#include "util/shell.h"
#include "util/module.h"
#include "util/window.h"

/* ダイアログプロシージャ */
INT_PTR CALLBACK MyDialogProc(
Expand Down Expand Up @@ -183,6 +184,8 @@ BOOL CDialog::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )

SetDialogPosSize();

m_hFontDialog = UpdateDialogFont( hwndDlg );

m_bInited = TRUE;
return TRUE;
}
Expand Down
3 changes: 3 additions & 0 deletions sakura_core/dlg/CDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class CDialog
HWND m_hwndParent; /* オーナーウィンドウのハンドル */
private:
HWND m_hWnd; /* このダイアログのハンドル */
HFONT m_hFontDialog; // ダイアログに設定されているフォント(破棄禁止)
public:
HWND m_hwndSizeBox;
LPARAM m_lParam;
Expand All @@ -163,5 +164,7 @@ class CDialog

// コントロールに画面のフォントを設定 2012/11/27 Uchi
HFONT SetMainFont( HWND hTarget );
// このダイアログに設定されているフォントを取得
HFONT GetDialogFont() { return m_hFontDialog; }
};
#endif /* SAKURA_CDIALOG_17C8C15C_881C_4C1F_B953_CB11FCC8B70B_H_ */
6 changes: 3 additions & 3 deletions sakura_core/dlg/CDlgAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
}
// To Here Dec. 2, 2002 genta

/* 基底クラスメンバ */
(void)CDialog::OnInitDialog( GetHwnd(), wParam, lParam );

// URLウィンドウをサブクラス化する
m_UrlUrWnd.SetSubclassWindow( GetItemHwnd( IDC_STATIC_URL_UR ) );
#ifdef GIT_REMOTE_ORIGIN_URL
Expand All @@ -287,9 +290,6 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
// Oct. 22, 2005 genta 原作者ホームページが無くなったので削除
//m_UrlOrgWnd.SubclassWindow( GetItemHwnd(IDC_STATIC_URL_ORG ) );

/* 基底クラスメンバ */
(void)CDialog::OnInitDialog( GetHwnd(), wParam, lParam );

/* デフォルトでは一番最初のタブオーダーの要素になるので明示的に OK ボタンにフォーカスを合わせる */
::SetFocus(GetItemHwnd(IDOK));

Expand Down
7 changes: 4 additions & 3 deletions sakura_core/dlg/CDlgGrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ BOOL CDlgGrep::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
m_comboDelExcludeFolder.pRecent = &m_cRecentExcludeFolder;
SetComboBoxDeleter(GetItemHwnd(IDC_COMBO_EXCLUDE_FOLDER), &m_comboDelExcludeFolder);

BOOL bRet = CDialog::OnInitDialog( hwndDlg, wParam, lParam );
if( !bRet ) return bRet;

// フォント設定 2012/11/27 Uchi
const int nItemIds[] = { IDC_COMBO_TEXT, IDC_COMBO_FILE, IDC_COMBO_FOLDER, IDC_COMBO_EXCLUDE_FILE, IDC_COMBO_EXCLUDE_FOLDER };
m_cFontDeleters.resize( _countof( nItemIds ) );
Expand All @@ -359,9 +362,7 @@ BOOL CDlgGrep::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
m_cFontDeleters[i].SetFont( hFontOld, hFont, hwndItem );
}

/* 基底クラスメンバ */
// CreateSizeBox();
return CDialog::OnInitDialog( hwndDlg, wParam, lParam );
return bRet;
}

/*! @brief フォルダ指定EditBoxのコールバック関数
Expand Down
5 changes: 4 additions & 1 deletion sakura_core/dlg/CDlgGrepReplace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@ BOOL CDlgGrepReplace::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
m_comboDelText2.pRecent = &m_cRecentReplace;
SetComboBoxDeleter( GetItemHwnd( IDC_COMBO_TEXT2 ), &m_comboDelText2 );

BOOL bRet = CDlgGrep::OnInitDialog( hwndDlg, wParam, lParam );
if( !bRet ) return bRet;

HFONT hFontOld = (HFONT)::SendMessageAny( GetItemHwnd( IDC_COMBO_TEXT2 ), WM_GETFONT, 0, 0 );
HFONT hFont = SetMainFont( GetItemHwnd( IDC_COMBO_TEXT2 ) );
m_cFontText2.SetFont( hFontOld, hFont, GetItemHwnd( IDC_COMBO_TEXT2 ) );

return CDlgGrep::OnInitDialog( hwndDlg, wParam, lParam );
return bRet;
}

BOOL CDlgGrepReplace::OnDestroy()
Expand Down
2 changes: 2 additions & 0 deletions sakura_core/dlg/CDlgInput1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "util/shell.h"
#include "sakura_rc.h"
#include "sakura.hh"
#include "util/window.h"

// 入力 CDlgInput1.cpp //@@@ 2002.01.07 add start MIK
static const DWORD p_helpids[] = { //13000
Expand All @@ -44,6 +45,7 @@ INT_PTR CALLBACK CDlgInput1Proc(
case WM_INITDIALOG:
pCDlgInput1 = ( CDlgInput1* )lParam;
if( NULL != pCDlgInput1 ){
UpdateDialogFont( hwndDlg );
return pCDlgInput1->DispatchEvent( hwndDlg, uMsg, wParam, lParam );
}else{
return FALSE;
Expand Down
2 changes: 2 additions & 0 deletions sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ UINT_PTR CALLBACK OFNHookProc(
}
case WM_INITDIALOG:
{
UpdateDialogFont( hdlg );

// Save off the long pointer to the OPENFILENAME structure.
// Modified by KEITA for WIN64 2003.9.6
OPENFILENAME* pOfn = (OPENFILENAME*)lParam;
Expand Down
16 changes: 8 additions & 8 deletions sakura_core/dlg/CDlgPrintSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ BOOL CDlgPrintSetting::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam
// ::SetTimer( GetHwnd(), IDT_PRINTSETTING, 500, NULL );
//UpdatePrintableLineAndColumn();

// ダイアログのフォントの取得
m_hFontDlg = (HFONT)::SendMessage( GetHwnd(), WM_GETFONT, 0, 0 ); // ダイアログのフォント
BOOL bRet = CDialog::OnInitDialog( GetHwnd(), wParam, lParam );

// ダイアログフォントの寸法を得ておく
LOGFONT lf;
::GetObject(m_hFontDlg, sizeof(LOGFONT), &lf);
::GetObject(GetDialogFont(), sizeof(LOGFONT), &lf);
m_nFontHeight = lf.lfHeight; // フォントサイズ

/* 基底クラスメンバ */
return CDialog::OnInitDialog( GetHwnd(), wParam, lParam );
return bRet;
}

BOOL CDlgPrintSetting::OnDestroy( void )
Expand All @@ -172,11 +172,11 @@ BOOL CDlgPrintSetting::OnDestroy( void )
// フォントの破棄
HFONT hFontOld;
hFontOld = (HFONT)::SendMessage(GetItemHwnd( IDC_STATIC_FONT_HEAD ), WM_GETFONT, 0, 0 );
if (m_hFontDlg != hFontOld) {
if (GetDialogFont() != hFontOld) {
::DeleteObject( hFontOld );
}
hFontOld = (HFONT)::SendMessage(GetItemHwnd( IDC_STATIC_FONT_FOOT ), WM_GETFONT, 0, 0 );
if (m_hFontDlg != hFontOld) {
if (GetDialogFont() != hFontOld) {
::DeleteObject( hFontOld );
}

Expand Down Expand Up @@ -913,7 +913,7 @@ void CDlgPrintSetting::SetFontName( int idTxt, int idUse, LOGFONT& lf, int nPoin
// フォントの設定
::SendMessage( GetItemHwnd( idTxt ), WM_SETFONT, (WPARAM)hFont, MAKELPARAM(FALSE, 0) );
}
if (m_hFontDlg != hFontOld) {
if (GetDialogFont() != hFontOld) {
// 古いフォントの破棄
::DeleteObject( hFontOld );
}
Expand Down
1 change: 0 additions & 1 deletion sakura_core/dlg/CDlgPrintSetting.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class CDlgPrintSetting final : public CDialog
PRINTSETTING m_PrintSettingArr[MAX_PRINTSETTINGARR];
int m_nLineNumberColumns; // 行番号表示する場合の桁数
bool m_bPrintableLinesAndColumnInvalid;
HFONT m_hFontDlg; // ダイアログのフォントハンドル
int m_nFontHeight; // ダイアログのフォントのサイズ

protected:
Expand Down
6 changes: 4 additions & 2 deletions sakura_core/dlg/CDlgReplace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ BOOL CDlgReplace::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
m_comboDelText2.pRecent = &m_cRecentReplace;
SetComboBoxDeleter(GetItemHwnd(IDC_COMBO_TEXT2), &m_comboDelText2);

BOOL bRet = CDialog::OnInitDialog( hwndDlg, wParam, lParam );
if( !bRet ) return bRet;

// フォント設定 2012/11/27 Uchi
HFONT hFontOld = (HFONT)::SendMessageAny( GetItemHwnd( IDC_COMBO_TEXT ), WM_GETFONT, 0, 0 );
HFONT hFont = SetMainFont( GetItemHwnd( IDC_COMBO_TEXT ) );
Expand All @@ -368,8 +371,7 @@ BOOL CDlgReplace::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )
hFont = SetMainFont( GetItemHwnd( IDC_COMBO_TEXT2 ) );
m_cFontText2.SetFont( hFontOld, hFont, GetItemHwnd( IDC_COMBO_TEXT2 ) );

/* 基底クラスメンバ */
return CDialog::OnInitDialog( hwndDlg, wParam, lParam );
return bRet;
}

BOOL CDlgReplace::OnDestroy()
Expand Down
2 changes: 2 additions & 0 deletions sakura_core/print/CPrintPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2062,6 +2062,8 @@ INT_PTR CALLBACK CPrintPreview::PrintPreviewBar_DlgProc(
CPrintPreview* pCPrintPreview;
switch( uMsg ){
case WM_INITDIALOG:
UpdateDialogFont( hwndDlg );

// Modified by KEITA for WIN64 2003.9.6
::SetWindowLongPtr( hwndDlg, DWLP_USER, lParam );
// 2007.02.11 Moca WM_INITもDispatchEvent_PPBを呼ぶように
Expand Down
2 changes: 2 additions & 0 deletions sakura_core/prop/CPropCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ INT_PTR CPropCommon::DlgProc(
pPsp = (PROPSHEETPAGE*)lParam;
pCPropCommon = ( CPropCommon* )(pPsp->lParam);
if( NULL != pCPropCommon ){
UpdateDialogFont( hwndDlg );
return (pCPropCommon->*DispatchPage)( hwndDlg, uMsg, wParam, pPsp->lParam );
}else{
return FALSE;
Expand Down Expand Up @@ -107,6 +108,7 @@ INT_PTR CPropCommon::DlgProc2(
case WM_INITDIALOG:
pCPropCommon = ( CPropCommon* )(lParam);
if( NULL != pCPropCommon ){
UpdateDialogFont( hwndDlg );
return (pCPropCommon->*DispatchPage)( hwndDlg, uMsg, IDOK, lParam );
}else{
return FALSE;
Expand Down
Loading