Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
LedLineItView.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef __LedLineItView_h__
5#define __LedLineItView_h__ 1
6
7#include "Stroika/Frameworks/StroikaPreComp.h"
8
9#include "Stroika/Frameworks/Led/Platform/MFC.h"
10#include "Stroika/Frameworks/Led/SimpleTextInteractor.h"
11#include "Stroika/Frameworks/Led/SyntaxColoring.h"
12
13#include "LedLineItConfig.h"
14
15#include "Resource.h"
16
17using namespace Stroika::Foundation;
18using namespace Stroika::Frameworks::Led;
19using namespace Stroika::Frameworks::Led::Platform;
20
21DISABLE_COMPILER_MSC_WARNING_START (4250) // inherits via dominance warning
22
23#if qSupportSyntaxColoring
24struct LedLineItMFCBaseClass : public Led_MFC_X<SimpleTextInteractor>, public StyledTextImager {
25protected:
26 virtual DistanceType MeasureSegmentHeight (size_t from, size_t to) const override
27 {
28 return Led_MFC_X<SimpleTextInteractor>::MeasureSegmentHeight (from, to);
29 }
30 virtual DistanceType MeasureSegmentBaseLine (size_t from, size_t to) const override
31 {
32 return Led_MFC_X<SimpleTextInteractor>::MeasureSegmentBaseLine (from, to);
33 }
34};
35#else
36struct LedLineItMFCBaseClass : public Led_MFC_X<SimpleTextInteractor> {};
37#endif
38
39class LedLineItDocument;
40
41class LedLineItView : public LedLineItMFCBaseClass {
42private:
43 using inherited = LedLineItMFCBaseClass;
44
45protected: // create from serialization only
46 LedLineItView ();
47 DECLARE_DYNCREATE (LedLineItView)
48
49public:
50 virtual ~LedLineItView ();
51
52protected:
53 virtual void OnInitialUpdate () override;
54
55#if qSupportSyntaxColoring
56public:
57 nonvirtual void ResetSyntaxColoringTable ();
58
59protected:
60 virtual void HookLosingTextStore () override;
61 virtual void HookGainedNewTextStore () override;
62#endif
63
64#if qSupportSyntaxColoring
65protected:
66 virtual vector<StyleRunElement> SummarizeStyleMarkers (size_t from, size_t to) const override;
67 virtual vector<StyleRunElement> SummarizeStyleMarkers (size_t from, size_t to, const TextLayoutBlock& text) const override;
68#endif
69
70public:
71 nonvirtual size_t GetCurUserLine () const;
72 nonvirtual void SetCurUserLine (size_t newCurLine); // OK if bad line given
73
74public:
75 virtual void UpdateScrollBars () override;
76
77public:
78 virtual DistanceType ComputeMaxHScrollPos () const override;
79
80private:
81 mutable DistanceType fCachedLayoutWidth;
82
83public:
84 virtual void OnTypedNormalCharacter (Led_tChar theChar, bool optionPressed, bool shiftPressed, bool commandPressed, bool controlPressed,
85 bool altKeyPressed) override;
86
87protected:
88 virtual const TabStopList& GetTabStopList (size_t /*containingPos*/) const override;
89
90protected:
91 virtual void TabletChangedMetrics () override;
92
93private:
94 SimpleTabStopList fTabStopList;
95
96public:
97 virtual void DidUpdateText (const UpdateInfo& updateInfo) noexcept override;
98
99public:
100 nonvirtual LedLineItDocument& GetDocument () const;
101
102public:
103 afx_msg void OnContextMenu (CWnd* /*pWnd*/, CPoint /*point*/);
104
105protected:
106 virtual BOOL IsSelected (const CObject* pDocItem) const override; // support for CView/OLE
107
108public:
109 afx_msg void OnUpdateFontNameChangeCommand (CCmdUI* pCmdUI);
110 afx_msg void OnFontNameChangeCommand (UINT cmdNum);
111
112private:
113 DistanceType PickOtherFontHeight (DistanceType origHeight);
114
115public:
116 afx_msg void OnUpdateFontSizeChangeCommand (CCmdUI* pCmdUI);
117 afx_msg void OnFontSizeChangeCommand (UINT cmdNum);
118
119public:
120 afx_msg void OnGotoLineCommand ();
121 afx_msg void OnShiftLeftCommand ();
122 afx_msg void OnShiftRightCommand ();
123 nonvirtual void OnShiftNCommand (bool shiftRight);
124
125#if qSupportGenRandomCombosCommand
126public:
127 afx_msg void OnGenRandomCombosCommand ();
128#endif
129
130protected:
131 virtual SearchParameters GetSearchParameters () const override;
132 virtual void SetSearchParameters (const SearchParameters& sp) override;
133
134protected:
135 afx_msg void OnSetFocus (CWnd* pOldWnd);
136 afx_msg void OnCancelEditCntr ();
137 afx_msg void OnCancelEditSrvr ();
138 afx_msg void OnSelectAllCommand ();
139 afx_msg void OnChooseFontCommand ();
140 DECLARE_MESSAGE_MAP ()
141
142#if qSupportSyntaxColoring
143private:
144#if qSupportOnlyMarkersWhichOverlapVisibleRegion
145 WindowedSyntaxColoringMarkerOwner* fSyntaxColoringMarkerOwner;
146#else
147 SimpleSyntaxColoringMarkerOwner* fSyntaxColoringMarkerOwner;
148#endif
149#endif
150
151#ifdef _DEBUG
152public:
153 virtual void AssertValid () const override;
154 virtual void Dump (CDumpContext& dc) const override;
155#endif
156};
157DISABLE_COMPILER_MSC_WARNING_END (4250) // inherits via dominance warning
158
159class FontDlgWithNoColorNoStyles : public CFontDialog {
160public:
161 FontDlgWithNoColorNoStyles (LOGFONT* lf);
162 virtual BOOL OnInitDialog () override;
163};
164
165/*
166 ********************************************************************************
167 ***************************** Implementation Details ***************************
168 ********************************************************************************
169 */
170#if !qStroika_Foundation_Debug_AssertionsChecked
171inline LedLineItDocument& LedLineItView::GetDocument () const
172{
173 return *(LedLineItDocument*)m_pDocument;
174}
175#endif
176
177#endif /*__LedLineItView_h__*/