Mercurial > hg > forks > UniversalIndentGUI
changeset 493:1a61b405be21
Corrected the read text length and some other smaller changes like window icon and menu checkability.
git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@733 59b1889a-e5ac-428c-b0c7-476e01d41282
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Mon, 16 Jun 2008 08:56:27 +0000 |
parents | 9b091f4bab8d |
children | 028b8e0c6139 |
files | src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.h |
diffstat | 2 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp Mon Jun 16 08:54:59 2008 +0000 +++ b/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp Mon Jun 16 08:56:27 2008 +0000 @@ -67,6 +67,8 @@ indentHandler = new IndentHandler( SettingsPaths::getIndenterPath(), SettingsPaths::getSettingsPath(), SettingsPaths::getTempPath(), 0); indentHandler->setWindowModality( Qt::ApplicationModal ); indentHandler->setWindowTitle("UniversalIndentGUI"); + indentHandler->setWindowIcon(QIcon(QString::fromUtf8(":/mainWindow/icon2.png"))); + indentHandler->setParameterChangedCallback( indentText ); //qapp.setActiveWindow(indentHandler); } @@ -93,6 +95,7 @@ case DLL_PROCESS_DETACH: { delete funcItem[0]._pShKey; + delete indentHandler; /* save settings */ saveSettings(); @@ -139,7 +142,7 @@ /*** * beNotification() * - * This function is called, if a notification in Scantilla/Notepad++ occurs + * This function is called, if a notification in Scintilla/Notepad++ occurs */ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode) { @@ -221,7 +224,18 @@ void aboutDlg(void) { - indentHandler->show(); + HMENU hMenu = ::GetMenu(nppData._nppHandle); + UINT state = ::GetMenuState(hMenu, funcItem[1]._cmdID, MF_BYCOMMAND); + + if ( state & MF_CHECKED ) { + indentHandler->hide(); + state = ::CheckMenuItem(hMenu, funcItem[1]._cmdID, MF_BYCOMMAND | MF_UNCHECKED); + } + else { + indentHandler->show(); + state = ::CheckMenuItem(hMenu, funcItem[1]._cmdID, MF_BYCOMMAND | MF_CHECKED); + } + } @@ -230,16 +244,17 @@ return (which == 0)?nppData._scintillaMainHandle:nppData._scintillaSecondHandle; }; + void indentText() { int currentEdit = 0; - const int maxLineLength = 2600; char *fullEditorText = NULL; - char wordsPerLineStr[maxLineLength]; // Get scintilla text edit window handle //::SendMessage(nppData._nppHandle, WM_GETCURRENTSCINTILLA, 0, (LPARAM)¤tEdit); int textLength = ::SendMessage(getCurrentHScintilla(currentEdit), SCI_GETTEXTLENGTH, 0, 0); + // Because the returned length is the index of the last character, increment the length. + textLength++; fullEditorText = new char[textLength];
--- a/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.h Mon Jun 16 08:54:59 2008 +0000 +++ b/src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.h Mon Jun 16 08:56:27 2008 +0000 @@ -35,11 +35,11 @@ /* ini file name */ -CONST TCHAR PLUGINTEMP_INI[] = _T("\\PluginManager.ini"); +CONST TCHAR PLUGINTEMP_INI[] = _T("\\UniversalIndentGUI.ini"); /* param names of ini file */ /* section */ -CONST TCHAR dlgTemp[] = _T("Plugin Template"); +CONST TCHAR dlgTemp[] = _T("UniversalIndentGUI"); /* keys of section */ CONST TCHAR Value1[] = _T("Value1"); CONST TCHAR Value2[] = _T("Value2");