[Scummvm-cvs-logs] scummvm master -> b89bc000d96fce9d4e977b8ad59391282e35704e
tsoliman
tarek at bashasoliman.com
Fri Dec 30 23:06:01 CET 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
16d529cdc3 KEYMAPPER: Use single column in remap dialog
b89bc000d9 KEYMAPPER: Remap dialog shows buttons before labels
Commit: 16d529cdc335feea858fde690fc1b3eae48449a2
https://github.com/scummvm/scummvm/commit/16d529cdc335feea858fde690fc1b3eae48449a2
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2011-12-30T13:52:40-08:00
Commit Message:
KEYMAPPER: Use single column in remap dialog
This is to allow for long labels like in the eob keymap
Changed paths:
backends/keymapper/remap-dialog.cpp
backends/keymapper/remap-dialog.h
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index 93b8725..2039acf 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 25e336c..1cb930b 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;
Commit: b89bc000d96fce9d4e977b8ad59391282e35704e
https://github.com/scummvm/scummvm/commit/b89bc000d96fce9d4e977b8ad59391282e35704e
Author: Tarek Soliman (tsoliman at scummvm.org)
Date: 2011-12-30T13:52:40-08:00
Commit Message:
KEYMAPPER: Remap dialog shows buttons before labels
Changed paths:
backends/keymapper/remap-dialog.cpp
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index 2039acf..c0654fc 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -170,7 +170,7 @@ void RemapDialog::reflowLayout() {
if (i >= _keymapWidgets.size()) {
widg.actionText =
- new GUI::StaticTextWidget(this, 0, 0, 0, 0, "", Graphics::kTextAlignRight);
+ new GUI::StaticTextWidget(this, 0, 0, 0, 0, "", Graphics::kTextAlignLeft);
widg.keyButton =
new GUI::ButtonWidget(this, 0, 0, 0, 0, "", 0, kRemapCmd + i);
widg.clearButton = addClearButton(this, "", kClearCmd + i, 0, 0, clearButtonWidth, clearButtonHeight);
@@ -182,9 +182,10 @@ void RemapDialog::reflowLayout() {
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);
- widg.clearButton->resize(x + labelWidth + keyButtonWidth + spacing, y + clearButtonYOff, clearButtonWidth, clearButtonHeight);
+ widg.keyButton->resize(x, y, keyButtonWidth, buttonHeight);
+ widg.clearButton->resize(x + keyButtonWidth + spacing, y + clearButtonYOff, clearButtonWidth, clearButtonHeight);
+ widg.actionText->resize(x + keyButtonWidth + spacing + clearButtonWidth + spacing, y + textYOff, labelWidth, kLineHeight);
+
}
while (oldSize > newSize) {
ActionWidgets widg = _keymapWidgets.remove_at(--oldSize);
@@ -391,7 +392,7 @@ void RemapDialog::refreshKeymap() {
debug(8, "RemapDialog::refreshKeymap actionI=%u", actionI);
ActionInfo& info = _currentActions[actionI];
- widg.actionText->setLabel(info.description + ": ");
+ widg.actionText->setLabel(info.description);
widg.actionText->setEnabled(!info.inherited);
const HardwareKey *mappedKey = info.action->getMappedKey();
More information about the Scummvm-git-logs
mailing list