diff --git a/src/cell.c b/src/cell.c index 815ef4d..b1fadbf 100644 --- a/src/cell.c +++ b/src/cell.c @@ -39,12 +39,18 @@ void destroy_cell(fort_cell_t *cell) int hint_width_cell(const fort_cell_t *cell, const context_t *context) { + /* todo: + * At the moment min width includes paddings. Maybe it is better that min width weren't include + * paddings but be min width of the cell content without padding + */ + assert(cell); assert(context); int result = context->table_options->cell_padding_left + context->table_options->cell_padding_right; if (cell->str_buffer && cell->str_buffer->str) { result += buffer_text_width(cell->str_buffer); } + result = MAX(result, get_cell_opt_value_hierarcial(context->table_options, context->row, context->column, FT_OPT_MIN_WIDTH)); return result; } diff --git a/src/options.c b/src/options.c index 3737d81..2d5f789 100644 --- a/src/options.c +++ b/src/options.c @@ -304,19 +304,28 @@ void destroy_table_options(fort_table_options_t* options) // return ((fort_column_options_t*)vector_at(options->col_options, column))->col_min_width; //} -int fort_options_column_width(const fort_table_options_t *options, size_t column) -{ - assert(options); - if (options->cell_options == NULL) - return -1; - const fort_cell_options_t* col_opt = cget_cell_opt(options->cell_options, FT_ANY_ROW, column); - if (col_opt == NULL || ((col_opt->options & FT_OPT_MIN_WIDTH) == 0)) - return -1; - else { - return col_opt->col_min_width; - } -} + + +//int fort_options_column_width(const fort_table_options_t *options, size_t column) +//{ +// assert(options); +// if (options->cell_options == NULL) +// return -1; + +// const fort_cell_options_t* col_opt = cget_cell_opt(options->cell_options, FT_ANY_ROW, column); +// if (col_opt == NULL || ((col_opt->options & FT_OPT_MIN_WIDTH) == 0)) +// return -1; +// else { +// return col_opt->col_min_width; +// } +//} + + + + + + //int fort_options_column_alignment(const fort_table_options_t *options, size_t column) //{ diff --git a/src/options.h b/src/options.h index f11f0b9..f4f78f4 100644 --- a/src/options.h +++ b/src/options.h @@ -151,7 +151,7 @@ fort_table_options_t* copy_table_options(const fort_table_options_t *option); void destroy_table_options(fort_table_options_t* options); //fort_status_t fort_options_set_column_min_width(fort_table_options_t *options, size_t column, size_t width); //fort_status_t fort_options_set_column_alignment(fort_table_options_t *options, size_t column, enum TextAlignment al); -int fort_options_column_width(const fort_table_options_t *options, size_t column); +//int fort_options_column_width(const fort_table_options_t *options, size_t column); //int fort_options_column_alignment(const fort_table_options_t *options, size_t column); diff --git a/src/table.c b/src/table.c index f4a25a1..1d80fb4 100644 --- a/src/table.c +++ b/src/table.c @@ -132,11 +132,11 @@ fort_status_t table_rows_and_cols_geometry(const FTABLE *table, * At the moment min width includes paddings. Maybe it is better that min width weren't include * paddings but be min width of the cell content without padding */ - if (table->options) { - for (size_t i = 0; i < cols; ++i) { - col_width_arr[i] = MAX((int)col_width_arr[i], fort_options_column_width(table->options, i)); - } - } +// if (table->options) { +// for (size_t i = 0; i < cols; ++i) { +// col_width_arr[i] = MAX((int)col_width_arr[i], fort_options_column_width(table->options, i)); +// } +// } *col_width_arr_p = col_width_arr; *col_width_arr_sz = cols;