From 7fd2c2230bb8c218069fe26f4c4ff240bf818f16 Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 19 Mar 2009 21:56:29 +0000 Subject: [PATCH] TheIDE now can work with diff/patch files git-svn-id: svn://ultimatepp.org/upp/trunk@984 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/Button.cpp | 68 ++++++++++++- uppsrc/CtrlLib/Prompt.cpp | 2 +- uppsrc/CtrlLib/PushCtrl.h | 14 ++- uppsrc/CtrlLib/src.tpp/Pusher$en-us.tpp | 4 +- uppsrc/TextDiffCtrl/DiffCtrl.cpp | 3 +- uppsrc/TextDiffCtrl/TextCtrl.cpp | 27 +++--- uppsrc/ide/Builders/MscBuilder.cpp | 2 +- uppsrc/ide/Diff.cpp | 123 +++++++++++++++++++++++- uppsrc/ide/icon.ico | Bin 2862 -> 2862 bytes uppsrc/ide/ide.h | 2 + uppsrc/ide/ide.iml | 2 +- uppsrc/ide/ide.key | 1 + uppsrc/ide/idebar.cpp | 4 +- uppsrc/ide/idewin.cpp | 4 +- 14 files changed, 227 insertions(+), 29 deletions(-) diff --git a/uppsrc/CtrlLib/Button.cpp b/uppsrc/CtrlLib/Button.cpp index 5b0c67a4d..cd20ba322 100644 --- a/uppsrc/CtrlLib/Button.cpp +++ b/uppsrc/CtrlLib/Button.cpp @@ -636,19 +636,56 @@ void ButtonOption::Serialize(Stream& s) { } void ButtonOption::Paint(Draw& w) { + const Style *st; + if (style) + st = style; + else + st = &StyleDefault(); + Size sz = GetSize(); - Size isz = image.GetSize(); - Rect r = sz; + bool ds = !IsShowEnabled(); + DrawLabel dl; + dl.text = label; + dl.font = StdFont(); + dl.limg = DisabledImage((option && !IsNull(image1)) ? image1 : image, !IsEnabled()); + dl.disabled = ds; + dl.lspc = !label.IsEmpty() && !image.IsEmpty() ? 4 : 0; + if(VisibleAccessKeys() && IsEnabled()) + dl.accesskey = accesskey; int i = !IsShowEnabled() ? CTRL_DISABLED : push ? CTRL_PRESSED : HasMouse() || HasFocus() ? CTRL_HOT : CTRL_NORMAL; if(option) i = CTRL_PRESSED; - ChPaint(w, sz, style ? style->look[i] : GetButtonStyle(this)->look[i]); - Point p = r.CenterPos(image.GetSize()); - w.DrawImage(p.x, p.y, DisabledImage((option && !IsNull(image1)) ? image1 : image, !IsEnabled())); + ChPaint(w, sz, st->look[i]); + dl.ink = st->textcolor[i]; + dl.Paint(w, 3, 3, sz.cx - 6, sz.cy - 6, true); + if(HasFocus() && st->drawfocus) + DrawFocus(w, Rect(sz).Deflated(3)); } +CH_STYLE(ButtonOption, Style, StyleDefault) +{ + const Button::Style& bs = Button::StyleNormal(); + for (int i = 0; i < 4; i++) + { + look[i] = bs.look[i]; + textcolor[i] = bs.textcolor[i]; + } + drawfocus = false; +} + +CH_STYLE(ButtonOption, Style, StyleFlat) +{ + const ToolButton::Style& tbs = ToolButton::StyleDefault(); + for (int i = 0; i < 4; i++) + { + look[i] = tbs.look[i]; + textcolor[i] = tbs.textcolor[i]; + } + drawfocus = false; +} + void ButtonOption::LeftDown(Point, dword) { push = true; Refresh(); @@ -688,6 +725,27 @@ Value ButtonOption::GetData() const return (int)Get(); } +dword ButtonOption::GetAccessKeys() const +{ + return AccessKeyBit(accesskey); +} + +void ButtonOption::AssignAccessKeys(dword used) +{ + if(!accesskey) { + accesskey = ChooseAccessKey(label, used); + if(accesskey) Refresh(); + used |= AccessKeyBit(accesskey); + } + Ctrl::AssignAccessKeys(used); +} + +ButtonOption& ButtonOption::SetLabel(const String& text) { + accesskey = ExtractAccessKey(text, label); + Refresh(); + return *this; +} + // -------------------- DataPusher::DataPusher() diff --git a/uppsrc/CtrlLib/Prompt.cpp b/uppsrc/CtrlLib/Prompt.cpp index d9ab2d904..6e02e11d2 100644 --- a/uppsrc/CtrlLib/Prompt.cpp +++ b/uppsrc/CtrlLib/Prompt.cpp @@ -110,7 +110,7 @@ int Prompt(Callback1 WhenLink, Vector wins = Ctrl::GetTopWindows(); for(int i = 0; i < wins.GetCount(); i++) { TopWindow *w = dynamic_cast(wins[i]); - if(w && w->GetScreenRect().Intersects(dlg.GetScreenRect()) && w->IsTopMost()) { + if(w && w->IsTopMost()) { dlg.TopMost(); break; } diff --git a/uppsrc/CtrlLib/PushCtrl.h b/uppsrc/CtrlLib/PushCtrl.h index 5360719cd..ef06d592c 100644 --- a/uppsrc/CtrlLib/PushCtrl.h +++ b/uppsrc/CtrlLib/PushCtrl.h @@ -207,30 +207,42 @@ public: virtual void SetData(const Value& v); virtual Value GetData() const; virtual void Serialize(Stream& s); + virtual dword GetAccessKeys() const; + virtual void AssignAccessKeys(dword used); public: struct Style : ChStyle