[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth ./changelog src/playlevel.cpp src/playt...
From: |
John McNabb |
Subject: |
[Wesnoth-cvs-commits] wesnoth ./changelog src/playlevel.cpp src/playt... |
Date: |
Fri, 25 Mar 2005 13:52:56 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: John McNabb <address@hidden> 05/03/25 18:52:55
Modified files:
. : changelog
src : playlevel.cpp playturn.cpp theme.cpp theme.hpp
Log message:
added theme dialog
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/changelog.diff?tr1=1.544&tr2=1.545&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playlevel.cpp.diff?tr1=1.194&tr2=1.195&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.350&tr2=1.351&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/theme.cpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/theme.hpp.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: wesnoth/changelog
diff -u wesnoth/changelog:1.544 wesnoth/changelog:1.545
--- wesnoth/changelog:1.544 Fri Mar 25 16:15:16 2005
+++ wesnoth/changelog Fri Mar 25 18:52:55 2005
@@ -1,4 +1,5 @@
CVS HEAD:
+ * Added theme dialog. started with ":theme"
* Added UNIT, UNDEAD_UNIT, and PLACE_IMAGE macros to utils.cfg
* terrain improvements
* fixed swamp transition (NW, SE) graphics
Index: wesnoth/src/playlevel.cpp
diff -u wesnoth/src/playlevel.cpp:1.194 wesnoth/src/playlevel.cpp:1.195
--- wesnoth/src/playlevel.cpp:1.194 Thu Mar 24 21:35:52 2005
+++ wesnoth/src/playlevel.cpp Fri Mar 25 18:52:55 2005
@@ -1,4 +1,4 @@
-/* $Id: playlevel.cpp,v 1.194 2005/03/24 21:35:52 ydirson Exp $ */
+/* $Id: playlevel.cpp,v 1.195 2005/03/25 18:52:55 darthfool Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -391,6 +391,7 @@
LOG_NG << "initializing display... " << (SDL_GetTicks() - ticks) <<
"\n";
const config dummy_cfg;
display gui(units,video,map,status,teams,theme_cfg != NULL ? *theme_cfg
: dummy_cfg, game_config, *level);
+ theme::set_known_themes(&game_config);
LOG_NG << "done initializing display... " << (SDL_GetTicks() - ticks)
<< "\n";
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.350 wesnoth/src/playturn.cpp:1.351
--- wesnoth/src/playturn.cpp:1.350 Thu Mar 24 21:18:26 2005
+++ wesnoth/src/playturn.cpp Fri Mar 25 18:52:55 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.350 2005/03/24 21:18:26 silene Exp $ */
+/* $Id: playturn.cpp,v 1.351 2005/03/25 18:52:55 darthfool Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -2410,7 +2410,19 @@
}
} else if (teams_[index].is_ai()) {
teams_[index].make_human();
+ }
+ } else if (cmd == "theme") {
+ int action = 0;
+ std::vector<std::string> options=theme::get_known_themes();
+ std::string current_theme=_("Saved Theme Preference:
")+preferences::theme();
+ action =
gui::show_dialog(gui_,NULL,"",current_theme,gui::OK_CANCEL,&options);
+ if(action >-1){
+ preferences::set_theme(options[action]);
+ //it would be preferable for the new theme to take effect
+ //immediately, however, this will have to do for now.
+ gui::show_dialog(gui_,NULL,"",_("New theme will take effect
on next new or loaded game."),gui::MESSAGE);
}
+
} else if(cmd == "ban") {
config cfg;
config& ban = cfg.add_child("ban");
Index: wesnoth/src/theme.cpp
diff -u wesnoth/src/theme.cpp:1.33 wesnoth/src/theme.cpp:1.34
--- wesnoth/src/theme.cpp:1.33 Thu Mar 10 22:03:32 2005
+++ wesnoth/src/theme.cpp Fri Mar 25 18:52:55 2005
@@ -424,8 +424,7 @@
const std::vector<std::string>& theme::menu::items() const { return items_; }
-theme::theme(const config& cfg, const SDL_Rect& screen) :
cfg_(resolve_rects(cfg))
-{
+theme::theme(const config& cfg, const SDL_Rect&
screen):cfg_(resolve_rects(cfg)){
set_resolution(screen);
}
@@ -553,3 +552,30 @@
{
return mini_map_.location(screen);
}
+
+std::map<std::string, config> theme::known_themes;
+void theme::set_known_themes(const config* cfg){
+ known_themes.clear();
+ if(cfg == NULL)
+ return;
+ const config& v = *cfg;
+ const config::child_list& known_themes_cfg = v.get_children("theme");
+
+ for(config::child_list::const_iterator thm = known_themes_cfg.begin();
thm != known_themes_cfg.end(); ++thm) {
+ std::string thm_name=(**thm)["name"];
+ if(thm_name!="null" && thm_name!="editor"){
+ known_themes[thm_name]=(**thm);
+ }
+ }
+}
+
+std::vector<std::string> theme::get_known_themes(){
+ std::vector<std::string> names;
+
+
+ for(std::map<std::string, config>::iterator
p_thm=known_themes.begin();p_thm!=known_themes.end();p_thm++){
+ names.push_back(p_thm->first);
+ }
+ return(names);
+}
+
Index: wesnoth/src/theme.hpp
diff -u wesnoth/src/theme.hpp:1.6 wesnoth/src/theme.hpp:1.7
--- wesnoth/src/theme.hpp:1.6 Thu Mar 10 22:03:32 2005
+++ wesnoth/src/theme.hpp Fri Mar 25 18:52:55 2005
@@ -4,6 +4,7 @@
#include <map>
#include <string>
#include <vector>
+#include <map>
class config;
@@ -132,8 +133,13 @@
const SDL_Rect& main_map_location(const SDL_Rect& screen) const;
const SDL_Rect& mini_map_location(const SDL_Rect& screen) const;
+ static void set_known_themes(const config* cfg);
+ static std::vector<std::string> get_known_themes();
+
private:
- const config& cfg_;
+ static std::map<std::string, config> theme::known_themes;
+ std::string cur_theme;
+ const config& cfg_;
std::vector<panel> panels_;
std::vector<label> labels_;
std::vector<menu> menus_;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth ./changelog src/playlevel.cpp src/playt...,
John McNabb <=