[NEW_FEATURE] Add chrome tab like feature : drag out tab to create a new instance.

[NEW_FEATURE] Add theme selector to switch styles.xml on the fly.
[NEW_FEATURE] Add new command parameters : -c (column) -x et -y (startup position).
[REMOVE] Remove change line marker which does not work correctly.
[ENHANCE] Improve main menu structure.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@454 f5eea248-9336-0410-98b8-ebc06183d4e3
pull/343/head^2
donho 2009-04-23 23:10:06 +00:00
parent 9deb93204d
commit 924efc4ed5
28 changed files with 874 additions and 400 deletions

View File

@ -41,6 +41,7 @@
#define generic_strncat wcsncat #define generic_strncat wcsncat
#define generic_strchr wcschr #define generic_strchr wcschr
#define generic_atoi _wtoi #define generic_atoi _wtoi
#define generic_itoa _itow
#define generic_atof _wtof #define generic_atof _wtof
#define generic_strtok wcstok #define generic_strtok wcstok
#define generic_strftime wcsftime #define generic_strftime wcsftime
@ -61,6 +62,7 @@
#define generic_strncat strncat #define generic_strncat strncat
#define generic_strchr strchr #define generic_strchr strchr
#define generic_atoi atoi #define generic_atoi atoi
#define generic_itoa itoa
#define generic_atof atof #define generic_atof atof
#define generic_strtok strtok #define generic_strtok strtok
#define generic_strftime strftime #define generic_strftime strftime

View File

@ -156,7 +156,17 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
if (!PathFileExists(xmlPath)) if (!PathFileExists(xmlPath))
{ {
throw generic_string(generic_string(xmlPath) + TEXT(" is missing.")); lstrcpyn( xmlPath, TEXT("\0"), MAX_PATH );
lstrcpy( xmlPath, nppParams->getAppDataNppDir() );
PathAppend(xmlPath, TEXT("plugins\\Config"));
PathAppend( xmlPath, pi->_moduleName );
PathRemoveExtension( xmlPath );
PathAddExtension( xmlPath, TEXT(".xml") );
if (! PathFileExists( xmlPath ) )
{
throw generic_string(generic_string(xmlPath) + TEXT(" is missing."));
}
} }
TiXmlDocument *_pXmlDoc = new TiXmlDocument(xmlPath); TiXmlDocument *_pXmlDoc = new TiXmlDocument(xmlPath);

View File

@ -196,7 +196,7 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
Window::init(hInst, parent); Window::init(hInst, parent);
WNDCLASS nppClass; WNDCLASS nppClass;
nppClass.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS;//CS_HREDRAW | CS_VREDRAW; nppClass.style = CS_BYTEALIGNWINDOW | CS_DBLCLKS;
nppClass.lpfnWndProc = Notepad_plus_Proc; nppClass.lpfnWndProc = Notepad_plus_Proc;
nppClass.cbClsExtra = 0; nppClass.cbClsExtra = 0;
nppClass.cbWndExtra = 0; nppClass.cbWndExtra = 0;
@ -263,7 +263,10 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
if (newUpperLeft.y + nppGUI._appPos.bottom < ::GetSystemMetrics(SM_YVIRTUALSCREEN)+margin) if (newUpperLeft.y + nppGUI._appPos.bottom < ::GetSystemMetrics(SM_YVIRTUALSCREEN)+margin)
newUpperLeft.y = workAreaRect.top; newUpperLeft.y = workAreaRect.top;
} }
::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE); if (cmdLineParams->isPointValid())
::MoveWindow(_hSelf, cmdLineParams->_point.x, cmdLineParams->_point.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
else
::MoveWindow(_hSelf, newUpperLeft.x, newUpperLeft.y, nppGUI._appPos.right, nppGUI._appPos.bottom, TRUE);
::GetModuleFileName(NULL, _nppPath, MAX_PATH); ::GetModuleFileName(NULL, _nppPath, MAX_PATH);
@ -283,22 +286,26 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
loadLastSession(); loadLastSession();
} }
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW); if (cmdLineParams->isPointValid())
::ShowWindow(_hSelf, SW_SHOW);
else
::ShowWindow(_hSelf, nppGUI._isMaximized?SW_MAXIMIZE:SW_SHOW);
if (cmdLine) if (cmdLine)
{ {
loadCommandlineParams(cmdLine, cmdLineParams); loadCommandlineParams(cmdLine, cmdLineParams);
} }
#ifdef UNICODE vector<generic_string> fileNames;
LocalizationSwicher & localizationSwitcher = pNppParams->getLocalizationSwitcher(); vector<generic_string> patterns;
vector<wstring> fileNames;
vector<wstring> patterns;
patterns.push_back(TEXT("*.xml")); patterns.push_back(TEXT("*.xml"));
wchar_t tmp[MAX_PATH]; TCHAR tmp[MAX_PATH];
lstrcpyW(tmp, _nppPath); lstrcpy(tmp, _nppPath);
::PathRemoveFileSpec(tmp); ::PathRemoveFileSpec(tmp);
#ifdef UNICODE
LocalizationSwitcher & localizationSwitcher = pNppParams->getLocalizationSwitcher();
wstring localizationDir = tmp; wstring localizationDir = tmp;
localizationDir += TEXT("\\localization\\"); localizationDir += TEXT("\\localization\\");
@ -309,6 +316,34 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
} }
#endif #endif
fileNames.clear();
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
// Get themes from both npp install themes dir and app data themes dir with the per user
// overriding default themes of the same name.
generic_string themeDir(pNppParams->getAppDataNppDir());
themeDir.append(TEXT("\\themes\\"));
getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
fileNames.clear();
themeDir.clear();
themeDir.assign(tmp);
themeDir.append(TEXT("\\themes\\"));
getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
{
generic_string themeName( themeSwitcher.getThemeFromXmlFileName(fileNames[i].c_str()) );
if (! themeSwitcher.themeNameExists(themeName.c_str()) )
{
themeSwitcher.addThemeFromXml(fileNames[i].c_str());
}
}
// Notify plugins that Notepad++ is ready // Notify plugins that Notepad++ is ready
SCNotification scnN; SCNotification scnN;
scnN.nmhdr.code = NPPN_READY; scnN.nmhdr.code = NPPN_READY;
@ -2081,7 +2116,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{ {
prevWasEdit = false; prevWasEdit = false;
} }
/*
if (!_isFileOpening && (isFromPrimary || isFromSecondary) && _pEditView->hasMarginShowed(ScintillaEditView::_SC_MARGE_MODIFMARKER)) if (!_isFileOpening && (isFromPrimary || isFromSecondary) && _pEditView->hasMarginShowed(ScintillaEditView::_SC_MARGE_MODIFMARKER))
{ {
bool isProcessed = false; bool isProcessed = false;
@ -2216,6 +2251,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
} }
} }
} }
*/
} }
break; break;
@ -2257,7 +2293,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case TCN_TABDROPPED: case TCN_TABDROPPED:
{ {
TabBarPlus *sender = reinterpret_cast<TabBarPlus *>(notification->nmhdr.idFrom); TabBarPlus *sender = reinterpret_cast<TabBarPlus *>(notification->nmhdr.idFrom);
bool isInCtrlStat = (::GetKeyState(VK_LCONTROL) & 0x80000000) != 0;
if (notification->nmhdr.code == TCN_TABDROPPEDOUTSIDE) if (notification->nmhdr.code == TCN_TABDROPPEDOUTSIDE)
{ {
POINT p = sender->getDraggingPoint(); POINT p = sender->getDraggingPoint();
@ -2269,8 +2305,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{ {
if (!_tabPopupDropMenu.isCreated()) if (!_tabPopupDropMenu.isCreated())
{ {
TCHAR goToView[32] = TEXT("Go to another View"); TCHAR goToView[32] = TEXT("Move to other view");
TCHAR cloneToView[32] = TEXT("Clone to another View"); TCHAR cloneToView[32] = TEXT("Clone to other View");
vector<MenuItemUnit> itemUnitArray; vector<MenuItemUnit> itemUnitArray;
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, goToView)); itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, goToView));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, cloneToView)); itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, cloneToView));
@ -2282,13 +2318,19 @@ BOOL Notepad_plus::notify(SCNotification *notification)
else if ((hWin == _pNonDocTab->getHSelf()) || else if ((hWin == _pNonDocTab->getHSelf()) ||
(hWin == _pNonEditView->getHSelf())) // In the another view group (hWin == _pNonEditView->getHSelf())) // In the another view group
{ {
if (::GetKeyState(VK_LCONTROL) & 0x80000000) docGotoAnotherEditView(isInCtrlStat?TransferClone:TransferMove);
docGotoAnotherEditView(TransferClone);
else
docGotoAnotherEditView(TransferMove);
} }
else else
{ {
RECT nppZone;
::GetWindowRect(_hSelf, &nppZone);
bool isInNppZone = (((p.x >= nppZone.left) && (p.x <= nppZone.right)) && (p.y >= nppZone.top) && (p.y <= nppZone.bottom));
if (isInNppZone)
{
// Do nothing
return TRUE;
}
generic_string quotFileName = TEXT("\""); generic_string quotFileName = TEXT("\"");
quotFileName += _pEditView->getCurrentBuffer()->getFullPathName(); quotFileName += _pEditView->getCurrentBuffer()->getFullPathName();
quotFileName += TEXT("\""); quotFileName += TEXT("\"");
@ -2300,7 +2342,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
HWND hWinParent = ::GetParent(hWin); HWND hWinParent = ::GetParent(hWin);
TCHAR className[MAX_PATH]; TCHAR className[MAX_PATH];
::GetClassName(hWinParent,className, sizeof(className)); ::GetClassName(hWinParent,className, sizeof(className));
if (lstrcmp(className, _className) == 0 && hWinParent != _hSelf) if (lstrcmp(className, _className) == 0 && hWinParent != _hSelf) // another Notepad++
{ {
int index = _pDocTab->getCurrentTabIndex(); int index = _pDocTab->getCurrentTabIndex();
BufferID bufferToClose = notifyDocTab->getBufferByIndex(index); BufferID bufferToClose = notifyDocTab->getBufferByIndex(index);
@ -2308,18 +2350,28 @@ BOOL Notepad_plus::notify(SCNotification *notification)
int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW; int iView = isFromPrimary?MAIN_VIEW:SUB_VIEW;
if (buf->isDirty()) if (buf->isDirty())
{ {
::MessageBox(_hSelf, TEXT("Document is modified, save it then try again."), TEXT("Go to another Notepad++ instance"), MB_OK); ::MessageBox(_hSelf, TEXT("Document is modified, save it then try again."), TEXT("Move to new Notepad++ Instance"), MB_OK);
} }
else else
{ {
::SendMessage(hWinParent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)hWin); ::SendMessage(hWinParent, NPPM_INTERNAL_SWITCHVIEWFROMHWND, 0, (LPARAM)hWin);
::SendMessage(hWinParent, WM_COPYDATA, (WPARAM)_hInst, (LPARAM)&fileNamesData); ::SendMessage(hWinParent, WM_COPYDATA, (WPARAM)_hInst, (LPARAM)&fileNamesData);
fileClose(bufferToClose, iView); if (!isInCtrlStat)
{
fileClose(bufferToClose, iView);
if (noOpenedDoc())
::SendMessage(_hSelf, WM_CLOSE, 0, 0);
}
} }
} }
else // Not Notepad++, we open it here
{
docOpenInNewInstance(isInCtrlStat?TransferClone:TransferMove, p.x, p.y);
}
} }
} }
break; //break;
return TRUE;
} }
case TCN_TABDELETE: case TCN_TABDELETE:
@ -2442,9 +2494,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FILENAMETOCLIP, TEXT("File name to Clipboard"))); itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FILENAMETOCLIP, TEXT("File name to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CURRENTDIRTOCLIP, TEXT("Current dir path to Clipboard"))); itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CURRENTDIRTOCLIP, TEXT("Current dir path to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(0, NULL)); itemUnitArray.push_back(MenuItemUnit(0, NULL));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, TEXT("Go to another View"))); itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, TEXT("Move to other view")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, TEXT("Clone to another View"))); itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, TEXT("Clone to other view")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_NEW_INSTANCE, TEXT("Go to new instance"))); itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_NEW_INSTANCE, TEXT("Move to new instance")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_LOAD_IN_NEW_INSTANCE, TEXT("Open in new instance"))); itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_LOAD_IN_NEW_INSTANCE, TEXT("Open in new instance")));
_tabPopupMenu.create(_hSelf, itemUnitArray); _tabPopupMenu.create(_hSelf, itemUnitArray);
@ -2934,7 +2986,7 @@ void Notepad_plus::specialCmd(int id, int param)
{ {
case IDM_VIEW_LINENUMBER: case IDM_VIEW_LINENUMBER:
case IDM_VIEW_SYMBOLMARGIN: case IDM_VIEW_SYMBOLMARGIN:
case IDM_VIEW_DOCCHANGEMARGIN: //case IDM_VIEW_DOCCHANGEMARGIN:
case IDM_VIEW_FOLDERMAGIN: case IDM_VIEW_FOLDERMAGIN:
{ {
int margin; int margin;
@ -2942,10 +2994,12 @@ void Notepad_plus::specialCmd(int id, int param)
margin = ScintillaEditView::_SC_MARGE_LINENUMBER; margin = ScintillaEditView::_SC_MARGE_LINENUMBER;
else if (id == IDM_VIEW_SYMBOLMARGIN) else if (id == IDM_VIEW_SYMBOLMARGIN)
margin = ScintillaEditView::_SC_MARGE_SYBOLE; margin = ScintillaEditView::_SC_MARGE_SYBOLE;
/*
else if (id == IDM_VIEW_DOCCHANGEMARGIN) else if (id == IDM_VIEW_DOCCHANGEMARGIN)
{ {
margin = ScintillaEditView::_SC_MARGE_MODIFMARKER; margin = ScintillaEditView::_SC_MARGE_MODIFMARKER;
} }
*/
else else
margin = ScintillaEditView::_SC_MARGE_FOLDER; margin = ScintillaEditView::_SC_MARGE_FOLDER;
@ -4914,6 +4968,12 @@ void Notepad_plus::hideView(int whichOne)
_mainWindowStatus &= ~viewToDisable; _mainWindowStatus &= ~viewToDisable;
} }
bool Notepad_plus::loadStyles()
{
NppParameters *pNppParam = NppParameters::getInstance();
return pNppParam->reloadStylers();
}
bool Notepad_plus::reloadLang() bool Notepad_plus::reloadLang()
{ {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters *pNppParam = NppParameters::getInstance();
@ -5211,7 +5271,7 @@ void Notepad_plus::undockUserDlg()
(ScintillaEditView::getUserDefineDlg())->display(); (ScintillaEditView::getUserDefineDlg())->display();
} }
void Notepad_plus::docOpenInNewInstance(FileTransferMode mode) void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
{ {
BufferID bufferID = _pEditView->getCurrentBufferID(); BufferID bufferID = _pEditView->getCurrentBufferID();
Buffer * buf = MainFileManager->getBufferByID(bufferID); Buffer * buf = MainFileManager->getBufferByID(bufferID);
@ -5224,12 +5284,23 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode)
command += nppName; command += nppName;
command += TEXT("\""); command += TEXT("\"");
command += TEXT(" \"$(FULL_CURRENT_PATH)\" -multiInst -nosession"); command += TEXT(" \"$(FULL_CURRENT_PATH)\" -multiInst -nosession -x");
TCHAR pX[10], pY[10];
generic_itoa(x, pX, 10);
generic_itoa(y, pY, 10);
command += pX;
command += TEXT(" -y");
command += pY;
Command cmd(command); Command cmd(command);
cmd.run(_hSelf); cmd.run(_hSelf);
if (mode == TransferMove) if (mode == TransferMove)
{
doClose(bufferID, currentView()); doClose(bufferID, currentView());
if (noOpenedDoc())
::SendMessage(_hSelf, WM_CLOSE, 0, 0);
}
} }
void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode) void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
@ -5264,6 +5335,8 @@ void Notepad_plus::docGotoAnotherEditView(FileTransferMode mode)
{ {
//just close the activate document, since thats the one we moved (no search) //just close the activate document, since thats the one we moved (no search)
doClose(_pEditView->getCurrentBufferID(), currentView()); doClose(_pEditView->getCurrentBufferID(), currentView());
if (noOpenedDoc())
::SendMessage(_hSelf, WM_CLOSE, 0, 0);
} // else it was cone, so leave it } // else it was cone, so leave it
//Activate the other view since thats where the document went //Activate the other view since thats where the document went
@ -6709,7 +6782,7 @@ bool Notepad_plus::saveScintillaParams(bool whichOne)
svp._lineNumberMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_LINENUMBER); svp._lineNumberMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_LINENUMBER);
svp._bookMarkMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_SYBOLE); svp._bookMarkMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_SYBOLE);
svp._docChangeStateMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_MODIFMARKER); //svp._docChangeStateMarginShow = pView->hasMarginShowed(ScintillaEditView::_SC_MARGE_MODIFMARKER);
svp._indentGuideLineShow = pView->isShownIndentGuide(); svp._indentGuideLineShow = pView->isShownIndentGuide();
svp._folderStyle = pView->getFolderStyle(); svp._folderStyle = pView->getFolderStyle();
svp._currentLineHilitingShow = pView->isCurrentLineHiLiting(); svp._currentLineHilitingShow = pView->isCurrentLineHiLiting();
@ -6930,8 +7003,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp2._lineNumberMarginShow); _subEditView.showMargin(ScintillaEditView::_SC_MARGE_LINENUMBER, svp2._lineNumberMarginShow);
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow); _mainEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp1._bookMarkMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp2._bookMarkMarginShow); _subEditView.showMargin(ScintillaEditView::_SC_MARGE_SYBOLE, svp2._bookMarkMarginShow);
_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_MODIFMARKER, svp1._docChangeStateMarginShow); //_mainEditView.showMargin(ScintillaEditView::_SC_MARGE_MODIFMARKER, svp1._docChangeStateMarginShow);
_subEditView.showMargin(ScintillaEditView::_SC_MARGE_MODIFMARKER, svp2._docChangeStateMarginShow); //_subEditView.showMargin(ScintillaEditView::_SC_MARGE_MODIFMARKER, svp2._docChangeStateMarginShow);
_mainEditView.showIndentGuideLine(svp1._indentGuideLineShow); _mainEditView.showIndentGuideLine(svp1._indentGuideLineShow);
_subEditView.showIndentGuideLine(svp2._indentGuideLineShow); _subEditView.showIndentGuideLine(svp2._indentGuideLineShow);
@ -7682,6 +7755,12 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
} }
return TRUE; return TRUE;
case NPPM_INTERNAL_RELOADSTYLERS:
{
loadStyles();
}
return TRUE;
case NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED: case NPPM_INTERNAL_PLUGINSHORTCUTMOTIFIED:
{ {
SCNotification scnN; SCNotification scnN;
@ -9707,6 +9786,8 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam
LangType lt = pCmdParams->_langType;//LangType(pCopyData->dwData & LASTBYTEMASK); LangType lt = pCmdParams->_langType;//LangType(pCopyData->dwData & LASTBYTEMASK);
int ln = pCmdParams->_line2go; int ln = pCmdParams->_line2go;
int cn = pCmdParams->_column2go;
bool readOnly = pCmdParams->_isReadOnly; bool readOnly = pCmdParams->_isReadOnly;
BufferID lastOpened = BUFFER_INVALID; BufferID lastOpened = BUFFER_INVALID;
@ -9730,11 +9811,18 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam
int iView = currentView(); //store view since fileswitch can cause it to change 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 switchToFile(bufID); //switch to the file. No deferred loading, but this way we can easily move the cursor to the right position
if (cn == -1)
_pEditView->execute(SCI_GOTOLINE, ln-1); _pEditView->execute(SCI_GOTOLINE, ln-1);
else
{
int pos = _pEditView->execute(SCI_FINDCOLUMN, ln-1, cn-1);
_pEditView->execute(SCI_GOTOPOS, pos);
}
switchEditViewTo(iView); //restore view switchEditViewTo(iView); //restore view
} }
} }
if (lastOpened != BUFFER_INVALID) { if (lastOpened != BUFFER_INVALID)
{
switchToFile(lastOpened); switchToFile(lastOpened);
} }
} }

