From 06ebe04471448f69d3eaa24f6acdf958ff42b761 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Fri, 19 Sep 2008 18:03:15 +0000 Subject: [PATCH] by default, try square arrangement, not 1 row as before --- src/dialogs/tiledialog.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp index e1287f051..99919d127 100644 --- a/src/dialogs/tiledialog.cpp +++ b/src/dialogs/tiledialog.cpp @@ -569,7 +569,7 @@ void TileDialog::updateSelection() const GSList *items = selection->itemList(); int selcount = g_slist_length((GSList *)items); - if (NoOfColsSpinner.get_value()>1){ + if (NoOfColsSpinner.get_value()>1 && NoOfRowsSpinner.get_value()>1){ // Update the number of rows assuming number of columns wanted remains same. double NoOfRows = ceil(selcount / NoOfColsSpinner.get_value()); NoOfRowsSpinner.set_value(NoOfRows); @@ -581,8 +581,11 @@ void TileDialog::updateSelection() prefs_set_double_attribute ("dialogs.gridtiler", "NoOfCols", NoOfCols); } } else { - NoOfColsSpinner.set_value(selcount); - prefs_set_double_attribute ("dialogs.gridtiler", "NoOfCols", selcount); + double PerRow = ceil(sqrt(selcount)); + double PerCol = ceil(sqrt(selcount)); + NoOfRowsSpinner.set_value(PerRow); + NoOfColsSpinner.set_value(PerCol); + prefs_set_double_attribute ("dialogs.gridtiler", "NoOfCols", PerCol); } @@ -643,8 +646,8 @@ TileDialog::TileDialog() /*#### Number of Rows ####*/ - double PerRow = selcount; - double PerCol = 1; + double PerRow = ceil(sqrt(selcount)); + double PerCol = ceil(sqrt(selcount)); #ifdef DEBUG_GRID_ARRANGE g_print("/n PerRox = %f PerCol = %f selcount = %d",PerRow,PerCol,selcount); -- 2.30.2