Improved hotkeys manager, and tweaked style manager.
Originally committed to SVN as r1617.
This commit is contained in:
parent
c4347d9e8a
commit
045583c190
3 changed files with 80 additions and 24 deletions
|
@ -69,7 +69,10 @@
|
||||||
// IDs
|
// IDs
|
||||||
enum {
|
enum {
|
||||||
BUTTON_DEFAULTS = 2500,
|
BUTTON_DEFAULTS = 2500,
|
||||||
HOTKEY_LIST
|
HOTKEY_LIST,
|
||||||
|
BUTTON_HOTKEY_SET,
|
||||||
|
BUTTON_HOTKEY_CLEAR,
|
||||||
|
BUTTON_HOTKEY_DEFAULT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -576,9 +579,6 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
||||||
hotkeysModified = false;
|
hotkeysModified = false;
|
||||||
origKeys = Hotkeys.key;
|
origKeys = Hotkeys.key;
|
||||||
|
|
||||||
// Description
|
|
||||||
wxStaticText *text = new wxStaticText(hotkeysPage,-1,_("List of all hotkeys (shortcuts) available in Aegisub.\nDouble click on any item to reassign it."),wxDefaultPosition,wxSize(150,-1));
|
|
||||||
|
|
||||||
// List of shortcuts
|
// List of shortcuts
|
||||||
Shortcuts = new wxListView(hotkeysPage,HOTKEY_LIST,wxDefaultPosition,wxSize(250,150),wxLC_REPORT | wxLC_SINGLE_SEL);
|
Shortcuts = new wxListView(hotkeysPage,HOTKEY_LIST,wxDefaultPosition,wxSize(250,150),wxLC_REPORT | wxLC_SINGLE_SEL);
|
||||||
Shortcuts->InsertColumn(0,_("Function"),wxLIST_FORMAT_LEFT,200);
|
Shortcuts->InsertColumn(0,_("Function"),wxLIST_FORMAT_LEFT,200);
|
||||||
|
@ -594,10 +594,16 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
||||||
Shortcuts->SetItem(pos,1,cur->second.GetText());
|
Shortcuts->SetItem(pos,1,cur->second.GetText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create buttons
|
||||||
|
wxSizer *buttons = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
buttons->Add(new wxButton(hotkeysPage,BUTTON_HOTKEY_SET,_("Set Hotkey...")),1,wxEXPAND|wxRIGHT,5);
|
||||||
|
buttons->Add(new wxButton(hotkeysPage,BUTTON_HOTKEY_CLEAR,_("Clear Hotkey")),1,wxEXPAND|wxRIGHT,5);
|
||||||
|
buttons->Add(new wxButton(hotkeysPage,BUTTON_HOTKEY_DEFAULT,_("Default")),1,wxEXPAND|wxRIGHT,0);
|
||||||
|
|
||||||
// Main sizer
|
// Main sizer
|
||||||
wxSizer *hotkeysSizer = new wxBoxSizer(wxVERTICAL);
|
wxSizer *hotkeysSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
hotkeysSizer->Add(text,0,wxALL|wxEXPAND,5);
|
|
||||||
hotkeysSizer->Add(Shortcuts,1,wxLEFT|wxRIGHT|wxTOP|wxEXPAND,5);
|
hotkeysSizer->Add(Shortcuts,1,wxLEFT|wxRIGHT|wxTOP|wxEXPAND,5);
|
||||||
|
hotkeysSizer->Add(buttons,0,wxALL|wxEXPAND,5);
|
||||||
hotkeysSizer->Fit(hotkeysPage);
|
hotkeysSizer->Fit(hotkeysPage);
|
||||||
hotkeysPage->SetSizer(hotkeysSizer);
|
hotkeysPage->SetSizer(hotkeysSizer);
|
||||||
}
|
}
|
||||||
|
@ -695,7 +701,9 @@ BEGIN_EVENT_TABLE(DialogOptions,wxDialog)
|
||||||
EVT_BUTTON(wxID_CANCEL,DialogOptions::OnCancel)
|
EVT_BUTTON(wxID_CANCEL,DialogOptions::OnCancel)
|
||||||
EVT_BUTTON(wxID_APPLY,DialogOptions::OnApply)
|
EVT_BUTTON(wxID_APPLY,DialogOptions::OnApply)
|
||||||
EVT_BUTTON(BUTTON_DEFAULTS,DialogOptions::OnDefaults)
|
EVT_BUTTON(BUTTON_DEFAULTS,DialogOptions::OnDefaults)
|
||||||
EVT_LIST_ITEM_ACTIVATED (HOTKEY_LIST,DialogOptions::OnEditHotkey)
|
EVT_BUTTON(BUTTON_HOTKEY_SET,DialogOptions::OnEditHotkey)
|
||||||
|
EVT_BUTTON(BUTTON_HOTKEY_CLEAR,DialogOptions::OnClearHotkey)
|
||||||
|
EVT_BUTTON(BUTTON_HOTKEY_DEFAULT,DialogOptions::OnDefaultHotkey)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@ -984,24 +992,70 @@ void DialogOptions::ReadFromOptions() {
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
// Edit a hotkey
|
// Edit a hotkey
|
||||||
void DialogOptions::OnEditHotkey(wxListEvent &event) {
|
void DialogOptions::OnEditHotkey(wxCommandEvent &event) {
|
||||||
|
// Get selection
|
||||||
|
int sel = Shortcuts->GetFirstSelected();
|
||||||
|
if (sel == wxNOT_FOUND) return;
|
||||||
|
|
||||||
// Get key and store old
|
// Get key and store old
|
||||||
HotkeyType *curKey = (HotkeyType *)event.GetData();
|
HotkeyType *curKey = (HotkeyType *) Shortcuts->GetItemData(sel);
|
||||||
int oldKeycode = curKey->keycode;
|
int oldKeycode = curKey->keycode;
|
||||||
int oldFlags = curKey->flags;
|
int oldFlags = curKey->flags;
|
||||||
|
|
||||||
// Open dialog
|
// Open dialog
|
||||||
DialogInputHotkey input(curKey,event.GetText());
|
DialogInputHotkey input(curKey,Shortcuts->GetItemText(sel));
|
||||||
input.ShowModal();
|
input.ShowModal();
|
||||||
|
|
||||||
// Update stuff if it changed
|
// Update stuff if it changed
|
||||||
if (oldKeycode != curKey->keycode || oldFlags != curKey->flags) {
|
if (oldKeycode != curKey->keycode || oldFlags != curKey->flags) {
|
||||||
Shortcuts->SetItem(event.GetIndex(),1,curKey->GetText());
|
Shortcuts->SetItem(sel,1,curKey->GetText());
|
||||||
hotkeysModified = true;
|
hotkeysModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////
|
||||||
|
// Clear a hotkey
|
||||||
|
void DialogOptions::OnClearHotkey(wxCommandEvent &event) {
|
||||||
|
for (int item=-1;true;) {
|
||||||
|
item = Shortcuts->GetNextItem(item,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED);
|
||||||
|
if (item == -1) break;
|
||||||
|
|
||||||
|
HotkeyType *curKey = (HotkeyType *) Shortcuts->GetItemData(item);
|
||||||
|
if (curKey->keycode != 0 || curKey->flags != 0) {
|
||||||
|
hotkeysModified = true;
|
||||||
|
curKey->keycode = 0;
|
||||||
|
curKey->flags = 0;
|
||||||
|
Shortcuts->SetItem(item,1,curKey->GetText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////
|
||||||
|
// Reset hotkey to default
|
||||||
|
void DialogOptions::OnDefaultHotkey(wxCommandEvent &event) {
|
||||||
|
// Load defaults
|
||||||
|
HotkeyManager defs;
|
||||||
|
defs.LoadDefaults();
|
||||||
|
|
||||||
|
// Replace
|
||||||
|
for (int item=-1;true;) {
|
||||||
|
item = Shortcuts->GetNextItem(item,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED);
|
||||||
|
if (item == -1) break;
|
||||||
|
|
||||||
|
HotkeyType *curKey = (HotkeyType *) Shortcuts->GetItemData(item);
|
||||||
|
HotkeyType *origKey = &defs.key[curKey->origName.Lower()];
|
||||||
|
if (origKey->keycode != curKey->keycode || origKey->flags != curKey->flags) {
|
||||||
|
hotkeysModified = true;
|
||||||
|
curKey->keycode = origKey->keycode;
|
||||||
|
curKey->flags = origKey->flags;
|
||||||
|
Shortcuts->SetItem(item,1,curKey->GetText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// Input constructor
|
// Input constructor
|
||||||
DialogInputHotkey::DialogInputHotkey(HotkeyType *_key,wxString name)
|
DialogInputHotkey::DialogInputHotkey(HotkeyType *_key,wxString name)
|
||||||
|
|
|
@ -80,7 +80,6 @@ enum TextType {
|
||||||
TEXT_TYPE_FONT
|
TEXT_TYPE_FONT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
// Options screen class
|
// Options screen class
|
||||||
class DialogOptions: public wxDialog {
|
class DialogOptions: public wxDialog {
|
||||||
|
@ -107,7 +106,10 @@ private:
|
||||||
void OnCancel(wxCommandEvent &event);
|
void OnCancel(wxCommandEvent &event);
|
||||||
void OnApply(wxCommandEvent &event);
|
void OnApply(wxCommandEvent &event);
|
||||||
void OnDefaults(wxCommandEvent &event);
|
void OnDefaults(wxCommandEvent &event);
|
||||||
void OnEditHotkey(wxListEvent &event);
|
|
||||||
|
void OnEditHotkey(wxCommandEvent &event);
|
||||||
|
void OnClearHotkey(wxCommandEvent &event);
|
||||||
|
void OnDefaultHotkey(wxCommandEvent &event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogOptions(wxWindow *parent);
|
DialogOptions(wxWindow *parent);
|
||||||
|
|
|
@ -67,9 +67,9 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
|
|
||||||
// Catalog
|
// Catalog
|
||||||
wxSizer *CatalogBox = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Catalog of available storages"));
|
wxSizer *CatalogBox = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Catalog of available storages"));
|
||||||
CatalogList = new wxComboBox(this,LIST_CATALOG, _T(""), wxDefaultPosition, wxSize(180,20), 0, NULL, wxCB_READONLY | wxCB_READONLY, wxDefaultValidator, _T("Catalog List"));
|
CatalogList = new wxComboBox(this,LIST_CATALOG, _T(""), wxDefaultPosition, wxSize(-1,-1), 0, NULL, wxCB_READONLY | wxCB_READONLY, wxDefaultValidator, _T("Catalog List"));
|
||||||
wxButton *CatalogNew = new wxButton(this, BUTTON_CATALOG_NEW, _("New"), wxDefaultPosition, wxSize(60,20));
|
wxButton *CatalogNew = new wxButton(this, BUTTON_CATALOG_NEW, _("New"), wxDefaultPosition, wxSize(-1,-1));
|
||||||
wxButton *CatalogDelete = new wxButton(this, BUTTON_CATALOG_DELETE, _("Delete"), wxDefaultPosition, wxSize(60,20));
|
wxButton *CatalogDelete = new wxButton(this, BUTTON_CATALOG_DELETE, _("Delete"), wxDefaultPosition, wxSize(-1,-1));
|
||||||
CatalogBox->Add(CatalogList,1,wxEXPAND | wxRIGHT | wxALIGN_RIGHT,5);
|
CatalogBox->Add(CatalogList,1,wxEXPAND | wxRIGHT | wxALIGN_RIGHT,5);
|
||||||
CatalogBox->Add(CatalogNew,0,wxRIGHT,5);
|
CatalogBox->Add(CatalogNew,0,wxRIGHT,5);
|
||||||
CatalogBox->Add(CatalogDelete,0,0,0);
|
CatalogBox->Add(CatalogDelete,0,0,0);
|
||||||
|
@ -80,11 +80,11 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
wxSizer *StorageButtons = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *StorageButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||||
wxSizer *StorageButtonsLow = new wxBoxSizer(wxVERTICAL);
|
wxSizer *StorageButtonsLow = new wxBoxSizer(wxVERTICAL);
|
||||||
wxSizer *StorageListSizer = new wxBoxSizer(wxHORIZONTAL);
|
wxSizer *StorageListSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
MoveToLocal = new wxButton(this, BUTTON_STORAGE_COPYTO, _("Copy to current script ->"), wxDefaultPosition, wxSize(205,25));
|
MoveToLocal = new wxButton(this, BUTTON_STORAGE_COPYTO, _("Copy to current script ->"), wxDefaultPosition, wxSize(205,-1));
|
||||||
StorageNew = new wxButton(this, BUTTON_STORAGE_NEW, _("New"), wxDefaultPosition, wxSize(40,25));
|
StorageNew = new wxButton(this, BUTTON_STORAGE_NEW, _("New"), wxDefaultPosition, wxSize(40,-1));
|
||||||
StorageEdit = new wxButton(this, BUTTON_STORAGE_EDIT, _("Edit"), wxDefaultPosition, wxSize(40,25));
|
StorageEdit = new wxButton(this, BUTTON_STORAGE_EDIT, _("Edit"), wxDefaultPosition, wxSize(40,-1));
|
||||||
StorageCopy = new wxButton(this, BUTTON_STORAGE_COPY, _("Copy"), wxDefaultPosition, wxSize(40,25));
|
StorageCopy = new wxButton(this, BUTTON_STORAGE_COPY, _("Copy"), wxDefaultPosition, wxSize(40,-1));
|
||||||
StorageDelete = new wxButton(this, BUTTON_STORAGE_DELETE, _("Delete"), wxDefaultPosition, wxSize(40,25));
|
StorageDelete = new wxButton(this, BUTTON_STORAGE_DELETE, _("Delete"), wxDefaultPosition, wxSize(40,-1));
|
||||||
StorageButtons->Add(StorageNew,1,wxEXPAND | wxRIGHT,5);
|
StorageButtons->Add(StorageNew,1,wxEXPAND | wxRIGHT,5);
|
||||||
StorageButtons->Add(StorageEdit,1,wxEXPAND | wxRIGHT,5);
|
StorageButtons->Add(StorageEdit,1,wxEXPAND | wxRIGHT,5);
|
||||||
StorageButtons->Add(StorageCopy,1,wxEXPAND | wxRIGHT,5);
|
StorageButtons->Add(StorageCopy,1,wxEXPAND | wxRIGHT,5);
|
||||||
|
@ -126,10 +126,10 @@ DialogStyleManager::DialogStyleManager (wxWindow *parent,SubtitlesGrid *_grid)
|
||||||
MoveToStorage = new wxButton(this, BUTTON_CURRENT_COPYTO, _("<- Copy to storage"), wxDefaultPosition, wxSize(-1,25));
|
MoveToStorage = new wxButton(this, BUTTON_CURRENT_COPYTO, _("<- Copy to storage"), wxDefaultPosition, wxSize(-1,25));
|
||||||
MoveImportSizer->Add(MoveToStorage,1,wxEXPAND | wxRIGHT,5);
|
MoveImportSizer->Add(MoveToStorage,1,wxEXPAND | wxRIGHT,5);
|
||||||
MoveImportSizer->Add(new wxButton(this, BUTTON_CURRENT_IMPORT, _("Import from script...")),1,wxEXPAND,0);
|
MoveImportSizer->Add(new wxButton(this, BUTTON_CURRENT_IMPORT, _("Import from script...")),1,wxEXPAND,0);
|
||||||
CurrentNew = new wxButton(this, BUTTON_CURRENT_NEW, _("New"), wxDefaultPosition, wxSize(40,25));
|
CurrentNew = new wxButton(this, BUTTON_CURRENT_NEW, _("New"), wxDefaultPosition, wxSize(40,-1));
|
||||||
CurrentEdit = new wxButton(this, BUTTON_CURRENT_EDIT, _("Edit"), wxDefaultPosition, wxSize(40,25));
|
CurrentEdit = new wxButton(this, BUTTON_CURRENT_EDIT, _("Edit"), wxDefaultPosition, wxSize(40,-1));
|
||||||
CurrentCopy = new wxButton(this, BUTTON_CURRENT_COPY, _("Copy"), wxDefaultPosition, wxSize(40,25));
|
CurrentCopy = new wxButton(this, BUTTON_CURRENT_COPY, _("Copy"), wxDefaultPosition, wxSize(40,-1));
|
||||||
CurrentDelete = new wxButton(this, BUTTON_CURRENT_DELETE, _("Delete"), wxDefaultPosition, wxSize(40,25));
|
CurrentDelete = new wxButton(this, BUTTON_CURRENT_DELETE, _("Delete"), wxDefaultPosition, wxSize(40,-1));
|
||||||
CurrentButtons->Add(CurrentNew,1,wxEXPAND | wxRIGHT,5);
|
CurrentButtons->Add(CurrentNew,1,wxEXPAND | wxRIGHT,5);
|
||||||
CurrentButtons->Add(CurrentEdit,1,wxEXPAND | wxRIGHT,5);
|
CurrentButtons->Add(CurrentEdit,1,wxEXPAND | wxRIGHT,5);
|
||||||
CurrentButtons->Add(CurrentCopy,1,wxEXPAND | wxRIGHT,5);
|
CurrentButtons->Add(CurrentCopy,1,wxEXPAND | wxRIGHT,5);
|
||||||
|
|
Loading…
Reference in a new issue