From 12d649f0113befdb7098962eabb7dd70e194a88b Mon Sep 17 00:00:00 2001 From: Stephen Kennedy Date: Mon, 18 Aug 2008 15:13:55 +0000 Subject: remap dialog updates svn-id: r33990 --- backends/keymapper/remap-dialog.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'backends/keymapper') 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 freeKeys (_keymapper->getHardwareKeySet()->getHardwareKeys()); // add most active keymap's keys -- cgit v1.2.3