⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spellcheckerdialog.h

📁 SpellChecker平写检测程序原代码,希望大家喜欢,他非常好用
💻 H
字号:
/*
This file is part of SpellChecker Plugin for Notepad++
Copyright (C)2006 Jens Lorenz <jens.plugin.npp@gmx.de>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/


#ifndef SPELLCHECKERDLG_H
#define SPELLCHECKERDLG_H

#include "PluginInterface.h"
#include "aspell.h"
#include "resource.h"
#include "StaticDialog.h"
#include <string>
#include <vector>
#include <algorithm>
#include <shlwapi.h>


using namespace std;


#define MAX_WORD    256

typedef enum RTHR {
    SC_STOP = FALSE,
    SC_NEXT = TRUE
};

typedef enum {
    EID_REPLACE,
    EID_LERN,
    EID_IGNORE,
    EID_CHANGE_LANG,
    EID_CANCEL,
    EID_MAX
} eEventId;



class SpellCheckerDialog : public StaticDialog
{
public:
	SpellCheckerDialog(void);
	~SpellCheckerDialog(void);

    void init(HINSTANCE hInst, NppData nppData, tSCProp *prop);

   	UINT doDialog(void);

    RTHR NotifyEvent(DWORD event);

protected:

	virtual BOOL CALLBACK run_dlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

	void InitialDialog(void);

	/* Aspell specific functions */
	BOOL FillLanguages(void);
	void UpdateLanguage(void);
	void FillSuggList(const AspellWordList *wl);

    void onSelSugg(void);

    RTHR NextMisspelling(void);
	RTHR CheckWord(bool showAspellError = true);

	void UpdateCheckerNextMisspelling(void);

    void CreateThreadResources(void);
    void DestroyThreadResources(void);

private:
	/* Handles */
	NppData					_nppData;
    BOOL                    _bUpdateNewEdit;

	/* handles of controls */
	HWND					_hStaticWord;
	HWND					_hNewEdit;
	HWND					_hSuggList;
	HWND					_hLang;

	tSCProp*				_pSCProp;

    /* for storing of selected word */
	AspellToken				_aspToken;

	/* parsing line start, end and current line */
	INT						_iStartLine;
	INT						_iCurLine;
	INT						_iLastLine;

	/* cursor positions */
    INT                     _iEndPos;
	INT						_iLineDiff;
    INT                     _iLineStartPos;
	INT						_iLineEndPos;

	/* buffer for spell suggestion and parsing of lines */
	LPTSTR					_pszLine;
	UINT					_uSizeLineBuf;
    TCHAR                   _szWord[MAX_WORD];

	/* Aspell members */
	BOOL					_bAspellIsWorking;
	AspellSpeller*	        _aspSpeller;
	AspellDocumentChecker*	_aspChecker;
};


#endif // SPELLCHECKERDLG_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -