Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/wesnoth/wesnoth
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jun 19, 2014
2 parents 0182224 + 5044300 commit 6b4ad80
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 17 deletions.
2 changes: 2 additions & 0 deletions changelog
Expand Up @@ -76,6 +76,8 @@ Version 1.13.0-dev:
* Added customizable recall costs for unit types and individual units,
using the new recall_cost attribute in [unit_type] and [unit].
* Added support for [elseif] tags inside [if]
* Schema validator messages now conform better to the new WML
parser/preprocessor diagnostics format introduced in version 1.11.10.
* Miscellaneous and bug fixes:
* replace 'fight_on_without_leader'=yes/no with defeat_condition=no_leader/
no_units/always/never which allows the wml developer to decide when a side
Expand Down
Expand Up @@ -90,7 +90,7 @@
profile=portraits/Hamel.png
canrecruit=yes
side=4
{GOLD 150 130 120 100}
{GOLD 130 120 100}
recruit=Dwarvish Fighter,Dwarvish Thunderer,Dwarvish Guardsman,Dwarvish Scout
team_name=rebels
user_team_name=_"Rebels"
Expand Down Expand Up @@ -119,7 +119,7 @@
name= _ "Thung"
canrecruit=yes
side=6
{GOLD 200 300 400 500}
{GOLD 300 400 500}
recruit=Troll Whelp,Troll,Troll Rocklobber
team_name=trolls
user_team_name=_"Trolls"
Expand Down
Expand Up @@ -56,7 +56,7 @@
side=3
team_name=undead
user_team_name=_"Undead"
{GOL 100 150 250}
{GOLD 100 150 250}
{INCOME 10 16 22}
#ifdef NORMAL
recruit=Skeleton,Skeleton Archer,Revenant
Expand Down
100 changes: 100 additions & 0 deletions data/gui/default/widget/slider_minimal.cfg
@@ -0,0 +1,100 @@
#textdomain wesnoth-lib
###
### Experimental slider variant that does not have a text label since the
### default variant does have one that takes up more space than is strictly
### necessary and I (shadowm) can't deal with all the magic numbers in it.
###

#define _GUI_STATE IMAGE_SUFFIX GROOVE_COLOR
[draw]

#
# Groove
#

[line]
x1 = 0
y1 = "(height / 2)"
x2 = "(width - 1)"
y2 = "(height / 2)"

color = {GROOVE_COLOR}
thickness = 1
[/line]

#
# Slider
#

[image]
x = "(positioner_offset)"
y = "(if (image_height < height, (height - image_height) / 2, 0))"
name = "buttons/sliders/slider{IMAGE_SUFFIX}"
[/image]

[/draw]
#enddef

#define _GUI_RESOLUTION RESOLUTION MIN_WIDTH DEFAULT_WIDTH HEIGHT POSITIONER_LENGTH

[resolution]

{RESOLUTION}

min_width = {MIN_WIDTH}
min_height = {HEIGHT}

default_width = {DEFAULT_WIDTH}
default_height = {HEIGHT}

max_width = 0
max_height = {HEIGHT}

minimum_positioner_length = {POSITIONER_LENGTH}
maximum_positioner_length = {POSITIONER_LENGTH}

#text_font_size = 1 # placeholder

[state_enabled]
{_GUI_STATE
".png"
({GUI__FONT_COLOR_ENABLED__DEFAULT})
}
[/state_enabled]

[state_disabled]
{_GUI_STATE
".png~GS()"
({GUI__FONT_COLOR_DISABLED__DEFAULT})
}
[/state_disabled]

[state_pressed]
{_GUI_STATE
"-pressed.png"
({GUI__FONT_COLOR_ENABLED__DEFAULT})
}
[/state_pressed]

[state_focussed]
{_GUI_STATE
"-active.png"
({GUI__FONT_COLOR_ENABLED__DEFAULT})
}
[/state_focussed]

[/resolution]
#enddef

[slider_definition]
id = "minimal"
description = "A slider without a value label."

# Tiny gui sizes haven't been tested yet so might need some tuning.
{_GUI_RESOLUTION ({GUI_TINY__RESOLUTION}) 75 125 11 8 }
{_GUI_RESOLUTION () 150 250 22 16 }

[/slider_definition]