View File

@ -403,6 +403,8 @@ private:
void hideCurrentView(); void hideCurrentView();
bool bothActive() { return (_mainWindowStatus & WindowBothActive) == WindowBothActive; }; bool bothActive() { return (_mainWindowStatus & WindowBothActive) == WindowBothActive; };
bool reloadLang(); bool reloadLang();
bool loadStyles();
int currentView(){ int currentView(){
return _activeView; return _activeView;
}; };
@ -417,7 +419,7 @@ private:
int switchEditViewTo(int gid); //activate other view (set focus etc) int switchEditViewTo(int gid); //activate other view (set focus etc)
void docGotoAnotherEditView(FileTransferMode mode); //TransferMode void docGotoAnotherEditView(FileTransferMode mode); //TransferMode
void docOpenInNewInstance(FileTransferMode mode); void docOpenInNewInstance(FileTransferMode mode, int x = 0, int y = 0);
void loadBufferIntoView(BufferID id, int whichOne, bool dontClose = false); //Doesnt _activate_ the buffer void loadBufferIntoView(BufferID id, int whichOne, bool dontClose = false); //Doesnt _activate_ the buffer
void removeBufferFromView(BufferID id, int whichOne); //Activates alternative of possible, or creates clean document if not clean already void removeBufferFromView(BufferID id, int whichOne); //Activates alternative of possible, or creates clean document if not clean already
@ -816,6 +818,19 @@ private:
void drawTabbarColoursFromStylerArray(); void drawTabbarColoursFromStylerArray();
void loadCommandlineParams(const TCHAR * commandLine, CmdLineParams * pCmdParams); void loadCommandlineParams(const TCHAR * commandLine, CmdLineParams * pCmdParams);
bool noOpenedDoc() const {
if (_mainDocTab.isVisible() && _subDocTab.isVisible())
return false;
if (_pDocTab->nbItem() == 1)
{
BufferID buffer = _pDocTab->getBufferByIndex(0);
Buffer * buf = MainFileManager->getBufferByID(buffer);
if (!buf->isDirty() && buf->isUntitled())
return true;
}
return false;
};
}; };
#endif //NOTEPAD_PLUS_H #endif //NOTEPAD_PLUS_H

View File

