From 403b29e499e086db95d37df82f027e7ffb597b2c Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 18 Apr 2010 17:15:12 +0000 Subject: [PATCH] CtrlLib: EditField ReadOnly Ctrl+C fix, DocEdit: NoEofLine, Display: Background fix git-svn-id: svn://ultimatepp.org/upp/trunk@2325 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/DocEdit.cpp | 4 +++- uppsrc/CtrlLib/EditField.cpp | 2 +- uppsrc/CtrlLib/TextEdit.h | 4 +++- uppsrc/Draw/Display.cpp | 13 +++++++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/uppsrc/CtrlLib/DocEdit.cpp b/uppsrc/CtrlLib/DocEdit.cpp index 9b3fccfc0..259dbe5f6 100644 --- a/uppsrc/CtrlLib/DocEdit.cpp +++ b/uppsrc/CtrlLib/DocEdit.cpp @@ -152,7 +152,8 @@ void DocEdit::Paint(Draw& w) { w.DrawRect(0, -sb, sz.cx, 1, bg); w.DrawRect(0, 0, 1, sz.cy, bg); w.DrawRect(sz.cx - 1, 0, 1, sz.cy, bg); - w.DrawRect(1, y++, cx, 1, SColorShadow); + if(eofline) + w.DrawRect(1, y++, cx, 1, SColorShadow); if(y < sz.cy) w.DrawRect(1, y, cx, sz.cy - y, bg); DrawTiles(w, DropCaret(), CtrlImg::checkers()); @@ -499,6 +500,7 @@ DocEdit::DocEdit() sb.SetLine(8); sb.WhenScroll = THISBACK(Scroll); InsertLines(0, 1); + eofline = true; } DocEdit::~DocEdit() {} diff --git a/uppsrc/CtrlLib/EditField.cpp b/uppsrc/CtrlLib/EditField.cpp index b6b802899..f11443397 100644 --- a/uppsrc/CtrlLib/EditField.cpp +++ b/uppsrc/CtrlLib/EditField.cpp @@ -828,7 +828,7 @@ bool EditField::Key(dword key, int rep) return true; } if(!IsEditable()) - return false; + return MenuBar::Scan(WhenBar, key); switch(key) { case K_BACKSPACE: case K_SHIFT|K_BACKSPACE: diff --git a/uppsrc/CtrlLib/TextEdit.h b/uppsrc/CtrlLib/TextEdit.h index 4cc9ade2b..4df90fa01 100644 --- a/uppsrc/CtrlLib/TextEdit.h +++ b/uppsrc/CtrlLib/TextEdit.h @@ -387,7 +387,7 @@ protected: CharFilter filter; ScrollBar sb; int cx; - bool updownleave; + bool updownleave, eofline; struct Fmt { FontInfo fi; @@ -424,6 +424,8 @@ public: DocEdit& NoUpDownLeave() { return UpDownLeave(false); } bool IsUpDownLeave() const { return updownleave; } DocEdit& SetScrollBarStyle(const ScrollBar::Style& s) { sb.SetStyle(s); return *this; } + DocEdit& EofLine(bool b = true) { eofline = b; return *this; } + DocEdit& NoEofLine() { return EofLine(false); } typedef DocEdit CLASSNAME; diff --git a/uppsrc/Draw/Display.cpp b/uppsrc/Draw/Display.cpp index 4db39a9f3..53dadcb92 100644 --- a/uppsrc/Draw/Display.cpp +++ b/uppsrc/Draw/Display.cpp @@ -66,7 +66,8 @@ void Display::PaintBackground(Draw& w, const Rect& r, const Value& q, void Display::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const { - StdDisplay().Paint(w, r, q, ink, paper, style); + PaintBackground(w, r, q, ink, paper, style); + Single().Paint0(w, r, q, ink, paper, style); } Size Display::RatioSize(const Value& q, int cx, int cy) const { @@ -80,7 +81,7 @@ Size Display::GetStdSize(const Value& q) const void StdDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword s) const { - LLOG("Display::Paint0: " << q << " ink:" << ink << " paper:" << paper); + LLOG("StdDisplay::Paint0: " << q << " ink:" << ink << " paper:" << paper); WString txt; Font font = StdFont(); int a = align; @@ -126,7 +127,7 @@ void StdDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q, void StdDisplayClass::Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword s) const { - LLOG("Display::Paint: " << q << " ink:" << ink << " paper:" << paper); + LLOG("StdDisplay::Paint: " << q << " ink:" << ink << " paper:" << paper); PaintBackground(w, r, q, ink, paper, s); Paint0(w, r, q, ink, paper, s); } @@ -158,7 +159,11 @@ Display::Display() {} Display::~Display() {} -const Display& GLOBAL_V_INIT(StdDisplayClass, StdDisplay) +const Display& StdDisplay() +{ + return Single(); +} + const Display& GLOBAL_VP_INIT(StdDisplayClass, StdCenterDisplay, (ALIGN_CENTER)) const Display& GLOBAL_VP_INIT(StdDisplayClass, StdRightDisplay, (ALIGN_RIGHT))