[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/kexi/formeditor
From: Jarosław Staniek <staniek () kde ! org>
Date: 2009-10-23 23:03:32
Message-ID: 1256339012.103519.16683.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1039610 by staniek:
Forms
* improve align-to-grid (no it is aligning to the closest grid); this especially \
fixes setting default widget sizes
M +8 -2 commands.cpp
M +3 -1 utils.cpp
--- trunk/koffice/kexi/formeditor/commands.cpp #1039609:1039610
@@ -992,8 +992,14 @@
// fix widget size is align-to-grid is enabled
if (d->form->isSnapWidgetsToGridEnabled()) {
const int grid = d->form->gridSize();
- d->insertRect.setWidth( alignValueToGrid(d->insertRect.width(), grid) );
- d->insertRect.setHeight( alignValueToGrid(d->insertRect.height(), grid) );
+ int v = alignValueToGrid(d->insertRect.width(), grid);
+ if (v < d->insertRect.width()) // do not allow to make the widget smaller
+ v += grid;
+ d->insertRect.setWidth( v );
+ v = alignValueToGrid(d->insertRect.height(), grid);
+ if (v < d->insertRect.height()) // do not allow to make the widget smaller
+ v += grid;
+ d->insertRect.setHeight( v );
}
w->move(d->insertRect.x(), d->insertRect.y());
--- trunk/koffice/kexi/formeditor/utils.cpp #1039609:1039610
@@ -322,7 +322,9 @@
int KFormDesigner::alignValueToGrid(int value, int gridSize)
{
- return value / gridSize * gridSize;
+ if ((value % gridSize * 2) < gridSize)
+ return value / gridSize * gridSize;
+ return (value / gridSize + 1) * gridSize;
}
//-----------------------------
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic