[BUG_FIXED] Fix unicode input problem for non ansi characters.
Fix missing fonts in font list problem (Styler configurator). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@141 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
d550ce44b2
commit
147d885a44
@ -166,7 +166,7 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi
|
||||
nppClass.cbWndExtra = 0;
|
||||
nppClass.hInstance = _hInst;
|
||||
nppClass.hIcon = ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON));
|
||||
nppClass.hCursor = NULL;
|
||||
nppClass.hCursor = ::LoadCursor(NULL, IDC_ARROW);
|
||||
nppClass.hbrBackground = ::CreateSolidBrush(::GetSysColor(COLOR_MENU));
|
||||
nppClass.lpszMenuName = MAKEINTRESOURCE(IDR_M30_MENU);
|
||||
nppClass.lpszClassName = _className;
|
||||
|
@ -340,11 +340,28 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty
|
||||
|
||||
_asNotepadStyle = (PathFileExists(notepadStylePath) == TRUE);
|
||||
|
||||
::AddFontResource(LINEDRAW_FONT);
|
||||
|
||||
//Load initial accelerator key definitions
|
||||
initMenuKeys();
|
||||
initScintillaKeys();
|
||||
}
|
||||
|
||||
NppParameters::~NppParameters()
|
||||
{
|
||||
for (int i = 0 ; i < _nbLang ; i++)
|
||||
delete _langList[i];
|
||||
for (int i = 0 ; i < _nbFile ; i++)
|
||||
delete _LRFileList[i];
|
||||
for (int i = 0 ; i < _nbUserLang ; i++)
|
||||
delete _userLangArray[i];
|
||||
if (_hUser32)
|
||||
FreeLibrary(_hUser32);
|
||||
if (_hUXTheme)
|
||||
FreeLibrary(_hUXTheme);
|
||||
|
||||
::RemoveFontResource(LINEDRAW_FONT);
|
||||
}
|
||||
void cutString(const char *str2cut, vector<string> & patternVect)
|
||||
{
|
||||
char str2scan[MAX_PATH];
|
||||
@ -718,10 +735,12 @@ void NppParameters::setFontList(HWND hWnd)
|
||||
//---------------//
|
||||
|
||||
LOGFONT lf;
|
||||
_fontlist.clear();
|
||||
_fontlist.push_back("");
|
||||
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lf.lfFaceName[0]='\0';
|
||||
lf.lfPitchAndFamily = 0;
|
||||
HDC hDC = ::GetDC(hWnd);
|
||||
::EnumFontFamiliesEx(hDC,
|
||||
&lf,
|
||||
|
@ -917,7 +917,7 @@ public:
|
||||
return false;
|
||||
};
|
||||
|
||||
const char * getLangNameFromExt(char *ext) {
|
||||
const char * getUserDefinedLangNameFromExt(char *ext) {
|
||||
if ((!ext) || (!ext[0]))
|
||||
return NULL;
|
||||
|
||||
@ -1060,19 +1060,8 @@ public:
|
||||
}
|
||||
private:
|
||||
NppParameters();
|
||||
~NppParameters() {
|
||||
for (int i = 0 ; i < _nbLang ; i++)
|
||||
delete _langList[i];
|
||||
for (int i = 0 ; i < _nbFile ; i++)
|
||||
delete _LRFileList[i];
|
||||
for (int i = 0 ; i < _nbUserLang ; i++)
|
||||
delete _userLangArray[i];
|
||||
if (_hUser32)
|
||||
FreeLibrary(_hUser32);
|
||||
if (_hUXTheme)
|
||||
FreeLibrary(_hUXTheme);
|
||||
//::RemoveFontResource(LINEDRAW_FONT);
|
||||
};
|
||||
~NppParameters();
|
||||
|
||||
static NppParameters *_pSelf;
|
||||
|
||||
TiXmlDocument *_pXmlDoc, *_pXmlUserDoc, *_pXmlUserStylerDoc, *_pXmlUserLangDoc, *_pXmlNativeLangDoc,\
|
||||
@ -1142,14 +1131,16 @@ private:
|
||||
static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, int FontType, LPARAM lParam) {
|
||||
vector<string> *pStrVect = (vector<string> *)lParam;
|
||||
size_t vectSize = pStrVect->size();
|
||||
if (vectSize == 0)
|
||||
pStrVect->push_back((char *)lpelfe->elfFullName);
|
||||
else
|
||||
{
|
||||
const char *lastFontName = pStrVect->at(vectSize - 1).c_str();
|
||||
if (strcmp(lastFontName, (const char *)lpelfe->elfFullName))
|
||||
pStrVect->push_back((char *)lpelfe->elfFullName);
|
||||
}
|
||||
|
||||
//Search through all the fonts, EnumFontFamiliesEx never states anything about order
|
||||
//Start at the end though, that's the most likely place to find a duplicate
|
||||
for(int i = vectSize - 1 ; i >= 0 ; i--) {
|
||||
if ( !strcmp((*pStrVect)[i].c_str(), (const char *)lpelfe->elfLogFont.lfFaceName) )
|
||||
return 1; //we already have seen this typeface, ignore it
|
||||
}
|
||||
//We can add the font
|
||||
//Add the face name and not the full name, we do not care about any styles
|
||||
pStrVect->push_back((char *)lpelfe->elfLogFont.lfFaceName);
|
||||
return 1; // I want to get all fonts
|
||||
};
|
||||
|
||||
|
@ -2,10 +2,11 @@
|
||||
|
||||
long Buffer::_recentTagCtr = 0;
|
||||
|
||||
// Set full path file name in buffer object,
|
||||
// and determinate its language by its extension.
|
||||
// If the ext is not in the list, the defaultLang passed as argument will be set.
|
||||
void Buffer::setFileName(const char *fn, LangType defaultLang)
|
||||
{
|
||||
bool isExtSet = false;
|
||||
|
||||
NppParameters *pNppParamInst = NppParameters::getInstance();
|
||||
strcpy(_fullPathName, fn);
|
||||
if (PathFileExists(_fullPathName))
|
||||
@ -16,11 +17,10 @@ void Buffer::setFileName(const char *fn, LangType defaultLang)
|
||||
|
||||
// Define User Lang firstly
|
||||
const char *langName = NULL;
|
||||
if ((langName = pNppParamInst->getLangNameFromExt(ext)))
|
||||
if ((langName = pNppParamInst->getUserDefinedLangNameFromExt(ext)))
|
||||
{
|
||||
_lang = L_USER;
|
||||
strcpy(_userLangExt, langName);
|
||||
isExtSet = true;
|
||||
}
|
||||
else // if it's not user lang, then check if it's supported lang
|
||||
{
|
||||
@ -34,10 +34,9 @@ void Buffer::setFileName(const char *fn, LangType defaultLang)
|
||||
else if (!_stricmp(fileName, "CmakeLists.txt"))
|
||||
_lang = L_CMAKE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isExtSet)
|
||||
_userLangExt[0] = '\0';
|
||||
}
|
||||
|
||||
// for _timeStamp
|
||||
updatTimeStamp();
|
||||
}
|
||||
|
@ -115,8 +115,19 @@ void ScintillaEditView::init(HINSTANCE hInst, HWND hPere)
|
||||
_codepage = ::GetACP();
|
||||
_oemCodepage = ::GetOEMCP();
|
||||
|
||||
::SetWindowLong(_hSelf, GWL_USERDATA, reinterpret_cast<LONG>(this));
|
||||
_scintillaDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLong(_hSelf, GWL_WNDPROC, reinterpret_cast<LONG>(scintillaStatic_Proc)));
|
||||
//Use either Unicode or ANSI setwindowlong, depending on environment
|
||||
if (::IsWindowUnicode(_hSelf))
|
||||
{
|
||||
::SetWindowLongW(_hSelf, GWL_USERDATA, reinterpret_cast<LONG>(this));
|
||||
_callWindowProc = CallWindowProcW;
|
||||
_scintillaDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongW(_hSelf, GWL_WNDPROC, reinterpret_cast<LONG>(scintillaStatic_Proc)));
|
||||
}
|
||||
else
|
||||
{
|
||||
::SetWindowLongA(_hSelf, GWL_USERDATA, reinterpret_cast<LONG>(this));
|
||||
_callWindowProc = CallWindowProcA;
|
||||
_scintillaDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongA(_hSelf, GWL_WNDPROC, reinterpret_cast<LONG>(scintillaStatic_Proc)));
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
@ -178,7 +189,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ::CallWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
|
||||
return _callWindowProc(_scintillaDefaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
void ScintillaEditView::setSpecialStyle(int styleID, COLORREF fgColour, COLORREF bgColour, const char *fontName, int fontStyle, int fontSize)
|
||||
{
|
||||
|
@ -123,6 +123,8 @@ static int getNbChiffre(int aNum, int base)
|
||||
|
||||
char * int2str(char *str, int strLen, int number, int base, int nbChiffre, bool isZeroLeading);
|
||||
|
||||
typedef LRESULT (WINAPI *CallWindowProcFunc) (WNDPROC,HWND,UINT,WPARAM,LPARAM);
|
||||
|
||||
class ScintillaEditView : public Window
|
||||
{
|
||||
friend class Notepad_plus;
|
||||
@ -644,6 +646,7 @@ protected:
|
||||
// the current active buffer index of _buffers
|
||||
int _currentIndex;
|
||||
static WNDPROC _scintillaDefaultProc;
|
||||
CallWindowProcFunc _callWindowProc;
|
||||
|
||||
// the list of docs
|
||||
buf_vec_t _buffers;
|
||||
|
@ -83,7 +83,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
|
||||
clz.cbWndExtra = 0;
|
||||
clz.hInstance = _hInst;
|
||||
clz.hIcon = NULL;
|
||||
clz.hCursor = NULL;
|
||||
clz.hCursor = ::LoadCursor(NULL, IDC_ARROW);
|
||||
clz.hbrBackground = NULL;
|
||||
clz.lpszMenuName = NULL;
|
||||
clz.lpszClassName = DSPC_CLASS_NAME;
|
||||
|
@ -127,7 +127,7 @@ void Gripper::startGrip(DockingCont* pCont, DockingManager* pDockMgr, void* pRes
|
||||
clz.cbWndExtra = 0;
|
||||
clz.hInstance = _hInst;
|
||||
clz.hIcon = NULL;
|
||||
clz.hCursor = NULL;
|
||||
clz.hCursor = ::LoadCursor(NULL, IDC_ARROW);
|
||||
|
||||
clz.hbrBackground = NULL;
|
||||
clz.lpszMenuName = NULL;
|
||||
|
@ -1328,7 +1328,7 @@ ATOM RegisterGridClass(HINSTANCE hInstance)
|
||||
wclass.cbWndExtra = 0;
|
||||
wclass.hInstance = hInstance;
|
||||
wclass.hIcon = NULL;
|
||||
wclass.hCursor = NULL;
|
||||
wclass.hCursor = ::LoadCursor(NULL, IDC_ARROW);
|
||||
|
||||
wclass.hbrBackground = (HBRUSH)(GetStockObject(GRAY_BRUSH));
|
||||
wclass.lpszClassName = "BABYGRID";
|
||||
|
@ -46,7 +46,7 @@ void SplitterContainer::create(Window *pWin0, Window *pWin1, int splitterSize,
|
||||
splitterContainerClass.cbWndExtra = 0;
|
||||
splitterContainerClass.hInstance = _hInst;
|
||||
splitterContainerClass.hIcon = NULL;
|
||||
splitterContainerClass.hCursor = NULL;
|
||||
splitterContainerClass.hCursor = ::LoadCursor(NULL, IDC_ARROW);
|
||||
|
||||
// hbrBackground must be NULL,
|
||||
// otherwise this window will hide some parts of 2 windows
|
||||
|
@ -20,7 +20,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd"
|
||||
AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd;..\src\WinControls\ToolTip"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="0"
|
||||
@ -35,7 +35,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/fixed:no"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib Oleacc.lib"
|
||||
ShowProgress="2"
|
||||
OutputFile="$(OutDir)/../../bin/notepad++Debug.exe"
|
||||
Version="1.0"
|
||||
@ -57,9 +57,10 @@ IF NOT EXIST ..\bin\langs.model.xml COPY ..\src\langs.model.xml ..\bin\langs.mod
|
||||
IF NOT EXIST ..\bin\stylers.xml COPY ..\src\stylers.model.xml ..\bin\stylers.xml
|
||||
IF NOT EXIST ..\bin\stylers.model.xml COPY ..\src\stylers.model.xml ..\bin\stylers.model.xml
|
||||
IF NOT EXIST ..\bin\LINEDRAW.TTF COPY ..\src\font\LINEDRAW.TTF ..\bin\LINEDRAW.TTF
|
||||
IF NOT EXIST ..\bin\contextMenu.xml COPY ..\src\contextMenu.xml ..\bin\contextMenu.xml
|
||||
IF NOT EXIST ..\bin\shortcuts.xml COPY ..\src\shortcuts.xml ..\bin\shortcuts.xml
|
||||
IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\userDefineLang.xml "/>
|
||||
IF NOT EXIST ..\bin\contextMenu.xml COPY ..\src\contextMenu.xml ..\bin\contextMenu.xml
|
||||
IF NOT EXIST ..\bin\shortcuts.xml COPY ..\src\shortcuts.xml ..\bin\shortcuts.xml
|
||||
IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\userDefineLang.xml
|
||||
"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
@ -92,7 +93,7 @@ IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\use
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\Win32Explr;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd"
|
||||
AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\Win32Explr;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd;..\src\WinControls\ToolTip"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="4"
|
||||
@ -106,7 +107,7 @@ IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\use
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/OPT:WIN98"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib odbc32.lib odbccp32.lib"
|
||||
AdditionalDependencies="comctl32.lib shlwapi.lib shell32.lib odbc32.lib odbccp32.lib Oleacc.lib"
|
||||
ShowProgress="2"
|
||||
OutputFile="$(OutDir)/notepad++.exe"
|
||||
Version="1.0"
|
||||
@ -129,9 +130,10 @@ IF NOT EXIST ..\bin\langs.model.xml COPY ..\src\langs.model.xml ..\bin\langs.mod
|
||||
IF NOT EXIST ..\bin\stylers.xml COPY ..\src\stylers.model.xml ..\bin\stylers.xml
|
||||
IF NOT EXIST ..\bin\stylers.model.xml COPY ..\src\stylers.model.xml ..\bin\stylers.model.xml
|
||||
IF NOT EXIST ..\bin\LINEDRAW.TTF COPY ..\src\font\LINEDRAW.TTF ..\bin\LINEDRAW.TTF
|
||||
IF NOT EXIST ..\bin\contextMenu.xml COPY ..\src\contextMenu.xml ..\bin\contextMenu.xml
|
||||
IF NOT EXIST ..\bin\shortcuts.xml COPY ..\src\shortcuts.xml ..\bin\shortcuts.xml
|
||||
IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\userDefineLang.xml "/>
|
||||
IF NOT EXIST ..\bin\contextMenu.xml COPY ..\src\contextMenu.xml ..\bin\contextMenu.xml
|
||||
IF NOT EXIST ..\bin\shortcuts.xml COPY ..\src\shortcuts.xml ..\bin\shortcuts.xml
|
||||
IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\userDefineLang.xml
|
||||
"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
@ -312,6 +314,9 @@ IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\use
|
||||
<File
|
||||
RelativePath="..\src\WinControls\ToolBar\ToolBar.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\ToolTip\ToolTip.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\TrayIcon\trayIconControler.cpp">
|
||||
</File>
|
||||
@ -347,6 +352,9 @@ IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\use
|
||||
<File
|
||||
RelativePath="..\src\lesDlgs.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\menuCmdID.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\Notepad_plus.h">
|
||||
</File>
|
||||
@ -551,6 +559,9 @@ IF NOT EXIST ..\bin\userDefineLang.xml COPY ..\src\userDefineLang.xml ..\bin\use
|
||||
<File
|
||||
RelativePath="..\src\WinControls\ToolBar\ToolBar.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\ToolTip\ToolTip.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\TrayIcon\trayIconControler.h">
|
||||
</File>
|
||||
|
Loading…
Reference in New Issue
Block a user