@ -1,4 +1,4 @@
/* /*
this file is part of notepad++ this file is part of notepad++
Copyright (C)2003 Don HO ( donho@altern.org ) Copyright (C)2003 Don HO ( donho@altern.org )
@ -113,6 +113,7 @@ IDI_FIND_RESULT_ICON ICON "icons\\findResult.ico"
IDC_DRAG_TAB CURSOR "cursors\\drag.cur" IDC_DRAG_TAB CURSOR "cursors\\drag.cur"
IDC_DRAG_INTERDIT_TAB CURSOR "cursors\\drag_interdit.cur" IDC_DRAG_INTERDIT_TAB CURSOR "cursors\\drag_interdit.cur"
IDC_DRAG_PLUS_TAB CURSOR "cursors\\drag_plus.cur" IDC_DRAG_PLUS_TAB CURSOR "cursors\\drag_plus.cur"
IDC_DRAG_OUT_TAB CURSOR "cursors\\drag_out.cur"
IDR_FILENEW BITMAP "icons\\newFile.bmp" IDR_FILENEW BITMAP "icons\\newFile.bmp"
IDR_FILEOPEN BITMAP "icons\\openFile.bmp" IDR_FILEOPEN BITMAP "icons\\openFile.bmp"
@ -206,36 +207,49 @@ BEGIN
MENUITEM "Cu&t", IDM_EDIT_CUT MENUITEM "Cu&t", IDM_EDIT_CUT
MENUITEM "&Copy", IDM_EDIT_COPY MENUITEM "&Copy", IDM_EDIT_COPY
MENUITEM "&Paste", IDM_EDIT_PASTE MENUITEM "&Paste", IDM_EDIT_PASTE
MENUITEM "&Delete", IDM_EDIT_DELETE
MENUITEM "Select A&ll", IDM_EDIT_SELECTALL MENUITEM "Select A&ll", IDM_EDIT_SELECTALL
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Copy Current full file path to Clipboard", IDM_EDIT_FULLPATHTOCLIP POPUP "Copy to clipboard"
MENUITEM "Copy Current file name to Clipboard", IDM_EDIT_FILENAMETOCLIP BEGIN
MENUITEM "Copy Current dir path to Clipboard", IDM_EDIT_CURRENTDIRTOCLIP MENUITEM "Current full file path to Clipboard", IDM_EDIT_FULLPATHTOCLIP
MENUITEM SEPARATOR MENUITEM "Current file name to Clipboard", IDM_EDIT_FILENAMETOCLIP
MENUITEM "Insert TAB (Indent)", IDM_EDIT_INS_TAB MENUITEM "Current dir path to Clipboard", IDM_EDIT_CURRENTDIRTOCLIP
MENUITEM "Remove TAB (Outdent)", IDM_EDIT_RMV_TAB END
MENUITEM "Duplicate current line", IDM_EDIT_DUP_LINE POPUP "Indent"
MENUITEM "Split lines", IDM_EDIT_SPLIT_LINES BEGIN
MENUITEM "Join lines", IDM_EDIT_JOIN_LINES MENUITEM "Increase Line Indent", IDM_EDIT_INS_TAB
MENUITEM "Move Up current line", IDM_EDIT_LINE_UP MENUITEM "Decrease Line Indent", IDM_EDIT_RMV_TAB
MENUITEM "Move Down current line", IDM_EDIT_LINE_DOWN END
POPUP "Convert case"
BEGIN
MENUITEM "to &UPPERCASE", IDM_EDIT_UPPERCASE
MENUITEM "to &lowercase", IDM_EDIT_LOWERCASE
END
POPUP "Line operations"
BEGIN
MENUITEM "Duplicate current line", IDM_EDIT_DUP_LINE
MENUITEM "Split lines", IDM_EDIT_SPLIT_LINES
MENUITEM "Join lines", IDM_EDIT_JOIN_LINES
MENUITEM "Move Up current line", IDM_EDIT_LINE_UP
MENUITEM "Move Down current line", IDM_EDIT_LINE_DOWN
END
POPUP "Comment/Uncomment"
BEGIN
MENUITEM "Toggle block comment", IDM_EDIT_BLOCK_COMMENT
MENUITEM "Block comment", IDM_EDIT_BLOCK_COMMENT_SET
MENUITEM "Block uncomment", IDM_EDIT_BLOCK_UNCOMMENT
MENUITEM "Stream comment", IDM_EDIT_STREAM_COMMENT
END
POPUP "Auto-completion"
BEGIN
MENUITEM "Function completion", IDM_EDIT_AUTOCOMPLETE
MENUITEM "Word completion", IDM_EDIT_AUTOCOMPLETE_CURRENTFILE
MENUITEM "Function parameters hint", IDM_EDIT_FUNCCALLTIP
END
MENUITEM "Trim Trailing Space", IDM_EDIT_TRIMTRAILING MENUITEM "Trim Trailing Space", IDM_EDIT_TRIMTRAILING
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Column Editor...", IDM_EDIT_COLUMNMODE MENUITEM "Column Editor...", IDM_EDIT_COLUMNMODE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "to &Upper case", IDM_EDIT_UPPERCASE
MENUITEM "to &Lower case", IDM_EDIT_LOWERCASE
MENUITEM SEPARATOR
MENUITEM "Block toggle comment", IDM_EDIT_BLOCK_COMMENT
MENUITEM "Block comment", IDM_EDIT_BLOCK_COMMENT_SET
MENUITEM "Block uncomment", IDM_EDIT_BLOCK_UNCOMMENT
MENUITEM "Stream comment", IDM_EDIT_STREAM_COMMENT
MENUITEM SEPARATOR
MENUITEM "Function completion", IDM_EDIT_AUTOCOMPLETE
MENUITEM "Word completion", IDM_EDIT_AUTOCOMPLETE_CURRENTFILE
MENUITEM "Function parameters hint", IDM_EDIT_FUNCCALLTIP
MENUITEM SEPARATOR
MENUITEM "Set Read Only", IDM_EDIT_SETREADONLY MENUITEM "Set Read Only", IDM_EDIT_SETREADONLY
MENUITEM "Clear Read Only Flag", IDM_EDIT_CLEARREADONLY MENUITEM "Clear Read Only Flag", IDM_EDIT_CLEARREADONLY
//MENUITEM SEPARATOR //MENUITEM SEPARATOR
@ -255,22 +269,22 @@ BEGIN
MENUITEM "Go to matching brace", IDM_SEARCH_GOTOMATCHINGBRACE MENUITEM "Go to matching brace", IDM_SEARCH_GOTOMATCHINGBRACE
MENUITEM SEPARATOR MENUITEM SEPARATOR
POPUP "Mark all with..." POPUP "Mark all"
BEGIN BEGIN
MENUITEM "Mark all with the 1st style", IDM_SEARCH_MARKALLEXT1 MENUITEM "Using 1st style", IDM_SEARCH_MARKALLEXT1
MENUITEM "Mark all with the 2nd style", IDM_SEARCH_MARKALLEXT2 MENUITEM "Using 2nd style", IDM_SEARCH_MARKALLEXT2
MENUITEM "Mark all with the 3rd style", IDM_SEARCH_MARKALLEXT3 MENUITEM "Using 3rd style", IDM_SEARCH_MARKALLEXT3
MENUITEM "Mark all with the 4th style", IDM_SEARCH_MARKALLEXT4 MENUITEM "Using 4th style", IDM_SEARCH_MARKALLEXT4
MENUITEM "Mark all with the 5th style", IDM_SEARCH_MARKALLEXT5 MENUITEM "Using 5th style", IDM_SEARCH_MARKALLEXT5
END END
POPUP "Unark all with..." POPUP "Unmark all"
BEGIN BEGIN
MENUITEM "Unmark all the 1st style", IDM_SEARCH_UNMARKALLEXT1 MENUITEM "Clear 1st style", IDM_SEARCH_UNMARKALLEXT1
MENUITEM "Unmark all the 2nd style", IDM_SEARCH_UNMARKALLEXT2 MENUITEM "Clear 2nd style", IDM_SEARCH_UNMARKALLEXT2
MENUITEM "Unmark all the 3rd style", IDM_SEARCH_UNMARKALLEXT3 MENUITEM "Clear 3rd style", IDM_SEARCH_UNMARKALLEXT3
MENUITEM "Unmark all the 4th style", IDM_SEARCH_UNMARKALLEXT4 MENUITEM "Clear 4th style", IDM_SEARCH_UNMARKALLEXT4
MENUITEM "Unmark all the 5th style", IDM_SEARCH_UNMARKALLEXT5 MENUITEM "Clear 5th style", IDM_SEARCH_UNMARKALLEXT5
MENUITEM "Clear all marks", IDM_SEARCH_CLEARALLMARKS MENUITEM "Clear all styles", IDM_SEARCH_CLEARALLMARKS
END END
@ -287,28 +301,43 @@ BEGIN
POPUP "&View" POPUP "&View"
BEGIN BEGIN
MENUITEM "Toggle Full Screen Mode", IDM_VIEW_FULLSCREENTOGGLE
MENUITEM "Always on top", IDM_VIEW_ALWAYSONTOP MENUITEM "Always on top", IDM_VIEW_ALWAYSONTOP
MENUITEM "Toggle Full Screen Mode", IDM_VIEW_FULLSCREENTOGGLE
MENUITEM "Post-it", IDM_VIEW_POSTIT MENUITEM "Post-it", IDM_VIEW_POSTIT
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Show White Space and TAB", IDM_VIEW_TAB_SPACE POPUP "Show Symbol"
MENUITEM "Show End Of Line", IDM_VIEW_EOL BEGIN
MENUITEM "Show all characters", IDM_VIEW_ALL_CHARACTERS MENUITEM "Show White Space and TAB", IDM_VIEW_TAB_SPACE
MENUITEM SEPARATOR MENUITEM "Show End Of Line", IDM_VIEW_EOL
MENUITEM "Show Indent guide", IDM_VIEW_INDENT_GUIDE MENUITEM "Show all characters", IDM_VIEW_ALL_CHARACTERS
MENUITEM "Wrap", IDM_VIEW_WRAP MENUITEM SEPARATOR
MENUITEM "Show wrap symbol", IDM_VIEW_WRAP_SYMBOL MENUITEM "Show Indent guide", IDM_VIEW_INDENT_GUIDE
MENUITEM "Show wrap symbol", IDM_VIEW_WRAP_SYMBOL
END
POPUP "Zoom"
BEGIN
MENUITEM "Zoom &in", IDM_VIEW_ZOOMIN
MENUITEM "Zoom &out", IDM_VIEW_ZOOMOUT
MENUITEM "Restore default zoom", IDM_VIEW_ZOOMRESTORE
END
POPUP "Move/Clone current document"
BEGIN
MENUITEM "Move to other view", IDM_VIEW_GOTO_ANOTHER_VIEW
MENUITEM "Clone to other view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW
MENUITEM "Move to new instance", IDM_VIEW_GOTO_NEW_INSTANCE
MENUITEM "Open in new instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE
END
MENUITEM "Word wrap", IDM_VIEW_WRAP
MENUITEM "Focus on other view", IDM_VIEW_SWITCHTO_OTHER_VIEW
MENUITEM "Hide lines", IDM_VIEW_HIDELINES
MENUITEM "User Define Dialog...", IDM_VIEW_USER_DLG MENUITEM "User Define Dialog...", IDM_VIEW_USER_DLG
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Zoom &in", IDM_VIEW_ZOOMIN
MENUITEM "Zoom &out", IDM_VIEW_ZOOMOUT
MENUITEM "Restore default zoom setting", IDM_VIEW_ZOOMRESTORE
MENUITEM SEPARATOR
MENUITEM "Fold all", IDM_VIEW_TOGGLE_FOLDALL MENUITEM "Fold all", IDM_VIEW_TOGGLE_FOLDALL
MENUITEM "Collapse the current level", IDM_VIEW_FOLD_CURRENT MENUITEM "Unfold all", IDM_VIEW_TOGGLE_UNFOLDALL
MENUITEM "Uncollapse the current level", IDM_VIEW_UNFOLD_CURRENT MENUITEM "Collapse current level", IDM_VIEW_FOLD_CURRENT
POPUP "Collapse the level" MENUITEM "Uncollapse current level", IDM_VIEW_UNFOLD_CURRENT
POPUP "Collapse level"
BEGIN BEGIN
MENUITEM "1" , IDM_VIEW_FOLD_1 MENUITEM "1" , IDM_VIEW_FOLD_1
MENUITEM "2", IDM_VIEW_FOLD_2 MENUITEM "2", IDM_VIEW_FOLD_2
@ -319,7 +348,7 @@ BEGIN
MENUITEM "7", IDM_VIEW_FOLD_7 MENUITEM "7", IDM_VIEW_FOLD_7
MENUITEM "8", IDM_VIEW_FOLD_8 MENUITEM "8", IDM_VIEW_FOLD_8
END END
POPUP "Uncollapse the level" POPUP "Uncollapse level"
BEGIN BEGIN
MENUITEM "1" , IDM_VIEW_UNFOLD_1 MENUITEM "1" , IDM_VIEW_UNFOLD_1
MENUITEM "2", IDM_VIEW_UNFOLD_2 MENUITEM "2", IDM_VIEW_UNFOLD_2
@ -330,15 +359,7 @@ BEGIN
MENUITEM "7", IDM_VIEW_UNFOLD_7 MENUITEM "7", IDM_VIEW_UNFOLD_7
MENUITEM "8", IDM_VIEW_UNFOLD_8 MENUITEM "8", IDM_VIEW_UNFOLD_8
END END
MENUITEM "Unfold all", IDM_VIEW_TOGGLE_UNFOLDALL
MENUITEM SEPARATOR
MENUITEM "Hide lines", IDM_VIEW_HIDELINES
MENUITEM SEPARATOR
MENUITEM "Go to another view", IDM_VIEW_GOTO_ANOTHER_VIEW
MENUITEM "Clone to another view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW
MENUITEM "Focus on other view", IDM_VIEW_SWITCHTO_OTHER_VIEW
MENUITEM "Go to new instance", IDM_VIEW_GOTO_NEW_INSTANCE
MENUITEM "Open in new instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV
MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH
@ -433,7 +454,7 @@ BEGIN
MENUITEM "Start Re&cording", IDM_MACRO_STARTRECORDINGMACRO MENUITEM "Start Re&cording", IDM_MACRO_STARTRECORDINGMACRO
MENUITEM "S&top Recording", IDM_MACRO_STOPRECORDINGMACRO MENUITEM "S&top Recording", IDM_MACRO_STOPRECORDINGMACRO
MENUITEM "&Playback", IDM_MACRO_PLAYBACKRECORDEDMACRO MENUITEM "&Playback", IDM_MACRO_PLAYBACKRECORDEDMACRO
MENUITEM "&Save current recorded macro", IDM_MACRO_SAVECURRENTMACRO MENUITEM "&Save current recorded macro...", IDM_MACRO_SAVECURRENTMACRO
MENUITEM "&Run a macro multiple times...", IDM_MACRO_RUNMULTIMACRODLG MENUITEM "&Run a macro multiple times...", IDM_MACRO_RUNMULTIMACRODLG
END END

View File

@ -331,43 +331,9 @@ ScintillaKeyDefinition scintKeyDefs[] = { //array of accelerator keys for all po
#ifdef UNICODE #ifdef UNICODE
#include "localizationString.h" #include "localizationString.h"
LocalizationSwicher::LocalizationSwicher() wstring LocalizationSwitcher::getLangFromXmlFileName(wchar_t *fn) const
{ {
TCHAR userPath[MAX_PATH]; size_t nbItem = sizeof(localizationDefs)/sizeof(LocalizationSwitcher::LocalizationDefinition);
// Make localConf.xml path
TCHAR localConfPath[MAX_PATH];
TCHAR nppPath[MAX_PATH];
::GetModuleFileName(NULL, nppPath, MAX_PATH);
PathRemoveFileSpec(nppPath);
lstrcpy(localConfPath, nppPath);
PathAppend(localConfPath, localConfFile);
// Test if localConf.xml exist
bool isLocal = (PathFileExists(localConfPath) == TRUE);
if (isLocal)
{
lstrcpy(userPath, nppPath);
}
else
{
ITEMIDLIST *pidl;
SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
SHGetPathFromIDList(pidl, userPath);
PathAppend(userPath, TEXT("Notepad++"));
}
TCHAR nativeLangPath[MAX_PATH];
lstrcpy(nativeLangPath, userPath);
PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
_nativeLangPath = nativeLangPath;
}
wstring LocalizationSwicher::getLangFromXmlFileName(wchar_t *fn) const
{
size_t nbItem = sizeof(localizationDefs)/sizeof(LocalizationSwicher::LocalizationDefinition);
for (size_t i = 0 ; i < nbItem ; i++) for (size_t i = 0 ; i < nbItem ; i++)
{ {
if (wcsicmp(fn, localizationDefs[i]._xmlFileName) == 0) if (wcsicmp(fn, localizationDefs[i]._xmlFileName) == 0)
@ -376,7 +342,7 @@ wstring LocalizationSwicher::getLangFromXmlFileName(wchar_t *fn) const
return TEXT(""); return TEXT("");
} }
wstring LocalizationSwicher::getXmlFilePathFromLangName(wchar_t *langName) const wstring LocalizationSwitcher::getXmlFilePathFromLangName(wchar_t *langName) const
{ {
for (size_t i = 0 ; i < _localizationList.size() ; i++) for (size_t i = 0 ; i < _localizationList.size() ; i++)
{ {
@ -386,19 +352,19 @@ wstring LocalizationSwicher::getXmlFilePathFromLangName(wchar_t *langName) const
return TEXT(""); return TEXT("");
} }
bool LocalizationSwicher::addLanguageFromXml(wstring xmlFullPath) bool LocalizationSwitcher::addLanguageFromXml(wstring xmlFullPath)
{ {
wchar_t * fn = ::PathFindFileNameW(xmlFullPath.c_str()); wchar_t * fn = ::PathFindFileNameW(xmlFullPath.c_str());
wstring foundLang = getLangFromXmlFileName(fn); wstring foundLang = getLangFromXmlFileName(fn);
if (foundLang != TEXT("")) if (foundLang != TEXT(""))
{ {
_localizationList.push_back(pair<wstring, wstring>(foundLang ,xmlFullPath)); _localizationList.push_back(pair<wstring, wstring>(foundLang, xmlFullPath));
return true; return true;
} }
return false; return false;
} }
bool LocalizationSwicher::switchToLang(wchar_t *lang2switch) const bool LocalizationSwitcher::switchToLang(wchar_t *lang2switch) const
{ {
wstring langPath = getXmlFilePathFromLangName(lang2switch); wstring langPath = getXmlFilePathFromLangName(lang2switch);
if (langPath == TEXT("")) if (langPath == TEXT(""))
@ -409,6 +375,17 @@ bool LocalizationSwicher::switchToLang(wchar_t *lang2switch) const
#endif #endif
generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) const
{
if (xmlFullPath == TEXT("")) return xmlFullPath;
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(xmlFullPath));
PathRemoveExtension(fn);
generic_string themeName = fn;
return themeName;
}
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
winVer getWindowsVersion() winVer getWindowsVersion()
@ -585,32 +562,30 @@ void cutString(const TCHAR *str2cut, vector<generic_string> & patternVect)
} }
} }
bool NppParameters::reloadStylers(TCHAR *stylePath)
{
if (_pXmlUserStylerDoc)
delete _pXmlUserStylerDoc;
_pXmlUserStylerDoc = new TiXmlDocument(stylePath?stylePath:_stylerPath);
bool loadOkay = _pXmlUserStylerDoc->LoadFile();
if (!loadOkay)
{
::MessageBox(NULL, TEXT("Load stylers.xml failed!"), TEXT("Configurator"),MB_OK);
delete _pXmlUserStylerDoc;
_pXmlUserStylerDoc = NULL;
return false;
}
_lexerStylerArray.eraseAll();
_widgetStyleArray.setNbStyler( 0 );
return getUserStylersFromXmlTree();
}
bool NppParameters::reloadLang() bool NppParameters::reloadLang()
{ {
TCHAR userPath[MAX_PATH];
// Make localConf.xml path
TCHAR localConfPath[MAX_PATH];
lstrcpy(localConfPath, _nppPath);
PathAppend(localConfPath, localConfFile);
// Test if localConf.xml exist
bool isLocal = (PathFileExists(localConfPath) == TRUE);
if (isLocal)
{
lstrcpy(userPath, _nppPath);
}
else
{
ITEMIDLIST *pidl;
SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
SHGetPathFromIDList(pidl, userPath);
PathAppend(userPath, TEXT("Notepad++"));
}
TCHAR nativeLangPath[MAX_PATH]; TCHAR nativeLangPath[MAX_PATH];
lstrcpy(nativeLangPath, userPath); lstrcpy(nativeLangPath, _userPath);
PathAppend(nativeLangPath, TEXT("nativeLang.xml")); PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
if (!PathFileExists(nativeLangPath)) if (!PathFileExists(nativeLangPath))
@ -639,8 +614,6 @@ bool NppParameters::load()
bool isAllLaoded = true; bool isAllLaoded = true;
for (int i = 0 ; i < NB_LANG ; _langList[i] = NULL, i++); for (int i = 0 ; i < NB_LANG ; _langList[i] = NULL, i++);
TCHAR userPath[MAX_PATH];
// Make localConf.xml path // Make localConf.xml path
TCHAR localConfPath[MAX_PATH]; TCHAR localConfPath[MAX_PATH];
lstrcpy(localConfPath, _nppPath); lstrcpy(localConfPath, _nppPath);
@ -651,21 +624,21 @@ bool NppParameters::load()
if (isLocal) if (isLocal)
{ {
lstrcpy(userPath, _nppPath); lstrcpy(_userPath, _nppPath);
} }
else else
{ {
ITEMIDLIST *pidl; ITEMIDLIST *pidl;
SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl); SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
SHGetPathFromIDList(pidl, userPath); SHGetPathFromIDList(pidl, _userPath);
PathAppend(userPath, TEXT("Notepad++")); PathAppend(_userPath, TEXT("Notepad++"));
lstrcpy(_appdataNppDir, userPath); lstrcpy(_appdataNppDir, _userPath);
if (!PathFileExists(userPath)) if (!PathFileExists(_userPath))
{ {
::CreateDirectory(userPath, NULL); ::CreateDirectory(_userPath, NULL);
} }
} }
@ -715,7 +688,7 @@ bool NppParameters::load()
// config.xml : for per user // // config.xml : for per user //
//---------------------------// //---------------------------//
TCHAR configPath[MAX_PATH]; TCHAR configPath[MAX_PATH];
lstrcpy(configPath, userPath); lstrcpy(configPath, _userPath);
PathAppend(configPath, TEXT("config.xml")); PathAppend(configPath, TEXT("config.xml"));
TCHAR srcConfigPath[MAX_PATH]; TCHAR srcConfigPath[MAX_PATH];
@ -758,20 +731,26 @@ bool NppParameters::load()
//----------------------------// //----------------------------//
// stylers.xml : for per user // // stylers.xml : for per user //
//----------------------------// //----------------------------//
TCHAR stylerPath[MAX_PATH];
lstrcpy(stylerPath, userPath); lstrcpy(_stylerPath, _userPath);
PathAppend(stylerPath, TEXT("stylers.xml")); PathAppend(_stylerPath, TEXT("stylers.xml"));
if (!PathFileExists(stylerPath)) if (!PathFileExists(_stylerPath))
{ {
TCHAR srcStylersPath[MAX_PATH]; TCHAR srcStylersPath[MAX_PATH];
lstrcpy(srcStylersPath, _nppPath); lstrcpy(srcStylersPath, _nppPath);
PathAppend(srcStylersPath, TEXT("stylers.model.xml")); PathAppend(srcStylersPath, TEXT("stylers.model.xml"));
::CopyFile(srcStylersPath, stylerPath, TRUE); ::CopyFile(srcStylersPath, _stylerPath, TRUE);
} }
_pXmlUserStylerDoc = new TiXmlDocument(stylerPath); if ( _nppGUI._themeName.empty() || (!PathFileExists(_nppGUI._themeName.c_str())) )
{
_nppGUI._themeName.assign(_stylerPath);
}
_pXmlUserStylerDoc = new TiXmlDocument(_nppGUI._themeName.c_str());
loadOkay = _pXmlUserStylerDoc->LoadFile(); loadOkay = _pXmlUserStylerDoc->LoadFile();
if (!loadOkay) if (!loadOkay)
{ {
@ -783,10 +762,14 @@ bool NppParameters::load()
else else
getUserStylersFromXmlTree(); getUserStylersFromXmlTree();
_themeSwitcher._stylesXmlPath = _stylerPath;
// Firstly, add the default theme
_themeSwitcher.addDefaultThemeFromXml(_stylerPath);
//-----------------------------------// //-----------------------------------//
// userDefineLang.xml : for per user // // userDefineLang.xml : for per user //
//-----------------------------------// //-----------------------------------//
lstrcpy(_userDefineLangPath, userPath); lstrcpy(_userDefineLangPath, _userPath);
PathAppend(_userDefineLangPath, TEXT("userDefineLang.xml")); PathAppend(_userDefineLangPath, TEXT("userDefineLang.xml"));
_pXmlUserLangDoc = new TiXmlDocument(_userDefineLangPath); _pXmlUserLangDoc = new TiXmlDocument(_userDefineLangPath);
@ -806,7 +789,7 @@ bool NppParameters::load()
// We'll look in the Notepad++ Dir. // // We'll look in the Notepad++ Dir. //
//----------------------------------------------// //----------------------------------------------//
TCHAR nativeLangPath[MAX_PATH]; TCHAR nativeLangPath[MAX_PATH];
lstrcpy(nativeLangPath, userPath); lstrcpy(nativeLangPath, _userPath);
PathAppend(nativeLangPath, TEXT("nativeLang.xml")); PathAppend(nativeLangPath, TEXT("nativeLang.xml"));
if (!PathFileExists(nativeLangPath)) if (!PathFileExists(nativeLangPath))
@ -824,36 +807,14 @@ bool NppParameters::load()
_pXmlNativeLangDocA = NULL; _pXmlNativeLangDocA = NULL;
isAllLaoded = false; isAllLaoded = false;
} }
#ifdef UNICODE
/* _localizationSwitcher._nativeLangPath = nativeLangPath;
//----------------------------------------------// #endif
// english.xml : for every user //
// Always in the Notepad++ Dir. //
//----------------------------------------------//
TCHAR englishPath[MAX_PATH];
lstrcpy(englishPath, _nppPath);
PathAppend(englishPath, TEXT("localization\\english.xml"));
if (PathFileExists(englishPath))
{
_pXmlEnglishDocA = new TiXmlDocumentA();
loadOkay = _pXmlEnglishDocA->LoadUnicodeFilePath(englishPath);
if (!loadOkay)
{
delete _pXmlEnglishDocA;
_pXmlEnglishDocA = NULL;
isAllLaoded = false;
}
}
*/
//---------------------------------// //---------------------------------//
// toolbarIcons.xml : for per user // // toolbarIcons.xml : for per user //
//---------------------------------// //---------------------------------//
TCHAR toolbarIconsPath[MAX_PATH]; TCHAR toolbarIconsPath[MAX_PATH];
lstrcpy(toolbarIconsPath, userPath); lstrcpy(toolbarIconsPath, _userPath);
PathAppend(toolbarIconsPath, TEXT("toolbarIcons.xml")); PathAppend(toolbarIconsPath, TEXT("toolbarIcons.xml"));
_pXmlToolIconsDoc = new TiXmlDocument(toolbarIconsPath); _pXmlToolIconsDoc = new TiXmlDocument(toolbarIconsPath);
@ -868,7 +829,7 @@ bool NppParameters::load()
//------------------------------// //------------------------------//
// shortcuts.xml : for per user // // shortcuts.xml : for per user //
//------------------------------// //------------------------------//
lstrcpy(_shortcutsPath, userPath); lstrcpy(_shortcutsPath, _userPath);
PathAppend(_shortcutsPath, TEXT("shortcuts.xml")); PathAppend(_shortcutsPath, TEXT("shortcuts.xml"));
if (!PathFileExists(_shortcutsPath)) if (!PathFileExists(_shortcutsPath))
@ -902,7 +863,7 @@ bool NppParameters::load()
//---------------------------------// //---------------------------------//
// contextMenu.xml : for per user // // contextMenu.xml : for per user //
//---------------------------------// //---------------------------------//
lstrcpy(_contextMenuPath, userPath); lstrcpy(_contextMenuPath, _userPath);
PathAppend(_contextMenuPath, TEXT("contextMenu.xml")); PathAppend(_contextMenuPath, TEXT("contextMenu.xml"));
if (!PathFileExists(_contextMenuPath)) if (!PathFileExists(_contextMenuPath))
@ -928,7 +889,7 @@ bool NppParameters::load()
//----------------------------// //----------------------------//
// session.xml : for per user // // session.xml : for per user //
//----------------------------// //----------------------------//
lstrcpy(_sessionPath, userPath); lstrcpy(_sessionPath, _userPath);
PathAppend(_sessionPath, TEXT("session.xml")); PathAppend(_sessionPath, TEXT("session.xml"));
// Don't load session.xml if not required in order to speed up!! // Don't load session.xml if not required in order to speed up!!
@ -2280,6 +2241,17 @@ void LexerStylerArray::addLexerStyler(const TCHAR *lexerName, const TCHAR *lexer
} }
} }
void LexerStylerArray::eraseAll()
{
for (int i = 0 ; i < _nbLexerStyler ; i++)
{
_lexerStylerArray[i].setNbStyler( 0 );
}
_nbLexerStyler = 0;
}
void StyleArray::addStyler(int styleID, TiXmlNode *styleNode) void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
{ {
_styleArray[_nbStyler]._styleID = styleID; _styleArray[_nbStyler]._styleID = styleID;
@ -3228,6 +3200,12 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
_nppGUI._shortTitlebar = false; _nppGUI._shortTitlebar = false;
} }
} }
else if (!lstrcmp(nm, TEXT("stylerTheme")))
{
const TCHAR *themePath = element->Attribute(TEXT("path"));
if (themePath != NULL && themePath != TEXT(""))
_nppGUI._themeName.assign(themePath);
}
} }
} }
@ -3255,7 +3233,7 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
else if (!lstrcmp(nm, TEXT("hide"))) else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._bookMarkMarginShow = false; _svp[whichOne]._bookMarkMarginShow = false;
} }
/*
// doc change state Margin // doc change state Margin
nm = element->Attribute(TEXT("docChangeStateMargin")); nm = element->Attribute(TEXT("docChangeStateMargin"));
if (nm) if (nm)
@ -3266,7 +3244,7 @@ void NppParameters::feedScintillaParam(bool whichOne, TiXmlNode *node)
else if (!lstrcmp(nm, TEXT("hide"))) else if (!lstrcmp(nm, TEXT("hide")))
_svp[whichOne]._docChangeStateMarginShow = false; _svp[whichOne]._docChangeStateMarginShow = false;
} }
*/
// Indent GuideLine // Indent GuideLine
nm = element->Attribute(TEXT("indentGuideLine")); nm = element->Attribute(TEXT("indentGuideLine"));
if (nm) if (nm)
@ -3468,7 +3446,7 @@ bool NppParameters::writeScintillaParams(const ScintillaViewParams & svp, bool w
(scintNode->ToElement())->SetAttribute(TEXT("lineNumberMargin"), svp._lineNumberMarginShow?TEXT("show"):TEXT("hide")); (scintNode->ToElement())->SetAttribute(TEXT("lineNumberMargin"), svp._lineNumberMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("bookMarkMargin"), svp._bookMarkMarginShow?TEXT("show"):TEXT("hide")); (scintNode->ToElement())->SetAttribute(TEXT("bookMarkMargin"), svp._bookMarkMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("docChangeStateMargin"), svp._docChangeStateMarginShow?TEXT("show"):TEXT("hide")); //(scintNode->ToElement())->SetAttribute(TEXT("docChangeStateMargin"), svp._docChangeStateMarginShow?TEXT("show"):TEXT("hide"));
(scintNode->ToElement())->SetAttribute(TEXT("indentGuideLine"), svp._indentGuideLineShow?TEXT("show"):TEXT("hide")); (scintNode->ToElement())->SetAttribute(TEXT("indentGuideLine"), svp._indentGuideLineShow?TEXT("show"):TEXT("hide"));
const TCHAR *pFolderStyleStr = (svp._folderStyle == FOLDER_STYLE_SIMPLE)?TEXT("simple"): const TCHAR *pFolderStyleStr = (svp._folderStyle == FOLDER_STYLE_SIMPLE)?TEXT("simple"):
(svp._folderStyle == FOLDER_STYLE_ARROW)?TEXT("arrow"): (svp._folderStyle == FOLDER_STYLE_ARROW)?TEXT("arrow"):
@ -3526,6 +3504,7 @@ bool NppParameters::writeGUIParams()
bool caretExist = false; bool caretExist = false;
bool openSaveDirExist = false; bool openSaveDirExist = false;
bool titleBarExist = false; bool titleBarExist = false;
bool stylerThemeExist = false;
TiXmlNode *dockingParamNode = NULL; TiXmlNode *dockingParamNode = NULL;
@ -3865,6 +3844,11 @@ bool NppParameters::writeGUIParams()
//pStr = (_nppGUI._showDirty)?TEXT("yes"):TEXT("no"); //pStr = (_nppGUI._showDirty)?TEXT("yes"):TEXT("no");
//element->SetAttribute(TEXT("showDirty"), pStr); //element->SetAttribute(TEXT("showDirty"), pStr);
} }
else if (!lstrcmp(nm, TEXT("stylerTheme")))
{
stylerThemeExist = true;
element->SetAttribute(TEXT("path"), _nppGUI._themeName.c_str());
}
} }
if (!noUpdateExist) if (!noUpdateExist)
@ -4045,6 +4029,12 @@ bool NppParameters::writeGUIParams()
const TCHAR *pStr = (_nppGUI._shortTitlebar)?TEXT("yes"):TEXT("no"); const TCHAR *pStr = (_nppGUI._shortTitlebar)?TEXT("yes"):TEXT("no");
GUIConfigElement->SetAttribute(TEXT("short"), pStr); GUIConfigElement->SetAttribute(TEXT("short"), pStr);
} }
if (!stylerThemeExist)
{
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
GUIConfigElement->SetAttribute(TEXT("name"), TEXT("stylerTheme"));
GUIConfigElement->SetAttribute(TEXT("path"), _nppGUI._themeName.c_str());
}
insertDockingParamNode(GUIRoot); insertDockingParamNode(GUIRoot);
return true; return true;

