[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp video.cpp v...
From: |
Yann Dirson |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp video.cpp v... |
Date: |
Wed, 16 Mar 2005 15:50:12 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Yann Dirson <address@hidden> 05/03/16 20:50:12
Modified files:
src : display.cpp display.hpp video.cpp video.hpp
src/widgets : menu.cpp widget.cpp
Log message:
moved help_string stuff from display to video
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.298&tr2=1.299&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.hpp.diff?tr1=1.96&tr2=1.97&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.cpp.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.hpp.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.83&tr2=1.84&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/widget.cpp.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
Patches:
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.298 wesnoth/src/display.cpp:1.299
--- wesnoth/src/display.cpp:1.298 Tue Mar 15 22:14:04 2005
+++ wesnoth/src/display.cpp Wed Mar 16 20:50:11 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.298 2005/03/15 22:14:04 ydirson Exp $ */
+/* $Id: display.cpp,v 1.299 2005/03/16 20:50:11 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -79,7 +79,7 @@
theme_(theme_cfg,screen_area()), builder_(cfg, level, map),
first_turn_(true), in_game_(false), map_labels_(*this,map),
tod_hex_mask1(NULL), tod_hex_mask2(NULL), diagnostic_label_(0),
- help_string_(0), fps_handle_(0)
+ fps_handle_(0)
{
if(non_interactive())
updatesLocked_++;
@@ -2156,41 +2156,6 @@
create_buttons();
}
-int display::set_help_string(const std::string& str)
-{
- font::remove_floating_label(help_string_);
-
- const SDL_Color colour = {0x0,0x00,0x00,0x77};
-
- int size = font::SIZE_LARGE;
-
- while(size > 0) {
- if(font::line_width(str, size) > x()) {
- size--;
- } else {
- break;
- }
- }
-
- help_string_ =
font::add_floating_label(str,size,font::NORMAL_COLOUR,x()/2,y(),0.0,0.0,-1,screen_area(),font::CENTER_ALIGN,&colour,5);
- const SDL_Rect& rect = font::get_floating_label_rect(help_string_);
- font::move_floating_label(help_string_,0.0,-double(rect.h));
- return help_string_;
-}
-
-void display::clear_help_string(int handle)
-{
- if(handle == help_string_) {
- font::remove_floating_label(handle);
- help_string_ = 0;
- }
-}
-
-void display::clear_all_help_strings()
-{
- clear_help_string(help_string_);
-}
-
void display::create_buttons()
{
buttons_.clear();
Index: wesnoth/src/display.hpp
diff -u wesnoth/src/display.hpp:1.96 wesnoth/src/display.hpp:1.97
--- wesnoth/src/display.hpp:1.96 Tue Mar 15 22:14:04 2005
+++ wesnoth/src/display.hpp Wed Mar 16 20:50:11 2005
@@ -1,4 +1,4 @@
-/* $Id: display.hpp,v 1.96 2005/03/15 22:14:04 ydirson Exp $ */
+/* $Id: display.hpp,v 1.97 2005/03/16 20:50:11 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -352,13 +352,6 @@
bool in_game() const { return in_game_; }
- //functions to set and clear 'help strings'. A 'help string' is like a
tooltip, but it appears
- //at the bottom of the screen, so as to not be intrusive. Setting a
help string sets what
- //is currently displayed there.
- int set_help_string(const std::string& str);
- void clear_help_string(int handle);
- void clear_all_help_strings();
-
private:
display(const display&);
void operator=(const display&);
@@ -503,9 +496,6 @@
int diagnostic_label_;
- //variables for help strings
- int help_string_;
-
//animated flags for each team
std::vector<animated<image::locator> > flags_;
Index: wesnoth/src/video.cpp
diff -u wesnoth/src/video.cpp:1.59 wesnoth/src/video.cpp:1.60
--- wesnoth/src/video.cpp:1.59 Tue Mar 15 22:14:04 2005
+++ wesnoth/src/video.cpp Wed Mar 16 20:50:11 2005
@@ -1,4 +1,4 @@
-/* $Id: video.cpp,v 1.59 2005/03/15 22:14:04 ydirson Exp $ */
+/* $Id: video.cpp,v 1.60 2005/03/16 20:50:11 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -202,7 +202,7 @@
{
update_all = true;
}
-CVideo::CVideo() : bpp(0), fake_screen(false)
+CVideo::CVideo() : bpp(0), fake_screen(false), help_string_(0)
{
const int res = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO |
SDL_INIT_NOPARACHUTE);
@@ -213,7 +213,7 @@
}
CVideo::CVideo( int x, int y, int bits_per_pixel, int flags)
- : bpp(0), fake_screen(false)
+ : bpp(0), fake_screen(false), help_string_(0)
{
const int res = SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO |
SDL_INIT_NOPARACHUTE);
if(res < 0) {
@@ -385,3 +385,38 @@
{
return bpp;
}
+
+int CVideo::set_help_string(const std::string& str)
+{
+ font::remove_floating_label(help_string_);
+
+ const SDL_Color colour = {0x0,0x00,0x00,0x77};
+
+ int size = font::SIZE_LARGE;
+
+ while(size > 0) {
+ if(font::line_width(str, size) > getx()) {
+ size--;
+ } else {
+ break;
+ }
+ }
+
+ help_string_ =
font::add_floating_label(str,size,font::NORMAL_COLOUR,getx()/2,gety(),0.0,0.0,-1,screen_area(),font::CENTER_ALIGN,&colour,5);
+ const SDL_Rect& rect = font::get_floating_label_rect(help_string_);
+ font::move_floating_label(help_string_,0.0,-double(rect.h));
+ return help_string_;
+}
+
+void CVideo::clear_help_string(int handle)
+{
+ if(handle == help_string_) {
+ font::remove_floating_label(handle);
+ help_string_ = 0;
+ }
+}
+
+void CVideo::clear_all_help_strings()
+{
+ clear_help_string(help_string_);
+}
Index: wesnoth/src/video.hpp
diff -u wesnoth/src/video.hpp:1.31 wesnoth/src/video.hpp:1.32
--- wesnoth/src/video.hpp:1.31 Tue Mar 15 22:14:04 2005
+++ wesnoth/src/video.hpp Wed Mar 16 20:50:11 2005
@@ -1,4 +1,4 @@
-/* $Id: video.hpp,v 1.31 2005/03/15 22:14:04 ydirson Exp $ */
+/* $Id: video.hpp,v 1.32 2005/03/16 20:50:11 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -78,6 +78,13 @@
void make_fake();
+ //functions to set and clear 'help strings'. A 'help string' is like a
tooltip, but it appears
+ //at the bottom of the screen, so as to not be intrusive. Setting a
help string sets what
+ //is currently displayed there.
+ int set_help_string(const std::string& str);
+ void clear_help_string(int handle);
+ void clear_all_help_strings();
+
private:
bool mode_changed_;
@@ -86,6 +93,9 @@
//if there is no display at all, but we 'fake' it for clients
bool fake_screen;
+
+ //variables for help strings
+ int help_string_;
};
#endif
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.83 wesnoth/src/widgets/menu.cpp:1.84
--- wesnoth/src/widgets/menu.cpp:1.83 Tue Mar 15 22:14:04 2005
+++ wesnoth/src/widgets/menu.cpp Wed Mar 16 20:50:12 2005
@@ -568,11 +568,11 @@
if(loc == cur_help_) {
return;
} else if(loc.first == -1) {
- disp().clear_help_string(help_string_);
+ video().clear_help_string(help_string_);
help_string_ = -1;
} else {
if(help_string_ != -1) {
- disp().clear_help_string(help_string_);
+ video().clear_help_string(help_string_);
help_string_ = -1;
}
@@ -582,7 +582,7 @@
const std::string& help = row[loc.second];
if(help.empty() == false) {
//std::cerr << "setting help string
from menu to '" << help << "'\n";
- help_string_ =
disp().set_help_string(help);
+ help_string_ =
video().set_help_string(help);
}
}
}
Index: wesnoth/src/widgets/widget.cpp
diff -u wesnoth/src/widgets/widget.cpp:1.29 wesnoth/src/widgets/widget.cpp:1.30
--- wesnoth/src/widgets/widget.cpp:1.29 Tue Mar 15 21:47:41 2005
+++ wesnoth/src/widgets/widget.cpp Wed Mar 16 20:50:12 2005
@@ -243,10 +243,10 @@
if (!hidden() && point_in_rect(mousex, mousey, rect_)) {
if(help_string_ == 0 && help_text_ != "") {
//std::cerr << "setting help string to '" << help_text_
<< "'\n";
- help_string_ = disp().set_help_string(help_text_);
+ help_string_ = video().set_help_string(help_text_);
}
} else if(help_string_ > 0) {
- disp().clear_help_string(help_string_);
+ video().clear_help_string(help_string_);
help_string_ = 0;
}
}
- [Wesnoth-cvs-commits] wesnoth/src display.cpp display.hpp video.cpp v...,
Yann Dirson <=