From 661a63eefeb5bc26671fae4105bc781062010d75 Mon Sep 17 00:00:00 2001 From: koldo Date: Thu, 29 Sep 2011 20:48:59 +0000 Subject: [PATCH] Scatter: Changed area selection color. git-svn-id: svn://ultimatepp.org/upp/trunk@3929 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/Scatter/PopUpText.cpp | 43 +++++------ bazaar/Scatter/PopUpText.h | 95 +++++++++++++----------- bazaar/Scatter/Scatter.cpp | 37 ++++----- bazaar/Scatter/src.tpp/Scatter$en-us.tpp | 7 ++ 4 files changed, 101 insertions(+), 81 deletions(-) diff --git a/bazaar/Scatter/PopUpText.cpp b/bazaar/Scatter/PopUpText.cpp index 6e6cf8ed5..9f7901d59 100644 --- a/bazaar/Scatter/PopUpText.cpp +++ b/bazaar/Scatter/PopUpText.cpp @@ -1,21 +1,22 @@ - -#include "PopUpText.h" - - -void PopUpInfo::Paint(Draw& w) -{ - Size sz = GetSize(); - if(!IsTransparent()) - w.DrawRect(0, 0, sz.cx, sz.cy, color); - PaintLabel(w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); -} - - -PopUpInfo::PopUpInfo(): color(SColorInfo()) -{ - Transparent(false); - NoWantFocus(); - IgnoreMouse(); - SetAlign(ALIGN_CENTER); - SetFrame(BlackFrame()); -} + +#include "PopUpText.h" + + +void PopUpInfo::Paint(Draw& w) +{ + Size sz = GetSize(); + if(!IsTransparent()) + w.DrawRect(0, 0, sz.cx, sz.cy, color); + PaintLabel(w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys()); +} + + +PopUpInfo::PopUpInfo(): color(SColorInfo()) +{ + Transparent(false); + NoWantFocus(); + IgnoreMouse(); + SetAlign(ALIGN_CENTER); + SetFrame(BlackFrame()); + opened = false; +} diff --git a/bazaar/Scatter/PopUpText.h b/bazaar/Scatter/PopUpText.h index fe54e9e3c..9b565dd7e 100644 --- a/bazaar/Scatter/PopUpText.h +++ b/bazaar/Scatter/PopUpText.h @@ -1,43 +1,52 @@ -#ifndef _PopUpText_PopUpText_h -#define _PopUpText_PopUpText_h - - -#include - -using namespace Upp; - -class PopUpInfo : public StaticText { - Color color; -public: - void Paint(Draw& w); - - PopUpInfo& SetFont(Font font) { LabelBase::SetFont(font); return *this; } - PopUpInfo& SetInk(Color color) { LabelBase::SetInk(color); return *this; } - PopUpInfo& SetAlign(int align) { LabelBase::SetAlign(align); return *this; } - PopUpInfo& SetImage(const Image& img, int spc = 0) { LabelBase::SetImage(img, spc); return *this; } - PopUpInfo& SetText(const char *text) { LabelBase::SetText(text); return *this; } - - PopUpInfo& operator=(const char *s) { SetText(s); return *this; } - PopUpInfo& SetColor(const Color& c) { color=c; return *this; } - - PopUpInfo(); - - inline void Appear(Ctrl *owner, const int& x, const int& y, const int& gx=0, const int& gy=0) - { - AppearOnly(owner); - Move(owner, x, y, gx, gy); - } - inline void AppearOnly(Ctrl * owner) - { - if(IsOpen()) Close(); - Ctrl::PopUp(owner); - } - inline void Move(Ctrl *owner, const int& x, const int& y, const int& gx=0, const int& gy=0) - { - SetRect(owner->GetScreenRect().left+x,owner->GetScreenRect().top+y,GetMinSize().cx+8+gx,GetMinSize().cy+4+gy); - } -}; - - -#endif - +#ifndef _PopUpText_PopUpText_h +#define _PopUpText_PopUpText_h + + +#include + +using namespace Upp; + +class PopUpInfo : public StaticText { + Color color; + bool opened; + +public: + void Paint(Draw& w); + + PopUpInfo& SetFont(Font font) { LabelBase::SetFont(font); return *this; } + PopUpInfo& SetInk(Color color) { LabelBase::SetInk(color); return *this; } + PopUpInfo& SetAlign(int align) { LabelBase::SetAlign(align); return *this; } + PopUpInfo& SetImage(const Image& img, int spc = 0) { LabelBase::SetImage(img, spc); return *this; } + PopUpInfo& SetText(const char *text) { LabelBase::SetText(text); return *this; } + + PopUpInfo& operator=(const char *s) { SetText(s); return *this; } + PopUpInfo& SetColor(const Color& c) { color=c; return *this; } + + PopUpInfo(); + + inline void Appear(Ctrl *owner, const int& x, const int& y, const int& gx=0, const int& gy=0) + { + AppearOnly(owner); + Move(owner, x, y, gx, gy); + } + inline void AppearOnly(Ctrl *owner) + { + if(IsOpen()) Close(); + Ctrl::PopUp(owner); + } + inline void AppearOnlyOpen(Ctrl *owner) + { + if (opened) + return; + AppearOnly(owner); + opened = true; + } + inline void Move(Ctrl *owner, const int& x, const int& y, const int& gx=0, const int& gy=0) + { + SetRect(owner->GetScreenRect().left+x,owner->GetScreenRect().top+y,GetMinSize().cx+8+gx,GetMinSize().cy+4+gy); + } +}; + + +#endif + diff --git a/bazaar/Scatter/Scatter.cpp b/bazaar/Scatter/Scatter.cpp index 33716f082..222663dd6 100644 --- a/bazaar/Scatter/Scatter.cpp +++ b/bazaar/Scatter/Scatter.cpp @@ -1013,26 +1013,26 @@ void Scatter::ProcessPopUp(const Point & pt) } String strx, _strx, dstrx, stry, _stry, dstry; if (cbModifFormatX) { - cbModifFormatX(strx, 0, x); strx.Replace("\n", ""); - cbModifFormatX(_strx, 0, _x); _strx.Replace("\n", ""); + cbModifFormatX(strx, 0, x); strx.Replace("\n", " "); + cbModifFormatX(_strx, 0, _x); _strx.Replace("\n", " "); } else { strx = VariableFormatX(x); _strx = VariableFormatX(_x); } if (cbModifFormatDeltaX) { - cbModifFormatDeltaX(dstrx, 0, dx); dstrx.Replace("\n", ""); + cbModifFormatDeltaX(dstrx, 0, dx); dstrx.Replace("\n", " "); } else { dstrx = VariableFormatX(dx); } if (cbModifFormatY) { - cbModifFormatY(stry, 0, y); stry.Replace("\n", ""); - cbModifFormatY(_stry, 0, _y); _stry.Replace("\n", ""); + cbModifFormatY(stry, 0, y); stry.Replace("\n", " "); + cbModifFormatY(_stry, 0, _y); _stry.Replace("\n", " "); } else { stry = VariableFormatY(y); _stry = VariableFormatY(_y); } if (cbModifFormatDeltaY) { - cbModifFormatDeltaY(dstry, 0, dy); dstry.Replace("\n", ""); + cbModifFormatDeltaY(dstry, 0, dy); dstry.Replace("\n", " "); } else { dstry = VariableFormatY(dy); } @@ -1045,14 +1045,14 @@ void Scatter::ProcessPopUp(const Point & pt) if (drawY2Reticle) { String stry2, _stry2, dstry2; if (cbModifFormatY2) { - cbModifFormatY2(stry2, 0, y2); stry2.Replace("\n", ""); - cbModifFormatY2(_stry2, 0, _y2); _stry2.Replace("\n", ""); + cbModifFormatY2(stry2, 0, y2); stry2.Replace("\n", " "); + cbModifFormatY2(_stry2, 0, _y2); _stry2.Replace("\n", " "); } else { stry2 = VariableFormatY2(y2); _stry2 = VariableFormatY2(_y2); } if (cbModifFormatDeltaY2) { - cbModifFormatDeltaY2(dstry2, 0, dy2); dstry2.Replace("\n", ""); + cbModifFormatDeltaY2(dstry2, 0, dy2); dstry2.Replace("\n", " "); } else { dstry2 = VariableFormatY(dy2); } @@ -1110,6 +1110,7 @@ void Scatter::LabelPopUp(bool down, Point &pt) if(paintInfo && px <=pt.x && pt.x<= GetSize().cx-px && (py + titleFont.GetHeight())<=pt.y && pt.y<= GetSize().cy-py) { popText.AppearOnly(this); + isLabelPopUp = true; if (IsNull(popLT)) popLT = pt; @@ -1234,7 +1235,9 @@ void Scatter::MouseMove(Point pt, dword) if (IsNull(popLT)) popLT = pt; popRB = pt; - ProcessPopUp(pt); + popText.AppearOnlyOpen(this); + + ProcessPopUp(pt); Refresh(); } } @@ -1634,12 +1637,12 @@ void Scatter::Plot(Draw& w, const int& scale,const int& l,const int& h)const int y0 = py + titleFont.GetHeight(); int rfrom = min(popLT.y-y0, popRB.y-y0); int rto = max(popLT.y-y0, popRB.y-y0); - for (int r = rfrom; r < rto; r += scale*5) - DrawLineX(w, popLT.x-x0, r, popRB.x-x0, r, scale, LtGray, "o..", scale); - DrawLineX(w, 1, popLT.y-y0, l, popLT.y-y0, scale, Black, "o.", scale); - DrawLineX(w, 1, popRB.y-y0, l, popRB.y-y0, scale, Black, "o.", scale); - DrawLineX(w, popLT.x-x0, 1, popLT.x-x0, h, scale, Black, "o.", scale); - DrawLineX(w, popRB.x-x0, 1, popRB.x-x0, h, scale, Black, "o.", scale); + for (int r = rfrom+scale*5; r < rto; r += scale*5) + DrawLineX(w, popLT.x-x0, r, popRB.x-x0, r, scale, LtRed, "o..", scale); + DrawLineX(w, 1, popLT.y-y0, l, popLT.y-y0, scale, LtRed, "o.", scale); + DrawLineX(w, 1, popRB.y-y0, l, popRB.y-y0, scale, LtRed, "o.", scale); + DrawLineX(w, popLT.x-x0, 1, popLT.x-x0, h, scale, LtRed, "o.", scale); + DrawLineX(w, popRB.x-x0, 1, popRB.x-x0, h, scale, LtRed, "o.", scale); } w.End(); } @@ -1827,7 +1830,7 @@ void Scatter::SetDrawing(Draw& w, const int& scale) const w.DrawText(l+scale*10,fround(-h*yMinUnit2/yRange2+h-i*h/(yRange/yMajorUnit))-scale*8,gridLabelY2,Standard6,axisColor); } - if(antialiasing && w.IsGui()) + if(antialiasing) // && w.IsGui()) IsGui() is always false in Linux { ImageDraw imdraw(3*l,3*h); Plot (imdraw,3,3*l,3*h); diff --git a/bazaar/Scatter/src.tpp/Scatter$en-us.tpp b/bazaar/Scatter/src.tpp/Scatter$en-us.tpp index 1242af383..794d92a08 100644 --- a/bazaar/Scatter/src.tpp/Scatter$en-us.tpp +++ b/bazaar/Scatter/src.tpp/Scatter$en-us.tpp @@ -62,6 +62,13 @@ value [%-*@3 x ]in data units.&] [%-*@3 y ]in data units.&] [s3;%% &] [s4; &] +[s5;:Scatter`:`:ShowInfo`(bool`): [@(0.0.255) void]_[* ShowInfo]([@(0.0.255) bool]_[*@3 show][@(0.0.255) `= +true])&] +[s2;%% Defines to show or not with [%-*@3 show ]the pop`-up window +that indicates in data units the cursor location and, if dragged, +the size of the window.&] +[s3;%% &] +[s4; &] [s5;:Scatter`:`:SetRange`(double`,double`,double`): [_^Scatter^ Scatter][@(0.0.255) `&]_[* S etRange]([@(0.0.255) double]_[*@3 rx], [@(0.0.255) double]_[*@3 ry], [@(0.0.255) double]_[*@3 ry2]_`=_`-[@3 1])&]