View File

@ -137,8 +137,22 @@ struct CmdLineParams {
bool _isNoTab; bool _isNoTab;
int _line2go; int _line2go;
int _column2go;
POINT _point;
bool _isPointXValid;
bool _isPointYValid;
bool isPointValid() {
return _isPointXValid && _isPointXValid;
};
LangType _langType; LangType _langType;
CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false), _line2go(-1), _langType(L_EXTERNAL){} CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false),\
_line2go(-1), _column2go(-1), _langType(L_EXTERNAL), _isPointXValid(false), _isPointYValid(false)
{
_point.x = 0;
_point.y = 0;
}
}; };
struct FloatingWindowInfo { struct FloatingWindowInfo {
@ -466,7 +480,7 @@ public :
}; };
bool hasEnoughSpace() {return (_nbLexerStyler < MAX_LEXER_STYLE);}; bool hasEnoughSpace() {return (_nbLexerStyler < MAX_LEXER_STYLE);};
void addLexerStyler(const TCHAR *lexerName, const TCHAR *lexerDesc, const TCHAR *lexerUserExt, TiXmlNode *lexerNode); void addLexerStyler(const TCHAR *lexerName, const TCHAR *lexerDesc, const TCHAR *lexerUserExt, TiXmlNode *lexerNode);
void eraseAll();
private : private :
LexerStyler _lexerStylerArray[MAX_LEXER_STYLE]; LexerStyler _lexerStylerArray[MAX_LEXER_STYLE];
int _nbLexerStyler; int _nbLexerStyler;
@ -538,7 +552,7 @@ struct NppGUI
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\ _isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\ _doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
_autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\ _autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false) { _doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false), _themeName(TEXT("")) {
_appPos.left = 0; _appPos.left = 0;
_appPos.top = 0; _appPos.top = 0;
_appPos.right = 700; _appPos.right = 700;
@ -617,17 +631,18 @@ struct NppGUI
OpenSaveDirSetting _openSaveDir; OpenSaveDirSetting _openSaveDir;
TCHAR _defaultDir[MAX_PATH]; TCHAR _defaultDir[MAX_PATH];
TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables TCHAR _defaultDirExp[MAX_PATH]; //expanded environment variables
generic_string _themeName;
}; };
struct ScintillaViewParams struct ScintillaViewParams
{ {
ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true), _docChangeStateMarginShow(true),\ ScintillaViewParams() : _lineNumberMarginShow(true), _bookMarkMarginShow(true),\
_folderStyle(FOLDER_STYLE_BOX), _indentGuideLineShow(true),\ _folderStyle(FOLDER_STYLE_BOX), _indentGuideLineShow(true),\
_currentLineHilitingShow(true), _wrapSymbolShow(false), _doWrap(false),\ _currentLineHilitingShow(true), _wrapSymbolShow(false), _doWrap(false),\
_zoom(0), _whiteSpaceShow(false), _eolShow(false){}; _zoom(0), _whiteSpaceShow(false), _eolShow(false){};
bool _lineNumberMarginShow; bool _lineNumberMarginShow;
bool _bookMarkMarginShow; bool _bookMarkMarginShow;
bool _docChangeStateMarginShow; //bool _docChangeStateMarginShow;
folderStyle _folderStyle; //"simple", TEXT("arrow"), TEXT("circle") and "box" folderStyle _folderStyle; //"simple", TEXT("arrow"), TEXT("circle") and "box"
bool _indentGuideLineShow; bool _indentGuideLineShow;
bool _currentLineHilitingShow; bool _currentLineHilitingShow;
@ -833,9 +848,10 @@ struct FindHistory {
#ifdef UNICODE #ifdef UNICODE
class LocalizationSwicher { class LocalizationSwitcher {
friend class NppParameters;
public : public :
LocalizationSwicher(); LocalizationSwitcher() {};
struct LocalizationDefinition { struct LocalizationDefinition {
wchar_t *_langName; wchar_t *_langName;
@ -864,6 +880,58 @@ private :
}; };
#endif #endif
class ThemeSwitcher {
friend class NppParameters;
public :
ThemeSwitcher(){};
struct ThemeDefinition {
TCHAR *_themeName;
TCHAR *_xmlFileName;
};
void addThemeFromXml(generic_string xmlFullPath) {
_themeList.push_back(pair<generic_string, generic_string>(getThemeFromXmlFileName(xmlFullPath.c_str()), xmlFullPath));
};
void addDefaultThemeFromXml(generic_string xmlFullPath) {
_themeList.push_back(pair<generic_string, generic_string>(TEXT("Default"), xmlFullPath));
};
generic_string getThemeFromXmlFileName(const TCHAR *fn) const;
generic_string getXmlFilePathFromThemeName(const TCHAR *themeName) const {
if (!themeName || themeName[0])
return TEXT("");
generic_string themePath = _stylesXmlPath;
return themePath;
};
bool themeNameExists(const TCHAR *themeName) {
for (size_t i = 0; i < _themeList.size(); i++ )
{
if (! (getElementFromIndex(i)).first.compare(themeName) ) return true;
}
return false;
}
size_t size() const {
return _themeList.size();
};
pair<generic_string, generic_string> & getElementFromIndex(size_t index) {
//if (index >= _themeList.size())
//return pair<generic_string, generic_string>(TEXT(""), TEXT(""));
return _themeList[index];
};
private :
vector< pair< generic_string, generic_string > > _themeList;
generic_string _stylesXmlPath;
};
const int NB_LANG = 80; const int NB_LANG = 80;
const bool DUP = true; const bool DUP = true;
@ -876,6 +944,7 @@ public:
static LangType getLangIDFromStr(const TCHAR *langName); static LangType getLangIDFromStr(const TCHAR *langName);
bool load(); bool load();
bool reloadLang(); bool reloadLang();
bool reloadStylers(TCHAR *stylePath = NULL);
void destroyInstance(); void destroyInstance();
bool _isTaskListRBUTTONUP_Active; bool _isTaskListRBUTTONUP_Active;
@ -1184,11 +1253,13 @@ public:
bool _isFindReplacing; // an on the fly variable for find/replace functions bool _isFindReplacing; // an on the fly variable for find/replace functions
#ifdef UNICODE #ifdef UNICODE
LocalizationSwicher & getLocalizationSwitcher() { LocalizationSwitcher & getLocalizationSwitcher() {
return _localizationSwitcher; return _localizationSwitcher;
}; };
#endif #endif
ThemeSwitcher & getThemeSwitcher() {
return _themeSwitcher;
};
private: private:
NppParameters(); NppParameters();
@ -1248,9 +1319,10 @@ private:
vector<ScintillaKeyMap> _scintillaKeyCommands; //scintilla keycommands. Static size vector<ScintillaKeyMap> _scintillaKeyCommands; //scintilla keycommands. Static size
vector<int> _scintillaModifiedKeyIndices; //modified scintilla keys. Indices static, determined by searching for commandId. Needed when saving alterations vector<int> _scintillaModifiedKeyIndices; //modified scintilla keys. Indices static, determined by searching for commandId. Needed when saving alterations
#ifdef UNICODE #ifdef UNICODE
LocalizationSwicher _localizationSwitcher; LocalizationSwitcher _localizationSwitcher;
#endif #endif
ThemeSwitcher _themeSwitcher;
//vector<generic_string> _noMenuCmdNames; //vector<generic_string> _noMenuCmdNames;
vector<MenuItemUnit> _contextMenuItems; vector<MenuItemUnit> _contextMenuItems;
Session _session; Session _session;
@ -1259,6 +1331,8 @@ private:
TCHAR _contextMenuPath[MAX_PATH]; TCHAR _contextMenuPath[MAX_PATH];
TCHAR _sessionPath[MAX_PATH]; TCHAR _sessionPath[MAX_PATH];
TCHAR _nppPath[MAX_PATH]; TCHAR _nppPath[MAX_PATH];
TCHAR _userPath[MAX_PATH];
TCHAR _stylerPath[MAX_PATH];
TCHAR _appdataNppDir[MAX_PATH]; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == TEXT(""))?"doLocalConf.xml present":"doLocalConf.xml absent" TCHAR _appdataNppDir[MAX_PATH]; // sentinel of the absence of "doLocalConf.xml" : (_appdataNppDir == TEXT(""))?"doLocalConf.xml present":"doLocalConf.xml absent"
TCHAR _currentDirectory[MAX_PATH]; TCHAR _currentDirectory[MAX_PATH];

View File

@ -327,7 +327,7 @@ void Buffer::setDeferredReload() { //triggers a reload on the next Document acce
doNotify(BufferChangeDirty); doNotify(BufferChangeDirty);
} }
/*
pair<size_t, bool> Buffer::getLineUndoState(size_t currentLine) const pair<size_t, bool> Buffer::getLineUndoState(size_t currentLine) const
{ {
for (size_t i = 0 ; i < _linesUndoState.size() ; i++) for (size_t i = 0 ; i < _linesUndoState.size() ; i++)
@ -354,6 +354,7 @@ void Buffer::setLineUndoState(size_t currentLine, size_t undoLevel, bool isSaved
_linesUndoState.push_back(pair<size_t, pair<size_t, bool> >(currentLine, pair<size_t, bool>(undoLevel, false))); _linesUndoState.push_back(pair<size_t, pair<size_t, bool> >(currentLine, pair<size_t, bool>(undoLevel, false)));
} }
} }
*/
//filemanager //filemanager
@ -581,7 +582,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy) {
buffer->setStatus(DOC_REGULAR); buffer->setStatus(DOC_REGULAR);
buffer->checkFileState(); buffer->checkFileState();
_pscratchTilla->execute(SCI_SETSAVEPOINT); _pscratchTilla->execute(SCI_SETSAVEPOINT);
_pscratchTilla->markSavedLines(); //_pscratchTilla->markSavedLines();
_pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault); _pscratchTilla->execute(SCI_SETDOCPOINTER, 0, _scratchDocDefault);
return true; return true;
@ -589,7 +590,8 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy) {
return false; return false;
} }
BufferID FileManager::newEmptyDocument() { BufferID FileManager::newEmptyDocument()
{
TCHAR newTitle[10]; TCHAR newTitle[10];
lstrcpy(newTitle, UNTITLED_STR); lstrcpy(newTitle, UNTITLED_STR);
wsprintf(newTitle+4, TEXT("%d"), _nextNewNumber); wsprintf(newTitle+4, TEXT("%d"), _nextNewNumber);

View File

@ -323,8 +323,11 @@ public :
void setNeedReload(bool reload) { void setNeedReload(bool reload) {
_needReloading = reload; _needReloading = reload;
} }
/*
pair<size_t, bool> getLineUndoState(size_t currentLine) const; pair<size_t, bool> getLineUndoState(size_t currentLine) const;
void setLineUndoState(size_t currentLine, size_t undoLevel, bool isSaved = false); void setLineUndoState(size_t currentLine, size_t undoLevel, bool isSaved = false);
*/
int docLength() const { int docLength() const {
return _pManager->docLength(_id); return _pManager->docLength(_id);
@ -350,7 +353,8 @@ private :
vector< ScintillaEditView * > _referees; vector< ScintillaEditView * > _referees;
vector< Position > _positions; vector< Position > _positions;
vector< vector<HeaderLineState> > _foldStates; vector< vector<HeaderLineState> > _foldStates;
vector< pair<size_t, pair<size_t, bool> > > _linesUndoState;
//vector< pair<size_t, pair<size_t, bool> > > _linesUndoState;
//Environment properties //Environment properties
DocFileStatus _currentStatus; DocFileStatus _currentStatus;

View File

@ -30,7 +30,7 @@ UserDefineDialog ScintillaEditView::_userDefineDlg;
const int ScintillaEditView::_SC_MARGE_LINENUMBER = 0; const int ScintillaEditView::_SC_MARGE_LINENUMBER = 0;
const int ScintillaEditView::_SC_MARGE_SYBOLE = 1; const int ScintillaEditView::_SC_MARGE_SYBOLE = 1;
const int ScintillaEditView::_SC_MARGE_FOLDER = 2; const int ScintillaEditView::_SC_MARGE_FOLDER = 2;
const int ScintillaEditView::_SC_MARGE_MODIFMARKER = 3; //const int ScintillaEditView::_SC_MARGE_MODIFMARKER = 3;
WNDPROC ScintillaEditView::_scintillaDefaultProc = NULL; WNDPROC ScintillaEditView::_scintillaDefaultProc = NULL;
/* /*
@ -153,14 +153,14 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
showMargin(_SC_MARGE_FOLDER, true); showMargin(_SC_MARGE_FOLDER, true);
execute(SCI_SETMARGINMASKN, _SC_MARGE_SYBOLE, (1<<MARK_BOOKMARK) | (1<<MARK_HIDELINESBEGIN) | (1<<MARK_HIDELINESEND)); execute(SCI_SETMARGINMASKN, _SC_MARGE_SYBOLE, (1<<MARK_BOOKMARK) | (1<<MARK_HIDELINESBEGIN) | (1<<MARK_HIDELINESEND));
/*
execute(SCI_SETMARGINMASKN, _SC_MARGE_MODIFMARKER, (1<<MARK_LINEMODIFIEDUNSAVED)|(1<<MARK_LINEMODIFIEDSAVED)); execute(SCI_SETMARGINMASKN, _SC_MARGE_MODIFMARKER, (1<<MARK_LINEMODIFIEDUNSAVED)|(1<<MARK_LINEMODIFIEDSAVED));
execute(SCI_SETMARGINTYPEN, _SC_MARGE_MODIFMARKER, SC_MARGIN_BACK); execute(SCI_SETMARGINTYPEN, _SC_MARGE_MODIFMARKER, SC_MARGIN_BACK);
showMargin(_SC_MARGE_MODIFMARKER, true); showMargin(_SC_MARGE_MODIFMARKER, true);
execute(SCI_MARKERDEFINE, MARK_LINEMODIFIEDSAVED, SCI_MARKERDEFINE); execute(SCI_MARKERDEFINE, MARK_LINEMODIFIEDSAVED, SCI_MARKERDEFINE);
execute(SCI_MARKERDEFINE, MARK_LINEMODIFIEDUNSAVED, SCI_MARKERDEFINE); execute(SCI_MARKERDEFINE, MARK_LINEMODIFIEDUNSAVED, SCI_MARKERDEFINE);
*/
execute(SCI_MARKERSETALPHA, MARK_BOOKMARK, 70); execute(SCI_MARKERSETALPHA, MARK_BOOKMARK, 70);
execute(SCI_MARKERDEFINEPIXMAP, MARK_BOOKMARK, (LPARAM)bookmark_xpm); execute(SCI_MARKERDEFINEPIXMAP, MARK_BOOKMARK, (LPARAM)bookmark_xpm);
execute(SCI_MARKERDEFINEPIXMAP, MARK_HIDELINESBEGIN, (LPARAM)acTop_xpm); execute(SCI_MARKERDEFINEPIXMAP, MARK_HIDELINESBEGIN, (LPARAM)acTop_xpm);
@ -1220,29 +1220,29 @@ void ScintillaEditView::defineDocType(LangType typeDoc)
} }
//All the global styles should put here //All the global styles should put here
static int indexOfIndentGuide = stylers.getStylerIndexByID(STYLE_INDENTGUIDE); int indexOfIndentGuide = stylers.getStylerIndexByID(STYLE_INDENTGUIDE);
if (indexOfIndentGuide != -1) if (indexOfIndentGuide != -1)
{ {
static Style & styleIG = stylers.getStyler(indexOfIndentGuide); Style & styleIG = stylers.getStyler(indexOfIndentGuide);
setStyle(styleIG); setStyle(styleIG);
} }
static int indexOfBraceLight = stylers.getStylerIndexByID(STYLE_BRACELIGHT); int indexOfBraceLight = stylers.getStylerIndexByID(STYLE_BRACELIGHT);
if (indexOfBraceLight != -1) if (indexOfBraceLight != -1)
{ {
static Style & styleBL = stylers.getStyler(indexOfBraceLight); Style & styleBL = stylers.getStyler(indexOfBraceLight);
setStyle(styleBL); setStyle(styleBL);
} }
//setStyle(STYLE_CONTROLCHAR, liteGrey); //setStyle(STYLE_CONTROLCHAR, liteGrey);
static int indexBadBrace = stylers.getStylerIndexByID(STYLE_BRACEBAD); int indexBadBrace = stylers.getStylerIndexByID(STYLE_BRACEBAD);
if (indexBadBrace != -1) if (indexBadBrace != -1)
{ {
static Style & styleBB = stylers.getStyler(indexBadBrace); Style & styleBB = stylers.getStyler(indexBadBrace);
setStyle(styleBB); setStyle(styleBB);
} }
static int indexLineNumber = stylers.getStylerIndexByID(STYLE_LINENUMBER); int indexLineNumber = stylers.getStylerIndexByID(STYLE_LINENUMBER);
if (indexLineNumber != -1) if (indexLineNumber != -1)
{ {
static Style & styleLN = stylers.getStyler(indexLineNumber); Style & styleLN = stylers.getStyler(indexLineNumber);
setSpecialStyle(styleLN); setSpecialStyle(styleLN);
} }
execute(SCI_SETTABWIDTH, ((NppParameters::getInstance())->getNppGUI())._tabSize); execute(SCI_SETTABWIDTH, ((NppParameters::getInstance())->getNppGUI())._tabSize);
@ -1901,7 +1901,7 @@ void ScintillaEditView::performGlobalStyles()
} }
for (int j = 0 ; j < NB_FOLDER_STATE ; j++) for (int j = 0 ; j < NB_FOLDER_STATE ; j++)
defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[_folderStyle][j], foldfgColor, foldbgColor); defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[_folderStyle][j], foldfgColor, foldbgColor);
/*
COLORREF unsavedChangebgColor = liteRed; COLORREF unsavedChangebgColor = liteRed;
i = stylers.getStylerIndexByName(TEXT("Unsaved change marker")); i = stylers.getStylerIndexByName(TEXT("Unsaved change marker"));
if (i != -1) if (i != -1)
@ -1919,7 +1919,7 @@ void ScintillaEditView::performGlobalStyles()
savedChangebgColor = style._bgColor; savedChangebgColor = style._bgColor;
} }
execute(SCI_MARKERSETBACK, MARK_LINEMODIFIEDSAVED, savedChangebgColor); execute(SCI_MARKERSETBACK, MARK_LINEMODIFIEDSAVED, savedChangebgColor);
*/
COLORREF wsSymbolFgColor = black; COLORREF wsSymbolFgColor = black;
i = stylers.getStylerIndexByName(TEXT("White space symbol")); i = stylers.getStylerIndexByName(TEXT("White space symbol"));
if (i != -1) if (i != -1)

