CVSROOT: /cvsroot/wesnoth Module name: wesnoth Branch: Changes by: Yann Dirson <[EMAIL PROTECTED]> 05/03/18 21:21:48
Modified files: src : about.cpp about.hpp ai.cpp dialogs.cpp dialogs.hpp display.cpp filechooser.cpp game.cpp help.cpp intro.cpp mapgen_dialog.cpp multiplayer_connect.cpp multiplayer_create.cpp multiplayer_lobby.cpp multiplayer_ui.cpp multiplayer_ui.hpp multiplayer_wait.cpp playturn.cpp preferences.cpp show_dialog.cpp show_dialog.hpp titlescreen.cpp src/editor : editor_dialogs.cpp editor_palettes.cpp src/widgets : button.cpp button.hpp combo.cpp combo.hpp file_chooser.cpp file_chooser.hpp label.cpp label.hpp menu.cpp menu.hpp progressbar.cpp progressbar.hpp scrollarea.cpp scrollarea.hpp scrollbar.cpp scrollbar.hpp scrollpane.cpp scrollpane.hpp slider.cpp slider.hpp textbox.cpp textbox.hpp widget.cpp widget.hpp Log message: cleanup of deps against display: most widgets do not need a display at all CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/about.cpp.diff?tr1=1.104&tr2=1.105&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/about.hpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/ai.cpp.diff?tr1=1.142&tr2=1.143&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.88&tr2=1.89&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.hpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.302&tr2=1.303&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filechooser.cpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.206&tr2=1.207&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.76&tr2=1.77&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/intro.cpp.diff?tr1=1.70&tr2=1.71&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen_dialog.cpp.diff?tr1=1.34&tr2=1.35&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.124&tr2=1.125&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_create.cpp.diff?tr1=1.15&tr2=1.16&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_lobby.cpp.diff?tr1=1.67&tr2=1.68&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.cpp.diff?tr1=1.12&tr2=1.13&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_ui.hpp.diff?tr1=1.4&tr2=1.5&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_wait.cpp.diff?tr1=1.13&tr2=1.14&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.342&tr2=1.343&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.143&tr2=1.144&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.115&tr2=1.116&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.hpp.diff?tr1=1.44&tr2=1.45&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/titlescreen.cpp.diff?tr1=1.36&tr2=1.37&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_dialogs.cpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.cpp.diff?tr1=1.60&tr2=1.61&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.hpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/combo.cpp.diff?tr1=1.28&tr2=1.29&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/combo.hpp.diff?tr1=1.21&tr2=1.22&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/file_chooser.cpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/file_chooser.hpp.diff?tr1=1.10&tr2=1.11&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/label.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/label.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.84&tr2=1.85&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.hpp.diff?tr1=1.34&tr2=1.35&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/progressbar.cpp.diff?tr1=1.8&tr2=1.9&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/progressbar.hpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollarea.hpp.diff?tr1=1.5&tr2=1.6&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.cpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollbar.hpp.diff?tr1=1.16&tr2=1.17&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollpane.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/scrollpane.hpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.cpp.diff?tr1=1.38&tr2=1.39&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/slider.hpp.diff?tr1=1.22&tr2=1.23&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.72&tr2=1.73&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.hpp.diff?tr1=1.43&tr2=1.44&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.cpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.hpp.diff?tr1=1.25&tr2=1.26&r1=text&r2=text Patches: Index: wesnoth/src/about.cpp diff -u wesnoth/src/about.cpp:1.104 wesnoth/src/about.cpp:1.105 --- wesnoth/src/about.cpp:1.104 Tue Mar 15 20:01:30 2005 +++ wesnoth/src/about.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: about.cpp,v 1.104 2005/03/15 20:01:30 ydirson Exp $ */ +/* $Id: about.cpp,v 1.105 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -317,27 +317,27 @@ return res; } -void show_about(display& disp) +void show_about(CVideo &video) { std::vector<std::string> text = get_text(); - SDL_Rect rect = {0, 0, disp.x(), disp.y()}; + SDL_Rect rect = {0, 0, video.getx(), video.gety()}; - const surface_restorer restorer(&disp.video(), rect); + const surface_restorer restorer(&video, rect); // Clear the screen - gui::draw_solid_tinted_rectangle(0,0,disp.x()-1,disp.y()-1, - 0,0,0,1.0,disp.video().getSurface()); + gui::draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1, + 0,0,0,1.0,video.getSurface()); update_whole_screen(); const surface map_image(image::get_image(game_config::map_image,image::UNSCALED)); SDL_Rect map_rect; - map_rect.x = disp.x()/2 - map_image->w/2; - map_rect.y = disp.y()/2 - map_image->h/2; + map_rect.x = video.getx()/2 - map_image->w/2; + map_rect.y = video.gety()/2 - map_image->h/2; map_rect.w = map_image->w; map_rect.h = map_image->h; - gui::button close(disp,_("Close")); - close.set_location((disp.x()/2)-(close.width()/2), map_rect.y+map_rect.h+15); + gui::button close(video,_("Close")); + close.set_location((video.getx()/2)-(close.width()/2), map_rect.y+map_rect.h+15); //substitute in the correct control characters for '+' and '-' @@ -373,7 +373,7 @@ do { // draw map to screen, thus erasing all text - SDL_BlitSurface(map_image,&middle_src,disp.video().getSurface(),&middle_dest); + SDL_BlitSurface(map_image,&middle_src,video.getSurface(),&middle_dest); // draw one screen full of text const int line_spacing = 5; @@ -382,7 +382,7 @@ int cur_line = 0; do { - SDL_Rect tr = font::draw_text(&disp.video(),screen_area(),font::SIZE_XLARGE,font::BLACK_COLOUR, + SDL_Rect tr = font::draw_text(&video,screen_area(),font::SIZE_XLARGE,font::BLACK_COLOUR, text[line], map_rect.x + map_rect.w / 8,y); if(is_new_line) { is_new_line = false; @@ -410,8 +410,8 @@ // mask off the upper and lower half of the map, // so text will scroll into view rather than // suddenly appearing out of nowhere - SDL_BlitSurface(map_image,&upper_src,disp.video().getSurface(),&upper_dest); - SDL_BlitSurface(map_image,&lower_src,disp.video().getSurface(),&lower_dest); + SDL_BlitSurface(map_image,&upper_src,video.getSurface(),&upper_dest); + SDL_BlitSurface(map_image,&lower_src,video.getSurface(),&lower_dest); // handle events events::pump(); @@ -420,7 +420,7 @@ // update screen and wait, so the text does not scroll too fast update_rect(map_rect); - disp.video().flip(); + video.flip(); SDL_Delay(20); } while(!close.pressed()); Index: wesnoth/src/about.hpp diff -u wesnoth/src/about.hpp:1.13 wesnoth/src/about.hpp:1.14 --- wesnoth/src/about.hpp:1.13 Wed Mar 9 20:48:42 2005 +++ wesnoth/src/about.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: about.hpp,v 1.13 2005/03/09 20:48:42 ydirson Exp $ */ +/* $Id: about.hpp,v 1.14 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -14,7 +14,7 @@ #ifndef ABOUT_H_INCLUDED #define ABOUT_H_INCLUDED -class display; +class CVideo; #include <vector> #include <string> @@ -22,7 +22,7 @@ namespace about { -void show_about(display& disp); +void show_about(CVideo &video); std::vector<std::string> get_text(); } Index: wesnoth/src/ai.cpp diff -u wesnoth/src/ai.cpp:1.142 wesnoth/src/ai.cpp:1.143 --- wesnoth/src/ai.cpp:1.142 Wed Mar 9 21:21:37 2005 +++ wesnoth/src/ai.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: ai.cpp,v 1.142 2005/03/09 21:21:37 ydirson Exp $ */ +/* $Id: ai.cpp,v 1.143 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -27,7 +27,6 @@ #include "playturn.hpp" #include "preferences.hpp" #include "replay.hpp" -#include "show_dialog.hpp" #include "statistics.hpp" #include "unit_display.hpp" #include "util.hpp" Index: wesnoth/src/dialogs.cpp diff -u wesnoth/src/dialogs.cpp:1.88 wesnoth/src/dialogs.cpp:1.89 --- wesnoth/src/dialogs.cpp:1.88 Tue Mar 15 20:01:30 2005 +++ wesnoth/src/dialogs.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: dialogs.cpp,v 1.88 2005/03/15 20:01:30 ydirson Exp $ */ +/* $Id: dialogs.cpp,v 1.89 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -251,9 +251,9 @@ class save_preview_pane : public gui::preview_pane { public: - save_preview_pane(display& disp, const config& game_config, gamemap* map, const game_data& data, + save_preview_pane(CVideo &video, const config& game_config, gamemap* map, const game_data& data, const std::vector<save_info>& info, const std::vector<config*>& summaries) - : gui::preview_pane(disp), game_config_(&game_config), map_(map), data_(&data), info_(&info), summaries_(&summaries), index_(0) + : gui::preview_pane(video), game_config_(&game_config), map_(map), data_(&data), info_(&info), summaries_(&summaries), index_(0) { set_measurements(200, 400); } @@ -284,7 +284,7 @@ const config& summary = *(*summaries_)[index_]; - surface const screen = disp().video().getSurface(); + surface const screen = video().getSurface(); SDL_Rect const &loc = location(); const SDL_Rect area = { loc.x + save_preview_border, loc.y + save_preview_border, @@ -390,7 +390,7 @@ } } - font::draw_text(&disp().video(), area, font::SIZE_SMALL, font::NORMAL_COLOUR, str.str(), area.x, ypos, true); + font::draw_text(&video(), area, font::SIZE_SMALL, font::NORMAL_COLOUR, str.str(), area.x, ypos, true); } } //end anon namespace @@ -460,7 +460,7 @@ const events::event_context context; if(generate_summaries) { - gui::progress_bar bar(disp); + gui::progress_bar bar(disp.video()); const SDL_Rect bar_area = {disp.x()/2 - 100, disp.y()/2 - 20, 200, 40}; bar.set_location(bar_area); @@ -505,7 +505,7 @@ gamemap map_obj(game_config,""); std::vector<gui::preview_pane*> preview_panes; - save_preview_pane save_preview(disp,game_config,&map_obj,data,games,summaries); + save_preview_pane save_preview(disp.video(),game_config,&map_obj,data,games,summaries); preview_panes.push_back(&save_preview); //create an option for whether the replay should be shown or not @@ -551,9 +551,10 @@ } unit_preview_pane::unit_preview_pane(display& disp, const gamemap* map, const unit& u, TYPE type, bool on_left_side) - : gui::preview_pane(disp), details_button_(disp,_("Profile"),gui::button::TYPE_PRESS,"lite_small",gui::button::MINIMUM_SPACE), - map_(map), units_(&unit_store_), index_(0), left_(on_left_side), - weapons_(type == SHOW_ALL) + : gui::preview_pane(disp.video()), disp_(disp), + details_button_(disp.video(),_("Profile"),gui::button::TYPE_PRESS,"lite_small",gui::button::MINIMUM_SPACE), + map_(map), units_(&unit_store_), index_(0), left_(on_left_side), + weapons_(type == SHOW_ALL) { unsigned w = font::relative_size(weapons_ ? 200 : 190); unsigned h = font::relative_size(weapons_ ? 370 : 140); @@ -562,9 +563,10 @@ } unit_preview_pane::unit_preview_pane(display& disp, const gamemap* map, const std::vector<unit>& units, TYPE type, bool on_left_side) - : gui::preview_pane(disp), details_button_(disp,_("Profile"),gui::button::TYPE_PRESS,"lite_small",gui::button::MINIMUM_SPACE), - map_(map), units_(&units), index_(0), left_(on_left_side), - weapons_(type == SHOW_ALL) + : gui::preview_pane(disp.video()), disp_(disp), + details_button_(disp.video(),_("Profile"),gui::button::TYPE_PRESS,"lite_small",gui::button::MINIMUM_SPACE), + map_(map), units_(&units), index_(0), left_(on_left_side), + weapons_(type == SHOW_ALL) { set_measurements(font::relative_size(200), font::relative_size(370)); } @@ -601,7 +603,7 @@ const bool right_align = left_side(); - surface const screen = disp().video().getSurface(); + surface const screen = video().getSurface(); SDL_Rect const &loc = location(); const SDL_Rect area = { loc.x + unit_preview_border, loc.y + unit_preview_border, @@ -637,7 +639,7 @@ desc << font::NORMAL_TEXT << u.description(); const std::string description = desc.str(); description_rect = font::text_area(description,font::SIZE_NORMAL); - description_rect = font::draw_text(&disp().video(),area,font::SIZE_NORMAL,font::NORMAL_COLOUR,desc.str(),right_align ? image_rect.x : image_rect.x + image_rect.w - description_rect.w,image_rect.y+image_rect.h+details_button_.location().h); + description_rect = font::draw_text(&video(),area,font::SIZE_NORMAL,font::NORMAL_COLOUR,desc.str(),right_align ? image_rect.x : image_rect.x + image_rect.w - description_rect.w,image_rect.y+image_rect.h+details_button_.location().h); } std::stringstream details; @@ -716,7 +718,7 @@ xpos = cur_area.x + cur_area.w - line_area.w; } - cur_area = font::draw_text(&disp().video(),location(),font::SIZE_SMALL,font::NORMAL_COLOUR,*line,xpos,cur_area.y); + cur_area = font::draw_text(&video(),location(),font::SIZE_SMALL,font::NORMAL_COLOUR,*line,xpos,cur_area.y); cur_area.y += cur_area.h; } } @@ -725,11 +727,11 @@ { if(map_ != NULL && details_button_.pressed() && index_ >= 0 && index_ < int(units_->size())) { - show_unit_description(disp(), (*units_)[index_]); + show_unit_description(disp_, (*units_)[index_]); } } -void show_unit_description(display& disp, const unit& u) +void show_unit_description(display &disp, const unit& u) { help::show_help(disp,"unit_" + u.type().id()); } @@ -739,7 +741,7 @@ static const int campaign_preview_border = 10; } -campaign_preview_pane::campaign_preview_pane(display& disp,std::vector<std::pair<std::string,std::string> >* desc) : gui::preview_pane(disp),descriptions_(desc),index_(0) +campaign_preview_pane::campaign_preview_pane(CVideo &video,std::vector<std::pair<std::string,std::string> >* desc) : gui::preview_pane(video),descriptions_(desc),index_(0) { set_measurements(350, 400); } @@ -771,7 +773,7 @@ /* background frame */ static const std::string default_style("mainmenu"); const std::string* style = &default_style; - gui::draw_dialog_frame(area.x,area.y,area.w,area.h,disp(),style); + gui::draw_dialog_frame(area.x,area.y,area.w,area.h,video(),style); /* description text */ const std::string& desc_text = font::word_wrap_text((*descriptions_)[index_].first,font::SIZE_SMALL,area.w-2*campaign_preview_border); @@ -779,7 +781,7 @@ SDL_Rect txt_area = { area.x+campaign_preview_border,area.y,0,0 }; for(std::vector<std::string>::const_iterator line = lines.begin(); line != lines.end(); ++line) { - txt_area = font::draw_text(&disp().video(),location(),font::SIZE_SMALL,font::NORMAL_COLOUR,*line,txt_area.x,txt_area.y); + txt_area = font::draw_text(&video(),location(),font::SIZE_SMALL,font::NORMAL_COLOUR,*line,txt_area.x,txt_area.y); txt_area.y += txt_area.h; } @@ -799,7 +801,7 @@ dst_rect.x = area.x+(area.w-src_rect.w)/2; dst_rect.y = txt_area.y+(max_height-src_rect.h)/2; - SDL_BlitSurface(img,&src_rect,disp().video().getSurface(),&dst_rect); + SDL_BlitSurface(img,&src_rect,video().getSurface(),&dst_rect); } } Index: wesnoth/src/dialogs.hpp diff -u wesnoth/src/dialogs.hpp:1.30 wesnoth/src/dialogs.hpp:1.31 --- wesnoth/src/dialogs.hpp:1.30 Wed Mar 9 22:21:54 2005 +++ wesnoth/src/dialogs.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: dialogs.hpp,v 1.30 2005/03/09 22:21:54 ydirson Exp $ */ +/* $Id: dialogs.hpp,v 1.31 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -65,8 +65,8 @@ public: enum TYPE { SHOW_ALL, SHOW_BASIC }; - unit_preview_pane(display& disp, const gamemap* map, const unit& u, TYPE type=SHOW_ALL, bool left_side=true); - unit_preview_pane(display& disp, const gamemap* map, const std::vector<unit>& units, TYPE type=SHOW_ALL, bool left_side=true); + unit_preview_pane(display &disp, const gamemap* map, const unit& u, TYPE type=SHOW_ALL, bool left_side=true); + unit_preview_pane(display &disp, const gamemap* map, const std::vector<unit>& units, TYPE type=SHOW_ALL, bool left_side=true); bool show_above() const; bool left_side() const; @@ -83,15 +83,16 @@ int index_; bool left_; bool weapons_; + display& disp_; }; -void show_unit_description(display& disp, const unit& u); +void show_unit_description(display &disp, const unit& u); class campaign_preview_pane : public gui::preview_pane { public: - campaign_preview_pane(display& disp,std::vector<std::pair<std::string,std::string> >* descriptions); + campaign_preview_pane(CVideo &video,std::vector<std::pair<std::string,std::string> >* descriptions); bool show_above() const; bool left_side() const; Index: wesnoth/src/display.cpp diff -u wesnoth/src/display.cpp:1.302 wesnoth/src/display.cpp:1.303 --- wesnoth/src/display.cpp:1.302 Wed Mar 16 22:43:47 2005 +++ wesnoth/src/display.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: display.cpp,v 1.302 2005/03/16 22:43:47 ydirson Exp $ */ +/* $Id: display.cpp,v 1.303 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -2149,7 +2149,7 @@ const std::vector<theme::menu>& buttons = theme_.menus(); for(std::vector<theme::menu>::const_iterator i = buttons.begin(); i != buttons.end(); ++i) { - gui::button b(*this,i->title(),gui::button::TYPE_PRESS,i->image()); + gui::button b(screen_,i->title(),gui::button::TYPE_PRESS,i->image()); const SDL_Rect& loc = i->location(screen_area()); b.set_location(loc.x,loc.y); Index: wesnoth/src/editor/editor_dialogs.cpp diff -u wesnoth/src/editor/editor_dialogs.cpp:1.25 wesnoth/src/editor/editor_dialogs.cpp:1.26 --- wesnoth/src/editor/editor_dialogs.cpp:1.25 Tue Mar 15 20:01:31 2005 +++ wesnoth/src/editor/editor_dialogs.cpp Fri Mar 18 21:21:48 2005 @@ -68,7 +68,7 @@ SDL_Rect dialog_rect = {xpos-10,ypos-10,width+20,height+20}; surface_restorer restorer(&disp.video(),dialog_rect); - gui::draw_dialog_frame(xpos,ypos,width,height,disp); + gui::draw_dialog_frame(xpos,ypos,width,height,disp.video()); SDL_Rect title_rect = font::draw_text(NULL,screen_area(),24,font::NORMAL_COLOUR, _("Create New Map"),0,0); @@ -90,10 +90,10 @@ width_rect.y = ypos + title_rect.h + vertical_margin*2; height_rect.y = width_rect.y + width_rect.h + vertical_margin; - gui::button new_map_button(disp, _("Generate New Map")); - gui::button random_map_button(disp, _("Generate Random Map")); - gui::button random_map_setting_button(disp, _("Random Generator Settings")); - gui::button cancel_button(disp, _("Cancel")); + gui::button new_map_button(disp.video(), _("Generate New Map")); + gui::button random_map_button(disp.video(), _("Generate Random Map")); + gui::button random_map_setting_button(disp.video(), _("Random Generator Settings")); + gui::button cancel_button(disp.video(), _("Cancel")); new_map_button.set_location(xpos + horz_margin,height_rect.y + height_rect.h + vertical_margin); random_map_button.set_location(xpos + horz_margin,ypos + height - random_map_button.height()-14*2-vertical_margin); @@ -110,14 +110,14 @@ SDL_Rect slider_rect = { slider_left,width_rect.y,slider_right-slider_left,width_rect.h}; slider_rect.y = width_rect.y; - gui::slider width_slider(disp); + gui::slider width_slider(disp.video()); width_slider.set_location(slider_rect); width_slider.set_min(map_min_width); width_slider.set_max(map_max_width); width_slider.set_value(map_width); slider_rect.y = height_rect.y; - gui::slider height_slider(disp); + gui::slider height_slider(disp.video()); height_slider.set_location(slider_rect); height_slider.set_min(map_min_height); height_slider.set_max(map_max_height); @@ -190,7 +190,7 @@ if (draw) { map_width = width_slider.value(); map_height = height_slider.value(); - gui::draw_dialog_frame(xpos,ypos,width,height,disp); + gui::draw_dialog_frame(xpos,ypos,width,height,disp.video()); title_rect = font::draw_text(&disp.video(),screen_area(),24,font::NORMAL_COLOUR, _("Create New Map"), xpos+(width-title_rect.w)/2,ypos+10); @@ -244,13 +244,13 @@ SDL_Rect clip_rect = {0,0,disp.x(),disp.y()}; - gui::button close_button(disp,_("Close Window")); + gui::button close_button(disp.video(),_("Close Window")); std::vector<gui::button*> buttons; buttons.push_back(&close_button); surface_restorer restorer; - gui::draw_dialog(xpos,ypos,width,height,disp,_("Preferences"),NULL,&buttons,&restorer); + gui::draw_dialog(xpos,ypos,width,height,disp.video(),_("Preferences"),NULL,&buttons,&restorer); const std::string& scroll_label = _("Scroll Speed:"); @@ -273,30 +273,30 @@ SDL_Rect slider_rect = { slider_left, scroll_pos, slider_right - slider_left, 10 }; slider_rect.y = scroll_pos; - gui::slider scroll_slider(disp); + gui::slider scroll_slider(disp.video()); scroll_slider.set_location(slider_rect); scroll_slider.set_min(1); scroll_slider.set_max(100); scroll_slider.set_value(preferences::scroll_speed()); - gui::button fullscreen_button(disp,_("Full Screen"), + gui::button fullscreen_button(disp.video(),_("Full Screen"), gui::button::TYPE_CHECK); fullscreen_button.set_check(preferences::fullscreen()); fullscreen_button.set_location(slider_left,scroll_pos + 80); - gui::button grid_button(disp,_("Show Grid"), + gui::button grid_button(disp.video(),_("Show Grid"), gui::button::TYPE_CHECK); grid_button.set_check(preferences::grid()); grid_button.set_location(slider_left + fullscreen_button.width() + 100, scroll_pos + 80); - gui::button resolution_button(disp,_("Video Mode")); + gui::button resolution_button(disp.video(),_("Video Mode")); resolution_button.set_location(slider_left,scroll_pos + 80 + 50); - gui::button hotkeys_button (disp,_("Hotkeys")); + gui::button hotkeys_button (disp.video(),_("Hotkeys")); hotkeys_button.set_location(slider_left + fullscreen_button.width() + 100, scroll_pos + 80 + 50); @@ -317,7 +317,7 @@ if(redraw_all) { restorer.cancel(); - gui::draw_dialog(xpos,ypos,width,height,disp,_("Preferences"),NULL,&buttons,&restorer); + gui::draw_dialog(xpos,ypos,width,height,disp.video(),_("Preferences"),NULL,&buttons,&restorer); fullscreen_button.set_dirty(); close_button.set_dirty(); resolution_button.set_dirty(); @@ -382,7 +382,7 @@ SDL_Rect dialog_rect = {xpos-10,ypos-10,width+20,height+20}; surface_restorer restorer(&disp.video(),dialog_rect); - gui::draw_dialog_frame(xpos,ypos,width,height,disp); + gui::draw_dialog_frame(xpos,ypos,width,height,disp.video()); SDL_Rect title_rect = font::draw_text(NULL,screen_area(),24,font::NORMAL_COLOUR, _("Resize Map"),0,0); @@ -404,8 +404,8 @@ width_rect.y = ypos + title_rect.h + vertical_margin*2; height_rect.y = width_rect.y + width_rect.h + vertical_margin; - gui::button cancel_button(disp, _("Cancel")); - gui::button ok_button(disp, _("Ok")); + gui::button cancel_button(disp.video(), _("Cancel")); + gui::button ok_button(disp.video(), _("Ok")); cancel_button.set_location(xpos + width - cancel_button.width() - horz_margin, ypos + height - cancel_button.height()-14); @@ -420,14 +420,14 @@ SDL_Rect slider_rect = { slider_left,width_rect.y,slider_right-slider_left,width_rect.h}; slider_rect.y = width_rect.y; - gui::slider width_slider(disp); + gui::slider width_slider(disp.video()); width_slider.set_location(slider_rect); width_slider.set_min(map_min_width); width_slider.set_max(map_max_width); width_slider.set_value(map_width); slider_rect.y = height_rect.y; - gui::slider height_slider(disp); + gui::slider height_slider(disp.video()); height_slider.set_location(slider_rect); height_slider.set_min(map_min_height); height_slider.set_max(map_max_height); @@ -443,7 +443,7 @@ if (draw) { map_width = width_slider.value(); map_height = height_slider.value(); - gui::draw_dialog_frame(xpos,ypos,width,height,disp); + gui::draw_dialog_frame(xpos,ypos,width,height,disp.video()); title_rect = font::draw_text(&disp.video(),screen_area(),24,font::NORMAL_COLOUR, _("Resize Map"), xpos+(width-title_rect.w)/2,ypos+10); Index: wesnoth/src/editor/editor_palettes.cpp diff -u wesnoth/src/editor/editor_palettes.cpp:1.25 wesnoth/src/editor/editor_palettes.cpp:1.26 --- wesnoth/src/editor/editor_palettes.cpp:1.25 Thu Mar 10 21:42:10 2005 +++ wesnoth/src/editor/editor_palettes.cpp Fri Mar 18 21:21:48 2005 @@ -34,9 +34,9 @@ terrain_palette::terrain_palette(display &gui, const size_specs &sizes, const gamemap &map) - : gui::widget(gui), size_specs_(sizes), gui_(gui), tstart_(0), map_(map), - top_button_(gui, "", gui::button::TYPE_PRESS, "uparrow-button"), - bot_button_(gui, "", gui::button::TYPE_PRESS, "downarrow-button") { + : gui::widget(gui.video()), size_specs_(sizes), gui_(gui), tstart_(0), map_(map), + top_button_(gui.video(), "", gui::button::TYPE_PRESS, "uparrow-button"), + bot_button_(gui.video(), "", gui::button::TYPE_PRESS, "downarrow-button") { terrains_ = map_.get_terrain_list(); terrains_.erase(std::remove_if(terrains_.begin(), terrains_.end(), is_invalid_terrain), terrains_.end()); @@ -330,7 +330,7 @@ // } brush_bar::brush_bar(display &gui, const size_specs &sizes) - : gui::widget(gui), size_specs_(sizes), gui_(gui), selected_(0), total_brush_(3), + : gui::widget(gui.video()), size_specs_(sizes), gui_(gui), selected_(0), total_brush_(3), size_(30) { adjust_size(); } Index: wesnoth/src/filechooser.cpp diff -u wesnoth/src/filechooser.cpp:1.6 wesnoth/src/filechooser.cpp:1.7 --- wesnoth/src/filechooser.cpp:1.6 Tue Mar 15 21:47:40 2005 +++ wesnoth/src/filechooser.cpp Fri Mar 18 21:21:48 2005 @@ -35,12 +35,12 @@ yloc = scr->h / 2 - height / 2; } std::vector<gui::button*> buttons_ptr; - gui::button ok_button_(disp, _("Ok")); - gui::button cancel_button_(disp, _("Cancel")); + gui::button ok_button_(disp.video(), _("Ok")); + gui::button cancel_button_(disp.video(), _("Cancel")); buttons_ptr.push_back(&ok_button_); buttons_ptr.push_back(&cancel_button_); surface_restorer restorer; - gui::draw_dialog(xloc, yloc, width, height, disp, title, NULL, &buttons_ptr, &restorer); + gui::draw_dialog(xloc, yloc, width, height, disp.video(), title, NULL, &buttons_ptr, &restorer); gui::file_chooser fc(disp, filename); fc.set_location(xloc + left_padding, yloc + top_padding); Index: wesnoth/src/game.cpp diff -u wesnoth/src/game.cpp:1.206 wesnoth/src/game.cpp:1.207 --- wesnoth/src/game.cpp:1.206 Tue Mar 15 20:01:31 2005 +++ wesnoth/src/game.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: game.cpp,v 1.206 2005/03/15 20:01:31 ydirson Exp $ */ +/* $Id: game.cpp,v 1.207 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -966,7 +966,7 @@ int res = 0; - dialogs::campaign_preview_pane campaign_preview(disp(),&campaign_desc); + dialogs::campaign_preview_pane campaign_preview(disp().video(),&campaign_desc); std::vector<gui::preview_pane*> preview_panes; preview_panes.push_back(&campaign_preview); @@ -1430,7 +1430,7 @@ const LEVEL_RESULT result = ::play_game(disp(),state_,game_config_,units_data_,video_); if(result == VICTORY) { the_end(disp().video()); - about::show_about(disp()); + about::show_about(disp().video()); } } catch(gamestatus::load_game_exception& e) { @@ -1672,7 +1672,7 @@ game.disp().redraw_everything(); continue; } else if(res == gui::SHOW_ABOUT) { - about::show_about(game.disp()); + about::show_about(game.disp().video()); continue; } Index: wesnoth/src/help.cpp diff -u wesnoth/src/help.cpp:1.76 wesnoth/src/help.cpp:1.77 --- wesnoth/src/help.cpp:1.76 Mon Mar 14 23:50:52 2005 +++ wesnoth/src/help.cpp Fri Mar 18 21:21:48 2005 @@ -161,7 +161,7 @@ /// navigated through and chosen. class help_menu : public gui::menu { public: - help_menu(display& disp, const section &toplevel, int max_height=-1); + help_menu(CVideo &video, const section &toplevel, int max_height=-1); int process(); /// Make the topic the currently selected one, and expand all @@ -235,7 +235,7 @@ /// The area where the content is shown in the help browser. class help_text_area : public gui::scrollarea { public: - help_text_area(display &disp, const section &toplevel); + help_text_area(CVideo &video, const section &toplevel); /// Display the topic. void show_topic(const topic &t); @@ -1450,8 +1450,8 @@ sections.clear(); } -help_menu::help_menu(display &disp, section const &toplevel, int max_height) - : gui::menu(disp, empty_string_vector, false, max_height), +help_menu::help_menu(CVideo &video, section const &toplevel, int max_height) + : gui::menu(video, empty_string_vector, false, max_height), toplevel_(toplevel), chosen_topic_(NULL), selected_item_(&toplevel, "") { update_visible_items(toplevel_); display_visible_items(); @@ -1609,8 +1609,8 @@ return t == vis_item.t && sec == vis_item.sec; } -help_text_area::help_text_area(display &disp, const section &toplevel) - : gui::scrollarea(disp), toplevel_(toplevel), shown_topic_(NULL), +help_text_area::help_text_area(CVideo &video, const section &toplevel) + : gui::scrollarea(video), toplevel_(toplevel), shown_topic_(NULL), title_spacing_(16), curr_loc_(0, 0), min_row_height_(font::get_max_height(normal_font_size)), curr_row_height_(min_row_height_), contents_height_(0) @@ -2066,7 +2066,7 @@ void help_text_area::draw_contents() { SDL_Rect const &loc = inner_location(); bg_restore(); - surface const screen = disp().video().getSurface(); + surface const screen = video().getSurface(); clip_rect_setter clip_rect_set(screen, loc); for(std::list<item>::const_iterator it = items_.begin(), end = items_.end(); it != end; ++it) { SDL_Rect dst = it->rect; @@ -2118,10 +2118,10 @@ help_browser::help_browser(display &disp, const section &toplevel) - : gui::widget(disp), disp_(disp), menu_(disp, toplevel), - text_area_(disp, toplevel), toplevel_(toplevel), ref_cursor_(false), - back_button_(disp, _("< Back"), gui::button::TYPE_PRESS), - forward_button_(disp, _("Forward >"), gui::button::TYPE_PRESS), + : gui::widget(disp.video()), disp_(disp), menu_(disp.video(), toplevel), + text_area_(disp.video(), toplevel), toplevel_(toplevel), ref_cursor_(false), + back_button_(disp.video(), _("< Back"), gui::button::TYPE_PRESS), + forward_button_(disp.video(), _("Forward >"), gui::button::TYPE_PRESS), shown_topic_(NULL) { // Hide the buttons at first since we do not have any forward or // back topics at this point. They will be unhidden when history @@ -2581,10 +2581,10 @@ yloc = scr->h / 2 - height / 2; } std::vector<gui::button*> buttons_ptr; - gui::button close_button_(disp, _("Close")); + gui::button close_button_(disp.video(), _("Close")); buttons_ptr.push_back(&close_button_); surface_restorer restorer; - gui::draw_dialog(xloc, yloc, width, height, disp, _("The Battle for Wesnoth Help"), + gui::draw_dialog(xloc, yloc, width, height, disp.video(), _("The Battle for Wesnoth Help"), NULL, &buttons_ptr, &restorer); if (preferences::encountered_units().size() != last_num_encountered_units Index: wesnoth/src/intro.cpp diff -u wesnoth/src/intro.cpp:1.70 wesnoth/src/intro.cpp:1.71 --- wesnoth/src/intro.cpp:1.70 Wed Mar 16 20:36:36 2005 +++ wesnoth/src/intro.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: intro.cpp,v 1.70 2005/03/16 20:36:36 ydirson Exp $ */ +/* $Id: intro.cpp,v 1.71 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -36,7 +36,7 @@ const int min_room_at_bottom = 150; } -bool show_intro_part(display& screen, const config& part, +bool show_intro_part(CVideo &video, const config& part, const std::string& scenario); void show_intro(display& screen, const config& data, const config& level) @@ -56,7 +56,7 @@ std::pair<const std::string*, const config*> item = *i; if(*item.first == "part") { - showing = show_intro_part(screen, (*item.second), scenario); + showing = show_intro_part(screen.video(), (*item.second), scenario); } else if(*item.first == "if") { const std::string type = game_events::conditional_passed( NULL, *item.second) ? "then":"else"; @@ -73,7 +73,7 @@ std::cerr << "intro sequence finished...\n"; } -bool show_intro_part(display& screen, const config& part, +bool show_intro_part(CVideo &video, const config& part, const std::string& scenario) { std::cerr << "showing intro part\n"; @@ -87,11 +87,11 @@ CKey key; - gui::button next_button(screen,_("Next") + std::string(">>>")); - gui::button skip_button(screen,_("Skip")); + gui::button next_button(video,_("Next") + std::string(">>>")); + gui::button skip_button(video,_("Skip")); - gui::draw_solid_tinted_rectangle(0,0,screen.x()-1,screen.y()-1, - 0,0,0,1.0,screen.video().getSurface()); + gui::draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1, + 0,0,0,1.0,video.getSurface()); const std::string& background_name = part["background"]; @@ -108,20 +108,20 @@ SDL_Rect dstrect; if(!background.null()) { - dstrect.x = screen.x()/2 - background->w/2; - dstrect.y = screen.y()/2 - background->h/2; + dstrect.x = video.getx()/2 - background->w/2; + dstrect.y = video.gety()/2 - background->h/2; dstrect.w = background->w; dstrect.h = background->h; - if(dstrect.y + dstrect.h > screen.y() - min_room_at_bottom) { - dstrect.y = maximum<int>(0,screen.y() - dstrect.h - min_room_at_bottom); + if(dstrect.y + dstrect.h > video.gety() - min_room_at_bottom) { + dstrect.y = maximum<int>(0,video.gety() - dstrect.h - min_room_at_bottom); } - SDL_BlitSurface(background,NULL,screen.video().getSurface(),&dstrect); + SDL_BlitSurface(background,NULL,video.getSurface(),&dstrect); #ifdef USE_TINY_GUI textx = 10; - int xbuttons = screen.x() - 50; + int xbuttons = video.getx() - 50; #else textx = dstrect.x; int xbuttons = dstrect.x+dstrect.w-40; @@ -131,21 +131,21 @@ next_button.set_location(xbuttons,dstrect.y+dstrect.h+20); skip_button.set_location(xbuttons,dstrect.y+dstrect.h+70); } else { - next_button.set_location(screen.x()-200,screen.y()-150); - skip_button.set_location(screen.x()-200,screen.y()-100); + next_button.set_location(video.getx()-200,video.gety()-150); + skip_button.set_location(video.getx()-200,video.gety()-100); } //draw title if needed if(show_title) { - const SDL_Rect area = {0,0,screen.x(),screen.y()}; + const SDL_Rect area = {0,0,video.getx(),video.gety()}; const SDL_Rect scenario_size = font::draw_text(NULL,area,font::SIZE_XLARGE,font::NORMAL_COLOUR,scenario,0,0); - update_rect(font::draw_text(&screen.video(),area,font::SIZE_XLARGE,font::NORMAL_COLOUR,scenario, + update_rect(font::draw_text(&video,area,font::SIZE_XLARGE,font::NORMAL_COLOUR,scenario, dstrect.x,dstrect.y - scenario_size.h - 4)); } update_whole_screen(); - screen.video().flip(); + video.flip(); if(!background.null()) { //draw images @@ -178,7 +178,7 @@ image_rect.w = img->w; image_rect.h = img->h; - SDL_BlitSurface(img,NULL,screen.video().getSurface(),&image_rect); + SDL_BlitSurface(img,NULL,video.getSurface(),&image_rect); update_rect(image_rect); @@ -203,7 +203,7 @@ continue; } - screen.video().flip(); + video.flip(); } } @@ -257,7 +257,7 @@ // FIXME: this is broken: it does not take kerning into account. std::string tmp; tmp.append(itor.substr().first, itor.substr().second); - const SDL_Rect rect = font::draw_text(&screen.video(), + const SDL_Rect rect = font::draw_text(&video, screen_area(),font::SIZE_PLUS, font::NORMAL_COLOUR,tmp,xpos,ypos, false); @@ -291,25 +291,25 @@ events::pump(); events::raise_process_event(); events::raise_draw_event(); - screen.video().flip(); + video.flip(); if(!skip || itor == utils::utf8_iterator::end(story)) SDL_Delay(20); } - gui::draw_solid_tinted_rectangle(0,0,screen.x()-1,screen.y()-1,0,0,0,1.0, - screen.video().getSurface()); + gui::draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,0,0,0,1.0, + video.getSurface()); return true; } -void the_end(CVideo& screen) +void the_end(CVideo& video) { SDL_Rect area = screen_area(); - SDL_FillRect(screen.getSurface(),&area,0); + SDL_FillRect(video.getSurface(),&area,0); update_whole_screen(); - screen.flip(); + video.flip(); const std::string text = _("The End"); const size_t font_size = font::SIZE_XLARGE; @@ -320,11 +320,11 @@ for(size_t n = 0; n < 255; n += 5) { const SDL_Color col = {n,n,n,n}; - font::draw_text(&screen,area,font_size,col,text,area.x,area.y); + font::draw_text(&video,area,font_size,col,text,area.x,area.y); update_rect(area); - screen.flip(); + video.flip(); - SDL_FillRect(screen.getSurface(),&area,0); + SDL_FillRect(video.getSurface(),&area,0); SDL_Delay(10); } Index: wesnoth/src/mapgen_dialog.cpp diff -u wesnoth/src/mapgen_dialog.cpp:1.34 wesnoth/src/mapgen_dialog.cpp:1.35 --- wesnoth/src/mapgen_dialog.cpp:1.34 Tue Mar 15 20:01:31 2005 +++ wesnoth/src/mapgen_dialog.cpp Fri Mar 18 21:21:48 2005 @@ -66,20 +66,22 @@ const events::resize_lock prevent_resizing; const events::event_context dialog_events_context; + CVideo& screen = disp.video(); + const int width = 600; const int height = 400; - const int xpos = disp.x()/2 - width/2; - int ypos = disp.y()/2 - height/2; + const int xpos = screen.getx()/2 - width/2; + int ypos = screen.gety()/2 - height/2; surface_restorer restorer; - gui::button close_button(disp,_("Close Window")); + gui::button close_button(screen,_("Close Window")); std::vector<gui::button*> buttons(1,&close_button); - gui::draw_dialog(xpos,ypos,width,height,disp,_("Map Generator"),NULL,&buttons,&restorer); + gui::draw_dialog(xpos,ypos,width,height,screen,_("Map Generator"),NULL,&buttons,&restorer); SDL_Rect dialog_rect = {xpos,ypos,width,height}; - surface_restorer dialog_restorer(&disp.video(),dialog_rect); + surface_restorer dialog_restorer(&screen,dialog_rect); const std::string& players_label = _("Players:"); const std::string& width_label = _("Width:"); @@ -126,7 +128,7 @@ const int slider_left = text_right + 10; const int slider_right = xpos + width - horz_margin - right_space; SDL_Rect slider_rect = { slider_left,players_rect.y,slider_right-slider_left,players_rect.h}; - gui::slider players_slider(disp); + gui::slider players_slider(screen); players_slider.set_location(slider_rect); players_slider.set_min(2); players_slider.set_max(max_players); @@ -138,14 +140,14 @@ const int extra_size_per_player = 2; slider_rect.y = width_rect.y; - gui::slider width_slider(disp); + gui::slider width_slider(screen); width_slider.set_location(slider_rect); width_slider.set_min(min_width+(players_slider.value()-2)*extra_size_per_player); width_slider.set_max(max_width); width_slider.set_value(width_); slider_rect.y = height_rect.y; - gui::slider height_slider(disp); + gui::slider height_slider(screen); height_slider.set_location(slider_rect); height_slider.set_min(min_width+(players_slider.value()-2)*extra_size_per_player); height_slider.set_max(max_height); @@ -155,7 +157,7 @@ const int max_iterations = 3000; slider_rect.y = iterations_rect.y; - gui::slider iterations_slider(disp); + gui::slider iterations_slider(screen); iterations_slider.set_location(slider_rect); iterations_slider.set_min(min_iterations); iterations_slider.set_max(max_iterations); @@ -165,7 +167,7 @@ const int max_hillsize = 50; slider_rect.y = hillsize_rect.y; - gui::slider hillsize_slider(disp); + gui::slider hillsize_slider(screen); hillsize_slider.set_location(slider_rect); hillsize_slider.set_min(min_hillsize); hillsize_slider.set_max(max_hillsize); @@ -175,7 +177,7 @@ const int max_villages = 50; slider_rect.y = villages_rect.y; - gui::slider villages_slider(disp); + gui::slider villages_slider(screen); villages_slider.set_location(slider_rect); villages_slider.set_min(min_villages); villages_slider.set_max(max_villages); @@ -184,7 +186,7 @@ const int min_landform = 0; const int max_landform = int(max_island); slider_rect.y = landform_rect.y; - gui::slider landform_slider(disp); + gui::slider landform_slider(screen); landform_slider.set_location(slider_rect); landform_slider.set_min(min_landform); landform_slider.set_max(max_landform); @@ -193,7 +195,7 @@ SDL_Rect link_rect = slider_rect; link_rect.y = link_rect.y + link_rect.h + vertical_margin; - gui::button link_castles(disp,_("Roads Between Castles"),gui::button::TYPE_CHECK); + gui::button link_castles(screen,_("Roads Between Castles"),gui::button::TYPE_CHECK); link_castles.set_check(link_castles_); link_castles.set_location(link_rect); @@ -226,37 +228,37 @@ events::raise_process_event(); events::raise_draw_event(); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,players_label,players_rect.x,players_rect.y); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,width_label,width_rect.x,width_rect.y); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,height_label,height_rect.x,height_rect.y); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,iterations_label,iterations_rect.x,iterations_rect.y); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,hillsize_label,hillsize_rect.x,hillsize_rect.y); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,villages_label,villages_rect.x,villages_rect.y); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,landform_label,landform_rect.x,landform_rect.y); + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,players_label,players_rect.x,players_rect.y); + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,width_label,width_rect.x,width_rect.y); + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,height_label,height_rect.x,height_rect.y); + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,iterations_label,iterations_rect.x,iterations_rect.y); + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,hillsize_label,hillsize_rect.x,hillsize_rect.y); + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,villages_label,villages_rect.x,villages_rect.y); + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,landform_label,landform_rect.x,landform_rect.y); std::stringstream players_str; players_str << nplayers_; - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,players_str.str(), + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,players_str.str(), slider_right+horz_margin,players_rect.y); std::stringstream width_str; width_str << width_; - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,width_str.str(), + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,width_str.str(), slider_right+horz_margin,width_rect.y); std::stringstream height_str; height_str << height_; - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,height_str.str(), + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,height_str.str(), slider_right+horz_margin,height_rect.y); std::stringstream villages_str; villages_str << nvillages_ << _("/1000 tiles"); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,villages_str.str(), + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,villages_str.str(), slider_right+horz_margin,villages_rect.y); std::stringstream landform_str; landform_str << gettext(island_size_ == 0 ? N_("Inland") : (island_size_ < max_coastal ? N_("Coastal") : N_("Island"))); - font::draw_text(&disp.video(),screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,landform_str.str(), + font::draw_text(&screen,screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,landform_str.str(), slider_right+horz_margin,landform_rect.y); update_rect(xpos,ypos,width,height); Index: wesnoth/src/multiplayer_connect.cpp diff -u wesnoth/src/multiplayer_connect.cpp:1.124 wesnoth/src/multiplayer_connect.cpp:1.125 --- wesnoth/src/multiplayer_connect.cpp:1.124 Wed Mar 16 20:31:29 2005 +++ wesnoth/src/multiplayer_connect.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer_connect.cpp,v 1.124 2005/03/16 20:31:29 j_daniel Exp $ */ +/* $Id: multiplayer_connect.cpp,v 1.125 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -47,16 +47,16 @@ index_(index), - player_number_(parent.disp(), lexical_cast_default<std::string>(index+1, ""), + player_number_(parent.video(), lexical_cast_default<std::string>(index+1, ""), font::SIZE_XLARGE, font::GOOD_COLOUR), combo_controller_(parent.disp(), parent.player_types_), - orig_controller_(parent.disp(), cfg["description"], font::SIZE_SMALL), + orig_controller_(parent.video(), cfg["description"], font::SIZE_SMALL), combo_faction_(parent.disp(), parent.player_factions_), combo_leader_(parent.disp(), std::vector<std::string>()), combo_team_(parent.disp(), parent.player_teams_), combo_colour_(parent.disp(), parent.player_colours_), - slider_gold_(parent.disp()), - label_gold_(parent.disp(), "100", font::SIZE_NORMAL, font::GOOD_COLOUR), + slider_gold_(parent.video()), + label_gold_(parent.video(), "100", font::SIZE_NORMAL, font::GOOD_COLOUR), llm_(parent.era_sides_, &parent.game_data_, &combo_leader_), @@ -454,20 +454,20 @@ team_prefix_(std::string(_("Team")) + " "), - waiting_label_(disp, ""), + waiting_label_(video(), ""), message_full_(false), default_controller_(default_controller), - scroll_pane_(disp), - type_title_label_(disp, _("Player/Type"), font::SIZE_NORMAL, font::GOOD_COLOUR), - faction_title_label_(disp, _("Faction"), font::SIZE_NORMAL, font::GOOD_COLOUR), - team_title_label_(disp, _("Team"), font::SIZE_NORMAL, font::GOOD_COLOUR), - colour_title_label_(disp, _("Color"), font::SIZE_NORMAL, font::GOOD_COLOUR), - gold_title_label_(disp, _("Gold"), font::SIZE_NORMAL, font::GOOD_COLOUR), - - ai_(disp, _("Computer vs Computer")), - launch_(disp, _("I'm Ready")), - cancel_(disp, _("Cancel")) + scroll_pane_(video()), + type_title_label_(video(), _("Player/Type"), font::SIZE_NORMAL, font::GOOD_COLOUR), + faction_title_label_(video(), _("Faction"), font::SIZE_NORMAL, font::GOOD_COLOUR), + team_title_label_(video(), _("Team"), font::SIZE_NORMAL, font::GOOD_COLOUR), + colour_title_label_(video(), _("Color"), font::SIZE_NORMAL, font::GOOD_COLOUR), + gold_title_label_(video(), _("Gold"), font::SIZE_NORMAL, font::GOOD_COLOUR), + + ai_(video(), _("Computer vs Computer")), + launch_(video(), _("I'm Ready")), + cancel_(video(), _("Cancel")) { // Send Initial information config response; Index: wesnoth/src/multiplayer_create.cpp diff -u wesnoth/src/multiplayer_create.cpp:1.15 wesnoth/src/multiplayer_create.cpp:1.16 --- wesnoth/src/multiplayer_create.cpp:1.15 Tue Mar 15 20:01:31 2005 +++ wesnoth/src/multiplayer_create.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer_create.cpp,v 1.15 2005/03/15 20:01:31 ydirson Exp $ */ +/* $Id: multiplayer_create.cpp,v 1.16 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -35,27 +35,27 @@ tooltip_manager_(disp.video()), map_selection_(-1), - maps_menu_(disp, std::vector<std::string>()), - turns_slider_(disp), - turns_label_(disp, "", font::SIZE_SMALL, font::GOOD_COLOUR), - village_gold_slider_(disp), - village_gold_label_(disp, "", font::SIZE_SMALL, font::GOOD_COLOUR), - xp_modifier_slider_(disp), - xp_modifier_label_(disp, "", font::SIZE_SMALL, font::GOOD_COLOUR), - name_entry_label_(disp, _("Name of game:"), font::SIZE_SMALL, font::GOOD_COLOUR), - num_players_label_(disp, "", font::SIZE_SMALL, font::GOOD_COLOUR), - era_label_(disp, _("Era:"), font::SIZE_SMALL, font::GOOD_COLOUR), - map_label_(disp, _("Map to play:"), font::SIZE_SMALL, font::GOOD_COLOUR), - fog_game_(disp, _("Fog Of War"), gui::button::TYPE_CHECK), - shroud_game_(disp, _("Shroud"), gui::button::TYPE_CHECK), - observers_game_(disp, _("Observers"), gui::button::TYPE_CHECK), - cancel_game_(disp, _("Cancel")), - launch_game_(disp, _("OK")), - regenerate_map_(disp, _("Regenerate")), - generator_settings_(disp, _("Settings...")), + maps_menu_(disp.video(), std::vector<std::string>()), + turns_slider_(disp.video()), + turns_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR), + village_gold_slider_(disp.video()), + village_gold_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR), + xp_modifier_slider_(disp.video()), + xp_modifier_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR), + name_entry_label_(disp.video(), _("Name of game:"), font::SIZE_SMALL, font::GOOD_COLOUR), + num_players_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR), + era_label_(disp.video(), _("Era:"), font::SIZE_SMALL, font::GOOD_COLOUR), + map_label_(disp.video(), _("Map to play:"), font::SIZE_SMALL, font::GOOD_COLOUR), + fog_game_(disp.video(), _("Fog Of War"), gui::button::TYPE_CHECK), + shroud_game_(disp.video(), _("Shroud"), gui::button::TYPE_CHECK), + observers_game_(disp.video(), _("Observers"), gui::button::TYPE_CHECK), + cancel_game_(disp.video(), _("Cancel")), + launch_game_(disp.video(), _("OK")), + regenerate_map_(disp.video(), _("Regenerate")), + generator_settings_(disp.video(), _("Settings...")), era_combo_(disp, std::vector<std::string>()), vision_combo_(disp, std::vector<std::string>()), - name_entry_(disp, 32), + name_entry_(disp.video(), 32), minimap_restorer_(NULL), minimap_rect_(null_rect), generator_(NULL) @@ -189,7 +189,7 @@ set_result(CREATE); return; } else { - gui::show_dialog(disp(), NULL, "", _("You must enter a name."), gui::OK_ONLY); + gui::show_dialog(disp_, NULL, "", _("You must enter a name."), gui::OK_ONLY); } } @@ -267,7 +267,7 @@ } if(generator_ != NULL && generator_->allow_user_config() && generator_settings_.pressed()) { - generator_->user_config(disp()); + generator_->user_config(disp_); map_changed = true; } @@ -311,7 +311,7 @@ const surface mini(image::getMinimap(minimap_rect_.w,minimap_rect_.h,map,0)); if(mini != NULL) { SDL_Rect rect = minimap_rect_; - SDL_BlitSurface(mini, NULL, disp().video().getSurface(), &rect); + SDL_BlitSurface(mini, NULL, video().getSurface(), &rect); update_rect(rect); } const int nsides = parameters_.scenario_data.get_children("side").size(); @@ -353,14 +353,14 @@ if (hide) { minimap_restorer_.assign(NULL); } else { - minimap_restorer_.assign(new surface_restorer(&disp().video(), minimap_rect_)); + minimap_restorer_.assign(new surface_restorer(&video(), minimap_rect_)); const std::string& map_data = parameters_.scenario_data["map_data"]; gamemap map(game_config(), map_data); const surface mini(image::getMinimap(minimap_rect_.w,minimap_rect_.h,map,0)); if(mini != NULL) { SDL_Rect rect = minimap_rect_; - SDL_BlitSurface(mini, NULL, disp().video().getSurface(), &rect); + SDL_BlitSurface(mini, NULL, video().getSurface(), &rect); update_rect(rect); } } @@ -376,7 +376,7 @@ int ypos = ca.y; // Dialog title - ypos += gui::draw_dialog_title(xpos, ypos, &disp().video(), _("Create Game")).h + border_size; + ypos += gui::draw_dialog_title(xpos, ypos, &video(), _("Create Game")).h + border_size; // Name Entry name_entry_label_.set_location(xpos, ypos); Index: wesnoth/src/multiplayer_lobby.cpp diff -u wesnoth/src/multiplayer_lobby.cpp:1.67 wesnoth/src/multiplayer_lobby.cpp:1.68 --- wesnoth/src/multiplayer_lobby.cpp:1.67 Sun Mar 13 10:32:21 2005 +++ wesnoth/src/multiplayer_lobby.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer_lobby.cpp,v 1.67 2005/03/13 10:32:21 silene Exp $ */ +/* $Id: multiplayer_lobby.cpp,v 1.68 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -24,11 +24,11 @@ lobby::lobby(display& disp, const config& cfg, chat& c, config& gamelist) : mp::ui(disp, cfg, c, gamelist), - observe_game_(disp, _("Observe Game")), - join_game_(disp, _("Join Game")), - create_game_(disp, _("Create Game")), - quit_game_(disp, _("Quit")), - games_menu_(disp, std::vector<std::string>()), + observe_game_(disp.video(), _("Observe Game")), + join_game_(disp.video(), _("Join Game")), + create_game_(disp.video(), _("Create Game")), + quit_game_(disp.video(), _("Quit")), + games_menu_(disp.video(), std::vector<std::string>()), current_game_(0) { gamelist_updated(); Index: wesnoth/src/multiplayer_ui.cpp diff -u wesnoth/src/multiplayer_ui.cpp:1.12 wesnoth/src/multiplayer_ui.cpp:1.13 --- wesnoth/src/multiplayer_ui.cpp:1.12 Fri Mar 11 02:30:07 2005 +++ wesnoth/src/multiplayer_ui.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer_ui.cpp,v 1.12 2005/03/11 02:30:07 Sirp Exp $ */ +/* $Id: multiplayer_ui.cpp,v 1.13 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -91,7 +91,8 @@ } ui::ui(display& disp, const config& cfg, chat& c, config& gamelist) : - gui::widget(disp), + gui::widget(disp.video()), + disp_(disp), hotkey_handler_(&disp), disp_manager_(&disp), @@ -100,9 +101,9 @@ chat_(c), gamelist_(gamelist), - chat_textbox_(disp, 100, "", false), - entry_textbox_(disp, 100), - users_menu_(disp, std::vector<std::string>()), + chat_textbox_(disp.video(), 100, "", false), + entry_textbox_(disp.video(), 100), + users_menu_(disp.video(), std::vector<std::string>()), result_(CONTINUE) { @@ -176,10 +177,10 @@ hide_children(); surface background(image::get_image("misc/lobby.png",image::UNSCALED)); - background = scale_surface(background, disp().x(), disp().y()); + background = scale_surface(background, video().getx(), video().gety()); if(background == NULL) return; - SDL_BlitSurface(background, NULL, disp().video().getSurface(), NULL); + SDL_BlitSurface(background, NULL, video().getSurface(), NULL); update_whole_screen(); hide_children(false); Index: wesnoth/src/multiplayer_ui.hpp diff -u wesnoth/src/multiplayer_ui.hpp:1.4 wesnoth/src/multiplayer_ui.hpp:1.5 --- wesnoth/src/multiplayer_ui.hpp:1.4 Wed Mar 9 09:32:11 2005 +++ wesnoth/src/multiplayer_ui.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer_ui.hpp,v 1.4 2005/03/09 09:32:11 ydirson Exp $ */ +/* $Id: multiplayer_ui.hpp,v 1.5 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -13,13 +13,15 @@ #ifndef MULTIPLAYER_UI_HPP_INCLUDED #define MULTIPLAYER_UI_HPP_INCLUDED -#include "widgets/textbox.hpp" -#include "widgets/button.hpp" -#include "widgets/menu.hpp" -#include "network.hpp" +class display; + #include "config.hpp" -#include "preferences.hpp" #include "hotkeys.hpp" +#include "network.hpp" +#include "preferences.hpp" +#include "widgets/button.hpp" +#include "widgets/menu.hpp" +#include "widgets/textbox.hpp" #include <deque> #include <string> @@ -85,6 +87,9 @@ SDL_Rect client_area() const; + display& disp_; + display& disp() { return disp_; }; + // Returns the main game config, as defined by loading the preprocessed // WML files. Children of this class may need this to obtain, for // example, the list of available eras. Index: wesnoth/src/multiplayer_wait.cpp diff -u wesnoth/src/multiplayer_wait.cpp:1.13 wesnoth/src/multiplayer_wait.cpp:1.14 --- wesnoth/src/multiplayer_wait.cpp:1.13 Tue Mar 15 20:01:31 2005 +++ wesnoth/src/multiplayer_wait.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer_wait.cpp,v 1.13 2005/03/15 20:01:31 ydirson Exp $ */ +/* $Id: multiplayer_wait.cpp,v 1.14 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -37,7 +37,7 @@ wait::leader_preview_pane::leader_preview_pane(display& disp, const game_data* data, const config::child_list& side_list) : - gui::preview_pane(disp), + gui::preview_pane(disp.video()), side_list_(side_list), leader_combo_(disp, std::vector<std::string>()), leaders_(side_list, data, &leader_combo_), @@ -57,7 +57,7 @@ { bg_restore(); - surface const screen = disp().video().getSurface(); + surface const screen = video().getSurface(); SDL_Rect const &loc = location(); const SDL_Rect area = { loc.x + leader_pane_border, loc.y + leader_pane_border, @@ -108,10 +108,10 @@ SDL_BlitSurface(unit_image,NULL,screen,&image_rect); } - font::draw_text(&disp().video(),area,font::SIZE_PLUS,font::NORMAL_COLOUR,faction,area.x + 80, area.y + 30); - const SDL_Rect leader_rect = font::draw_text(&disp().video(),area,font::SIZE_SMALL,font::NORMAL_COLOUR, + font::draw_text(&video(),area,font::SIZE_PLUS,font::NORMAL_COLOUR,faction,area.x + 80, area.y + 30); + const SDL_Rect leader_rect = font::draw_text(&video(),area,font::SIZE_SMALL,font::NORMAL_COLOUR, _("Leader: "),area.x, area.y + 80); - font::draw_wrapped_text(&disp().video(),area,font::SIZE_SMALL,font::NORMAL_COLOUR, + font::draw_wrapped_text(&video(),area,font::SIZE_SMALL,font::NORMAL_COLOUR, _("Recruits: ") + recruit_string.str(),area.x, area.y + 102, area.w); @@ -144,9 +144,9 @@ wait::wait(display& disp, const config& cfg, const game_data& data, mp::chat& c, config& gamelist) : ui(disp, cfg, c, gamelist), - cancel_button_(disp, _("Cancel")), - start_label_(disp, _("Waiting for game to start...")), - game_menu_(disp, std::vector<std::string>()), + cancel_button_(disp.video(), _("Cancel")), + start_label_(disp.video(), _("Waiting for game to start...")), + game_menu_(disp.video(), std::vector<std::string>()), game_data_(data), stop_updates_(false) Index: wesnoth/src/playturn.cpp diff -u wesnoth/src/playturn.cpp:1.342 wesnoth/src/playturn.cpp:1.343 --- wesnoth/src/playturn.cpp:1.342 Mon Mar 14 22:26:38 2005 +++ wesnoth/src/playturn.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: playturn.cpp,v 1.342 2005/03/14 22:26:38 gruikya Exp $ */ +/* $Id: playturn.cpp,v 1.343 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -2710,7 +2710,7 @@ textbox_.mode = mode; if(check_label != "") { - textbox_.check.assign(new gui::button(gui_,check_label,gui::button::TYPE_CHECK)); + textbox_.check.assign(new gui::button(gui_.video(),check_label,gui::button::TYPE_CHECK)); textbox_.check->set_check(checked); } @@ -2733,7 +2733,7 @@ return; } - textbox_.box.assign(new gui::textbox(gui_,textbox_width,"",true,256,0.8,0.6)); + textbox_.box.assign(new gui::textbox(gui_.video(),textbox_width,"",true,256,0.8,0.6)); textbox_.box->set_volatile(true); textbox_.box->set_location(area.x + label_area.w + border_size*2,ypos); Index: wesnoth/src/preferences.cpp diff -u wesnoth/src/preferences.cpp:1.143 wesnoth/src/preferences.cpp:1.144 --- wesnoth/src/preferences.cpp:1.143 Tue Mar 15 20:01:31 2005 +++ wesnoth/src/preferences.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: preferences.cpp,v 1.143 2005/03/15 20:01:31 ydirson Exp $ */ +/* $Id: preferences.cpp,v 1.144 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -805,29 +805,30 @@ enum TAB { GENERAL_TAB, DISPLAY_TAB, SOUND_TAB }; TAB tab_; + display &disp_; }; preferences_dialog::preferences_dialog(display& disp) - : gui::preview_pane(disp), - music_slider_(disp), sound_slider_(disp), - scroll_slider_(disp), gamma_slider_(disp), - fullscreen_button_(disp, _("Full Screen"), gui::button::TYPE_CHECK), - turbo_button_(disp, _("Accelerated Speed"), gui::button::TYPE_CHECK), - show_ai_moves_button_(disp, _("Skip AI Moves"), gui::button::TYPE_CHECK), - show_grid_button_(disp, _("Show Grid"), gui::button::TYPE_CHECK), - show_floating_labels_button_(disp, _("Show Floating Labels"), gui::button::TYPE_CHECK), - turn_dialog_button_(disp, _("Turn Dialog"), gui::button::TYPE_CHECK), - turn_bell_button_(disp, _("Turn Bell"), gui::button::TYPE_CHECK), - show_team_colours_button_(disp, _("Show Team Colors"), gui::button::TYPE_CHECK), - show_colour_cursors_button_(disp, _("Show Color Cursors"), gui::button::TYPE_CHECK), - show_haloing_button_(disp, _("Show Haloing Effects"), gui::button::TYPE_CHECK), - video_mode_button_(disp, _("Video Mode")), - hotkeys_button_(disp, _("Hotkeys")), - gamma_button_(disp, _("Adjust Gamma"), gui::button::TYPE_CHECK), - flip_time_button_(disp, _("Reverse Time Graphics"), gui::button::TYPE_CHECK), - music_label_(disp, _("Music Volume:")), sound_label_(disp, _("SFX Volume:")), - scroll_label_(disp, _("Scroll Speed:")), gamma_label_(disp, _("Gamma:")), - slider_label_width_(0), tab_(GENERAL_TAB) + : gui::preview_pane(disp.video()), + music_slider_(disp.video()), sound_slider_(disp.video()), + scroll_slider_(disp.video()), gamma_slider_(disp.video()), + fullscreen_button_(disp.video(), _("Full Screen"), gui::button::TYPE_CHECK), + turbo_button_(disp.video(), _("Accelerated Speed"), gui::button::TYPE_CHECK), + show_ai_moves_button_(disp.video(), _("Skip AI Moves"), gui::button::TYPE_CHECK), + show_grid_button_(disp.video(), _("Show Grid"), gui::button::TYPE_CHECK), + show_floating_labels_button_(disp.video(), _("Show Floating Labels"), gui::button::TYPE_CHECK), + turn_dialog_button_(disp.video(), _("Turn Dialog"), gui::button::TYPE_CHECK), + turn_bell_button_(disp.video(), _("Turn Bell"), gui::button::TYPE_CHECK), + show_team_colours_button_(disp.video(), _("Show Team Colors"), gui::button::TYPE_CHECK), + show_colour_cursors_button_(disp.video(), _("Show Color Cursors"), gui::button::TYPE_CHECK), + show_haloing_button_(disp.video(), _("Show Haloing Effects"), gui::button::TYPE_CHECK), + video_mode_button_(disp.video(), _("Video Mode")), + hotkeys_button_(disp.video(), _("Hotkeys")), + gamma_button_(disp.video(), _("Adjust Gamma"), gui::button::TYPE_CHECK), + flip_time_button_(disp.video(), _("Reverse Time Graphics"), gui::button::TYPE_CHECK), + music_label_(disp.video(), _("Music Volume:")), sound_label_(disp.video(), _("SFX Volume:")), + scroll_label_(disp.video(), _("Scroll Speed:")), gamma_label_(disp.video(), _("Gamma:")), + slider_label_width_(0), tab_(GENERAL_TAB), disp_(disp) { set_measurements(400, 400); @@ -969,7 +970,7 @@ if (show_team_colours_button_.pressed()) set_show_side_colours(show_team_colours_button_.checked()); if (hotkeys_button_.pressed()) - show_hotkeys_dialog(disp()); + show_hotkeys_dialog(disp_); if (show_colour_cursors_button_.pressed()) set_colour_cursors(show_colour_cursors_button_.checked()); if (show_haloing_button_.pressed()) @@ -1141,12 +1142,12 @@ const int width = 600; const int height = 500; - gui::button close_button (disp, _("Close Window")); + gui::button close_button (disp.video(), _("Close Window")); std::vector<gui::button*> buttons; buttons.push_back(&close_button); surface_restorer restorer; - gui::draw_dialog(xpos,ypos,width,height,disp,_("Hotkey Settings"),NULL,&buttons,&restorer); + gui::draw_dialog(xpos,ypos,width,height,disp.video(),_("Hotkey Settings"),NULL,&buttons,&restorer); SDL_Rect clip_rect = { 0, 0, disp.x (), disp.y () }; SDL_Rect text_size = font::draw_text(NULL, clip_rect, font::SIZE_PLUS, @@ -1167,14 +1168,14 @@ menu_items.push_back (str.str ()); } - gui::menu menu_(disp, menu_items, false, height); + gui::menu menu_(disp.video(), menu_items, false, height); menu_.set_width(400); menu_.set_location(xpos + 20, ypos); - gui::button change_button (disp, _("Change Hotkey")); + gui::button change_button (disp.video(), _("Change Hotkey")); change_button.set_location(xpos + width - change_button.width () -30,ypos + 80); - gui::button save_button (disp, _("Save Hotkeys")); + gui::button save_button (disp.video(), _("Save Hotkeys")); save_button.set_location(xpos + width - save_button.width () - 30,ypos + 130); for(;;) { @@ -1192,7 +1193,7 @@ gui::draw_dialog_frame (centerx-text_size.w/2 - 20, centery-text_size.h/2 - 6, text_size.w+40, - text_size.h+12,disp); + text_size.h+12,disp.video()); font::draw_text (&disp.video(), clip_rect, font::SIZE_LARGE,font::NORMAL_COLOUR, _("Press desired HotKey"),centerx-text_size.w/2-10, centery-text_size.h/2-3); Index: wesnoth/src/show_dialog.cpp diff -u wesnoth/src/show_dialog.cpp:1.115 wesnoth/src/show_dialog.cpp:1.116 --- wesnoth/src/show_dialog.cpp:1.115 Tue Mar 15 22:14:04 2005 +++ wesnoth/src/show_dialog.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: show_dialog.cpp,v 1.115 2005/03/15 22:14:04 ydirson Exp $ */ +/* $Id: show_dialog.cpp,v 1.116 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -24,6 +24,7 @@ #include "help.hpp" #include "hotkeys.hpp" #include "image.hpp" +#include "key.hpp" #include "log.hpp" #include "playlevel.hpp" #include "show_dialog.hpp" @@ -86,7 +87,7 @@ SDL_PushEvent(&pb_event); } -void draw_dialog_frame(int x, int y, int w, int h, display& disp, const std::string* dialog_style, surface_restorer* restorer) +void draw_dialog_frame(int x, int y, int w, int h, CVideo &video, const std::string* dialog_style, surface_restorer* restorer) { if(dialog_style == NULL) { static const std::string default_style("menu"); @@ -102,13 +103,13 @@ if(have_border && restorer != NULL) { const SDL_Rect rect = {x-top->h,y-left->w,w+left->w+right->w,h+top->h+bot->h}; - *restorer = surface_restorer(&disp.video(),rect); + *restorer = surface_restorer(&video,rect); } else if(restorer != NULL) { const SDL_Rect rect = {x,y,w,h}; - *restorer = surface_restorer(&disp.video(),rect); + *restorer = surface_restorer(&video,rect); } - draw_dialog_background(x,y,w,h,disp,*dialog_style); + draw_dialog_background(x,y,w,h,video,*dialog_style); if(have_border == false) { return; @@ -117,25 +118,25 @@ surface top_image(scale_surface(top,w,top->h)); if(top_image != NULL) { - disp.video().blit_surface(x,y-top->h,top_image); + video.blit_surface(x,y-top->h,top_image); } surface bot_image(scale_surface(bot,w,bot->h)); if(bot_image != NULL) { - disp.video().blit_surface(x,y+h,bot_image); + video.blit_surface(x,y+h,bot_image); } surface left_image(scale_surface(left,left->w,h)); if(left_image != NULL) { - disp.video().blit_surface(x-left->w,y,left_image); + video.blit_surface(x-left->w,y,left_image); } surface right_image(scale_surface(right,right->w,h)); if(right_image != NULL) { - disp.video().blit_surface(x+w,y,right_image); + video.blit_surface(x+w,y,right_image); } update_rect(x-left->w,y-top->h,w+left->w+right->w,h+top->h+bot->h); @@ -148,13 +149,13 @@ return; } - disp.video().blit_surface(x-top_left->w,y-top_left->h,top_left); - disp.video().blit_surface(x-bot_left->w,y+h,bot_left); - disp.video().blit_surface(x+w,y-top_right->h,top_right); - disp.video().blit_surface(x+w,y+h,bot_right); + video.blit_surface(x-top_left->w,y-top_left->h,top_left); + video.blit_surface(x-bot_left->w,y+h,bot_left); + video.blit_surface(x+w,y-top_right->h,top_right); + video.blit_surface(x+w,y+h,bot_right); } -void draw_dialog_background(int x, int y, int w, int h, display& disp, const std::string& style) +void draw_dialog_background(int x, int y, int w, int h, CVideo &video, const std::string& style) { const std::string menu_background = "misc/" + style + "-background.png"; @@ -164,7 +165,7 @@ return; } - const SDL_Rect& screen_bounds = disp.screen_area(); + const SDL_Rect& screen_bounds = screen_area(); if(x < 0) { w += x; x = 0; @@ -199,23 +200,21 @@ SDL_Rect dst = src; dst.x = x + i; dst.y = y + j; - SDL_BlitSurface(bg,&src,disp.video().getSurface(),&dst); + SDL_BlitSurface(bg,&src,video.getSurface(),&dst); } } } -SDL_Rect draw_dialog_title(int x, int y, CVideo* disp, const std::string& text) +SDL_Rect draw_dialog_title(int x, int y, CVideo* video, const std::string& text) { SDL_Rect rect = {0,0,10000,10000}; - if(disp != NULL) { - rect = screen_area(); - } + rect = screen_area(); - return font::draw_text(disp, rect, font::SIZE_LARGE, font::TITLE_COLOUR, + return font::draw_text(video, rect, font::SIZE_LARGE, font::TITLE_COLOUR, text, x, y + 5, false, TTF_STYLE_BOLD); } -void draw_dialog(int x, int y, int w, int h, display& disp, const std::string& title, +void draw_dialog(int x, int y, int w, int h, CVideo &video, const std::string& title, const std::string* style, std::vector<button*>* buttons, surface_restorer* restorer, button* help_button) { @@ -254,10 +253,10 @@ buttons_area.x += xpos + width; - draw_dialog_frame(xpos,ypos,width,height,disp,style,restorer); + draw_dialog_frame(xpos,ypos,width,height,video,style,restorer); if (!title.empty()) { - draw_dialog_title(x + border_size, y - title_area.h, &disp.video(), title); + draw_dialog_title(x + border_size, y - title_area.h, &video, title); } if(buttons != NULL) { @@ -435,7 +434,7 @@ const bool editable_textbox = use_textbox && std::find(text_widget_text->begin(),text_widget_text->end(),'\n') == text_widget_text->end(); static const std::string default_text_string = ""; const unsigned int text_box_width = 350; - textbox text_widget(disp,text_box_width, + textbox text_widget(screen,text_box_width, use_textbox ? *text_widget_text : default_text_string, editable_textbox, text_widget_max_chars); int text_widget_width = 0; @@ -446,13 +445,13 @@ const SDL_Rect& area = font::text_area(*text_widget_text,message_font_size); - text_widget.set_width(minimum<size_t>(disp.x()/2,maximum<size_t>(area.w,text_widget.location().w))); - text_widget.set_height(minimum<size_t>(disp.y()/2,maximum<size_t>(area.h,text_widget.location().h))); + text_widget.set_width(minimum<size_t>(screen.getx()/2,maximum<size_t>(area.w,text_widget.location().w))); + text_widget.set_height(minimum<size_t>(screen.gety()/2,maximum<size_t>(area.h,text_widget.location().h))); text_widget_width = font::text_area(text_widget_label,message_font_size).w + text_widget.location().w;; text_widget_height = text_widget.location().h + message_font_size; } - menu menu_(disp,menu_items,type == MESSAGE); + menu menu_(screen,menu_items,type == MESSAGE); menu_.set_numeric_keypress_selection(use_textbox == false); @@ -520,7 +519,7 @@ if(button_list != NULL) { try { while((*button_list)[0] != '\0') { - buttons.push_back(button(disp,gettext(*button_list))); + buttons.push_back(button(screen,gettext(*button_list))); ++button_list; } @@ -537,7 +536,7 @@ std::vector<button> check_buttons; if(options != NULL) { for(std::vector<check_item>::const_iterator i = options->begin(); i != options->end(); ++i) { - button check_button(disp,i->label,button::TYPE_CHECK); + button check_button(screen,i->label,button::TYPE_CHECK); check_button_height += check_button.height() + button_height_padding; check_button_width = maximum<int>(check_button.width(),check_button_width); @@ -547,7 +546,7 @@ if(action_buttons != NULL) { for(std::vector<dialog_button>::const_iterator i = action_buttons->begin(); i != action_buttons->end(); ++i) { - button new_button(disp,i->label); + button new_button(screen,i->label); check_button_height += new_button.height() + button_height_padding; check_button_width = maximum<int>(new_button.width(),check_button_width); @@ -648,10 +647,10 @@ surface_restorer restorer; - button help_button(disp,_("Help")); + button help_button(screen,_("Help")); const std::string& title = image == NULL ? caption : ""; - draw_dialog(xframe,yframe,frame_width,frame_height,disp,title,dialog_style,&buttons_ptr,&restorer,help_topic.empty() ? NULL : &help_button); + draw_dialog(xframe,yframe,frame_width,frame_height,screen,title,dialog_style,&buttons_ptr,&restorer,help_topic.empty() ? NULL : &help_button); //calculate the positions of the preview panes to the sides of the dialog if(preview_panes != NULL) { @@ -696,7 +695,7 @@ text_widget_width - text_widget.location().w, text_widget_y_unpadded); events::raise_draw_event(); - font::draw_text(&disp.video(), clipRect, message_font_size, + font::draw_text(&screen, clipRect, message_font_size, font::NORMAL_COLOUR, text_widget_label, xloc + left_padding,text_widget_y_unpadded); } @@ -711,15 +710,15 @@ const int x = xloc + left_padding; const int y = yloc + top_padding; - disp.video().blit_surface(x,y,image); + screen.blit_surface(x,y,image); - font::draw_text(&disp.video(), clipRect, caption_font_size, + font::draw_text(&screen, clipRect, caption_font_size, font::NORMAL_COLOUR, caption, xloc+image_width+left_padding+image_h_padding, yloc+top_padding); } - font::draw_text(&disp.video(), clipRect, message_font_size, + font::draw_text(&screen, clipRect, message_font_size, font::NORMAL_COLOUR, message, xloc+image_width+left_padding+image_h_padding, yloc+top_padding+caption_size.h); @@ -895,7 +894,7 @@ } } - disp.video().flip(); + screen.flip(); SDL_Delay(10); if(action != NULL) { Index: wesnoth/src/show_dialog.hpp diff -u wesnoth/src/show_dialog.hpp:1.44 wesnoth/src/show_dialog.hpp:1.45 --- wesnoth/src/show_dialog.hpp:1.44 Tue Mar 15 20:01:31 2005 +++ wesnoth/src/show_dialog.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: show_dialog.hpp,v 1.44 2005/03/15 20:01:31 ydirson Exp $ */ +/* $Id: show_dialog.hpp,v 1.45 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -15,7 +15,7 @@ #define SHOW_DIALOG_HPP_INCLUDED class config; -class display; +class CVideo; #include "cursor.hpp" #include "font.hpp" @@ -46,9 +46,9 @@ bool reset_to; }; -void draw_dialog_frame(int x, int y, int w, int h, display& disp, const std::string* dialog_style=NULL, surface_restorer* restorer=NULL); +void draw_dialog_frame(int x, int y, int w, int h, CVideo &video, const std::string* dialog_style=NULL, surface_restorer* restorer=NULL); -void draw_dialog_background(int x, int y, int w, int h, display& disp, const std::string& dialog_style); +void draw_dialog_background(int x, int y, int w, int h, CVideo &video, const std::string& dialog_style); void draw_rectangle(int x, int y, int w, int h, Uint32 colour, surface tg); @@ -69,7 +69,7 @@ //below the client area. //if 'restorer' is present, it will be set to a restorer that will reset the screen area //to its original state after the dialog is drawn. -void draw_dialog(int x, int y, int w, int h, display& disp, const std::string& title, +void draw_dialog(int x, int y, int w, int h, CVideo &video, const std::string& title, const std::string* dialog_style=NULL, std::vector<button*>* buttons=NULL, surface_restorer* restorer=NULL, button* help_button=NULL); @@ -116,7 +116,7 @@ //by 'show_dialog' and shows information about the selection. class preview_pane : public widget { public: - preview_pane(display& disp) : widget(disp) {} + preview_pane(CVideo &video) : widget(video) {} virtual ~preview_pane() { tooltips::clear_tooltips(location()); } virtual bool show_above() const { return false; } @@ -130,7 +130,7 @@ //if a menu is given, then returns -1 if the dialog was cancelled, and the //index of the selection otherwise. If no menu is given, returns the index //of the button that was pressed -int show_dialog(display& screen, surface image, +int show_dialog(display &screen, surface image, const std::string& caption, const std::string& message, DIALOG_TYPE type=MESSAGE, const std::vector<std::string>* menu_items=NULL, @@ -145,11 +145,11 @@ const std::string& help_topic="" ); -void show_error_message(display &screen, std::string const &message); +void show_error_message(display &disp, std::string const &message); network::connection network_data_dialog(display& disp, const std::string& msg, config& cfg, network::connection connection_num=0); -void check_quit(display& screen); +void check_quit(CVideo &video); } Index: wesnoth/src/titlescreen.cpp diff -u wesnoth/src/titlescreen.cpp:1.36 wesnoth/src/titlescreen.cpp:1.37 --- wesnoth/src/titlescreen.cpp:1.36 Tue Mar 15 22:14:04 2005 +++ wesnoth/src/titlescreen.cpp Fri Mar 18 21:21:48 2005 @@ -213,21 +213,21 @@ std::vector<button> buttons; size_t b, max_width = 0; for(b = 0; b != nbuttons; ++b) { - buttons.push_back(button(screen,sgettext(button_labels[b]))); + buttons.push_back(button(screen.video(),sgettext(button_labels[b]))); buttons.back().set_help_string(sgettext(help_button_labels[b])); max_width = maximum<size_t>(max_width,buttons.back().width()); } SDL_Rect main_dialog_area = {menu_xbase-padding,menu_ybase-padding,max_width+padding*2,menu_yincr*(nbuttons-1)+buttons.back().height()+padding*2}; std::string style = "mainmenu"; - draw_dialog_frame(main_dialog_area.x,main_dialog_area.y,main_dialog_area.w,main_dialog_area.h,screen,&style); + draw_dialog_frame(main_dialog_area.x,main_dialog_area.y,main_dialog_area.w,main_dialog_area.h,screen.video(),&style); for(b = 0; b != nbuttons; ++b) { buttons[b].set_width(max_width); buttons[b].set_location(menu_xbase + b*menu_xincr, menu_ybase + b*menu_yincr); } - gui::button next_tip_button(screen,_("More"),button::TYPE_PRESS,"lite_small"); + gui::button next_tip_button(screen.video(),_("More"),button::TYPE_PRESS,"lite_small"); if(tips_of_day.empty()) { tips_of_day = get_tips_of_day(); @@ -253,7 +253,7 @@ next_tip_button.set_location(area.x+area.w-next_tip_button.location().w - pad,area.y+area.h - pad - next_tip_button.location().h); - draw_dialog_frame(area.x,area.y,area.w,area.h,screen,&style); + draw_dialog_frame(area.x,area.y,area.w,area.h,screen.video(),&style); font::draw_text(&screen.video(),area,font::SIZE_NORMAL,font::NORMAL_COLOUR,tip_of_day,area.x+pad,area.y+pad); font::draw_text(&screen.video(), area, font::SIZE_NORMAL, font::NORMAL_COLOUR, Index: wesnoth/src/widgets/button.cpp diff -u wesnoth/src/widgets/button.cpp:1.60 wesnoth/src/widgets/button.cpp:1.61 --- wesnoth/src/widgets/button.cpp:1.60 Tue Mar 15 22:14:04 2005 +++ wesnoth/src/widgets/button.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: button.cpp,v 1.60 2005/03/15 22:14:04 ydirson Exp $ */ +/* $Id: button.cpp,v 1.61 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -14,7 +14,6 @@ #include "../global.hpp" #include "button.hpp" -#include "../display.hpp" #include "../font.hpp" #include "../image.hpp" #include "../log.hpp" @@ -30,9 +29,9 @@ const int checkbox_horizontal_padding = font::SIZE_SMALL / 2; const int vertical_padding = font::SIZE_SMALL / 2; -button::button(display& disp, const std::string& label, button::TYPE type, +button::button(CVideo& video, const std::string& label, button::TYPE type, std::string button_image_name, SPACE_CONSUMPTION spacing) - : widget(disp), label_(label), + : widget(video), label_(label), image_(NULL), pressedImage_(NULL), activeImage_(NULL), pressedActiveImage_(NULL), button_(true), state_(NORMAL), type_(type), enabled_(true), pressed_(false) { @@ -69,8 +68,8 @@ textRect_.x = 0; textRect_.y = 0; - textRect_.w = video().getx(); - textRect_.h = video().gety(); + textRect_.w = video.getx(); + textRect_.h = video.gety(); textRect_ = font::draw_text(NULL,textRect_,font_size, font::BUTTON_COLOUR,label_,0,0); Index: wesnoth/src/widgets/button.hpp diff -u wesnoth/src/widgets/button.hpp:1.29 wesnoth/src/widgets/button.hpp:1.30 --- wesnoth/src/widgets/button.hpp:1.29 Sat Nov 6 13:13:16 2004 +++ wesnoth/src/widgets/button.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: button.hpp,v 1.29 2004/11/06 13:13:16 silene Exp $ */ +/* $Id: button.hpp,v 1.30 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -23,8 +23,6 @@ #include <vector> #include <string> -class display; - namespace gui { class button : public widget @@ -36,7 +34,7 @@ enum SPACE_CONSUMPTION { DEFAULT_SPACE, MINIMUM_SPACE }; - button(display& disp, const std::string& label, TYPE type=TYPE_PRESS, + button(CVideo& video, const std::string& label, TYPE type=TYPE_PRESS, std::string button_image="", SPACE_CONSUMPTION spacing=DEFAULT_SPACE); virtual ~button() {} Index: wesnoth/src/widgets/combo.cpp diff -u wesnoth/src/widgets/combo.cpp:1.28 wesnoth/src/widgets/combo.cpp:1.29 --- wesnoth/src/widgets/combo.cpp:1.28 Sun Feb 20 22:30:29 2005 +++ wesnoth/src/widgets/combo.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: combo.cpp,v 1.28 2005/02/20 22:30:29 gruikya Exp $ */ +/* $Id: combo.cpp,v 1.29 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -15,6 +15,7 @@ #include "combo.hpp" #include "button.hpp" +#include "../display.hpp" #include "../show_dialog.hpp" #include "../video.hpp" @@ -25,8 +26,8 @@ const int vertical_padding = 10; combo::combo(display& disp, const std::vector<std::string>& items) - : button(disp, items.empty() ? "" : items[0]), - items_(items), selected_(0), oldSelected_(0) + : button(disp.video(), items.empty() ? "" : items[0]), + items_(items), selected_(0), oldSelected_(0), disp_(&disp) { } @@ -76,7 +77,7 @@ if (!pressed()) return; SDL_Rect const &loc = location(); - set_selected_internal(gui::show_dialog(disp(), NULL, "", "", gui::MESSAGE, &items_, + set_selected_internal(gui::show_dialog(*disp_, NULL, "", "", gui::MESSAGE, &items_, NULL, "", NULL, -1, NULL, NULL, loc.x, loc.y + loc.h)); } Index: wesnoth/src/widgets/combo.hpp diff -u wesnoth/src/widgets/combo.hpp:1.21 wesnoth/src/widgets/combo.hpp:1.22 --- wesnoth/src/widgets/combo.hpp:1.21 Thu Mar 10 02:09:26 2005 +++ wesnoth/src/widgets/combo.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: combo.hpp,v 1.21 2005/03/10 02:09:26 ydirson Exp $ */ +/* $Id: combo.hpp,v 1.22 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -15,9 +15,10 @@ #include "SDL.h" -#include "button.hpp" class display; +#include "button.hpp" + namespace gui { class combo : public button @@ -38,6 +39,7 @@ void set_selected_internal(int val); std::vector<std::string> items_; int selected_, oldSelected_; + display* disp_; }; //end class combo } Index: wesnoth/src/widgets/file_chooser.cpp diff -u wesnoth/src/widgets/file_chooser.cpp:1.26 wesnoth/src/widgets/file_chooser.cpp:1.27 --- wesnoth/src/widgets/file_chooser.cpp:1.26 Tue Mar 15 21:47:41 2005 +++ wesnoth/src/widgets/file_chooser.cpp Fri Mar 18 21:21:48 2005 @@ -14,8 +14,7 @@ #define GETTEXT_DOMAIN "wesnoth-lib" -class display; - +#include "../display.hpp" #include "../events.hpp" #include "../filesystem.hpp" #include "../font.hpp" @@ -35,12 +34,13 @@ namespace gui { file_chooser::file_chooser(display &disp, std::string start_file) - : widget(disp), delete_button_(disp, _("Delete File")), + : widget(disp.video()), delete_button_(disp.video(), _("Delete File")), path_delim_('/'), current_dir_(get_path(start_file)), - chosen_file_(start_file), file_list_(disp, files_in_current_dir_, false), - filename_textbox_(disp, 100, start_file, true), - current_path_label_(disp, current_dir_), choice_made_(false), - last_selection_(-1) { + chosen_file_(start_file), file_list_(disp.video(), files_in_current_dir_, false), + filename_textbox_(disp.video(), 100, start_file, true), + current_path_label_(disp.video(), current_dir_), choice_made_(false), + last_selection_(-1), disp_(disp) +{ // If the start file is not a file or directory, use the root. if(!file_exists(chosen_file_) && !is_directory(chosen_file_) || !is_directory(current_dir_)) { @@ -128,7 +128,7 @@ if (delete_button_.pressed()) { const int ret = remove(get_current_file().c_str()); if (ret == -1) { - show_dialog(disp(), NULL, "", _("Deletion of the file failed."), OK_ONLY); + show_dialog(disp_, NULL, "", _("Deletion of the file failed."), OK_ONLY); } else { update_file_lists(); Index: wesnoth/src/widgets/file_chooser.hpp diff -u wesnoth/src/widgets/file_chooser.hpp:1.10 wesnoth/src/widgets/file_chooser.hpp:1.11 --- wesnoth/src/widgets/file_chooser.hpp:1.10 Thu Nov 18 20:26:34 2004 +++ wesnoth/src/widgets/file_chooser.hpp Fri Mar 18 21:21:48 2005 @@ -93,6 +93,7 @@ label current_path_label_; bool choice_made_; int last_selection_; + display& disp_; }; } Index: wesnoth/src/widgets/label.cpp diff -u wesnoth/src/widgets/label.cpp:1.8 wesnoth/src/widgets/label.cpp:1.9 --- wesnoth/src/widgets/label.cpp:1.8 Tue Mar 15 21:47:41 2005 +++ wesnoth/src/widgets/label.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: label.cpp,v 1.8 2005/03/15 21:47:41 ydirson Exp $ */ +/* $Id: label.cpp,v 1.9 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -19,7 +19,7 @@ namespace gui { -label::label(display& d, const std::string& text, int size, const SDL_Color& colour) : widget(d), text_(text), size_(size), colour_(colour) +label::label(CVideo& video, const std::string& text, int size, const SDL_Color& colour) : widget(video), text_(text), size_(size), colour_(colour) { update_label_size(); } Index: wesnoth/src/widgets/label.hpp diff -u wesnoth/src/widgets/label.hpp:1.3 wesnoth/src/widgets/label.hpp:1.4 --- wesnoth/src/widgets/label.hpp:1.3 Sat Nov 6 13:13:16 2004 +++ wesnoth/src/widgets/label.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: label.hpp,v 1.3 2004/11/06 13:13:16 silene Exp $ */ +/* $Id: label.hpp,v 1.4 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -23,7 +23,7 @@ class label : public widget { public: - label(display& d, const std::string& text, int size=font::SIZE_NORMAL, + label(CVideo& video, const std::string& text, int size=font::SIZE_NORMAL, const SDL_Color& colour=font::NORMAL_COLOUR); const std::string& set_text(const std::string& text); const std::string& get_text() const; Index: wesnoth/src/widgets/menu.cpp diff -u wesnoth/src/widgets/menu.cpp:1.84 wesnoth/src/widgets/menu.cpp:1.85 --- wesnoth/src/widgets/menu.cpp:1.84 Wed Mar 16 20:50:12 2005 +++ wesnoth/src/widgets/menu.cpp Fri Mar 18 21:21:48 2005 @@ -2,8 +2,8 @@ #include "menu.hpp" -#include "../display.hpp" #include "../font.hpp" +#include "../image.hpp" #include "../sdl_utils.hpp" #include "../show_dialog.hpp" #include "../util.hpp" @@ -20,9 +20,9 @@ namespace gui { -menu::menu(display& disp, const std::vector<std::string>& items, +menu::menu(CVideo& video, const std::vector<std::string>& items, bool click_selects, int max_height, int max_width) - : scrollarea(disp), + : scrollarea(video), max_height_(max_height), max_width_(max_width), max_items_(-1), item_height_(-1), cur_help_(-1,-1), help_string_(-1), selected_(0), click_selects_(click_selects), Index: wesnoth/src/widgets/menu.hpp diff -u wesnoth/src/widgets/menu.hpp:1.34 wesnoth/src/widgets/menu.hpp:1.35 --- wesnoth/src/widgets/menu.hpp:1.34 Thu Mar 10 02:09:26 2005 +++ wesnoth/src/widgets/menu.hpp Fri Mar 18 21:21:48 2005 @@ -4,7 +4,6 @@ #include <string> #include <vector> -class display; #include "../events.hpp" #include "../sdl_utils.hpp" @@ -18,7 +17,7 @@ class menu : public scrollarea { public: - menu(display& disp, const std::vector<std::string>& items, + menu(CVideo& video, const std::vector<std::string>& items, bool click_selects=false, int max_height=-1, int max_width=-1); int selection() const; Index: wesnoth/src/widgets/progressbar.cpp diff -u wesnoth/src/widgets/progressbar.cpp:1.8 wesnoth/src/widgets/progressbar.cpp:1.9 --- wesnoth/src/widgets/progressbar.cpp:1.8 Tue Mar 15 21:47:41 2005 +++ wesnoth/src/widgets/progressbar.cpp Fri Mar 18 21:21:48 2005 @@ -8,7 +8,7 @@ namespace gui { -progress_bar::progress_bar(display& disp) : widget(disp), progress_(0) +progress_bar::progress_bar(CVideo& video) : widget(video), progress_(0) {} void progress_bar::set_progress_percent(int progress) Index: wesnoth/src/widgets/progressbar.hpp diff -u wesnoth/src/widgets/progressbar.hpp:1.3 wesnoth/src/widgets/progressbar.hpp:1.4 --- wesnoth/src/widgets/progressbar.hpp:1.3 Mon Nov 1 18:06:37 2004 +++ wesnoth/src/widgets/progressbar.hpp Fri Mar 18 21:21:48 2005 @@ -8,7 +8,7 @@ class progress_bar : public widget { public: - progress_bar(display& disp); + progress_bar(CVideo& video); void set_progress_percent(int progress); Index: wesnoth/src/widgets/scrollarea.cpp diff -u wesnoth/src/widgets/scrollarea.cpp:1.11 wesnoth/src/widgets/scrollarea.cpp:1.12 --- wesnoth/src/widgets/scrollarea.cpp:1.11 Thu Mar 10 02:09:26 2005 +++ wesnoth/src/widgets/scrollarea.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollarea.cpp,v 1.11 2005/03/10 02:09:26 ydirson Exp $*/ +/* $Id: scrollarea.cpp,v 1.12 2005/03/18 21:21:48 ydirson Exp $*/ /* Copyright (C) 2004 by Guillaume Melquiond <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -13,8 +13,6 @@ #include "../global.hpp" -class display; - #include "scrollarea.hpp" #include <algorithm> @@ -22,8 +20,8 @@ namespace gui { -scrollarea::scrollarea(display &d) - : widget(d), scrollbar_(d), +scrollarea::scrollarea(CVideo &video) + : widget(video), scrollbar_(video), old_position_(0), recursive_(false), shown_scrollbar_(false) { } Index: wesnoth/src/widgets/scrollarea.hpp diff -u wesnoth/src/widgets/scrollarea.hpp:1.5 wesnoth/src/widgets/scrollarea.hpp:1.6 --- wesnoth/src/widgets/scrollarea.hpp:1.5 Sun Feb 6 10:40:13 2005 +++ wesnoth/src/widgets/scrollarea.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollarea.hpp,v 1.5 2005/02/06 10:40:13 isaaccp Exp $ */ +/* $Id: scrollarea.hpp,v 1.6 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2004 by Guillaume Melquiond <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ @@ -27,7 +27,7 @@ /// Create a zone with automatic handling of scrollbar. /// \param d the display object /// \param pane the widget where wheel events take place - scrollarea(display &d); + scrollarea(CVideo &video); virtual void hide(bool value = true); Index: wesnoth/src/widgets/scrollbar.cpp diff -u wesnoth/src/widgets/scrollbar.cpp:1.30 wesnoth/src/widgets/scrollbar.cpp:1.31 --- wesnoth/src/widgets/scrollbar.cpp:1.30 Tue Mar 15 22:14:04 2005 +++ wesnoth/src/widgets/scrollbar.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollbar.cpp,v 1.30 2005/03/15 22:14:04 ydirson Exp $*/ +/* $Id: scrollbar.cpp,v 1.31 2005/03/18 21:21:48 ydirson Exp $*/ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> 2004 by Guillaume Melquiond <[EMAIL PROTECTED]> @@ -15,7 +15,6 @@ #include "../global.hpp" #include "scrollbar.hpp" -#include "../display.hpp" #include "../image.hpp" #include "../video.hpp" @@ -39,10 +38,10 @@ namespace gui { -scrollbar::scrollbar(display &d) - : widget(d), mid_scaled_(NULL), groove_scaled_(NULL), - uparrow_(d, "", button::TYPE_TURBO, "uparrow-button"), - downarrow_(d, "", button::TYPE_TURBO, "downarrow-button"), +scrollbar::scrollbar(CVideo &video) + : widget(video), mid_scaled_(NULL), groove_scaled_(NULL), + uparrow_(video, "", button::TYPE_TURBO, "uparrow-button"), + downarrow_(video, "", button::TYPE_TURBO, "downarrow-button"), state_(NORMAL), grip_position_(0), grip_height_(0), full_height_(0), scroll_rate_(1) { Index: wesnoth/src/widgets/scrollbar.hpp diff -u wesnoth/src/widgets/scrollbar.hpp:1.16 wesnoth/src/widgets/scrollbar.hpp:1.17 --- wesnoth/src/widgets/scrollbar.hpp:1.16 Sat Feb 26 21:18:15 2005 +++ wesnoth/src/widgets/scrollbar.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollbar.hpp,v 1.16 2005/02/26 21:18:15 gruikya Exp $ */ +/* $Id: scrollbar.hpp,v 1.17 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> 2004 by Guillaume Melquiond <[EMAIL PROTECTED]> @@ -31,7 +31,7 @@ /// \param d the display object /// \param pane the widget where wheel events take place /// \param callback a callback interface for warning that the grip has been moved - scrollbar(display &d); + scrollbar(CVideo &video); virtual void hide(bool value = true); Index: wesnoth/src/widgets/scrollpane.cpp diff -u wesnoth/src/widgets/scrollpane.cpp:1.7 wesnoth/src/widgets/scrollpane.cpp:1.8 --- wesnoth/src/widgets/scrollpane.cpp:1.7 Sun Feb 20 22:30:29 2005 +++ wesnoth/src/widgets/scrollpane.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollpane.cpp,v 1.7 2005/02/20 22:30:29 gruikya Exp $ */ +/* $Id: scrollpane.cpp,v 1.8 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -35,7 +35,7 @@ namespace gui { -scrollpane::scrollpane(display& d) : scrollarea(d), border_(5) +scrollpane::scrollpane(CVideo &video) : scrollarea(video), border_(5) { content_pos_.x = 0; content_pos_.y = 0; Index: wesnoth/src/widgets/scrollpane.hpp diff -u wesnoth/src/widgets/scrollpane.hpp:1.7 wesnoth/src/widgets/scrollpane.hpp:1.8 --- wesnoth/src/widgets/scrollpane.hpp:1.7 Thu Mar 10 02:09:26 2005 +++ wesnoth/src/widgets/scrollpane.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: scrollpane.hpp,v 1.7 2005/03/10 02:09:26 ydirson Exp $ */ +/* $Id: scrollpane.hpp,v 1.8 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2004 by Philippe Plantier <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -40,7 +40,7 @@ /// \param d the display object /// \param pane the widget where wheel events take place /// \param callback a callback interface for warning that the grip has been moved - scrollpane(display &d); + scrollpane(CVideo &video); virtual void set_location(SDL_Rect const &rect); Index: wesnoth/src/widgets/slider.cpp diff -u wesnoth/src/widgets/slider.cpp:1.38 wesnoth/src/widgets/slider.cpp:1.39 --- wesnoth/src/widgets/slider.cpp:1.38 Tue Mar 15 22:14:04 2005 +++ wesnoth/src/widgets/slider.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: slider.cpp,v 1.38 2005/03/15 22:14:04 ydirson Exp $ */ +/* $Id: slider.cpp,v 1.39 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -14,7 +14,6 @@ #include "../global.hpp" #include "slider.hpp" -#include "../display.hpp" #include "../image.hpp" #include "../video.hpp" @@ -28,8 +27,8 @@ namespace gui { -slider::slider(display& d) - : widget(d), image_(image::get_image(slider_image, image::UNSCALED)), +slider::slider(CVideo &video) + : widget(video), image_(image::get_image(slider_image, image::UNSCALED)), highlightedImage_(image::get_image(selected_image, image::UNSCALED)), min_(-100000), max_(100000), value_(0), increment_(1), state_(NORMAL) Index: wesnoth/src/widgets/slider.hpp diff -u wesnoth/src/widgets/slider.hpp:1.22 wesnoth/src/widgets/slider.hpp:1.23 --- wesnoth/src/widgets/slider.hpp:1.22 Sat Nov 6 13:42:25 2004 +++ wesnoth/src/widgets/slider.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: slider.hpp,v 1.22 2004/11/06 13:42:25 silene Exp $ */ +/* $Id: slider.hpp,v 1.23 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -26,7 +26,7 @@ class slider : public widget { public: - slider(display& d); + slider(CVideo &video); void set_min(int value); void set_max(int value); Index: wesnoth/src/widgets/textbox.cpp diff -u wesnoth/src/widgets/textbox.cpp:1.72 wesnoth/src/widgets/textbox.cpp:1.73 --- wesnoth/src/widgets/textbox.cpp:1.72 Tue Mar 15 21:47:41 2005 +++ wesnoth/src/widgets/textbox.cpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: textbox.cpp,v 1.72 2005/03/15 21:47:41 ydirson Exp $ */ +/* $Id: textbox.cpp,v 1.73 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -31,8 +31,8 @@ const int font_size = font::SIZE_PLUS; -textbox::textbox(display& d, int width, const std::string& text, bool editable, size_t max_size, double alpha, double alpha_focus) - : scrollarea(d), max_size_(max_size), text_(utils::string_to_wstring(text)), +textbox::textbox(CVideo &video, int width, const std::string& text, bool editable, size_t max_size, double alpha, double alpha_focus) + : scrollarea(video), max_size_(max_size), text_(utils::string_to_wstring(text)), cursor_(text_.size()), selstart_(-1), selend_(-1), grabmouse_(false), text_pos_(0), editable_(editable), show_cursor_(true), show_cursor_at_(0), text_image_(NULL), Index: wesnoth/src/widgets/textbox.hpp diff -u wesnoth/src/widgets/textbox.hpp:1.43 wesnoth/src/widgets/textbox.hpp:1.44 --- wesnoth/src/widgets/textbox.hpp:1.43 Tue Mar 15 21:47:41 2005 +++ wesnoth/src/widgets/textbox.hpp Fri Mar 18 21:21:48 2005 @@ -1,4 +1,4 @@ -/* $Id: textbox.hpp,v 1.43 2005/03/15 21:47:41 ydirson Exp $ */ +/* $Id: textbox.hpp,v 1.44 2005/03/18 21:21:48 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -14,8 +14,6 @@ #ifndef TEXTBOX_HPP_INCLUDED #define TEXTBOX_HPP_INCLUDED -class display; - #include "../serialization/string_utils.hpp" #include "../sdl_utils.hpp" @@ -28,7 +26,7 @@ class textbox : public scrollarea { public: - textbox(display& d, int width, const std::string& text="", bool editable=true, size_t max_size = 256, double alpha = 0.4, double alpha_focus = 0.2); + textbox(CVideo &video, int width, const std::string& text="", bool editable=true, size_t max_size = 256, double alpha = 0.4, double alpha_focus = 0.2); const std::string text() const; void set_text(const std::string& text); Index: wesnoth/src/widgets/widget.cpp diff -u wesnoth/src/widgets/widget.cpp:1.30 wesnoth/src/widgets/widget.cpp:1.31 --- wesnoth/src/widgets/widget.cpp:1.30 Wed Mar 16 20:50:12 2005 +++ wesnoth/src/widgets/widget.cpp Fri Mar 18 21:21:48 2005 @@ -1,7 +1,6 @@ #include "../global.hpp" #include "widget.hpp" -#include "../display.hpp" #include "../video.hpp" namespace { @@ -11,15 +10,15 @@ namespace gui { widget::widget(const widget &o) - : events::handler(), disp_(o.disp_), restorer_(o.restorer_), rect_(o.rect_), + : events::handler(), video_(o.video_), restorer_(o.restorer_), rect_(o.rect_), focus_(o.focus_), needs_restore_(o.needs_restore_), 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), +widget::widget(CVideo& video) + : video_(&video), rect_(EmptyRect), focus_(true), needs_restore_(false), state_(UNINIT), clip_(false), volatile_(false), help_string_(0) { } @@ -29,11 +28,6 @@ bg_cancel(); } -// FIXME: we should move this into the header so that it can be -// inlined, but that would currently create a -// widget->display->button->widget include cycle -CVideo& widget::video() const { return (disp_->video()); } - void widget::bg_cancel() { for(std::vector< surface_restorer >::iterator i = restorer_.begin(), Index: wesnoth/src/widgets/widget.hpp diff -u wesnoth/src/widgets/widget.hpp:1.25 wesnoth/src/widgets/widget.hpp:1.26 --- wesnoth/src/widgets/widget.hpp:1.25 Tue Mar 15 21:47:41 2005 +++ wesnoth/src/widgets/widget.hpp Fri Mar 18 21:21:48 2005 @@ -10,7 +10,6 @@ #include <vector> class CVideo; -class display; namespace gui { @@ -54,7 +53,7 @@ protected: widget(widget const &o); - widget(display& disp); + widget(CVideo& video); virtual ~widget(); // During each relocation, this function should be called to register @@ -65,8 +64,7 @@ void bg_update(); void bg_cancel(); - display& disp() const { return *disp_; } - CVideo& video() const; + CVideo& video() const { return *video_; }; virtual void handle_event(SDL_Event const &event) {} @@ -78,7 +76,7 @@ void volatile_draw(); void volatile_undraw(); - display* disp_; + CVideo* video_; std::vector< surface_restorer > restorer_; SDL_Rect rect_; bool focus_; // Should user input be ignored?