2007-04-14 03:02:21 +02:00
|
|
|
// Copyright (c) 2007, 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/
|
2007-04-14 03:02:21 +02:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file dialog_spellchecker.cpp
|
|
|
|
/// @brief Spell checker dialogue box, not used
|
|
|
|
/// @ingroup unused spelling
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
|
|
|
|
///////////
|
|
|
|
// Headers
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
2007-04-14 18:08:50 +02:00
|
|
|
#include <wx/intl.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ass_dialogue.h"
|
|
|
|
#include "ass_file.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "compat.h"
|
2007-04-14 03:02:21 +02:00
|
|
|
#include "dialog_spellchecker.h"
|
2007-04-14 17:26:46 +02:00
|
|
|
#include "frame_main.h"
|
2008-01-13 22:54:31 +01:00
|
|
|
#include "help_button.h"
|
2009-07-24 02:08:25 +02:00
|
|
|
#include "libresrc/libresrc.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "main.h"
|
2010-08-02 08:31:38 +02:00
|
|
|
#include "include/aegisub/spellchecker.h"
|
2010-12-08 04:36:10 +01:00
|
|
|
#include "selection_controller.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subs_edit_box.h"
|
2010-07-20 05:11:11 +02:00
|
|
|
#include "subs_edit_ctrl.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "subs_grid.h"
|
|
|
|
#include "utils.h"
|
2007-04-14 03:02:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
///////
|
|
|
|
// IDs
|
|
|
|
enum {
|
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
|
2007-04-14 03:02:21 +02:00
|
|
|
BUTTON_REPLACE = 1720,
|
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
|
2007-04-14 03:02:21 +02:00
|
|
|
BUTTON_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
|
|
|
|
|
|
|
/// DOCME
|
2007-04-14 03:02:21 +02:00
|
|
|
BUTTON_REPLACE_ALL,
|
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
|
2007-04-14 03:02:21 +02:00
|
|
|
BUTTON_IGNORE_ALL,
|
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
|
2007-04-14 18:08:50 +02:00
|
|
|
BUTTON_ADD,
|
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
|
2007-04-14 18:08:50 +02:00
|
|
|
LIST_SUGGESTIONS,
|
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
|
2007-04-14 18:08:50 +02:00
|
|
|
LIST_LANGUAGES
|
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
|
|
|
|
|
|
|
/// @brief Constructor
|
|
|
|
/// @param parent
|
|
|
|
/// @return
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
DialogSpellChecker::DialogSpellChecker(wxFrame *parent)
|
2007-04-14 18:08:50 +02:00
|
|
|
: wxDialog(parent, -1, _("Spell Checker"), wxDefaultPosition, wxDefaultSize)
|
2007-04-14 03:02:21 +02:00
|
|
|
{
|
2007-07-05 01:09:40 +02:00
|
|
|
// Set icon
|
2009-07-25 06:49:59 +02:00
|
|
|
SetIcon(BitmapToIcon(GETIMAGE(spellcheck_toolbutton_24)));
|
2007-07-05 01:09:40 +02:00
|
|
|
|
2007-04-14 18:08:50 +02:00
|
|
|
// Get spell checker
|
2010-08-02 08:31:38 +02:00
|
|
|
spellchecker = SpellCheckerFactory::GetSpellChecker();
|
2007-04-14 18:08:50 +02:00
|
|
|
if (!spellchecker) {
|
|
|
|
wxMessageBox(_T("No spellchecker available."),_T("Error"),wxICON_ERROR);
|
|
|
|
Destroy();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get languages
|
|
|
|
langCodes = spellchecker->GetLanguageList();
|
|
|
|
wxArrayString langNames;
|
|
|
|
const wxLanguageInfo *info;
|
|
|
|
for (size_t i=0;i<langCodes.Count();i++) {
|
|
|
|
wxString name;
|
|
|
|
info = wxLocale::FindLanguageInfo(langCodes[i]);
|
|
|
|
if (info) name = info->Description;
|
|
|
|
else name = langCodes[i];
|
|
|
|
langNames.Add(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get current language
|
2010-05-21 03:13:36 +02:00
|
|
|
wxString curLang = lagi_wxString(OPT_GET("Tool/Spell Checker/Language")->GetString());
|
2007-04-14 18:08:50 +02:00
|
|
|
int curLangPos = langCodes.Index(curLang);
|
|
|
|
if (curLangPos == wxNOT_FOUND) {
|
|
|
|
curLangPos = langCodes.Index(_T("en"));
|
|
|
|
if (curLangPos == wxNOT_FOUND) {
|
|
|
|
curLangPos = langCodes.Index(_T("en_US"));
|
|
|
|
if (curLangPos == wxNOT_FOUND) {
|
|
|
|
curLangPos = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-04-14 03:02:21 +02:00
|
|
|
// Top sizer
|
2007-07-05 17:23:31 +02:00
|
|
|
origWord = new wxTextCtrl(this,-1,_("original"),wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
|
|
|
|
replaceWord = new wxTextCtrl(this,-1,_("replace with"));
|
2007-04-14 03:02:21 +02:00
|
|
|
wxFlexGridSizer *topSizer = new wxFlexGridSizer(2,2,5,5);
|
|
|
|
topSizer->Add(new wxStaticText(this,-1,_("Misspelled word:")),0,wxALIGN_CENTER_VERTICAL);
|
|
|
|
topSizer->Add(origWord,1,wxEXPAND);
|
|
|
|
topSizer->Add(new wxStaticText(this,-1,_("Replace with:")),0,wxALIGN_CENTER_VERTICAL);
|
|
|
|
topSizer->Add(replaceWord,1,wxEXPAND);
|
|
|
|
topSizer->AddGrowableCol(1,1);
|
|
|
|
|
2008-01-16 02:01:40 +01:00
|
|
|
// List
|
|
|
|
suggestList = new wxListBox(this,LIST_SUGGESTIONS,wxDefaultPosition,wxSize(300,150));
|
|
|
|
|
2007-04-14 03:02:21 +02:00
|
|
|
// Actions sizer
|
|
|
|
wxSizer *actionsSizer = new wxBoxSizer(wxVERTICAL);
|
2008-01-13 22:54:31 +01:00
|
|
|
actionsSizer->Add(new wxButton(this,BUTTON_REPLACE,_("Replace")),0,wxEXPAND | wxBOTTOM,5);
|
|
|
|
actionsSizer->Add(new wxButton(this,BUTTON_REPLACE_ALL,_("Replace All")),0,wxEXPAND | wxBOTTOM,5);
|
|
|
|
actionsSizer->Add(new wxButton(this,BUTTON_IGNORE,_("Ignore")),0,wxEXPAND | wxBOTTOM,5);
|
|
|
|
actionsSizer->Add(new wxButton(this,BUTTON_IGNORE_ALL,_("Ignore all")),0,wxEXPAND | wxBOTTOM,5);
|
2010-01-19 02:05:51 +01:00
|
|
|
actionsSizer->Add(addButton = new wxButton(this,BUTTON_ADD,_("Add to dictionary")),0,wxEXPAND | wxBOTTOM,5);
|
2008-01-13 22:54:31 +01:00
|
|
|
actionsSizer->Add(new HelpButton(this,_T("Spell Checker")),0,wxEXPAND | wxBOTTOM,0);
|
|
|
|
actionsSizer->AddStretchSpacer(1);
|
2007-04-14 03:02:21 +02:00
|
|
|
|
|
|
|
// Bottom sizer
|
2007-04-14 18:08:50 +02:00
|
|
|
language = new wxComboBox(this,LIST_LANGUAGES,_T(""),wxDefaultPosition,wxDefaultSize,langNames,wxCB_DROPDOWN | wxCB_READONLY);
|
|
|
|
language->SetSelection(curLangPos);
|
|
|
|
wxFlexGridSizer *botSizer = new wxFlexGridSizer(2,2,5,5);
|
|
|
|
botSizer->Add(suggestList,1,wxEXPAND);
|
2008-01-13 22:54:31 +01:00
|
|
|
botSizer->Add(actionsSizer,1,wxEXPAND);
|
|
|
|
botSizer->Add(language,0,wxEXPAND);
|
|
|
|
botSizer->Add(new wxButton(this,wxID_CANCEL),0,wxEXPAND);
|
2007-04-14 18:08:50 +02:00
|
|
|
botSizer->AddGrowableCol(0,1);
|
2008-01-13 22:54:31 +01:00
|
|
|
botSizer->AddGrowableRow(0,1);
|
|
|
|
//SetEscapeId(wxID_CLOSE);
|
2007-04-14 03:02:21 +02:00
|
|
|
|
|
|
|
// Main sizer
|
|
|
|
wxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
mainSizer->Add(topSizer,0,wxEXPAND | wxALL,5);
|
2007-04-14 18:08:50 +02:00
|
|
|
mainSizer->Add(botSizer,1,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
|
2007-04-14 03:02:21 +02:00
|
|
|
SetSizer(mainSizer);
|
2008-01-13 22:54:31 +01:00
|
|
|
mainSizer->SetSizeHints(this);
|
2007-04-14 03:02:21 +02:00
|
|
|
CenterOnParent();
|
|
|
|
|
2007-04-14 18:08:50 +02:00
|
|
|
// Go to first match and show
|
|
|
|
if (GetFirstMatch()) ShowModal();
|
2007-04-14 17:26:46 +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 Destructor
|
|
|
|
///
|
2007-04-14 17:26:46 +02:00
|
|
|
DialogSpellChecker::~DialogSpellChecker() {
|
|
|
|
if (spellchecker) delete spellchecker;
|
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
|
|
|
|
|
|
|
/// @brief Find next match
|
|
|
|
/// @param startLine
|
|
|
|
/// @param startPos
|
|
|
|
/// @return
|
|
|
|
///
|
2007-04-14 17:26:46 +02:00
|
|
|
bool DialogSpellChecker::FindNext(int startLine,int startPos) {
|
|
|
|
// Set start
|
|
|
|
if (startLine != -1) lastLine = startLine;
|
|
|
|
if (startPos != -1) lastPos = 0;
|
|
|
|
|
|
|
|
// Get grid
|
2010-06-16 08:20:33 +02:00
|
|
|
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
|
2007-04-14 17:26:46 +02:00
|
|
|
int rows = grid->GetRows();
|
|
|
|
|
|
|
|
// Loop through lines
|
|
|
|
for (int i=lastLine;i<rows+firstLine;i++) {
|
|
|
|
startFindNextOuterLoop:
|
|
|
|
// Get dialogue
|
|
|
|
int curLine = i % rows;
|
|
|
|
AssDialogue *diag = grid->GetDialogue(curLine);
|
|
|
|
|
|
|
|
// Find list of words in it
|
|
|
|
IntPairVector results;
|
|
|
|
GetWordBoundaries(diag->Text,results);
|
|
|
|
|
|
|
|
// Look for spelling mistakes
|
|
|
|
for (size_t j=0;j<results.size();j++) {
|
|
|
|
// Get word
|
|
|
|
int s = results[j].first;
|
|
|
|
if (s < lastPos) continue;
|
|
|
|
int e = results[j].second;
|
|
|
|
wxString word = diag->Text.Mid(s,e-s);
|
|
|
|
|
|
|
|
// Check if it's on auto ignore
|
|
|
|
if (autoIgnore.Index(word) != wxNOT_FOUND) continue;
|
|
|
|
|
|
|
|
// Mistake
|
|
|
|
if (!spellchecker->CheckWord(word)) {
|
|
|
|
// Set word
|
|
|
|
wordStart = s;
|
|
|
|
wordEnd = e;
|
|
|
|
lastLine = i;
|
|
|
|
lastPos = e;
|
|
|
|
|
|
|
|
// Auto replace?
|
|
|
|
if (autoReplace.find(word) != autoReplace.end()) {
|
|
|
|
// lol mad h4x
|
|
|
|
replaceWord->SetValue(autoReplace[word]);
|
|
|
|
Replace();
|
|
|
|
goto startFindNextOuterLoop;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Proceed normally
|
|
|
|
SetWord(word);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Go to next
|
|
|
|
lastPos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// None found
|
|
|
|
return 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 Set word
|
|
|
|
/// @param word
|
|
|
|
///
|
2007-04-14 17:26:46 +02:00
|
|
|
void DialogSpellChecker::SetWord(wxString word) {
|
|
|
|
// Get list of suggestions
|
|
|
|
wxArrayString sugs = spellchecker->GetSuggestions(word);
|
|
|
|
|
|
|
|
// Set fields
|
|
|
|
origWord->SetValue(word);
|
|
|
|
replaceWord->SetValue((sugs.Count()>0)? sugs[0] : word);
|
|
|
|
|
|
|
|
// Set suggestions list
|
|
|
|
suggestList->Clear();
|
|
|
|
for (size_t i=0;i<sugs.Count();i++) suggestList->Append(sugs[i]);
|
2007-04-14 03:02:21 +02:00
|
|
|
|
2007-04-14 17:26:46 +02:00
|
|
|
// Show word on the main program interface
|
2010-06-16 08:20:33 +02:00
|
|
|
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
|
2007-04-14 17:26:46 +02:00
|
|
|
int line = lastLine % grid->GetRows();
|
|
|
|
grid->SelectRow(line,false);
|
|
|
|
grid->MakeCellVisible(line,0);
|
2010-06-26 13:32:16 +02:00
|
|
|
grid->SetActiveLine(grid->GetDialogue(line));
|
2007-04-14 17:26:46 +02:00
|
|
|
grid->editBox->TextEdit->SetSelectionU(wordStart,wordEnd);
|
|
|
|
grid->EndBatch();
|
2010-01-19 02:05:51 +01:00
|
|
|
|
|
|
|
addButton->Enable(spellchecker->CanAddWord(word));
|
2007-04-14 03:02:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////
|
|
|
|
// Event table
|
|
|
|
BEGIN_EVENT_TABLE(DialogSpellChecker,wxDialog)
|
2008-01-13 22:54:31 +01:00
|
|
|
EVT_BUTTON(wxID_CANCEL,DialogSpellChecker::OnClose)
|
2007-04-14 03:02:21 +02:00
|
|
|
EVT_BUTTON(BUTTON_REPLACE,DialogSpellChecker::OnReplace)
|
|
|
|
EVT_BUTTON(BUTTON_REPLACE_ALL,DialogSpellChecker::OnReplaceAll)
|
|
|
|
EVT_BUTTON(BUTTON_IGNORE,DialogSpellChecker::OnIgnore)
|
|
|
|
EVT_BUTTON(BUTTON_IGNORE_ALL,DialogSpellChecker::OnIgnoreAll)
|
|
|
|
EVT_BUTTON(BUTTON_ADD,DialogSpellChecker::OnAdd)
|
2007-04-14 18:08:50 +02:00
|
|
|
|
|
|
|
EVT_COMBOBOX(LIST_LANGUAGES,DialogSpellChecker::OnChangeLanguage)
|
|
|
|
EVT_LISTBOX(LIST_SUGGESTIONS,DialogSpellChecker::OnChangeSuggestion)
|
|
|
|
EVT_LISTBOX_DCLICK(LIST_SUGGESTIONS,DialogSpellChecker::OnTakeSuggestion)
|
2007-04-14 03:02:21 +02:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
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 Close
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
void DialogSpellChecker::OnClose(wxCommandEvent &event) {
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Replace
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
void DialogSpellChecker::OnReplace(wxCommandEvent &event) {
|
2007-04-14 17:26:46 +02:00
|
|
|
Replace();
|
|
|
|
FindOrDie();
|
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
|
|
|
|
|
|
|
/// @brief Replace all errors
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
void DialogSpellChecker::OnReplaceAll(wxCommandEvent &event) {
|
2007-04-14 17:26:46 +02:00
|
|
|
// Add word to autoreplace list
|
|
|
|
autoReplace[origWord->GetValue()] = replaceWord->GetValue();
|
|
|
|
|
|
|
|
// Replace
|
|
|
|
Replace();
|
|
|
|
FindOrDie();
|
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
|
|
|
|
|
|
|
/// @brief Ignore this error
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
void DialogSpellChecker::OnIgnore(wxCommandEvent &event) {
|
2007-04-14 17:26:46 +02:00
|
|
|
// Next
|
|
|
|
FindOrDie();
|
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
|
|
|
|
|
|
|
/// @brief Ignore all errors
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
void DialogSpellChecker::OnIgnoreAll(wxCommandEvent &event) {
|
2007-04-14 17:26:46 +02:00
|
|
|
// Add word to autoignore list
|
|
|
|
autoIgnore.Add(origWord->GetValue());
|
|
|
|
|
|
|
|
// Next
|
|
|
|
FindOrDie();
|
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
|
|
|
|
|
|
|
/// @brief Add to dictionary
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 03:02:21 +02:00
|
|
|
void DialogSpellChecker::OnAdd(wxCommandEvent &event) {
|
2007-04-14 17:26:46 +02:00
|
|
|
spellchecker->AddWord(origWord->GetValue());
|
|
|
|
FindOrDie();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Goes to next... if it can't find one, close
|
|
|
|
/// @return
|
|
|
|
///
|
2007-04-14 17:26:46 +02:00
|
|
|
bool DialogSpellChecker::FindOrDie() {
|
|
|
|
if (!FindNext()) {
|
|
|
|
wxMessageBox(_("Aegisub has finished checking spelling of this script."),_("Spell checking complete."));
|
|
|
|
Destroy();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return 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 Replace
|
|
|
|
///
|
2007-04-14 17:26:46 +02:00
|
|
|
void DialogSpellChecker::Replace() {
|
|
|
|
// Get dialog
|
2010-06-16 08:20:33 +02:00
|
|
|
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
|
2007-04-14 17:26:46 +02:00
|
|
|
AssDialogue *diag = grid->GetDialogue(lastLine % grid->GetRows());
|
|
|
|
|
|
|
|
// Replace
|
|
|
|
diag->Text = diag->Text.Left(wordStart) + replaceWord->GetValue() + diag->Text.Mid(wordEnd);
|
|
|
|
lastPos = wordStart + replaceWord->GetValue().Length();
|
|
|
|
|
|
|
|
// Commit
|
2010-12-07 20:09:28 +01:00
|
|
|
grid->ass->Commit(_("Spell check replace"), AssFile::COMMIT_TEXT);
|
2007-04-14 03:02:21 +02:00
|
|
|
}
|
2007-04-14 18:08:50 +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 Change language
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 18:08:50 +02:00
|
|
|
void DialogSpellChecker::OnChangeLanguage(wxCommandEvent &event) {
|
|
|
|
// Change language code
|
|
|
|
wxString code = langCodes[language->GetSelection()];
|
|
|
|
spellchecker->SetLanguage(code);
|
2010-05-21 03:13:36 +02:00
|
|
|
OPT_SET("Tool/Spell Checker/Language")->SetString(STD_STR(code));
|
2007-04-14 18:08:50 +02:00
|
|
|
|
|
|
|
// Go back to first match
|
|
|
|
GetFirstMatch();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Change suggestion
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 18:08:50 +02:00
|
|
|
void DialogSpellChecker::OnChangeSuggestion(wxCommandEvent &event) {
|
|
|
|
replaceWord->SetValue(suggestList->GetStringSelection());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Suggestion box double clicked
|
|
|
|
/// @param event
|
|
|
|
///
|
2007-04-14 18:08:50 +02:00
|
|
|
void DialogSpellChecker::OnTakeSuggestion(wxCommandEvent &event) {
|
|
|
|
// First line should be unnecessary due to event above, but you never know...
|
|
|
|
replaceWord->SetValue(suggestList->GetStringSelection());
|
|
|
|
Replace();
|
|
|
|
FindOrDie();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 First match
|
|
|
|
///
|
2007-04-14 18:08:50 +02:00
|
|
|
bool DialogSpellChecker::GetFirstMatch() {
|
|
|
|
// Get selection
|
2010-06-16 08:20:33 +02:00
|
|
|
SubtitlesGrid *grid = ((FrameMain*)GetParent())->SubsGrid;
|
2007-04-14 18:08:50 +02:00
|
|
|
wxArrayInt sel = grid->GetSelection();
|
|
|
|
firstLine = (sel.Count()>0) ? sel[0] : 0;
|
|
|
|
bool hasTypos = FindNext(firstLine,0);
|
|
|
|
|
|
|
|
// File is already OK
|
|
|
|
if (!hasTypos) {
|
|
|
|
wxMessageBox(_("Aegisub has found no spelling mistakes in this script."),_("Spell checking complete."));
|
|
|
|
Destroy();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// OK
|
|
|
|
return true;
|
|
|
|
}
|
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
|
|
|
|