View File

@ -102,8 +102,8 @@ const UCHAR BASE_02 = 0x03; // Bin
const int MARK_BOOKMARK = 24; const int MARK_BOOKMARK = 24;
const int MARK_HIDELINESBEGIN = 23; const int MARK_HIDELINESBEGIN = 23;
const int MARK_HIDELINESEND = 22; const int MARK_HIDELINESEND = 22;
const int MARK_LINEMODIFIEDUNSAVED = 21; //const int MARK_LINEMODIFIEDUNSAVED = 21;
const int MARK_LINEMODIFIEDSAVED = 20; //const int MARK_LINEMODIFIEDSAVED = 20;
// 24 - 16 reserved for Notepad++ internal used // 24 - 16 reserved for Notepad++ internal used
// 15 - 0 are free to use for plugins // 15 - 0 are free to use for plugins
@ -245,7 +245,7 @@ public:
static const int _SC_MARGE_LINENUMBER; static const int _SC_MARGE_LINENUMBER;
static const int _SC_MARGE_SYBOLE; static const int _SC_MARGE_SYBOLE;
static const int _SC_MARGE_FOLDER; static const int _SC_MARGE_FOLDER;
static const int _SC_MARGE_MODIFMARKER; //static const int _SC_MARGE_MODIFMARKER;
void showMargin(int whichMarge, bool willBeShowed = true) { void showMargin(int whichMarge, bool willBeShowed = true) {
if (whichMarge == _SC_MARGE_LINENUMBER) if (whichMarge == _SC_MARGE_LINENUMBER)
@ -526,7 +526,7 @@ public:
return false; return false;
}; };
void setHiLiteResultWords(const TCHAR *keywords); void setHiLiteResultWords(const TCHAR *keywords);
/*
pair<size_t, bool> getLineUndoState(size_t currentLine) { pair<size_t, bool> getLineUndoState(size_t currentLine) {
Buffer * buf = getCurrentBuffer(); Buffer * buf = getCurrentBuffer();
return buf->getLineUndoState(currentLine); return buf->getLineUndoState(currentLine);
@ -548,7 +548,7 @@ public:
} }
} }
}; };
*/
protected: protected:
static HINSTANCE _hLib; static HINSTANCE _hLib;
static int _refCount; static int _refCount;

View File

@ -71,21 +71,14 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
{ {
_lsArray = (NppParameters::getInstance())->getLStylerArray(); NppParameters *nppParamInst = NppParameters::getInstance();
_globalStyles = (NppParameters::getInstance())->getGlobalStylers();
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)TEXT("Global Styles"));
// All the lexers
for (int i = 0 ; i < _lsArray.getNbLexer() ; i++)
{
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i));
}
_hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK); _hCheckBold = ::GetDlgItem(_hSelf, IDC_BOLD_CHECK);
_hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK); _hCheckItalic = ::GetDlgItem(_hSelf, IDC_ITALIC_CHECK);
_hCheckUnderline = ::GetDlgItem(_hSelf, IDC_UNDERLINE_CHECK); _hCheckUnderline = ::GetDlgItem(_hSelf, IDC_UNDERLINE_CHECK);
_hFontNameCombo = ::GetDlgItem(_hSelf, IDC_FONT_COMBO); _hFontNameCombo = ::GetDlgItem(_hSelf, IDC_FONT_COMBO);
_hFontSizeCombo = ::GetDlgItem(_hSelf, IDC_FONTSIZE_COMBO); _hFontSizeCombo = ::GetDlgItem(_hSelf, IDC_FONTSIZE_COMBO);
_hSwitch2ThemeCombo = ::GetDlgItem(_hSelf, IDC_SWITCH2THEME_COMBO);
_hFgColourStaticText = ::GetDlgItem(_hSelf, IDC_FG_STATIC); _hFgColourStaticText = ::GetDlgItem(_hSelf, IDC_FG_STATIC);
_hBgColourStaticText = ::GetDlgItem(_hSelf, IDC_BG_STATIC); _hBgColourStaticText = ::GetDlgItem(_hSelf, IDC_BG_STATIC);
@ -96,6 +89,29 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
colourHooker.setColour(RGB(0xFF, 0x00, 0x00)); colourHooker.setColour(RGB(0xFF, 0x00, 0x00));
colourHooker.hookOn(_hStyleInfoStaticText); colourHooker.hookOn(_hStyleInfoStaticText);
_currentThemeIndex = -1;
int defaultThemeIndex = 0;
ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher();
for(size_t i = 0 ; i < themeSwitcher.size() ; i++)
{
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i);
int j = ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, (LPARAM)themeInfo.first.c_str());
::SendMessage(_hSwitch2ThemeCombo, CB_SETITEMDATA, j, (LPARAM)themeInfo.second.c_str());
if (! themeInfo.second.compare( nppParamInst->getNppGUI()._themeName ) )
{
_currentThemeIndex = j;
}
if (! themeInfo.first.compare(TEXT("Default")) )
{
defaultThemeIndex = j;
}
}
if (_currentThemeIndex == -1)
{
_currentThemeIndex = defaultThemeIndex;
}
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
for(int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; i++) for(int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; i++)
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[i]); ::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[i]);
@ -124,14 +140,11 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
_pFgColour->display(); _pFgColour->display();
_pBgColour->display(); _pBgColour->display();
const int index2Begin = 0;
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_SETCURSEL, 0, index2Begin);
setStyleListFromLexer(index2Begin);
::EnableWindow(::GetDlgItem(_hSelf, IDOK), _isDirty);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), !_isSync);
NppParameters *pNppParam = NppParameters::getInstance(); ::EnableWindow(::GetDlgItem(_hSelf, IDOK), _isDirty);
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture(); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE/*!_isSync*/);
ETDTProc enableDlgTheme = (ETDTProc)nppParamInst->getEnableThemeDlgTexture();
if (enableDlgTheme) if (enableDlgTheme)
{ {
enableDlgTheme(_hSelf, ETDT_ENABLETAB); enableDlgTheme(_hSelf, ETDT_ENABLETAB);
@ -141,6 +154,9 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
updateGlobalOverrideCtrls(); updateGlobalOverrideCtrls();
setVisualFromStyleList(); setVisualFromStyleList();
goToCenter(); goToCenter();
loadLangListFromNppParam();
return TRUE; return TRUE;
} }
@ -206,19 +222,40 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
//::MessageBox(NULL, TEXT("cancel"), TEXT(""), MB_OK); //::MessageBox(NULL, TEXT("cancel"), TEXT(""), MB_OK);
if (_isDirty) if (_isDirty)
{ {
//::MessageBox(NULL, TEXT("dirty"), TEXT(""), MB_OK); NppParameters *nppParamInst = NppParameters::getInstance();
LexerStylerArray & lsArray = (NppParameters::getInstance())->getLStylerArray(); if (_restoreInvalid)
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers(); {
generic_string str( nppParamInst->getNppGUI()._themeName );
nppParamInst->reloadStylers( &str[0] );
}
LexerStylerArray & lsArray = nppParamInst->getLStylerArray();
StyleArray & globalStyles = nppParamInst->getGlobalStylers();
globalStyles = _globalStyles = _gstyles2restored; if (_restoreInvalid)
lsArray = _lsArray = _styles2restored; {
_lsArray = _styles2restored = lsArray;
_globalStyles = _gstyles2restored = globalStyles;
}
else
{
globalStyles = _globalStyles = _gstyles2restored;
lsArray = _lsArray = _styles2restored;
}
restoreGlobalOverrideValues(); restoreGlobalOverrideValues();
_restoreInvalid = false;
_isDirty = false; _isDirty = false;
_isThemeDirty = false;
setVisualFromStyleList(); setVisualFromStyleList();
//(nppParamInst->getNppGUI())._themeName
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
} }
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), !_isSync); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE/*!_isSync*/);
display(false); display(false);
return TRUE; return TRUE;
@ -229,15 +266,19 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray(); LexerStylerArray & lsa = (NppParameters::getInstance())->getLStylerArray();
StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers(); StyleArray & globalStyles = (NppParameters::getInstance())->getGlobalStylers();
lsa = _lsArray; _lsArray = lsa;
globalStyles = _globalStyles; _globalStyles = globalStyles;
updateThemeName(_themeName);
_restoreInvalid = false;
_currentThemeIndex = ::SendMessage(_hSwitch2ThemeCombo, CB_GETCURSEL, 0, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
_isDirty = false; _isDirty = false;
} }
_isThemeDirty = false;
(NppParameters::getInstance())->writeStyles(_lsArray, _globalStyles); (NppParameters::getInstance())->writeStyles(_lsArray, _globalStyles);
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), FALSE);
_isSync = true; //_isSync = true;
display(false); display(false);
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
return TRUE; return TRUE;
@ -339,12 +380,24 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
{ {
int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETCURSEL, 0, 0); int i = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETCURSEL, 0, 0);
if (i != LB_ERR) if (i != LB_ERR)
{
bool prevThemeState = _isThemeDirty;
setStyleListFromLexer(i); setStyleListFromLexer(i);
_isThemeDirty = prevThemeState;
}
break; break;
} }
case IDC_STYLES_LIST : case IDC_STYLES_LIST :
setVisualFromStyleList(); setVisualFromStyleList();
break; break;
case IDC_SWITCH2THEME_COMBO :
switchToTheme();
setVisualFromStyleList();
notifyDataModified();
_isThemeDirty = false;
apply();
break;
} }
return TRUE; return TRUE;
} }
@ -400,6 +453,34 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
return FALSE; return FALSE;
} }
void WordStyleDlg::loadLangListFromNppParam()
{
NppParameters *nppParamInst = NppParameters::getInstance();
_lsArray = nppParamInst->getLStylerArray();
_globalStyles = nppParamInst->getGlobalStylers();
// Clean up Language List
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_RESETCONTENT, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)TEXT("Global Styles"));
// All the lexers
for (int i = 0 ; i < _lsArray.getNbLexer() ; i++)
{
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i));
}
const int index2Begin = 0;
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_SETCURSEL, 0, index2Begin);
setStyleListFromLexer(index2Begin);
}
void WordStyleDlg::updateThemeName(generic_string themeName)
{
NppParameters *pNppParam = NppParameters::getInstance();
NppGUI & nppGUI = (NppGUI & )pNppParam->getNppGUI();
nppGUI._themeName.assign( themeName );
}
void WordStyleDlg::updateColour(bool which) void WordStyleDlg::updateColour(bool which)
{ {
Style & style = getCurrentStyler(); Style & style = getCurrentStyler();
@ -504,6 +585,39 @@ void WordStyleDlg::updateFontStyleStatus(fontStyleType whitchStyle)
} }
} }
void WordStyleDlg::switchToTheme()
{
int iSel = ::SendMessage(_hSwitch2ThemeCombo, CB_GETCURSEL, 0, 0);
generic_string prevThemeName(_themeName);
_themeName.clear();
_themeName.assign( (TCHAR *)::SendMessage(_hSwitch2ThemeCombo, CB_GETITEMDATA, iSel, 0) );
//if (!_themeName.compare(prevThemeName) ) return;
if ( _isThemeDirty ) {
TCHAR themeFileName[MAX_PATH];
lstrcpy(themeFileName, prevThemeName.c_str());
PathStripPath( themeFileName );
PathRemoveExtension( themeFileName );
int mb_response =
::MessageBox( _hSelf,
TEXT(" Unsaved changes are about to be discarded!\n")
TEXT(" Do you want to save your changes before switching themes?"),
themeFileName,
MB_ICONWARNING | MB_YESNO | MB_APPLMODAL | MB_SETFOREGROUND );
if ( mb_response == IDYES ) (NppParameters::getInstance())->writeStyles(_lsArray, _globalStyles);
}
NppParameters *nppParamInst = NppParameters::getInstance();
nppParamInst->reloadStylers(&_themeName[0]);
loadLangListFromNppParam();
_restoreInvalid = true;
}
void WordStyleDlg::setStyleListFromLexer(int index) void WordStyleDlg::setStyleListFromLexer(int index)
{ {
_currentLexerIndex = index; _currentLexerIndex = index;
@ -705,6 +819,6 @@ void WordStyleDlg::apply()
::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDOK), FALSE);
//_isDirty = false; //_isDirty = false;
_isSync = false; //_isSync = false;
::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0); ::SendMessage(_hParent, WM_UPDATESCINTILLAS, 0, 0);
} }

View File

