Author: mordante
Date: Wed Apr 30 20:28:09 2008
New Revision: 26263

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26263&view=rev
Log:
Some small cleanups.

Modified:
    trunk/src/gui/widgets/canvas.cpp
    trunk/src/gui/widgets/canvas.hpp
    trunk/src/gui/widgets/control.hpp
    trunk/src/gui/widgets/grid.hpp
    trunk/src/gui/widgets/text.cpp
    trunk/src/gui/widgets/window.cpp

Modified: trunk/src/gui/widgets/canvas.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/canvas.cpp?rev=26263&r1=26262&r2=26263&view=diff
==============================================================================
--- trunk/src/gui/widgets/canvas.cpp (original)
+++ trunk/src/gui/widgets/canvas.cpp Wed Apr 30 20:28:09 2008
@@ -783,16 +783,7 @@
                variables_.add("height",variant(h_));
        }
 
-       // set surface sizes (do nothing now)
-#if 0  
-       if(fixme test whether -> can be used otherwise we crash w_ != 
canvas_->w || h_ != canvas_->h) {
-               // create new
-
-       } else {
-               // fill current
-       }
-#endif
-       // instead we overwrite the entire thing for now
+       // create surface
        DBG_G_D << "Canvas: create new empty canvas.\n";
        canvas_.assign(SDL_CreateRGBSurface(SDL_SWSURFACE, w_, h_, 32, 
0xFF0000, 0xFF00, 0xFF, 0xFF000000));
 
@@ -837,7 +828,6 @@
 
 void tcanvas::tshape::put_pixel(ptrdiff_t start, Uint32 colour, unsigned w, 
unsigned x, unsigned y)
 {
-       // fixme the 4 is true due to Uint32..
        *reinterpret_cast<Uint32*>(start + (y * w * 4) + x * 4) = colour;
 }
 

Modified: trunk/src/gui/widgets/canvas.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/canvas.hpp?rev=26263&r1=26262&r2=26263&view=diff
==============================================================================
--- trunk/src/gui/widgets/canvas.hpp (original)
+++ trunk/src/gui/widgets/canvas.hpp Wed Apr 30 20:28:09 2008
@@ -15,8 +15,6 @@
 //! @file canvas.hpp
 //! This file contains the canvas object which is the part where the widgets
 //! draw (tempory) images on.
-
-// FIXME look at SDL_gfx it might have some nice functions that same me work.
 
 #ifndef __GUI_WIDGETS_CANVAS_HPP_INCLUDED__
 #define __GUI_WIDGETS_CANVAS_HPP_INCLUDED__

Modified: trunk/src/gui/widgets/control.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/control.hpp?rev=26263&r1=26262&r2=26263&view=diff
==============================================================================
--- trunk/src/gui/widgets/control.hpp (original)
+++ trunk/src/gui/widgets/control.hpp Wed Apr 30 20:28:09 2008
@@ -19,6 +19,8 @@
 #include "gui/widgets/settings.hpp"
 #include "gui/widgets/widget.hpp"
 #include "tstring.hpp"
+
+#include <cassert>
 
 namespace gui2 {
 
@@ -62,7 +64,8 @@
        const t_string& help_message() const { return help_message_; }
 
        std::vector<tcanvas>& canvas() { return canvas_; }
-       tcanvas& canvas(const unsigned index) { return canvas_[index]; } // 
FIXME an assert would be nice
+       tcanvas& canvas(const unsigned index) 
+               { assert(index < canvas_.size()); return canvas_[index]; }
 
        //! Inherited from twidget.
        void draw(surface& surface);
@@ -122,10 +125,10 @@
        //! The label associated with a lot of widgets to show a (non editable) 
text.
        t_string label_;
 
-       //! When hovering a tooltip with extra information can show up. (FIXME 
implement)
+       //! When hovering a tooltip with extra information can show up.
        t_string tooltip_;
 
-       //! When the user presses help a tooltip with even more info can be 
shown. (FIXME implement)
+       //! When the user presses help a tooltip with even more info can be 
shown.
        t_string help_message_;
 
        //! Holds all canvas objects for a control. 

Modified: trunk/src/gui/widgets/grid.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/grid.hpp?rev=26263&r1=26262&r2=26263&view=diff
==============================================================================
--- trunk/src/gui/widgets/grid.hpp (original)
+++ trunk/src/gui/widgets/grid.hpp Wed Apr 30 20:28:09 2008
@@ -17,6 +17,8 @@
 
 #include "gui/widgets/widget.hpp"
 #include "gui/widgets/control.hpp"
+
+#include <cassert>
 
 namespace gui2 {
 
@@ -75,15 +77,21 @@
        void set_rows_cols(const unsigned rows, const unsigned cols);
 
        void set_row_grow_factor(const unsigned row, const unsigned factor)
-               { row_grow_factor_[row] = factor; set_dirty(); } //FIXME add 
assert.
+       { 
+               assert(row < row_grow_factor_.size()); 
+               row_grow_factor_[row] = factor; 
+               set_dirty(); 
+       } 
 
        void set_col_grow_factor(const unsigned col, const unsigned factor)
-               { col_grow_factor_[col] = factor; set_dirty(); } //FIXME add 
assert.
+       { 
+               assert(col< col_grow_factor_.size());
+               col_grow_factor_[col] = factor; 
+               set_dirty(); 
+       }
 
        void remove_child(const unsigned row, const unsigned col);
        void remove_child(const std::string& id, const bool find_all = false);
-
-       //FIXME  add the option to set the proportional growth for each row and 
column
 
        //! Inherited from twidget.
        tpoint get_minimum_size() const { /*FIXME IMPLEMENT*/ return 
tpoint(0,0); } 

Modified: trunk/src/gui/widgets/text.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/text.cpp?rev=26263&r1=26262&r2=26263&view=diff
==============================================================================
--- trunk/src/gui/widgets/text.cpp (original)
+++ trunk/src/gui/widgets/text.cpp Wed Apr 30 20:28:09 2008
@@ -78,9 +78,6 @@
 void ttext_::mouse_left_button_down(tevent_handler& event) 
 { 
        DBG_G_E << "Text_box: left mouse button down.\n"; 
-
-       //FIXME place cursor
-       //set select  mode
 
        event.keyboard_capture(this);
        event.mouse_capture();
@@ -355,8 +352,6 @@
        handled = true;
        if(sel_start_){
                delete_char(true);
-       } else {
-               // FIXME beep
        }
 
 }
@@ -384,8 +379,5 @@
        }
 }
 
-
-
-
 } // namespace gui2
 

Modified: trunk/src/gui/widgets/window.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/gui/widgets/window.cpp?rev=26263&r1=26262&r2=26263&view=diff
==============================================================================
--- trunk/src/gui/widgets/window.cpp (original)
+++ trunk/src/gui/widgets/window.cpp Wed Apr 30 20:28:09 2008
@@ -77,11 +77,7 @@
 {
        log_scope2(gui_draw, "Window: show.");  
 
-       // Sanity
-       if(status_ != NEW) {
-               // FIXME throw an exception
-
-       }
+       assert(status_ == NEW);
 
        // We cut a piece of the screen and use that, that way all coordinates
        // are relative to the window.
@@ -93,7 +89,6 @@
        for(status_ = SHOWING; status_ != REQUEST_CLOSE; ) {
                process_events();
 
-               // fixme manual destroy
                if(status_ == REQUEST_CLOSE) {
                        break;
                }


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to