diff --git a/uppsrc/RichEdit/ColumnPopUp.cpp b/uppsrc/RichEdit/ColumnPopUp.cpp index 12ac3f644..abfe9a451 100644 --- a/uppsrc/RichEdit/ColumnPopUp.cpp +++ b/uppsrc/RichEdit/ColumnPopUp.cpp @@ -5,7 +5,6 @@ namespace Upp { ColumnPopUp::ColumnPopUp() { SetFrame(BlackFrame()); - WhenSelect = [=](int i) { code = i; }; } void ColumnPopUp::Paint(Draw& w) @@ -62,11 +61,10 @@ void ColumnPopUp::PopUp(Point p, Ctrl *owner) int ColumnPopUp::Execute() { PopUp(GetMousePos(), GetActiveCtrl()); - code = -1; EventLoop(this); if(IsOpen()) Close(); - return code; + return cursor; } diff --git a/uppsrc/RichEdit/DiagramEditor.h b/uppsrc/RichEdit/DiagramEditor.h index b9ea06c58..c8010e102 100644 --- a/uppsrc/RichEdit/DiagramEditor.h +++ b/uppsrc/RichEdit/DiagramEditor.h @@ -17,7 +17,6 @@ struct ColumnPopUp : Ctrl { Size isz = Size(64, 32); int count = 18; int cursor = -1; - int code = -1; void Paint(Draw& w) override; void MouseMove(Point p, dword keyflags) override; diff --git a/uppsrc/RichEdit/DiagramMouse.cpp b/uppsrc/RichEdit/DiagramMouse.cpp index ec83ffbff..010c14725 100644 --- a/uppsrc/RichEdit/DiagramMouse.cpp +++ b/uppsrc/RichEdit/DiagramMouse.cpp @@ -112,10 +112,6 @@ void DiagramEditor::LeftDown(Point p, dword keyflags) } } - if((keyflags & K_CTRL) == 0) { - sel.Clear(); - cursor = -1; - } int i = FindItem(p); if(i >= 0) { SetCursor(i); @@ -129,6 +125,7 @@ void DiagramEditor::LeftDown(Point p, dword keyflags) } else { sel.Clear(); + SetCursor(-1); doselection = true; } @@ -178,6 +175,7 @@ void DiagramEditor::MouseMove(Point p, dword keyflags) } m.FixPosition(); Sync(); + return; } } @@ -188,9 +186,15 @@ void DiagramEditor::LeftUp(Point p, dword keyflags) Sync(); doselection = false; Commit(); - if(Distance(dragstart, p) < 2 && CursorItem().IsTextClick(p)) { - StartText(); - return; + if(Distance(dragstart, p) < 2) { + if((keyflags & K_CTRL) == 0) { + sel.Clear(); + SetCursor(cursor); + } + if(CursorItem().IsTextClick(p)) { + StartText(); + return; + } } } diff --git a/uppsrc/RichText/Diagram.cpp b/uppsrc/RichText/Diagram.cpp index 273dcf74b..b45709d52 100644 --- a/uppsrc/RichText/Diagram.cpp +++ b/uppsrc/RichText/Diagram.cpp @@ -162,21 +162,22 @@ void DiagramItem::Paint(Painter& w, dword style) const Pointf a2 = p2; if(d > 20) { // enough length to have caps if(line_start == CAP_ARROW) - a1 += v * 8; + a1 += v * 4 * width; if(line_end == CAP_ARROW) - a2 -= v * 8; + a2 -= v * 4 * width; } w.Move(a1).Line(a2); DoDash(); - w.Stroke(width, ink); + w.LineCap(LINECAP_ROUND).Stroke(width, ink); Pointf o = Orthogonal(v); if(d > 20) { auto PaintCap = [&](int k, Pointf p, Pointf a) { + Pointf oo = width * 2 * o; switch(k) { case CAP_ARROW: - w.Move(p).Line(a + 4 * o).Line(a - 4 * o).Fill(ink); + w.Move(p).Line(a + oo).Line(a - oo).Fill(ink); break; case CAP_CIRCLE: w.Circle(p, 5).Fill(ink); @@ -214,6 +215,7 @@ void DiagramItem::Paint(Painter& w, dword style) const int txt_cy = txt.GetHeight(zoom, GetRect().GetWidth()); Rectf r(p1, p2); r.Normalize(); + r.Deflate(width / 2); Pointf c = r.CenterPoint(); int sz = min(r.Width(), r.Height()); switch(shape) {