-
Notifications
You must be signed in to change notification settings - Fork 168
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
ミニマップの実装クラスを分割する #1748
Merged
sanomari
merged 1 commit into
sakura-editor:master
from
sanomari:feature/add_cminimapview
Oct 24, 2021
Merged
ミニマップの実装クラスを分割する #1748
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*! @file */ | ||
/* | ||
Copyright (C) 2012, Moca | ||
Copyright (C) 2018-2021, Sakura Editor Organization | ||
|
||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
|
||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
|
||
1. The origin of this software must not be misrepresented; | ||
you must not claim that you wrote the original software. | ||
If you use this software in a product, an acknowledgment | ||
in the product documentation would be appreciated but is | ||
not required. | ||
|
||
2. Altered source versions must be plainly marked as such, | ||
and must not be misrepresented as being the original software. | ||
|
||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
*/ | ||
|
||
#include "StdAfx.h" | ||
#include "view/CMiniMapView.h" | ||
|
||
#include "doc/CEditDoc.h" | ||
|
||
BOOL CMiniMapView::Create( HWND hWndParent ) | ||
{ | ||
auto pcEditDoc = CEditDoc::getInstance(); | ||
return CEditView::Create( hWndParent, pcEditDoc, -1, FALSE, true ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*! @file */ | ||
/* | ||
Copyright (C) 2012, Moca | ||
Copyright (C) 2018-2021, Sakura Editor Organization | ||
|
||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
|
||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
|
||
1. The origin of this software must not be misrepresented; | ||
you must not claim that you wrote the original software. | ||
If you use this software in a product, an acknowledgment | ||
in the product documentation would be appreciated but is | ||
not required. | ||
|
||
2. Altered source versions must be plainly marked as such, | ||
and must not be misrepresented as being the original software. | ||
|
||
3. This notice may not be removed or altered from any source | ||
distribution. | ||
*/ | ||
#pragma once | ||
|
||
#include "view/CEditView.h" | ||
|
||
/*! | ||
ミニマップ | ||
|
||
編集ビューのコードを流用して縮小ビューを表示する | ||
*/ | ||
class CMiniMapView : public CEditView | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 本当はCEditViewとCMiniMapViewの最小公約数的なクラスを抽出してやるといいんですけどね。 |
||
{ | ||
public: | ||
BOOL Create( HWND hWndParent ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,9 +246,6 @@ CEditWnd::~CEditWnd() | |
} | ||
m_pcEditView = NULL; | ||
|
||
delete m_pcEditViewMiniMap; | ||
m_pcEditViewMiniMap = NULL; | ||
|
||
delete m_pcViewFont; | ||
m_pcViewFont = NULL; | ||
|
||
|
@@ -621,8 +618,6 @@ HWND CEditWnd::Create( | |
|
||
m_pcViewFont = new CViewFont(&GetLogfont()); | ||
|
||
m_pcEditViewMiniMap = new CEditView(); | ||
|
||
m_pcViewFontMiniMap = new CViewFont(&GetLogfont(), true); | ||
|
||
wmemset( m_pszMenubarMessage, L' ', MENUBAR_MESSAGE_MAX_LEN ); // null終端は不要 | ||
|
@@ -1024,12 +1019,12 @@ void CEditWnd::LayoutTabBar( void ) | |
void CEditWnd::LayoutMiniMap( void ) | ||
{ | ||
if( m_pShareData->m_Common.m_sWindow.m_bDispMiniMap ){ /* タブバーを表示する */ | ||
if( NULL == GetMiniMap().GetHwnd() ){ | ||
GetMiniMap().Create( GetHwnd(), GetDocument(), -1, FALSE, true ); | ||
if( !m_cMiniMapView.GetHwnd() ){ | ||
m_cMiniMapView.Create( GetHwnd() ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 他と合わせてるんだと思いますが、Createメソッドって「なかったら作る」じゃないですかね? 呼ぶ前にif文挟むの無駄じゃね?という指摘。(対応は任意。 |
||
} | ||
}else{ | ||
if( NULL != GetMiniMap().GetHwnd() ){ | ||
GetMiniMap().Close(); | ||
if( m_cMiniMapView.GetHwnd() ){ | ||
m_cMiniMapView.Close(); | ||
} | ||
} | ||
} | ||
|
@@ -1059,8 +1054,8 @@ void CEditWnd::EndLayoutBars( BOOL bAdjust/* = TRUE*/ ) | |
// その後、ウィンドウの下部境界を上下ドラッグしてサイズ変更するとゴミが現れることがあった。 | ||
::SetWindowPos( m_cDlgFuncList.GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ); | ||
} | ||
if (NULL != GetMiniMap().GetHwnd()) { | ||
::ShowWindow(GetMiniMap().GetHwnd(), nCmdShow); | ||
if( m_cMiniMapView.GetHwnd() ){ | ||
::ShowWindow( m_cMiniMapView.GetHwnd(), nCmdShow ); | ||
} | ||
|
||
if( bAdjust ) | ||
|
@@ -2523,7 +2518,7 @@ void CEditWnd::InitMenu_Function(HMENU hMenu, EFunctionCode eFunc, const wchar_t | |
break; | ||
case F_SHOWMINIMAP: | ||
SetMenuFuncSel( hMenu, eFunc, pszKey, | ||
!m_pShareData->m_Common.m_sWindow.m_bMenuIcon | !GetMiniMap().GetHwnd() ); | ||
!m_pShareData->m_Common.m_sWindow.m_bMenuIcon | !m_cMiniMapView.GetHwnd() ); | ||
break; | ||
case F_TOGGLE_KEY_SEARCH: | ||
SetMenuFuncSel( hMenu, eFunc, pszKey, | ||
|
@@ -2953,8 +2948,8 @@ void CEditWnd::PrintPreviewModeONOFF( void ) | |
::ShowWindow( m_cFuncKeyWnd.GetHwnd(), SW_SHOW ); | ||
::ShowWindow( m_cTabWnd.GetHwnd(), SW_SHOW ); //@@@ 2003.06.25 MIK | ||
::ShowWindow( m_cDlgFuncList.GetHwnd(), SW_SHOW ); // 2010.06.25 ryoji | ||
if (NULL != GetMiniMap().GetHwnd()) { | ||
::ShowWindow(GetMiniMap().GetHwnd(), SW_SHOW); | ||
if( m_cMiniMapView.GetHwnd() ){ | ||
::ShowWindow( m_cMiniMapView.GetHwnd(), SW_SHOW ); | ||
} | ||
|
||
// その他のモードレスダイアログも戻す // 2010.06.25 ryoji | ||
|
@@ -2987,8 +2982,8 @@ void CEditWnd::PrintPreviewModeONOFF( void ) | |
::ShowWindow( m_cFuncKeyWnd.GetHwnd(), SW_HIDE ); | ||
::ShowWindow( m_cTabWnd.GetHwnd(), SW_HIDE ); //@@@ 2003.06.25 MIK | ||
::ShowWindow( m_cDlgFuncList.GetHwnd(), SW_HIDE ); // 2010.06.25 ryoji | ||
if (NULL != GetMiniMap().GetHwnd()) { | ||
::ShowWindow(GetMiniMap().GetHwnd(), SW_HIDE); | ||
if( m_cMiniMapView.GetHwnd() ){ | ||
::ShowWindow( m_cMiniMapView.GetHwnd(), SW_HIDE ); | ||
} | ||
|
||
// その他のモードレスダイアログも隠す // 2010.06.25 ryoji | ||
|
@@ -3307,16 +3302,16 @@ LRESULT CEditWnd::OnSize2( WPARAM wParam, LPARAM lParam, bool bUpdateStatus ) | |
|
||
// ミニマップ | ||
int nMiniMapWidth = 0; | ||
if( GetMiniMap().GetHwnd() ){ | ||
if( m_cMiniMapView.GetHwnd() ){ | ||
nMiniMapWidth = GetDllShareData().m_Common.m_sWindow.m_nMiniMapWidth; | ||
::MoveWindow( m_pcEditViewMiniMap->GetHwnd(), | ||
::MoveWindow( m_cMiniMapView.GetHwnd(), | ||
(eDockSideFL == DOCKSIDE_RIGHT)? cx - nFuncListWidth - nMiniMapWidth: cx - nMiniMapWidth, | ||
(eDockSideFL == DOCKSIDE_TOP)? nTop + nFuncListHeight: nTop, | ||
nMiniMapWidth, | ||
(eDockSideFL == DOCKSIDE_TOP || eDockSideFL == DOCKSIDE_BOTTOM)? nHeight - nFuncListHeight: nHeight, | ||
TRUE | ||
); | ||
GetMiniMap().SplitBoxOnOff( FALSE, FALSE, bMiniMapSizeBox ); | ||
m_cMiniMapView.SplitBoxOnOff( FALSE, FALSE, bMiniMapSizeBox ); | ||
} | ||
|
||
::MoveWindow( | ||
|
@@ -4312,7 +4307,7 @@ void CEditWnd::Views_DeleteCompatibleBitmap() | |
GetView(i).DeleteCompatibleBitmap(); | ||
} | ||
} | ||
GetMiniMap().DeleteCompatibleBitmap(); | ||
m_cMiniMapView.DeleteCompatibleBitmap(); | ||
} | ||
|
||
LRESULT CEditWnd::Views_DispatchEvent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | ||
|
@@ -4377,7 +4372,7 @@ void CEditWnd::InitAllViews() | |
GetView(i).GetCaret().MoveCursor( CLayoutPoint(0, 0), true ); | ||
GetView(i).GetCaret().m_nCaretPosX_Prev = CLayoutInt(0); | ||
} | ||
GetMiniMap().OnChangeSetting(); | ||
m_cMiniMapView.OnChangeSetting(); | ||
} | ||
|
||
void CEditWnd::Views_RedrawAll() | ||
|
@@ -4388,7 +4383,7 @@ void CEditWnd::Views_RedrawAll() | |
GetView(v).RedrawAll(); | ||
} | ||
} | ||
GetMiniMap().RedrawAll(); | ||
m_cMiniMapView.RedrawAll(); | ||
//アクティブを再描画 | ||
GetActiveView().RedrawAll(); | ||
} | ||
|
@@ -4400,7 +4395,7 @@ void CEditWnd::Views_Redraw() | |
if( m_nActivePaneIndex != v ) | ||
GetView(v).Redraw(); | ||
} | ||
GetMiniMap().Redraw(); | ||
m_cMiniMapView.Redraw(); | ||
//アクティブを再描画 | ||
GetActiveView().Redraw(); | ||
} | ||
|
@@ -4475,7 +4470,7 @@ bool CEditWnd::SetDrawSwitchOfAllViews( bool bDraw ) | |
for( i = 0; i < GetAllViewCount(); i++ ){ | ||
GetView(i).SetDrawSwitch( bDraw ); | ||
} | ||
GetMiniMap().SetDrawSwitch( bDraw ); | ||
m_cMiniMapView.SetDrawSwitch( bDraw ); | ||
return bDrawSwitchOld; | ||
} | ||
|
||
|
@@ -4503,8 +4498,8 @@ void CEditWnd::RedrawAllViews( CEditView* pcViewExclude ) | |
pcView->AdjustScrollBars(); | ||
} | ||
} | ||
GetMiniMap().Redraw(); | ||
GetMiniMap().AdjustScrollBars(); | ||
m_cMiniMapView.Redraw(); | ||
m_cMiniMapView.AdjustScrollBars(); | ||
} | ||
|
||
void CEditWnd::Views_DisableSelectArea(bool bRedraw) | ||
|
@@ -4581,8 +4576,8 @@ BOOL CEditWnd::UpdateTextWrap( void ) | |
for( int i = 0; i < GetAllViewCount(); i++ ){ | ||
::UpdateWindow( GetView(i).GetHwnd() ); | ||
} | ||
if( GetMiniMap().GetHwnd() ){ | ||
::UpdateWindow( GetMiniMap().GetHwnd() ); | ||
if( m_cMiniMapView.GetHwnd() ){ | ||
::UpdateWindow( m_cMiniMapView.GetHwnd() ); | ||
} | ||
} | ||
return bWrap; // 画面更新=折り返し変更 | ||
|
@@ -4629,9 +4624,9 @@ void CEditWnd::ChangeLayoutParam( bool bShowProgress, CKetaXInt nTabSize, int nT | |
GetView(i).AdjustScrollBars(); // 2008.06.18 ryoji | ||
} | ||
} | ||
if( GetMiniMap().GetHwnd() ){ | ||
InvalidateRect( GetMiniMap().GetHwnd(), NULL, TRUE ); | ||
GetMiniMap().AdjustScrollBars(); | ||
if( m_cMiniMapView.GetHwnd() ){ | ||
InvalidateRect( m_cMiniMapView.GetHwnd(), NULL, TRUE ); | ||
m_cMiniMapView.AdjustScrollBars(); | ||
} | ||
GetActiveView().GetCaret().ShowCaretPosInfo(); // 2009.07.25 ryoji | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