Discussion:
Digest for scintilla-interest@googlegroups.com - 4 Messages in 2 Topics
Mueller, Joe
2013-10-10 06:05:51 UTC
Permalink
Thanks for your reply Neil. Having to explicitly set the scroll width for annotations kind of defeats the purpose of turning on scroll width tracking.

I think the following modification to the 3.3.0 version of Editor.cxx solves the problem, if you agree, could you incorporate that into your next release?
2775a2776
rcSegment.left = xStart;
2778c2779
< if (vs.annotationVisible == ANNOTATION_BOXED) {
---
if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
2782,2785c2783,2788
< rcSegment.left = xStart + indent;
< rcSegment.right = rcSegment.left + widthAnnotation;
< } else {
< rcSegment.left = xStart;
---
if (widthAnnotation > lineWidthMaxSeen)
lineWidthMaxSeen = widthAnnotation;
if ((vs.annotationVisible == ANNOTATION_BOXED)) {
rcSegment.left = xStart + indent;
rcSegment.right = rcSegment.left + widthAnnotation;
}
Or if the diff input is difficult to use, here's the relevant piece of code:
void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
int indent = pdoc->GetLineIndentation(line) * vsDraw.spaceWidth;
PRectangle rcSegment = rcLine;
int annotationLine = subLine - ll->lines;
const StyledText stAnnotation = pdoc->AnnotationStyledText(line);
rcSegment.left = xStart;
if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) {
surface->FillRectangle(rcSegment, vsDraw.styles[0].back);
if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
// Only care about calculating width if need to draw box
int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);
widthAnnotation += vsDraw.spaceWidth * 2; // Margins
if (widthAnnotation > lineWidthMaxSeen)
lineWidthMaxSeen = widthAnnotation;
if ((vs.annotationVisible == ANNOTATION_BOXED)) {
rcSegment.left = xStart + indent;
rcSegment.right = rcSegment.left + widthAnnotation;
}
}
From: scintilla-***@googlegroups.com [mailto:scintilla-***@googlegroups.com]
Sent: Wednesday, October 09, 2013 5:58 PM
To: Digest Recipients
Subject: [scintilla] Digest for scintilla-***@googlegroups.com - 4 Messages in 2 Topics

Today's Topic Summary

Group: http://groups.google.com/group/scintilla-interest/topics
§ SCI_SETSCROLLWIDTHTRACKING and annotation lines [2 Updates]
§ Questions on colourising the background [2 Updates]
SCI_SETSCROLLWIDTHTRACKING and annotation lines<http://groups.google.com/group/scintilla-interest/t/6cf0ce5b10f56ce5>
"Mueller, Joe" <***@mentor.com<mailto:***@mentor.com>> Oct 09 11:08PM

I'm having trouble where I have set SCI_SETSCROLLWIDTHTRACKING on, but when adding an annotation line that's larger than the text in the document, the horizontal scroll bar width isn't expanded to allow viewing of the entire annotation line. Is this a known problem?

Joe
I'm having trouble where I have set SCI_SETSCROLLWIDTHTRACKING on, but when adding an annotation line that's larger than the text in the document, the horizontal scroll bar width isn't expanded to allow viewing of the entire annotation line. Is this a known problem?
Its not something that was taken into account when implementing annotations. Applications can increase the scroll width when setting an annotation if they want.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Mueller, Joe
2013-10-10 16:27:58 UTC
Permalink
Testing showed that I needed to leave the margin width out of the computation of the scrollbar width, the following gives a better result:
2775a2776
rcSegment.left = xStart;
2778c2779
< if (vs.annotationVisible == ANNOTATION_BOXED) {
---
if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
2780a2782,2783
if (widthAnnotation > lineWidthMaxSeen)
lineWidthMaxSeen = widthAnnotation;
2782,2785c2785,2788
< rcSegment.left = xStart + indent;
< rcSegment.right = rcSegment.left + widthAnnotation;
< } else {
< rcSegment.left = xStart;
---
if ((vs.annotationVisible == ANNOTATION_BOXED)) {
rcSegment.left = xStart + indent;
rcSegment.right = rcSegment.left + widthAnnotation;
}
Or if the diff cannot be consumed:
void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
int indent = pdoc->GetLineIndentation(line) * vsDraw.spaceWidth;
PRectangle rcSegment = rcLine;
int annotationLine = subLine - ll->lines;
const StyledText stAnnotation = pdoc->AnnotationStyledText(line);
rcSegment.left = xStart;
if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) {
surface->FillRectangle(rcSegment, vsDraw.styles[0].back);
if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
// Only care about calculating width if need to draw box
int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);
if (widthAnnotation > lineWidthMaxSeen)
lineWidthMaxSeen = widthAnnotation;
widthAnnotation += vsDraw.spaceWidth * 2; // Margins
if ((vs.annotationVisible == ANNOTATION_BOXED)) {
rcSegment.left = xStart + indent;
rcSegment.right = rcSegment.left + widthAnnotation;
}
}

