[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src multiplayer.cpp multiplayer_ui.cpp ...
From: |
Philippe Plantier |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src multiplayer.cpp multiplayer_ui.cpp ... |
Date: |
Thu, 24 Feb 2005 18:39:35 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Philippe Plantier <address@hidden> 05/02/24 23:39:35
Modified files:
src : multiplayer.cpp multiplayer_ui.cpp
scoped_resource.hpp
src/widgets : widget.cpp widget.hpp
Log message:
Fixed several bugs regarding resizing in the multiplayer lobby.
Made widgets not have a clip area by default.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.138&tr2=1.139&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.cpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/scoped_resource.hpp.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.cpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.hpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
Patches:
Index: wesnoth/src/multiplayer.cpp
diff -u wesnoth/src/multiplayer.cpp:1.138 wesnoth/src/multiplayer.cpp:1.139
--- wesnoth/src/multiplayer.cpp:1.138 Thu Feb 24 20:00:00 2005
+++ wesnoth/src/multiplayer.cpp Thu Feb 24 23:39:35 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer.cpp,v 1.138 2005/02/24 20:00:00 gruikya Exp $ */
+/* $Id: multiplayer.cpp,v 1.139 2005/02/24 23:39:35 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
Index: wesnoth/src/multiplayer_ui.cpp
diff -u wesnoth/src/multiplayer_ui.cpp:1.4 wesnoth/src/multiplayer_ui.cpp:1.5
--- wesnoth/src/multiplayer_ui.cpp:1.4 Thu Feb 24 20:28:41 2005
+++ wesnoth/src/multiplayer_ui.cpp Thu Feb 24 23:39:35 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_ui.cpp,v 1.4 2005/02/24 20:28:41 gruikya Exp $ */
+/* $Id: multiplayer_ui.cpp,v 1.5 2005/02/24 23:39:35 gruikya Exp $ */
/*
Copyright (C)
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -139,17 +139,22 @@
int ui::xscale(int x) const
{
- return (x*disp().x())/1024;
+ return (x * width())/1024;
}
int ui::yscale(int y) const
{
- return (y*disp().y())/768;
+ return (y * height())/768;
}
SDL_Rect ui::client_area() const
{
- SDL_Rect res = { xscale(11)+6, yscale(40)+6, xscale(833)-12,
yscale(524)-12 };
+ SDL_Rect res;
+
+ res.x = xscale(11) + 6;
+ res.y = yscale(40) + 6;
+ res.w = xscale(833) > 12 ? xscale(833) - 12 : 0;
+ res.h = yscale(524) > 12 ? yscale(524) - 12 : 0;
return res;
}
@@ -257,10 +262,10 @@
void ui::layout_children(const SDL_Rect& rect)
{
users_menu_.set_width(xscale(156));
- users_menu_.set_location(xscale(856),yscale(42));
- chat_textbox_.set_location(xscale(11) + 4, xscale(573) + 4);
- chat_textbox_.set_measurements(xscale(833) - 8, xscale(143) - 8);
- entry_textbox_.set_location(xscale(11) + 4,yscale(732));
+ users_menu_.set_location(xscale(856), yscale(42));
+ chat_textbox_.set_location(xscale(11) + 4, yscale(573) + 4);
+ chat_textbox_.set_measurements(xscale(833) - 8, yscale(143) - 8);
+ entry_textbox_.set_location(xscale(11) + 4, yscale(732));
entry_textbox_.set_width(xscale(833) - 8);
}
Index: wesnoth/src/scoped_resource.hpp
diff -u wesnoth/src/scoped_resource.hpp:1.17
wesnoth/src/scoped_resource.hpp:1.18
--- wesnoth/src/scoped_resource.hpp:1.17 Sat Sep 4 16:54:20 2004
+++ wesnoth/src/scoped_resource.hpp Thu Feb 24 23:39:35 2005
@@ -1,4 +1,4 @@
-/* $Id: scoped_resource.hpp,v 1.17 2004/09/04 16:54:20 silene Exp $ */
+/* $Id: scoped_resource.hpp,v 1.18 2005/02/24 23:39:35 gruikya Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -88,7 +88,7 @@
*
* @ret the underlying resource
*/
- resource_type get() const { return resource; }
+ resource_type get() const { return resource; }
/**
* This function provides convenient direct access to the -> operator
Index: wesnoth/src/widgets/widget.cpp
diff -u wesnoth/src/widgets/widget.cpp:1.26 wesnoth/src/widgets/widget.cpp:1.27
--- wesnoth/src/widgets/widget.cpp:1.26 Thu Nov 18 04:08:33 2004
+++ wesnoth/src/widgets/widget.cpp Thu Feb 24 23:39:35 2005
@@ -12,19 +12,15 @@
widget::widget(const widget &o)
: events::handler(), disp_(o.disp_), restorer_(o.restorer_),
rect_(o.rect_),
focus_(o.focus_), needs_restore_(o.needs_restore_),
- state_(o.state_), clip_rect_(o.clip_rect_), volatile_(o.volatile_),
+ state_(o.state_), clip_(o.clip_), clip_rect_(o.clip_rect_),
volatile_(o.volatile_),
help_text_(o.help_text_), help_string_(o.help_string_)
{
}
widget::widget(display& disp)
: disp_(&disp), rect_(EmptyRect), focus_(true), needs_restore_(false),
- state_(UNINIT), volatile_(false), help_string_(0)
+ state_(UNINIT), clip_(false), volatile_(false), help_string_(0)
{
- clip_rect_.x = 0;
- clip_rect_.y = 0;
- clip_rect_.w = disp.screen_area().w;
- clip_rect_.h = disp.screen_area().h;
}
widget::~widget()
@@ -131,6 +127,7 @@
void widget::set_clip_rect(const SDL_Rect& rect)
{
clip_rect_ = rect;
+ clip_ = true;
set_dirty(true);
}
@@ -163,7 +160,9 @@
void widget::bg_restore() const
{
- clip_rect_setter set_clip_rect(disp().video().getSurface(), clip_rect_);
+ util::scoped_ptr<clip_rect_setter> clipper(NULL);
+ if (clip_)
+ clipper.assign(new
clip_rect_setter(disp().video().getSurface(), clip_rect_));
if (needs_restore_) {
for(std::vector< surface_restorer >::const_iterator i =
restorer_.begin(),
@@ -179,7 +178,9 @@
void widget::bg_restore(SDL_Rect const &rect) const
{
- clip_rect_setter set_clip_rect(disp().video().getSurface(), clip_rect_);
+ util::scoped_ptr<clip_rect_setter> clipper(NULL);
+ if (clip_)
+ clipper.assign(new
clip_rect_setter(disp().video().getSurface(), clip_rect_));
for(std::vector< surface_restorer >::const_iterator i =
restorer_.begin(),
i_end = restorer_.end(); i != i_end; ++i)
@@ -200,7 +201,10 @@
bg_restore();
- clip_rect_setter set_clip_rect(disp().video().getSurface(), clip_rect_);
+ util::scoped_ptr<clip_rect_setter> clipper(NULL);
+ if (clip_)
+ clipper.assign(new
clip_rect_setter(disp().video().getSurface(), clip_rect_));
+
draw_contents();
update_rect(rect_);
Index: wesnoth/src/widgets/widget.hpp
diff -u wesnoth/src/widgets/widget.hpp:1.22 wesnoth/src/widgets/widget.hpp:1.23
--- wesnoth/src/widgets/widget.hpp:1.22 Sat Nov 6 20:03:56 2004
+++ wesnoth/src/widgets/widget.hpp Thu Feb 24 23:39:35 2005
@@ -82,6 +82,7 @@
mutable bool needs_restore_; // Have we drawn ourselves, so that if
moved, we need to restore the background?
enum { UNINIT, HIDDEN, DIRTY, DRAWN } state_;
+ bool clip_;
SDL_Rect clip_rect_;
bool volatile_;