forked from CobaltFusion/DebugViewPP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CLogViewTabItem2.h
109 lines (84 loc) · 2.45 KB
/
CLogViewTabItem2.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// (C) Copyright Gert-Jan de Vos and Jan Wilmans 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Repository at: https://github.com/djeedjay/DebugViewPP/
#pragma once
#include <memory>
#include "atlgdix.h"
#include "atlcoll.h"
namespace WTL {
using ATL::CString;
}
#include <atlcom.h>
#pragma warning(push, 3)
#pragma warning(disable : 4838)
#include "CustomTabCtrl.h"
#include "DotNetTabCtrl.h"
#include "TabbedFrame.h"
#pragma warning(pop)
#include "DebugView++Lib/CTimelineView.h"
namespace fusion {
namespace debugviewpp {
class CLogView;
class CLogViewTabItem : public CTabViewTabItem
{
public:
void SetView(std::shared_ptr<CLogView> pView);
CLogView& GetView();
void Create(HWND parent) { m_parent = parent; }
HWND GetLogViewParent() { return m_parent; }
private:
std::shared_ptr<CLogView> m_pView;
HWND m_parent = HWND();
};
class CMyPaneContainer : public CPaneContainerImpl<CMyPaneContainer>
{
public:
DECLARE_WND_CLASS_EX(_T("MY_PaneContainer"), 0, -1)
BEGIN_MSG_MAP(CMyPaneContainerImpl)
REFLECT_NOTIFICATIONS()
CHAIN_MSG_MAP(CPaneContainerImpl<CMyPaneContainer>)
END_MSG_MAP()
};
using TimePoint = std::chrono::steady_clock::time_point;
using Duration = std::chrono::steady_clock::duration;
class ViewPort
{
public:
ViewPort() = default;
ViewPort(TimePoint begin, TimePoint end, Duration timeUnitPerPixel);
bool Contains(TimePoint p) const;
gdi::Pixel ToPx(TimePoint p) const;
Duration ToDuration(gdi::Pixel p) const;
TimePoint ToTimePoint(gdi::Pixel p) const;
std::wstring FormatAsTime(gdi::Pixel p);
void ZoomInTo(gdi::Pixel position);
void ZoomOut(gdi::Pixel position);
private:
// time range
TimePoint m_begin;
TimePoint m_end;
// conversion factor
Duration m_timeunitPerPixelBase;
Duration m_timeunitPerPixel;
int m_zoomFactor = 1000;
};
class CLogViewTabItem2 : public CTabViewTabItem
{
public:
~CLogViewTabItem2() override;
void SetView(std::shared_ptr<CLogView> pView);
CLogView& GetView();
void Create(HWND parent);
HWND GetLogViewParent() { return m_top; }
private:
std::shared_ptr<CLogView> m_pView;
CHorSplitterWindow m_split;
CMyPaneContainer m_top;
CMyPaneContainer m_bottom;
gdi::CTimelineView m_timelineView;
ViewPort m_viewPort;
};
} // namespace debugviewpp
} // namespace fusion