[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src dialogs.cpp dialogs.hpp help.cpp mu...
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src dialogs.cpp dialogs.hpp help.cpp mu... |
Date: |
Sat, 06 Nov 2004 08:19:19 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 04/11/06 13:13:16
Modified files:
src : dialogs.cpp dialogs.hpp help.cpp
multiplayer_client.cpp multiplayer_client.hpp
preferences.cpp
src/editor : editor_palettes.cpp
src/widgets : button.cpp button.hpp file_chooser.cpp
file_chooser.hpp label.cpp label.hpp menu.cpp
scrollarea.cpp scrollarea.hpp scrollbar.cpp
scrollbar.hpp slider.cpp slider.hpp textbox.cpp
widget.cpp widget.hpp
Log message:
Add update_location for a 2-stage set_location; refresh bugs may ensue
since it inverts the rectangle registration process. Rename register_rectangle
in bg_register. Add set_measurements to remove contiguous call to set_width and
set_height.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.hpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_client.cpp.diff?tr1=1.75&tr2=1.76&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_client.hpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.120&tr2=1.121&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.cpp.diff?tr1=1.47&tr2=1.48&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.hpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/file_chooser.cpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/file_chooser.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/label.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/label.hpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.69&tr2=1.70&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.cpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.hpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.hpp.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.cpp.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.hpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.62&tr2=1.63&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.cpp.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.hpp.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
Patches:
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.66 wesnoth/src/dialogs.cpp:1.67
--- wesnoth/src/dialogs.cpp:1.66 Thu Nov 4 20:58:43 2004
+++ wesnoth/src/dialogs.cpp Sat Nov 6 13:13:15 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.66 2004/11/04 20:58:43 ydirson Exp $ */
+/* $Id: dialogs.cpp,v 1.67 2004/11/06 13:13:15 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -251,9 +251,6 @@
set_height(400);
}
- virtual void set_location(SDL_Rect const &rect);
- using widget::set_location;
-
void draw_contents();
void set_selection(int index) {
index_ = index;
@@ -272,12 +269,6 @@
std::map<std::string,surface> map_cache_;
};
-void save_preview_pane::set_location(SDL_Rect const &rect)
-{
- widget::set_location(rect);
- register_rectangle(rect);
-}
-
void save_preview_pane::draw_contents()
{
if(index_ < 0 || index_ >= int(summaries_->size()) || info_->size() !=
summaries_->size()) {
@@ -594,12 +585,6 @@
}
}
-void unit_preview_pane::set_location(SDL_Rect const &rect)
-{
- widget::set_location(rect);
- register_rectangle(rect);
-}
-
void unit_preview_pane::draw_contents()
{
if(index_ < 0 || index_ >= int(units_->size())) {
@@ -757,12 +742,6 @@
set_height(400);
}
-void campaign_preview_pane::set_location(SDL_Rect const &rect)
-{
- gui::preview_pane::set_location(rect);
- register_rectangle(rect);
-}
-
bool campaign_preview_pane::show_above() const { return false; }
bool campaign_preview_pane::left_side() const { return false; }
Index: wesnoth/src/dialogs.hpp
diff -u wesnoth/src/dialogs.hpp:1.26 wesnoth/src/dialogs.hpp:1.27
--- wesnoth/src/dialogs.hpp:1.26 Wed Nov 3 22:20:27 2004
+++ wesnoth/src/dialogs.hpp Sat Nov 6 13:13:15 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.hpp,v 1.26 2004/11/03 22:20:27 gruikya Exp $ */
+/* $Id: dialogs.hpp,v 1.27 2004/11/06 13:13:15 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -72,8 +72,6 @@
bool show_above() const;
bool left_side() const;
void set_selection(int index);
- void set_location(SDL_Rect const &);
- using gui::preview_pane::set_location;
private:
void draw_contents();
@@ -99,8 +97,6 @@
bool show_above() const;
bool left_side() const;
void set_selection(int index);
- void set_location(SDL_Rect const &);
- using gui::preview_pane::set_location;
private:
void draw_contents();
Index: wesnoth/src/editor/editor_palettes.cpp
diff -u wesnoth/src/editor/editor_palettes.cpp:1.20
wesnoth/src/editor/editor_palettes.cpp:1.21
--- wesnoth/src/editor/editor_palettes.cpp:1.20 Sun Oct 31 20:50:13 2004
+++ wesnoth/src/editor/editor_palettes.cpp Sat Nov 6 13:13:16 2004
@@ -63,7 +63,7 @@
(button_height + button_palette_padding) * 2;
rect.y = terrain_start_;
rect.h = space_for_terrains;
- register_rectangle(rect);
+ bg_register(rect);
const unsigned terrains_fitting =
(unsigned)(space_for_terrains / size_specs_.terrain_space) * 2;
const unsigned total_terrains = num_terrains();
@@ -336,8 +336,7 @@
void brush_bar::adjust_size() {
set_location(size_specs_.brush_x, size_specs_.brush_y);
- set_width(size_ * total_brush_);
- set_height(size_);
+ set_measurements(size_ * total_brush_, size_);
set_dirty();
}
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.50 wesnoth/src/help.cpp:1.51
--- wesnoth/src/help.cpp:1.50 Sat Nov 6 09:19:27 2004
+++ wesnoth/src/help.cpp Sat Nov 6 13:13:15 2004
@@ -363,11 +363,6 @@
public:
help_browser(display &disp, const section &toplevel);
- // Overloaded from widget so that the layout may be adjusted to fit
- // the new dimensions.
- virtual void set_location(const SDL_Rect& rect);
- using gui::widget::set_location;
-
void adjust_layout();
/// Display the topic with the specified identifier. Open the menu
@@ -375,6 +370,7 @@
void show_topic(const std::string &topic_id);
protected:
+ virtual void update_location(SDL_Rect const &rect);
virtual void process_event();
virtual void handle_event(const SDL_Event &event);
@@ -1614,7 +1610,7 @@
{}
void help_text_area::set_inner_location(SDL_Rect const &rect) {
- register_rectangle(rect);
+ bg_register(rect);
}
void help_text_area::show_topic(const topic &t) {
@@ -2112,9 +2108,7 @@
back_button_.hide(true);
forward_button_.hide(true);
// Set sizes to some default values.
- set_location(1, 1);
- set_width(400);
- set_height(500);
+ set_measurements(400, 500);
}
void help_browser::adjust_layout() {
@@ -2152,8 +2146,7 @@
set_dirty(true);
}
-void help_browser::set_location(const SDL_Rect& rect) {
- widget::set_location(rect);
+void help_browser::update_location(const SDL_Rect& rect) {
adjust_layout();
}
Index: wesnoth/src/multiplayer_client.cpp
diff -u wesnoth/src/multiplayer_client.cpp:1.75
wesnoth/src/multiplayer_client.cpp:1.76
--- wesnoth/src/multiplayer_client.cpp:1.75 Thu Nov 4 22:22:55 2004
+++ wesnoth/src/multiplayer_client.cpp Sat Nov 6 13:13:15 2004
@@ -799,15 +799,3 @@
{
return leaders_.get_leader();
}
-
-void leader_preview_pane::set_location(const SDL_Rect& rect)
-{
- if (location().x == rect.x && location().y == rect.y &&
- location().w == rect.w && location().h == rect.h)
- return;
-
- widget::set_location(rect);
- register_rectangle(rect);
-}
-
-
Index: wesnoth/src/multiplayer_client.hpp
diff -u wesnoth/src/multiplayer_client.hpp:1.6
wesnoth/src/multiplayer_client.hpp:1.7
--- wesnoth/src/multiplayer_client.hpp:1.6 Thu Nov 4 22:22:55 2004
+++ wesnoth/src/multiplayer_client.hpp Sat Nov 6 13:13:15 2004
@@ -46,9 +46,6 @@
void set_selection(int index);
std::string get_selected_leader();
- virtual void set_location(const SDL_Rect& rect);
- using widget::set_location;
-
private:
void draw_contents();
void process();
Index: wesnoth/src/preferences.cpp
diff -u wesnoth/src/preferences.cpp:1.120 wesnoth/src/preferences.cpp:1.121
--- wesnoth/src/preferences.cpp:1.120 Wed Nov 3 21:46:58 2004
+++ wesnoth/src/preferences.cpp Sat Nov 6 13:13:15 2004
@@ -1,4 +1,4 @@
-/* $Id: preferences.cpp,v 1.120 2004/11/03 21:46:58 gruikya Exp $ */
+/* $Id: preferences.cpp,v 1.121 2004/11/06 13:13:15 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -636,7 +636,7 @@
void process_event();
bool left_side() const { return false; }
void set_selection(int index);
- void set_location(SDL_Rect const &rect);
+ void update_location(SDL_Rect const &rect);
gui::slider music_slider_, sound_slider_, scroll_slider_, gamma_slider_;
gui::button fullscreen_button_, turbo_button_, show_ai_moves_button_,
@@ -736,10 +736,9 @@
hotkeys_button_.set_help_string(_("View and configure keyboard
shortcuts"));
}
-void preferences_dialog::set_location(SDL_Rect const &rect)
+void preferences_dialog::update_location(SDL_Rect const &rect)
{
- widget::set_location(rect);
- register_rectangle(rect);
+ bg_register(rect);
const int border = 10;
// General tab
Index: wesnoth/src/widgets/button.cpp
diff -u wesnoth/src/widgets/button.cpp:1.47 wesnoth/src/widgets/button.cpp:1.48
--- wesnoth/src/widgets/button.cpp:1.47 Mon Nov 1 18:06:37 2004
+++ wesnoth/src/widgets/button.cpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: button.cpp,v 1.47 2004/11/01 18:06:37 gruikya Exp $ */
+/* $Id: button.cpp,v 1.48 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -101,12 +101,6 @@
}
}
-void button::set_location(SDL_Rect const &rect)
-{
- widget::set_location(rect);
- register_rectangle(rect);
-}
-
void button::set_check(bool check)
{
if (type_ != TYPE_CHECK)
Index: wesnoth/src/widgets/button.hpp
diff -u wesnoth/src/widgets/button.hpp:1.28 wesnoth/src/widgets/button.hpp:1.29
--- wesnoth/src/widgets/button.hpp:1.28 Mon Nov 1 18:06:37 2004
+++ wesnoth/src/widgets/button.hpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: button.hpp,v 1.28 2004/11/01 18:06:37 gruikya Exp $ */
+/* $Id: button.hpp,v 1.29 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -40,9 +40,6 @@
std::string button_image="", SPACE_CONSUMPTION
spacing=DEFAULT_SPACE);
virtual ~button() {}
- virtual void set_location(SDL_Rect const &rect);
- using widget::set_location;
-
void set_check(bool check);
bool checked() const;
Index: wesnoth/src/widgets/file_chooser.cpp
diff -u wesnoth/src/widgets/file_chooser.cpp:1.9
wesnoth/src/widgets/file_chooser.cpp:1.10
--- wesnoth/src/widgets/file_chooser.cpp:1.9 Mon Nov 1 18:06:37 2004
+++ wesnoth/src/widgets/file_chooser.cpp Sat Nov 6 13:13:16 2004
@@ -39,9 +39,7 @@
chosen_file_ = current_dir_;
}
// Set sizes to some default values.
- set_location(1, 1);
- set_width(400);
- set_height(500);
+ set_measurements(400, 500);
update_file_lists();
}
@@ -251,23 +249,7 @@
}
}
-void file_chooser::set_location(const SDL_Rect& rect) {
- widget::set_location(rect);
- adjust_layout();
-}
-
-void file_chooser::set_location(int x, int y) {
- widget::set_location(x, y);
- adjust_layout();
-}
-
-void file_chooser::set_width(int w) {
- widget::set_width(w);
- adjust_layout();
-}
-
-void file_chooser::set_height(int h) {
- widget::set_height(h);
+void file_chooser::update_location(SDL_Rect const &rect) {
adjust_layout();
}
Index: wesnoth/src/widgets/file_chooser.hpp
diff -u wesnoth/src/widgets/file_chooser.hpp:1.3
wesnoth/src/widgets/file_chooser.hpp:1.4
--- wesnoth/src/widgets/file_chooser.hpp:1.3 Mon Nov 1 18:06:37 2004
+++ wesnoth/src/widgets/file_chooser.hpp Sat Nov 6 13:13:16 2004
@@ -37,17 +37,13 @@
void set_dirty(bool dirty=true);
- void set_location(const SDL_Rect& rect);
- void set_location(int x, int y);
- void set_width(int w);
- void set_height(int h);
-
/// Return true if the user is done making her choice.
bool choice_made() const;
/// Return the choosen file.
std::string get_choice() const;
protected:
+ virtual void update_location(SDL_Rect const &rect);
virtual void handle_event(const SDL_Event& event);
private:
Index: wesnoth/src/widgets/label.cpp
diff -u wesnoth/src/widgets/label.cpp:1.2 wesnoth/src/widgets/label.cpp:1.3
--- wesnoth/src/widgets/label.cpp:1.2 Tue Nov 2 00:11:36 2004
+++ wesnoth/src/widgets/label.cpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: label.cpp,v 1.2 2004/11/02 00:11:36 cedricd Exp $ */
+/* $Id: label.cpp,v 1.3 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -67,21 +67,10 @@
font::draw_text(&disp(), disp().screen_area(), size_, colour_, text_,
location().x, location().y);
}
-void label::set_location(const SDL_Rect& rect)
-{
- if (location().x == rect.x && location().y == rect.y &&
- location().w == rect.w && location().h == rect.h)
- return;
-
- widget::set_location(rect);
- register_rectangle(rect);
-}
-
void label::update_label_size()
{
SDL_Rect area = font::text_area(text_, size_);
- set_width(area.w);
- set_height(area.h);
+ set_measurements(area.w, area.h);
}
Index: wesnoth/src/widgets/label.hpp
diff -u wesnoth/src/widgets/label.hpp:1.2 wesnoth/src/widgets/label.hpp:1.3
--- wesnoth/src/widgets/label.hpp:1.2 Tue Nov 2 00:11:36 2004
+++ wesnoth/src/widgets/label.hpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: label.hpp,v 1.2 2004/11/02 00:11:36 cedricd Exp $ */
+/* $Id: label.hpp,v 1.3 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2004 by Philippe Plantier <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -35,9 +35,6 @@
const SDL_Color& get_colour() const;
virtual void draw_contents();
- virtual void set_location(const SDL_Rect& rect);
- using widget::set_location;
-
private:
void update_label_size();
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.69 wesnoth/src/widgets/menu.cpp:1.70
--- wesnoth/src/widgets/menu.cpp:1.69 Sat Nov 6 11:00:02 2004
+++ wesnoth/src/widgets/menu.cpp Sat Nov 6 13:13:16 2004
@@ -110,7 +110,7 @@
{
itemRects_.clear();
update_scrollbar_grip_height();
- register_rectangle(rect);
+ bg_register(rect);
}
void menu::change_item(int pos1, int pos2,std::string str)
@@ -150,7 +150,6 @@
if (!keep_viewport)
set_position(0);
update_scrollbar_grip_height();
- set_location(location()); // Force some more updating.
adjust_viewport_to_selection();
set_dirty();
}
Index: wesnoth/src/widgets/scrollarea.cpp
diff -u wesnoth/src/widgets/scrollarea.cpp:1.1
wesnoth/src/widgets/scrollarea.cpp:1.2
--- wesnoth/src/widgets/scrollarea.cpp:1.1 Sat Nov 6 09:19:28 2004
+++ wesnoth/src/widgets/scrollarea.cpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.cpp,v 1.1 2004/11/06 09:19:28 silene Exp $*/
+/* $Id: scrollarea.cpp,v 1.2 2004/11/06 13:13:16 silene Exp $*/
/*
Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -32,9 +32,8 @@
return scrollbar_.grip_height_ < scrollbar_.full_height_;
}
-void scrollarea::set_location(SDL_Rect const &rect)
+void scrollarea::update_location(SDL_Rect const &rect)
{
- widget::set_location(rect);
SDL_Rect r = rect;
shown_scrollbar_ = has_scrollbar();
if (shown_scrollbar_) {
Index: wesnoth/src/widgets/scrollarea.hpp
diff -u wesnoth/src/widgets/scrollarea.hpp:1.1
wesnoth/src/widgets/scrollarea.hpp:1.2
--- wesnoth/src/widgets/scrollarea.hpp:1.1 Sat Nov 6 09:19:28 2004
+++ wesnoth/src/widgets/scrollarea.hpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollarea.hpp,v 1.1 2004/11/06 09:19:28 silene Exp $ */
+/* $Id: scrollarea.hpp,v 1.2 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2004 by Guillaume Melquiond <address@hidden>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -29,11 +29,10 @@
/// \param pane the widget where wheel events take place
scrollarea(display &d);
- virtual void set_location(SDL_Rect const &rect);
- using widget::set_location;
virtual void hide(bool value = true);
protected:
+ virtual void update_location(SDL_Rect const &rect);
virtual void handle_event(const SDL_Event& event);
virtual void process_event();
virtual void scroll(int pos) = 0;
Index: wesnoth/src/widgets/scrollbar.cpp
diff -u wesnoth/src/widgets/scrollbar.cpp:1.19
wesnoth/src/widgets/scrollbar.cpp:1.20
--- wesnoth/src/widgets/scrollbar.cpp:1.19 Sat Nov 6 09:19:28 2004
+++ wesnoth/src/widgets/scrollbar.cpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.cpp,v 1.19 2004/11/06 09:19:28 silene Exp $*/
+/* $Id: scrollbar.cpp,v 1.20 2004/11/06 13:13:16 silene Exp $*/
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -51,16 +51,15 @@
}
}
-void scrollbar::set_location(SDL_Rect const &rect)
+void scrollbar::update_location(SDL_Rect const &rect)
{
- widget::set_location(rect);
int uh = uparrow_.height(), dh = downarrow_.height();
uparrow_.set_location(rect.x, rect.y);
downarrow_.set_location(rect.x, rect.y + rect.h - dh);
SDL_Rect r = rect;
r.y += uh;
r.h -= uh + dh;
- register_rectangle(r);
+ bg_register(r);
}
void scrollbar::hide(bool value)
Index: wesnoth/src/widgets/scrollbar.hpp
diff -u wesnoth/src/widgets/scrollbar.hpp:1.9
wesnoth/src/widgets/scrollbar.hpp:1.10
--- wesnoth/src/widgets/scrollbar.hpp:1.9 Sat Nov 6 09:19:28 2004
+++ wesnoth/src/widgets/scrollbar.hpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: scrollbar.hpp,v 1.9 2004/11/06 09:19:28 silene Exp $ */
+/* $Id: scrollbar.hpp,v 1.10 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -32,8 +32,6 @@
/// \param callback a callback interface for warning that the grip has
been moved
scrollbar(display &d);
- virtual void set_location(SDL_Rect const &rect);
- using widget::set_location;
virtual void hide(bool value = true);
/// This function is used to determine where the scrollbar is.
@@ -57,6 +55,7 @@
void set_full_size(unsigned h);
protected:
+ virtual void update_location(SDL_Rect const &rect);
virtual void handle_event(const SDL_Event& event);
virtual void process_event();
virtual void draw_contents();
Index: wesnoth/src/widgets/slider.cpp
diff -u wesnoth/src/widgets/slider.cpp:1.32 wesnoth/src/widgets/slider.cpp:1.33
--- wesnoth/src/widgets/slider.cpp:1.32 Mon Nov 1 18:06:37 2004
+++ wesnoth/src/widgets/slider.cpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: slider.cpp,v 1.32 2004/11/01 18:06:37 gruikya Exp $ */
+/* $Id: slider.cpp,v 1.33 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -34,11 +34,10 @@
{
}
-void slider::set_location(SDL_Rect const &rect)
+void slider::update_location(SDL_Rect const &rect)
{
SDL_Rect dst = { rect.x, rect.y, rect.w, image_->h };
- widget::set_location(dst);
- register_rectangle(dst);
+ bg_register(dst);
}
void slider::set_min(int value)
Index: wesnoth/src/widgets/slider.hpp
diff -u wesnoth/src/widgets/slider.hpp:1.20 wesnoth/src/widgets/slider.hpp:1.21
--- wesnoth/src/widgets/slider.hpp:1.20 Mon Nov 1 18:06:37 2004
+++ wesnoth/src/widgets/slider.hpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: slider.hpp,v 1.20 2004/11/01 18:06:37 gruikya Exp $ */
+/* $Id: slider.hpp,v 1.21 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -37,9 +37,8 @@
int max_value() const;
int min_value() const;
- virtual void set_location(SDL_Rect const &rect);
-
protected:
+ virtual void update_location(SDL_Rect const &rect);
virtual void handle_event(const SDL_Event& event);
virtual void draw_contents();
Index: wesnoth/src/widgets/textbox.cpp
diff -u wesnoth/src/widgets/textbox.cpp:1.62
wesnoth/src/widgets/textbox.cpp:1.63
--- wesnoth/src/widgets/textbox.cpp:1.62 Sat Nov 6 09:19:28 2004
+++ wesnoth/src/widgets/textbox.cpp Sat Nov 6 13:13:16 2004
@@ -1,4 +1,4 @@
-/* $Id: textbox.cpp,v 1.62 2004/11/06 09:19:28 silene Exp $ */
+/* $Id: textbox.cpp,v 1.63 2004/11/06 13:13:16 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -37,14 +37,13 @@
{
// static const SDL_Rect area = d.screen_area();
// const int height =
font::draw_text(NULL,area,font_size,font::NORMAL_COLOUR,"ABCD",0,0).h;
- set_height(font::get_max_height(font_size));
- set_width(width);
+ set_measurements(width, font::get_max_height(font_size));
update_text_cache(true);
}
void textbox::set_inner_location(SDL_Rect const &rect)
{
- register_rectangle(rect);
+ bg_register(rect);
}
const std::string textbox::text() const
Index: wesnoth/src/widgets/widget.cpp
diff -u wesnoth/src/widgets/widget.cpp:1.24 wesnoth/src/widgets/widget.cpp:1.25
--- wesnoth/src/widgets/widget.cpp:1.24 Sat Nov 6 09:19:28 2004
+++ wesnoth/src/widgets/widget.cpp Sat Nov 6 13:13:16 2004
@@ -40,45 +40,57 @@
void widget::set_location(SDL_Rect const &rect)
{
- //if (rect_.x == rect.x && rect_.y == rect.y && rect_.w == rect.w &&
rect_.h == rect.h)
- // return;
+ if (rect_.x == rect.x && rect_.y == rect.y && rect_.w == rect.w &&
rect_.h == rect.h)
+ return;
if (state_ == UNINIT && rect.x != -1234 && rect.y != -1234)
state_ = DRAWN;
bg_restore();
+ bg_cancel();
rect_ = rect;
set_dirty(true);
- bg_cancel();
+ update_location(rect);
+}
+
+void widget::update_location(SDL_Rect const &rect)
+{
+ bg_register(rect);
}
-void widget::register_rectangle(SDL_Rect const &rect)
+void widget::bg_register(SDL_Rect const &rect)
{
- restorer_.push_back(surface_restorer(&disp().video(), rect));
+ restorer_.push_back(surface_restorer(&disp_->video(), rect));
}
void widget::set_location(int x, int y)
{
- SDL_Rect rect = { x, y, location().w, location().h };
+ SDL_Rect rect = { x, y, rect_.w, rect_.h };
+ set_location(rect);
+}
+
+void widget::set_width(unsigned w)
+{
+ SDL_Rect rect = { rect_.x, rect_.y, w, rect_.h };
set_location(rect);
}
-void widget::set_width(int w)
+void widget::set_height(unsigned h)
{
- SDL_Rect rect = { location().x, location().y, w, location().h };
+ SDL_Rect rect = { rect_.x, rect_.y, rect_.w, h };
set_location(rect);
}
-void widget::set_height(int h)
+void widget::set_measurements(unsigned w, unsigned h)
{
- SDL_Rect rect = { location().x, location().y, location().w, h };
+ SDL_Rect rect = { rect_.x, rect_.y, w, h };
set_location(rect);
}
-size_t widget::width() const
+unsigned widget::width() const
{
return rect_.w;
}
-size_t widget::height() const
+unsigned widget::height() const
{
return rect_.h;
}
Index: wesnoth/src/widgets/widget.hpp
diff -u wesnoth/src/widgets/widget.hpp:1.19 wesnoth/src/widgets/widget.hpp:1.20
--- wesnoth/src/widgets/widget.hpp:1.19 Mon Nov 1 18:06:37 2004
+++ wesnoth/src/widgets/widget.hpp Sat Nov 6 13:13:16 2004
@@ -16,13 +16,14 @@
{
public:
SDL_Rect const &location() const;
- virtual void set_location(SDL_Rect const &rect);
+ void set_location(SDL_Rect const &rect);
void set_location(int x, int y);
- void set_width(int w);
- void set_height(int h);
+ void set_width(unsigned w);
+ void set_height(unsigned h);
+ void set_measurements(unsigned w, unsigned h);
- size_t width() const;
- size_t height() const;
+ unsigned width() const;
+ unsigned height() const;
virtual bool focus() const;
void set_focus(bool focus);
@@ -56,7 +57,7 @@
// During each relocation, this function should be called to register
// the rectangles the widget needs to refresh automatically
- void register_rectangle(SDL_Rect const &rect);
+ void bg_register(SDL_Rect const &rect);
void bg_restore() const;
void bg_restore(SDL_Rect const &rect) const;
@@ -66,6 +67,7 @@
virtual void draw();
virtual void draw_contents() {};
+ virtual void update_location(SDL_Rect const &rect);
private:
void volatile_draw();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src dialogs.cpp dialogs.hpp help.cpp mu...,
Guillaume Melquiond <=