X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Ftable.cpp;h=1fe69619f911aa892563c27b54dba76e613d1c5d;hb=4ab33a06c9f8a85b193d7db8bc6ee9b8895aab09;hp=f3016723e3566078a8ca204d1b5d60d4e0d765ed;hpb=73afd124ab87e8bace98db55517a56c797a9b8c7;p=libs%2Fgltk.git diff --git a/source/table.cpp b/source/table.cpp index f301672..1fe6961 100644 --- a/source/table.cpp +++ b/source/table.cpp @@ -1,10 +1,4 @@ -/* $Id$ - -This file is part of libmspgltk -Copyright © 2008 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include #include #include #include "part.h" @@ -46,14 +40,14 @@ void Table::set_columns(unsigned c) void Table::set_column_width(unsigned c, unsigned w) { if(c>=columns) - throw InvalidParameterValue("Column index out of bounds"); + throw invalid_argument("Table::set_column_width"); col_w[c] = w; } void Table::set_cell_text(unsigned r, unsigned c, const string &t) { if(r>=rows || c>=columns) - throw InvalidParameterValue("Cell coordinates out of bounds"); + throw out_of_range("Table::set_cell_text"); data[r*columns+c] = t; } @@ -62,8 +56,8 @@ 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 &font = style->get_font(); + float font_size = style->get_font_size(); unsigned free_width = geom.w; for(unsigned i=0; i(font->get_string_width(text)*font_size); - rgeom.h = static_cast((font->get_ascent()-font->get_descent())*font_size); + rgeom.w = static_cast(font.get_string_width(text)*font_size); + rgeom.h = static_cast((font.get_ascent()-font.get_descent())*font_size); part.get_alignment().apply(rgeom, cgeom, part.get_margin()); GL::push_matrix(); GL::translate(rgeom.x, rgeom.y, 0); GL::scale_uniform(font_size); - font->draw_string(text); + font.draw_string(text); GL::pop_matrix(); cgeom.x += cgeom.w;