Skip to content

未使用メンバ変数削除 (m_bVisualStyle) #2043

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 2 additions & 7 deletions sakura_core/window/CTabWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#include "env/CShareData.h"
#include "env/CSakuraEnvironment.h"
#include "uiparts/CGraphics.h"
#include "util/os.h" //WM_THEMECHANGED
#include "util/os.h"
#include "util/window.h"
#include "util/module.h"
#include "util/string_ex2.h"
Expand Down Expand Up @@ -170,11 +170,8 @@ LRESULT CTabWnd::TabWndDispatchEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARA
::InvalidateRect( GetHwnd(), NULL, TRUE ); // アクティブタブの位置が変わるのでトップバンドを更新する // 2006.03.27 ryoji
break;

case WM_THEMECHANGED:
m_bVisualStyle = ::IsVisualStyle();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「この変数が要らない」わけではなく、本来なら参照すべき箇所(≒OnDrawItem内、2か所)で
「::IsVisualStyle()」を直接呼び出しているために「現状は使われていない」が実情のようです。

あるべき論を語り出すとめんどくさいですが、「テーマ(≒旧称VisualStyle)が有効かどうか」というグローバル状態をウインドウのメッセージディスパッチャクラスのプロパティにキャッシュさせるやり方は、それなりに一般的で妥当な気がします。

「CTabWndクラスが複数ウインドウのメッセージを処理していてメンバー変数もイベントハンドラも多過ぎ、構造が分かりづら過ぎ」というのには同意しますが、このメンバーを削ることで「分かりやすくなるか?」というと微妙に思っています。(実際、変数が保持する情報を使うコードがありますし。)

default:
break;

//default:
}

return 1L; //デフォルトのディスパッチにまわす
Expand Down Expand Up @@ -814,7 +811,6 @@ CTabWnd::CTabWnd()
: CWnd(L"::CTabWnd")
, m_eTabPosition( TabPosition_None )
, m_eDragState( DRAG_NONE )
, m_bVisualStyle( FALSE ) // 2007.04.01 ryoji
, m_bHovering( FALSE ) // 2006.02.01 ryoji
, m_bListBtnHilighted( FALSE ) // 2006.02.01 ryoji
, m_bCloseBtnHilighted( FALSE ) // 2006.10.21 ryoji
Expand Down Expand Up @@ -853,7 +849,6 @@ HWND CTabWnd::Open( HINSTANCE hInstance, HWND hwndParent )
m_hFont = NULL;
gm_pOldWndProc = NULL;
m_hwndToolTip = NULL;
m_bVisualStyle = ::IsVisualStyle(); // 2007.04.01 ryoji
m_eDragState = DRAG_NONE; // 2005.09.29 ryoji
m_bHovering = FALSE; // 2006.02.01 ryoji
m_bListBtnHilighted = FALSE; // 2006.02.01 ryoji
Expand Down
1 change: 0 additions & 1 deletion sakura_core/window/CTabWnd.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ class CTabWnd final : public CWnd
int m_iIconApp; //!< アプリケーションアイコンのインデックス
int m_iIconGrep; //!< Grepアイコンのインデックス

BOOL m_bVisualStyle; //!< ビジュアルスタイルかどうか // 2007.04.01 ryoji
BOOL m_bHovering;
BOOL m_bListBtnHilighted;
BOOL m_bCloseBtnHilighted; //!< 閉じるボタンハイライト状態 // 2006.10.21 ryoji
Expand Down