From 35ced32e331ee29fda1642616c803637952f5b22 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 30 May 2025 14:27:29 +0900 Subject: Replace TRUE/FALSE with boolean values true/false - part 1 Signed-off-by: Michele Calgaro (cherry picked from commit a7f1e6e2552d9cdbb3d76bff089db522248b9a24) --- doc/html/tutorial1-14.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'doc/html/tutorial1-14.html') diff --git a/doc/html/tutorial1-14.html b/doc/html/tutorial1-14.html index 094c8081c..9d7a692e3 100644 --- a/doc/html/tutorial1-14.html +++ b/doc/html/tutorial1-14.html @@ -80,13 +80,13 @@ three mouse event handlers. The names say it all.

This private function checks if a point is inside the barrel of the cannon.

        bool barrelPressed;
 
-

This private variable is TRUE if the user has pressed the mouse on the +

This private variable is true if the user has pressed the mouse on the barrel and not released it.

t14/cannon.cpp

-

        barrelPressed = FALSE;
+

        barrelPressed = false;
 

This line has been added to the constructor. Initially, the mouse is not pressed on the barrel. @@ -100,7 +100,7 @@ the third, too. if ( e->button() != LeftButton ) return; if ( barrelHit( e->pos() ) ) - barrelPressed = TRUE; + barrelPressed = true; }

This is a TQt event handler. It is called when the user presses a @@ -108,7 +108,7 @@ mouse button when the mouse cursor is over the widget.

If the event was not generated by the left mouse button, we return immediately. Otherwise, we check if the position of the mouse cursor is within the cannon's barrel. If it is, we set barrelPressed to -TRUE. +true.

Notice that the pos() function returns a point in the widget's coordinate system.

    void CannonField::mouseMoveEvent( TQMouseEvent *e )
@@ -141,7 +141,7 @@ value converted to degrees.
 

    void CannonField::mouseReleaseEvent( TQMouseEvent *e )
     {
         if ( e->button() == LeftButton )
-            barrelPressed = FALSE;
+            barrelPressed = false;
     }
 

This TQt event handler is called whenever the user releases a mouse @@ -179,8 +179,8 @@ the bottom edge of the barrier to the bottom edge of the widget. return barrelRect.contains( mtx.map(p) ); }

-

This function returns TRUE if the point is in the barrel; otherwise it returns -FALSE. +

This function returns true if the point is in the barrel; otherwise it returns +false.

Here we use the class TQWMatrix. It is defined in the header file ntqwmatrix.h, which is included by ntqpainter.h.

TQWMatrix defines a coordinate system mapping. It can perform the same @@ -192,7 +192,7 @@ coordinate system and then we rotate it. inside the barrel. To do this, we invert the transformation matrix. The inverted matrix performs the inverse transformation that we used when drawing the barrel. We map the point p using the inverted -matrix and return TRUE if it is inside the original barrel rectangle. +matrix and return true if it is inside the original barrel rectangle.

t14/gamebrd.cpp

-- cgit v1.2.3