Joe

From: Mueller, Joe
Sent: Wednesday, October 09, 2013 11:06 PM
To: 'scintilla-***@googlegroups.com'
Subject: RE: [scintilla] Digest for scintilla-***@googlegroups.com - 4 Messages in 2 Topics

Thanks for your reply Neil. Having to explicitly set the scroll width for annotations kind of defeats the purpose of turning on scroll width tracking.

I think the following modification to the 3.3.0 version of Editor.cxx solves the problem, if you agree, could you incorporate that into your next release?
2775a2776
rcSegment.left = xStart;
2778c2779
< if (vs.annotationVisible == ANNOTATION_BOXED) {
---
if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
2782,2785c2783,2788
< rcSegment.left = xStart + indent;
< rcSegment.right = rcSegment.left + widthAnnotation;
< } else {
< rcSegment.left = xStart;
---
if (widthAnnotation > lineWidthMaxSeen)
lineWidthMaxSeen = widthAnnotation;
if ((vs.annotationVisible == ANNOTATION_BOXED)) {
rcSegment.left = xStart + indent;
rcSegment.right = rcSegment.left + widthAnnotation;
}
Or if the diff input is difficult to use, here's the relevant piece of code:
void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine) {
int indent = pdoc->GetLineIndentation(line) * vsDraw.spaceWidth;
PRectangle rcSegment = rcLine;
int annotationLine = subLine - ll->lines;
const StyledText stAnnotation = pdoc->AnnotationStyledText(line);
rcSegment.left = xStart;
if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) {
surface->FillRectangle(rcSegment, vsDraw.styles[0].back);
if (trackLineWidth || (vs.annotationVisible == ANNOTATION_BOXED)) {
// Only care about calculating width if need to draw box
int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);
widthAnnotation += vsDraw.spaceWidth * 2; // Margins
if (widthAnnotation > lineWidthMaxSeen)
lineWidthMaxSeen = widthAnnotation;
if ((vs.annotationVisible == ANNOTATION_BOXED)) {
rcSegment.left = xStart + indent;
rcSegment.right = rcSegment.left + widthAnnotation;
}
}
From: scintilla-***@googlegroups.com<mailto:scintilla-***@googlegroups.com> [mailto:scintilla-***@googlegroups.com]
Sent: Wednesday, October 09, 2013 5:58 PM
To: Digest Recipients
Subject: [scintilla] Digest for scintilla-***@googlegroups.com<mailto:scintilla-***@googlegroups.com> - 4 Messages in 2 Topics

Today's Topic Summary

Group: http://groups.google.com/group/scintilla-interest/topics
§ SCI_SETSCROLLWIDTHTRACKING and annotation lines [2 Updates]
§ Questions on colourising the background [2 Updates]
SCI_SETSCROLLWIDTHTRACKING and annotation lines<http://groups.google.com/group/scintilla-interest/t/6cf0ce5b10f56ce5>
"Mueller, Joe" <***@mentor.com<mailto:***@mentor.com>> Oct 09 11:08PM

I'm having trouble where I have set SCI_SETSCROLLWIDTHTRACKING on, but when adding an annotation line that's larger than the text in the document, the horizontal scroll bar width isn't expanded to allow viewing of the entire annotation line. Is this a known problem?

Joe
I'm having trouble where I have set SCI_SETSCROLLWIDTHTRACKING on, but when adding an annotation line that's larger than the text in the document, the horizontal scroll bar width isn't expanded to allow viewing of the entire annotation line. Is this a known problem?
Its not something that was taken into account when implementing annotations. Applications can increase the scroll width when setting an annotation if they want.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2013-10-10 23:01:24 UTC
Permalink
I'll look at this after 3.3.6 is released.
Post by Mueller, Joe
2775a2776
rcSegment.left = xStart;
That looks like it may stop drawing some background in the following FillRectangle call. It would be easier to review if the patch avoided side effects apart from lineWidthMaxSeen.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...