@@ -21,13 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21
21
#include " ViewLines.h"
22
22
23
23
#pragma warning (disable : 4355)
24
- CEditorView::CEditorView (int id):CComDispatch(),m_IndPanel(this ), SCIView((((id-1 )==0)? nppData._scintillaMainHandle : nppData._scintillaSecondHandle)){
24
+ CEditorView::CEditorView (int id):CComDispatch(),m_IndPanel(* this ), SCIView((((id-1 )==0)? nppData._scintillaMainHandle : nppData._scintillaSecondHandle)){
25
25
m_Id = id;
26
26
27
27
m_Listener = NULL ;
28
28
}
29
29
30
-
31
30
LRESULT CEditorView::getBufferId (){
32
31
int curDoc =(int ) NPPM (GETCURRENTDOCINDEX, 0 , m_Id-1 );
33
32
return NPPM (GETBUFFERIDFROMPOS, curDoc, m_Id-1 );
@@ -88,47 +87,32 @@ int CEditorView::bytePosToPos(int pos){
88
87
return result;
89
88
}
90
89
91
- void CEditorView::setIndicatorLinesUpdater (int begin, int end){
92
-
93
- ForegroundIdleHook::IdleHandler* indicatorPixelsUpdater = &m_IndPanel.m_IndicPixelsUp ;
94
-
95
- if (indicatorPixelsUpdater != NULL )
96
- ForegroundIdleHook::getInstance ()->remove (indicatorPixelsUpdater);
97
-
98
- if (m_IndPanel.m_IndicLinesUp .m_Begin > begin || (m_IndPanel.m_IndicLinesUp .m_End == 0 /* first time */ ))
99
- m_IndPanel.m_IndicLinesUp .m_Begin = begin;
100
-
101
- if (m_IndPanel.m_IndicLinesUp .m_End != -1 && (end == -1 || m_IndPanel.m_IndicLinesUp .m_End < end))
102
- m_IndPanel.m_IndicLinesUp .m_End = end;
103
-
104
- ForegroundIdleHook::getInstance ()->add (&m_IndPanel.m_IndicLinesUp );
105
- }
106
-
107
90
void CEditorView::DoMessage (SCNotification* eventArgs){
108
91
switch (eventArgs->nmhdr .code ){
109
92
case SCN_MODIFIED:
110
93
if (eventArgs->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)){
111
94
if (eventArgs->linesAdded != 0 ) // changes in more than one line
112
- setIndicatorLinesUpdater (eventArgs->position ,-1 ); // from position to bottom
95
+ m_IndPanel. updateLines (eventArgs->position ,-1 ); // from position to bottom
113
96
else // changes in the single line, update only necessary positions
114
- setIndicatorLinesUpdater (eventArgs->position , eventArgs->position + eventArgs->length );
97
+ m_IndPanel. updateLines (eventArgs->position , eventArgs->position + eventArgs->length );
115
98
} else if (eventArgs->modificationType & ( SC_MOD_CHANGEINDICATOR)){
116
99
// update only necessary positions
117
- setIndicatorLinesUpdater (eventArgs-> position , eventArgs-> position + eventArgs-> length );
100
+ m_IndPanel. updateLines (- 1 , - 1 );
118
101
}
102
+
119
103
break ;
120
104
case NPPN_BUFFERACTIVATED:
121
105
// update all lines
122
- setIndicatorLinesUpdater (-1 ,-1 );
106
+ m_IndPanel. updateLines (-1 ,-1 );
123
107
break ;
124
108
case SCN_ZOOM:{
125
109
// update only pixels
126
- ForegroundIdleHook::getInstance ()-> add (& m_IndPanel.m_IndicPixelsUp );
110
+ m_IndPanel.updatePixels ( );
127
111
break ;
128
112
}
129
113
case SCN_MARGINCLICK:
130
- if (eventArgs->margin == 2 ){ // click above fold symbol
131
- setIndicatorLinesUpdater (-1 ,-1 );
114
+ if (eventArgs->margin == SC_MARGIN_FORE ){ // click on fold symbol
115
+ m_IndPanel. updateLines (-1 ,-1 );
132
116
}
133
117
break ;
134
118
}
0 commit comments