New Keyboard Shortcuts dialog layout (fix #777)

This commit is contained in:
David Capello 2015-08-25 13:59:15 -03:00
parent 746f41ff5b
commit 19951c6dd5
2 changed files with 20 additions and 19 deletions

View File

@ -1,13 +1,22 @@
<!-- Aseprite --> <!-- Aseprite -->
<!-- Copyright (C) 2001-2014 by David Capello --> <!-- Copyright (C) 2001-2015 by David Capello -->
<gui> <gui>
<window id="keyboard_shortcuts" text="Keyboard Shortcuts"> <window id="keyboard_shortcuts" text="Keyboard Shortcuts">
<hbox> <hbox>
<vbox>
<view expansive="true" width="80">
<listbox id="section" expansive="true" />
</view>
<separator horizontal="true" />
<button text="&amp;OK" closewindow="true" id="ok" magnet="true" width="60" />
<button text="&amp;Cancel" closewindow="true" />
<separator horizontal="true" />
<button text="&amp;Import" id="import_button" />
<button text="&amp;Export" id="export_button" />
<separator horizontal="true" />
<button text="&amp;Reset" id="reset_button" />
</vbox>
<vbox expansive="true"> <vbox expansive="true">
<hbox>
<label text="Section:" />
<combobox id="section" expansive="true" />
</hbox>
<view id="menus_view" expansive="true"> <view id="menus_view" expansive="true">
<listbox id="menus" /> <listbox id="menus" />
</view> </view>
@ -21,15 +30,6 @@
<listbox id="actions" /> <listbox id="actions" />
</view> </view>
</vbox> </vbox>
<vbox>
<button text="&amp;OK" closewindow="true" id="ok" magnet="true" width="60" />
<button text="&amp;Cancel" closewindow="true" />
<separator horizontal="true" />
<button text="&amp;Import" id="import_button" />
<button text="&amp;Export" id="export_button" />
<separator horizontal="true" />
<button text="&amp;Reset" id="reset_button" />
</vbox>
</hbox> </hbox>
</window> </window>
</gui> </gui>

View File

@ -283,10 +283,10 @@ public:
KeyboardShortcutsWindow() { KeyboardShortcutsWindow() {
setAutoRemap(false); setAutoRemap(false);
section()->addItem("Menus"); section()->addChild(new ListItem("Menus"));
section()->addItem("Commands"); section()->addChild(new ListItem("Commands"));
section()->addItem("Tools"); section()->addChild(new ListItem("Tools"));
section()->addItem("Action Modifiers"); section()->addChild(new ListItem("Action Modifiers"));
section()->Change.connect(Bind<void>(&KeyboardShortcutsWindow::onSectionChange, this)); section()->Change.connect(Bind<void>(&KeyboardShortcutsWindow::onSectionChange, this));
importButton()->Click.connect(Bind<void>(&KeyboardShortcutsWindow::onImport, this)); importButton()->Click.connect(Bind<void>(&KeyboardShortcutsWindow::onImport, this));
@ -365,11 +365,12 @@ private:
this->tools()->sortItems(); this->tools()->sortItems();
this->actions()->sortItems(); this->actions()->sortItems();
section()->selectIndex(0);
onSectionChange(); onSectionChange();
} }
void onSectionChange() { void onSectionChange() {
int section = this->section()->getSelectedItemIndex(); int section = this->section()->getSelectedIndex();
menusView()->setVisible(section == 0); menusView()->setVisible(section == 0);
commandsView()->setVisible(section == 1); commandsView()->setVisible(section == 1);