]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/table.cpp
Style update: add spaces around assignments
[libs/gltk.git] / source / table.cpp
index 7f0ae796f9c7077599990ee1fd563fe64bec0b29..085a44237f979bbe9013534c9c160881d75b14eb 100644 (file)
@@ -23,13 +23,13 @@ Table::Table(const Resources &r):
        data(1),
        col_w(1)
 {
-       focusable=false;
+       focusable = false;
        update_style();
 }
 
 void Table::set_rows(unsigned r)
 {
-       rows=r;
+       rows = r;
        data.resize(rows*columns);
 }
 
@@ -40,7 +40,7 @@ void Table::set_columns(unsigned c)
                for(unsigned j=0; j<min(c, columns); ++j)
                        new_data[i*c+j].swap(data[i*columns+j]);
        data.swap(new_data);
-       columns=c;
+       columns = c;
 
        col_w.resize(columns);
 }
@@ -49,7 +49,7 @@ void Table::set_column_width(unsigned c, unsigned w)
 {
        if(c>=columns)
                throw InvalidParameterValue("Column index out of bounds");
-       col_w[c]=w;
+       col_w[c] = w;
 }
 
 void Table::set_cell_text(unsigned r, unsigned c, const string &t)
@@ -57,40 +57,40 @@ void Table::set_cell_text(unsigned r, unsigned c, const string &t)
        if(r>=rows || c>=columns)
                throw InvalidParameterValue("Cell coordinates out of bounds");
 
-       data[r*columns+c]=t;
+       data[r*columns+c] = t;
 }
 
 void Table::render_special(const Part &part) const
 {
        if(part.get_name()=="cells")
        {
-               const GL::Font *const font=style->get_font();
-               const float font_size=font->get_default_size();
+               const GL::Font *const font = style->get_font();
+               const float font_size = font->get_default_size();
 
-               unsigned free_width=geom.w;
+               unsigned free_width = geom.w;
                for(unsigned i=0; i<columns; ++i)
-                       free_width-=col_w[i];
+                       free_width -= col_w[i];
 
                Geometry cgeom;
-               cgeom.h=geom.h/rows;
-               cgeom.y=geom.h-cgeom.h;
+               cgeom.h = geom.h/rows;
+               cgeom.y = geom.h-cgeom.h;
 
                for(unsigned i=0; i<rows; ++i)
                {
-                       cgeom.x=0;
+                       cgeom.x = 0;
                        for(unsigned j=0; j<columns; ++j)
                        {
                                if(col_w[j])
-                                       cgeom.w=col_w[j];
+                                       cgeom.w = col_w[j];
                                else
-                                       cgeom.w=free_width/columns;
+                                       cgeom.w = free_width/columns;
 
-                               const string &text=data[i*columns+j];
+                               const string &text = data[i*columns+j];
                                Geometry rgeom;
-                               rgeom.x=cgeom.x;
-                               rgeom.y=cgeom.y;
-                               rgeom.w=static_cast<unsigned>(font->get_string_width(text)*font_size);
-                               rgeom.h=static_cast<unsigned>((font->get_ascent()-font->get_descent())*font_size);
+                               rgeom.x = cgeom.x;
+                               rgeom.y = cgeom.y;
+                               rgeom.w = static_cast<unsigned>(font->get_string_width(text)*font_size);
+                               rgeom.h = static_cast<unsigned>((font->get_ascent()-font->get_descent())*font_size);
 
                                part.get_alignment().apply(rgeom, cgeom, part.get_margin());
 
@@ -100,10 +100,10 @@ void Table::render_special(const Part &part) const
                                font->draw_string(text);
                                GL::pop_matrix();
 
-                               cgeom.x+=cgeom.w;
+                               cgeom.x += cgeom.w;
                        }
 
-                       cgeom.y-=cgeom.h;
+                       cgeom.y -= cgeom.h;
                }
        }
 }