aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarko Njezic <devnull@localhost>2012-02-25 00:02:40 +0100
committerMarko Njezic <devnull@localhost>2012-02-25 00:02:40 +0100
commitc8ef39998a48b5e6d19eb74026b25432814d4ee3 (patch)
tree35ed2b2e95b00e25d298564cbbe13ddadde3861e
parent054af99d9aae10ae2222c76557e8554dafff60a5 (diff)
downloadscintilla-mirror-c8ef39998a48b5e6d19eb74026b25432814d4ee3.tar.gz
Bug #3493503. Properly redraw image markers with height larger than line height.
Regression from change set 3949.
-rw-r--r--src/Editor.cxx18
-rw-r--r--src/ViewStyle.cxx20
-rw-r--r--src/ViewStyle.h2
3 files changed, 39 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index a6212ab1f..50d4962fb 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -639,6 +639,18 @@ void Editor::RedrawSelMargin(int line, bool allAfter) {
if (line != -1) {
int position = pdoc->LineStart(line);
PRectangle rcLine = RectangleFromRange(position, position);
+
+ // Inflate line rectangle if there are image markers with height larger than line height
+ if (vs.largestMarkerHeight > vs.lineHeight) {
+ int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2;
+ rcLine.top -= delta;
+ rcLine.bottom += delta;
+ if (rcLine.top < rcSelMargin.top)
+ rcLine.top = rcSelMargin.top;
+ if (rcLine.bottom > rcSelMargin.bottom)
+ rcLine.bottom = rcSelMargin.bottom;
+ }
+
rcSelMargin.top = rcLine.top;
if (!allAfter)
rcSelMargin.bottom = rcLine.bottom;
@@ -8040,8 +8052,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
// Marker definition and setting
case SCI_MARKERDEFINE:
- if (wParam <= MARKER_MAX)
+ if (wParam <= MARKER_MAX) {
vs.markers[wParam].markType = lParam;
+ vs.CalcLargestMarkerHeight();
+ }
InvalidateStyleData();
RedrawSelMargin();
break;
@@ -8112,6 +8126,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_MARKERDEFINEPIXMAP:
if (wParam <= MARKER_MAX) {
vs.markers[wParam].SetXPM(CharPtrFromSPtr(lParam));
+ vs.CalcLargestMarkerHeight();
};
InvalidateStyleData();
RedrawSelMargin();
@@ -8128,6 +8143,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
case SCI_MARKERDEFINERGBAIMAGE:
if (wParam <= MARKER_MAX) {
vs.markers[wParam].SetRGBAImage(sizeRGBAImage, reinterpret_cast<unsigned char *>(lParam));
+ vs.CalcLargestMarkerHeight();
};
InvalidateStyleData();
RedrawSelMargin();
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index ab3c68907..b8be22646 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -145,6 +145,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
for (int mrk=0; mrk<=MARKER_MAX; mrk++) {
markers[mrk] = source.markers[mrk];
}
+ CalcLargestMarkerHeight();
for (int ind=0; ind<=INDIC_MAX; ind++) {
indicators[ind] = source.indicators[ind];
}
@@ -230,6 +231,9 @@ void ViewStyle::Init(size_t stylesSize_) {
fontNames.Clear();
ResetDefaultStyle();
+ // There are no image markers by default, so no need for calling CalcLargestMarkerHeight()
+ largestMarkerHeight = 0;
+
indicators[0].style = INDIC_SQUIGGLE;
indicators[0].under = false;
indicators[0].fore = ColourDesired(0, 0x7f, 0);
@@ -457,3 +461,19 @@ bool ViewStyle::ValidStyle(size_t styleIndex) const {
return styleIndex < stylesSize;
}
+void ViewStyle::CalcLargestMarkerHeight() {
+ largestMarkerHeight = 0;
+ for (int m = 0; m <= MARKER_MAX; ++m) {
+ switch (markers[m].markType) {
+ case SC_MARK_PIXMAP:
+ if (markers[m].pxpm->GetHeight() > largestMarkerHeight)
+ largestMarkerHeight = markers[m].pxpm->GetHeight();
+ break;
+ case SC_MARK_RGBAIMAGE:
+ if (markers[m].image->GetHeight() > largestMarkerHeight)
+ largestMarkerHeight = markers[m].image->GetHeight();
+ break;
+ }
+ }
+}
+
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 3803a6cb2..ef8d98e0c 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -66,6 +66,7 @@ public:
size_t stylesSize;
Style *styles;
LineMarker markers[MARKER_MAX + 1];
+ int largestMarkerHeight;
Indicator indicators[INDIC_MAX + 1];
int technology;
int lineHeight;
@@ -148,6 +149,7 @@ public:
void SetStyleFontName(int styleIndex, const char *name);
bool ProtectionActive() const;
bool ValidStyle(size_t styleIndex) const;
+ void CalcLargestMarkerHeight();
};
#ifdef SCI_NAMESPACE