RichEdit: SingleLine, Filter

git-svn-id: svn://ultimatepp.org/upp/trunk@2845 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-11-14 23:32:12 +00:00
parent 1a9adab933
commit c34b788e7a
5 changed files with 11 additions and 1 deletions

View file

@ -76,6 +76,7 @@ bool RichEdit::Accept(PasteClip& d, RichText& clip)
void RichEdit::ClipPaste(RichText& clip)
{
Filter(clip);
NextUndo();
if(clip.GetPartCount() == 1 && clip.IsTable(0)) {
CancelSelection();

View file

@ -703,6 +703,8 @@ RichEdit::RichEdit()
Finish();
imagefs.Type("Images (*.png *.gif *.jpg *.bmp)", "*.png *.gif *.jpg *.bmp");
singleline = false;
}
RichEdit::~RichEdit() {}

View file

@ -62,7 +62,7 @@ bool RichEdit::Key(dword key, int count)
Redo();
return true;
case K_ENTER:
if(!RemoveSelection() && InsertLineSpecial())
if(singleline || !RemoveSelection() && InsertLineSpecial())
return true;
InsertLine();
ShowFormat();
@ -159,6 +159,7 @@ bool RichEdit::Key(dword key, int count)
if(p.posinpara < p.paralen)
Remove(cursor, 1);
}
Filter(txt);
Insert(cursor, txt, true);
Move(cursor + count, false);
break;

View file

@ -2,6 +2,8 @@
NAMESPACE_UPP
void RichEdit::Filter(RichText& txt) {}
bool RichEdit::InvalidRange(int l, int h)
{
return !InSameTxt(text.GetRichPos(min(l, h)), text.GetRichPos(max(l, h)));

View file

@ -259,6 +259,7 @@ private:
bool nolinks;
bool overwrite;
bool useraction, modified;
bool singleline;
static int fixedlang;
WithRichFindReplaceLayout<TopWindow> findreplace;
@ -607,6 +608,8 @@ protected:
};
public:
virtual void Filter(RichText& txt);
static double DotToPt(int dot);
static int PtToDot(double pt);
static Bits SpellParagraph(const RichPara& p);
@ -736,6 +739,7 @@ public:
Size GetPage() { return pagesz; }
RichEdit& NoRuler() { RemoveFrame(ruler); return *this; }
RichEdit& SingleLine(bool b = true) { singleline = b; return *this; }
RichEdit& FontFaces(const Vector<int>& face);
RichEdit& ViewBorder(int cx) { viewborder = cx; Refresh(); return *this; }
RichEdit& ShowCodes(Color c) { showcodes = c; Refresh(); return *this; }