[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src about.cpp display.cpp help.cpp intr...
From: |
Yann Dirson |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src about.cpp display.cpp help.cpp intr... |
Date: |
Wed, 23 Mar 2005 16:30:47 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Yann Dirson <address@hidden> 05/03/23 21:30:46
Modified files:
src : about.cpp display.cpp help.cpp intro.cpp
sdl_utils.cpp sdl_utils.hpp show_dialog.cpp
show_dialog.hpp
src/editor : editor.cpp editor_palettes.cpp
src/widgets : menu.cpp textbox.cpp
Log message:
moved from show_dialog to sdl_utils those draw_ functions that do not
even need a CVideo. hence much cleanup of deps against show_dialog
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/about.cpp.diff?tr1=1.105&tr2=1.106&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.307&tr2=1.308&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.80&tr2=1.81&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/intro.cpp.diff?tr1=1.72&tr2=1.73&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.76&tr2=1.77&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.hpp.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.117&tr2=1.118&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.hpp.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.cpp.diff?tr1=1.98&tr2=1.99&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_palettes.cpp.diff?tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.85&tr2=1.86&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/textbox.cpp.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
Patches:
Index: wesnoth/src/about.cpp
diff -u wesnoth/src/about.cpp:1.105 wesnoth/src/about.cpp:1.106
--- wesnoth/src/about.cpp:1.105 Fri Mar 18 21:21:48 2005
+++ wesnoth/src/about.cpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: about.cpp,v 1.105 2005/03/18 21:21:48 ydirson Exp $ */
+/* $Id: about.cpp,v 1.106 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -19,7 +19,6 @@
#include "image.hpp"
#include "key.hpp"
#include "display.hpp"
-#include "show_dialog.hpp"
#include "sdl_utils.hpp"
#include "video.hpp"
#include "widgets/button.hpp"
@@ -325,7 +324,7 @@
const surface_restorer restorer(&video, rect);
// Clear the screen
- gui::draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,
+ draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,
0,0,0,1.0,video.getSurface());
update_whole_screen();
Index: wesnoth/src/display.cpp
diff -u wesnoth/src/display.cpp:1.307 wesnoth/src/display.cpp:1.308
--- wesnoth/src/display.cpp:1.307 Wed Mar 23 20:46:58 2005
+++ wesnoth/src/display.cpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: display.cpp,v 1.307 2005/03/23 20:46:58 ydirson Exp $ */
+/* $Id: display.cpp,v 1.308 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -27,7 +27,6 @@
#include "log.hpp"
#include "preferences.hpp"
#include "sdl_utils.hpp"
-#include "show_dialog.hpp"
#include "sound.hpp"
#include "team.hpp"
#include "tooltips.hpp"
@@ -1089,7 +1088,7 @@
const Uint32 boxcolour = SDL_MapRGB(surf->format,0xFF,0xFF,0xFF);
const surface screen(screen_.getSurface());
- gui::draw_rectangle(x+xbox,y+ybox,wbox,hbox,boxcolour,screen);
+ draw_rectangle(x+xbox,y+ybox,wbox,hbox,boxcolour,screen);
update_rect(minimap_location);
}
Index: wesnoth/src/editor/editor.cpp
diff -u wesnoth/src/editor/editor.cpp:1.98 wesnoth/src/editor/editor.cpp:1.99
--- wesnoth/src/editor/editor.cpp:1.98 Tue Mar 22 23:42:37 2005
+++ wesnoth/src/editor/editor.cpp Wed Mar 23 21:30:46 2005
@@ -1148,8 +1148,8 @@
else {
color =
SDL_MapRGB(screen->format,0x00,0x00,0x00);
}
- gui::draw_rectangle(draw_rect.x, draw_rect.y,
draw_rect.w, draw_rect.h,
- color,
gui_.video().getSurface());
+ draw_rectangle(draw_rect.x, draw_rect.y, draw_rect.w,
draw_rect.h,
+ color, gui_.video().getSurface());
update_rect(draw_rect);
}
}
Index: wesnoth/src/editor/editor_palettes.cpp
diff -u wesnoth/src/editor/editor_palettes.cpp:1.26
wesnoth/src/editor/editor_palettes.cpp:1.27
--- wesnoth/src/editor/editor_palettes.cpp:1.26 Fri Mar 18 21:21:48 2005
+++ wesnoth/src/editor/editor_palettes.cpp Wed Mar 23 21:30:46 2005
@@ -16,7 +16,6 @@
#include "editor_palettes.hpp"
#include "editor_layout.hpp"
#include "../sdl_utils.hpp"
-#include "../show_dialog.hpp"
#include "../image.hpp"
#include "../reports.hpp"
#include "../gettext.hpp"
@@ -290,7 +289,7 @@
else {
color = SDL_MapRGB(screen->format,0x00,0x00,0x00);
}
- gui::draw_rectangle(dstrect.x, dstrect.y, image->w, image->h,
color, screen);
+ draw_rectangle(dstrect.x, dstrect.y, image->w, image->h, color,
screen);
if (counter_from_zero % 2 != 0)
y += size_specs_.terrain_space;
}
@@ -422,7 +421,7 @@
const Uint32 color = (unsigned)i == selected_brush_size() ?
SDL_MapRGB(screen->format,0xFF,0x00,0x00) :
SDL_MapRGB(screen->format,0x00,0x00,0x00);
- gui::draw_rectangle(dstrect.x, dstrect.y, image->w, image->h,
color, screen);
+ draw_rectangle(dstrect.x, dstrect.y, image->w, image->h, color,
screen);
x += image->w;
}
update_rect(loc);
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.80 wesnoth/src/help.cpp:1.81
--- wesnoth/src/help.cpp:1.80 Sat Mar 19 14:54:00 2005
+++ wesnoth/src/help.cpp Wed Mar 23 21:30:46 2005
@@ -23,6 +23,7 @@
#include "image.hpp"
#include "language.hpp"
#include "preferences.hpp"
+#include "sdl_utils.hpp"
#include "show_dialog.hpp"
#include "unit.hpp"
#include "util.hpp"
@@ -2076,7 +2077,7 @@
dst.y += loc.y;
if (it->box) {
for (int i = 0; i < box_width; i++) {
- gui::draw_rectangle(dst.x, dst.y,
it->rect.w - i * 2, it->rect.h - i * 2,
+ draw_rectangle(dst.x, dst.y, it->rect.w
- i * 2, it->rect.h - i * 2,
0, screen);
dst.x++;
dst.y++;
Index: wesnoth/src/intro.cpp
diff -u wesnoth/src/intro.cpp:1.72 wesnoth/src/intro.cpp:1.73
--- wesnoth/src/intro.cpp:1.72 Sun Mar 20 16:27:44 2005
+++ wesnoth/src/intro.cpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: intro.cpp,v 1.72 2005/03/20 16:27:44 ydirson Exp $ */
+/* $Id: intro.cpp,v 1.73 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -20,7 +20,7 @@
#include "image.hpp"
#include "intro.hpp"
#include "key.hpp"
-#include "show_dialog.hpp"
+#include "sdl_utils.hpp"
#include "sound.hpp"
#include "util.hpp"
#include "video.hpp"
@@ -89,7 +89,7 @@
gui::button next_button(video,_("Next") + std::string(">>>"));
gui::button skip_button(video,_("Skip"));
- gui::draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,
+ draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,
0,0,0,1.0,video.getSurface());
@@ -296,7 +296,7 @@
SDL_Delay(20);
}
-
gui::draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,0,0,0,1.0,
+ draw_solid_tinted_rectangle(0,0,video.getx()-1,video.gety()-1,0,0,0,1.0,
video.getSurface());
return true;
Index: wesnoth/src/sdl_utils.cpp
diff -u wesnoth/src/sdl_utils.cpp:1.76 wesnoth/src/sdl_utils.cpp:1.77
--- wesnoth/src/sdl_utils.cpp:1.76 Wed Mar 9 21:56:05 2005
+++ wesnoth/src/sdl_utils.cpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.cpp,v 1.76 2005/03/09 21:56:05 ydirson Exp $ */
+/* $Id: sdl_utils.cpp,v 1.77 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -25,6 +25,8 @@
#include <iostream>
#include <map>
+#define ERR_DP lg::err(lg::display)
+
SDLKey sdl_keysym_from_name(std::string const &keyname)
{
static bool initialized = false;
@@ -931,3 +933,36 @@
{
surface_.assign(NULL);
}
+
+void draw_rectangle(int x, int y, int w, int h, Uint32 colour,surface target)
+{
+ if(x < 0 || y < 0 || x+w >= target->w || y+h >= target->h) {
+ ERR_DP << "Rectangle has illegal co-ordinates: " << x << "," <<
y
+ << "," << w << "," << h << "\n";
+ return;
+ }
+
+ SDL_Rect top = {x,y,w,1};
+ SDL_Rect bot = {x,y+h-1,w,1};
+ SDL_Rect left = {x,y,1,h};
+ SDL_Rect right = {x+w-1,y,1,h};
+
+ SDL_FillRect(target,&top,colour);
+ SDL_FillRect(target,&bot,colour);
+ SDL_FillRect(target,&left,colour);
+ SDL_FillRect(target,&right,colour);
+}
+
+void draw_solid_tinted_rectangle(int x, int y, int w, int h,
+ int r, int g, int b,
+ double alpha, surface target)
+{
+ if(x < 0 || y < 0 || x+w >= target->w || y+h >= target->h) {
+ ERR_DP << "Rectangle has illegal co-ordinates: " << x << "," <<
y
+ << "," << w << "," << h << "\n";
+ return;
+ }
+
+ SDL_Rect rect = {x,y,w,h};
+
fill_rect_alpha(rect,SDL_MapRGB(target->format,r,g,b),Uint8(alpha*255),target);
+}
Index: wesnoth/src/sdl_utils.hpp
diff -u wesnoth/src/sdl_utils.hpp:1.54 wesnoth/src/sdl_utils.hpp:1.55
--- wesnoth/src/sdl_utils.hpp:1.54 Tue Mar 1 20:42:52 2005
+++ wesnoth/src/sdl_utils.hpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.hpp,v 1.54 2005/03/01 20:42:52 j_daniel Exp $ */
+/* $Id: sdl_utils.hpp,v 1.55 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -218,4 +218,11 @@
SDL_Rect rect;
};
+
+void draw_rectangle(int x, int y, int w, int h, Uint32 colour, surface tg);
+
+void draw_solid_tinted_rectangle(int x, int y, int w, int h,
+ int r, int g, int b,
+ double alpha, surface target);
+
#endif
Index: wesnoth/src/show_dialog.cpp
diff -u wesnoth/src/show_dialog.cpp:1.117 wesnoth/src/show_dialog.cpp:1.118
--- wesnoth/src/show_dialog.cpp:1.117 Wed Mar 23 20:46:58 2005
+++ wesnoth/src/show_dialog.cpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: show_dialog.cpp,v 1.117 2005/03/23 20:46:58 ydirson Exp $ */
+/* $Id: show_dialog.cpp,v 1.118 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -275,39 +275,6 @@
}
}
-void draw_rectangle(int x, int y, int w, int h, Uint32 colour,surface target)
-{
- if(x < 0 || y < 0 || x+w >= target->w || y+h >= target->h) {
- ERR_DP << "Rectangle has illegal co-ordinates: " << x << "," <<
y
- << "," << w << "," << h << "\n";
- return;
- }
-
- SDL_Rect top = {x,y,w,1};
- SDL_Rect bot = {x,y+h-1,w,1};
- SDL_Rect left = {x,y,1,h};
- SDL_Rect right = {x+w-1,y,1,h};
-
- SDL_FillRect(target,&top,colour);
- SDL_FillRect(target,&bot,colour);
- SDL_FillRect(target,&left,colour);
- SDL_FillRect(target,&right,colour);
-}
-
-void draw_solid_tinted_rectangle(int x, int y, int w, int h,
- int r, int g, int b,
- double alpha, surface target)
-{
- if(x < 0 || y < 0 || x+w >= target->w || y+h >= target->h) {
- ERR_DP << "Rectangle has illegal co-ordinates: " << x << "," <<
y
- << "," << w << "," << h << "\n";
- return;
- }
-
- SDL_Rect rect = {x,y,w,h};
-
fill_rect_alpha(rect,SDL_MapRGB(target->format,r,g,b),Uint8(alpha*255),target);
-}
-
} //end namespace gui
namespace {
Index: wesnoth/src/show_dialog.hpp
diff -u wesnoth/src/show_dialog.hpp:1.46 wesnoth/src/show_dialog.hpp:1.47
--- wesnoth/src/show_dialog.hpp:1.46 Wed Mar 23 20:46:58 2005
+++ wesnoth/src/show_dialog.hpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: show_dialog.hpp,v 1.46 2005/03/23 20:46:58 ydirson Exp $ */
+/* $Id: show_dialog.hpp,v 1.47 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -50,12 +50,6 @@
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);
-
-void draw_solid_tinted_rectangle(int x, int y, int w, int h,
- int r, int g, int b,
- double alpha,
surface target);
-
//given the location of a dialog, will draw its title.
//Returns the area the title takes up
SDL_Rect draw_dialog_title(int x, int y, CVideo* disp, const std::string&
text);
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.85 wesnoth/src/widgets/menu.cpp:1.86
--- wesnoth/src/widgets/menu.cpp:1.85 Fri Mar 18 21:21:48 2005
+++ wesnoth/src/widgets/menu.cpp Wed Mar 23 21:30:46 2005
@@ -5,7 +5,6 @@
#include "../font.hpp"
#include "../image.hpp"
#include "../sdl_utils.hpp"
-#include "../show_dialog.hpp"
#include "../util.hpp"
#include "../video.hpp"
#include "../wml_separators.hpp"
@@ -394,10 +393,10 @@
}
clear_item(item);
- gui::draw_solid_tinted_rectangle(rect.x, rect.y, rect.w, rect.h,
- item == selected_ ? 150:0,0,0,
- item == selected_ ? 0.6 : 0.2,
- video().getSurface());
+ draw_solid_tinted_rectangle(rect.x, rect.y, rect.w, rect.h,
+ item == selected_ ? 150:0,0,0,
+ item == selected_ ? 0.6 : 0.2,
+ video().getSurface());
SDL_Rect const &area = screen_area();
//SDL_Rect area = { 0, 0, rect.w, rect.h };
Index: wesnoth/src/widgets/textbox.cpp
diff -u wesnoth/src/widgets/textbox.cpp:1.73
wesnoth/src/widgets/textbox.cpp:1.74
--- wesnoth/src/widgets/textbox.cpp:1.73 Fri Mar 18 21:21:48 2005
+++ wesnoth/src/widgets/textbox.cpp Wed Mar 23 21:30:46 2005
@@ -1,4 +1,4 @@
-/* $Id: textbox.cpp,v 1.73 2005/03/18 21:21:48 ydirson Exp $ */
+/* $Id: textbox.cpp,v 1.74 2005/03/23 21:30:46 ydirson Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -18,7 +18,7 @@
#include "../font.hpp"
#include "../language.hpp"
#include "../log.hpp"
-#include "../show_dialog.hpp"
+#include "../sdl_utils.hpp"
#include "../util.hpp"
#include "../video.hpp"
#include "SDL.h"
@@ -123,8 +123,8 @@
SDL_Rect const &loc = inner_location();
surface surf = video().getSurface();
- gui::draw_solid_tinted_rectangle(loc.x,loc.y,loc.w,loc.h,0,0,0,
- focus() ? alpha_focus_ : alpha_, surf);
+ draw_solid_tinted_rectangle(loc.x,loc.y,loc.w,loc.h,0,0,0,
+ focus() ? alpha_focus_ : alpha_, surf);
SDL_Rect src;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src about.cpp display.cpp help.cpp intr...,
Yann Dirson <=