@ -63,7 +63,7 @@ private :
class WordStyleDlg : public StaticDialog class WordStyleDlg : public StaticDialog
{ {
public : public :
WordStyleDlg():_isDirty(false), _isSync(true), _isShownGOCtrls(false){/*_originalWarning[0] = '\0';*/}; WordStyleDlg():_isDirty(false), _isThemeDirty(false), _restoreInvalid(false), /*_isSync(true),*/ _isShownGOCtrls(false){};
void init(HINSTANCE hInst, HWND parent) { void init(HINSTANCE hInst, HWND parent) {
Window::init(hInst, parent); Window::init(hInst, parent);
@ -114,12 +114,14 @@ private :
ColourPicker *_pBgColour; ColourPicker *_pBgColour;
int _currentLexerIndex; int _currentLexerIndex;
int _currentThemeIndex;
HWND _hCheckBold; HWND _hCheckBold;
HWND _hCheckItalic; HWND _hCheckItalic;
HWND _hCheckUnderline; HWND _hCheckUnderline;
HWND _hFontNameCombo; HWND _hFontNameCombo;
HWND _hFontSizeCombo; HWND _hFontSizeCombo;
HWND _hSwitch2ThemeCombo;
HWND _hFgColourStaticText; HWND _hFgColourStaticText;
HWND _hBgColourStaticText; HWND _hBgColourStaticText;
@ -130,15 +132,18 @@ private :
LexerStylerArray _lsArray; LexerStylerArray _lsArray;
StyleArray _globalStyles; StyleArray _globalStyles;
generic_string _themeName;
LexerStylerArray _styles2restored; LexerStylerArray _styles2restored;
StyleArray _gstyles2restored; StyleArray _gstyles2restored;
GlobalOverride _gOverride2restored; GlobalOverride _gOverride2restored;
bool _restoreInvalid;
ColourStaticTextHooker colourHooker; ColourStaticTextHooker colourHooker;
bool _isDirty; bool _isDirty;
bool _isSync; bool _isThemeDirty;
//bool _isSync;
bool _isShownGOCtrls; bool _isShownGOCtrls;
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
@ -183,6 +188,10 @@ private :
void updateFontName(); void updateFontName();
void updateFontSize(); void updateFontSize();
void updateUserKeywords(); void updateUserKeywords();
void switchToTheme();
void updateThemeName(generic_string themeName);
void loadLangListFromNppParam();
void enableFg(bool isEnable) { void enableFg(bool isEnable) {
::EnableWindow(_pFgColour->getHSelf(), isEnable); ::EnableWindow(_pFgColour->getHSelf(), isEnable);
@ -211,7 +220,7 @@ private :
}; };
long notifyDataModified() { long notifyDataModified() {
_isDirty = true; _isDirty = true;
//::EnableWindow(::GetDlgItem(_hSelf, IDOK), TRUE); _isThemeDirty = true;
::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), TRUE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_SAVECLOSE_BUTTON), TRUE);
return TRUE; return TRUE;
} }

View File

@ -24,53 +24,59 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define IDC_STATIC -1 #define IDC_STATIC -1
#endif #endif
IDD_STYLER_DLG DIALOGEX 36, 44, 500, 227 IDD_STYLER_DLG DIALOGEX 36, 44, 500, 246
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW EXSTYLE WS_EX_TOOLWINDOW
CAPTION "Style Configurator" CAPTION "Style Configurator"
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x0 FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN BEGIN
LTEXT "Foreground color",IDC_FG_STATIC,203,48,59,8,0, WS_EX_RIGHT LTEXT "Switch to theme : ",IDC_SWITCH2THEME_STATIC,6,9,83,8,0,WS_EX_RIGHT
LTEXT "Background color",IDC_BG_STATIC,203,75,59,8,0, WS_EX_RIGHT COMBOBOX IDC_SWITCH2THEME_COMBO,95,7,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_FONT_COMBO,371,44,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Foreground color",IDC_FG_STATIC,203,72,59,8,0,WS_EX_RIGHT
COMBOBOX IDC_FONTSIZE_COMBO,442,71,33,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Background color",IDC_BG_STATIC,203,99,59,8,0,WS_EX_RIGHT
CONTROL "Bold",IDC_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,64,63,10 COMBOBOX IDC_FONT_COMBO,371,68,104,78,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Italic",IDC_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,76,62,10 COMBOBOX IDC_FONTSIZE_COMBO,442,95,33,82,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Font style",IDC_FONTGROUP_STATIC,311,28,169,77 CONTROL "Bold",IDC_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,88,63,10
GROUPBOX "Colour style",IDC_COLOURGROUP_STATIC,191,28,111,77 CONTROL "Italic",IDC_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,100,62,10
LTEXT "Font Name :",IDC_FONTNAME_STATIC,315,47,52,8,0, WS_EX_RIGHT GROUPBOX "Font style",IDC_FONTGROUP_STATIC,311,52,169,77
LTEXT "Font size :",IDC_FONTSIZE_STATIC,388,73,51,8,0, WS_EX_RIGHT GROUPBOX "Colour style",IDC_COLOURGROUP_STATIC,191,52,111,77
LTEXT "Style :",IDC_STYLEDESC_STATIC,87,10,68,8 LTEXT "Font Name :",IDC_FONTNAME_STATIC,315,71,52,8,0,WS_EX_RIGHT
//LTEXT "Attention : The definition of this style will be the default definition for all non defined styles", IDC_STYLEDEFAULT_WARNING_STATIC,190,6,295,22 LTEXT "Font size :",IDC_FONTSIZE_STATIC,388,97,51,8,0,WS_EX_RIGHT
LTEXT " ", IDC_STYLEDESCRIPTION_STATIC,190,6,295,22 LTEXT "Style :",IDC_STYLEDESC_STATIC,87,34,68,8
EDITTEXT IDC_DEF_EXT_EDIT,17,191,61,14,ES_AUTOHSCROLL | ES_READONLY LTEXT " ",IDC_STYLEDESCRIPTION_STATIC,190,30,295,22
LTEXT "Default ext : ",IDC_DEF_EXT_STATIC,20,179,61,8 EDITTEXT IDC_DEF_EXT_EDIT,17,215,61,14,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_USER_EXT_EDIT,93,191,71,14, ES_AUTOHSCROLL LTEXT "Default ext : ",IDC_DEF_EXT_STATIC,20,203,61,8
LTEXT "User ext :",IDC_USER_EXT_STATIC,95,180,71,8 EDITTEXT IDC_USER_EXT_EDIT,93,215,71,14,ES_AUTOHSCROLL
CONTROL "Underline",IDC_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,88,80,10 LTEXT "User ext :",IDC_USER_EXT_STATIC,95,204,71,8
EDITTEXT IDC_DEF_KEYWORDS_EDIT,191,127,136,43,ES_MULTILINE | ES_READONLY | WS_VSCROLL CONTROL "Underline",IDC_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,112,80,10
EDITTEXT IDC_USER_KEYWORDS_EDIT,347,126,134,43,ES_MULTILINE | WS_VSCROLL EDITTEXT IDC_DEF_KEYWORDS_EDIT,191,151,136,43,ES_MULTILINE | ES_READONLY | WS_VSCROLL
LTEXT "Default keywords",IDC_DEF_KEYWORDS_STATIC,193,117,122,8 EDITTEXT IDC_USER_KEYWORDS_EDIT,347,150,134,43,ES_MULTILINE | WS_VSCROLL
LTEXT "User Define keywords",IDC_USER_KEYWORDS_STATIC,349,116,126,8 LTEXT "Default keywords",IDC_DEF_KEYWORDS_STATIC,193,141,122,8
LTEXT "+",IDC_PLUSSYMBOL_STATIC,335,142,8,8 LTEXT "User Define keywords",IDC_USER_KEYWORDS_STATIC,349,140,126,8
PUSHBUTTON "Cancel",IDCANCEL,332,198,57,14 LTEXT "+",IDC_PLUSSYMBOL_STATIC,335,166,8,8
//PUSHBUTTON "Apply",IDOK,264,198,60,14 PUSHBUTTON "Cancel",IDCANCEL,332,222,57,14
PUSHBUTTON "Save && Close",IDC_SAVECLOSE_BUTTON,255,198,69,14 PUSHBUTTON "Save && Close",IDC_SAVECLOSE_BUTTON,255,222,69,14
CONTROL "",IDC_SC_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,441,208,53,10 CONTROL "",IDC_SC_PERCENTAGE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | NOT WS_VISIBLE | WS_TABSTOP,441,235,53,10
CONTROL "Transparency",IDC_SC_TRANSPARENT_CHECK,"Button", BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,431,197,63, 10 CONTROL "Transparency",IDC_SC_TRANSPARENT_CHECK,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,431,221,63,10
LISTBOX IDC_LANGUAGES_LIST,17,22,59,146,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP LISTBOX IDC_LANGUAGES_LIST,17,46,59,146,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
LISTBOX IDC_STYLES_LIST,87,22,76,146,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP LISTBOX IDC_STYLES_LIST,87,46,76,146,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
GROUPBOX "",IDC_STATIC,7,0,166,212 GROUPBOX "",IDC_STATIC,7,24,166,212
LTEXT "Language :",IDC_LANGDESC_STATIC,19,10,61,8 LTEXT "Language :",IDC_LANGDESC_STATIC,19,34,61,8
GROUPBOX "",IDC_STATIC,181,0,310,184 GROUPBOX "",IDC_STATIC,181,24,310,184
LTEXT "+",IDC_PLUSSYMBOL2_STATIC,83,193,8,8 LTEXT "+",IDC_PLUSSYMBOL2_STATIC,83,217,8,8
CONTROL "Enable global foreground color",IDC_GLOBAL_FG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,114,132,10 CONTROL "Enable global foreground color",IDC_GLOBAL_FG_CHECK,
CONTROL "Enable global background color",IDC_GLOBAL_BG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,129,131,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,138,132,10
CONTROL "Enable global font",IDC_GLOBAL_FONT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,110,153,10 CONTROL "Enable global background color",IDC_GLOBAL_BG_CHECK,
CONTROL "Enable global font size",IDC_GLOBAL_FONTSIZE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,125,135,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,153,131,10
CONTROL "Enable global bold font style",IDC_GLOBAL_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,140,135,10 CONTROL "Enable global font",IDC_GLOBAL_FONT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,134,153,10
CONTROL "Enable global Italic font style",IDC_GLOBAL_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,155,135,10 CONTROL "Enable global font size",IDC_GLOBAL_FONTSIZE_CHECK,
CONTROL "Enable global underline font style",IDC_GLOBAL_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,170,135,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,149,135,10
CONTROL "Enable global bold font style",IDC_GLOBAL_BOLD_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,164,135,10
CONTROL "Enable global Italic font style",IDC_GLOBAL_ITALIC_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,179,135,10
CONTROL "Enable global underline font style",IDC_GLOBAL_UNDERLINE_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,194,135,10
END END

View File

@ -61,3 +61,5 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define IDC_SC_TRANSPARENT_CHECK (IDD_GLOBAL_STYLER_DLG + 3) #define IDC_SC_TRANSPARENT_CHECK (IDD_GLOBAL_STYLER_DLG + 3)
#define IDC_LANGUAGES_LIST (IDD_GLOBAL_STYLER_DLG + 4) #define IDC_LANGUAGES_LIST (IDD_GLOBAL_STYLER_DLG + 4)
#define IDC_STYLES_LIST (IDD_GLOBAL_STYLER_DLG + 5) #define IDC_STYLES_LIST (IDD_GLOBAL_STYLER_DLG + 5)
#define IDC_SWITCH2THEME_STATIC (IDD_GLOBAL_STYLER_DLG + 6)
#define IDC_SWITCH2THEME_COMBO (IDD_GLOBAL_STYLER_DLG + 7)

View File

@ -23,17 +23,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef IDC_STATIC #ifndef IDC_STATIC
#define IDC_STATIC -1 #define IDC_STATIC -1
#endif #endif
IDD_PREFERENCE_BOX DIALOGEX 0, 0, 395, 231 IDD_PREFERENCE_BOX DIALOGEX 0, 0, 400, 235
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE
CAPTION "Preferences" CAPTION "Preferences"
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
BEGIN BEGIN
PUSHBUTTON "Close",IDC_BUTTON_CLOSE,174,206,45,14 PUSHBUTTON "Close",IDC_BUTTON_CLOSE,174,212,45,14
END END
IDD_PREFERENCE_BAR_BOX DIALOGEX 0, 0, 370, 180 IDD_PREFERENCE_BAR_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
@ -62,7 +62,7 @@ BEGIN
COMBOBOX IDC_COMBO_LOCALIZATION,28,20,119,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_COMBO_LOCALIZATION,28,20,119,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END END
IDD_PREFERENCE_MARGEIN_BOX DIALOGEX 0, 0, 392, 185 IDD_PREFERENCE_MARGEIN_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
@ -74,10 +74,8 @@ BEGIN
CONTROL "Display line number margin",IDC_CHECK_LINENUMBERMARGE, CONTROL "Display line number margin",IDC_CHECK_LINENUMBERMARGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,117,141,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,117,141,10
CONTROL "Display bookmark margin",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,129,150,10 CONTROL "Display bookmark margin",IDC_CHECK_BOOKMARKMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,129,150,10
CONTROL "Display line change state margin",IDC_CHECK_DOCCHANGESTATEMARGE, //CONTROL "Display line change state margin",IDC_CHECK_DOCCHANGESTATEMARGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,141,162,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,141,162,10 CONTROL "Enable current line highlight",IDC_CHECK_CURRENTLINEHILITE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,141,129,10
CONTROL "Enable current line highlight",IDC_CHECK_CURRENTLINEHILITE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,153,129,10
CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,81,122,10 CONTROL "Show vertical edge",IDC_CHECK_SHOWVERTICALEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,212,81,122,10
RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,207,129,83,8 RTEXT "Number of columns :",IDC_NBCOLONE_STATIC,207,129,83,8
LTEXT "0",IDC_COLONENUMBER_STATIC,297,128,18,8 LTEXT "0",IDC_COLONENUMBER_STATIC,297,128,18,8
@ -100,7 +98,7 @@ BEGIN
END END
IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 370, 180 IDD_PREFERENCE_SETTING_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
@ -132,7 +130,7 @@ BEGIN
EDITTEXT IDC_EDIT_SESSIONFILEEXT,315,157,34,14,ES_AUTOHSCROLL EDITTEXT IDC_EDIT_SESSIONFILEEXT,315,157,34,14,ES_AUTOHSCROLL
END END
IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 370, 180 IDD_PREFERENCE_NEWDOCSETTING_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1 FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN BEGIN
@ -160,7 +158,7 @@ BEGIN
CONTROL "Apply while open ANSI file",IDC_CHECK_OPENANSIASUTF8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,46,124,10 CONTROL "Apply while open ANSI file",IDC_CHECK_OPENANSIASUTF8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,74,46,124,10
END END
IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 370, 180 IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
BEGIN BEGIN
@ -172,7 +170,7 @@ BEGIN
CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,229,8,72,8 CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,229,8,72,8
END END
IDD_PREFERENCE_PRINT_BOX DIALOGEX 0, 0, 370, 180 IDD_PREFERENCE_PRINT_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
BEGIN BEGIN
@ -193,7 +191,7 @@ BEGIN
GROUPBOX "Margin Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,187,45,144,96,BS_CENTER GROUPBOX "Margin Setting (Unit:mm)",IDC_MARGESETTINGS_STATIC,187,45,144,96,BS_CENTER
END END
IDD_PREFERENCE_PRINT2_BOX DIALOGEX 0, 0, 370, 180 IDD_PREFERENCE_PRINT2_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
BEGIN BEGIN
@ -226,7 +224,7 @@ BEGIN
LTEXT "",IDC_VIEWPANEL_STATIC,121,149,213,8 LTEXT "",IDC_VIEWPANEL_STATIC,121,149,213,8
END END
IDD_PREFERENCE_BACKUP_BOX DIALOGEX 0, 0, 370, 180 IDD_PREFERENCE_BACKUP_BOX DIALOGEX 0, 0, 390, 185
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1
BEGIN BEGIN

View File

@ -174,7 +174,7 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
::EnableWindow(::GetDlgItem(_hSelf, IDC_LOCALIZATION_GB_STATIC), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_LOCALIZATION_GB_STATIC), FALSE);
::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_LOCALIZATION), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_COMBO_LOCALIZATION), FALSE);
#else #else
LocalizationSwicher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher();
for (size_t i = 0 ; i < localizationSwitcher.size() ; i++) for (size_t i = 0 ; i < localizationSwitcher.size() ; i++)
{ {
@ -276,7 +276,7 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
case IDC_RADIO_STANDARD : case IDC_RADIO_STANDARD :
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_TOOLBAR_STANDARD, 0); ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_TOOLBAR_STANDARD, 0);
return TRUE; return TRUE;
#ifdef UNICODE
default : default :
switch (HIWORD(wParam)) switch (HIWORD(wParam))
{ {
@ -286,11 +286,38 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
{ {
case IDC_COMBO_LOCALIZATION : case IDC_COMBO_LOCALIZATION :
{ {
LocalizationSwicher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); #ifdef UNICODE
LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher();
int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0); int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0);
wchar_t langName[MAX_PATH]; wchar_t langName[MAX_PATH];
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXT, index, (LPARAM)langName); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXT, index, (LPARAM)langName);
if (langName[0]) if (langName[0])
{
// Make English as basic language
if (localizationSwitcher.switchToLang(TEXT("English")))
{
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RELOADNATIVELANG, 0, 0);
}
// Change the language
if (localizationSwitcher.switchToLang(langName))
{
::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RELOADNATIVELANG, 0, 0);
::InvalidateRect(_hParent, NULL, TRUE);
}
//::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_RELOADSTYLERS, 0, 0);
}
#endif
}
return TRUE;
/*
case IDC_COMBO_THEME :
{
LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher();
int index = ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETCURSEL, 0, 0);
TCHAR themeName[MAX_PATH];
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_GETLBTEXT, index, (LPARAM)themeName);
if (langName[0])
{ {
// Make English as basic language // Make English as basic language
if (localizationSwitcher.switchToLang(TEXT("English"))) if (localizationSwitcher.switchToLang(TEXT("English")))
@ -306,12 +333,12 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
} }
} }
return TRUE; return TRUE;
*/
default: default:
break; break;
} }
} }
} }
#endif
} }
} }
} }
@ -347,7 +374,7 @@ void MarginsDlg::changePanelTo(int index)
::SendDlgItemMessage(_hSelf, IDC_CHECK_LINENUMBERMARGE, BM_SETCHECK, svp._lineNumberMarginShow, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_LINENUMBERMARGE, BM_SETCHECK, svp._lineNumberMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_SETCHECK, svp._bookMarkMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCCHANGESTATEMARGE, BM_SETCHECK, svp._docChangeStateMarginShow, 0); //::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCCHANGESTATEMARGE, BM_SETCHECK, svp._docChangeStateMarginShow, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_SETCHECK, svp._currentLineHilitingShow, 0); ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_SETCHECK, svp._currentLineHilitingShow, 0);
bool isEnable = !(svp._edgeMode == EDGE_NONE); bool isEnable = !(svp._edgeMode == EDGE_NONE);
@ -456,12 +483,12 @@ BOOL CALLBACK MarginsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam
svp._bookMarkMarginShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_GETCHECK, 0, 0)); svp._bookMarkMarginShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_BOOKMARKMARGE, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_SYMBOLMARGIN, iView); ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_SYMBOLMARGIN, iView);
return TRUE; return TRUE;
/*
case IDC_CHECK_DOCCHANGESTATEMARGE: case IDC_CHECK_DOCCHANGESTATEMARGE:
svp._docChangeStateMarginShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCCHANGESTATEMARGE, BM_GETCHECK, 0, 0)); svp._docChangeStateMarginShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_DOCCHANGESTATEMARGE, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_DOCCHANGEMARGIN, iView); ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_DOCCHANGEMARGIN, iView);
return TRUE; return TRUE;
*/
case IDC_CHECK_CURRENTLINEHILITE: case IDC_CHECK_CURRENTLINEHILITE:
svp._currentLineHilitingShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_GETCHECK, 0, 0)); svp._currentLineHilitingShow = (BST_CHECKED == ::SendDlgItemMessage(_hSelf, IDC_CHECK_CURRENTLINEHILITE, BM_GETCHECK, 0, 0));
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, iView); ::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_CURLINE_HILITING, iView);

View File

@ -26,6 +26,7 @@ const COLORREF grey = RGB(128, 128, 128);
#define IDC_DRAG_TAB 1404 #define IDC_DRAG_TAB 1404
#define IDC_DRAG_INTERDIT_TAB 1405 #define IDC_DRAG_INTERDIT_TAB 1405
#define IDC_DRAG_PLUS_TAB 1406 #define IDC_DRAG_PLUS_TAB 1406
#define IDC_DRAG_OUT_TAB 1407
bool TabBarPlus::_doDragNDrop = false; bool TabBarPlus::_doDragNDrop = false;
@ -738,8 +739,10 @@ void TabBarPlus::draggingCursor(POINT screenPoint)
else else
::SetCursor(::LoadCursor(_hInst, MAKEINTRESOURCE(IDC_DRAG_TAB))); ::SetCursor(::LoadCursor(_hInst, MAKEINTRESOURCE(IDC_DRAG_TAB)));
} }
else else if (isPointInParentZone(screenPoint))
::SetCursor(::LoadCursor(_hInst, MAKEINTRESOURCE(IDC_DRAG_INTERDIT_TAB))); ::SetCursor(::LoadCursor(_hInst, MAKEINTRESOURCE(IDC_DRAG_INTERDIT_TAB)));
else // drag out of application
::SetCursor(::LoadCursor(_hInst, MAKEINTRESOURCE(IDC_DRAG_OUT_TAB)));
} }
} }

