[NEW_FEATURE] (Author: Giles Payne) Auto-detect character encoding (settings part).
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1202 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
9f46e7c4c8
commit
f12faf0ac8
@ -781,6 +781,7 @@
|
||||
<Item id="6331" name="在標題列僅顯示檔案名稱〈無路徑〉"/>
|
||||
<Item id="6332" name="區別大小寫"/>
|
||||
<Item id="6333" name="字慧高亮度顯示"/>
|
||||
<Item id="6334" name="自動檢測字符編碼"/>
|
||||
<Item id="6114" name="啟動"/>
|
||||
<Item id="6115" name="自動縮排"/>
|
||||
<Item id="6117" name="開啟 MRU (Most Recently Used) 功能"/>
|
||||
|
@ -777,6 +777,7 @@
|
||||
<Item id="6331" name="Show only filename in title bar"/>
|
||||
<Item id="6332" name="Match case"/>
|
||||
<Item id="6333" name="Smart Highlighting"/>
|
||||
<Item id="6334" name="Autodetect character encoding"/>
|
||||
<Item id="6114" name="Enable"/>
|
||||
<Item id="6115" name="Auto-indent"/>
|
||||
<Item id="6117" name="Enable MRU behaviour"/>
|
||||
|
@ -774,6 +774,7 @@
|
||||
<Item id="6331" name="Show only filename in title bar"/>
|
||||
<Item id="6332" name="Match case"/>
|
||||
<Item id="6333" name="Smart Highlighting"/>
|
||||
<Item id="6334" name="Autodetect character encoding"/>
|
||||
<Item id="6114" name="Enable"/>
|
||||
<Item id="6115" name="Auto-indent"/>
|
||||
<Item id="6117" name="Enable MRU behaviour"/>
|
||||
|
@ -801,6 +801,7 @@
|
||||
<Item id="6331" name="Afficher seulement le nom du fichier dans la barre de titre"/>
|
||||
<Item id="6332" name="Case sensible"/>
|
||||
<Item id="6333" name="Sélectionner et montrer tout"/>
|
||||
<Item id="6334" name="Détecter l'encodage automatiquement"/>
|
||||
</MISC>
|
||||
</Preference>
|
||||
<MultiMacro title="Exécuter une macro en boucle">
|
||||
|
@ -718,6 +718,7 @@
|
||||
<Item id="6331" name="Nur Dateinamen in Titelleiste anzeigen"/>
|
||||
<Item id="6332" name="Groß-/Kleinschreibung unterscheiden"/>
|
||||
<Item id="6333" name="Mehrfache Markierung"/>
|
||||
<Item id="6334" name="Enkodierung automatisch erkennen"/>
|
||||
</MISC>
|
||||
<Backup title="Sicherheitskopie">
|
||||
<Item id="6801" name="Sicherheitskopie"/>
|
||||
|
@ -746,6 +746,7 @@
|
||||
<Item id="6331" name="Mostrar solo el nombre en la barra"/>
|
||||
<Item id="6332" name="Ajustar tamaño"/>
|
||||
<Item id="6333" name="Resaltado inteligente"/>
|
||||
<Item id="6334" name="Detección de codificación automática"/>
|
||||
<Item id="6114" name="Activar"/>
|
||||
<Item id="6115" name="Auto-márgen"/>
|
||||
<Item id="6117" name="Permitir MRU"/>
|
||||
|
@ -767,6 +767,7 @@
|
||||
<Item id="6331" name="Mostrar solo el nombre del archivo en el título"/>
|
||||
<Item id="6332" name="Coincidir MAYÚSCULAS/minúsculas"/>
|
||||
<Item id="6333" name="Destacado inteligente"/>
|
||||
<Item id="6334" name="Detección de codificación automática"/>
|
||||
<Item id="6114" name="Habilitar"/>
|
||||
<Item id="6115" name="Sangría automática"/>
|
||||
<Item id="6117" name="Ordenar por el usado más reciente"/>
|
||||
|
@ -3441,7 +3441,21 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (!lstrcmp(nm, TEXT("DetectEncoding")))
|
||||
{
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
{
|
||||
val = n->Value();
|
||||
if (val)
|
||||
{
|
||||
if (!lstrcmp(val, TEXT("yes")))
|
||||
_nppGUI._detectEncoding = true;
|
||||
else
|
||||
_nppGUI._detectEncoding = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("MaitainIndent")))
|
||||
{
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
@ -4461,6 +4475,7 @@ bool NppParameters::writeGUIParams()
|
||||
bool checkHistoryFilesExist = false;
|
||||
bool trayIconExist = false;
|
||||
bool rememberLastSessionExist = false;
|
||||
bool detectEncoding = false;
|
||||
bool newDocDefaultSettingsExist = false;
|
||||
bool langsExcludedLstExist = false;
|
||||
bool printSettingExist = false;
|
||||
@ -4642,7 +4657,16 @@ bool NppParameters::writeGUIParams()
|
||||
else
|
||||
childNode->InsertEndChild(TiXmlText(pStr));
|
||||
}
|
||||
|
||||
else if (!lstrcmp(nm, TEXT("DetectEncoding")))
|
||||
{
|
||||
detectEncoding = true;
|
||||
const TCHAR *pStr = _nppGUI._detectEncoding?TEXT("yes"):TEXT("no");
|
||||
TiXmlNode *n = childNode->FirstChild();
|
||||
if (n)
|
||||
n->SetValue(pStr);
|
||||
else
|
||||
childNode->InsertEndChild(TiXmlText(pStr));
|
||||
}
|
||||
else if (!lstrcmp(nm, TEXT("MaitainIndent")))
|
||||
{
|
||||
maitainIndentExist = true;
|
||||
@ -4982,7 +5006,10 @@ bool NppParameters::writeGUIParams()
|
||||
{
|
||||
insertGUIConfigBoolNode(GUIRoot, TEXT("RememberLastSession"), _nppGUI._rememberLastSession);
|
||||
}
|
||||
|
||||
if (!detectEncoding)
|
||||
{
|
||||
insertGUIConfigBoolNode(GUIRoot, TEXT("DetectEncoding"), _nppGUI._detectEncoding);
|
||||
}
|
||||
if (!newDocDefaultSettingsExist)
|
||||
{
|
||||
TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement();
|
||||
|
@ -704,7 +704,7 @@ struct NppGUI
|
||||
_tabStatus(TAB_DRAWTOPBAR | TAB_DRAWINACTIVETAB | TAB_DRAGNDROP), _splitterPos(POS_HORIZOTAL),\
|
||||
_userDefineDlgStatus(UDD_DOCKED), _tabSize(8), _tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _fileAutoDetectionOriginalValue(_fileAutoDetection),\
|
||||
_checkHistoryFiles(true) ,_enableSmartHilite(true), _disableSmartHiliteTmp(false), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true), _enableHiliteNonHTMLZone(false),\
|
||||
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
|
||||
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _detectEncoding(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
|
||||
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
|
||||
_autocStatus(autoc_both), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
|
||||
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\
|
||||
@ -748,6 +748,7 @@ struct NppGUI
|
||||
bool _isMaximized;
|
||||
bool _isMinimizedToTray;
|
||||
bool _rememberLastSession;
|
||||
bool _detectEncoding;
|
||||
bool _doTaskList;
|
||||
bool _maitainIndent;
|
||||
bool _enableSmartHilite;
|
||||
|
@ -853,7 +853,8 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, Utf8_16_Rea
|
||||
}
|
||||
else if (encoding == -1)
|
||||
{
|
||||
encoding = detectCodepage(data, lenFile);
|
||||
if (NppParameters::getInstance()->getNppGUI()._detectEncoding)
|
||||
encoding = detectCodepage(data, lenFile);
|
||||
}
|
||||
isFirstTime = false;
|
||||
}
|
||||
|
@ -127,6 +127,7 @@ private:
|
||||
size_t _nrBufs;
|
||||
int detectCodepage(char* buf, size_t len);
|
||||
|
||||
|
||||
bool loadFileData(Document doc, const TCHAR * filename, Utf8_16_Read * UnicodeConvertor, LangType language, int & encoding, formatType *pFormat = NULL);
|
||||
};
|
||||
|
||||
|
@ -124,16 +124,13 @@ BEGIN
|
||||
CONTROL "Enable",IDC_CHECK_ENABLEDOCSWITCHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,15,69,10
|
||||
CONTROL "Enable MRU behaviour",IDC_CHECK_STYLEMRU,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,45,28,140,10
|
||||
CONTROL "Enable",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,45,57,142,10
|
||||
CONTROL "Match case",IDC_CHECK_SMARTHILITECASESENSITIVE,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,45,71,142,10
|
||||
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,105,150,10
|
||||
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,120,150,10
|
||||
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,135,150,10
|
||||
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,150,217,10
|
||||
CONTROL "Remember current session for next launch",IDC_CHECK_REMEMBERSESSION,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,165,217,10
|
||||
CONTROL "Match case",IDC_CHECK_SMARTHILITECASESENSITIVE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,45,71,142,10
|
||||
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,100,150,10
|
||||
CONTROL "Autodetect character encoding",IDC_CHECK_DETECTENCODING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,115,217,10
|
||||
CONTROL "Auto-indent",IDC_CHECK_MAINTAININDENT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,130,150,10
|
||||
CONTROL "Minimize to system tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,145,150,10
|
||||
CONTROL "Show only filename in title bar",IDC_CHECK_SHORTTITLE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,37,160,217,10
|
||||
CONTROL "Remember current session for next launch",IDC_CHECK_REMEMBERSESSION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,37,175,217,10
|
||||
CONTROL "Enable",IDC_CHECK_CLICKABLELINK_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,15,140,10
|
||||
CONTROL "No underline",IDC_CHECK_CLICKABLELINK_NOUNDERLINE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,267,28,140,10
|
||||
|
@ -829,6 +829,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_REMEMBERSESSION, BM_SETCHECK, nppGUI._rememberLastSession, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_DETECTENCODING, BM_SETCHECK, nppGUI._detectEncoding, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, nppGUI._autoUpdateOpt._doAutoUpdate, 0);
|
||||
|
||||
::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE);
|
||||
@ -961,7 +962,9 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||
case IDC_CHECK_REMEMBERSESSION:
|
||||
nppGUI._rememberLastSession = isCheckedOrNot(wParam);
|
||||
return TRUE;
|
||||
|
||||
case IDC_CHECK_DETECTENCODING:
|
||||
nppGUI._detectEncoding = isCheckedOrNot(wParam);
|
||||
return TRUE;
|
||||
case IDC_CHECK_ENABLEDOCSWITCHER :
|
||||
{
|
||||
nppGUI._doTaskList = !nppGUI._doTaskList;
|
||||
|
@ -158,6 +158,7 @@
|
||||
#define IDC_CHECK_SHORTTITLE (IDD_PREFERENCE_SETTING_BOX + 31)
|
||||
#define IDC_CHECK_SMARTHILITECASESENSITIVE (IDD_PREFERENCE_SETTING_BOX + 32)
|
||||
#define IDC_SMARTHILITING_STATIC (IDD_PREFERENCE_SETTING_BOX + 33)
|
||||
#define IDC_CHECK_DETECTENCODING (IDD_PREFERENCE_SETTING_BOX + 34)
|
||||
//-- FLS: xFileEditViewHistoryParameterGUI: Additional Checkbox for enabling the history for restoring the edit view per file.
|
||||
#define IDC_PREFERENCE_OFFSET_FLS 40
|
||||
#define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SETTING_BOX + IDC_PREFERENCE_OFFSET_FLS + 1)
|
||||
|
Loading…
Reference in New Issue
Block a user