From c8fc20df6e00295a869d834470fec5dafc5a2932 Mon Sep 17 00:00:00 2001 From: micio Date: Fri, 18 May 2012 21:48:54 +0000 Subject: [PATCH] Ide/Debuggers/Gdb_MI2 : some cosmetics in Quickwatch git-svn-id: svn://ultimatepp.org/upp/trunk@4968 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Debuggers/Gdb_MI2.cpp | 21 ++++++++++++++++++--- uppsrc/ide/Debuggers/Gdb_MI2.h | 7 ++++++- uppsrc/ide/Debuggers/Gdb_MI2.lay | 8 ++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/uppsrc/ide/Debuggers/Gdb_MI2.cpp b/uppsrc/ide/Debuggers/Gdb_MI2.cpp index 4d0d05463..2f8fb7a05 100644 --- a/uppsrc/ide/Debuggers/Gdb_MI2.cpp +++ b/uppsrc/ide/Debuggers/Gdb_MI2.cpp @@ -24,6 +24,14 @@ static void MarkChanged2(const VectorMap& m, ArrayCtrl& data) } } +void WatchEdit::HighlightLine(int line, Vector& h, int pos) +{ + Color cEven = Blend(SColorInfo, White, 220); + Color cOdd = Blend(SColorInfo, White, 128); + for(int i = 0; i < h.GetCount(); i++) + h[i].paper = (line % 2 ? cOdd : cEven); +} + ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC IDE INTERFACE ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -276,10 +284,13 @@ Gdb_MI2::Gdb_MI2() dlock.NoTransparent(); dlock.Hide(); - CtrlLayoutOKCancel(quickwatch, "Quick watch"); + CtrlLayout(quickwatch, "Quick watch"); + quickwatch.close.Cancel() <<= quickwatch.Breaker(IDCANCEL); + quickwatch.evaluate.Ok() <<= quickwatch.Acceptor(IDOK); quickwatch.WhenClose = quickwatch.Breaker(IDCANCEL); quickwatch.value.SetReadOnly(); quickwatch.value.SetFont(Courier(12)); + quickwatch.value.SetColor(TextCtrl::PAPER_READONLY, White); quickwatch.Sizeable().Zoomable(); quickwatch.NoCenter(); quickwatch.SetRect(0, 150, 300, 400); @@ -1270,7 +1281,7 @@ String Gdb_MI2::FormatWatchLine(String exp, String const &val, int level) } // deep watch current quickwatch variable -void Gdb_MI2::WatchDeep(String const &parentExp, String const &var, int level) +void Gdb_MI2::WatchDeep(String parentExp, String const &var, int level) { MIValue childInfo = MICmd("var-list-children 1 \"" + var + "\" 0 100"); int nChilds = min(atoi(childInfo["numchild"].Get()), 100); @@ -1291,8 +1302,12 @@ void Gdb_MI2::WatchDeep(String const &parentExp, String const &var, int level) } */ if(isdigit(exp[0])) + { exp = '[' + exp + ']'; - else + if(parentExp.Mid(parentExp.GetCount() - 1, 1) == ".") + parentExp = parentExp.Left(parentExp.GetCount() - 1); + } + if(exp[0] != '.' && exp[0] != '[') exp = '.' + exp; String type = child("type", ""); diff --git a/uppsrc/ide/Debuggers/Gdb_MI2.h b/uppsrc/ide/Debuggers/Gdb_MI2.h index ec39eff32..3f773969f 100644 --- a/uppsrc/ide/Debuggers/Gdb_MI2.h +++ b/uppsrc/ide/Debuggers/Gdb_MI2.h @@ -3,6 +3,11 @@ #include "MIValue.h" +class WatchEdit : public LineEdit +{ + virtual void HighlightLine(int line, Vector& h, int pos); +}; + #define LAYOUTFILE #include @@ -192,7 +197,7 @@ class Gdb_MI2 : public Debugger, public ParentCtrl String FormatWatchLine(String exp, String const &val, int level); // deep watch current quickwatch variable - void WatchDeep(String const &parentExp, String const &name, int level = 0); + void WatchDeep(String parentExp, String const &name, int level = 0); // copy stack frame list to clipboard void CopyStack(void); diff --git a/uppsrc/ide/Debuggers/Gdb_MI2.lay b/uppsrc/ide/Debuggers/Gdb_MI2.lay index 915f8f99e..b77a74fd5 100644 --- a/uppsrc/ide/Debuggers/Gdb_MI2.lay +++ b/uppsrc/ide/Debuggers/Gdb_MI2.lay @@ -36,10 +36,10 @@ LAYOUT(Gdb_MI2Registers64Layout, 220, 68) ITEM(Label, rsp, SetLabel(t_("0000000000000000")).SetFont(MonospaceZ(8)).LeftPosZ(136, 80).TopPosZ(52, 13)) END_LAYOUT -LAYOUT(Gdb_MI2QuickwatchLayout, 400, 200) +LAYOUT(Gdb_MI2QuickwatchLayout, 400, 224) ITEM(WithDropChoice, expression, HSizePosZ(4, 72).TopPosZ(4, 19)) - ITEM(Button, ok, SetLabel(t_("Evaluate")).RightPosZ(4, 64).TopPosZ(4, 20)) - ITEM(LineEdit, value, HSizePosZ(4, 4).VSizePosZ(28, 4)) - ITEM(Button, cancel, RightPosZ(4, 28).BottomPosZ(-32, 16)) + ITEM(Button, evaluate, SetLabel(t_("Evaluate")).RightPosZ(4, 64).TopPosZ(4, 20)) + ITEM(WatchEdit, value, HSizePosZ(4, 4).VSizePosZ(28, 28)) + ITEM(Button, close, SetLabel(t_("Close")).RightPosZ(4, 64).BottomPosZ(4, 20)) END_LAYOUT