2011-09-15 07:16:41 +02:00
|
|
|
// Copyright (c) 2011, Thomas Goyne <plorkyeran@aegisub.org>
|
2007-04-14 03:02:21 +02:00
|
|
|
//
|
2011-09-15 07:16:41 +02:00
|
|
|
// Permission to use, copy, modify, and distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice appear in all copies.
|
2007-04-14 03:02:21 +02:00
|
|
|
//
|
2011-09-15 07:16:41 +02:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2007-04-14 03:02:21 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2007-04-14 03:02:21 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file dialog_spellchecker.h
|
|
|
|
/// @see dialog_spellchecker.cpp
|
2011-09-15 07:16:41 +02:00
|
|
|
/// @ingroup spelling
|
2009-07-29 07:43:02 +02:00
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
|
2009-09-11 04:36:34 +02:00
|
|
|
#ifndef AGI_PRE
|
|
|
|
#include <map>
|
2011-09-15 07:16:41 +02:00
|
|
|
#include <set>
|
2009-09-11 04:36:34 +02:00
|
|
|
|
2007-09-12 01:22:26 +02:00
|
|
|
#include <wx/dialog.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
#endif
|
2007-04-14 03:02:21 +02:00
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
#include <libaegisub/scoped_ptr.h>
|
|
|
|
|
2011-01-16 08:16:13 +01:00
|
|
|
namespace agi { struct Context; }
|
2011-09-15 07:16:41 +02:00
|
|
|
class AssDialogue;
|
2007-04-14 03:02:21 +02:00
|
|
|
class SpellChecker;
|
2011-09-15 07:16:41 +02:00
|
|
|
class wxButton;
|
2012-01-26 21:51:08 +01:00
|
|
|
class wxCheckBox;
|
2011-09-15 07:16:41 +02:00
|
|
|
class wxComboBox;
|
|
|
|
class wxListBox;
|
|
|
|
class wxTextCtrl;
|
2007-04-14 03:02:21 +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
|
|
|
/// DOCME
|
|
|
|
/// @class DialogSpellChecker
|
|
|
|
/// @brief DOCME
|
|
|
|
///
|
|
|
|
/// DOCME
|
2007-04-14 03:02:21 +02:00
|
|
|
class DialogSpellChecker : public wxDialog {
|
2011-09-15 07:16:41 +02:00
|
|
|
agi::Context *context; ///< The project context
|
|
|
|
agi::scoped_ptr<SpellChecker> spellchecker; ///< The spellchecking engine
|
2007-04-14 17:26:46 +02:00
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
/// Words which the user has indicated should always be corrected
|
|
|
|
std::map<wxString,wxString> auto_replace;
|
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
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
/// Words which the user has temporarily added to the dictionary
|
|
|
|
std::set<wxString> auto_ignore;
|
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
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
/// Dictionaries available
|
|
|
|
wxArrayString dictionary_lang_codes;
|
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
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
int word_start; ///< Start index of the current misspelled word
|
2012-02-01 01:47:57 +01:00
|
|
|
int word_end; ///< End index of the current misspelled word
|
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
|
|
|
|
2012-02-01 01:47:57 +01:00
|
|
|
wxTextCtrl *orig_word; ///< The word being corrected
|
2011-09-15 07:16:41 +02:00
|
|
|
wxTextCtrl *replace_word; ///< The replacement that will be used if "Replace" is clicked
|
2012-02-01 01:47:57 +01:00
|
|
|
wxListBox *suggest_list; ///< The list of suggested replacements
|
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
|
|
|
|
2012-02-01 01:47:57 +01:00
|
|
|
wxComboBox *language; ///< The list of available languages
|
|
|
|
wxButton *add_button; ///< Add word to currently active dictionary
|
2012-01-26 21:51:08 +01:00
|
|
|
wxCheckBox *skip_comments; ///< Skip over commented lines
|
2007-04-14 03:02:21 +02:00
|
|
|
|
2012-02-01 01:47:57 +01:00
|
|
|
AssDialogue *start_line; ///< The first line checked
|
|
|
|
AssDialogue *active_line; ///< The most recently checked line
|
|
|
|
bool has_looped; ///< Has the search already looped from the end to beginning?
|
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
/// Find the next misspelled word and close the dialog if there are none
|
|
|
|
/// @return Are there any more misspelled words?
|
|
|
|
bool FindNext();
|
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
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
/// Check a single line for misspellings
|
|
|
|
/// @param active_line Line to check
|
|
|
|
/// @param start_pos Index in the line to start at
|
|
|
|
/// @param[in,out] commit_id Commit id for coalescing autoreplace commits
|
|
|
|
/// @return Was a misspelling found?
|
|
|
|
bool CheckLine(AssDialogue *active_line, int start_pos, int *commit_id);
|
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
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
/// Set the current word to be corrected
|
|
|
|
void SetWord(wxString const& word);
|
|
|
|
/// Correct the currently selected word
|
2007-04-14 17:26:46 +02:00
|
|
|
void Replace();
|
2007-04-14 03:02:21 +02:00
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
void OnChangeLanguage(wxCommandEvent&);
|
|
|
|
void OnChangeSuggestion(wxCommandEvent&);
|
2007-04-14 18:08:50 +02:00
|
|
|
|
2011-09-15 07:16:41 +02:00
|
|
|
void OnReplace(wxCommandEvent&);
|
|
|
|
void OnReplaceAll(wxCommandEvent&);
|
|
|
|
void OnIgnore(wxCommandEvent&);
|
|
|
|
void OnIgnoreAll(wxCommandEvent&);
|
|
|
|
void OnAdd(wxCommandEvent&);
|
|
|
|
void OnClose(wxCommandEvent&);
|
2007-04-14 03:02:21 +02:00
|
|
|
|
|
|
|
public:
|
2011-01-16 08:16:13 +01:00
|
|
|
DialogSpellChecker(agi::Context *context);
|
2007-04-14 17:26:46 +02:00
|
|
|
~DialogSpellChecker();
|
2007-04-14 03:02:21 +02:00
|
|
|
};
|