#undef _GUI_STATE
#undef _GUI_RESOLUTION
14 changes: 13 additions & 1 deletion data/gui/default/window/chat_log.cfg
Expand Up @@ -65,13 +65,25 @@
border_size = 5
[slider]
id = "page_number"
definition = "default"
definition = "minimal"
minimum_value = 1
maximum_value = 100
step_size = 1
# Unused, kept for 1.12 i18n in case the default slider
# variant with a label needs to be restored.
maximum_value_label = _"Last"
[/slider]
[/column]
[column]
grow_factor = 0
border = "all"
border_size = 5
[label]
id = "page_label"
definition = "default"
label = ""
[/label]
[/column]
[column]
grow_factor = 0
border = "all"
Expand Down
9 changes: 9 additions & 0 deletions src/gui/dialogs/chat_log.cpp
Expand Up @@ -74,6 +74,7 @@ class tchat_log::model
, chat_log_history(r->build_chat_log())
, page(0)
, page_number()
, page_label()
, previous_page()
, next_page()
, filter()
Expand All @@ -89,6 +90,7 @@ class tchat_log::model
int page;
static const int COUNT_PER_PAGE = 100;
tslider* page_number;
tcontrol* page_label;
tbutton* previous_page;
tbutton* next_page;
ttext_box* filter;
Expand Down Expand Up @@ -310,6 +312,11 @@ class tchat_log::controller
LOG_CHAT_LOG << "Maximum value of page number slider: "
<< count_of_pages << std::endl;
model_.page_number->set_value(page + 1);

std::ostringstream cur_page_text;
cur_page_text << (page + 1) << '/' << std::max(1, count_of_pages);
model_.page_label->set_label(cur_page_text.str());

LOG_CHAT_LOG << "Exiting tchat_log::controller::update_view_from_model"
<< std::endl;
}
Expand Down Expand Up @@ -404,6 +411,8 @@ class tchat_log::view
this,
boost::ref(window)));

model_.page_label = &find_widget<tcontrol>(&window, "page_label", false);

LOG_CHAT_LOG << "Exiting tchat_log::view::bind" << std::endl;
}

Expand Down
32 changes: 19 additions & 13 deletions src/serialization/schema_validator.cpp
Expand Up @@ -34,7 +34,7 @@ static lg::log_domain log_validation("validation");
static std::string at(const std::string & file, int line){
std::ostringstream ss;
ss << line << " " << file;
return ::lineno_string(ss.str());
return "at " + ::lineno_string(ss.str());
}

static void print_output(const std::string & message,bool flag_exception = false ){
Expand All @@ -55,53 +55,59 @@ static void extra_tag_error(const std::string & file, int line,
const std::string & name,int n,
const std::string & parent, bool flag_exception){
std::ostringstream ss;
ss <<at(file,line) << ": extra tag [" << name << "]; there may only be "
<< n << " ["<< name <<"] in [" << parent <<"]\n";
ss << "Extra tag [" << name << "]; there may only be "
<< n << " [" << name << "] in [" << parent << "]\n"
<< at(file, line) << "\n";
print_output (ss.str (),flag_exception);
}

static void wrong_tag_error(const std::string & file, int line,
const std::string & name,const std::string & parent,
bool flag_exception){
std::ostringstream ss;
ss <<at(file,line) << ": tag [" << name << "] may not be used in [" <<
parent <<"]\n";
ss << "Tag [" << name << "] may not be used in ["
<< parent << "]\n"
<< at(file, line) << "\n";
print_output (ss.str (),flag_exception);
}

static void missing_tag_error(const std::string & file, int line,
const std::string & name,int n,
const std::string & parent, bool flag_exception){
std::ostringstream ss;
ss <<at(file,line) << ": missing tag [" << name << "]; there must be "
<< n << " ["<< name <<"]s in [" << parent <<"]\n";
ss << "Missing tag [" << name << "]; there must be "
<< n << " [" << name << "]s in [" << parent << "]\n"
<< at(file, line) << "\n";
print_output (ss.str (),flag_exception);
}

static void extra_key_error(const std::string & file, int line,
const std::string & tag,const std::string & key,
bool flag_exception){
std::ostringstream ss;
ss << at(file,line) << ": Invalid key '"<< key <<"=' in tag ["<< tag
<< "] on line " << line << "\n";
ss << "Invalid key '" << key << "=' in tag [" << tag
<< "]\n"
<< at(file, line) << "\n";
print_output (ss.str (),flag_exception);
}

static void missing_key_error(const std::string & file, int line,
const std::string & tag,const std::string & key,
bool flag_exception){
std::ostringstream ss;
ss << at(file,line) << ": In tag "<< tag
<< " which begins here, " << " missing key "<< key << "\n";
ss << "Missing key '" << key << "=' in tag [" << tag
<< "]\n"
<< at(file, line) << "\n";
print_output (ss.str (),flag_exception);
}

static void wrong_value_error(const std::string & file, int line,
const std::string & tag,const std::string & key,
const std::string & value,bool flag_exception){
std::ostringstream ss;
ss << at(file,line) << ": Invalid value '"<< value << "' in key '" << key <<
"=' in tag ["<< tag <<"] on line " << line << "'\n";
ss << "Invalid value '" << value << "' in key '" << key
<< "=' in tag [" << tag << "]\n"
<< at(file, line) << "\n";
print_output (ss.str (),flag_exception);
}

Expand Down

0 comments on commit 6b4ad80

Please sign in to comment.