diff --git a/src/tools/toolbox.cpp b/src/tools/toolbox.cpp index 54bbef0f6..98182bf49 100644 --- a/src/tools/toolbox.cpp +++ b/src/tools/toolbox.cpp @@ -18,6 +18,7 @@ #include "config.h" +#include #include #include #include @@ -93,12 +94,12 @@ ToolBox::~ToolBox() { PRINTF("Toolbox module: uninstalling\n"); - for_each(m_tools.begin(), m_tools.end(), deleter()); - for_each(m_groups.begin(), m_groups.end(), deleter()); - for_each(m_intertwiners.begin(), m_intertwiners.end(), deleter()); - for_each(m_pointshapers.begin(), m_pointshapers.end(), deleter()); - for_each(m_controllers.begin(), m_controllers.end(), deleter()); - for_each(m_inks.begin(), m_inks.end(), deleter()); + std::for_each(m_tools.begin(), m_tools.end(), deleter()); + std::for_each(m_groups.begin(), m_groups.end(), deleter()); + std::for_each(m_intertwiners.begin(), m_intertwiners.end(), deleter()); + std::for_each(m_pointshapers.begin(), m_pointshapers.end(), deleter()); + std::for_each(m_controllers.begin(), m_controllers.end(), deleter()); + std::for_each(m_inks.begin(), m_inks.end(), deleter()); PRINTF("Toolbox module: uninstalled\n"); } diff --git a/third_party/vaca/include/Vaca/Debug.h b/third_party/vaca/include/Vaca/Debug.h index e52340231..9d67a0144 100644 --- a/third_party/vaca/include/Vaca/Debug.h +++ b/third_party/vaca/include/Vaca/Debug.h @@ -58,6 +58,11 @@ void VACA_DLL trace(const char* filename, size_t line, const char* msg, ...); void VACA_DLL closeLogFile(); #ifndef __GNUC__ + +#include + +#pragma warning(disable: 4996) + /** @internal Dirty trick for compilers that does not support @@ -75,12 +80,14 @@ struct trace_t { Vaca::details::trace(filename, line, buf); } }; + inline trace_t make_trace(const char* filename, size_t line) { trace_t tmp; tmp.filename = filename; tmp.line = line; return tmp; } + #endif } // namespace details diff --git a/third_party/vaca/include/Vaca/Point.h b/third_party/vaca/include/Vaca/Point.h index fffcda09e..eb1e88e57 100644 --- a/third_party/vaca/include/Vaca/Point.h +++ b/third_party/vaca/include/Vaca/Point.h @@ -34,6 +34,11 @@ #include "Vaca/base.h" +#ifdef VACA_WINDOWS + struct tagPOINT; + struct tagPOINTS; +#endif + namespace Vaca { /** @@ -69,9 +74,9 @@ public: bool operator!=(const Point& pt) const; #ifdef VACA_WINDOWS - explicit Point(CONST LPPOINT pt); - explicit Point(CONST LPPOINTS pt); - operator POINT() const; + explicit Point(const tagPOINT* pt); + explicit Point(const tagPOINTS* pt); + operator tagPOINT() const; #endif }; diff --git a/third_party/vaca/include/Vaca/Rect.h b/third_party/vaca/include/Vaca/Rect.h index 81cf32533..233812d0a 100644 --- a/third_party/vaca/include/Vaca/Rect.h +++ b/third_party/vaca/include/Vaca/Rect.h @@ -34,6 +34,10 @@ #include "Vaca/base.h" +#ifdef VACA_WINDOWS + struct tagRECT; +#endif + namespace Vaca { /** @@ -110,8 +114,8 @@ public: bool operator!=(const Rect& rc) const; #ifdef VACA_WINDOWS - explicit Rect(LPCRECT rc); - operator RECT() const; + explicit Rect(const tagRECT* rc); + operator tagRECT() const; #endif }; diff --git a/third_party/vaca/include/Vaca/Size.h b/third_party/vaca/include/Vaca/Size.h index 9ba966e51..21aff9a4f 100644 --- a/third_party/vaca/include/Vaca/Size.h +++ b/third_party/vaca/include/Vaca/Size.h @@ -34,6 +34,10 @@ #include "Vaca/base.h" +#ifdef VACA_WINDOWS + struct tagSIZE; +#endif + namespace Vaca { /** @@ -72,8 +76,8 @@ public: bool operator!=(const Size& sz) const; #ifdef VACA_WINDOWS - explicit Size(CONST LPSIZE sz); - operator SIZE() const; + explicit Size(const tagSIZE* sz); + operator tagSIZE() const; #endif }; diff --git a/third_party/vaca/include/Vaca/base.h b/third_party/vaca/include/Vaca/base.h index 5f6ed67ad..ba49dd983 100644 --- a/third_party/vaca/include/Vaca/base.h +++ b/third_party/vaca/include/Vaca/base.h @@ -37,62 +37,18 @@ #define VACA_WINDOWS #endif -#pragma warning(disable: 4251) -#pragma warning(disable: 4275) -#pragma warning(disable: 4355) -#pragma warning(disable: 4996) -#include -#include #include -#ifdef VACA_WINDOWS - #include - #include -#endif #include "Vaca/Enum.h" -// memory leaks -#ifdef MEMORY_LEAK_DETECTOR - #include "debug_new.h" -#endif - namespace Vaca { #define VACA_VERSION 0 #define VACA_SUB_VERSION 0 #define VACA_WIP_VERSION 8 -/** - @def VACA_MAIN() - @brief Defines the name and arguments that the main routine - of the program should contain. - - You can use it as: - @code - int VACA_MAIN() - { - ... - } - @endcode - - @win32 - It is the signature of @msdn{WinMain}. In other - operating systems this could be @c "main(int argc, char* argv[])". - @endwin32 -*/ -#ifdef VACA_WINDOWS - #define VACA_MAIN() \ - PASCAL WinMain(HINSTANCE hInstance, \ - HINSTANCE hPrevInstance, \ - LPSTR lpCmdLine, \ - int nCmdShow) -#else - #define VACA_MAIN() \ - int main(int argc, char* argv[]) -#endif - /** @def VACA_DLL @brief Used to export/import symbols to/from the dynamic library. @@ -374,13 +330,16 @@ template void remove_from_container(ContainerType& container, typename ContainerType::const_reference element) { - typename ContainerType::iterator - it = std::find(container.begin(), - container.end(), - element); - - if (it != container.end()) - container.erase(it); + for (typename ContainerType::iterator + it = container.begin(), + end = container.end(); it != end; ) { + if (*it == element) { + it = container.erase(it); + end = container.end(); + } + else + ++it; + } } // ====================================================================== diff --git a/third_party/vaca/src/Point.cpp b/third_party/vaca/src/Point.cpp index 004645838..4f76f6b7f 100644 --- a/third_party/vaca/src/Point.cpp +++ b/third_party/vaca/src/Point.cpp @@ -32,6 +32,10 @@ #include "Vaca/Point.h" #include "Vaca/Size.h" +#ifdef VACA_WINDOWS +#include +#endif + using namespace Vaca; Point::Point() @@ -154,19 +158,19 @@ bool Point::operator!=(const Point& pt) const #ifdef VACA_WINDOWS -Point::Point(CONST LPPOINT pt) +Point::Point(const tagPOINT* pt) { x = pt->x; y = pt->y; } -Point::Point(CONST LPPOINTS pt) +Point::Point(const tagPOINTS* pt) { x = pt->x; y = pt->y; } -Point::operator POINT() const +Point::operator tagPOINT() const { POINT pt; pt.x = x; diff --git a/third_party/vaca/src/Rect.cpp b/third_party/vaca/src/Rect.cpp index 41744ab58..6e97ea5d3 100644 --- a/third_party/vaca/src/Rect.cpp +++ b/third_party/vaca/src/Rect.cpp @@ -33,6 +33,10 @@ #include "Vaca/Point.h" #include "Vaca/Size.h" +#ifdef VACA_WINDOWS +#include +#endif + using namespace Vaca; /** @@ -422,7 +426,7 @@ bool Rect::operator!=(const Rect& rc) const @internal */ -Rect::Rect(LPCRECT rc) +Rect::Rect(const tagRECT rc) { x = rc->left; y = rc->top; @@ -436,9 +440,9 @@ Rect::Rect(LPCRECT rc) @internal */ -Rect::operator RECT() const +Rect::operator tagRECT() const { - RECT rc; + tagRECT rc; rc.left = x; rc.top = y; rc.right = x+w; diff --git a/third_party/vaca/src/Size.cpp b/third_party/vaca/src/Size.cpp index 53eb90a7a..33546f54c 100644 --- a/third_party/vaca/src/Size.cpp +++ b/third_party/vaca/src/Size.cpp @@ -32,6 +32,10 @@ #include "Vaca/Size.h" #include "Vaca/Point.h" +#ifdef VACA_WINDOWS +#include +#endif + using namespace Vaca; Size::Size() @@ -166,15 +170,15 @@ bool Size::operator!=(const Size& sz) const #ifdef VACA_WINDOWS -Size::Size(CONST LPSIZE sz) +Size::Size(const tagSIZE* sz) { w = sz->cx; h = sz->cy; } -Size::operator SIZE() const +Size::operator tagSIZE() const { - SIZE sz; + tagSIZE sz; sz.cx = w; sz.cy = h; return sz;