2006-01-16 22:02:54 +01:00
|
|
|
// 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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file hotkeys.cpp
|
|
|
|
/// @brief Keep hotkey configuration and handle hotkey presses
|
|
|
|
/// @ingroup main_ui
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
///////////
|
|
|
|
// Headers
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "hotkeys.h"
|
|
|
|
#include <fstream>
|
|
|
|
#include "text_file_reader.h"
|
|
|
|
#include "text_file_writer.h"
|
|
|
|
#include <wx/filename.h>
|
|
|
|
#include <wx/accel.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Constructors HotkeyType //////////////////////////////////
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
HotkeyType::HotkeyType() {
|
|
|
|
flags = 0;
|
|
|
|
keycode = 0;
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param text
|
|
|
|
/// @param name
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
HotkeyType::HotkeyType(wxString text,wxString name) {
|
|
|
|
Parse(text);
|
|
|
|
origName = name;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Get string of hotkey
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString HotkeyType::GetText() {
|
|
|
|
wxString text;
|
|
|
|
|
|
|
|
// Modifiers
|
|
|
|
if (flags & wxACCEL_CTRL) text += _T("Ctrl-");
|
|
|
|
if (flags & wxACCEL_ALT) text += _T("Alt-");
|
|
|
|
if (flags & wxACCEL_SHIFT) text += _T("Shift-");
|
|
|
|
|
|
|
|
// Key name
|
|
|
|
text += GetKeyName(keycode);
|
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Parse text into hotkey
|
|
|
|
/// @param text
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyType::Parse(wxString text) {
|
|
|
|
// Reset
|
|
|
|
flags = 0;
|
|
|
|
keycode = 0;
|
|
|
|
wxString work = text.Lower();
|
|
|
|
|
|
|
|
// Parse modifiers
|
|
|
|
while (true) {
|
|
|
|
// Ctrl
|
|
|
|
if (work.Left(5) == _T("ctrl-")) {
|
|
|
|
flags |= wxACCEL_CTRL;
|
|
|
|
work = work.Mid(5);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Alt
|
|
|
|
if (work.Left(4) == _T("alt-")) {
|
|
|
|
flags |= wxACCEL_ALT;
|
|
|
|
work = work.Mid(4);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shift
|
|
|
|
if (work.Left(6) == _T("shift-")) {
|
|
|
|
flags |= wxACCEL_SHIFT;
|
|
|
|
work = work.Mid(6);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get key name
|
|
|
|
FillMap();
|
|
|
|
bool got = false;
|
|
|
|
std::map<int,wxString>::iterator cur;
|
|
|
|
for (cur = keyName.begin();cur != keyName.end();cur++) {
|
|
|
|
if (cur->second.Lower() == work) {
|
|
|
|
keycode = cur->first;
|
|
|
|
got = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Didn't find, check if it's a raw code
|
|
|
|
if (!got) {
|
|
|
|
if (work.Left(1) == _T("[") && work.Right(1) == _T("]")) {
|
|
|
|
work = work.Mid(1,work.Length()-2);
|
|
|
|
if (work.IsNumber()) {
|
|
|
|
long temp;
|
|
|
|
work.ToLong(&temp);
|
|
|
|
keycode = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// DOCME
|
2006-01-16 22:02:54 +01:00
|
|
|
std::map<int,wxString> HotkeyType::keyName;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param keycode
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString HotkeyType::GetKeyName(int keycode) {
|
|
|
|
// Fill map
|
|
|
|
FillMap();
|
|
|
|
|
|
|
|
// Blank key
|
|
|
|
if (keycode == 0) return _T("");
|
|
|
|
|
|
|
|
// Get key name
|
|
|
|
std::map<int,wxString>::iterator cur = keyName.find(keycode);
|
|
|
|
if (cur != keyName.end()) return cur->second;
|
|
|
|
else return wxString::Format(_T("[%i]"),keycode);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Fill map
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyType::FillMap() {
|
|
|
|
if (keyName.empty()) {
|
2007-09-22 17:16:48 +02:00
|
|
|
keyName[WXK_BACK] = _T("Backspace");
|
2006-01-16 22:02:54 +01:00
|
|
|
keyName[WXK_SPACE] = _T("Space");
|
|
|
|
keyName[WXK_RETURN] = _T("Enter");
|
|
|
|
keyName[WXK_TAB] = _T("Tab");
|
|
|
|
keyName[WXK_PAUSE] = _T("Pause");
|
|
|
|
|
|
|
|
keyName[WXK_LEFT] = _T("Left");
|
|
|
|
keyName[WXK_RIGHT] = _T("Right");
|
|
|
|
keyName[WXK_UP] = _T("Up");
|
|
|
|
keyName[WXK_DOWN] = _T("Down");
|
|
|
|
|
|
|
|
keyName[WXK_INSERT] = _T("Insert");
|
|
|
|
keyName[WXK_DELETE] = _T("Delete");
|
|
|
|
keyName[WXK_HOME] = _T("Home");
|
|
|
|
keyName[WXK_END] = _T("End");
|
2007-01-22 20:31:49 +01:00
|
|
|
keyName[WXK_PAGEUP] = _T("PgUp");
|
|
|
|
keyName[WXK_PAGEDOWN] = _T("PgDn");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
keyName[WXK_NUMPAD0] = _T("KP_0");
|
|
|
|
keyName[WXK_NUMPAD1] = _T("KP_1");
|
|
|
|
keyName[WXK_NUMPAD2] = _T("KP_2");
|
|
|
|
keyName[WXK_NUMPAD3] = _T("KP_3");
|
|
|
|
keyName[WXK_NUMPAD4] = _T("KP_4");
|
|
|
|
keyName[WXK_NUMPAD5] = _T("KP_5");
|
|
|
|
keyName[WXK_NUMPAD6] = _T("KP_6");
|
|
|
|
keyName[WXK_NUMPAD7] = _T("KP_7");
|
|
|
|
keyName[WXK_NUMPAD8] = _T("KP_8");
|
|
|
|
keyName[WXK_NUMPAD9] = _T("KP_9");
|
|
|
|
keyName[WXK_NUMPAD_ADD] = _T("KP_Add");
|
|
|
|
keyName[WXK_NUMPAD_SUBTRACT] = _T("KP_Subtract");
|
2006-12-30 21:58:24 +01:00
|
|
|
keyName[WXK_NUMPAD_SUBTRACT] = _T("KP_Subtract");
|
|
|
|
keyName[WXK_NUMPAD_MULTIPLY] = _T("KP_Multiply");
|
|
|
|
keyName[WXK_NUMPAD_DIVIDE] = _T("KP_Divide");
|
|
|
|
keyName[WXK_NUMPAD_DECIMAL] = _T("KP_Decimal");
|
2007-07-27 10:24:49 +02:00
|
|
|
keyName[WXK_NUMPAD_ENTER] = _T("KP_Enter");
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
keyName[WXK_F1] = _T("F1");
|
|
|
|
keyName[WXK_F2] = _T("F2");
|
|
|
|
keyName[WXK_F3] = _T("F3");
|
|
|
|
keyName[WXK_F4] = _T("F4");
|
|
|
|
keyName[WXK_F5] = _T("F5");
|
|
|
|
keyName[WXK_F6] = _T("F6");
|
|
|
|
keyName[WXK_F7] = _T("F7");
|
|
|
|
keyName[WXK_F8] = _T("F8");
|
|
|
|
keyName[WXK_F9] = _T("F9");
|
|
|
|
keyName[WXK_F10] = _T("F10");
|
|
|
|
keyName[WXK_F11] = _T("F11");
|
|
|
|
keyName[WXK_F12] = _T("F12");
|
|
|
|
|
|
|
|
for (char i='!';i<='`';i++) {
|
|
|
|
keyName[i] = wchar_t(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// DOCME
|
2006-01-16 22:02:54 +01:00
|
|
|
HotkeyManager Hotkeys;
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Constructor
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
HotkeyManager::HotkeyManager() {
|
|
|
|
modified = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Destructor
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
HotkeyManager::~HotkeyManager() {
|
|
|
|
key.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Save
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyManager::Save() {
|
|
|
|
// Check if it's actually modified
|
|
|
|
if (!modified) return;
|
|
|
|
|
|
|
|
// Open file
|
|
|
|
using namespace std;
|
|
|
|
TextFileWriter file(filename,_T("UTF-8"));
|
|
|
|
file.WriteLineToFile(_T("[Hotkeys]"));
|
|
|
|
|
|
|
|
// Put variables in it
|
|
|
|
for (map<wxString,HotkeyType>::iterator cur=key.begin();cur!=key.end();cur++) {
|
|
|
|
file.WriteLineToFile((*cur).first + _T("=") + (*cur).second.GetText());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close
|
|
|
|
modified = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Load
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyManager::Load() {
|
|
|
|
// Load defaults
|
|
|
|
LoadDefaults();
|
|
|
|
|
|
|
|
// Check if file exists (create if it doesn't)
|
|
|
|
wxFileName path(filename);
|
|
|
|
if (!path.FileExists()) {
|
|
|
|
modified = true;
|
|
|
|
Save();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Open file
|
|
|
|
using namespace std;
|
|
|
|
TextFileReader file(filename);
|
2009-07-14 23:28:49 +02:00
|
|
|
wxString header;
|
|
|
|
try {
|
|
|
|
if (file.GetCurrentEncoding() != _T("binary"))
|
|
|
|
header = file.ReadLineFromFile();
|
|
|
|
}
|
|
|
|
catch (wxString e) {
|
|
|
|
header = _T("");
|
|
|
|
}
|
2009-05-25 01:19:28 +02:00
|
|
|
if (header != _T("[Hotkeys]")) {
|
|
|
|
wxFileName backupfn(filename);
|
|
|
|
backupfn.SetFullName(_T("hotkeys.bak"));
|
|
|
|
wxCopyFile(filename, backupfn.GetFullPath());
|
|
|
|
modified = true;
|
|
|
|
Save();
|
|
|
|
wxLogWarning(_T("Hotkeys file corrupted, defaults restored.\nA backup of the corrupted file was made."));
|
|
|
|
return;
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Get variables
|
|
|
|
wxString curLine;
|
|
|
|
map<wxString,HotkeyType>::iterator cur;
|
|
|
|
while (file.HasMoreLines()) {
|
|
|
|
// Parse line
|
2009-07-14 23:28:49 +02:00
|
|
|
try {
|
|
|
|
curLine = file.ReadLineFromFile();
|
|
|
|
}
|
|
|
|
catch (wxString e) {
|
|
|
|
wxFileName backupfn(filename);
|
|
|
|
backupfn.SetFullName(_T("hotkeys.bak"));
|
|
|
|
wxCopyFile(filename, backupfn.GetFullPath());
|
|
|
|
modified = true;
|
|
|
|
Save();
|
|
|
|
wxLogWarning(_T("Hotkeys file corrupted, defaults restored.\nA backup of the corrupted file was made."));
|
|
|
|
return;
|
|
|
|
}
|
2006-02-20 22:32:58 +01:00
|
|
|
if (curLine.IsEmpty()) continue;
|
2006-01-16 22:02:54 +01:00
|
|
|
size_t pos = curLine.Find(_T("="));
|
|
|
|
if (pos == wxString::npos) continue;
|
|
|
|
wxString func = curLine.Left(pos);
|
|
|
|
wxString value = curLine.Mid(pos+1);
|
|
|
|
|
|
|
|
// Find it
|
|
|
|
cur = key.find(func);
|
|
|
|
if (cur != key.end()) {
|
|
|
|
(*cur).second.Parse(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Commented out so it discards anything that isn't listed:
|
|
|
|
//else SetHotkey(func,value);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close
|
|
|
|
Save();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Load defaults
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyManager::LoadDefaults() {
|
|
|
|
modified = true;
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @note () is used here instead of _T(). This is done so the strings can be extracted.
|
|
|
|
/// However, since this function is called before locale is set, it won't ever be translated.
|
|
|
|
/// Keep this in mind: THESE CANNOT BE TRANSLATED HERE!
|
|
|
|
/// As a safeguard, _() is undefined here
|
2006-01-16 22:02:54 +01:00
|
|
|
#undef _
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// DOCME
|
2006-01-16 22:02:54 +01:00
|
|
|
#define _(a) _T(a)
|
|
|
|
|
|
|
|
SetHotkey(_("New subtitles"),_T("Ctrl-N"));
|
|
|
|
SetHotkey(_("Open subtitles"),_T("Ctrl-O"));
|
|
|
|
SetHotkey(_("Save subtitles"),_T("Ctrl-S"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
SetHotkey(_("Exit"),_T("Ctrl-Q"));
|
|
|
|
SetHotkey(_("Help"),_T("Ctrl-?"));
|
|
|
|
SetHotkey(_("Options"),_T("Ctrl-,"));
|
|
|
|
#else
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Exit"),_T("Alt-F4"));
|
|
|
|
SetHotkey(_("Help"),_T("F1"));
|
2007-01-03 04:47:08 +01:00
|
|
|
SetHotkey(_("Options"),_T("Alt-O"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#endif
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-12-24 18:42:09 +01:00
|
|
|
SetHotkey(_("Edit Box Commit"),_T("Ctrl-Enter"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Undo"),_T("Ctrl-Z"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
SetHotkey(_("Redo"),_T("Ctrl-Shift-Z"));
|
|
|
|
#else
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Redo"),_T("Ctrl-Y"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#endif
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Shift Times"),_T("Ctrl-I"));
|
|
|
|
SetHotkey(_("Find"),_T("Ctrl-F"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
SetHotkey(_("Find Next"),_T("Ctrl-G"));
|
|
|
|
SetHotkey(_("Replace"),_T("Ctrl-Shift-F")); // non-standard?
|
|
|
|
#else
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Find Next"),_T("F3"));
|
|
|
|
SetHotkey(_("Replace"),_T("Ctrl-H"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#endif
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Select Lines"),_T(""));
|
|
|
|
SetHotkey(_("Copy"),_T("Ctrl-C"));
|
|
|
|
SetHotkey(_("Cut"),_T("Ctrl-X"));
|
|
|
|
SetHotkey(_("Paste"),_T("Ctrl-V"));
|
2006-12-17 19:30:19 +01:00
|
|
|
SetHotkey(_("Paste Over"),_T("Ctrl-Shift-V"));
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2007-09-22 17:16:48 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
SetHotkey(_("Video Jump"),_T("Ctrl-J"));
|
|
|
|
#else
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Video Jump"),_T("Ctrl-G"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#endif
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Jump Video to Start"),_T("Ctrl-1"));
|
|
|
|
SetHotkey(_("Jump Video to End"),_T("Ctrl-2"));
|
|
|
|
SetHotkey(_("Set Start to Video"),_T("Ctrl-3"));
|
|
|
|
SetHotkey(_("Set End to Video"),_T("Ctrl-4"));
|
|
|
|
SetHotkey(_("Snap to Scene"),_T("Ctrl-5"));
|
|
|
|
SetHotkey(_("Shift by Current Time"),_T("Ctrl-6"));
|
|
|
|
SetHotkey(_("Zoom 50%"),_T(""));
|
|
|
|
SetHotkey(_("Zoom 100%"),_T(""));
|
|
|
|
SetHotkey(_("Zoom 200%"),_T(""));
|
|
|
|
|
|
|
|
SetHotkey(_("Video global prev frame"),_T("Ctrl-KP_4"));
|
|
|
|
SetHotkey(_("Video global next frame"),_T("Ctrl-KP_6"));
|
|
|
|
SetHotkey(_("Video global focus seek"),_T("Ctrl-Space"));
|
2006-12-17 21:46:01 +01:00
|
|
|
SetHotkey(_("Video global play"),_T("Ctrl-P"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Grid global prev line"),_T("Ctrl-KP_8"));
|
|
|
|
SetHotkey(_("Grid global next line"),_T("Ctrl-KP_2"));
|
|
|
|
SetHotkey(_("Save Subtitles Alt"),_T("F2"));
|
|
|
|
SetHotkey(_("Video global zoom in"),_T("Ctrl-KP_Add"));
|
|
|
|
SetHotkey(_("Video global zoom out"),_T("Ctrl-KP_Subtract"));
|
|
|
|
|
|
|
|
SetHotkey(_("Grid move row down"),_T("Alt-Down"));
|
|
|
|
SetHotkey(_("Grid move row up"),_T("Alt-Up"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#ifdef __APPLE__
|
|
|
|
SetHotkey(_("Grid delete rows"),_T("Ctrl-Backspace"));
|
|
|
|
#else
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Grid delete rows"),_T("Ctrl-Delete"));
|
2007-09-22 17:16:48 +02:00
|
|
|
#endif
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Grid duplicate rows"),_T(""));
|
|
|
|
SetHotkey(_("Grid duplicate and shift one frame"),_T("Ctrl-D"));
|
|
|
|
|
|
|
|
SetHotkey(_("Audio Commit Alt"),_T("G"));
|
|
|
|
SetHotkey(_("Audio Commit"),_T("Enter"));
|
2006-12-24 19:45:11 +01:00
|
|
|
SetHotkey(_("Audio Commit (Stay)"),_T("F8"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Audio Prev Line"),_T("Left"));
|
|
|
|
SetHotkey(_("Audio Prev Line Alt"),_T("Z"));
|
|
|
|
SetHotkey(_("Audio Next Line"),_T("Right"));
|
|
|
|
SetHotkey(_("Audio Next Line Alt"),_T("X"));
|
|
|
|
SetHotkey(_("Audio Play"),_T("Space"));
|
|
|
|
SetHotkey(_("Audio Play Alt"),_T("S"));
|
2007-01-06 05:27:09 +01:00
|
|
|
SetHotkey(_("Audio Play or Stop"),_T("B"));
|
|
|
|
SetHotkey(_("Audio Stop"),_T("H"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Audio Karaoke Increase Len"),_T("KP_Add"));
|
|
|
|
SetHotkey(_("Audio Karaoke Decrease Len"),_T("KP_Subtract"));
|
|
|
|
SetHotkey(_("Audio Karaoke Increase Len Shift"),_T("Shift-KP_Add"));
|
|
|
|
SetHotkey(_("Audio Karaoke Decrease Len Shift"),_T("Shift-KP_Subtract"));
|
|
|
|
SetHotkey(_("Audio Scroll Left"),_T("A"));
|
|
|
|
SetHotkey(_("Audio Scroll Right"),_T("F"));
|
|
|
|
SetHotkey(_("Audio Play First 500ms"),_T("E"));
|
|
|
|
SetHotkey(_("Audio Play Last 500ms"),_T("D"));
|
|
|
|
SetHotkey(_("Audio Play 500ms Before"),_T("Q"));
|
|
|
|
SetHotkey(_("Audio Play 500ms After"),_T("W"));
|
2006-07-01 08:37:46 +02:00
|
|
|
SetHotkey(_("Audio Play To End"),_T("T"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Audio Play Original Line"),_T("R"));
|
|
|
|
SetHotkey(_("Audio Add Lead In"),_T("C"));
|
|
|
|
SetHotkey(_("Audio Add Lead Out"),_T("V"));
|
|
|
|
|
2006-12-30 21:58:24 +01:00
|
|
|
SetHotkey(_("Audio Medusa Toggle"),_T("Ctrl-KP_Multiply"));
|
|
|
|
SetHotkey(_("Audio Medusa Play"),_T("KP_5"));
|
|
|
|
SetHotkey(_("Audio Medusa Stop"),_T("KP_8"));
|
|
|
|
SetHotkey(_("Audio Medusa Shift Start Back"),_T("KP_4"));
|
|
|
|
SetHotkey(_("Audio Medusa Shift Start Forward"),_T("KP_6"));
|
|
|
|
SetHotkey(_("Audio Medusa Shift End Back"),_T("KP_7"));
|
|
|
|
SetHotkey(_("Audio Medusa Shift End Forward"),_T("KP_9"));
|
|
|
|
SetHotkey(_("Audio Medusa Play Before"),_T("KP_1"));
|
|
|
|
SetHotkey(_("Audio Medusa Play After"),_T("KP_3"));
|
|
|
|
SetHotkey(_("Audio Medusa Next"),_T("KP_2"));
|
|
|
|
SetHotkey(_("Audio Medusa Previous"),_T("KP_0"));
|
2007-07-27 10:24:49 +02:00
|
|
|
SetHotkey(_("Audio Medusa Enter"),_T("KP_Enter"));
|
2006-12-30 21:58:24 +01:00
|
|
|
|
2008-05-09 07:03:40 +02:00
|
|
|
SetHotkey(_("Translation Assistant Play Audio"),_T("End"));
|
|
|
|
SetHotkey(_("Translation Assistant Play Video"),_T("Home"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Translation Assistant Next"),_T("PgDn"));
|
|
|
|
SetHotkey(_("Translation Assistant Prev"),_T("PgUp"));
|
|
|
|
SetHotkey(_("Translation Assistant Accept"),_T("Enter"));
|
2006-12-24 19:45:11 +01:00
|
|
|
SetHotkey(_("Translation Assistant Preview"),_T("F8"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Translation Assistant Insert Original"),_T("Insert"));
|
|
|
|
|
2008-05-09 07:03:40 +02:00
|
|
|
SetHotkey(_("Styling Assistant Play Audio"),_T("End"));
|
|
|
|
SetHotkey(_("Styling Assistant Play Video"),_T("Home"));
|
2006-01-16 22:02:54 +01:00
|
|
|
SetHotkey(_("Styling Assistant Next"),_T("PgDn"));
|
|
|
|
SetHotkey(_("Styling Assistant Prev"),_T("PgUp"));
|
|
|
|
SetHotkey(_("Styling Assistant Accept"),_T("Enter"));
|
2006-12-24 19:45:11 +01:00
|
|
|
SetHotkey(_("Styling Assistant Preview"),_T("F8"));
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Set hotkey
|
|
|
|
/// @param function
|
|
|
|
/// @param hotkey
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyManager::SetHotkey(wxString function,HotkeyType hotkey) {
|
|
|
|
key[function.Lower()] = hotkey;
|
|
|
|
modified = true;
|
|
|
|
}
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief DOCME
|
|
|
|
/// @param function
|
|
|
|
/// @param hotkey
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyManager::SetHotkey(wxString function,wxString hotkey) {
|
|
|
|
key[function.Lower()] = HotkeyType(hotkey,function);
|
|
|
|
modified = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Set file
|
|
|
|
/// @param file
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyManager::SetFile(wxString file) {
|
|
|
|
filename = file;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Get hotkey as text
|
|
|
|
/// @param function
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxString HotkeyManager::GetText(wxString function) {
|
|
|
|
std::map<wxString,HotkeyType>::iterator cur = key.find(function.Lower());
|
|
|
|
if (cur != key.end()) {
|
|
|
|
return (*cur).second.GetText();
|
|
|
|
}
|
|
|
|
else throw _T("Hotkey not defined");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Get hotkey as accelerator entry
|
|
|
|
/// @param function
|
|
|
|
/// @param id
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
wxAcceleratorEntry HotkeyManager::GetAccelerator(wxString function,int id) {
|
|
|
|
std::map<wxString,HotkeyType>::iterator cur = key.find(function.Lower());
|
|
|
|
if (cur != key.end()) {
|
|
|
|
HotkeyType *hotkey = &(*cur).second;
|
|
|
|
wxAcceleratorEntry entry;
|
|
|
|
entry.Set(hotkey->flags,hotkey->keycode,id);
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
else throw _T("Hotkey not defined");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Set last key pressed
|
|
|
|
/// @param keypress
|
|
|
|
/// @param ctrl
|
|
|
|
/// @param alt
|
|
|
|
/// @param shift
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void HotkeyManager::SetPressed(int keypress,bool ctrl,bool alt,bool shift) {
|
|
|
|
lastKey = keypress;
|
|
|
|
lastMod = 0;
|
|
|
|
if (ctrl) lastMod |= wxACCEL_CTRL;
|
|
|
|
if (alt) lastMod |= wxACCEL_ALT;
|
|
|
|
if (shift) lastMod |= wxACCEL_SHIFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Is pressed?
|
|
|
|
/// @param function
|
|
|
|
/// @return
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
bool HotkeyManager::IsPressed(wxString function) {
|
|
|
|
std::map<wxString,HotkeyType>::iterator cur = key.find(function.Lower());
|
|
|
|
if (cur != key.end()) {
|
|
|
|
HotkeyType *hotkey = &(*cur).second;
|
|
|
|
return (hotkey->keycode == lastKey && hotkey->flags == lastMod);
|
|
|
|
}
|
|
|
|
else throw _T("Hotkey not defined");
|
|
|
|
}
|
|
|
|
|
2007-10-21 03:13:26 +02:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Search for a hotkey
|
|
|
|
/// @param keycode
|
|
|
|
/// @param mod
|
|
|
|
///
|
2007-10-21 03:13:26 +02:00
|
|
|
HotkeyType *HotkeyManager::Find(int keycode,int mod) {
|
|
|
|
for (std::map<wxString,HotkeyType>::iterator cur = key.begin();cur != key.end();cur++) {
|
|
|
|
if (cur->second.keycode == keycode && cur->second.flags == mod) {
|
|
|
|
return &(cur->second);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-07-29 07:43:02 +02:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|