mirror of https://github.com/odrling/Aegisub
Make some non-mutating hotkey methods const.
Originally committed to SVN as r3852.
This commit is contained in:
parent
c3a6fbae6e
commit
fc75937466
|
@ -74,7 +74,7 @@ HotkeyType::HotkeyType(wxString text,wxString name) {
|
|||
/// @brief Get string of hotkey
|
||||
/// @return
|
||||
///
|
||||
wxString HotkeyType::GetText() {
|
||||
wxString HotkeyType::GetText() const {
|
||||
wxString text;
|
||||
|
||||
// Modifiers
|
||||
|
@ -539,10 +539,10 @@ void HotkeyManager::SetFile(wxString file) {
|
|||
/// @param function
|
||||
/// @return
|
||||
///
|
||||
wxString HotkeyManager::GetText(wxString function) {
|
||||
std::map<wxString,HotkeyType>::iterator cur = key.find(function.Lower());
|
||||
const wxString HotkeyManager::GetText(wxString function) const {
|
||||
std::map<wxString,HotkeyType>::const_iterator cur = key.find(function.Lower());
|
||||
if (cur != key.end()) {
|
||||
return (*cur).second.GetText();
|
||||
return cur->second.GetText();
|
||||
}
|
||||
else throw _T("Hotkey not defined");
|
||||
}
|
||||
|
@ -554,10 +554,10 @@ wxString HotkeyManager::GetText(wxString function) {
|
|||
/// @param id
|
||||
/// @return
|
||||
///
|
||||
wxAcceleratorEntry HotkeyManager::GetAccelerator(wxString function,int id) {
|
||||
std::map<wxString,HotkeyType>::iterator cur = key.find(function.Lower());
|
||||
wxAcceleratorEntry HotkeyManager::GetAccelerator(wxString function,int id) const {
|
||||
std::map<wxString,HotkeyType>::const_iterator cur = key.find(function.Lower());
|
||||
if (cur != key.end()) {
|
||||
HotkeyType *hotkey = &(*cur).second;
|
||||
const HotkeyType *hotkey = &(*cur).second;
|
||||
wxAcceleratorEntry entry;
|
||||
entry.Set(hotkey->flags,hotkey->keycode,id);
|
||||
return entry;
|
||||
|
@ -587,10 +587,10 @@ void HotkeyManager::SetPressed(int keypress,bool ctrl,bool alt,bool shift) {
|
|||
/// @param function
|
||||
/// @return
|
||||
///
|
||||
bool HotkeyManager::IsPressed(wxString function) {
|
||||
std::map<wxString,HotkeyType>::iterator cur = key.find(function.Lower());
|
||||
bool HotkeyManager::IsPressed(wxString function) const {
|
||||
std::map<wxString,HotkeyType>::const_iterator cur = key.find(function.Lower());
|
||||
if (cur != key.end()) {
|
||||
HotkeyType *hotkey = &(*cur).second;
|
||||
const HotkeyType *hotkey = &(*cur).second;
|
||||
return (hotkey->keycode == lastKey && hotkey->flags == lastMod);
|
||||
}
|
||||
else throw _T("Hotkey not defined");
|
||||
|
@ -611,5 +611,3 @@ HotkeyType *HotkeyManager::Find(int keycode,int mod) {
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
HotkeyType(wxString text,wxString name);
|
||||
|
||||
void Parse(wxString text);
|
||||
wxString GetText();
|
||||
wxString GetText() const;
|
||||
|
||||
|
||||
/// DOCME
|
||||
|
@ -123,9 +123,9 @@ public:
|
|||
void LoadDefaults();
|
||||
HotkeyType *Find(int keycode,int mod);
|
||||
|
||||
wxString GetText(wxString function);
|
||||
wxAcceleratorEntry GetAccelerator(wxString function,int id);
|
||||
bool IsPressed(wxString function);
|
||||
const wxString GetText(wxString function) const;
|
||||
wxAcceleratorEntry GetAccelerator(wxString function,int id) const;
|
||||
bool IsPressed(wxString function) const;
|
||||
void SetPressed(int key,bool ctrl=false,bool alt=false,bool shift=false);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue