diff --git a/bazaar/Controls4U/ActiveX.cpp b/bazaar/Controls4U/ActiveX.cpp index 4dec3ff77..41558d9df 100644 --- a/bazaar/Controls4U/ActiveX.cpp +++ b/bazaar/Controls4U/ActiveX.cpp @@ -1,11 +1,10 @@ #ifdef _WIN32 #include - -using namespace Upp; - #include "ActiveX.h" +NAMESPACE_UPP + bool BSTRSet(const String str, BSTR &bstr) { wchar_t *buffer; DWORD size = MultiByteToWideChar(CP_UTF8, 0, str, -1, 0, 0); @@ -374,4 +373,6 @@ HRESULT STDMETHODCALLTYPE AXClientSite::OnPosRectChange(LPCRECT lprcPosRect) { return S_OK; } +END_UPP_NAMESPACE + #endif diff --git a/bazaar/Controls4U/ActiveX.h b/bazaar/Controls4U/ActiveX.h index 6819864d3..0097f69b9 100644 --- a/bazaar/Controls4U/ActiveX.h +++ b/bazaar/Controls4U/ActiveX.h @@ -18,6 +18,8 @@ static const CLSID CLSID_MozillaBrowser = {0x1339B54C, 0x3453, 0x11D2, {0x93, 0xB9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}; //http://www.iol.ie/~locka/mozilla/control.htm +NAMESPACE_UPP + class FirefoxBrowser : public DHCtrlActiveX { public: FirefoxBrowser(bool status = true) : DHCtrlActiveX(CLSID_MozillaBrowser, "Firefox", status) {}; @@ -133,5 +135,6 @@ private: }; }; +END_UPP_NAMESPACE #endif diff --git a/bazaar/Controls4U/ActiveX_base.h b/bazaar/Controls4U/ActiveX_base.h index ee68e8e7d..c199db43d 100644 --- a/bazaar/Controls4U/ActiveX_base.h +++ b/bazaar/Controls4U/ActiveX_base.h @@ -1,6 +1,8 @@ #ifndef _hdIE_ActiveX_Support_h_ #define _hdIE_ActiveX_Support_h_ +NAMESPACE_UPP + bool BSTRSet(const String str, BSTR &bstr); String BSTRGet(BSTR &bstr); @@ -117,5 +119,6 @@ private: bool status; }; +END_UPP_NAMESPACE #endif diff --git a/bazaar/Controls4U/Controls4U.cpp b/bazaar/Controls4U/Controls4U.cpp index 0b02c4d12..9c90ae9a9 100644 --- a/bazaar/Controls4U/Controls4U.cpp +++ b/bazaar/Controls4U/Controls4U.cpp @@ -1,7 +1,5 @@ #include -using namespace Upp; - #include "Controls4U/Controls4U.h" #define TFILE @@ -11,6 +9,8 @@ using namespace Upp; #define IMAGEFILE #include +NAMESPACE_UPP + void PaintCenterText(Painter &w, double x, double y, String text, Font fnt, Color color) { Size sz = GetTextSize(text, fnt); w.Text(x - sz.cx / 2., y - sz.cy / 2., text, fnt).Fill(color); @@ -1936,3 +1936,4 @@ String FileBrowser::GetFolder() { return ~folders; } +END_UPP_NAMESPACE \ No newline at end of file diff --git a/bazaar/Controls4U/Controls4U.h b/bazaar/Controls4U/Controls4U.h index aaa7a7e32..89d23c687 100644 --- a/bazaar/Controls4U/Controls4U.h +++ b/bazaar/Controls4U/Controls4U.h @@ -1,6 +1,7 @@ #ifndef _Controls4U_Controls4U_h_ #define _Controls4U_Controls4U_h_ +#include #include #include #if defined(PLATFORM_WIN32) @@ -10,6 +11,8 @@ #include "Controls4U/SliderCtrlX.h" #include "Controls4U/StarIndicator.h" +NAMESPACE_UPP; + double AngAdd(double ang, double val); class EditFileFolder : public EditString { @@ -572,4 +575,6 @@ public: Callback WhenSelected; }; +END_UPP_NAMESPACE + #endif diff --git a/bazaar/Controls4U/Controls4U.upp b/bazaar/Controls4U/Controls4U.upp index bc23ca49a..c1699065d 100644 --- a/bazaar/Controls4U/Controls4U.upp +++ b/bazaar/Controls4U/Controls4U.upp @@ -2,7 +2,8 @@ description "Some additional controls\377B255,170,0"; uses CtrlLib, - Functions4U; + Functions4U, + ClassFactory; uses(!NOPAINTER) Painter; diff --git a/bazaar/Controls4U/DrawingCanvas.cpp b/bazaar/Controls4U/DrawingCanvas.cpp index acb2c2c7e..542050896 100644 --- a/bazaar/Controls4U/DrawingCanvas.cpp +++ b/bazaar/Controls4U/DrawingCanvas.cpp @@ -24,9 +24,8 @@ void GraphElemList::Paint(Painter &sw, Svg2DTransform _transf, SvgStyle _style, _transf.Apply(sw); _style += style; _style.Apply(sw); - for (int i = 0; i < elems.GetCount(); ++i) { + for (int i = 0; i < elems.GetCount(); ++i) elems[i].Paint(sw, _transf, _style, false); - } if (firstLayer) PaintLimits(sw); } @@ -143,7 +142,6 @@ Array GetTransformArgs(String str, const char *command) { } - void SvgGet_Rect(GraphElemList &elems, XmlParser &xp) { RectElem &elem = static_cast(elems.elems.Add(new RectElem())); @@ -431,6 +429,8 @@ void ParseG(GraphElemList &elems, XmlParser &xp, Svg2DTransform transf, SvgStyle xp.Skip(); } +/* + bool ParseSVG(DrawingCanvas &canvas, const char *svgFile, const char *svgFolder) { XmlParser xp(svgFile); while(!xp.IsTag()) @@ -572,6 +572,8 @@ void DrawingCanvas::LeftUp(Point p, dword keyflags) { selectionWindow.isSelected = false; } } +*/ + PainterCanvas::PainterCanvas() { rotate = 0; @@ -597,10 +599,12 @@ PainterCanvas::PainterCanvas() { legendShowFilename = false; legendShowXY = false; } - -void PainterCanvas::Paint(Draw& w) { - Size sz = GetSize(); - ImageBuffer ib(sz); + +Image PainterCanvas::GetImage(Size sz) +{ + if (IsNull(sz)) + sz = GetSize(); + ImageBuffer ib(sz); BufferPainter sw(ib, mode); sw.Translate(translateX, translateY); @@ -609,26 +613,53 @@ void PainterCanvas::Paint(Draw& w) { sw.Opacity(opacity); sw.LineCap(linecap); sw.LineJoin(linejoin); - //if (/*IsNull(backImage) || */colorUnderBackgroundImage) - // sw.Clear(backColor); - //else - // sw.Clear(RGBAZero()); + if (backColor) sw.Clear(backColor); else sw.Clear(SColorFace()); - //else { - // Color c = Null; - // sw.Clear(c); - //} - +//sw.Move(0, 0).Line(300, 300).Stroke(2, Black()); if (canvasSize.cx > 0 && canvasSize.cy > 0) { if (!IsNull(backImage)) sw.Rectangle(0, 0, canvasSize.cx, canvasSize.cy).Fill(backImage, 0, 0, canvasSize.cx, 0, FILL_FAST).Stroke(0, Black()); DoPaint(sw); WhenPaint(sw); - } - w.DrawImage(0, 0, ib); +// sw.Move(0, 0).Line(300, 300).Stroke(2, Black()); + } + return ib; +} + +void PainterCanvas::Paint(Draw& w) { +/* Size sz = GetSize(); + ImageBuffer ib(sz); + BufferPainter sw(ib, mode); + + sw.Translate(translateX, translateY); + sw.Rotate(rotate); + sw.Scale(scale); + sw.Opacity(opacity); + sw.LineCap(linecap); + sw.LineJoin(linejoin);*/ + //if (/*IsNull(backImage) || */colorUnderBackgroundImage) + // sw.Clear(backColor); + //else + // sw.Clear(RGBAZero()); +/* if (backColor) + sw.Clear(backColor); + else + sw.Clear(SColorFace());*/ + //else { + // Color c = Null; + // sw.Clear(c); + //} + +/* if (canvasSize.cx > 0 && canvasSize.cy > 0) { + if (!IsNull(backImage)) + sw.Rectangle(0, 0, canvasSize.cx, canvasSize.cy).Fill(backImage, 0, 0, canvasSize.cx, 0, FILL_FAST).Stroke(0, Black()); + DoPaint(sw); + WhenPaint(sw); + }*/ + w.DrawImage(0, 0, GetImage()); if (legendShowXY) { Size sz = GetTextSize(legendText, legendFont); w.DrawRectOp(0, 0, sz.cx, sz.cy, LtGray()); @@ -640,6 +671,7 @@ void PainterCanvas::Paint(Draw& w) { int twidth = 100; int theight = int(twidth*double(canvasSize.cy)/canvasSize.cx); + Size sz = GetSize(); int tx = sz.cx-twidth-20; int ty = sz.cy-theight-20; @@ -779,13 +811,11 @@ PainterCanvas &PainterCanvas::SetBackground(const String &imageFilename) { return SetBackground(StreamRaster::LoadFileAny(~imageFilename)); } -void PainterCanvas::RightDown(Point p, dword keyflags) -{ +void PainterCanvas::RightDown(Point p, dword keyflags) { MenuBar::Execute(THISBACK(ContextMenu)); } -void PainterCanvas::ContextMenu(Bar& bar) -{ +void PainterCanvas::ContextMenu(Bar& bar) { bar.Add(t_("Fit to size"), Controls4UImgC::ShapeHandles(), THISBACK(FitInCanvas)); bar.Add(t_("Zoom +"), Controls4UImgC::ZoomPlus(), THISBACK1(Zoom, 1.2)); bar.Add(t_("Zoom -"), Controls4UImgC::ZoomMinus(), THISBACK1(Zoom, 1/1.2)); @@ -799,15 +829,13 @@ void PainterCanvas::ContextMenu(Bar& bar) bar.Add(t_("Load background"), Controls4UImgC::Save(), THISBACK1(Load, Null)); } -void PainterCanvas::SaveToClipboard() -{ +void PainterCanvas::SaveToClipboard() { GuiLock __; Image img = GetBackground(); WriteClipboardImage(img); } -void PainterCanvas::Load(String fileName) -{ +void PainterCanvas::Load(String fileName) { GuiLock __; if (IsNull(fileName)) { FileSel fs; @@ -831,8 +859,7 @@ void PainterCanvas::Load(String fileName) } } -void PainterCanvas::SaveToFile(String fileName) -{ +void PainterCanvas::SaveToFile(String fileName) { GuiLock __; if (IsNull(fileName)) { FileSel fs; @@ -859,8 +886,7 @@ void PainterCanvas::SaveToFile(String fileName) Exclamation(Format(t_("File format \"%s\" not found"), GetFileExt(fileName))); } -Image PainterCanvas::CursorImage(Point p, dword keyflags) -{ +Image PainterCanvas::CursorImage(Point p, dword keyflags) { return cursorImage; } @@ -890,4 +916,12 @@ PainterCanvas &PainterCanvas::SetLegend(bool _legendShowXY, Font _legendFont) { legendShowXY = _legendShowXY; legendFont = _legendFont; return *this; +} + +INITBLOCK{ + GraphElem::Register("GraphElem"); + GraphElem::Register("LineElem"); + GraphElem::Register("RectElem"); + + // Falta el resto } \ No newline at end of file diff --git a/bazaar/Controls4U/DrawingCanvas.h b/bazaar/Controls4U/DrawingCanvas.h index 78edce351..1bc490efc 100644 --- a/bazaar/Controls4U/DrawingCanvas.h +++ b/bazaar/Controls4U/DrawingCanvas.h @@ -62,6 +62,7 @@ public: angle = a; return *this; } + void Xmlize(XmlIO &xml) {xml ("transX", transX)("transY", transY)("angle", angle)("scaleX", scaleX)("scaleY", scaleY);} private: double transX; @@ -86,13 +87,16 @@ public: SvgStyle &operator=(const SvgStyle &style); SvgStyle &operator+=(const SvgStyle &style); - SvgStyle &SetStrokeWidth(int c) {strokeWidth = c; return *this;} + SvgStyle &SetStrokeWidth(double c) {strokeWidth = c; return *this;} SvgStyle &SetStrokeColor(Color c) {strokeColor = c; return *this;} SvgStyle &SetFill(Color c) {fill = c; return *this;} SvgStyle &SetOpacity(double c) {opacity = c; return *this;} - + + void Xmlize(XmlIO &xml) {xml ("strokeWidth", strokeWidth)("strokeColor", strokeColor) + ("fill", fill)("opacity", opacity);} + public: - int strokeWidth; + double strokeWidth; Color strokeColor; Color fill; double opacity; @@ -135,15 +139,11 @@ public: } }; -class GraphElem : Moveable { +class GraphElem : public WithPolyXML, public Pte { public: GraphElem() {} GraphElem(const GraphElem &graph); - Svg2DTransform transf; - SvgStyle style; - GraphElemLimits limits; - virtual void Paint(Painter &sw, Svg2DTransform transf, SvgStyle style, bool firstLayer) {}; virtual void SetLimits() {}; virtual void PaintLimits(Painter &sw) { @@ -158,9 +158,14 @@ public: sw.Line(limits.left, limits.bottom).Opacity(0.3).Stroke(0.5, Black()); } virtual ~GraphElem() {}; + + virtual void Xmlize(XmlIO &xml) {xml ("transf", transf)("style", style)("limits", limits);} + + Svg2DTransform transf; + SvgStyle style; + GraphElemLimits limits; }; - class LineElem : public GraphElem { public: virtual void Paint(Painter &sw, Svg2DTransform _transf, SvgStyle _style, bool) { @@ -181,6 +186,8 @@ public: LineElem(double x1, double y1, double x2, double y2) : x1(x1), y1(y1), x2(x2), y2(y2) {SetLimits();} LineElem() {x1 = x2 = y1 = y2 = 0;} + void Xmlize(XmlIO &xml) {xml ("x1", x1)("y1", y1)("x2", x2)("y2", y2); } + //private: double x1, y1, x2, y2; }; @@ -205,6 +212,8 @@ public: RectElem(const Rect &rect) : x(rect.left), y(rect.top), width(rect.right - rect.left), height(rect.bottom - rect.top) {SetLimits();} RectElem() {x = y = width = height = 0;} + void Xmlize(XmlIO &xml) {xml ("x", x)("y", y)("width", width)("height", height);} + //private: double x, y, width, height; }; @@ -217,7 +226,7 @@ public: sw.Ellipse(x, y, width, height); _style += style; _style.Apply(sw); - PaintLimits(sw); + //PaintLimits(sw); } virtual void SetLimits() { limits.left = x - width; @@ -228,6 +237,8 @@ public: EllipseElem(double x, double y, double width, double height) : x(x), y(y), width(width), height(height) {SetLimits();} EllipseElem() {x = y = width = height = 0;} + void Xmlize(XmlIO &xml) {xml ("x", x)("y", y)("width", width)("height", height);} + //private: double x, y, width, height; }; @@ -254,6 +265,9 @@ public: width(width), height(height), fileName(fileName) {img = Null; SetLimits();} ImageElem() {x = y = width = height = 0; img = Null;} + void Xmlize(XmlIO &xml) {xml ("x", x)("y", y)("width", width)("height", height) + ("fileName", fileName)("img", img);} + //private: double x, y, width, height; String fileName; @@ -270,7 +284,7 @@ public: sw.Line(points[i].x, points[i].y); _style += style; _style.Apply(sw); - PaintLimits(sw); + //PaintLimits(sw); } virtual void SetLimits() { limits.Reset(); @@ -279,6 +293,8 @@ public: } PolygonElem() {} + void Xmlize(XmlIO &xml) {xml ("points", points);} + //private: Array points; }; @@ -293,7 +309,7 @@ public: sw.Text(0, 0, text, f); _style += style; _style.Apply(sw); - PaintLimits(sw); + //PaintLimits(sw); } virtual void SetLimits() { limits.left = 0; @@ -306,12 +322,15 @@ public: limits.right += fi[wtext[i]]; limits.bottom = limits.top + f.GetHeight(); } + TextElem(double x, double y, String text, Font f) : x(x), y(y), text(text), f(f) {factor = 1; SetLimits();} TextElem() { - factor = 20; + factor = 1; f.Face(Font::ARIAL); f.Height(12); } + void Xmlize(XmlIO &xml) {xml ("x", x)("y", y)("text", text)("font", font)("f", f)("factor", factor);} + //private: double x, y; String text; @@ -329,7 +348,7 @@ public: sw.Path(path); _style += style; _style.Apply(sw); - PaintLimits(sw); + //PaintLimits(sw); } bool ReadBool(CParser& p) { // Painter:: while(p.Char(',')); @@ -432,6 +451,8 @@ public: } PathElem() {} + void Xmlize(XmlIO &xml) {xml ("path", path);} + //private: String path; }; @@ -439,15 +460,17 @@ public: class GraphElemList : public GraphElem { public: - Array elems; + PolyXMLArray elems; String title; void Paint(Painter &sw, Svg2DTransform transf, SvgStyle style, bool firstLayer = false); void Clear(); + + void Xmlize(XmlIO &xml) {xml ("elems", elems);} }; - +/* class CanvasSelector { typedef CanvasSelector CLASSNAME; public: @@ -496,7 +519,7 @@ private: bool LoadSvg(DrawingCanvas &canvas, String fileName); - +*/ class PainterCanvas : public Ctrl { @@ -508,19 +531,20 @@ public: void Zoom(double factor); void Scroll(double factorX, double factorY); void FitInCanvas(); + Image GetImage(Size sz = Null); PainterCanvas &SetBackground(Color color) {backColor = color; Refresh(); return *this;}; PainterCanvas &SetBackground(const Image image); PainterCanvas &SetBackground(const String &imageFilename); - Image GetBackground() {return backImage;} - PainterCanvas &SetColorUnderBackgroundImage(bool set) {colorUnderBackgroundImage = set; return *this;}; + Image GetBackground() {return backImage;} + PainterCanvas &SetColorUnderBackgroundImage(bool set) {colorUnderBackgroundImage = set; return *this;}; PainterCanvas &SetScale(double factor) {scale *= factor; Refresh(); return *this;}; PainterCanvas &SetAlwaysFitInCanvas(bool fit = true){alwaysFitInCanvas = fit; Refresh(); return *this;} PainterCanvas &SetMode(int md = MODE_ANTIALIASED) {mode = md; return *this;} PainterCanvas &SetShowWindow(bool sw = true) {showWindow = sw; return *this;}; PainterCanvas &SetCursorImage(const Image &img) {cursorImage = img; return *this;}; - PainterCanvas &SetLegend(bool _legendShowXY, Font _legendFont); + PainterCanvas &SetLegend(bool _legendShowXY = true, Font _legendFont = StdFont()); GraphElemList elemList; @@ -530,6 +554,13 @@ public: Callback2 WhenMouseMove; Callback2 WhenMouseLeft; + void Xmlize(XmlIO &xml) {xml ("elemList", elemList)("translateX", translateX) + ("translateY", translateY)("rotate", rotate)("scale", scale)("opacity", opacity) + ("linejoin", linejoin)("linecap", linecap)("mode", mode)("scaleFactor", scaleFactor) + ("backImage", backImage)("backColor", backColor)("canvasSize", canvasSize) + ("colorUnderBackgroundImage", colorUnderBackgroundImage) + ("alwaysFitInCanvas", alwaysFitInCanvas)("showWindow", showWindow);} + protected: virtual void Paint(Draw& draw); virtual void Layout(); diff --git a/bazaar/Controls4U/FirefoxBrowser.cpp b/bazaar/Controls4U/FirefoxBrowser.cpp index f5524179e..e6fefc431 100644 --- a/bazaar/Controls4U/FirefoxBrowser.cpp +++ b/bazaar/Controls4U/FirefoxBrowser.cpp @@ -1,11 +1,10 @@ #ifdef _WIN32 #include - -using namespace Upp; - #include "ActiveX.h" +NAMESPACE_UPP + bool FirefoxBrowser::Browse(const String &strurl) { IIWebBrowser webBrowser(this); if (!webBrowser) @@ -171,4 +170,6 @@ bool FirefoxBrowser::Stop() { return false; } +END_UPP_NAMESPACE + #endif diff --git a/bazaar/Controls4U/IExplorerBrowser.cpp b/bazaar/Controls4U/IExplorerBrowser.cpp index 364dcafe9..cb705ef90 100644 --- a/bazaar/Controls4U/IExplorerBrowser.cpp +++ b/bazaar/Controls4U/IExplorerBrowser.cpp @@ -1,11 +1,10 @@ #ifdef _WIN32 #include - -using namespace Upp; - #include "ActiveX.h" +NAMESPACE_UPP + bool InternetExplorerBrowser::Browse(const String &strurl) { IIWebBrowser webBrowser(this); if (!webBrowser) @@ -171,4 +170,6 @@ bool InternetExplorerBrowser::Stop() { return false; } +END_UPP_NAMESPACE + #endif diff --git a/bazaar/Controls4U/SliderCtrlX.cpp b/bazaar/Controls4U/SliderCtrlX.cpp index a1460c96f..facc1dd00 100644 --- a/bazaar/Controls4U/SliderCtrlX.cpp +++ b/bazaar/Controls4U/SliderCtrlX.cpp @@ -13,11 +13,10 @@ **********************************************************************************************/ #include - -using namespace Upp; - #include "SliderCtrlX.h" +NAMESPACE_UPP + #define IMAGECLASS SliderThumbsImg #define IMAGEFILE #include @@ -573,3 +572,5 @@ int SliderCtrlX::SliderToClient(int v) const return v; } + +END_UPP_NAMESPACE \ No newline at end of file diff --git a/bazaar/Controls4U/SliderCtrlX.h b/bazaar/Controls4U/SliderCtrlX.h index b4f9b8162..d88d1f6e2 100644 --- a/bazaar/Controls4U/SliderCtrlX.h +++ b/bazaar/Controls4U/SliderCtrlX.h @@ -1,3 +1,5 @@ +NAMESPACE_UPP + class SliderCtrlX : public Ctrl { static const int BORDER_SIZE = 2; static const int BORDER1 = BORDER_SIZE; @@ -108,3 +110,5 @@ public: SliderCtrlX& SetThumbType(int n=0); SliderCtrlX& UseCustomThumbs( bool b = true ) { m_bUseCustomThumbs = b; return *this; }; }; + +END_UPP_NAMESPACE \ No newline at end of file diff --git a/bazaar/Controls4U/StarIndicator.cpp b/bazaar/Controls4U/StarIndicator.cpp index 135e54e15..d4201e583 100644 --- a/bazaar/Controls4U/StarIndicator.cpp +++ b/bazaar/Controls4U/StarIndicator.cpp @@ -19,12 +19,10 @@ **********************************************************************************************/ #include - -//NAMESPACE_UPP -using namespace Upp; - #include "StarIndicator.h" +NAMESPACE_UPP + #define IMAGECLASS StarsImg #define IMAGEFILE #include @@ -182,4 +180,4 @@ StarIndicator& StarIndicator::SetVotes(int n) return *this; } -//END_UPP_NAMESPACE +END_UPP_NAMESPACE diff --git a/bazaar/Controls4U/StarIndicator.h b/bazaar/Controls4U/StarIndicator.h index 199c0de3f..50e9aef9c 100644 --- a/bazaar/Controls4U/StarIndicator.h +++ b/bazaar/Controls4U/StarIndicator.h @@ -1,35 +1,38 @@ -#include - -class StarIndicator : public ProgressIndicator { -private: - bool m_bAlwaysShowValue; // True if value/votes must be always shown, not only if mouse over - bool m_bMouseInside; // True if mouse over the control - bool m_bTotal; // Shows the total (5) or not - bool m_bVotes; // Shows number of votes or not - Color m_FontColor; // Font color - int m_nVotes; // Number of votes - int m_nVotesHigh; // Number of Votes for Green - int m_nVotesLow; // Number of Votes for Red - -public: - StarIndicator(); - virtual ~StarIndicator(); - - virtual StarIndicator& AlwaysShowValue(bool b) { m_bAlwaysShowValue=b; return *this; } - virtual void MouseEnter(Point p, dword keyflags); - virtual void MouseLeave(); - virtual void MouseMove(Point p, dword keyflags) { Refresh(); } - virtual void Paint(Draw& draw); - virtual void Layout(); - virtual StarIndicator& SetFontColor(Color c) { m_FontColor=c; return *this; } - virtual void Set(double n); - virtual void Set(int n) { return Set((double)n); } - virtual void Set(int n, int tot) { return ProgressIndicator::Set(n, tot); } - virtual StarIndicator& SetVotes(int n); - virtual StarIndicator& SetVotesHigh(int n) { m_nVotesHigh=n; return *this; } - virtual StarIndicator& SetVotesLow(int n) { m_nVotesLow=n; return *this; } - virtual StarIndicator& ShowPercent(bool b) { percent=b; return *this; } - virtual StarIndicator& ShowTotal(bool b) { m_bTotal=b; return *this; } - virtual StarIndicator& ShowVotes(bool b) { m_bVotes=b; return *this; } -}; - +#include + +NAMESPACE_UPP + +class StarIndicator : public ProgressIndicator { +private: + bool m_bAlwaysShowValue; // True if value/votes must be always shown, not only if mouse over + bool m_bMouseInside; // True if mouse over the control + bool m_bTotal; // Shows the total (5) or not + bool m_bVotes; // Shows number of votes or not + Color m_FontColor; // Font color + int m_nVotes; // Number of votes + int m_nVotesHigh; // Number of Votes for Green + int m_nVotesLow; // Number of Votes for Red + +public: + StarIndicator(); + virtual ~StarIndicator(); + + virtual StarIndicator& AlwaysShowValue(bool b) { m_bAlwaysShowValue=b; return *this; } + virtual void MouseEnter(Point p, dword keyflags); + virtual void MouseLeave(); + virtual void MouseMove(Point p, dword keyflags) { Refresh(); } + virtual void Paint(Draw& draw); + virtual void Layout(); + virtual StarIndicator& SetFontColor(Color c) { m_FontColor=c; return *this; } + virtual void Set(double n); + virtual void Set(int n) { return Set((double)n); } + virtual void Set(int n, int tot) { return ProgressIndicator::Set(n, tot); } + virtual StarIndicator& SetVotes(int n); + virtual StarIndicator& SetVotesHigh(int n) { m_nVotesHigh=n; return *this; } + virtual StarIndicator& SetVotesLow(int n) { m_nVotesLow=n; return *this; } + virtual StarIndicator& ShowPercent(bool b) { percent=b; return *this; } + virtual StarIndicator& ShowTotal(bool b) { m_bTotal=b; return *this; } + virtual StarIndicator& ShowVotes(bool b) { m_bVotes=b; return *this; } +}; + +END_UPP_NAMESPACE \ No newline at end of file diff --git a/bazaar/Controls4U/VLCPlayer.cpp b/bazaar/Controls4U/VLCPlayer.cpp index 0e6f33921..85dd6cf96 100644 --- a/bazaar/Controls4U/VLCPlayer.cpp +++ b/bazaar/Controls4U/VLCPlayer.cpp @@ -1,11 +1,9 @@ #ifdef _WIN32 #include - -using namespace Upp; - #include "ActiveX.h" +NAMESPACE_UPP bool VLCPlayer::AddTarget(const String movie) { if (IsPlaying()) @@ -177,4 +175,6 @@ int VLCPlayer::GetLength() { return seconds; } +END_UPP_NAMESPACE + #endif diff --git a/bazaar/Controls4U/init b/bazaar/Controls4U/init index 7c425dc96..d81a29355 100644 --- a/bazaar/Controls4U/init +++ b/bazaar/Controls4U/init @@ -2,5 +2,6 @@ #define _Controls4U_icpp_init_stub #include "CtrlLib/init" #include "Functions4U/init" +#include "ClassFactory/init" #include "Painter/init" #endif diff --git a/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tpp b/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tpp index 56c29be26..e9e3c7c43 100644 --- a/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tpp +++ b/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tpp @@ -4,8 +4,10 @@ topic "News and changes log"; [{_}%EN-US [s0; [*R+184 Controls4U. News and changes log]&] [s0;%- &] -[ {{1441:8559f0;g0;^t/25b/25 [s0;# [2 2011/08/27]] -:: [s0; [2 Added PainterCanvas]] +[ {{1441:8559f0;g0;^t/25b/25 [s0;# [2 2012/07/03]] +:: [s0; [2 Included NAMESPACE`_UPP.]] +:: [s0;# [2 2011/08/27]] +:: [s0; [2 Added PainterCanvas (experimental)]] :: [s0;# [2 2011/07/26]] :: [s0; [2 Removed internal MyBufferPainter]] :: [s0;# [2 2011/07/24]] @@ -37,4 +39,4 @@ be refreshed as it runs by itself.]] by andrei`_natanael.]] :: [s0;# [2 2009/12/02]] :: [s0;# [2 Created Controls4U.]]}}&] -[s0; ] \ No newline at end of file +[s0; ]] \ No newline at end of file diff --git a/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tppi b/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tppi index 7295d88e5..a53e5ac9a 100644 --- a/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tppi +++ b/bazaar/Controls4U/srcdoc.tpp/ChangesLog$en-us.tppi @@ -1,6 +1,6 @@ TITLE("News and changes log") COMPRESSED -120,156,133,84,253,79,219,48,16,253,87,78,2,38,198,6,137,243,209,143,244,167,210,49,169,154,96,19,29,19,82,149,129,155,92,91,139,212,70,182,83,134,16,255,251,206,73,129,118,36,90,165,74,137,125,239,189,187,119,119,153,194,254,190,255,217,223,243,255,243,75,190,224,156,151,133,77,167,188,23,14,142,46,59,132,99,132,11,89,200,124,214,9,162,110,20,248,161,31,68,44,136,89,175,23,177,110,220,11,251,157,78,146,241,123,43,148,76,167,79,55,207,7,103,23,199,87,19,152,26,127,0,211,163,203,79,172,23,193,72,73,171,85,97,162,171,19,184,192,7,3,92,230,144,45,185,92,160,129,66,45,210,15,169,139,63,56,6,122,128,167,39,22,69,44,233,197,113,127,238,15,22,254,224,183,245,130,120,70,255,138,117,15,166,1,4,62,99,158,223,243,130,110,154,38,201,70,45,128,97,158,99,14,63,184,144,22,245,136,203,53,55,175,247,91,184,174,23,116,118,112,151,184,82,107,66,86,56,201,11,56,127,60,45,231,115,212,27,170,22,146,168,65,124,82,136, -156,180,173,46,174,171,50,39,150,235,177,204,69,198,173,106,225,97,172,129,103,108,126,113,162,58,252,120,210,4,10,189,32,220,1,141,42,55,9,118,246,231,190,80,26,245,169,86,15,6,53,72,190,66,176,10,198,85,105,104,255,185,127,207,238,59,95,27,83,250,38,213,12,178,186,151,141,184,78,51,110,130,150,92,176,165,113,121,12,51,43,214,120,253,194,99,26,137,98,47,220,37,162,169,129,149,202,17,140,144,139,130,10,90,106,228,121,213,49,224,121,46,220,248,57,246,21,141,175,120,187,61,60,255,73,254,213,211,85,209,143,41,106,41,12,100,220,32,156,35,89,2,100,92,78,140,75,110,64,42,11,6,165,33,186,181,176,143,47,253,179,34,27,21,42,187,115,133,12,75,167,226,50,17,117,60,119,245,112,139,121,75,33,91,67,178,247,102,201,171,11,5,55,6,223,155,224,247,61,22,120,65,127,199,132,58,149,241,138,47,16,242,122,85,97,198,179,187,133,86,165,91,40,69,141,117,105,89,205,165,185,231,26,165,221,41,126,11,159,108,242,184,50,56,52,167, -175,28,135,31,171,154,245,102,29,170,208,175,194,222,38,201,91,76,91,174,241,238,121,171,111,165,113,75,143,198,144,140,81,165,206,218,203,15,219,41,93,183,104,38,182,153,19,106,45,146,163,238,58,87,88,183,71,34,213,65,1,51,36,185,57,41,46,233,157,192,194,130,46,165,129,217,35,61,26,44,230,45,57,176,184,169,125,36,251,93,11,242,151,187,193,219,184,70,135,103,50,55,244,86,186,41,5,148,229,202,73,153,114,65,223,57,154,16,39,70,129,26,197,237,141,228,150,75,142,239,247,168,150,245,131,221,243,17,13,180,99,216,250,146,166,233,243,115,221,92,72,255,2,7,222,201,172, +120,156,133,84,253,111,218,48,16,253,87,44,177,78,180,91,27,231,139,143,240,19,101,76,66,19,29,42,99,170,132,178,214,36,7,88,13,54,178,29,218,170,234,255,190,51,161,45,89,19,13,9,41,137,239,189,187,123,247,206,115,242,233,19,253,74,27,244,63,191,232,27,44,89,158,153,120,206,58,126,239,236,186,133,56,23,113,190,235,187,212,109,121,65,59,240,168,79,189,192,245,66,183,211,9,220,118,216,241,187,173,86,148,176,173,225,82,196,243,231,219,151,147,225,213,249,108,74,230,154,246,200,252,236,250,139,219,9,200,64,10,163,100,166,131,217,5,185,130,7,77,152,72,73,178,102,98,5,154,100,114,21,127,142,109,252,201,57,193,7,242,252,236,6,129,27,117,194,176,187,164,189,21,237,253,49,142,23,46,240,191,103,109,144,185,71,60,234,122,14,109,59,212,143,227,40,58,100,243,200,72,36,89,158,66,74,174,250,227,225,116,210,31,12,239,110,103,147,201,197,91,208,43,216,117,104,199,241,218,37,112,63,181,200,9,227,194,128,26,48,177,99,154,52,225,113, +11,138,111,64,24,150,157,86,209,180,29,175,85,162,185,134,141,220,33,209,158,70,176,140,140,159,46,243,229,18,212,129,185,134,36,168,168,101,154,241,20,75,49,42,187,217,75,54,53,76,141,68,202,19,102,100,13,143,235,86,240,140,244,111,134,84,205,211,74,33,124,199,43,171,56,216,79,6,97,195,199,109,38,21,168,75,37,31,52,40,34,216,6,136,145,40,179,109,13,204,63,231,31,217,169,149,185,178,164,31,66,46,72,82,248,162,18,215,170,198,77,193,160,10,38,215,182,142,126,98,248,14,110,94,121,116,37,81,232,248,101,34,116,32,217,200,20,136,230,98,149,97,67,107,5,44,221,79,140,176,52,229,214,202,150,125,131,171,192,223,79,155,227,95,168,95,225,212,70,97,54,60,228,154,36,76,3,25,3,74,66,80,184,20,25,215,232,28,33,13,209,32,52,210,237,184,121,122,157,159,225,201,32,147,201,189,109,164,159,219,44,182,18,94,196,51,219,15,51,144,214,52,114,100,146,198,187,36,111,42,100,76,107,248,40,2,237,58,184,44,94,183,36,66,81,202, +104,195,86,64,210,98,237,201,130,37,247,43,37,115,187,156,18,7,107,203,50,138,9,189,101,10,23,160,212,252,17,62,58,212,49,211,208,215,151,111,28,205,211,125,207,234,176,14,251,208,239,220,220,69,209,123,76,93,173,97,249,123,173,110,185,182,23,8,104,141,105,180,204,85,82,223,190,95,79,105,167,133,158,56,102,142,112,180,128,138,218,227,84,66,49,30,1,216,7,6,44,0,211,45,49,227,26,223,17,204,13,81,185,208,100,241,132,143,26,178,101,77,13,110,88,53,62,76,251,83,113,123,193,88,227,29,84,195,143,67,145,106,124,203,173,75,9,136,124,99,83,233,124,133,119,38,58,196,38,195,64,5,252,238,86,48,195,4,131,143,123,84,164,165,94,249,251,0,13,109,25,142,110,229,56,126,121,41,134,75,226,248,47,246,236,223,247,