[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src dialogs.cpp game.cpp help.cpp prefe...
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src dialogs.cpp game.cpp help.cpp prefe... |
Date: |
Thu, 02 Dec 2004 17:03:51 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 04/12/02 21:57:28
Modified files:
src : dialogs.cpp game.cpp help.cpp preferences.cpp
src/widgets : menu.cpp menu.hpp
Log message:
Another fix for compiling with Irix CC.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.75&tr2=1.76&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.168&tr2=1.169&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.125&tr2=1.126&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.74&tr2=1.75&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.hpp.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
Patches:
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.75 wesnoth/src/dialogs.cpp:1.76
--- wesnoth/src/dialogs.cpp:1.75 Tue Nov 30 21:41:18 2004
+++ wesnoth/src/dialogs.cpp Thu Dec 2 21:57:27 2004
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.75 2004/11/30 21:41:18 silene Exp $ */
+/* $Id: dialogs.cpp,v 1.76 2004/12/02 21:57:27 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -26,6 +26,7 @@
#include "replay.hpp"
#include "show_dialog.hpp"
#include "util.hpp"
+#include "widgets/menu.hpp"
#include "widgets/progressbar.hpp"
#include <cstdio>
@@ -61,7 +62,7 @@
for(std::vector<std::string>::const_iterator op = options.begin(); op
!= options.end(); ++op) {
sample_units.push_back(::get_advanced_unit(info,units,loc,*op));
const unit_type& type = sample_units.back().type();
- lang_options.push_back("&" + type.image() + "," +
type.language_name());
+ lang_options.push_back(IMAGE_PREFIX + type.image() +
COLUMN_SEPARATOR + type.language_name());
}
const config::child_list& mod_options =
u->second.get_modification_advances();
@@ -70,7 +71,7 @@
sample_units.push_back(::get_advanced_unit(info,units,loc,u->second.type().name()));
sample_units.back().add_modification("advance",**mod);
const unit_type& type = sample_units.back().type();
- lang_options.push_back("&" + type.image() + "," +
(**mod)["description"]);
+ lang_options.push_back(IMAGE_PREFIX + type.image() +
COLUMN_SEPARATOR + (**mod)["description"]);
}
LOG_DP << "options: " << options.size() << "\n";
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.168 wesnoth/src/game.cpp:1.169
--- wesnoth/src/game.cpp:1.168 Tue Nov 30 21:41:18 2004
+++ wesnoth/src/game.cpp Thu Dec 2 21:57:27 2004
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.168 2004/11/30 21:41:18 silene Exp $ */
+/* $Id: game.cpp,v 1.169 2004/12/02 21:57:27 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1222,12 +1222,13 @@
state_.campaign_define = "MULTIPLAYER";
std::vector<std::string> host_or_join;
- const std::string sep(1,gui::menu::HELP_STRING_SEPARATOR);
- host_or_join.push_back(std::string("&icons/icon-server.png,") + _("Join
Official Server") + sep + _("Log on to the official Wesnoth multiplayer
server"));
- host_or_join.push_back(std::string("&icons/icon-serverother.png,") +
_("Join Game") + sep + _("Join a server or hosted game"));
- host_or_join.push_back(std::string("&icons/icon-hostgame.png,") +
_("Host Networked Game") + sep + _("Host a game without using a server"));
- host_or_join.push_back(std::string("&icons/icon-hotseat.png,") +
_("Hotseat Game") + sep + _("Play a multiplayer game sharing the same
machine"));
- host_or_join.push_back(std::string("&icons/icon-ai.png,") + _("Human vs
AI") + sep + _("Play a game against AI opponents"));
+ std::string const pre = IMAGE_PREFIX + std::string("icons/icon-");
+ char const sep = COLUMN_SEPARATOR;
+ host_or_join.push_back(pre + "server.png" + sep + _("Join Official
Server") + sep + _("Log on to the official Wesnoth multiplayer server"));
+ host_or_join.push_back(pre + "serverother.png" + sep + _("Join Game") +
sep + _("Join a server or hosted game"));
+ host_or_join.push_back(pre + "hostgame.png" + sep + _("Host Networked
Game") + sep + _("Host a game without using a server"));
+ host_or_join.push_back(pre + "hotseat.png" + sep + _("Hotseat Game") +
sep + _("Play a multiplayer game sharing the same machine"));
+ host_or_join.push_back(pre + "ai.png" + sep + _("Human vs AI") + sep +
_("Play a game against AI opponents"));
std::string login = preferences::login();
const int res =
gui::show_dialog(disp(),NULL,_("Multiplayer"),"",gui::OK_CANCEL,&host_or_join,NULL,_("Login")
+ std::string(": "),&login);
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.57 wesnoth/src/help.cpp:1.58
--- wesnoth/src/help.cpp:1.57 Thu Dec 2 07:59:49 2004
+++ wesnoth/src/help.cpp Thu Dec 2 21:57:27 2004
@@ -1494,14 +1494,14 @@
std::string pad_string;
// Indentation is represented as three spaces per level.
pad_string.resize(level * 3, ' ');
- to_show << pad_string << char(menu::IMG_TEXT_SEPARATOR) << "&" ;
+ to_show << pad_string << char(gui::menu::IMG_TEXT_SEPARATOR) << "&" ;
if (expanded(sec)) {
to_show << open_section_img;
}
else {
to_show << closed_section_img;
}
- to_show << char(menu::IMG_TEXT_SEPARATOR) << sec.title;
+ to_show << char(gui::menu::IMG_TEXT_SEPARATOR) << sec.title;
return to_show.str();
}
@@ -1509,8 +1509,8 @@
std::string pad_string;
pad_string.resize(level * 3, ' ');
std::stringstream to_show;
- to_show << pad_string << char(menu::IMG_TEXT_SEPARATOR) << "&" <<
topic_img
- << char(menu::IMG_TEXT_SEPARATOR) << topic.title;
+ to_show << pad_string << char(gui::menu::IMG_TEXT_SEPARATOR) << "&" <<
topic_img
+ << char(gui::menu::IMG_TEXT_SEPARATOR) << topic.title;
return to_show.str();
}
@@ -1550,7 +1550,7 @@
}
int help_menu::process() {
- int res = menu::process();
+ int res = gui::menu::process();
if (double_clicked())
res = selection();
if (!visible_items_.empty() && (unsigned)res < visible_items_.size()) {
Index: wesnoth/src/preferences.cpp
diff -u wesnoth/src/preferences.cpp:1.125 wesnoth/src/preferences.cpp:1.126
--- wesnoth/src/preferences.cpp:1.125 Thu Nov 18 22:00:12 2004
+++ wesnoth/src/preferences.cpp Thu Dec 2 21:57:28 2004
@@ -1,4 +1,4 @@
-/* $Id: preferences.cpp,v 1.125 2004/11/18 22:00:12 ydirson Exp $ */
+/* $Id: preferences.cpp,v 1.126 2004/12/02 21:57:28 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -866,9 +866,11 @@
{
std::vector<std::string> items;
- items.push_back(std::string("&icons/icon-general.png,") +
dsgettext(GETTEXT_DOMAIN,"Prefs section^General"));
- items.push_back(std::string("&icons/icon-display.png,") +
dsgettext(GETTEXT_DOMAIN,"Prefs section^Display"));
- items.push_back(std::string("&icons/icon-music.png,") +
dsgettext(GETTEXT_DOMAIN,"Prefs section^Sound"));
+ std::string const pre = IMAGE_PREFIX + std::string("icons/icon-");
+ char const sep = COLUMN_SEPARATOR;
+ items.push_back(pre + "general.png" + sep +
dsgettext(GETTEXT_DOMAIN,"Prefs section^General"));
+ items.push_back(pre + "display.png" + sep +
dsgettext(GETTEXT_DOMAIN,"Prefs section^Display"));
+ items.push_back(pre + "music.png" + sep +
dsgettext(GETTEXT_DOMAIN,"Prefs section^Sound"));
for(;;) {
try {
@@ -945,9 +947,8 @@
std::vector<std::string> options;
for(std::vector<std::pair<int,int> >::const_iterator j =
resolutions.begin(); j != resolutions.end(); ++j) {
std::ostringstream option;
- if(*j == current_res) {
- option << char(gui::menu::DEFAULT_ITEM);
- }
+ if (*j == current_res)
+ option << DEFAULT_ITEM;
option << j->first << "x" << j->second;
options.push_back(option.str());
@@ -998,7 +999,7 @@
std::stringstream str,name;
name << i->get_description();
str << name.str();
- str << ", : ,";
+ str << COLUMN_SEPARATOR << " : " << COLUMN_SEPARATOR;
str << i->get_name();
menu_items.push_back (str.str ());
}
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.74 wesnoth/src/widgets/menu.cpp:1.75
--- wesnoth/src/widgets/menu.cpp:1.74 Thu Nov 18 04:08:33 2004
+++ wesnoth/src/widgets/menu.cpp Thu Dec 2 21:57:28 2004
@@ -36,7 +36,7 @@
{
for(std::vector<std::string>::const_iterator item = items.begin();
item != items.end(); ++item) {
- items_.push_back(config::quoted_split(*item, ',',
!strip_spaces));
+ items_.push_back(config::quoted_split(*item, COLUMN_SEPARATOR,
!strip_spaces));
//make sure there is always at least one item
if(items_.back().empty())
@@ -327,8 +327,6 @@
}
namespace {
- const char ImagePrefix = '&';
-
SDL_Rect item_size(const std::string& item) {
SDL_Rect res = {0,0,0,0};
std::vector<std::string> img_text_items = config::split(item,
menu::IMG_TEXT_SEPARATOR);
@@ -339,7 +337,7 @@
res.w += 5;
}
const std::string str = *it;
- if(str.empty() == false && str[0] == ImagePrefix) {
+ if (!str.empty() && str[0] == IMAGE_PREFIX) {
const std::string
image_name(str.begin()+1,str.end());
surface const img =
image::get_image(image_name,image::UNSCALED);
if(img != NULL) {
@@ -412,7 +410,7 @@
for (std::vector<std::string>::const_iterator it =
img_text_items.begin();
it != img_text_items.end(); it++) {
str = *it;
- if(str.empty() == false && str[0] == ImagePrefix) {
+ if (!str.empty() && str[0] == IMAGE_PREFIX) {
const std::string
image_name(str.begin()+1,str.end());
surface const img =
image::get_image(image_name,image::UNSCALED);
const int max_width = max_width_ < 0 ? area.w :
Index: wesnoth/src/widgets/menu.hpp
diff -u wesnoth/src/widgets/menu.hpp:1.27 wesnoth/src/widgets/menu.hpp:1.28
--- wesnoth/src/widgets/menu.hpp:1.27 Sat Nov 6 09:19:28 2004
+++ wesnoth/src/widgets/menu.hpp Thu Dec 2 21:57:28 2004
@@ -12,6 +12,8 @@
#include "SDL.h"
+char const HELP_STRING_SEPARATOR = '|', DEFAULT_ITEM = '*', COLUMN_SEPARATOR =
'\t', IMAGE_PREFIX = '&';
+
namespace gui {
class menu : public scrollarea
@@ -50,7 +52,6 @@
void scroll(int pos);
- enum { HELP_STRING_SEPARATOR = '|', DEFAULT_ITEM = '*' };
enum { IMG_TEXT_SEPARATOR = 1 }; // Re-evaluate if this should be
something else to be settable from WML.
protected:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src dialogs.cpp game.cpp help.cpp prefe...,
Guillaume Melquiond <=