View File

@ -370,6 +370,13 @@ protected:
return ::SendMessage(_hSelf, TCM_HITTEST, 0, (LPARAM)&hitInfo); return ::SendMessage(_hSelf, TCM_HITTEST, 0, (LPARAM)&hitInfo);
}; };
bool isPointInParentZone(POINT screenPoint) const {
RECT parentZone;
::GetWindowRect(_hParent, &parentZone);
return (((screenPoint.x >= parentZone.left) && (screenPoint.x <= parentZone.right)) &&
(screenPoint.y >= parentZone.top) && (screenPoint.y <= parentZone.bottom));
};
}; };
#endif // TAB_BAR_H #endif // TAB_BAR_H

View File

@ -249,9 +249,7 @@ private :
::DrawText(hDC, label, lstrlen(label), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT); ::DrawText(hDC, label, lstrlen(label), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
}; };
}; };
#endif // TASKLISTDLG_H #endif // TASKLISTDLG_H

View File

@ -22,7 +22,7 @@
<Item MenuEntryName="Edit" MenuItemName="to Upper case"/> <Item MenuEntryName="Edit" MenuItemName="to Upper case"/>
<Item MenuEntryName="Edit" MenuItemName="to Lower case"/> <Item MenuEntryName="Edit" MenuItemName="to Lower case"/>
<Item id="0"/> <Item id="0"/>
<Item MenuEntryName="Edit" MenuItemName="Block toggle comment"/> <Item MenuEntryName="Edit" MenuItemName="Toggle block comment"/>
<Item MenuEntryName="Edit" MenuItemName="Stream comment"/> <Item MenuEntryName="Edit" MenuItemName="Stream comment"/>
<Item id="0"/> <Item id="0"/>
<Item MenuEntryName="View" MenuItemName="Hide lines"/> <Item MenuEntryName="View" MenuItemName="Hide lines"/>

View File

@ -75,7 +75,7 @@
<Keywords name="instre1">as case class data default deriving do else hiding if import in infix infixl infixr instance let module newtype of proc qualified rec then type where _</Keywords> <Keywords name="instre1">as case class data default deriving do else hiding if import in infix infixl infixr instance let module newtype of proc qualified rec then type where _</Keywords>
</Language> </Language>
<Language name="html" ext="html htm shtml shtm xhtml" commentLine="" commentStart="&lt;!--" commentEnd="--&gt;"> <Language name="html" ext="html htm shtml shtm xhtml" commentLine="" commentStart="&lt;!--" commentEnd="--&gt;">
<Keywords name="instre1">!doctype a abbr accept-charset accept accesskey acronym action address align alink alt applet archive area axis b background base basefont bdo bgcolor big blockquote body border br button caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime dd declare defer del dfn dir disabled div dl dt em embed enctype event face fieldset file font for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head headers height hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd label lang language leftmargin legend li link longdesc map marginwidth marginheight maxlength media menu meta method multiple name noframes nohref noresize noscript noshade nowrap object ol onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup optgroup option onreset onselect onsubmit onunload p param password profile pre prompt public q radio readonly rel reset rev rows rowspan rules s samp scheme scope script scrolling select selected shape size small span src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead title topmargin tr tt type u ul usemap valign value valuetype var version vlink vspace width xml xmlns</Keywords> <Keywords name="instre1">!doctype a abbr accept-charset accept accesskey acronym action address align alink alt applet archive area axis b background base basefont bdo bgcolor big blockquote body border br button caption cellpadding cellspacing center char charoff charset checkbox checked cite class classid clear code codebase codetype col colgroup color cols colspan comment compact content coords data datafld dataformatas datapagesize datasrc datetime dd declare defer del dfn dir disabled div dl dt em embed enctype event face fieldset file font for form frame frameborder frameset h1 h2 h3 h4 h5 h6 head headers height hidden hr href hreflang hspace html http-equiv i id iframe image img input ins isindex ismap kbd label lang language leftmargin legend li link longdesc map marginwidth marginheight maxlength media menu meta method multiple name noframes nohref noresize noscript noshade nowrap object ol onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup optgroup option onreset onselect onsubmit onunload p param password profile pre prompt public q radio readonly rel reset rev rows rowspan rules s samp scheme scope script scrolling select selected shape size small span src standby start strike strong style sub submit summary sup tabindex table target tbody td text textarea tfoot th thead title topmargin tr tt type u ul usemap valign value valuetype var version vlink vspace width xml xmlns</Keywords>
</Language> </Language>
<Language name="ini" ext="ini inf reg url" commentLine=";"> <Language name="ini" ext="ini inf reg url" commentLine=";">
</Language> </Language>

Binary file not shown.

View File

@ -127,7 +127,9 @@
#define IDC_DRAG_TAB 1404 #define IDC_DRAG_TAB 1404
#define IDC_DRAG_INTERDIT_TAB 1405 #define IDC_DRAG_INTERDIT_TAB 1405
#define IDC_DRAG_PLUS_TAB 1406 #define IDC_DRAG_PLUS_TAB 1406
#define IDC_MACRO_RECORDING 1407 #define IDC_DRAG_OUT_TAB 1407
#define IDC_MACRO_RECORDING 1408
#define IDR_SAVEALL 1500 #define IDR_SAVEALL 1500
#define IDR_CLOSEFILE 1501 #define IDR_CLOSEFILE 1501
@ -306,6 +308,7 @@
#define NPPM_INTERNAL_SEARCH_GOTONEXTFOUND (NOTEPADPLUS_USER_INTERNAL + 28) #define NPPM_INTERNAL_SEARCH_GOTONEXTFOUND (NOTEPADPLUS_USER_INTERNAL + 28)
#define NPPM_INTERNAL_SEARCH_GOTOPREVFOUND (NOTEPADPLUS_USER_INTERNAL + 29) #define NPPM_INTERNAL_SEARCH_GOTOPREVFOUND (NOTEPADPLUS_USER_INTERNAL + 29)
#define NPPM_INTERNAL_FOCUS_ON_FOUND_RESULTS (NOTEPADPLUS_USER_INTERNAL + 30) #define NPPM_INTERNAL_FOCUS_ON_FOUND_RESULTS (NOTEPADPLUS_USER_INTERNAL + 30)
#define NPPM_INTERNAL_RELOADSTYLERS (NOTEPADPLUS_USER_INTERNAL + 31)
// See Notepad_plus_msgs.h // See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000) //#define NOTEPADPLUS_USER (WM_USER + 1000)

View File

@ -726,7 +726,5 @@
<WidgetStyle name="Active tab unfocused indicator" styleID="0" fgColor="FFCAB0" /> <WidgetStyle name="Active tab unfocused indicator" styleID="0" fgColor="FFCAB0" />
<WidgetStyle name="Active tab text" styleID="0" fgColor="000000" /> <WidgetStyle name="Active tab text" styleID="0" fgColor="000000" />
<WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" /> <WidgetStyle name="Inactive tabs" styleID="0" fgColor="808080" bgColor="C0C0C0" />
<WidgetStyle name="Unsaved change marker" styleID="0" bgColor="FEE389" />
<WidgetStyle name="Saved change marker" styleID="0" bgColor="A4FFB1" />
</GlobalStyles> </GlobalStyles>
</NotepadPlus> </NotepadPlus>

View File

@ -1,114 +1,178 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="7.10" Version="8,00"
Name="xmlUpdater" Name="xmlUpdater"
ProjectGUID="{89EB9F92-B72D-46D3-879E-D6BF8403CF42}" ProjectGUID="{89EB9F92-B72D-46D3-879E-D6BF8403CF42}"
RootNamespace="xmlUpdater" RootNamespace="xmlUpdater"
Keyword="Win32Proj"> Keyword="Win32Proj"
>
<Platforms> <Platforms>
<Platform <Platform
Name="Win32"/> Name="Win32"
/>
</Platforms> </Platforms>
<ToolFiles>
</ToolFiles>
<Configurations> <Configurations>
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="Debug" OutputDirectory="Debug"
IntermediateDirectory="Debug" IntermediateDirectory="Debug"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="2"> InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\TinyXml" AdditionalIncludeDirectories="..\..\TinyXml;..\..\MISC\Common"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="5" RuntimeLibrary="1"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderThrough="" PrecompiledHeaderThrough=""
AssemblerOutput="0" AssemblerOutput="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="true"
DebugInformationFormat="4" DebugInformationFormat="4"
CompileAs="2"/> CompileAs="2"
/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)/../xmlUpdater.exe" OutputFile="$(OutDir)/../xmlUpdater.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="TRUE" GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/xmlUpdater.pdb" ProgramDatabaseFile="$(OutDir)/xmlUpdater.pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"
/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCALinkTool"
/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCManifestTool"
/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCXDCMakeTool"
/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCBscMakeTool"
/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCFxCopTool"
/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCAppVerifierTool"
/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCWebDeploymentTool"
/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCPostBuildEventTool"
<Tool />
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
<Configuration <Configuration
Name="Release|Win32" Name="Release|Win32"
OutputDirectory="Release" OutputDirectory="Release"
IntermediateDirectory="Release" IntermediateDirectory="Release"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="2"> InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\TinyXml" AdditionalIncludeDirectories="..\..\TinyXml;..\..\MISC\Common"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="4" RuntimeLibrary="0"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"/> DebugInformationFormat="3"
/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)/../xmlUpdater.exe" OutputFile="$(OutDir)/../xmlUpdater.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="TRUE" GenerateDebugInformation="true"
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1"/> TargetMachine="1"
/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCALinkTool"
/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCManifestTool"
/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCXDCMakeTool"
/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCBscMakeTool"
/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCFxCopTool"
/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCAppVerifierTool"
/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCWebDeploymentTool"
/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCPostBuildEventTool"
<Tool />
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
</Configurations> </Configurations>
<References> <References>
@ -117,32 +181,41 @@
<Filter <Filter
Name="Source Files" Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File <File
RelativePath="..\..\TinyXml\tinystr.cpp"> RelativePath="..\..\TinyXml\tinystr.cpp"
>
</File> </File>
<File <File
RelativePath="..\..\TinyXml\tinyxml.cpp"> RelativePath="..\..\TinyXml\tinyxml.cpp"
>
</File> </File>
<File <File
RelativePath="..\..\TinyXml\tinyxmlerror.cpp"> RelativePath="..\..\TinyXml\tinyxmlerror.cpp"
>
</File> </File>
<File <File
RelativePath="..\..\TinyXml\tinyxmlparser.cpp"> RelativePath="..\..\TinyXml\tinyxmlparser.cpp"
>
</File> </File>
<File <File
RelativePath=".\xmlUpdater.cpp"> RelativePath=".\xmlUpdater.cpp"
>
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="Header Files" Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd" Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File <File
RelativePath="..\..\TinyXml\tinystr.h"> RelativePath="..\..\TinyXml\tinystr.h"
>
</File> </File>
<File <File
RelativePath="..\..\TinyXml\tinyxml.h"> RelativePath="..\..\TinyXml\tinyxml.h"
>
</File> </File>
</Filter> </Filter>
</Files> </Files>

View File

@ -127,6 +127,17 @@ LangType getLangTypeFromParam(ParamVector & params) {
return NppParameters::getLangIDFromStr(langStr.c_str()); return NppParameters::getLangIDFromStr(langStr.c_str());
}; };
int getNumberFromParam(char paramName, ParamVector & params, bool & isParamePresent) {
generic_string numStr;
if (!getParamVal(paramName, params, numStr))
{
isParamePresent = false;
return -1;
}
isParamePresent = true;
return generic_atoi(numStr.c_str());
};
/*
int getLn2GoFromParam(ParamVector & params) { int getLn2GoFromParam(ParamVector & params) {
generic_string lineNumStr; generic_string lineNumStr;
if (!getParamVal('n', params, lineNumStr)) if (!getParamVal('n', params, lineNumStr))
@ -134,6 +145,14 @@ int getLn2GoFromParam(ParamVector & params) {
return generic_atoi(lineNumStr.c_str()); return generic_atoi(lineNumStr.c_str());
}; };
int getPointXFromParam(ParamVector & params) {
generic_string pointXStr;
if (!getParamVal('x', params, pointXStr))
return -1;
return generic_atoi(pointXStr.c_str());
};
*/
const TCHAR FLAG_MULTI_INSTANCE[] = TEXT("-multiInst"); const TCHAR FLAG_MULTI_INSTANCE[] = TEXT("-multiInst");
const TCHAR FLAG_NO_PLUGIN[] = TEXT("-noPlugin"); const TCHAR FLAG_NO_PLUGIN[] = TEXT("-noPlugin");
const TCHAR FLAG_READONLY[] = TEXT("-ro"); const TCHAR FLAG_READONLY[] = TEXT("-ro");
@ -142,7 +161,6 @@ const TCHAR FLAG_NOTABBAR[] = TEXT("-notabbar");
void doException(Notepad_plus & notepad_plus_plus); void doException(Notepad_plus & notepad_plus_plus);
//int WINAPI NppMainEntry(HINSTANCE hInstance, HINSTANCE, TCHAR * cmdLine, int nCmdShow)
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdShow) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdShow)
{ {
LPTSTR cmdLine = ::GetCommandLine(); LPTSTR cmdLine = ::GetCommandLine();
@ -157,6 +175,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh
if (::GetLastError() == ERROR_ALREADY_EXISTS) if (::GetLastError() == ERROR_ALREADY_EXISTS)
TheFirstOne = false; TheFirstOne = false;
bool isParamePresent;
CmdLineParams cmdLineParams; CmdLineParams cmdLineParams;
bool isMultiInst = isInList(FLAG_MULTI_INSTANCE, params); bool isMultiInst = isInList(FLAG_MULTI_INSTANCE, params);
cmdLineParams._isNoTab = isInList(FLAG_NOTABBAR, params); cmdLineParams._isNoTab = isInList(FLAG_NOTABBAR, params);
@ -164,7 +183,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh
cmdLineParams._isReadOnly = isInList(FLAG_READONLY, params); cmdLineParams._isReadOnly = isInList(FLAG_READONLY, params);
cmdLineParams._isNoSession = isInList(FLAG_NOSESSION, params); cmdLineParams._isNoSession = isInList(FLAG_NOSESSION, params);
cmdLineParams._langType = getLangTypeFromParam(params); cmdLineParams._langType = getLangTypeFromParam(params);
cmdLineParams._line2go = getLn2GoFromParam(params); cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);
cmdLineParams._column2go = getNumberFromParam('c', params, isParamePresent);
cmdLineParams._point.x = getNumberFromParam('x', params, cmdLineParams._isPointXValid);
cmdLineParams._point.y = getNumberFromParam('y', params, cmdLineParams._isPointYValid);
NppParameters *pNppParameters = NppParameters::getInstance(); NppParameters *pNppParameters = NppParameters::getInstance();
// override the settings if notepad style is present // override the settings if notepad style is present

View File

@ -631,6 +631,14 @@
RelativePath="..\src\resource.h" RelativePath="..\src\resource.h"
> >
</File> </File>
<File
RelativePath="..\src\WinControls\ColourPicker\resource.h"
>
</File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File <File
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h" RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
> >