From d6db33b1d2b199f4db59508ab3236e376f2c2df4 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 20 Oct 2008 10:36:42 +0000 Subject: [PATCH] Fixed ugly bug in RichEdit (problem deleting paragraph inside table) git-svn-id: svn://ultimatepp.org/upp/trunk@552 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/FileSel.cpp | 9 ++++----- uppsrc/CtrlLib/TabCtrl.cpp | 2 +- uppsrc/CtrlLib/TabCtrl.h | 5 +++-- uppsrc/IconDes/Bar.cpp | 2 +- uppsrc/RichText/TextData.cpp | 14 ++++++++------ uppsrc/ide/Assist.cpp | 27 +++++++++++++++++---------- uppsrc/ide/Cpp.cpp | 15 ++++++++++----- uppsrc/ide/Navigator.cpp | 1 + uppsrc/ide/icon.ico | Bin 2862 -> 2862 bytes uppsrc/ide/ide.key | 2 +- 10 files changed, 46 insertions(+), 31 deletions(-) diff --git a/uppsrc/CtrlLib/FileSel.cpp b/uppsrc/CtrlLib/FileSel.cpp index ef9c700a4..b2c963d88 100644 --- a/uppsrc/CtrlLib/FileSel.cpp +++ b/uppsrc/CtrlLib/FileSel.cpp @@ -16,11 +16,10 @@ struct FileIconMaker : ImageMaker { Color c = White(); Image m[2]; for(int i = 0; i < 2; i++) { - SHFILEINFOW info; - WString wfile = file.ToWString(); - SHGetFileInfoW(~wfile, dir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL, - &info, sizeof(info), - SHGFI_ICON|SHGFI_SMALLICON|(exe ? 0 : SHGFI_USEFILEATTRIBUTES)); + SHFILEINFO info; + SHGetFileInfo(ToSystemCharset(file), dir ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL, + &info, sizeof(info), + SHGFI_ICON|SHGFI_SMALLICON|(exe ? 0 : SHGFI_USEFILEATTRIBUTES)); HICON icon = info.hIcon; ICONINFO iconinfo; if(!icon || !GetIconInfo(icon, &iconinfo)) diff --git a/uppsrc/CtrlLib/TabCtrl.cpp b/uppsrc/CtrlLib/TabCtrl.cpp index 90b7caa70..09a82857f 100644 --- a/uppsrc/CtrlLib/TabCtrl.cpp +++ b/uppsrc/CtrlLib/TabCtrl.cpp @@ -202,7 +202,7 @@ void TabCtrl::Paint(Draw& w) ChPaint(w, 0, th, sz.cx, sz.cy - th, style->body); } -int TabCtrl::GetTab(Point p) +int TabCtrl::GetTab(Point p) const { if(p.y >= 0 && p.y < style->tabheight) for(int i = 0; i < tab.GetCount(); i++) diff --git a/uppsrc/CtrlLib/TabCtrl.h b/uppsrc/CtrlLib/TabCtrl.h index 6472077fd..e5c643289 100644 --- a/uppsrc/CtrlLib/TabCtrl.h +++ b/uppsrc/CtrlLib/TabCtrl.h @@ -33,7 +33,7 @@ public: void Layout(int x, int y, int cy); void Paint(Draw& w, int state); - int Right() { return x + cx; } + int Right() const { return x + cx; } public: Item& Text(const String& _text); @@ -85,7 +85,6 @@ private: static Image Fade(int i); - int GetTab(Point p); void PaintTabs(Draw& w); void ScrollInto(int i); void Left(); @@ -112,6 +111,8 @@ public: void Remove(int i); + int GetTab(Point p) const; + int GetCount() const { return tab.GetCount(); } Item& GetItem(int i) { return tab[i]; } const Item& GetItem(int i) const { return tab[i]; } diff --git a/uppsrc/IconDes/Bar.cpp b/uppsrc/IconDes/Bar.cpp index 9f357035e..64ac19dce 100644 --- a/uppsrc/IconDes/Bar.cpp +++ b/uppsrc/IconDes/Bar.cpp @@ -103,7 +103,7 @@ void IconDes::SettingBar(Bar& bar) paste_opaque ? IconDesImg::PasteOpaque() : IconDesImg::PasteTransparent(), THISBACK(TogglePaste)) - .Key(K_CTRL_T); + .Key(K_ALT_T); } void IconDes::SelectBar(Bar& bar) diff --git a/uppsrc/RichText/TextData.cpp b/uppsrc/RichText/TextData.cpp index e25ff8e71..099289ce6 100644 --- a/uppsrc/RichText/TextData.cpp +++ b/uppsrc/RichText/TextData.cpp @@ -280,17 +280,19 @@ void RichText::ApplyFormatInfo(int pos, const FormatInfo& fi, int count) void RichText::ReplaceStyle(int pos, const Uuid& id) { - int p = FindPart(pos); - RichPara pa = RichTxt::Get(p, id, style); - Put(p, pa, style); + RichTxt& txt = GetUpdateText(pos); + int p = txt.FindPart(pos); + RichPara pa = txt.Get(p, id, style); + txt.Set(p, pa, style); } void RichText::ReStyle(int pos, const Uuid& id) { - int p = FindPart(pos); - RichPara pa = Get(p); + RichTxt& txt = GetUpdateText(pos); + int p = txt.FindPart(pos); + RichPara pa = txt.Get(p, style); pa.format.styleid = id; - Put(p, pa, style); + txt.Set(p, pa, style); } RichText::Formating RichText::SaveFormat(int pos, int count) const diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index 87820ff9e..34e5bb8fa 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -1,8 +1,14 @@ #include "ide.h" -#define LDUMP(x) // DDUMP(x) -#define LDUMPC(x) // DDUMPC(x) -#define LLOG(x) // DLOG(x) +#if 0 +#define LDUMP(x) DDUMP(x) +#define LDUMPC(x) DDUMPC(x) +#define LLOG(x) DLOG(x) +#else +#define LDUMP(x) +#define LDUMPC(x) +#define LLOG(x) +#endif class IndexSeparatorFrameCls : public CtrlFrame { virtual void FrameLayout(Rect& r) { r.right -= 1; } @@ -160,6 +166,8 @@ String AssistEditor::CompleteIdBack(int& q) id = "::" + id; } else { + if(iscib(*id)) + break; String nid = IdBack(q); if(IsNull(nid)) break; @@ -298,10 +306,11 @@ void AssistEditor::Assist() if(Ch(q - 1) == '(') { --q; String id = IdBack(q); - if(id == "THISBACK") + if(id == "THISBACK") { GatherItems(parser.current_scope, false, in_types, false, true); + PopUpAssist(); + } } - else if(Ch(q - 1) == ':') { while(Ch(q - 1) == ':') q--; @@ -324,13 +333,13 @@ void AssistEditor::Assist() GatherItems("", false, in_types2, true, false); } } - if(assist_item.GetCount() == 0) - return; PopUpAssist(); } void AssistEditor::PopUpAssist(bool auto_insert) { + if(assist_item.GetCount() == 0) + return; int lcy = max(16, BrowserFont().Info().GetHeight()); type.Clear(); type.Add(AttrText("").Ink(SColorHighlight())); @@ -513,9 +522,7 @@ bool AssistEditor::Key(dword key, int count) else if(auto_assist && InCode()) { if(key == '.' || key == '>' && Ch(GetCursor() - 2) == '-' || - key == ':' && Ch(GetCursor() - 2) == ':') - Assist(); - if(key == '(') + key == ':' && Ch(GetCursor() - 2) == ':' || key == '(') Assist(); } if(key == ',') { diff --git a/uppsrc/ide/Cpp.cpp b/uppsrc/ide/Cpp.cpp index a9e0b1ae3..7cb77c8d2 100644 --- a/uppsrc/ide/Cpp.cpp +++ b/uppsrc/ide/Cpp.cpp @@ -1,8 +1,14 @@ #include "ide.h" -#define LDUMP(x) // DDUMP(x) -#define LDUMPC(x) // DDUMPC(x) -#define LLOG(x) // DLOG(x) +#if 0 +#define LDUMP(x) DDUMP(x) +#define LDUMPC(x) DDUMPC(x) +#define LLOG(x) DLOG(x) +#else +#define LDUMP(x) +#define LDUMPC(x) +#define LLOG(x) +#endif static Array sEmpty; @@ -141,8 +147,7 @@ void AssistEditor::ExpressionType(const String& ttype, const Vector& xp, const Array& n = GetTypeItems(type); String id = xp[ii]; int q = id.ReverseFind(':'); - if(q > 0 && id[q - 1] == ':') { - id = id.Mid(q + 1); + if(q > 0 && id[q - 1] == ':') { // problem here!!! ExpressionType(ResolveTParam(Qualify("", id.Mid(0, q - 1)), tparam), xp, ii + 1, typeset); return; } diff --git a/uppsrc/ide/Navigator.cpp b/uppsrc/ide/Navigator.cpp index 68c6c6eea..bc23ad686 100644 --- a/uppsrc/ide/Navigator.cpp +++ b/uppsrc/ide/Navigator.cpp @@ -173,6 +173,7 @@ void AssistEditor::IndexClick() void AssistEditor::SyncCursor() { + browser.search.NullText(String("Find (") + GetKeyDesc(IdeKeys::AK_SEARCHCODE().key[0]) + ") "); if(navigator == NAV_INDEX) { if(!index.IsCursor()) index.SetCursor(0); diff --git a/uppsrc/ide/icon.ico b/uppsrc/ide/icon.ico index 1b29c034623f494d92e32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ol3o{Y=ma9$Cg+; zi}6)Hp+p@7R50upBl7WboE2* z4-E`|?_qpS&w@jJZBeMxz3=c!}kUl#m*Yu zv?g%u1B7(0tZzrA>dykik7dmxJm|;R-QL1se;n0qiOCS#8M7?v&T93ylC z1*6YQ*mD_kK=s6wryM&*V1|hNP|Y(iVMadg2bFW}0HGNnygS8Q(HSBn4cD^~g|fbm z1J}b*r0R#}Y-8Lu$JFDgQb%A~;y(S*f#*I!NO!0o_AxYc^eE4X>A)bK+@G20!pQgJ z_}!55vyWg+s5i3C{1F1ff;acoINyb1Aok>%#^N2AM>Y(q&6jm@d_;ZnAF90@+aowe z2+xRMSTW|+o{wS}f6~294C=k5)H8}*jExy4O3z1dr(?|Np5z)ctc6+NsN~>u(t8-hkrJQU=EmNi+UmWILSK1@ir+c^wITbhUzWW$J;%Qo&WIG`s?Omae4CYj|;Mk#k+_6+}nHo=$sH_f6DB|4%@}z;x~R? bp1e6>JlUbJFV6>;w|VFMXMR@3|LxO%QP)-j diff --git a/uppsrc/ide/ide.key b/uppsrc/ide/ide.key index c3064dbf7..8fef4593a 100644 --- a/uppsrc/ide/ide.key +++ b/uppsrc/ide/ide.key @@ -89,4 +89,4 @@ KEY(CLEARMARKERSFILE, "Remove change markers in file", K_ALT_R) KEY(CLEARMARKERSALL, "Remove all change markers", K_SHIFT|K_ALT_R) KEY(TOGGLEINDEX, "File index", K_CTRL_F12) KEY(SEARCHINDEX, "File index search", K_F12) -KEY(SEARCHCODE, "Search code", K_CTRL_D) +KEY(SEARCHCODE, "Search code", K_CTRL_Q)