Skip to content

Commit d22671e

Browse files
author
Koen Deforche
committed
fix WRectF united() issue
1 parent 67e6613 commit d22671e

File tree

6 files changed

+36
-28
lines changed

6 files changed

+36
-28
lines changed

Changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
12-10-2011:
2+
* WRectF: fix isEmpty() to be more restrictive: only a rect with
3+
width = 0 and height = 0 is now empty
4+
15
11-10-2011:
26
* WPopupMenuItem: fix crash with re-showing hidden popup
37

examples/simplechat/SimpleChatWidget.C

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ SimpleChatWidget::SimpleChatWidget(SimpleChatServer& server,
2727
Wt::WContainerWidget *parent)
2828
: WContainerWidget(parent),
2929
server_(server),
30+
loggedIn_(false),
3031
userList_(0),
3132
messageReceived_(0)
3233
{
@@ -43,9 +44,8 @@ SimpleChatWidget::~SimpleChatWidget()
4344

4445
void SimpleChatWidget::connect()
4546
{
46-
if (server_.connect(this,
47-
boost::bind(&SimpleChatWidget::processChatEvent,
48-
this, _1)))
47+
if (server_.connect
48+
(this, boost::bind(&SimpleChatWidget::processChatEvent, this, _1)))
4949
Wt::WApplication::instance()->enableUpdates(true);
5050
}
5151

@@ -97,6 +97,7 @@ void SimpleChatWidget::login()
9797
void SimpleChatWidget::logout()
9898
{
9999
if (loggedIn()) {
100+
loggedIn_ = false;
100101
server_.logout(user_);
101102

102103
letLogin();
@@ -164,7 +165,7 @@ void SimpleChatWidget::createLayout(WWidget *messages, WWidget *userList,
164165

165166
bool SimpleChatWidget::loggedIn() const
166167
{
167-
return !userNameEdit_;
168+
return loggedIn_;
168169
}
169170

170171
void SimpleChatWidget::render(WFlags<RenderFlag> flags)
@@ -189,6 +190,7 @@ bool SimpleChatWidget::startChat(const WString& user)
189190
* is used to indicate a new chat event for this user.
190191
*/
191192
if (server_.login(user)) {
193+
loggedIn_ = true;
192194
connect();
193195

194196
user_ = user;

examples/simplechat/SimpleChatWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class SimpleChatWidget : public Wt::WContainerWidget,
8383
UserMap users_;
8484

8585
SimpleChatServer& server_;
86+
bool loggedIn_;
8687

8788
Wt::JSlot clearInput_;
8889

src/Wt/WRectF

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,15 @@ public:
3030
*
3131
* \sa isNull()
3232
* \elseif java
33-
* Constructs a rectangle from top left point (<i>x=0</i>, \p y=0)
34-
* and size <i>width=0</i> x \p height=0.
33+
* Constructs an empty rectangle at point (0, 0).
3534
* \endif
3635
*/
3736
WRectF();
3837

3938
/*! \brief Creates a rectangle.
4039
*
41-
* Constructs a rectangle with top left point (<i>x</i>, \p y)
42-
* and size <i>width</i> x \p height.
40+
* Constructs a rectangle with top left point (\p x, \p y)
41+
* and size \p width x \p height.
4342
*/
4443
WRectF(double x, double y, double width, double height);
4544

@@ -48,9 +47,9 @@ public:
4847
* Constructs a rectangle from the two points \p topLeft and
4948
* \p bottomRight.
5049
*
51-
* If you want to create a rectangle from two arbitrary corner points,
52-
* you can use this constructor too, but should call normalized()
53-
* afterwords.
50+
* If you want to create a rectangle from two arbitrary corner
51+
* points, you can use this constructor too, but should call
52+
* normalized() afterwords.
5453
*/
5554
WRectF(const WPointF& topLeft, const WPointF& bottomRight);
5655

@@ -73,8 +72,7 @@ public:
7372

7473
/*! \brief Determines whether or not this rectangle is empty.
7574
*
76-
* A rectangle is empty if its width or its height is less than
77-
* or equal to zero.
75+
* A rectangle is empty if its width and height are zero.
7876
*/
7977
bool isEmpty() const;
8078

@@ -94,27 +92,27 @@ public:
9492

9593
/*! \brief Sets the width.
9694
*
97-
* The right side of the rectangle may move, but does not change the X
98-
* position of the left side.
95+
* The right side of the rectangle may move, but this does not
96+
* affect the left side.
9997
*/
10098
void setWidth(double width) { width_ = width; }
10199

102100
/*! \brief Sets the Y-position of the top side.
103101
*
104-
* The bottom side of the rectangle may move, but does not change
105-
* the Y position of the top side.
102+
* The bottom side of the rectangle may move, but this does not
103+
* affect the Y position of the top side.
106104
*/
107105
void setHeight(double height) { height_ = height; }
108106

109-
/*! \brief Returns the X-position of the left side.
107+
/*! \brief Returns the X-position (left side offset).
110108
*
111109
* This is equivalent to left().
112110
*
113111
* \sa y(), left()
114112
*/
115113
double x() const { return x_; }
116114

117-
/*! \brief Returns the Y-position of the top side.
115+
/*! \brief Returns the Y-position (top side offset).
118116
*
119117
* This is equivalent to top().
120118
*
@@ -134,25 +132,25 @@ public:
134132
*/
135133
double height() const { return height_; }
136134

137-
/*! \brief Returns the X position of the left side.
135+
/*! \brief Returns the X position (left side offset).
138136
*
139137
* \sa x(), right()
140138
*/
141139
double left() const { return x_; }
142140

143-
/*! \brief Returns the Y position of the top side.
141+
/*! \brief Returns the Y position (top side offset).
144142
*
145143
* \sa y(), bottom()
146144
*/
147145
double top() const { return y_; }
148146

149-
/*! \brief Returns the X position of the right side.
147+
/*! \brief Returns the the right side offset.
150148
*
151149
* \sa left()
152150
*/
153151
double right() const { return x_ + width_; }
154152

155-
/*! \brief Returns the Y position of the bottom side.
153+
/*! \brief Returns the bottom side offset.
156154
*
157155
* \sa top()
158156
*/

src/Wt/WRectF.C

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ WRectF& WRectF::operator=(const WRectF& rhs)
4040

4141
bool WRectF::operator==(const WRectF& rhs) const
4242
{
43-
return (x_ == rhs.x_ && y_ == rhs.y_
44-
&& width_ == rhs.width_ && height_ == rhs.height_);
43+
return
44+
x_ == rhs.x_
45+
&& y_ == rhs.y_
46+
&& width_ == rhs.width_
47+
&& height_ == rhs.height_;
4548
}
4649

4750
bool WRectF::operator!=(const WRectF& rhs) const
@@ -58,7 +61,7 @@ bool WRectF::isNull() const
5861

5962
bool WRectF::isEmpty() const
6063
{
61-
return width_ <= 0 || height_ <= 0;
64+
return width_ == 0 && height_ == 0;
6265
}
6366

6467
void WRectF::setX(double x)

src/web/skeleton/Wt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,8 +2208,8 @@ function load(fullapp) {
22082208

22092209
var currentHideLoadingIndicator = null;
22102210

2211-
function cancelFeedback(t) {
2212-
clearTimeout(t);
2211+
function cancelFeedback(timer) {
2212+
clearTimeout(timer);
22132213
document.body.style.cursor = 'auto';
22142214

22152215
if (currentHideLoadingIndicator != null) {

0 commit comments

Comments
 (0)