# HG changeset patch # User thomas_-_s # Date 1213606587 0 # Node ID 1a61b405be21ddf3dd0641aa76ff7c58f51eb381 # Parent 9b091f4bab8dc4ff0f783a947d261c49e9b9a48c 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 diff -r 9b091f4bab8d -r 1a61b405be21 src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.cpp --- 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]; diff -r 9b091f4bab8d -r 1a61b405be21 src/UniversalIndentGUI_NPP/UniversalIndentGUI_NPP.h --- 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");