aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Kennedy2008-08-18 15:13:55 +0000
committerStephen Kennedy2008-08-18 15:13:55 +0000
commit12d649f0113befdb7098962eabb7dd70e194a88b (patch)
tree0b37b8ada9896a2abf08ad96673c99d85edb08cd
parent68e45aab3afbe9fa811529e5b79b83fc9079ecf6 (diff)
downloadscummvm-rg350-12d649f0113befdb7098962eabb7dd70e194a88b.tar.gz
scummvm-rg350-12d649f0113befdb7098962eabb7dd70e194a88b.tar.bz2
scummvm-rg350-12d649f0113befdb7098962eabb7dd70e194a88b.zip
remap dialog updates
svn-id: r33990
-rw-r--r--backends/keymapper/remap-dialog.cpp23
-rw-r--r--gui/theme-config.cpp10
2 files changed, 17 insertions, 16 deletions
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index 2becfe3f59..1998fa813e 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -118,9 +118,6 @@ void RemapDialog::close() {
}
void RemapDialog::reflowLayout() {
- int labelWidth = g_gui.evaluator()->getVar("remap_popup_labelW");
- _kmPopUp->changeLabelWidth(labelWidth);
-
int scrollbarWidth, buttonHeight;
if (g_gui.getWidgetSize() == GUI::kBigWidgetSize) {
buttonHeight = GUI::kBigButtonHeight;
@@ -134,13 +131,15 @@ void RemapDialog::reflowLayout() {
int areaW = g_gui.evaluator()->getVar("remap_keymap_area.w");
int areaH = g_gui.evaluator()->getVar("remap_keymap_area.h");
int spacing = g_gui.evaluator()->getVar("remap_spacing");
- _colCount = g_gui.evaluator()->getVar("remap_col_count");
- if (_colCount <= 0)
- error("remap_col_count must be >= 0");
+ int labelWidth = g_gui.evaluator()->getVar("remap_label_width");
+ int buttonWidth = g_gui.evaluator()->getVar("remap_button_width");
+ int colWidth = labelWidth + buttonWidth + spacing;
+ _colCount = (areaW - scrollbarWidth) / colWidth;
_rowCount = (areaH + spacing) / (buttonHeight + spacing);
- if (_rowCount <= 0)
+ if (_colCount <= 0 || _rowCount <= 0)
error("Remap dialog too small to display any keymaps!");
- int colWidth = (areaW - scrollbarWidth - _colCount * spacing) / _colCount;
+
+ _kmPopUp->changeLabelWidth(labelWidth);
_scrollBar->resize(areaX + areaW - scrollbarWidth, areaY, scrollbarWidth, areaH);
_scrollBar->_entriesPerPage = _rowCount;
@@ -162,10 +161,10 @@ void RemapDialog::reflowLayout() {
} else {
widg = _keymapWidgets[i];
}
- uint x = areaX + (i % _colCount) * (colWidth + spacing);
+ uint x = areaX + (i % _colCount) * colWidth;
uint y = areaY + (i / _colCount) * (buttonHeight + spacing);
- widg.actionText->resize(x, y + textYOff, colWidth / 2, kLineHeight);
- widg.keyButton->resize(x + colWidth / 2, y, colWidth / 2, buttonHeight);
+ widg.actionText->resize(x, y + textYOff, labelWidth, kLineHeight);
+ widg.keyButton->resize(x + labelWidth, y, buttonWidth, buttonHeight);
}
while (oldSize > newSize) {
ActionWidgets widg = _keymapWidgets.remove_at(--oldSize);
@@ -238,6 +237,8 @@ void RemapDialog::handleTickle() {
void RemapDialog::loadKeymap() {
_currentActions.clear();
if (_activeKeymaps->size() > 0 && _kmPopUp->getSelected() == 0) {
+ // load active keymaps
+
List<const HardwareKey*> freeKeys (_keymapper->getHardwareKeySet()->getHardwareKeys());
// add most active keymap's keys
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp
index 9d417c9c2e..acb5660db8 100644
--- a/gui/theme-config.cpp
+++ b/gui/theme-config.cpp
@@ -374,13 +374,13 @@ const char *Theme::_defaultConfigINI =
"scummsaveload_extinfo.visible=true\n"
"\n"
"# Keymapper remap dialog\n"
-"remap=(w / 4) (h / 4) (w / 2) (h / 2)\n"
+"remap=(10) (10) (w - 20) (h - 20)\n"
"remap_spacing=10\n"
-"remap_popup=remap_spacing remap_spacing (prev.w - remap_spacing * 2) (kLineHeight + 2)\n"
-"remap_popup_labelW=kButtonWidth\n"
-"remap_col_count=2\n"
+"remap_popup=remap_spacing remap_spacing (remap.w - remap_spacing * 2) (kLineHeight + 2)\n"
"remap_keymap_area=remap_spacing (remap_popup.y + remap_popup.h + remap_spacing) (remap.w - remap_spacing * 2) (remap.h - self.y - remap_spacing * 2 - kBigButtonHeight)\n"
-"remap_close_button=((remap.w - kButtonWidth) / 2) (prev.y + prev.h + remap_spacing) kButtonWidth kBigButtonHeight\n"
+"remap_label_width=100\n"
+"remap_button_width=80\n"
+"remap_close_button=((remap.w - kButtonWidth) / 2) (remap_keymap_area.y + remap_keymap_area.h + remap_spacing) kButtonWidth kBigButtonHeight\n"
"############################################\n"
"[chooser]\n"
"chooserW=(w - 2 * 8)\n"