summaryrefslogtreecommitdiff
path: root/src/gui/widgets/guitable.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-14 02:54:44 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-14 02:54:44 +0300
commit84499779fcf0c8b5392a88f1c9311775e692ebef (patch)
treef390326a50eed73d8f8c62107979a4d81093ce52 /src/gui/widgets/guitable.cpp
parent4ee30f47b491de0ace9b692072fd286cf12c7828 (diff)
downloadmv-84499779fcf0c8b5392a88f1c9311775e692ebef.tar.gz
mv-84499779fcf0c8b5392a88f1c9311775e692ebef.tar.bz2
mv-84499779fcf0c8b5392a88f1c9311775e692ebef.tar.xz
mv-84499779fcf0c8b5392a88f1c9311775e692ebef.zip
Improve a bit some gui controls speed.
Diffstat (limited to 'src/gui/widgets/guitable.cpp')
-rw-r--r--src/gui/widgets/guitable.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 088b72db3..4cd6d03cf 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -236,15 +236,16 @@ void GuiTable::setSelectedColumn(int selected)
}
else
{
- if ((selected >= mModel->getColumns() && mWrappingEnabled) ||
+ const int columns = mModel->getColumns();
+ if ((selected >= columns && mWrappingEnabled) ||
(selected < 0 && !mWrappingEnabled))
{
mSelectedColumn = 0;
}
- else if ((selected >= mModel->getColumns() && !mWrappingEnabled) ||
+ else if ((selected >= columns && !mWrappingEnabled) ||
(selected < 0 && mWrappingEnabled))
{
- mSelectedColumn = mModel->getColumns() - 1;
+ mSelectedColumn = columns - 1;
}
else
{
@@ -345,11 +346,11 @@ void GuiTable::draw(gcn::Graphics* graphics)
widget->setDimension(bounds);
- mHighlightColor.a = static_cast<int>(mAlpha * 255.0f);
- graphics->setColor(mHighlightColor);
-
if (mSelectedRow > 0)
{
+ mHighlightColor.a = static_cast<int>(mAlpha * 255.0f);
+ graphics->setColor(mHighlightColor);
+
if (mLinewiseMode && r == static_cast<unsigned>(
mSelectedRow) && c == 0)
{
@@ -477,7 +478,6 @@ void GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent)
{
setSelectedRow(getSelectedRow() - 1);
}
-
mouseEvent.consume();
}
}
@@ -487,7 +487,6 @@ void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
if (isFocused())
{
setSelectedRow(getSelectedRow() + 1);
-
mouseEvent.consume();
}
}
@@ -561,14 +560,15 @@ int GuiTable::getColumnForX(int x) const
int column;
int delta = 0;
- for (column = 0; column < mModel->getColumns(); column++)
+ const int colnum = mModel->getColumns();
+ for (column = 0; column < colnum; column ++)
{
delta += getColumnWidth(column);
if (x <= delta)
break;
}
- if (column < 0 || column >= mModel->getColumns())
+ if (column < 0 || column >= colnum)
return -1;
else
return column;