aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorTarek Soliman2011-12-30 15:28:46 -0600
committerTarek Soliman2011-12-30 15:52:40 -0600
commit16d529cdc335feea858fde690fc1b3eae48449a2 (patch)
treeb52b47f969e4df9a790725376635c2f0f3d7e82c /backends
parent27e38d16ee66367f7589e545c1377825a36e8891 (diff)
downloadscummvm-rg350-16d529cdc335feea858fde690fc1b3eae48449a2.tar.gz
scummvm-rg350-16d529cdc335feea858fde690fc1b3eae48449a2.tar.bz2
scummvm-rg350-16d529cdc335feea858fde690fc1b3eae48449a2.zip
KEYMAPPER: Use single column in remap dialog
This is to allow for long labels like in the eob keymap
Diffstat (limited to 'backends')
-rw-r--r--backends/keymapper/remap-dialog.cpp21
-rw-r--r--backends/keymapper/remap-dialog.h2
2 files changed, 12 insertions, 11 deletions
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index 93b8725341..2039acf245 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -138,18 +138,19 @@ void RemapDialog::reflowLayout() {
int16 areaX, areaY;
uint16 areaW, areaH;
+ g_gui.xmlEval()->getWidgetData((const String&)String("KeyMapper.KeymapArea"), areaX, areaY, areaW, areaH);
+
int spacing = g_gui.xmlEval()->getVar("Globals.KeyMapper.Spacing");
- int labelWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.LabelWidth");
int keyButtonWidth = g_gui.xmlEval()->getVar("Globals.KeyMapper.ButtonWidth");
int clearButtonWidth = g_gui.xmlEval()->getVar("Globals.Line.Height");
int clearButtonHeight = g_gui.xmlEval()->getVar("Globals.Line.Height");
- int colWidth = labelWidth + keyButtonWidth + clearButtonWidth + spacing;
- g_gui.xmlEval()->getWidgetData((const String&)String("KeyMapper.KeymapArea"), areaX, areaY, areaW, areaH);
+ int colWidth = areaW - scrollbarWidth;
+ int labelWidth = colWidth - (keyButtonWidth + spacing + clearButtonWidth + spacing);
- _colCount = (areaW - scrollbarWidth) / colWidth;
_rowCount = (areaH + spacing) / (buttonHeight + spacing);
- if (_colCount <= 0 || _rowCount <= 0)
+ debug("rowCount = %d" , _rowCount);
+ if (colWidth <= 0 || _rowCount <= 0)
error("Remap dialog too small to display any keymaps");
_scrollBar->resize(areaX + areaW - scrollbarWidth, areaY, scrollbarWidth, areaH);
@@ -160,7 +161,7 @@ void RemapDialog::reflowLayout() {
uint textYOff = (buttonHeight - kLineHeight) / 2;
uint clearButtonYOff = (buttonHeight - clearButtonHeight) / 2;
uint oldSize = _keymapWidgets.size();
- uint newSize = _rowCount * _colCount;
+ uint newSize = _rowCount;
_keymapWidgets.reserve(newSize);
@@ -178,8 +179,8 @@ void RemapDialog::reflowLayout() {
widg = _keymapWidgets[i];
}
- uint x = areaX + (i % _colCount) * colWidth;
- uint y = areaY + (i / _colCount) * (buttonHeight + spacing);
+ uint x = areaX;
+ uint y = areaY + (i) * (buttonHeight + spacing);
widg.actionText->resize(x, y + textYOff, labelWidth, kLineHeight);
widg.keyButton->resize(x + labelWidth, y, keyButtonWidth, buttonHeight);
@@ -362,7 +363,7 @@ void RemapDialog::loadKeymap() {
// refresh scroll bar
_scrollBar->_currentPos = 0;
- _scrollBar->_numEntries = (_currentActions.size() + _colCount - 1) / _colCount;
+ _scrollBar->_numEntries = _currentActions.size();
_scrollBar->recalc();
// force refresh
@@ -371,7 +372,7 @@ void RemapDialog::loadKeymap() {
}
void RemapDialog::refreshKeymap() {
- int newTopAction = _scrollBar->_currentPos * _colCount;
+ int newTopAction = _scrollBar->_currentPos;
if (newTopAction == _topAction)
return;
diff --git a/backends/keymapper/remap-dialog.h b/backends/keymapper/remap-dialog.h
index 25e336c4fe..1cb930bd42 100644
--- a/backends/keymapper/remap-dialog.h
+++ b/backends/keymapper/remap-dialog.h
@@ -82,7 +82,7 @@ protected:
//GUI::ContainerWidget *_container;
GUI::ScrollBarWidget *_scrollBar;
- uint _colCount, _rowCount;
+ uint _rowCount;
Array<ActionWidgets> _keymapWidgets;
Action *_activeRemapAction;