diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 714b5073..d765bd96 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -63,28 +63,28 @@ ToolBarButtonUnit toolBarIcons[] = { {IDM_FILE_CLOSE, IDI_CLOSE_OFF_ICON, IDI_CLOSE_ON_ICON, IDI_CLOSE_OFF_ICON, IDR_CLOSEFILE}, {IDM_FILE_CLOSEALL, IDI_CLOSEALL_OFF_ICON, IDI_CLOSEALL_ON_ICON, IDI_CLOSEALL_OFF_ICON, IDR_CLOSEALL}, {IDM_FILE_PRINTNOW, IDI_PRINT_OFF_ICON, IDI_PRINT_ON_ICON, IDI_PRINT_OFF_ICON, IDR_PRINT}, - + //-------------------------------------------------------------------------------------// {0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON}, //-------------------------------------------------------------------------------------// - + {IDM_EDIT_CUT, IDI_CUT_OFF_ICON, IDI_CUT_ON_ICON, IDI_CUT_DISABLE_ICON, IDR_CUT}, {IDM_EDIT_COPY, IDI_COPY_OFF_ICON, IDI_COPY_ON_ICON, IDI_COPY_DISABLE_ICON, IDR_COPY}, {IDM_EDIT_PASTE, IDI_PASTE_OFF_ICON, IDI_PASTE_ON_ICON, IDI_PASTE_DISABLE_ICON, IDR_PASTE}, - + //-------------------------------------------------------------------------------------// {0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON}, //-------------------------------------------------------------------------------------// - + {IDM_EDIT_UNDO, IDI_UNDO_OFF_ICON, IDI_UNDO_ON_ICON, IDI_UNDO_DISABLE_ICON, IDR_UNDO}, - {IDM_EDIT_REDO, IDI_REDO_OFF_ICON, IDI_REDO_ON_ICON, IDI_REDO_DISABLE_ICON, IDR_REDO}, + {IDM_EDIT_REDO, IDI_REDO_OFF_ICON, IDI_REDO_ON_ICON, IDI_REDO_DISABLE_ICON, IDR_REDO}, //-------------------------------------------------------------------------------------// {0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON}, //-------------------------------------------------------------------------------------// - + {IDM_SEARCH_FIND, IDI_FIND_OFF_ICON, IDI_FIND_ON_ICON, IDI_FIND_OFF_ICON, IDR_FIND}, {IDM_SEARCH_REPLACE, IDI_REPLACE_OFF_ICON, IDI_REPLACE_ON_ICON, IDI_REPLACE_OFF_ICON, IDR_REPLACE}, - + //-------------------------------------------------------------------------------------// {0, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON, IDI_SEPARATOR_ICON}, //-------------------------------------------------------------------------------------// @@ -114,7 +114,7 @@ ToolBarButtonUnit toolBarIcons[] = { {IDM_MACRO_PLAYBACKRECORDEDMACRO, IDI_PLAYRECORD_OFF_ICON, IDI_PLAYRECORD_ON_ICON, IDI_PLAYRECORD_DISABLE_ICON, IDR_PLAYRECORD}, {IDM_MACRO_RUNMULTIMACRODLG, IDI_MMPLAY_OFF_ICON, IDI_MMPLAY_ON_ICON, IDI_MMPLAY_DIS_ICON, IDR_M_PLAYRECORD}, {IDM_MACRO_SAVECURRENTMACRO, IDI_SAVERECORD_OFF_ICON, IDI_SAVERECORD_ON_ICON, IDI_SAVERECORD_DISABLE_ICON, IDR_SAVERECORD} - + }; @@ -128,7 +128,7 @@ Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(N _isFileOpening(false), _rememberThisSession(true), _pAnsiCharPanel(NULL), _pClipboardHistoryPanel(NULL) { ZeroMemory(&_prevSelectedRange, sizeof(_prevSelectedRange)); - + TiXmlDocumentA *nativeLangDocRootA = (NppParameters::getInstance())->getNativeLangA(); _nativeLangSpeaker.init(nativeLangDocRootA); @@ -140,11 +140,11 @@ Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(N localizationSwitcher.setFileName(fn); } #endif - + (NppParameters::getInstance())->setNativeLangSpeaker(&_nativeLangSpeaker); TiXmlDocument *toolIconsDocRoot = (NppParameters::getInstance())->getToolIcons(); - + if (toolIconsDocRoot) { _toolBar.initTheme(toolIconsDocRoot); @@ -153,7 +153,7 @@ Notepad_plus::Notepad_plus(): _mainWindowStatus(0), _pDocTab(NULL), _pEditView(N // ATTENTION : the order of the destruction is very important // because if the parent's window handle is destroyed before -// the destruction of its children windows' handles, +// the destruction of its children windows' handles, // its children windows' handles will be destroyed automatically! Notepad_plus::~Notepad_plus() { @@ -193,7 +193,7 @@ Notepad_plus::~Notepad_plus() -LRESULT Notepad_plus::init(HWND hwnd) +LRESULT Notepad_plus::init(HWND hwnd) { NppParameters *pNppParam = NppParameters::getInstance(); NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI(); @@ -218,7 +218,7 @@ LRESULT Notepad_plus::init(HWND hwnd) MainFileManager->init(this, &_fileEditView); //get it up and running asap. pNppParam->setFontList(hwnd); - + _mainWindowStatus = WindowMainActive; _activeView = MAIN_VIEW; @@ -247,13 +247,13 @@ LRESULT Notepad_plus::init(HWND hwnd) _mainEditView.showIndentGuideLine(svp1._indentGuideLineShow); _subEditView.showIndentGuideLine(svp1._indentGuideLineShow); - + ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETWIDTH, 0, 0); ::SendMessage(hwnd, NPPM_INTERNAL_SETCARETBLINKRATE, 0, 0); _configStyleDlg.init(_pPublicInterface->getHinst(), hwnd); _preference.init(_pPublicInterface->getHinst(), hwnd); - + //Marker Margin config _mainEditView.setMakerStyle(svp1._folderStyle); _subEditView.setMakerStyle(svp1._folderStyle); @@ -266,7 +266,7 @@ LRESULT Notepad_plus::init(HWND hwnd) _mainEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); _subEditView.execute(SCI_SETCARETLINEVISIBLE, svp1._currentLineHilitingShow); - + _mainEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true); _subEditView.execute(SCI_SETCARETLINEVISIBLEALWAYS, true); @@ -318,7 +318,7 @@ LRESULT Notepad_plus::init(HWND hwnd) } _mainDocTab.display(); - + TabBarPlus::doDragNDrop((tabBarStatus & TAB_DRAGNDROP) != 0); TabBarPlus::setDrawTopBar((tabBarStatus & TAB_DRAWTOPBAR) != 0); TabBarPlus::setDrawInactiveTab((tabBarStatus & TAB_DRAWINACTIVETAB) != 0); @@ -375,7 +375,7 @@ LRESULT Notepad_plus::init(HWND hwnd) _restoreButton.init(_pPublicInterface->getHinst(), hwnd); - + // ------------ // // Menu Section // @@ -526,10 +526,10 @@ LRESULT Notepad_plus::init(HWND hwnd) vector & shortcuts = pNppParam->getUserShortcuts(); len = shortcuts.size(); - for(size_t i = 0; i < len; i++) + for(size_t i = 0; i < len; i++) { CommandShortcut & csc = shortcuts[i]; - if (!csc.getName()[0]) + if (!csc.getName()[0]) { //no predefined name, get name from menu and use that ::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND); csc.setName(purgeMenuItemString(menuName, true).c_str()); @@ -544,7 +544,7 @@ LRESULT Notepad_plus::init(HWND hwnd) // Shortcut Accelerator : should be the last one since it will capture all the shortcuts _accelerator.init(_mainMenuHandle, hwnd); pNppParam->setAccelerator(&_accelerator); - + // Scintilla key accelerator vector scints; scints.push_back(_mainEditView.getHSelf()); @@ -560,7 +560,7 @@ LRESULT Notepad_plus::init(HWND hwnd) //-- Tool Bar Section --// toolBarStatusType tbStatus = nppGUI._toolBarStatus; willBeShown = nppGUI._toolbarShow; - + // To notify plugins that toolbar icons can be registered SCNotification scnN; scnN.nmhdr.code = NPPN_TBMODIFICATION; @@ -633,7 +633,7 @@ LRESULT Notepad_plus::init(HWND hwnd) { if (pdi._name == NPP_INTERNAL_FUCTION_STR) { - _internalFuncIDs.push_back(pdi._internalID); + _internalFuncIDs.push_back(pdi._internalID); } else { @@ -660,7 +660,7 @@ LRESULT Notepad_plus::init(HWND hwnd) -void Notepad_plus::killAllChildren() +void Notepad_plus::killAllChildren() { _toolBar.destroy(); _rebarTop.destroy(); @@ -705,7 +705,7 @@ bool Notepad_plus::saveGUIParams() UserDefineDialog *udd = _pEditView->getUserDefineDlg(); bool b = udd->isDocked(); nppGUI._userDefineDlgStatus = (b?UDD_DOCKED:0) | (udd->isVisible()?UDD_SHOW:0); - + // Save the position WINDOWPLACEMENT posInfo; @@ -744,14 +744,14 @@ bool Notepad_plus::saveProjectPanelsParams() return (NppParameters::getInstance())->writeProjectPanelsSettings(); } -void Notepad_plus::saveDockingParams() +void Notepad_plus::saveDockingParams() { NppGUI & nppGUI = (NppGUI &)(NppParameters::getInstance())->getNppGUI(); // Save the docking information nppGUI._dockingData._leftWidth = _dockingManager.getDockedContSize(CONT_LEFT); - nppGUI._dockingData._rightWidth = _dockingManager.getDockedContSize(CONT_RIGHT); - nppGUI._dockingData._topHeight = _dockingManager.getDockedContSize(CONT_TOP); + nppGUI._dockingData._rightWidth = _dockingManager.getDockedContSize(CONT_RIGHT); + nppGUI._dockingData._topHeight = _dockingManager.getDockedContSize(CONT_TOP); nppGUI._dockingData._bottomHight = _dockingManager.getDockedContSize(CONT_BOTTOM); // clear the conatainer tab information (active tab) @@ -874,7 +874,7 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const char data[blockSize]; int lenFile = fread(data, 1, blockSize, f); fclose(f); - + // Put data in _invisibleEditView _invisibleEditView.execute(SCI_CLEARALL); _invisibleEditView.execute(SCI_APPENDTEXT, lenFile, (LPARAM)data); @@ -884,16 +884,16 @@ int Notepad_plus::getHtmlXmlEncoding(const TCHAR *fileName) const if (langT == L_XML) { // find encoding by RegExpr - + const char *xmlHeaderRegExpr = ""; - + int startPos = 0; int endPos = lenFile-1; _invisibleEditView.execute(SCI_SETSEARCHFLAGS, SCFIND_REGEXP|SCFIND_POSIX); _invisibleEditView.execute(SCI_SETTARGETSTART, startPos); _invisibleEditView.execute(SCI_SETTARGETEND, endPos); - + int posFound = _invisibleEditView.execute(SCI_SEARCHINTARGET, strlen(xmlHeaderRegExpr), (LPARAM)xmlHeaderRegExpr); if (posFound != -1) { @@ -985,7 +985,7 @@ bool Notepad_plus::replaceAllFiles() { _invisibleEditView.execute(SCI_ENDUNDOACTION); } } - + if (_mainWindowStatus & WindowSubActive) { for (int i = 0 ; i < _subDocTab.nbItem() ; i++) @@ -1007,7 +1007,7 @@ bool Notepad_plus::replaceAllFiles() { _invisibleEditView.setCurrentBuffer(oldBuf); _pEditView = pOldView; - + if (nbTotal < 0) ::printStr(TEXT("The regular expression to search is formed badly")); else @@ -1018,7 +1018,7 @@ bool Notepad_plus::replaceAllFiles() { wsprintf(result, TEXT("%d occurrences replaced."), nbTotal); ::printStr(result); } - + return true; } @@ -1033,42 +1033,177 @@ bool Notepad_plus::matchInList(const TCHAR *fileName, const vectorexecute(SCI_GETTABWIDTH); - generic_string ws(tabWidth, ' '); + int docLength = int(_pEditView->execute(SCI_GETLENGTH)) + 1; + if (docLength < 2) + return; + int count = 0; + int column = 0; + int counter = 0; + int tabStop = tabWidth - 1; // remember, counting from zero ! + bool onlyLeading = false; + bool nonSpaceFound = false; - // tab2ws or ws2tab ? - if (tab2ws) + char * source = new char[docLength]; + if (source == NULL) + return; + _pEditView->execute(SCI_GETTEXT, docLength, (LPARAM)source); + + if (whichWay == tab2Space) { - blank2replace = ws; + // count how many tabs are there + for (const char * ch=source; *ch; ++ch) + { + if (*ch == '\t') + ++count; + } + if (count == 0) + { + delete [] source; + return; + } } - else + // allocate tabwidth-1 chars extra per tab, just to be safe + size_t newlen = docLength + count * (tabWidth - 1) + 1; + char * destination = new char[newlen]; + if (destination == NULL) { - blank2search= ws; + delete [] source; + return; + } + char * dest = destination; + + switch (whichWay) + { + case tab2Space: + { + // rip through each line in the file + for (const char * ch = source; *ch; ++ch) + { + if (*ch == '\t') + { + size_t insertTabs = tabWidth - (column % tabWidth); + for (size_t i = 0; i= 1) // counter is counted from 0, so counter >= max -1 + { + *dest++ = '\t'; + ch += counter; + column += counter + 1; + counter = 0; + nextChar = true; + break; + } + else if (*(ch+1) == ' ' || *(ch+1) == '\t') // if followed by space or TAB, convert even a single space to TAB + { + *dest++ = '\t'; + ch++; + column += 1; + counter = 0; + } + else // single space, don't convert it to TAB + { + *dest++ = *ch; + column += 1; + counter = 0; + nextChar = true; + break; + } + } + else + ++counter; + } + + if (nextChar == true) + { + nextChar = false; + continue; + } + + if (*ch == ' ' && *(ch + counter) == '\t') // spaces "absorbed" by a TAB on the right + { + *dest++ = '\t'; + ch += counter; + column = tabStop + 1; + tabStop += tabWidth; + counter = 0; + continue; + } + } + + if (onlyLeading == true && nonSpaceFound == false) + nonSpaceFound = true; + + if (*ch == '\n' || *ch == '\r') + { + *dest++ = *ch; + column = 0; + tabStop = tabWidth - 1; + nonSpaceFound = false; + } + else if (*ch == '\t') + { + *dest++ = *ch; + column = tabStop + 1; + tabStop += tabWidth; + counter = 0; + } + else + { + *dest++ = *ch; + ++column; + counter = 0; + + if (column > 0 && column % tabWidth == 0) + tabStop += tabWidth; + } + } + *dest = '\0'; + break; + } } - FindOption env; - env._str2Search = blank2search; - env._str4Replace = blank2replace; - env._searchType = FindRegex; - - // do the replacement - _pEditView->execute(SCI_BEGINUNDOACTION); - _findReplaceDlg.processAll(ProcessReplaceAll, &env, true); - - // if white space to TAB, we replace the remain white spaces by TAB - if (!tab2ws) - { - env._str2Search = TEXT(" +"); - _findReplaceDlg.processAll(ProcessReplaceAll, &env, true); - } + _pEditView->execute(SCI_BEGINUNDOACTION); + _pEditView->execute(SCI_SETTEXT, 0, (LPARAM)destination); _pEditView->execute(SCI_ENDUNDOACTION); + + // clean up + delete [] source; + delete [] destination; } void Notepad_plus::doTrim(trimOp whichPart) @@ -1100,7 +1235,7 @@ void Notepad_plus::getMatchedFileNames(const TCHAR *dir, const vectorgetHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break; BufferID id = MainFileManager->getBufferFromName(fileNames.at(i).c_str()); - if (id != BUFFER_INVALID) + if (id != BUFFER_INVALID) { dontClose = true; - } - else + } + else { id = MainFileManager->loadFile(fileNames.at(i).c_str()); dontClose = false; } - - if (id != BUFFER_INVALID) + + if (id != BUFFER_INVALID) { Buffer * pBuf = MainFileManager->getBufferByID(id); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); @@ -1242,7 +1377,7 @@ bool Notepad_plus::replaceInFiles() _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc); _invisibleEditView.setCurrentBuffer(oldBuf); _pEditView = pOldView; - + TCHAR msg[128]; wsprintf(msg, TEXT("%d occurences replaced"), nbTotal); printStr(msg); @@ -1289,23 +1424,23 @@ bool Notepad_plus::findInFiles() if (PeekMessage(&msg, _pPublicInterface->getHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break; BufferID id = MainFileManager->getBufferFromName(fileNames.at(i).c_str()); - if (id != BUFFER_INVALID) + if (id != BUFFER_INVALID) { dontClose = true; - } - else + } + else { id = MainFileManager->loadFile(fileNames.at(i).c_str()); dontClose = false; } - - if (id != BUFFER_INVALID) + + if (id != BUFFER_INVALID) { Buffer * pBuf = MainFileManager->getBufferByID(id); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); - + nbTotal += _findReplaceDlg.processAll(ProcessFindAll, FindReplaceDlg::_env, true, fileNames.at(i).c_str()); if (!dontClose) MainFileManager->closeBuffer(id, _pEditView); @@ -1319,11 +1454,11 @@ bool Notepad_plus::findInFiles() _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, oldDoc); _pEditView = pOldView; - + _findReplaceDlg.putFindResult(nbTotal); FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory(); - if (nbTotal && !findHistory._isDlgAlwaysVisible) + if (nbTotal && !findHistory._isDlgAlwaysVisible) _findReplaceDlg.display(false); return true; } @@ -1341,7 +1476,7 @@ bool Notepad_plus::findInOpenedFiles() const bool isEntireDoc = true; _findReplaceDlg.beginNewFilesSearch(); - + if (_mainWindowStatus & WindowMainActive) { for (int i = 0 ; i < _mainDocTab.nbItem() ; i++) @@ -1353,7 +1488,7 @@ bool Notepad_plus::findInOpenedFiles() nbTotal += _findReplaceDlg.processAll(ProcessFindAll, FindReplaceDlg::_env, isEntireDoc, pBuf->getFullPathName()); } } - + if (_mainWindowStatus & WindowSubActive) { for (int i = 0 ; i < _subDocTab.nbItem() ; i++) @@ -1391,7 +1526,7 @@ bool Notepad_plus::findInCurrentFile() const bool isEntireDoc = true; _findReplaceDlg.beginNewFilesSearch(); - + _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); int cp = _invisibleEditView.execute(SCI_GETCODEPAGE); _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); @@ -1405,7 +1540,7 @@ bool Notepad_plus::findInCurrentFile() _findReplaceDlg.putFindResult(nbTotal); FindHistory & findHistory = (NppParameters::getInstance())->getFindHistory(); - if (nbTotal && !findHistory._isDlgAlwaysVisible) + if (nbTotal && !findHistory._isDlgAlwaysVisible) _findReplaceDlg.display(false); return true; } @@ -1416,12 +1551,12 @@ void Notepad_plus::filePrint(bool showDialog) int startPos = int(_pEditView->execute(SCI_GETSELECTIONSTART)); int endPos = int(_pEditView->execute(SCI_GETSELECTIONEND)); - + printer.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), _pEditView, showDialog, startPos, endPos); printer.doPrint(); } -int Notepad_plus::doSaveOrNot(const TCHAR *fn) +int Notepad_plus::doSaveOrNot(const TCHAR *fn) { TCHAR pattern[64] = TEXT("Save file \"%s\" ?"); TCHAR phrase[512]; @@ -1429,7 +1564,7 @@ int Notepad_plus::doSaveOrNot(const TCHAR *fn) return doActionOrNot(TEXT("Save"), phrase, MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL); } -int Notepad_plus::doReloadOrNot(const TCHAR *fn, bool dirty) +int Notepad_plus::doReloadOrNot(const TCHAR *fn, bool dirty) { TCHAR* pattern = TEXT("%s\r\rThis file has been modified by another program.\rDo you want to reload it%s?"); TCHAR* lose_info_str = dirty ? TEXT(" and lose the changes made in Notepad++") : TEXT(""); @@ -1439,7 +1574,7 @@ int Notepad_plus::doReloadOrNot(const TCHAR *fn, bool dirty) return doActionOrNot(TEXT("Reload"), phrase, MB_YESNO | MB_APPLMODAL | icon); } -int Notepad_plus::doCloseOrNot(const TCHAR *fn) +int Notepad_plus::doCloseOrNot(const TCHAR *fn) { TCHAR pattern[128] = TEXT("The file \"%s\" doesn't exist anymore.\rKeep this file in editor?"); TCHAR phrase[512]; @@ -1447,7 +1582,7 @@ int Notepad_plus::doCloseOrNot(const TCHAR *fn) return doActionOrNot(TEXT("Keep non existing file"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); } -int Notepad_plus::doDeleteOrNot(const TCHAR *fn) +int Notepad_plus::doDeleteOrNot(const TCHAR *fn) { TCHAR pattern[128] = TEXT("The file \"%s\"\rwill be deleted from your disk and this document will be closed.\rContinue?"); TCHAR phrase[512]; @@ -1455,12 +1590,12 @@ int Notepad_plus::doDeleteOrNot(const TCHAR *fn) return doActionOrNot(TEXT("Delete file"), phrase, MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL); } -int Notepad_plus::doActionOrNot(const TCHAR *title, const TCHAR *displayText, int type) +int Notepad_plus::doActionOrNot(const TCHAR *title, const TCHAR *displayText, int type) { return ::MessageBox(_pPublicInterface->getHSelf(), displayText, title, type); } -void Notepad_plus::enableMenu(int cmdID, bool doEnable) const +void Notepad_plus::enableMenu(int cmdID, bool doEnable) const { int flag = doEnable?MF_ENABLED | MF_BYCOMMAND:MF_DISABLED | MF_GRAYED | MF_BYCOMMAND; ::EnableMenuItem(_mainMenuHandle, cmdID, flag); @@ -1478,12 +1613,13 @@ void Notepad_plus::enableCommand(int cmdID, bool doEnable, int which) const } } -void Notepad_plus::checkClipboard() +void Notepad_plus::checkClipboard() { bool hasSelection = (_pEditView->execute(SCI_GETSELECTIONSTART) != _pEditView->execute(SCI_GETSELECTIONEND)); bool canPaste = (_pEditView->execute(SCI_CANPASTE) != 0); - enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR); + enableCommand(IDM_EDIT_CUT, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_COPY, hasSelection, MENU | TOOLBAR); + enableCommand(IDM_EDIT_PASTE, canPaste, MENU | TOOLBAR); enableCommand(IDM_EDIT_DELETE, hasSelection, MENU | TOOLBAR); enableCommand(IDM_EDIT_UPPERCASE, hasSelection, MENU); @@ -1514,7 +1650,7 @@ void Notepad_plus::checkDocState() enableCommand(IDM_FILE_SAVEALL, isSeveralDirty, MENU | TOOLBAR); enableCommand(IDM_VIEW_GOTO_NEW_INSTANCE, !(isCurrentDirty || isCurrentUntitled), MENU); enableCommand(IDM_VIEW_LOAD_IN_NEW_INSTANCE, !(isCurrentDirty || isCurrentUntitled), MENU); - + bool isSysReadOnly = curBuf->getFileReadOnly(); if (isSysReadOnly) { @@ -1552,7 +1688,7 @@ void Notepad_plus::checkMacroState() enableCommand(IDM_MACRO_STOPRECORDINGMACRO, _recordingMacro, MENU | TOOLBAR); enableCommand(IDM_MACRO_PLAYBACKRECORDEDMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR); enableCommand(IDM_MACRO_SAVECURRENTMACRO, !_macro.empty() && !_recordingMacro, MENU | TOOLBAR); - + enableCommand(IDM_MACRO_RUNMULTIMACRODLG, (!_macro.empty() && !_recordingMacro) || !((NppParameters::getInstance())->getMacroList()).empty(), MENU | TOOLBAR); } @@ -1572,7 +1708,7 @@ void Notepad_plus::checkSyncState() enableCommand(IDM_VIEW_SYNSCROLLH, canDoSync, MENU | TOOLBAR); } -void Notepad_plus::checkLangsMenu(int id) const +void Notepad_plus::checkLangsMenu(int id) const { Buffer * curBuf = _pEditView->getCurrentBuffer(); if (id == -1) @@ -1611,7 +1747,7 @@ generic_string Notepad_plus::getLangDesc(LangType langType, bool getName) return generic_string(elc._name); else return generic_string(elc._desc); - } + } if (langType > L_EXTERNAL) langType = L_TEXT; @@ -1634,7 +1770,7 @@ generic_string Notepad_plus::getLangDesc(LangType langType, bool getName) return str2Show; } -void Notepad_plus::copyMarkedLines() +void Notepad_plus::copyMarkedLines() { int lastLine = _pEditView->lastZeroBasedLineNumber(); generic_string globalStr = TEXT(""); @@ -1702,7 +1838,7 @@ void Notepad_plus::pasteToMarkedLines() generic_string clipboardStr = (const TCHAR *)clipboardDataPtr; - ::GlobalUnlock(clipboardData); + ::GlobalUnlock(clipboardData); ::CloseClipboard(); _pEditView->execute(SCI_BEGINUNDOACTION); @@ -1716,11 +1852,11 @@ void Notepad_plus::pasteToMarkedLines() _pEditView->execute(SCI_ENDUNDOACTION); } -void Notepad_plus::deleteMarkedline(int ln) +void Notepad_plus::deleteMarkedline(int ln) { int lineLen = _pEditView->execute(SCI_LINELENGTH, ln); int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); - + bookmarkDelete(ln); TCHAR emptyString[2] = TEXT(""); _pEditView->replaceTarget(emptyString, lineBegin, lineBegin + lineLen); @@ -1742,7 +1878,7 @@ void Notepad_plus::inverseMarks() } } -void Notepad_plus::replaceMarkedline(int ln, const TCHAR *str) +void Notepad_plus::replaceMarkedline(int ln, const TCHAR *str) { int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); int lineEnd = _pEditView->execute(SCI_GETLINEENDPOSITION, ln); @@ -1750,7 +1886,7 @@ void Notepad_plus::replaceMarkedline(int ln, const TCHAR *str) _pEditView->replaceTarget(str, lineBegin, lineEnd); } -generic_string Notepad_plus::getMarkedLine(int ln) +generic_string Notepad_plus::getMarkedLine(int ln) { int lineLen = _pEditView->execute(SCI_LINELENGTH, ln); int lineBegin = _pEditView->execute(SCI_POSITIONFROMLINE, ln); @@ -1772,7 +1908,7 @@ void Notepad_plus::findMatchingBracePos(int & braceAtCaret, int & braceOpposite) int lengthDoc = int(_pEditView->execute(SCI_GETLENGTH)); - if ((lengthDoc > 0) && (caretPos > 0)) + if ((lengthDoc > 0) && (caretPos > 0)) { charBefore = TCHAR(_pEditView->execute(SCI_GETCHARAT, caretPos - 1, 0)); } @@ -1782,7 +1918,7 @@ void Notepad_plus::findMatchingBracePos(int & braceAtCaret, int & braceOpposite) braceAtCaret = caretPos - 1; } - if (lengthDoc > 0 && (braceAtCaret < 0)) + if (lengthDoc > 0 && (braceAtCaret < 0)) { // No brace found so check other side TCHAR charAfter = TCHAR(_pEditView->execute(SCI_GETCHARAT, caretPos, 0)); @@ -1791,12 +1927,12 @@ void Notepad_plus::findMatchingBracePos(int & braceAtCaret, int & braceOpposite) braceAtCaret = caretPos; } } - if (braceAtCaret >= 0) + if (braceAtCaret >= 0) braceOpposite = int(_pEditView->execute(SCI_BRACEMATCH, braceAtCaret, 0)); } // return true if 1 or 2 (matched) brace(s) is found -bool Notepad_plus::braceMatch() +bool Notepad_plus::braceMatch() { int braceAtCaret = -1; int braceOpposite = -1; @@ -1806,8 +1942,8 @@ bool Notepad_plus::braceMatch() { _pEditView->execute(SCI_BRACEBADLIGHT, braceAtCaret); _pEditView->execute(SCI_SETHIGHLIGHTGUIDE, 0); - } - else + } + else { _pEditView->execute(SCI_BRACEHIGHLIGHT, braceAtCaret, braceOpposite); @@ -1908,7 +2044,7 @@ void Notepad_plus::addHotSpot(bool docIsModifing) if ((ch == 0x0A) || (ch == 0x0D)) { int eolMode = _pEditView->execute(SCI_GETEOLMODE); - + if ((eolMode == SC_EOL_CRLF) && (posBegin2style > 1)) posBegin2style -= 2; else if (posBegin2style > 0) @@ -1921,7 +2057,7 @@ void Notepad_plus::addHotSpot(bool docIsModifing) ch = (UCHAR)_pEditView->execute(SCI_GETCHARAT, posBegin2style--); } } - + int startPos = 0, endPos = -1; _pEditView->getVisibleStartAndEndPosition(&startPos, &endPos); @@ -1972,7 +2108,7 @@ void Notepad_plus::addHotSpot(bool docIsModifing) char fontNameA[128]; Style hotspotStyle; - + hotspotStyle._styleID = style_hotspot; _pEditView->execute(SCI_STYLEGETFONT, idStyle, (LPARAM)fontNameA); TCHAR *generic_fontname = new TCHAR[128]; @@ -2006,13 +2142,13 @@ void Notepad_plus::addHotSpot(bool docIsModifing) _pEditView->execute(SCI_STARTSTYLING, start, 0x1F); _pEditView->execute(SCI_SETSTYLING, foundTextLen, style_hotspot); if (style_hotspot > 1) - style_hotspot--; + style_hotspot--; } } _pEditView->execute(SCI_SETTARGETSTART, posFound + foundTextLen); _pEditView->execute(SCI_SETTARGETEND, endPos); - + posFound = _pEditView->execute(SCI_SEARCHINTARGET, strlen(URL_REG_EXPR), (LPARAM)URL_REG_EXPR); } @@ -2030,7 +2166,7 @@ void Notepad_plus::MaintainIndentation(TCHAR ch) int indentAmount = 0; if (((eolMode == SC_EOL_CRLF || eolMode == SC_EOL_LF) && ch == '\n') || - (eolMode == SC_EOL_CR && ch == '\r')) + (eolMode == SC_EOL_CR && ch == '\r')) { while (lastLine >= 0 && _pEditView->getLineLength(lastLine) == 0) lastLine--; @@ -2045,7 +2181,7 @@ void Notepad_plus::MaintainIndentation(TCHAR ch) } void Notepad_plus::specialCmd(int id) -{ +{ NppParameters *pNppParam = NppParameters::getInstance(); switch (id) @@ -2088,7 +2224,7 @@ void Notepad_plus::specialCmd(int id) _subEditView.setMakerStyle(fStyle); break; } - + case IDM_VIEW_CURLINE_HILITING: { COLORREF colour = pNppParam->getCurLineHilitingColour(); @@ -2096,7 +2232,7 @@ void Notepad_plus::specialCmd(int id) _subEditView.setCurrentLineHiLiting(!_pEditView->isCurrentLineHiLiting(), colour); break; } - + case IDM_VIEW_EDGEBACKGROUND: case IDM_VIEW_EDGELINE: case IDM_VIEW_EDGENONE: @@ -2266,7 +2402,7 @@ enum LangType Notepad_plus::menuID2LangType(int cmdID) case IDM_LANG_INNO : return L_INNO; case IDM_LANG_CMAKE : - return L_CMAKE; + return L_CMAKE; case IDM_LANG_YAML : return L_YAML; case IDM_LANG_COBOL : @@ -2318,7 +2454,7 @@ void Notepad_plus::setTitle() ::SendMessage(_pPublicInterface->getHSelf(), WM_SETTEXT, 0, (LPARAM)result.c_str()); } -void Notepad_plus::activateNextDoc(bool direction) +void Notepad_plus::activateNextDoc(bool direction) { int nbDoc = _pDocTab->nbItem(); @@ -2384,7 +2520,7 @@ size_t Notepad_plus::getSelectedCharNumber(UniMode u) for (size_t pos = stpos; pos < endpos; pos++) { unsigned char c = 0xf0 & (unsigned char)_pEditView->execute(SCI_GETCHARAT, pos); - if (c >= 0xc0) + if (c >= 0xc0) pos += utflen[(c & 0x30) >> 4]; result++; } @@ -2519,7 +2655,7 @@ int Notepad_plus::wordCount() } -void Notepad_plus::updateStatusBar() +void Notepad_plus::updateStatusBar() { TCHAR strLnCol[128]; TCHAR strSel[64]; @@ -2543,7 +2679,7 @@ void Notepad_plus::updateStatusBar() _statusBar.setText(_pEditView->execute(SCI_GETOVERTYPE) ? TEXT("OVR") : TEXT("INS"), STATUSBAR_TYPING_MODE); } -void Notepad_plus::dropFiles(HDROP hdrop) +void Notepad_plus::dropFiles(HDROP hdrop) { if (hdrop) { @@ -2651,7 +2787,7 @@ void Notepad_plus::hideView(int whichOne) } else // otherwise the main window is the spltter container that we just created _pMainWindow = windowToSet; - + _subSplitter.display(false); //hide splitter //hide scintilla and doctab if (whichOne == MAIN_VIEW) { @@ -2729,9 +2865,9 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) int index = tabToClose->getIndexByBuffer(id); if (index == -1) //doesn't exist, done return false; - + Buffer * buf = MainFileManager->getBufferByID(id); - + //Cannot close doc if last and clean if (tabToClose->nbItem() == 1) { @@ -2776,7 +2912,7 @@ bool Notepad_plus::removeBufferFromView(BufferID id, int whichOne) return true; } -int Notepad_plus::switchEditViewTo(int gid) +int Notepad_plus::switchEditViewTo(int gid) { if (currentView() == gid) { //make sure focus is ok, then leave _pEditView->getFocus(); //set the focus @@ -2827,7 +2963,7 @@ void Notepad_plus::dockUserDlg() if (bothActive()) _pMainSplitter->setWin0(&_subSplitter); - else + else _pMainSplitter->setWin0(_pDocTab); _pMainSplitter->display(); @@ -2847,11 +2983,11 @@ void Notepad_plus::undockUserDlg() _pMainWindow = &_subSplitter; else _pMainWindow = _pDocTab; - + ::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0); _mainWindowStatus &= ~WindowUserActive; - (ScintillaEditView::getUserDefineDlg())->display(); + (ScintillaEditView::getUserDefineDlg())->display(); } void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y) @@ -2871,7 +3007,7 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y) TCHAR pX[10], pY[10]; generic_itoa(x, pX, 10); generic_itoa(y, pY, 10); - + command += pX; command += TEXT(" -y"); command += pY; @@ -2938,7 +3074,7 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode) } //Close the document if we transfered the document instead of cloning it - if (mode == TransferMove) + if (mode == TransferMove) { //just close the activate document, since thats the one we moved (no search) doClose(_pEditView->getCurrentBufferID(), currentView()); @@ -2977,7 +3113,7 @@ bool Notepad_plus::activateBuffer(BufferID id, int whichOne) return false; } - if (reload) + if (reload) { performPostReload(whichOne); } @@ -2998,16 +3134,16 @@ void Notepad_plus::performPostReload(int whichOne) { _mainEditView.execute(SCI_GOTOLINE, _mainEditView.execute(SCI_GETLINECOUNT) -1); } else { _subEditView.execute(SCI_GOTOLINE, _subEditView.execute(SCI_GETLINECOUNT) -1); - } + } } -void Notepad_plus::bookmarkNext(bool forwardScan) +void Notepad_plus::bookmarkNext(bool forwardScan) { int lineno = _pEditView->getCurrentLineNumber(); int sci_marker = SCI_MARKERNEXT; int lineStart = lineno + 1; //Scan starting from next line int lineRetry = 0; //If not found, try from the beginning - if (!forwardScan) + if (!forwardScan) { lineStart = lineno - 1; //Scan starting from previous line lineRetry = int(_pEditView->execute(SCI_GETLINECOUNT)); //If not found, try from the end @@ -3024,7 +3160,7 @@ void Notepad_plus::bookmarkNext(bool forwardScan) _pEditView->execute(SCI_GOTOLINE, nextLine); } -void Notepad_plus::staticCheckMenuAndTB() const +void Notepad_plus::staticCheckMenuAndTB() const { // Visibility of invisible characters bool wsTabShow = _pEditView->isInvisibleCharsShown(); @@ -3048,13 +3184,13 @@ void Notepad_plus::staticCheckMenuAndTB() const { onlyEOL = true; } - + checkMenuItem(IDM_VIEW_TAB_SPACE, onlyWS); checkMenuItem(IDM_VIEW_EOL, onlyEOL); checkMenuItem(IDM_VIEW_ALL_CHARACTERS, bothWSEOL); _toolBar.setCheck(IDM_VIEW_ALL_CHARACTERS, bothWSEOL); - // Visibility of the indentation guide line + // Visibility of the indentation guide line bool b = _pEditView->isShownIndentGuide(); checkMenuItem(IDM_VIEW_INDENT_GUIDE, b); _toolBar.setCheck(IDM_VIEW_INDENT_GUIDE, b); @@ -3067,21 +3203,21 @@ void Notepad_plus::staticCheckMenuAndTB() const checkMenuItem(IDM_VIEW_WRAP_SYMBOL, _pEditView->isWrapSymbolVisible()); } -void Notepad_plus::dynamicCheckMenuAndTB() const +void Notepad_plus::dynamicCheckMenuAndTB() const { //Format conversion enableConvertMenuItems(_pEditView->getCurrentBuffer()->getFormat()); checkUnicodeMenuItems(); } -void Notepad_plus::enableConvertMenuItems(formatType f) const +void Notepad_plus::enableConvertMenuItems(formatType f) const { enableCommand(IDM_FORMAT_TODOS, (f != WIN_FORMAT), MENU); enableCommand(IDM_FORMAT_TOUNIX, (f != UNIX_FORMAT), MENU); enableCommand(IDM_FORMAT_TOMAC, (f != MAC_FORMAT), MENU); } -void Notepad_plus::checkUnicodeMenuItems() const +void Notepad_plus::checkUnicodeMenuItems() const { Buffer *buf = _pEditView->getCurrentBuffer(); UniMode um = buf->getUnicodeMode(); @@ -3128,7 +3264,7 @@ void Notepad_plus::checkUnicodeMenuItems() const // Uncheck all in the main encoding menu ::CheckMenuRadioItem(_mainMenuHandle, IDM_FORMAT_ANSI, IDM_FORMAT_AS_UTF_8, IDM_FORMAT_ANSI, MF_BYCOMMAND); ::CheckMenuItem(_mainMenuHandle, IDM_FORMAT_ANSI, MF_UNCHECKED | MF_BYCOMMAND); - + // Check the encoding item ::CheckMenuRadioItem(_mainMenuHandle, IDM_FORMAT_ENCODE, IDM_FORMAT_ENCODE_END, cmdID, MF_BYCOMMAND); } @@ -3208,7 +3344,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) generic_string comment(commentLineSybol); comment += TEXT(" "); - + const int linebufferSize = 1024; TCHAR linebuf[linebufferSize]; size_t comment_length = comment.length(); @@ -3226,7 +3362,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) selEndLine--; _pEditView->execute(SCI_BEGINUNDOACTION); - for (int i = selStartLine; i <= selEndLine; i++) + for (int i = selStartLine; i <= selEndLine; i++) { int lineStart = _pEditView->execute(SCI_POSITIONFROMLINE, i); int lineIndent = lineStart; @@ -3236,7 +3372,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) lineIndent = _pEditView->execute(SCI_GETLINEINDENTPOSITION, i); _pEditView->getGenericText(linebuf, linebufferSize, lineIndent, lineEnd); - + generic_string linebufStr = linebuf; // empty lines are not commented @@ -3247,10 +3383,10 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) if (linebufStr.substr(0, comment_length - 1) == comment.substr(0, comment_length - 1)) { int len = (linebufStr.substr(0, comment_length) == comment)?comment_length:comment_length - 1; - + _pEditView->execute(SCI_SETSEL, lineIndent, lineIndent + len); _pEditView->replaceSelWith(""); - + if (i == selStartLine) // is this the first selected line? selectionStart -= len; selectionEnd -= len; // every iteration @@ -3274,13 +3410,13 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode) selectionEnd = firstSelLineStart; selectionStart = firstSelLineStart; } - if (move_caret) + if (move_caret) { // moving caret to the beginning of selected block _pEditView->execute(SCI_GOTOPOS, selectionEnd); _pEditView->execute(SCI_SETCURRENTPOS, selectionStart); } - else + else { _pEditView->execute(SCI_SETSEL, selectionStart, selectionEnd); } @@ -3360,7 +3496,7 @@ bool Notepad_plus::doStreamComment() return true; } -bool Notepad_plus::saveScintillaParams() +bool Notepad_plus::saveScintillaParams() { NppParameters * pNppParam = NppParameters::getInstance(); ScintillaViewParams & svp = (ScintillaViewParams &)pNppParam->getSVP(); @@ -3372,7 +3508,7 @@ bool Notepad_plus::saveScintillaParams() bool Notepad_plus::addCurrentMacro() { vector & theMacros = (NppParameters::getInstance())->getMacroList(); - + int nbMacro = theMacros.size(); int cmdID = ID_MACRO + nbMacro; @@ -3383,7 +3519,7 @@ bool Notepad_plus::addCurrentMacro() { HMENU hMacroMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_MACRO); int const posBase = 6; //separator at index 5 - if (nbMacro == 0) + if (nbMacro == 0) { ::InsertMenu(hMacroMenu, posBase-1, MF_BYPOSITION, (unsigned int)-1, 0); //no separator yet, add one @@ -3394,7 +3530,7 @@ bool Notepad_plus::addCurrentMacro() generic_string nativeLangShortcutMapperMacro = pNativeLangSpeaker->getNativeLangMenuString(IDM_SETTING_SHORTCUT_MAPPER_MACRO); if (nativeLangShortcutMapperMacro == TEXT("")) nativeLangShortcutMapperMacro = TEXT("Modify Shortcut/Delete Macro..."); - + ::InsertMenu(hMacroMenu, posBase + nbMacro + 2, MF_BYCOMMAND, IDM_SETTING_SHORTCUT_MAPPER_MACRO, nativeLangShortcutMapperMacro.c_str()); } theMacros.push_back(ms); @@ -3439,7 +3575,7 @@ void Notepad_plus::getTaskListInfo(TaskListInfo *tli) { size_t currentNbDoc = _pDocTab->nbItem(); size_t nonCurrentNbDoc = _pNonDocTab->nbItem(); - + tli->_currentIndex = 0; if (!viewVisible(otherView())) @@ -3492,7 +3628,7 @@ bool Notepad_plus::goToPreviousIndicator(int indicID2Search, bool isWrap) const if (!isWrap) return false; posStart = _pEditView->execute(SCI_INDICATORSTART, indicID2Search, docLen - 1); - } + } } int newPos = posStart - 1; @@ -3557,7 +3693,7 @@ bool Notepad_plus::goToNextIndicator(int indicID2Search, bool isWrap) const { NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI()); nppGUI._disableSmartHiliteTmp = true; - + int currentline = _pEditView->execute(SCI_LINEFROMPOSITION, posEnd); _pEditView->execute(SCI_ENSUREVISIBLE, currentline); // make sure target line is unfolded @@ -3579,9 +3715,9 @@ void Notepad_plus::fullScreenToggle() //Preset view area, in case something fails, primary monitor values fullscreenArea.top = 0; fullscreenArea.left = 0; - fullscreenArea.right = GetSystemMetrics(SM_CXSCREEN); + fullscreenArea.right = GetSystemMetrics(SM_CXSCREEN); fullscreenArea.bottom = GetSystemMetrics(SM_CYSCREEN); - + //if (_winVersion != WV_NT) { HMONITOR currentMonitor; //Handle to monitor where fullscreen should go @@ -3627,7 +3763,7 @@ void Notepad_plus::fullScreenToggle() _beforeSpecialView.preStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN; } } - + //Set fullscreen window, highest non-top z-order, show the window and redraw it (refreshing the windowmanager cache aswell) ::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW); ::SetWindowPos(_pPublicInterface->getHSelf(), HWND_TOP, fullscreenArea.left, fullscreenArea.top, fullscreenArea.right, fullscreenArea.bottom, SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED); @@ -3646,7 +3782,7 @@ void Notepad_plus::fullScreenToggle() int x = nppRect.right - w; int y = nppRect.top; ::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE); - + _pEditView->getFocus(); } else //toggle fullscreen off @@ -3736,7 +3872,7 @@ void Notepad_plus::postItToggle() int bs = buttonStatus_postit; if (_beforeSpecialView.isFullScreen) { - bs |= buttonStatus_fullscreen; + bs |= buttonStatus_fullscreen; } else { @@ -3765,7 +3901,7 @@ void Notepad_plus::postItToggle() ::SetWindowPos(_pPublicInterface->getHSelf(), HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED); ::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW); } - + // show restore button _restoreButton.doDialog(_nativeLangSpeaker.isRTL()); @@ -3779,7 +3915,7 @@ void Notepad_plus::postItToggle() int x = nppRect.right - w - w; int y = nppRect.top + 1; ::MoveWindow(_restoreButton.getHSelf(), x, y, w, h, FALSE); - + _pEditView->getFocus(); } else //PostIt enabled, disable it @@ -3812,11 +3948,11 @@ void Notepad_plus::postItToggle() //dwStyle |= (WS_CAPTION | WS_SIZEBOX); ::ShowWindow(_pPublicInterface->getHSelf(), SW_HIDE); ::SetWindowLongPtr(_pPublicInterface->getHSelf(), GWL_STYLE, _beforeSpecialView.preStyle); - + //Redraw the window and refresh windowmanager cache, dont do anything else, sizing is done later on ::SetWindowPos(_pPublicInterface->getHSelf(), HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_DRAWFRAME|SWP_FRAMECHANGED); ::ShowWindow(_pPublicInterface->getHSelf(), SW_SHOW); - } + } } _beforeSpecialView.isPostIt = !_beforeSpecialView.isPostIt; @@ -3838,7 +3974,7 @@ void Notepad_plus::doSynScorll(HWND whichView) int mainColumn, subColumn; if (whichView == _mainEditView.getHSelf()) - { + { if (_syncInfo._isSynScollV) { // Compute for Line @@ -4016,22 +4152,22 @@ bool Notepad_plus::str2Cliboard(const TCHAR *str2cpy) #endif HGLOBAL hglbCopy = ::GlobalAlloc(GMEM_MOVEABLE, len2Allocate); - if (hglbCopy == NULL) - { - return false; - } - - if (!::OpenClipboard(_pPublicInterface->getHSelf())) - return false; - + if (hglbCopy == NULL) + { + return false; + } + + if (!::OpenClipboard(_pPublicInterface->getHSelf())) + return false; + ::EmptyClipboard(); - // Lock the handle and copy the text to the buffer. + // Lock the handle and copy the text to the buffer. TCHAR *pStr = (TCHAR *)::GlobalLock(hglbCopy); lstrcpy(pStr, str2cpy); - ::GlobalUnlock(hglbCopy); + ::GlobalUnlock(hglbCopy); - // Place the handle on the clipboard. + // Place the handle on the clipboard. ::SetClipboardData(cilpboardFormat, hglbCopy); ::CloseClipboard(); return true; @@ -4039,7 +4175,7 @@ bool Notepad_plus::str2Cliboard(const TCHAR *str2cpy) //ONLY CALL IN CASE OF EMERGENCY: EXCEPTION //This function is destructive -bool Notepad_plus::emergency(generic_string emergencySavedDir) +bool Notepad_plus::emergency(generic_string emergencySavedDir) { ::CreateDirectory(emergencySavedDir.c_str(), NULL); return dumpFiles(emergencySavedDir.c_str(), TEXT("File")); @@ -4091,7 +4227,7 @@ void Notepad_plus::drawTabbarColoursFromStylerArray() TabBarPlus::setColour(stInact->_bgColor, TabBarPlus::inactiveBg); } -void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) +void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) { // To avoid to crash while MS-DOS style is set as default language, // Checking the validity of current instance is necessary. @@ -4109,10 +4245,10 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) bool subActive = (_subEditView.getCurrentBuffer() == buffer); //Only event that applies to non-active Buffers - if (mask & BufferChangeStatus) + if (mask & BufferChangeStatus) { //reload etc bool didDialog = false; - switch(buffer->getStatus()) + switch(buffer->getStatus()) { case DOC_UNNAMED: //nothing todo { @@ -4120,7 +4256,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) } case DOC_REGULAR: //nothing todo { - break; + break; } case DOC_MODIFIED: //ask for reloading { @@ -4179,7 +4315,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) if (mask & (BufferChangeReadonly)) { checkDocState(); - + bool isSysReadOnly = buffer->getFileReadOnly(); bool isUserReadOnly = buffer->getUserReadOnly(); bool isDirty = buffer->isDirty(); @@ -4215,7 +4351,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) if ((currentView() == SUB_VIEW) && !subActive) return; - if (mask & (BufferChangeDirty|BufferChangeFilename)) + if (mask & (BufferChangeDirty|BufferChangeFilename)) { checkDocState(); setTitle(); @@ -4224,7 +4360,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) setWorkingDir(dir.c_str()); } - if (mask & (BufferChangeLanguage)) + if (mask & (BufferChangeLanguage)) { checkLangsMenu(-1); //let N++ do search for the item setLangStatus(buffer->getLangType()); @@ -4232,7 +4368,7 @@ void Notepad_plus::notifyBufferChanged(Buffer * buffer, int mask) _autoCompleteMain.setLanguage(buffer->getLangType()); else if (_subEditView.getCurrentBuffer() == buffer) _autoCompleteSub.setLanguage(buffer->getLangType()); - + SCNotification scnN; scnN.nmhdr.code = NPPN_LANGCHANGED; scnN.nmhdr.hwndFrom = _pPublicInterface->getHSelf(); @@ -4255,7 +4391,7 @@ void Notepad_plus::notifyBufferActivated(BufferID bufid, int view) Buffer * buf = MainFileManager->getBufferByID(bufid); buf->increaseRecentTag(); - if (view == MAIN_VIEW) + if (view == MAIN_VIEW) { _autoCompleteMain.setLanguage(buf->getLangType()); } @@ -4310,7 +4446,7 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam FileNameStringSplitter fnss(commandLine); const TCHAR *pFn = NULL; - + LangType lt = pCmdParams->_langType;//LangType(pCopyData->dwData & LASTBYTEMASK); int ln = pCmdParams->_line2go; int cn = pCmdParams->_column2go; @@ -4333,7 +4469,7 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam pBuf->setLangType(lt); } - if (ln != -1) + if (ln != -1) { //we have to move the cursor manually int iView = currentView(); //store view since fileswitch can cause it to change switchToFile(bufID); //switch to the file. No deferred loading, but this way we can easily move the cursor to the right position @@ -4378,7 +4514,7 @@ void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *fil { Buffer * buf = _pEditView->getCurrentBuffer(); UserLangContainer * userLangContainer = pNppParam->getULCFromName(buf->getUserDefineLangName()); - if (userLangContainer) + if (userLangContainer) ext = userLangContainer->getExtention(); } else @@ -4410,7 +4546,7 @@ vector Notepad_plus::addNppComponents(const TCHAR *destDir, cons { FileDialog fDlg(_pPublicInterface->getHSelf(), _pPublicInterface->getHinst()); fDlg.setExtFilter(extFilterName, extFilter, NULL); - + vector copiedFiles; if (stringVector *pfns = fDlg.doOpenMultiFilesDlg()) @@ -4425,9 +4561,9 @@ vector Notepad_plus::addNppComponents(const TCHAR *destDir, cons } destDirName += TEXT("\\"); - + size_t sz = pfns->size(); - for (size_t i = 0 ; i < sz ; i++) + for (size_t i = 0 ; i < sz ; i++) { if (::PathFileExists(pfns->at(i).c_str())) { @@ -4443,7 +4579,7 @@ vector Notepad_plus::addNppComponents(const TCHAR *destDir, cons return copiedFiles; } -void Notepad_plus::setWorkingDir(const TCHAR *dir) +void Notepad_plus::setWorkingDir(const TCHAR *dir) { NppParameters * params = NppParameters::getInstance(); if (params->getNppGUI()._openSaveDir == dir_last) @@ -4486,8 +4622,9 @@ int Notepad_plus::getLangFromMenuName(const TCHAR * langName) return id; } -generic_string Notepad_plus::getLangFromMenu(const Buffer * buf) +generic_string Notepad_plus::getLangFromMenu(const Buffer * buf) { + int id; generic_string userLangName; const int nbChar = 32; @@ -4534,7 +4671,7 @@ bool Notepad_plus::noOpenedDoc() const return false; } -bool Notepad_plus::reloadLang() +bool Notepad_plus::reloadLang() { NppParameters *pNppParam = NppParameters::getInstance(); @@ -4563,7 +4700,7 @@ bool Notepad_plus::reloadLang() { ::ModifyMenu(_mainMenuHandle, indexWindow - 1, MF_BYPOSITION, 0, pluginsTrans.c_str()); } - + if (windowTrans != TEXT("")) { ::ModifyMenu(_mainMenuHandle, indexWindow, MF_BYPOSITION, 0, windowTrans.c_str()); @@ -4582,11 +4719,11 @@ bool Notepad_plus::reloadLang() tmp[i]._itemName = purgeMenuItemString(menuName); } } - + vector & shortcuts = pNppParam->getUserShortcuts(); len = shortcuts.size(); - for(size_t i = 0; i < len; i++) + for(size_t i = 0; i < len; i++) { CommandShortcut & csc = shortcuts[i]; ::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND); @@ -4661,9 +4798,9 @@ void Notepad_plus::launchClipboardHistoryPanel() if (!_pClipboardHistoryPanel) { _pClipboardHistoryPanel = new ClipboardHistoryPanel(); - + _pClipboardHistoryPanel->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), &_pEditView); - + tTbData data = {0}; _pClipboardHistoryPanel->create(&data); @@ -4689,7 +4826,7 @@ void Notepad_plus::launchFileSwitcherPanel() _pFileSwitcherPanel = new VerticalFileSwitcher; HIMAGELIST hImgLst = _docTabIconList.getHandle(); _pFileSwitcherPanel->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), hImgLst); - + tTbData data = {0}; _pFileSwitcherPanel->create(&data); @@ -4713,9 +4850,9 @@ void Notepad_plus::launchAnsiCharPanel() if (!_pAnsiCharPanel) { _pAnsiCharPanel = new AnsiCharPanel(); - + _pAnsiCharPanel->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), &_pEditView); - + tTbData data = {0}; _pAnsiCharPanel->create(&data); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 484edf13..a8fa2eb9 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -151,6 +151,12 @@ enum trimOp { lineEol = 2 }; +enum spaceTab { + tab2Space = 0, + space2TabLeading = 1, + space2TabAll = 2 +}; + struct TaskListInfo; struct VisibleGUIConf { @@ -599,7 +605,7 @@ private: bool goToNextIndicator(int indicID2Search, bool isWrap = true) const; int wordCount(); - void wsTabConvert(bool whichWay); + void wsTabConvert(spaceTab whichWay); void doTrim(trimOp whichPart); void launchAnsiCharPanel(); void launchClipboardHistoryPanel(); diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index f8f90c74..46098285 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -7,10 +7,10 @@ // version 2 of the License, or (at your option) any later version. // // Note that the GPL places important restrictions on "derived works", yet -// it does not provide a detailed definition of that term. To avoid -// misunderstandings, we consider an application to constitute a +// it does not provide a detailed definition of that term. To avoid +// misunderstandings, we consider an application to constitute a // "derivative work" for the purpose of this license if it does any of the -// following: +// following: // 1. Integrates source code from Notepad++. // 2. Integrates/includes/aggregates Notepad++ into a proprietary executable // installer, such as those produced by InstallShield. @@ -238,14 +238,14 @@ BEGIN BEGIN MENUITEM "Increase Line Indent", IDM_EDIT_INS_TAB MENUITEM "Decrease Line Indent", IDM_EDIT_RMV_TAB - END + END POPUP "Convert Case to" BEGIN MENUITEM "&UPPERCASE", IDM_EDIT_UPPERCASE MENUITEM "&lowercase", IDM_EDIT_LOWERCASE - END + END POPUP "Line Operations" - BEGIN + BEGIN MENUITEM "Duplicate Current Line", IDM_EDIT_DUP_LINE MENUITEM "Split Lines", IDM_EDIT_SPLIT_LINES MENUITEM "Join Lines", IDM_EDIT_JOIN_LINES @@ -271,31 +271,32 @@ BEGIN MENUITEM "UNIX Format", IDM_FORMAT_TOUNIX MENUITEM "Mac Format", IDM_FORMAT_TOMAC END - POPUP "Blank Operations" - BEGIN - MENUITEM "Trim Trailing Space", IDM_EDIT_TRIMTRAILING - MENUITEM "Trim Leading Space", IDM_EDIT_TRIMLINEHEAD - MENUITEM "Trim Leading and Trailing Space", IDM_EDIT_TRIM_BOTH - MENUITEM "EOL to Space", IDM_EDIT_EOL2WS - MENUITEM "Remove Unnecessary Blank and EOL", IDM_EDIT_TRIMALL - MENUITEM SEPARATOR - MENUITEM "TAB to Space", IDM_EDIT_TAB2SW - MENUITEM "Space to TAB", IDM_EDIT_SW2TAB - END - POPUP "Paste Special" - BEGIN - MENUITEM "Paste HTML Content", IDM_EDIT_PASTE_AS_HTML - MENUITEM "Paste RTF Content", IDM_EDIT_PASTE_AS_RTF - MENUITEM SEPARATOR - MENUITEM "Copy Binary Content", IDM_EDIT_COPY_BINARY - MENUITEM "Cut Binary Content", IDM_EDIT_CUT_BINARY - MENUITEM "Paste Binary Content", IDM_EDIT_PASTE_BINARY - END + POPUP "Blank Operations" + BEGIN + MENUITEM "Trim Trailing Space", IDM_EDIT_TRIMTRAILING + MENUITEM "Trim Leading Space", IDM_EDIT_TRIMLINEHEAD + MENUITEM "Trim Leading and Trailing Space", IDM_EDIT_TRIM_BOTH + MENUITEM "EOL to Space", IDM_EDIT_EOL2WS + MENUITEM "Remove Unnecessary Blank and EOL", IDM_EDIT_TRIMALL + MENUITEM SEPARATOR + MENUITEM "TAB to Space", IDM_EDIT_TAB2SW + MENUITEM "Space to TAB (All)", IDM_EDIT_SW2TAB_ALL + MENUITEM "Space to TAB (Leading)", IDM_EDIT_SW2TAB_LEADING + END + POPUP "Paste Special" + BEGIN + MENUITEM "Paste HTML Content", IDM_EDIT_PASTE_AS_HTML + MENUITEM "Paste RTF Content", IDM_EDIT_PASTE_AS_RTF + MENUITEM SEPARATOR + MENUITEM "Copy Binary Content", IDM_EDIT_COPY_BINARY + MENUITEM "Cut Binary Content", IDM_EDIT_CUT_BINARY + MENUITEM "Paste Binary Content", IDM_EDIT_PASTE_BINARY + END MENUITEM SEPARATOR MENUITEM "Column Mode...", IDM_EDIT_COLUMNMODETIP - MENUITEM "Column Editor...", IDM_EDIT_COLUMNMODE - MENUITEM "Character Panel", IDM_EDIT_CHAR_PANEL - MENUITEM "Clipboard History", IDM_EDIT_CLIPBOARDHISTORY_PANEL + MENUITEM "Column Editor...", IDM_EDIT_COLUMNMODE + MENUITEM "Character Panel", IDM_EDIT_CHAR_PANEL + MENUITEM "Clipboard History", IDM_EDIT_CLIPBOARDHISTORY_PANEL MENUITEM SEPARATOR MENUITEM "Set Read-Only", IDM_EDIT_SETREADONLY MENUITEM "Clear Read-Only Flag", IDM_EDIT_CLEARREADONLY @@ -356,22 +357,22 @@ BEGIN MENUITEM "5th Style", IDM_SEARCH_GONEXTMARKER5 MENUITEM "Find Style", IDM_SEARCH_GONEXTMARKER_DEF END - MENUITEM SEPARATOR + MENUITEM SEPARATOR POPUP "Bookmark" BEGIN - MENUITEM "Toggle Bookmark" , IDM_SEARCH_TOGGLE_BOOKMARK - MENUITEM "Next Bookmark", IDM_SEARCH_NEXT_BOOKMARK - MENUITEM "Previous Bookmark", IDM_SEARCH_PREV_BOOKMARK - MENUITEM "Clear All Bookmarks", IDM_SEARCH_CLEAR_BOOKMARKS - MENUITEM "Cut Bookmarked Lines", IDM_SEARCH_CUTMARKEDLINES - MENUITEM "Copy Bookmarked Lines", IDM_SEARCH_COPYMARKEDLINES - MENUITEM "Paste to (Replace) Bookmarked Lines", IDM_SEARCH_PASTEMARKEDLINES - MENUITEM "Remove Bookmarked Lines", IDM_SEARCH_DELETEMARKEDLINES - MENUITEM "Remove Unmarked Lines", IDM_SEARCH_DELETEUNMARKEDLINES - MENUITEM "Inverse Bookmark", IDM_SEARCH_INVERSEMARKS + MENUITEM "Toggle Bookmark" , IDM_SEARCH_TOGGLE_BOOKMARK + MENUITEM "Next Bookmark", IDM_SEARCH_NEXT_BOOKMARK + MENUITEM "Previous Bookmark", IDM_SEARCH_PREV_BOOKMARK + MENUITEM "Clear All Bookmarks", IDM_SEARCH_CLEAR_BOOKMARKS + MENUITEM "Cut Bookmarked Lines", IDM_SEARCH_CUTMARKEDLINES + MENUITEM "Copy Bookmarked Lines", IDM_SEARCH_COPYMARKEDLINES + MENUITEM "Paste to (Replace) Bookmarked Lines", IDM_SEARCH_PASTEMARKEDLINES + MENUITEM "Remove Bookmarked Lines", IDM_SEARCH_DELETEMARKEDLINES + MENUITEM "Remove Unmarked Lines", IDM_SEARCH_DELETEUNMARKEDLINES + MENUITEM "Inverse Bookmark", IDM_SEARCH_INVERSEMARKS END - MENUITEM SEPARATOR - MENUITEM "Find characters in range...", IDM_SEARCH_FINDCHARINRANGE + MENUITEM SEPARATOR + MENUITEM "Find characters in range...", IDM_SEARCH_FINDCHARINRANGE END POPUP "&View" @@ -436,18 +437,18 @@ BEGIN END MENUITEM SEPARATOR - MENUITEM "Summary...", IDM_VIEW_SUMMARY + MENUITEM "Summary...", IDM_VIEW_SUMMARY MENUITEM SEPARATOR - POPUP "Project" + POPUP "Project" BEGIN MENUITEM "Project Panel 1", IDM_VIEW_PROJECT_PANEL_1 - MENUITEM "Project Panel 2", IDM_VIEW_PROJECT_PANEL_2 - MENUITEM "Project Panel 3", IDM_VIEW_PROJECT_PANEL_3 + MENUITEM "Project Panel 2", IDM_VIEW_PROJECT_PANEL_2 + MENUITEM "Project Panel 3", IDM_VIEW_PROJECT_PANEL_3 END #ifdef UNICODE - MENUITEM "Document Map", IDM_VIEW_DOC_MAP + MENUITEM "Document Map", IDM_VIEW_DOC_MAP #endif - MENUITEM SEPARATOR + MENUITEM SEPARATOR MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH MENUITEM SEPARATOR @@ -470,7 +471,7 @@ BEGIN MENUITEM "OEM 720", IDM_FORMAT_DOS_720 MENUITEM "Windows-1256", IDM_FORMAT_WIN_1256 END - + POPUP "Baltic" BEGIN MENUITEM "ISO 8859-4", IDM_FORMAT_ISO_8859_4 @@ -492,25 +493,25 @@ BEGIN MENUITEM "OEM 866", IDM_FORMAT_DOS_866 MENUITEM "Windows-1251", IDM_FORMAT_WIN_1251 END - + POPUP "Central European" BEGIN //MENUITEM "ISO 8859-16", IDM_FORMAT_ISO_8859_16 MENUITEM "OEM 852", IDM_FORMAT_DOS_852 MENUITEM "Windows-1250", IDM_FORMAT_WIN_1250 END - + POPUP "Chinese" BEGIN MENUITEM "Big5 (Traditional)", IDM_FORMAT_BIG5 MENUITEM "GB2312 (Simplified)", IDM_FORMAT_GB2312 END - + POPUP "Eastern European" BEGIN MENUITEM "ISO 8859-2", IDM_FORMAT_ISO_8859_2 END - + POPUP "Greek" BEGIN MENUITEM "ISO 8859-7", IDM_FORMAT_ISO_8859_7 @@ -518,37 +519,37 @@ BEGIN MENUITEM "OEM 869", IDM_FORMAT_DOS_869 MENUITEM "Windows-1253", IDM_FORMAT_WIN_1253 END - + POPUP "Hebrew" BEGIN MENUITEM "ISO 8859-8", IDM_FORMAT_ISO_8859_8 MENUITEM "OEM 862", IDM_FORMAT_DOS_862 MENUITEM "Windows-1255", IDM_FORMAT_WIN_1255 END - + POPUP "Japanese" BEGIN MENUITEM "Shift-JIS", IDM_FORMAT_SHIFT_JIS END - + POPUP "Korean" BEGIN MENUITEM "Windows 949", IDM_FORMAT_KOREAN_WIN - MENUITEM "EUC-KR", IDM_FORMAT_EUC_KR + MENUITEM "EUC-KR", IDM_FORMAT_EUC_KR END - + POPUP "North European" BEGIN MENUITEM "OEM 861 : Icelandic", IDM_FORMAT_DOS_861 MENUITEM "OEM 865 : Nordic", IDM_FORMAT_DOS_865 END - + POPUP "Thai" BEGIN //MENUITEM "ISO 8859-11", IDM_FORMAT_ISO_8859_11 MENUITEM "TIS-620", IDM_FORMAT_TIS_620 END - + POPUP "Turkish" BEGIN MENUITEM "ISO 8859-3", IDM_FORMAT_ISO_8859_3 @@ -556,7 +557,7 @@ BEGIN MENUITEM "OEM 857", IDM_FORMAT_DOS_857 MENUITEM "Windows-1254", IDM_FORMAT_WIN_1254 END - + POPUP "Western European" BEGIN MENUITEM "ISO 8859-1", IDM_FORMAT_ISO_8859_1 @@ -569,7 +570,7 @@ BEGIN MENUITEM "OEM-US", IDM_FORMAT_DOS_437 MENUITEM "Windows-1252", IDM_FORMAT_WIN_1252 END - + POPUP "Vietnamese" BEGIN MENUITEM "Windows-1258", IDM_FORMAT_WIN_1258 @@ -585,64 +586,64 @@ BEGIN POPUP "&Language" BEGIN - MENUITEM "Ada", IDM_LANG_ADA - MENUITEM "ASP", IDM_LANG_ASP - MENUITEM "Assembly", IDM_LANG_ASM - MENUITEM "AutoIt", IDM_LANG_AU3 - MENUITEM "Batch", IDM_LANG_BATCH - MENUITEM "C", IDM_LANG_C - MENUITEM "C#", IDM_LANG_CS - MENUITEM "C++", IDM_LANG_CPP - MENUITEM "Caml", IDM_LANG_CAML - MENUITEM "Cmake", IDM_LANG_CMAKE - MENUITEM "COBOL", IDM_LANG_COBOL - MENUITEM "CSS", IDM_LANG_CSS - MENUITEM "D", IDM_LANG_D - MENUITEM "Diff", IDM_LANG_DIFF - MENUITEM "Flash actionscript", IDM_LANG_FLASH - MENUITEM "Fortran", IDM_LANG_FORTRAN - MENUITEM "Gui4Cli", IDM_LANG_GUI4CLI - MENUITEM "Haskell", IDM_LANG_HASKELL - MENUITEM "HTML", IDM_LANG_HTML - MENUITEM "INNO", IDM_LANG_INNO - MENUITEM "Java", IDM_LANG_JAVA - MENUITEM "Javascript", IDM_LANG_JS - MENUITEM "JSP", IDM_LANG_JSP - MENUITEM "KIXtart", IDM_LANG_KIX - MENUITEM "LISP", IDM_LANG_LISP - MENUITEM "Lua", IDM_LANG_LUA - MENUITEM "Makefile", IDM_LANG_MAKEFILE - MENUITEM "Matlab", IDM_LANG_MATLAB - MENUITEM "MS INI file", IDM_LANG_INI - MENUITEM "MS-DOS Style", IDM_LANG_ASCII - MENUITEM "Normal Text", IDM_LANG_TEXT - MENUITEM "NSIS", IDM_LANG_NSIS - MENUITEM "Objective-C", IDM_LANG_OBJC - MENUITEM "Pascal", IDM_LANG_PASCAL - MENUITEM "Perl", IDM_LANG_PERL - MENUITEM "PHP", IDM_LANG_PHP - MENUITEM "Postscript", IDM_LANG_PS - MENUITEM "PowerShell", IDM_LANG_POWERSHELL - MENUITEM "Properties", IDM_LANG_PROPS - MENUITEM "Python", IDM_LANG_PYTHON - MENUITEM "R", IDM_LANG_R - MENUITEM "Resource file", IDM_LANG_RC - MENUITEM "Ruby", IDM_LANG_RUBY - MENUITEM "Shell", IDM_LANG_BASH - MENUITEM "Scheme", IDM_LANG_SCHEME - MENUITEM "Smalltalk", IDM_LANG_SMALLTALK - MENUITEM "SQL", IDM_LANG_SQL - MENUITEM "TCL", IDM_LANG_TCL - MENUITEM "TeX", IDM_LANG_TEX - MENUITEM "VB", IDM_LANG_VB - MENUITEM "VHDL", IDM_LANG_VHDL - MENUITEM "Verilog", IDM_LANG_VERILOG - MENUITEM "XML", IDM_LANG_XML - MENUITEM "YAML", IDM_LANG_YAML + MENUITEM "Ada", IDM_LANG_ADA + MENUITEM "ASP", IDM_LANG_ASP + MENUITEM "Assembly", IDM_LANG_ASM + MENUITEM "AutoIt", IDM_LANG_AU3 + MENUITEM "Batch", IDM_LANG_BATCH + MENUITEM "C", IDM_LANG_C + MENUITEM "C#", IDM_LANG_CS + MENUITEM "C++", IDM_LANG_CPP + MENUITEM "Caml", IDM_LANG_CAML + MENUITEM "Cmake", IDM_LANG_CMAKE + MENUITEM "COBOL", IDM_LANG_COBOL + MENUITEM "CSS", IDM_LANG_CSS + MENUITEM "D", IDM_LANG_D + MENUITEM "Diff", IDM_LANG_DIFF + MENUITEM "Flash actionscript", IDM_LANG_FLASH + MENUITEM "Fortran", IDM_LANG_FORTRAN + MENUITEM "Gui4Cli", IDM_LANG_GUI4CLI + MENUITEM "Haskell", IDM_LANG_HASKELL + MENUITEM "HTML", IDM_LANG_HTML + MENUITEM "INNO", IDM_LANG_INNO + MENUITEM "Java", IDM_LANG_JAVA + MENUITEM "Javascript", IDM_LANG_JS + MENUITEM "JSP", IDM_LANG_JSP + MENUITEM "KIXtart", IDM_LANG_KIX + MENUITEM "LISP", IDM_LANG_LISP + MENUITEM "Lua", IDM_LANG_LUA + MENUITEM "Makefile", IDM_LANG_MAKEFILE + MENUITEM "Matlab", IDM_LANG_MATLAB + MENUITEM "MS INI file", IDM_LANG_INI + MENUITEM "MS-DOS Style", IDM_LANG_ASCII + MENUITEM "Normal Text", IDM_LANG_TEXT + MENUITEM "NSIS", IDM_LANG_NSIS + MENUITEM "Objective-C", IDM_LANG_OBJC + MENUITEM "Pascal", IDM_LANG_PASCAL + MENUITEM "Perl", IDM_LANG_PERL + MENUITEM "PHP", IDM_LANG_PHP + MENUITEM "Postscript", IDM_LANG_PS + MENUITEM "PowerShell", IDM_LANG_POWERSHELL + MENUITEM "Properties", IDM_LANG_PROPS + MENUITEM "Python", IDM_LANG_PYTHON + MENUITEM "R", IDM_LANG_R + MENUITEM "Resource file", IDM_LANG_RC + MENUITEM "Ruby", IDM_LANG_RUBY + MENUITEM "Shell", IDM_LANG_BASH + MENUITEM "Scheme", IDM_LANG_SCHEME + MENUITEM "Smalltalk", IDM_LANG_SMALLTALK + MENUITEM "SQL", IDM_LANG_SQL + MENUITEM "TCL", IDM_LANG_TCL + MENUITEM "TeX", IDM_LANG_TEX + MENUITEM "VB", IDM_LANG_VB + MENUITEM "VHDL", IDM_LANG_VHDL + MENUITEM "Verilog", IDM_LANG_VERILOG + MENUITEM "XML", IDM_LANG_XML + MENUITEM "YAML", IDM_LANG_YAML MENUITEM SEPARATOR MENUITEM "User-Defined", IDM_LANG_USER END - + POPUP "&Language" BEGIN POPUP "A" @@ -743,8 +744,8 @@ BEGIN MENUITEM "YAML", IDM_LANG_YAML MENUITEM SEPARATOR MENUITEM "User-Defined", IDM_LANG_USER - END - + END + POPUP "Se&ttings" BEGIN MENUITEM "Preferences...", IDM_SETTING_PREFERECE @@ -757,7 +758,7 @@ BEGIN MENUITEM "Import style theme(s)...", IDM_SETTING_IMPORTSTYLETHEMS END MENUITEM SEPARATOR - MENUITEM "Edit Popup ContextMenu", IDM_SETTING_EDITCONTEXTMENU + MENUITEM "Edit Popup ContextMenu", IDM_SETTING_EDITCONTEXTMENU END POPUP "Macro" diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index d9d65e9d..14333c46 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -879,11 +879,15 @@ void Notepad_plus::command(int id) break; case IDM_EDIT_TAB2SW: - wsTabConvert(true); + wsTabConvert(tab2Space); break; - case IDM_EDIT_SW2TAB: - wsTabConvert(false); + case IDM_EDIT_SW2TAB_LEADING: + wsTabConvert(space2TabLeading); + break; + + case IDM_EDIT_SW2TAB_ALL: + wsTabConvert(space2TabAll); break; case IDM_EDIT_SETREADONLY: @@ -2376,7 +2380,8 @@ void Notepad_plus::command(int id) case IDM_EDIT_EOL2WS: case IDM_EDIT_TRIMALL: case IDM_EDIT_TAB2SW: - case IDM_EDIT_SW2TAB: + case IDM_EDIT_SW2TAB_ALL: + case IDM_EDIT_SW2TAB_LEADING: case IDM_EDIT_SETREADONLY : case IDM_EDIT_FULLPATHTOCLIP : case IDM_EDIT_FILENAMETOCLIP : diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 30d5240a..9b01de21 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -103,7 +103,8 @@ WinMenuKeyDefinition winKeyDefs[] = { {VK_NULL, IDM_EDIT_EOL2WS, false, false, false, NULL}, {VK_NULL, IDM_EDIT_TRIMALL, false, false, false, NULL}, {VK_NULL, IDM_EDIT_TAB2SW, false, false, false, NULL}, - {VK_NULL, IDM_EDIT_SW2TAB, false, false, false, NULL}, + {VK_NULL, IDM_EDIT_SW2TAB_ALL, false, false, false, NULL}, + {VK_NULL, IDM_EDIT_SW2TAB_LEADING, false, false, false, NULL}, {VK_C, IDM_EDIT_COLUMNMODE, false, true, false, NULL}, {VK_U, IDM_EDIT_UPPERCASE, true, false, true, NULL}, diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 1159059d..ba250dfa 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -88,7 +88,9 @@ #define IDM_EDIT_EOL2WS (IDM_EDIT + 44) #define IDM_EDIT_TRIMALL (IDM_EDIT + 45) #define IDM_EDIT_TAB2SW (IDM_EDIT + 46) - #define IDM_EDIT_SW2TAB (IDM_EDIT + 47) + #define IDM_EDIT_SW2TAB_LEADING (IDM_EDIT + 53) + #define IDM_EDIT_SW2TAB_ALL (IDM_EDIT + 54) + //#define IDM_EDIT_SW2TAB (IDM_EDIT + 47) // Menu macro #define IDM_MACRO_SAVECURRENTMACRO (IDM_EDIT + 25)