PDB debugger now shows tooltip with values of variables

git-svn-id: svn://ultimatepp.org/upp/trunk@1069 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-04-17 18:15:59 +00:00
commit c9e56076d6
12 changed files with 135 additions and 20 deletions

View file

@ -570,13 +570,57 @@ void CodeEditor::LeftDown(Point p, dword keyflags) {
WhenLeftDown();
}
void CodeEditor::Tip::Paint(Draw& w)
{
Rect r = GetSize();
w.DrawRect(r, SColorInfo());
r.left++;
if(d)
d->Paint(w, r, v, SColorText(), SColorPaper(), 0);
}
CodeEditor::Tip::Tip()
{
SetFrame(BlackFrame());
BackPaint();
}
void CodeEditor::SyncTip()
{
MouseTip mt;
mt.pos = tippos;
if(tippos >= 0 && IsVisible() && WhenTip(mt)) {
tip.d = mt.display;
tip.v = mt.value;
Point p = Upp::GetMousePos();
Size sz = tip.AddFrameSize(mt.sz);
tip.SetRect(p.x, p.y + 24, sz.cx, sz.cy);
if(!tip.IsOpen())
tip.PopUp(this, false, false, true);
tip.Refresh();
}
else
CloseTip();
}
void CodeEditor::MouseMove(Point p, dword f) {
LineEdit::MouseMove(p, f);
if(IsSelection()) return;
int pos = GetMousePos(p);
int l, h;
if(GetWordPos(pos, l, h) || pos > 0 && GetWordPos(pos - 1, l, h))
WhenDbgView(Get(l, h - l));
tippos = GetMousePos(p);
SyncTip();
}
Image CodeEditor::CursorImage(Point p, dword keyflags)
{
if(tip.IsOpen())
return Image::Arrow();
return LineEdit::CursorImage(p, keyflags);
}
void CodeEditor::MouseLeave()
{
tippos = -1;
LineEdit::MouseLeave();
}
WString CodeEditor::GetI()
@ -1033,6 +1077,7 @@ CodeEditor::CodeEditor() {
auto_enclose = false;
mark_lines = true;
check_edited = false;
tippos = -1;
}
CodeEditor::~CodeEditor() {}

View file

@ -156,11 +156,14 @@ class CodeEditor : public LineEdit {
friend class EditorBar;
public:
virtual bool Key(dword code, int count);
virtual void LeftDown(Point p, dword keyflags);
virtual void LeftDouble(Point p, dword keyflags);
virtual void MouseMove(Point p, dword keyflags);
virtual void Serialize(Stream& s);
virtual bool Key(dword code, int count);
virtual void LeftDown(Point p, dword keyflags);
virtual void LeftDouble(Point p, dword keyflags);
virtual void MouseMove(Point p, dword keyflags);
virtual Image CursorImage(Point p, dword keyflags);
virtual void Serialize(Stream& s);
virtual void MouseLeave();
void CheckEdited(bool e = true) { check_edited = e; }
bool GetCheckEdited() { return check_edited; }
@ -299,6 +302,18 @@ protected:
int iwc;
int highlight;
struct Tip : Ctrl {
Value v;
const Display *d;
virtual void Paint(Draw& w);
Tip();
};
Tip tip;
int tippos;
struct HlSt;
@ -368,12 +383,19 @@ private:
HlStyle hl_style[HL_COUNT];
public:
Callback WhenSelection;
Callback1<const String&> WhenDbgView;
Callback WhenLeftDown;
Callback WhenAnnotationMove;
Callback WhenAnnotationClick;
Callback WhenAnnotationRightClick;
struct MouseTip {
int pos;
Value value;
const Display *display;
Size sz;
};
Callback WhenSelection;
Gate1<MouseTip&> WhenTip;
Callback WhenLeftDown;
Callback WhenAnnotationMove;
Callback WhenAnnotationClick;
Callback WhenAnnotationRightClick;
FrameTop<Button> topsbbutton;
FrameTop<Button> topsbbutton1;
@ -482,6 +504,9 @@ public:
void DefaultHlStyles();
void LoadHlStyles(const char *s);
String StoreHlStyles();
void SyncTip();
void CloseTip() { if(tip.IsOpen()) tip.Close(); tip.d = NULL; }
const char *GetHlName(int i);
bool HasHlFont(int i);