diff --git a/libjcore/Make.files b/libjcore/Make.files index 927f921a6..35f034235 100644 --- a/libjcore/Make.files +++ b/libjcore/Make.files @@ -132,7 +132,6 @@ .cpp ./code/JBroadcastSnooper .cpp ./code/JMDIServer .cpp ./code/JUpdateChecker -.cpp ./code/jMouseUtil .cpp ./code/JStopWatch .cpp ./code/jSysUtil_UNIX .cpp ./code/jTime diff --git a/libjcore/code/JCoreLibVersion.h b/libjcore/code/JCoreLibVersion.h index 7e3c62c57..cbed304a9 100644 --- a/libjcore/code/JCoreLibVersion.h +++ b/libjcore/code/JCoreLibVersion.h @@ -43,6 +43,7 @@ static const char* kCurrentJCoreLibVersionStr = "4.1.0"; // jMath: // *** Removed kJPi & kJE in favor of std::numbers. // Removed unused constant kJLog10ToLog2. +// Removed JLAbs() in favor of labs(). // JString: // Switched to an exponential reallocation model. // *** Adjusted ctor to use NormalizeData enum instead of bool. diff --git a/libjcore/code/jMath.h b/libjcore/code/jMath.h index ccaaec7d9..c2b3c3f34 100644 --- a/libjcore/code/jMath.h +++ b/libjcore/code/jMath.h @@ -45,15 +45,6 @@ JLCeil return JRound( ceil(x) ); } -inline long -JLAbs - ( - const long x - ) -{ - return (x >= 0 ? x : -x); -} - inline long JTruncate ( diff --git a/libjcore/code/jMouseUtil.cpp b/libjcore/code/jMouseUtil.cpp deleted file mode 100644 index c12cd74f2..000000000 --- a/libjcore/code/jMouseUtil.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/****************************************************************************** - jMouseUtil.cpp - - Useful functions for dealing with the mouse cursor. - - Copyright (C) 2003 by John Lindal. - - ******************************************************************************/ - -#include "jMouseUtil.h" -#include "jAssert.h" - -/****************************************************************************** - JMouseMoved - - Returns true if the points are further apart than the debounce width. - - ******************************************************************************/ - -bool -JMouseMoved - ( - const JPoint& pt1, - const JPoint& pt2, - const JCoordinate debounceWidth - ) -{ - return JLAbs(pt2.x - pt1.x) > debounceWidth || - JLAbs(pt2.y - pt1.y) > debounceWidth; -} diff --git a/libjcore/code/jMouseUtil.h b/libjcore/code/jMouseUtil.h index 9cfe02ee5..d8bdda572 100644 --- a/libjcore/code/jMouseUtil.h +++ b/libjcore/code/jMouseUtil.h @@ -10,7 +10,23 @@ #include "JPoint.h" -bool JMouseMoved(const JPoint& pt1, const JPoint& pt2, - const JCoordinate debounceWidth = 3); +/****************************************************************************** + JMouseMoved + + Returns true if the points are further apart than the debounce width. + + ******************************************************************************/ + +inline bool +JMouseMoved + ( + const JPoint& pt1, + const JPoint& pt2, + const JCoordinate debounceWidth = 3 + ) +{ + return (labs(pt2.x - pt1.x) > debounceWidth || + labs(pt2.y - pt1.y) > debounceWidth); +} #endif diff --git a/libjcore/libjcore.jcc b/libjcore/libjcore.jcc index a2c38ea79..79fe156df 100644 --- a/libjcore/libjcore.jcc +++ b/libjcore/libjcore.jcc @@ -733,10 +733,6 @@ T F "./code/JUpdateChecker.cpp" T -2 "jMouseUtil.cpp" -F -"./code/jMouseUtil.cpp" -T 2 "JStopWatch.cpp" F "./code/JStopWatch.cpp" diff --git a/libjcore/test/code/test_jMath.cpp b/libjcore/test/code/test_jMath.cpp index 4315434f4..cc583504b 100644 --- a/libjcore/test/code/test_jMath.cpp +++ b/libjcore/test/code/test_jMath.cpp @@ -56,9 +56,3 @@ JTEST(Truncate) JAssertEqual(4, JTruncate(4.3)); JAssertEqual(4, JTruncate(4.9)); } - -JTEST(Abs) -{ - JAssertEqual(5, JLAbs(5)); - JAssertEqual(5, JLAbs(-5)); -} diff --git a/libjx/code/JXMenuTable.cpp b/libjx/code/JXMenuTable.cpp index 0a29e9a9a..2a336175e 100644 --- a/libjx/code/JXMenuTable.cpp +++ b/libjx/code/JXMenuTable.cpp @@ -686,8 +686,8 @@ JXMenuTable::MenuSelectItem if (submenu != nullptr && (!checkMovement || - (JLAbs(itsCurrPt.x - itsPrevPt.x) <= kMoveSlowDelta && - JLAbs(itsCurrPt.y - itsPrevPt.y) <= kMoveSlowDelta))) + (labs(itsCurrPt.x - itsPrevPt.x) <= kMoveSlowDelta && + labs(itsCurrPt.y - itsPrevPt.y) <= kMoveSlowDelta))) { if (itsOpenSubmenu != nullptr) { diff --git a/libjx/code/JXWindow.cpp b/libjx/code/JXWindow.cpp index 1f45296d7..6f4038f33 100644 --- a/libjx/code/JXWindow.cpp +++ b/libjx/code/JXWindow.cpp @@ -1384,8 +1384,8 @@ JXWindow::AnalyzeWindowManager WaitForWM(d, w); assert( w->itsIsMappedFlag ); - if (JLAbs(w->itsWMFrameLoc.x - p) > kWMFrameSlop || - JLAbs(w->itsWMFrameLoc.y - p) > kWMFrameSlop) + if (labs(w->itsWMFrameLoc.x - p) > kWMFrameSlop || + labs(w->itsWMFrameLoc.y - p) > kWMFrameSlop) { behavior.frameCompensateFlag = !behavior.frameCompensateFlag; d->SetWMBehavior(behavior); diff --git a/tools/jx_layout_editor/code/LayoutContainer.cpp b/tools/jx_layout_editor/code/LayoutContainer.cpp index 19302e9b3..a5219a7b9 100644 --- a/tools/jx_layout_editor/code/LayoutContainer.cpp +++ b/tools/jx_layout_editor/code/LayoutContainer.cpp @@ -413,7 +413,7 @@ LayoutContainer::EnclosingBoundsResized const JCoordinate dhb ) { - if ((JLAbs(dwb) >= itsGridSpacing || JLAbs(dhb) >= itsGridSpacing) && + if ((labs(dwb) >= JCoordinate(itsGridSpacing) || labs(dhb) >= JCoordinate(itsGridSpacing)) && !itsIgnoreResizeFlag && !CurrentUndoIs(LayoutUndo::kWindowResizeType)) { auto* newUndo = jnew LayoutUndo(itsDoc, LayoutUndo::kWindowResizeType); @@ -436,7 +436,7 @@ LayoutContainer::BoundsResized ) { JXWidget::BoundsResized(dw,dh); - if (JLAbs(dw) >= itsGridSpacing || JLAbs(dh) >= itsGridSpacing) + if (labs(dw) >= JCoordinate(itsGridSpacing) || labs(dh) >= JCoordinate(itsGridSpacing)) { itsDoc->DataModified(); }