Skip to content

Commit 38209b7

Browse files
committed
prepare for Crop to selection feature
some non-functional changes
1 parent 85853ef commit 38209b7

File tree

11 files changed

+43
-31
lines changed

11 files changed

+43
-31
lines changed

DebugView++/DebugView++.rc

-24.4 KB
Binary file not shown.

DebugView++/LogView.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,15 +1003,9 @@ LRESULT CLogView::OnBeginDrag(NMHDR* pnmh)
10031003
return 0;
10041004
}
10051005

1006-
void CLogView::ClearView()
1007-
{
1008-
m_firstLine = m_logFile.Count();
1009-
Clear();
1010-
}
1011-
10121006
void CLogView::OnViewClear(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/)
10131007
{
1014-
ClearView();
1008+
Clear();
10151009
}
10161010

10171011
void CLogView::OnViewReset(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/)
@@ -1302,6 +1296,7 @@ void CLogView::SetAutoScrollStop(bool enable)
13021296

13031297
void CLogView::Clear()
13041298
{
1299+
m_firstLine = m_logFile.Count();
13051300
SetItemCount(0);
13061301
m_dirty = false;
13071302
m_logLines.clear();
@@ -1330,7 +1325,7 @@ void CLogView::SetFocusLine(int line)
13301325
void CLogView::Add(int beginIndex, int line, const Message& msg)
13311326
{
13321327
if (IsClearMessage(msg))
1333-
ClearView();
1328+
Clear();
13341329

13351330
if (!IsIncluded(msg))
13361331
return;

DebugView++/LogView.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ class CLogView :
236236

237237
std::vector<std::string> GetSelectedMessages() const;
238238
void ResetToLine(int line);
239-
void ClearView();
240239
void UpdateColumnInfo();
241240
void UpdateColumns();
242241
int ColumnToSubItem(Column::type column) const;

DebugView++/MainFrame.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ BEGIN_MSG_MAP2(CMainFrame)
184184
COMMAND_ID_HANDLER_EX(ID_FILE_LOAD_CONFIGURATION, OnFileLoadConfiguration)
185185
COMMAND_ID_HANDLER_EX(ID_FILE_SAVE_CONFIGURATION, OnFileSaveConfiguration)
186186
COMMAND_ID_HANDLER_EX(ID_LOG_CLEAR, OnLogClear)
187+
COMMAND_ID_HANDLER_EX(ID_LOG_CROP, OnLogCrop)
187188
COMMAND_ID_HANDLER_EX(ID_LOG_PAUSE, OnLogPause)
188189
COMMAND_ID_HANDLER_EX(ID_LOG_GLOBAL, OnLogGlobal)
189190
COMMAND_ID_HANDLER_EX(ID_LOG_HISTORY, OnLogHistory)
@@ -1031,8 +1032,6 @@ void CMainFrame::OnFileRun(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/
10311032
void CMainFrame::Load(const std::wstring& filename, bool keeptailing)
10321033
{
10331034
SetTitle(filename);
1034-
if (!IsPaused())
1035-
Pause();
10361035
ClearLog();
10371036
m_logSources.AddAnyFileReader(WStr(std::experimental::filesystem::path(filename).filename().string()), keeptailing);
10381037
}
@@ -1054,8 +1053,6 @@ void CMainFrame::Load(std::istream& file, const std::string& name, FILETIME file
10541053
{
10551054
Win32::ScopedCursor cursor(::LoadCursor(nullptr, IDC_WAIT));
10561055

1057-
if (!IsPaused())
1058-
Pause();
10591056
ClearLog();
10601057

10611058
Line line;
@@ -1131,9 +1128,8 @@ void CMainFrame::OnFileSaveConfiguration(UINT /*uNotifyCode*/, int /*nID*/, CWin
11311128

11321129
void CMainFrame::ClearLog()
11331130
{
1134-
// First Clear LogFile so views reset their m_firstLine:
11351131
m_logFile.Clear();
1136-
m_logSources.Reset();
1132+
m_logSources.ResetTimer();
11371133
int views = GetViewCount();
11381134
for (int i = 0; i < views; ++i)
11391135
{
@@ -1150,6 +1146,26 @@ void CMainFrame::OnLogClear(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*
11501146
ClearLog();
11511147
}
11521148

1149+
void CMainFrame::OnLogCrop(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/)
1150+
{
1151+
auto selection = GetView().GetSelectedRange();
1152+
if (selection.count < 2) return;
1153+
1154+
//LogFile temp = m_logFile.Copy(selection.beginLine, selection.endLine);
1155+
//m_logFile.Swap(temp);
1156+
//
1157+
//m_logSources.ResetTimer();
1158+
//int views = GetViewCount();
1159+
//for (int i = 0; i < views; ++i)
1160+
//{
1161+
// GetView(i).Clear();
1162+
// SetModifiedMark(i, false);
1163+
// GetTabCtrl().UpdateLayout();
1164+
// GetTabCtrl().Invalidate();
1165+
//}
1166+
//UpdateStatusBar();
1167+
}
1168+
11531169
void CMainFrame::OnLinkViews(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/)
11541170
{
11551171
m_linkViews = !m_linkViews;

DebugView++/MainFrame.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class CMainFrame : public CTabbedFrameImpl<CMainFrame, CDotNetTabCtrl<SelectedTa
198198
void OnHide(UINT uNotifyCode, int nID, CWindow wndCtl);
199199
void OnAlwaysOnTop(UINT uNotifyCode, int nID, CWindow wndCtl);
200200
void OnLogClear(UINT uNotifyCode, int nID, CWindow wndCtl);
201+
void OnLogCrop(UINT uNotifyCode, int nID, CWindow wndCtl);
201202
void OnLogPause(UINT uNotifyCode, int nID, CWindow wndCtl);
202203
void OnLogGlobal(UINT uNotifyCode, int nID, CWindow wndCtl);
203204
void OnLogHistory(UINT uNotifyCode, int nID, CWindow wndCtl);

DebugView++/resource.h

-5.66 KB
Binary file not shown.

DebugView++Lib/LogFile.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ void LogFile::Clear()
3838
{
3939
m_messages.clear();
4040
m_messages.shrink_to_fit();
41-
m_storage.Clear();
42-
m_storage.shrink_to_fit();
43-
m_processInfo.Clear();
41+
m_storage.Clear();
42+
m_storage.shrink_to_fit();
43+
m_processInfo.Clear();
4444
}
4545

4646
void LogFile::Add(const Message& msg)

DebugView++Lib/LogSources.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void LogSources::Abort()
128128
m_listenThread.Synchronize();
129129
}
130130

131-
void LogSources::Reset()
131+
void LogSources::ResetTimer()
132132
{
133133
m_timer.Reset();
134134
}

IndexedStorageLib/IndexedStorage.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013.
22
// Distributed under the Boost Software License, Version 1.0.
3-
// (See accompanying file LICENSE_1_0.txt or copy at
3+
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

66
// Repository at: https://github.com/djeedjay/DebugViewPP/
@@ -12,7 +12,7 @@
1212

1313
namespace fusion {
1414
namespace indexedstorage {
15-
15+
1616
const int blockSize = 400;
1717

1818
bool VectorStorage::Empty() const
@@ -106,7 +106,7 @@ std::string SnappyStorage::GetString(size_t index)
106106
{
107107
auto blockId = GetBlockIndex(index);
108108
auto id = GetRelativeIndex(index);
109-
109+
110110
if (blockId == m_writeBlockIndex)
111111
{
112112
return m_writeList[id];
@@ -155,10 +155,10 @@ std::vector<std::string> SnappyStorage::Decompress(const std::string& value)
155155

156156
void SnappyStorage::shrink_to_fit()
157157
{
158-
m_readList.shrink_to_fit();
159-
m_writeList.shrink_to_fit();
160-
m_storage.shrink_to_fit();
158+
m_readList.shrink_to_fit();
159+
m_writeList.shrink_to_fit();
160+
m_storage.shrink_to_fit();
161161
}
162162

163-
} // namespace indexedstorage
163+
} // namespace indexedstorage
164164
} // namespace fusion

include/DebugView++Lib/LogSources.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class LogSources
6363
void SetAutoNewLine(bool value);
6464
bool GetAutoNewLine() const;
6565

66-
void Reset();
66+
void ResetTimer();
6767
void Listen();
6868
void ListenUntilUpdateEvent();
6969
void Abort();

0 commit comments

Comments
 (0)