Merged the hotkeys dialog into the options dialog.
Originally committed to SVN as r1058.
This commit is contained in:
parent
29e529367e
commit
a891964bc2
11 changed files with 192 additions and 348 deletions
|
@ -65,7 +65,6 @@ aegisub_SOURCES = \
|
|||
dialog_export.cpp \
|
||||
dialog_fextracker.cpp \
|
||||
dialog_fonts_collector.cpp \
|
||||
dialog_hotkeys.cpp \
|
||||
dialog_jumpto.cpp \
|
||||
dialog_kanji_timer.cpp \
|
||||
dialog_options.cpp \
|
||||
|
|
|
@ -213,6 +213,7 @@ Please visit http://aegisub.net to download latest version
|
|||
- Implemented sorting of subtitles by start time. (AMZ)
|
||||
- Recovered subtitle files are now saved in their own subfolder (customizeable in config.dat). (AMZ)
|
||||
- Fixed crash with changing font properties via the subtitle edit box when there was a \fs override tag earlier in the line. (AMZ)
|
||||
- Hotkey editor was moved inside the options dialog. (AMZ)
|
||||
|
||||
|
||||
= 1.09 beta - 2006.01.16 ===========================
|
||||
|
|
|
@ -1,220 +0,0 @@
|
|||
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// AEGISUB
|
||||
//
|
||||
// Website: http://aegisub.cellosoft.com
|
||||
// Contact: mailto:zeratul@cellosoft.com
|
||||
//
|
||||
|
||||
|
||||
////////////
|
||||
// Includes
|
||||
#include "dialog_hotkeys.h"
|
||||
#include "frame_main.h"
|
||||
#include "main.h"
|
||||
|
||||
|
||||
///////////////
|
||||
// Constructor
|
||||
DialogHotkeys::DialogHotkeys(FrameMain *_parent)
|
||||
: wxDialog(NULL, -1, _("Hotkeys"), wxDefaultPosition, wxSize(300,300), wxCAPTION | wxCLOSE_BOX | wxRESIZE_BORDER, _T("Hotkeys"))
|
||||
{
|
||||
// Backup original shortcuts
|
||||
origKeys = Hotkeys.key;
|
||||
|
||||
// Set variables
|
||||
modified = false;
|
||||
parent = _parent;
|
||||
|
||||
// Description
|
||||
wxStaticText *text = new wxStaticText(this,-1,_("List of all hotkeys (shortcuts) available in Aegisub. Double click on any item to reassign it."));
|
||||
|
||||
// List of shortcuts
|
||||
Shortcuts = new wxListView(this,Hotkey_List,wxDefaultPosition,wxSize(450,380),wxLC_REPORT | wxLC_SINGLE_SEL);
|
||||
Shortcuts->InsertColumn(0,_("Function"),wxLIST_FORMAT_LEFT,245);
|
||||
Shortcuts->InsertColumn(1,_("Key"),wxLIST_FORMAT_LEFT,180);
|
||||
|
||||
// Populate list
|
||||
std::map<wxString,HotkeyType>::iterator cur;
|
||||
for (cur = Hotkeys.key.end();cur-- != Hotkeys.key.begin();) {
|
||||
wxListItem item;
|
||||
item.SetText(wxGetTranslation(cur->second.origName));
|
||||
item.SetData(&cur->second);
|
||||
int pos = Shortcuts->InsertItem(item);
|
||||
Shortcuts->SetItem(pos,1,cur->second.GetText());
|
||||
}
|
||||
|
||||
// Button sizer
|
||||
wxSizer *ButtonSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
ButtonSizer->AddStretchSpacer(1);
|
||||
#ifndef __APPLE__
|
||||
ButtonSizer->Add(new wxButton(this,wxID_OK),0,wxRIGHT|wxEXPAND,5);
|
||||
ButtonSizer->Add(new wxButton(this,wxID_CANCEL),0,wxRIGHT|wxEXPAND,0);
|
||||
#else
|
||||
ButtonSizer->Add(new wxButton(this,wxID_CANCEL),0,wxRIGHT|wxEXPAND,5);
|
||||
ButtonSizer->Add(new wxButton(this,wxID_OK),0,wxRIGHT|wxEXPAND,0);
|
||||
#endif
|
||||
|
||||
// Main sizer
|
||||
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
MainSizer->Add(text,0,wxALL|wxEXPAND,5);
|
||||
MainSizer->Add(Shortcuts,1,wxLEFT|wxRIGHT|wxTOP|wxEXPAND,5);
|
||||
MainSizer->Add(ButtonSizer,0,wxALL|wxEXPAND,5);
|
||||
MainSizer->SetSizeHints(this);
|
||||
SetSizer(MainSizer);
|
||||
CenterOnParent();
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
// Event table
|
||||
BEGIN_EVENT_TABLE(DialogHotkeys,wxDialog)
|
||||
EVT_LIST_ITEM_ACTIVATED (Hotkey_List,DialogHotkeys::OnEditItem)
|
||||
EVT_BUTTON(wxID_OK,DialogHotkeys::OnOK)
|
||||
EVT_BUTTON(wxID_CANCEL,DialogHotkeys::OnCancel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
//////////////
|
||||
// OK pressed
|
||||
void DialogHotkeys::OnOK(wxCommandEvent &event) {
|
||||
// Apply changes if modified
|
||||
if (modified) {
|
||||
// Save changes
|
||||
Hotkeys.modified = true;
|
||||
Hotkeys.Save();
|
||||
|
||||
// Rebuild menu
|
||||
parent->InitMenu();
|
||||
|
||||
// Rebuild accelerator table
|
||||
parent->SetAccelerators();
|
||||
}
|
||||
|
||||
// Close
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
|
||||
//////////////////
|
||||
// Cancel pressed
|
||||
void DialogHotkeys::OnCancel(wxCommandEvent &event) {
|
||||
// Restore if it was modified
|
||||
if (modified) Hotkeys.key = origKeys;
|
||||
|
||||
// Close
|
||||
EndModal(0);
|
||||
}
|
||||
|
||||
|
||||
/////////////////
|
||||
// Edit a hotkey
|
||||
void DialogHotkeys::OnEditItem(wxListEvent &event) {
|
||||
// Get key and store old
|
||||
HotkeyType *curKey = (HotkeyType *)event.GetData();
|
||||
int oldKeycode = curKey->keycode;
|
||||
int oldFlags = curKey->flags;
|
||||
|
||||
// Open dialog
|
||||
DialogInputHotkey input(curKey,event.GetText());
|
||||
input.ShowModal();
|
||||
|
||||
// Update stuff if it changed
|
||||
if (oldKeycode != curKey->keycode || oldFlags != curKey->flags) {
|
||||
Shortcuts->SetItem(event.GetIndex(),1,curKey->GetText());
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////
|
||||
// Input constructor
|
||||
DialogInputHotkey::DialogInputHotkey(HotkeyType *_key,wxString name)
|
||||
: wxDialog(NULL, -1, _("Press Key"), wxDefaultPosition, wxSize(200,50), wxCAPTION | wxWANTS_CHARS , _T("Press key"))
|
||||
{
|
||||
// Key
|
||||
key = _key;
|
||||
|
||||
// Text
|
||||
wxStaticText *text = new wxStaticText(this,-1,_("Press key to bind to \"") + name + _("\" or esc to cancel."));
|
||||
|
||||
// Key capturer
|
||||
capture = new CaptureKey(this);
|
||||
|
||||
// Main sizer
|
||||
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
MainSizer->Add(text,1,wxALL,5);
|
||||
MainSizer->SetSizeHints(this);
|
||||
SetSizer(MainSizer);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Capturer constructor
|
||||
CaptureKey::CaptureKey(DialogInputHotkey *_parent)
|
||||
: wxTextCtrl(_parent,-1,_T(""),wxDefaultPosition,wxSize(0,0))
|
||||
{
|
||||
parent = _parent;
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////
|
||||
// Input event table
|
||||
BEGIN_EVENT_TABLE(CaptureKey,wxTextCtrl)
|
||||
EVT_KEY_DOWN(CaptureKey::OnKeyDown)
|
||||
EVT_KILL_FOCUS(CaptureKey::OnLoseFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
///////////////
|
||||
// On key down
|
||||
void CaptureKey::OnKeyDown(wxKeyEvent &event) {
|
||||
int keycode = event.GetKeyCode();
|
||||
|
||||
if (keycode == WXK_ESCAPE) parent->EndModal(0);
|
||||
else if (keycode != WXK_SHIFT && keycode != WXK_CONTROL && keycode != WXK_ALT) {
|
||||
parent->key->keycode = keycode;
|
||||
int mod = 0;
|
||||
if (event.m_altDown) mod |= wxACCEL_ALT;
|
||||
if (event.m_controlDown) mod |= wxACCEL_CTRL;
|
||||
if (event.m_shiftDown) mod |= wxACCEL_SHIFT;
|
||||
parent->key->flags = mod;
|
||||
parent->EndModal(0);
|
||||
}
|
||||
else event.Skip();
|
||||
}
|
||||
|
||||
|
||||
//////////////
|
||||
// Keep focus
|
||||
void CaptureKey::OnLoseFocus(wxFocusEvent &event) {
|
||||
SetFocus();
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
// Copyright (c) 2005, Rodrigo Braz Monteiro
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// * Neither the name of the Aegisub Group nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
// POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// -----------------------------------------------------------------------------
|
||||
//
|
||||
// AEGISUB
|
||||
//
|
||||
// Website: http://aegisub.cellosoft.com
|
||||
// Contact: mailto:zeratul@cellosoft.com
|
||||
//
|
||||
|
||||
|
||||
#ifndef DIALOG_HOTKEYS_H
|
||||
#define DIALOG_HOTKEYS_H
|
||||
|
||||
|
||||
////////////
|
||||
// Includes
|
||||
#include <wx/wxprec.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <map>
|
||||
#include "hotkeys.h"
|
||||
|
||||
|
||||
//////////////
|
||||
// Prototypes
|
||||
class FrameMain;
|
||||
class DialogInputHotkey;
|
||||
|
||||
|
||||
/////////////////////
|
||||
// List dialog class
|
||||
class DialogHotkeys : public wxDialog {
|
||||
private:
|
||||
std::map<wxString,HotkeyType> origKeys;
|
||||
wxListView *Shortcuts;
|
||||
bool modified;
|
||||
FrameMain *parent;
|
||||
|
||||
void OnEditItem(wxListEvent &event);
|
||||
void OnOK(wxCommandEvent &event);
|
||||
void OnCancel(wxCommandEvent &event);
|
||||
|
||||
public:
|
||||
DialogHotkeys(FrameMain *parent);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
/////////////////////
|
||||
// Capture key class
|
||||
class CaptureKey : public wxTextCtrl {
|
||||
private:
|
||||
DialogInputHotkey *parent;
|
||||
void OnKeyDown(wxKeyEvent &event);
|
||||
void OnLoseFocus(wxFocusEvent &event);
|
||||
|
||||
public:
|
||||
CaptureKey(DialogInputHotkey *parent);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
//////////////////////
|
||||
// Input dialog class
|
||||
class DialogInputHotkey : public wxDialog {
|
||||
friend class CaptureKey;
|
||||
|
||||
private:
|
||||
CaptureKey *capture;
|
||||
HotkeyType *key;
|
||||
|
||||
public:
|
||||
DialogInputHotkey(HotkeyType *key,wxString name);
|
||||
};
|
||||
|
||||
|
||||
///////
|
||||
// IDs
|
||||
enum {
|
||||
Hotkey_List = 2500
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -83,6 +83,7 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
|||
wxPanel *audioPage = new wxPanel(book,-1);
|
||||
wxPanel *displayPage = new wxPanel(book,-1);
|
||||
wxPanel *autoPage = new wxPanel(book,-1);
|
||||
wxPanel *hotkeysPage = new wxPanel(book,-1);
|
||||
|
||||
// General page
|
||||
{
|
||||
|
@ -589,6 +590,38 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
|||
autoPage->SetSizer(autoMainSizer);
|
||||
}
|
||||
|
||||
// Hotkeys page
|
||||
{
|
||||
// Variables
|
||||
hotkeysModified = false;
|
||||
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
|
||||
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(1,_("Key"),wxLIST_FORMAT_LEFT,120);
|
||||
|
||||
// Populate list
|
||||
std::map<wxString,HotkeyType>::iterator cur;
|
||||
for (cur = Hotkeys.key.end();cur-- != Hotkeys.key.begin();) {
|
||||
wxListItem item;
|
||||
item.SetText(wxGetTranslation(cur->second.origName));
|
||||
item.SetData(&cur->second);
|
||||
int pos = Shortcuts->InsertItem(item);
|
||||
Shortcuts->SetItem(pos,1,cur->second.GetText());
|
||||
}
|
||||
|
||||
// Main sizer
|
||||
wxSizer *hotkeysSizer = new wxBoxSizer(wxVERTICAL);
|
||||
hotkeysSizer->Add(text,0,wxALL|wxEXPAND,5);
|
||||
hotkeysSizer->Add(Shortcuts,1,wxLEFT|wxRIGHT|wxTOP|wxEXPAND,5);
|
||||
hotkeysSizer->Fit(hotkeysPage);
|
||||
hotkeysPage->SetSizer(hotkeysSizer);
|
||||
}
|
||||
|
||||
// List book
|
||||
book->AddPage(generalPage,_("General"),true);
|
||||
book->AddSubPage(filePage,_("File save/load"),true);
|
||||
|
@ -598,6 +631,7 @@ DialogOptions::DialogOptions(wxWindow *parent)
|
|||
book->AddPage(audioPage,_("Audio"),true);
|
||||
book->AddSubPage(displayPage,_("Display"),true);
|
||||
book->AddPage(autoPage,_("Automation"),true);
|
||||
book->AddPage(hotkeysPage,_("Hotkeys"),true);
|
||||
#ifdef wxUSE_TREEBOOK
|
||||
book->ChangeSelection(Options.AsInt(_T("Options page")));
|
||||
#endif
|
||||
|
@ -646,6 +680,7 @@ BEGIN_EVENT_TABLE(DialogOptions,wxDialog)
|
|||
EVT_BUTTON(wxID_OK,DialogOptions::OnOK)
|
||||
EVT_BUTTON(wxID_CANCEL,DialogOptions::OnCancel)
|
||||
EVT_BUTTON(wxID_APPLY,DialogOptions::OnApply)
|
||||
EVT_LIST_ITEM_ACTIVATED (Hotkey_List,DialogOptions::OnEditHotkey)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
@ -678,6 +713,10 @@ void DialogOptions::OnApply(wxCommandEvent &event) {
|
|||
//////////
|
||||
// Cancel
|
||||
void DialogOptions::OnCancel(wxCommandEvent &event) {
|
||||
// Undo hotkeys
|
||||
if (hotkeysModified) Hotkeys.key = origKeys;
|
||||
|
||||
// Set options
|
||||
Options.SetInt(_T("Options page"),book->GetSelection());
|
||||
Options.Save();
|
||||
EndModal(0);
|
||||
|
@ -782,6 +821,22 @@ void DialogOptions::WriteToOptions(bool justApply) {
|
|||
}
|
||||
}
|
||||
|
||||
// Apply hotkey changes if modified
|
||||
if (hotkeysModified) {
|
||||
// Save changes
|
||||
Hotkeys.modified = true;
|
||||
Hotkeys.Save();
|
||||
hotkeysModified = false;
|
||||
origKeys = Hotkeys.key;
|
||||
|
||||
// Rebuild menu
|
||||
FrameMain *parent = (FrameMain*) GetParent();
|
||||
parent->InitMenu();
|
||||
|
||||
// Rebuild accelerator table
|
||||
parent->SetAccelerators();
|
||||
}
|
||||
|
||||
// Save options
|
||||
Options.Save();
|
||||
|
||||
|
@ -882,3 +937,89 @@ void DialogOptions::ReadFromOptions() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////
|
||||
// Edit a hotkey
|
||||
void DialogOptions::OnEditHotkey(wxListEvent &event) {
|
||||
// Get key and store old
|
||||
HotkeyType *curKey = (HotkeyType *)event.GetData();
|
||||
int oldKeycode = curKey->keycode;
|
||||
int oldFlags = curKey->flags;
|
||||
|
||||
// Open dialog
|
||||
DialogInputHotkey input(curKey,event.GetText());
|
||||
input.ShowModal();
|
||||
|
||||
// Update stuff if it changed
|
||||
if (oldKeycode != curKey->keycode || oldFlags != curKey->flags) {
|
||||
Shortcuts->SetItem(event.GetIndex(),1,curKey->GetText());
|
||||
hotkeysModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////
|
||||
// Input constructor
|
||||
DialogInputHotkey::DialogInputHotkey(HotkeyType *_key,wxString name)
|
||||
: wxDialog(NULL, -1, _("Press Key"), wxDefaultPosition, wxSize(200,50), wxCAPTION | wxWANTS_CHARS , _T("Press key"))
|
||||
{
|
||||
// Key
|
||||
key = _key;
|
||||
|
||||
// Text
|
||||
wxStaticText *text = new wxStaticText(this,-1,_("Press key to bind to \"") + name + _("\" or esc to cancel."));
|
||||
|
||||
// Key capturer
|
||||
capture = new CaptureKey(this);
|
||||
|
||||
// Main sizer
|
||||
wxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
||||
MainSizer->Add(text,1,wxALL,5);
|
||||
MainSizer->SetSizeHints(this);
|
||||
SetSizer(MainSizer);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Capturer constructor
|
||||
CaptureKey::CaptureKey(DialogInputHotkey *_parent)
|
||||
: wxTextCtrl(_parent,-1,_T(""),wxDefaultPosition,wxSize(0,0))
|
||||
{
|
||||
parent = _parent;
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////
|
||||
// Input event table
|
||||
BEGIN_EVENT_TABLE(CaptureKey,wxTextCtrl)
|
||||
EVT_KEY_DOWN(CaptureKey::OnKeyDown)
|
||||
EVT_KILL_FOCUS(CaptureKey::OnLoseFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
///////////////
|
||||
// On key down
|
||||
void CaptureKey::OnKeyDown(wxKeyEvent &event) {
|
||||
int keycode = event.GetKeyCode();
|
||||
|
||||
if (keycode == WXK_ESCAPE) parent->EndModal(0);
|
||||
else if (keycode != WXK_SHIFT && keycode != WXK_CONTROL && keycode != WXK_ALT) {
|
||||
parent->key->keycode = keycode;
|
||||
int mod = 0;
|
||||
if (event.m_altDown) mod |= wxACCEL_ALT;
|
||||
if (event.m_controlDown) mod |= wxACCEL_CTRL;
|
||||
if (event.m_shiftDown) mod |= wxACCEL_SHIFT;
|
||||
parent->key->flags = mod;
|
||||
parent->EndModal(0);
|
||||
}
|
||||
else event.Skip();
|
||||
}
|
||||
|
||||
|
||||
//////////////
|
||||
// Keep focus
|
||||
void CaptureKey::OnLoseFocus(wxFocusEvent &event) {
|
||||
SetFocus();
|
||||
}
|
||||
|
|
|
@ -40,12 +40,17 @@
|
|||
////////////
|
||||
// Includes
|
||||
#include <wx/wxprec.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "options.h"
|
||||
#include "hotkeys.h"
|
||||
|
||||
|
||||
//////////////
|
||||
// Prototypes
|
||||
class FrameMain;
|
||||
class DialogInputHotkey;
|
||||
#ifdef wxUSE_TREEBOOK
|
||||
class wxTreebook;
|
||||
#else
|
||||
|
@ -73,6 +78,11 @@ private:
|
|||
wxTreebook *book;
|
||||
std::vector<OptionsBind> binds;
|
||||
|
||||
// Hotkeys
|
||||
std::map<wxString,HotkeyType> origKeys;
|
||||
wxListView *Shortcuts;
|
||||
bool hotkeysModified;
|
||||
|
||||
void Bind(wxControl *ctrl,wxString option,int param=0);
|
||||
void WriteToOptions(bool justApply=false);
|
||||
void ReadFromOptions();
|
||||
|
@ -80,6 +90,7 @@ private:
|
|||
void OnOK(wxCommandEvent &event);
|
||||
void OnCancel(wxCommandEvent &event);
|
||||
void OnApply(wxCommandEvent &event);
|
||||
void OnEditHotkey(wxListEvent &event);
|
||||
|
||||
public:
|
||||
DialogOptions(wxWindow *parent);
|
||||
|
@ -87,3 +98,39 @@ public:
|
|||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
/////////////////////
|
||||
// Capture key class
|
||||
class CaptureKey : public wxTextCtrl {
|
||||
private:
|
||||
DialogInputHotkey *parent;
|
||||
void OnKeyDown(wxKeyEvent &event);
|
||||
void OnLoseFocus(wxFocusEvent &event);
|
||||
|
||||
public:
|
||||
CaptureKey(DialogInputHotkey *parent);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
//////////////////////
|
||||
// Input dialog class
|
||||
class DialogInputHotkey : public wxDialog {
|
||||
friend class CaptureKey;
|
||||
|
||||
private:
|
||||
CaptureKey *capture;
|
||||
HotkeyType *key;
|
||||
|
||||
public:
|
||||
DialogInputHotkey(HotkeyType *key,wxString name);
|
||||
};
|
||||
|
||||
|
||||
///////
|
||||
// IDs
|
||||
enum {
|
||||
Hotkey_List = 2500
|
||||
};
|
||||
|
|
|
@ -241,7 +241,6 @@ void FrameMain::InitToolbar () {
|
|||
|
||||
// Options
|
||||
Toolbar->AddTool(Menu_Tools_Options,_("Options"),wxBITMAP(options_button),_("Configure Aegisub"));
|
||||
Toolbar->AddTool(Menu_Tools_Hotkeys,_("Hotkeys"),wxBITMAP(hotkeys_button),_("Remap hotkeys"));
|
||||
Toolbar->AddTool(Grid_Toggle_Tags,_("Cycle Tag Hidding Mode"),wxBITMAP(toggle_tag_hiding),_("Cycle through tag-hiding modes"));
|
||||
|
||||
// Update
|
||||
|
@ -419,7 +418,6 @@ void FrameMain::InitMenu() {
|
|||
viewMenu = new wxMenu();
|
||||
AppendBitmapMenuItem(viewMenu,Menu_View_Language, _T("&Language..."), _("Select Aegisub interface language"), wxBITMAP(blank_button));
|
||||
AppendBitmapMenuItem(viewMenu,Menu_Tools_Options, _("&Options...") + wxString(_T("\t")) + Hotkeys.GetText(_T("Options")), _("Configure Aegisub"), wxBITMAP(options_button));
|
||||
AppendBitmapMenuItem(viewMenu,Menu_Tools_Hotkeys, _("&Hotkeys..."), _("Remap hotkeys"), wxBITMAP(hotkeys_button));
|
||||
AppendBitmapMenuItem(viewMenu,Menu_Tools_Log, _("Lo&g window..."), _("Open log window"), wxBITMAP(blank_button));
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->AppendRadioItem(Menu_View_Subs, _("Subs only view"), _("Display subtitles only"));
|
||||
|
|
|
@ -204,7 +204,6 @@ private:
|
|||
void OnOpenResample (wxCommandEvent &event);
|
||||
void OnOpenTimingProcessor (wxCommandEvent &event);
|
||||
void OnOpenKanjiTimer (wxCommandEvent &event);
|
||||
void OnOpenHotkeys (wxCommandEvent &event);
|
||||
void OnOpenOptions (wxCommandEvent &event);
|
||||
void OnOpenLog (wxCommandEvent &event);
|
||||
void OnGridEvent (wxCommandEvent &event);
|
||||
|
@ -360,7 +359,6 @@ enum {
|
|||
Menu_Tools_Resample,
|
||||
Menu_Tools_Timing_Processor,
|
||||
Menu_Tools_Kanji_Timer,
|
||||
Menu_Tools_Hotkeys,
|
||||
Menu_Tools_Options,
|
||||
Menu_Tools_Log,
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
#include "dialog_kanji_timer.h"
|
||||
#include "audio_display.h"
|
||||
#include "toggle_bitmap.h"
|
||||
#include "dialog_hotkeys.h"
|
||||
#include "dialog_timing_processor.h"
|
||||
#if USE_FEXTRACKER == 1
|
||||
#include "../FexTrackerSource/FexTracker.h"
|
||||
|
@ -168,7 +167,6 @@ BEGIN_EVENT_TABLE(FrameMain, wxFrame)
|
|||
EVT_MENU(Menu_Tools_Resample, FrameMain::OnOpenResample)
|
||||
EVT_MENU(Menu_Tools_Timing_Processor, FrameMain::OnOpenTimingProcessor)
|
||||
EVT_MENU(Menu_Tools_Kanji_Timer, FrameMain::OnOpenKanjiTimer)
|
||||
EVT_MENU(Menu_Tools_Hotkeys, FrameMain::OnOpenHotkeys)
|
||||
EVT_MENU(Menu_Tools_Options, FrameMain::OnOpenOptions)
|
||||
EVT_MENU(Menu_Tools_Log, FrameMain::OnOpenLog)
|
||||
|
||||
|
@ -923,13 +921,6 @@ void FrameMain::OnOpenKanjiTimer (wxCommandEvent &event) {
|
|||
kanjitimer.ShowModal();
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
// Open Hotkeys dialog
|
||||
void FrameMain::OnOpenHotkeys (wxCommandEvent &event) {
|
||||
DialogHotkeys keys(this);
|
||||
keys.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
// Open Options dialog
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
//////////////
|
||||
// Prototypes
|
||||
class DialogHotkeys;
|
||||
class DialogOptions;
|
||||
|
||||
|
||||
////////////////
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
/////////////////////////////
|
||||
// Class that stores hotkeys
|
||||
class HotkeyManager {
|
||||
friend class DialogHotkeys;
|
||||
friend class DialogOptions;
|
||||
private:
|
||||
bool modified;
|
||||
wxString filename;
|
||||
|
|
|
@ -111,7 +111,7 @@ LibassSubtitlesProvider::LibassSubtitlesProvider() {
|
|||
ass_renderer = ass_renderer_init(ass_library);
|
||||
if (!ass_renderer) throw _T("ass_renderer_init failed");
|
||||
ass_set_font_scale(ass_renderer, 1.);
|
||||
ass_set_fonts(ass_renderer, NULL, "Sans");
|
||||
ass_set_fonts(ass_renderer, "c:\\windows\\fonts\\verdana.ttf", "Sans");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue