From ed1bbdd32db857295b4cfa615946ac71e47edb8f Mon Sep 17 00:00:00 2001 From: koldo Date: Mon, 2 Sep 2019 06:30:11 +0000 Subject: [PATCH] Controls4U: Removed multiple warnings got using compiler pedantic options git-svn-id: svn://ultimatepp.org/upp/trunk@13570 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/Controls4U/ActiveX.h | 12 +- bazaar/Controls4U/ActiveX_base.h | 4 +- bazaar/Controls4U/Controls4U.cpp | 227 +++++++++--------- bazaar/Controls4U/Controls4U.h | 22 +- bazaar/Controls4U/PainterCanvas.cpp | 8 +- bazaar/Controls4U/PainterCanvas.h | 17 +- bazaar/Controls4U/StarIndicator.h | 4 +- .../src.tpp/EditFileFolder_en-us.tpp | 3 +- .../src.tpp/EditFileFolder_en-us.tppi | 32 +-- 9 files changed, 169 insertions(+), 160 deletions(-) diff --git a/bazaar/Controls4U/ActiveX.h b/bazaar/Controls4U/ActiveX.h index 8f04cd392..c810043f1 100644 --- a/bazaar/Controls4U/ActiveX.h +++ b/bazaar/Controls4U/ActiveX.h @@ -21,7 +21,7 @@ static const CLSID CLSID_MozillaBrowser = {0x1339B54C, 0x3453, 0x11D2, {0x93, 0x class FirefoxBrowser : public DHCtrlActiveX { public: - FirefoxBrowser(bool status = true) : DHCtrlActiveX(CLSID_MozillaBrowser, "Firefox", status) {}; + FirefoxBrowser(bool _status = true) : DHCtrlActiveX(CLSID_MozillaBrowser, "Firefox", _status) {}; virtual ~FirefoxBrowser() {}; bool Browse(const String &url); @@ -42,7 +42,7 @@ private: public: IIWebBrowser(FirefoxBrowser *obj) { if (obj->GetStatus()) - web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2); + web = static_cast(obj->QueryInterface(IID_IWebBrowser2)); else web = 0; } @@ -59,7 +59,7 @@ private: class InternetExplorerBrowser : public DHCtrlActiveX { public: - InternetExplorerBrowser(bool status = true) : DHCtrlActiveX(CLSID_WebBrowser, "IExplorer", status) {}; + InternetExplorerBrowser(bool _status = true) : DHCtrlActiveX(CLSID_WebBrowser, "IExplorer", _status) {}; virtual ~InternetExplorerBrowser() {}; bool Browse(const String &url); @@ -80,7 +80,7 @@ private: public: IIWebBrowser(InternetExplorerBrowser *obj) { if (obj->GetStatus()) - web = (IWebBrowser2 *)obj->QueryInterface(IID_IWebBrowser2); + web = static_cast(obj->QueryInterface(IID_IWebBrowser2)); else web = 0; } @@ -100,7 +100,7 @@ static const CLSID CLSID_VLCPLayer = {0x9BE31822, 0xFDAD, 0x461B, {0xAD, 0x51, 0 class VLCPlayer : public DHCtrlActiveX { public: - VLCPlayer(bool status = true) : DHCtrlActiveX(CLSID_VLCPLayer, "VLCPlayer", status) {}; + VLCPlayer(bool _status = true) : DHCtrlActiveX(CLSID_VLCPLayer, "VLCPlayer", _status) {}; virtual ~VLCPlayer() {}; bool AddTarget(const String movie); @@ -124,7 +124,7 @@ private: public: IIVLC(VLCPlayer *obj) { if (obj->GetStatus()) - vlc = (IVLCControl *)obj->QueryInterface(IID_IVLCControl); + vlc = static_cast(obj->QueryInterface(IID_IVLCControl)); else vlc = 0; } diff --git a/bazaar/Controls4U/ActiveX_base.h b/bazaar/Controls4U/ActiveX_base.h index 5418d102e..f528add73 100644 --- a/bazaar/Controls4U/ActiveX_base.h +++ b/bazaar/Controls4U/ActiveX_base.h @@ -24,7 +24,7 @@ public: operator BSTR *() {return &bstr;} operator BSTR () {return bstr;} String ToString() { - WString ret((wchar *)bstr); + WString ret(static_cast(bstr)); return ret.ToString(); } private: @@ -34,7 +34,7 @@ private: class AXClientSite : public IOleClientSite, public IOleInPlaceFrame, public IOleInPlaceSite { public: AXClientSite() {} - AXClientSite(HWND hwnd):hwnd(hwnd){} + AXClientSite(HWND _hwnd) : hwnd(_hwnd){} virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject); virtual ULONG STDMETHODCALLTYPE AddRef(); diff --git a/bazaar/Controls4U/Controls4U.cpp b/bazaar/Controls4U/Controls4U.cpp index dd66870b8..02a737e55 100644 --- a/bazaar/Controls4U/Controls4U.cpp +++ b/bazaar/Controls4U/Controls4U.cpp @@ -106,8 +106,8 @@ EditFileFolder &EditFileFolder::UseHistory(bool use) { EditFileFolder &EditFileFolder::UseUp(bool use) { if (use) { if (EditString::FindFrame(butUp) == -1) { - int pos = EditString::FindFrame(butRight); - EditString::InsertFrame(pos+1, butUp); + int _pos = EditString::FindFrame(butRight); + EditString::InsertFrame(_pos+1, butUp); } } else EditString::RemoveFrame(butUp); @@ -117,10 +117,10 @@ EditFileFolder &EditFileFolder::UseUp(bool use) { EditFileFolder &EditFileFolder::UseBrowse(bool use) { if (use) { if (EditString::FindFrame(butBrowseLeft) == -1) { - int pos = EditString::FindFrame(butUp); - if (pos == -1) - pos = EditString::FindFrame(butRight); - EditString::InsertFrame(pos+1, butBrowseLeft); + int _pos = EditString::FindFrame(butUp); + if (_pos == -1) + _pos = EditString::FindFrame(butRight); + EditString::InsertFrame(_pos+1, butBrowseLeft); } } else EditString::RemoveFrame(butBrowseLeft); @@ -130,8 +130,8 @@ EditFileFolder &EditFileFolder::UseBrowse(bool use) { EditFileFolder &EditFileFolder::UseBrowseRight(bool use) { if (use) { if (EditString::FindFrame(butBrowseRight) == -1) { - int pos = EditString::FindFrame(butRight); - EditString::InsertFrame(pos+1, butBrowseRight); + int _pos = EditString::FindFrame(butRight); + EditString::InsertFrame(_pos+1, butBrowseRight); } } else EditString::RemoveFrame(butBrowseRight); @@ -141,8 +141,8 @@ EditFileFolder &EditFileFolder::UseBrowseRight(bool use) { EditFileFolder &EditFileFolder::UseGo(bool use) { if (use) { if (EditString::FindFrame(butGo) == -1) { - int pos = EditString::FindFrame(butRight); - EditString::InsertFrame(pos+1, butGo); + int _pos = EditString::FindFrame(butRight); + EditString::InsertFrame(_pos+1, butGo); } } else EditString::RemoveFrame(butGo); @@ -199,10 +199,11 @@ void EditFileFolder::DoGo(bool add) { if (histInd >= history.GetCount()-1) butRight.Enable(false); } - AddHistory(); - WhenChange(); - //WhenAction(); - Accept(); + if (WhenChange()) { + AddHistory(); + //WhenAction(); + Accept(); + } } void EditFileFolder::DoLeft() { @@ -238,8 +239,11 @@ EditFile::EditFile() { EditFileFolder(); butBrowseRight.Tip(t_("Browse file")); butFolder.WhenAction = [&] { - String folder = GetFileFolder(String(GetData())); - if (!DirectoryExists(folder)) + String fileName = GetData(); + String folder = GetFileFolder(fileName); + if (Trim(fileName).IsEmpty()) + Exclamation(t_("No file set")); + else if (!DirectoryExists(folder)) Exclamation(::Format(t_("Folder '%s' does not exist"), DeQtf(folder))); else { if (folder.StartsWith("\\")) @@ -252,12 +256,14 @@ EditFile::EditFile() { EditFolder::EditFolder() { isFile = false; - title = t_("Select directory"); + title = t_("Select folder"); EditFileFolder(); butBrowseRight.Tip(t_("Browse folder")); butFolder.WhenAction = [&] { String folder = GetData(); - if (!DirectoryExists(folder)) + if (Trim(folder).IsEmpty()) + Exclamation(t_("No folder set")); + else if (!DirectoryExists(folder)) Exclamation(::Format(t_("Folder '%s' does not exist"), DeQtf(folder))); else LaunchWebBrowser(folder);}; @@ -280,8 +286,8 @@ void ImagePopUp::Paint(Draw &w) { switch (fit) { case StaticImage::BestFit: { - Rect rect = FitInFrame(sz, imagesize); - sz = rect.GetSize(); + Rect _rect = FitInFrame(sz, imagesize); + sz = _rect.GetSize(); w.DrawImage(sz, image); break; } case StaticImage::FillFrame: @@ -292,8 +298,8 @@ void ImagePopUp::Paint(Draw &w) { break; case StaticImage::RepeatToFill: for (int left = 0; left < sz.cx; left += imagesize.cx) - for (int top = 0; top < sz.cy; top += imagesize.cy) - w.DrawImage(left, top, image); + for (int _top = 0; _top < sz.cy; _top += imagesize.cy) + w.DrawImage(left, _top, image); break; } @@ -390,7 +396,7 @@ void ImagePopUp::Close() { Ctrl::Close(); } -void StaticImage::MouseEnter(Point pos, dword keyflags) { +void StaticImage::MouseEnter(Point, dword) { if (isPopUp) { Point pt = GetScreenRect().TopLeft(); popup.PopUp(this, pt.x, pt.y, szPopUp.cx, szPopUp.cy, origImage, angle, fit); @@ -405,7 +411,7 @@ void StaticImage::MouseLeave() { void StaticImage::Layout() { if (useAsBackground) { //Ctrl *q = GetFirstChild(); - SetFirstChild((Ctrl *)this); + SetFirstChild(static_cast(this)); SizePos(); } } @@ -449,8 +455,8 @@ void StaticImage::Paint(Draw& w) { break; case StaticImage::RepeatToFill: for (int left = 0; left < sz.cx; left += imagesize.cx) - for (int top = 0; top < sz.cy; top += imagesize.cy) - w.DrawImage(left, top, *imageView); + for (int _top = 0; _top < sz.cy; _top += imagesize.cy) + w.DrawImage(left, _top, *imageView); break; } } @@ -492,21 +498,21 @@ StaticImage& StaticImage::SetAngle(int _angle) { return *this; } -void StaticImage::RightDown(Point pos, dword keyflags) { +void StaticImage::RightDown(Point , dword ) { if(!IsEditable()) return; WhenRightDown(); } -void StaticImage::LeftDown(Point pos, dword keyflags) { +void StaticImage::LeftDown(Point , dword ) { if(!IsEditable()) return; WhenLeftDown(); } -void StaticImage::LeftDouble(Point pos, dword keyflags) { +void StaticImage::LeftDouble(Point , dword ) { if(!IsEditable()) return; @@ -540,7 +546,7 @@ void StaticImageSet::Paint(Draw& w) { w.DrawImage(FitInFrame(sz, imagesize), images[id]); } -void StaticImageSet::LeftDown(Point pos, dword keyflags) +void StaticImageSet::LeftDown(Point , dword ) { if(!IsEditable()) return; @@ -552,13 +558,13 @@ void StaticImageSet::LeftDown(Point pos, dword keyflags) Refresh(); } -void StaticImageSet::LeftRepeat(Point pos, dword keyflags) +void StaticImageSet::LeftRepeat(Point _pos, dword keyflags) { if(!HasCapture()) - LeftDown(pos, keyflags); + LeftDown(_pos, keyflags); } -void StaticImageSet::LeftUp(Point pos, dword keyflags) +void StaticImageSet::LeftUp(Point , dword ) { if (!HasCapture()) return; @@ -566,7 +572,7 @@ void StaticImageSet::LeftUp(Point pos, dword keyflags) Refresh(); } -void StaticImageSet::MouseMove(Point pos, dword keyflags) +void StaticImageSet::MouseMove(Point , dword ) { if(!HasCapture()) return; @@ -739,7 +745,7 @@ void PaintArrowEnd(Painter &sw, double x0, double y0, double x1, double y1, int sw.Move(x0, y0).Line(x0 + alen, y0 - awidth).Line(x0 + alen, y0 + awidth).Line(x0, y0); sw.Fill(color); } else { - double t = atan((y1-y0)/(double)(x1-x0)); + double t = atan((y1-y0)/static_cast(x1-x0)); double xa = alen*cos(t); double ya = alen*sin(t); double xb = awidth*sin(t); @@ -817,7 +823,7 @@ void StaticArrow::FramePaint(Draw& w, const Rect& rr) { x0 += 8*width; } else { PaintArrowEnd(sw, x0, y0, x1, y1, width, color, true); - double t = atan((y1-y0)/(double)(x1-x0)); + double t = atan((y1-y0)/static_cast(x1-x0)); x0 += 8*width*cos(t); y0 += 8*width*sin(t); } @@ -831,7 +837,7 @@ void StaticArrow::FramePaint(Draw& w, const Rect& rr) { x1 -= 8*width; } else { PaintArrowEnd(sw, x1, y1, x0, y0, width, color, false); - double t = atan((y1-y0)/(double)(x1-x0)); + double t = atan((y1-y0)/static_cast(x1-x0)); x1 -= 8*width*cos(t); y1 -= 8*width*sin(t); } @@ -909,9 +915,9 @@ StaticArrow::StaticArrow() { ends = EndLeft; } -void StaticClock::PaintPtr(BufferPainter &w, double cmx, double cmy, double pos, double m, double d, Color color, double cf) { - double dx = m * sin(pos * 2 * M_PI); - double dy = m * cos(pos * 2 * M_PI); +void StaticClock::PaintPtr(BufferPainter &w, double cmx, double cmy, double _pos, double m, double d, Color color, double cf) { + double dx = m * sin(_pos * 2 * M_PI); + double dy = m * cos(_pos * 2 * M_PI); double sx = cmx - dx * 35 / 2.0; double sy = cmy + dy * 35 / 2.0; @@ -986,16 +992,16 @@ void StaticClock::Paint(Draw& ww) { double numberd = numberPos - 0.2; Font fnt, fnt4; if (numberType == StaticClock::Small) { - fnt4 = Arial((int)(14*bigF)); - fnt = Arial((int)(14*bigF)); + fnt4 = Arial(static_cast(14*bigF)); + fnt = Arial(static_cast(14*bigF)); } else if (numberType == StaticClock::Big) { - fnt4 = Arial((int)(20*bigF)); - fnt = Arial((int)(20*bigF)); + fnt4 = Arial(static_cast(20*bigF)); + fnt = Arial(static_cast(20*bigF)); } else if (numberType == StaticClock::BigSmall) { - fnt4 = Arial((int)(20*bigF)); - fnt = Arial((int)(14*bigF)); + fnt4 = Arial(static_cast(20*bigF)); + fnt = Arial(static_cast(14*bigF)); } else if (numberType == StaticClock::Big4) { - fnt4 = Arial((int)(20*bigF)); + fnt4 = Arial(static_cast(20*bigF)); } for(int i = 1; i <= 12; i++) { double x = cmx + (numberd * sin(i * M_PI / 6.0) * cf); @@ -1043,7 +1049,7 @@ StaticClock& StaticClock::SetImage(String _fileName) { } void StaticClock::SetData(const Value& v) { - SetTime((Time) v); + SetTime(static_cast