[NEW_FEATURE] Settings on cloud - dropbox.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1242 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
948b52c9d1
commit
bad9b9dbbf
@ -43,6 +43,34 @@ void printStr(const TCHAR *str2print)
|
|||||||
::MessageBox(NULL, str2print, TEXT(""), MB_OK);
|
::MessageBox(NULL, str2print, TEXT(""), MB_OK);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string getFileContent(const TCHAR *file2read)
|
||||||
|
{
|
||||||
|
const size_t blockSize = 256;
|
||||||
|
char data[blockSize];
|
||||||
|
FILE *fp = generic_fopen(file2read, TEXT("rb"));
|
||||||
|
|
||||||
|
_fseeki64 (fp , 0 , SEEK_END);
|
||||||
|
unsigned __int64 fileSize =_ftelli64(fp);
|
||||||
|
rewind(fp);
|
||||||
|
|
||||||
|
size_t lenFile = fread(data, 1, blockSize, fp);
|
||||||
|
fclose(fp);
|
||||||
|
if (lenFile <= 0) return "";
|
||||||
|
if (fileSize >= blockSize)
|
||||||
|
data[blockSize-1] = '\0';
|
||||||
|
else
|
||||||
|
data[fileSize] = '\0';
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeFileContent(const TCHAR *file2write, const char *content2write)
|
||||||
|
{
|
||||||
|
FILE *f = generic_fopen(file2write, TEXT("w+"));
|
||||||
|
fwrite(content2write, sizeof(content2write[0]), strlen(content2write), f);
|
||||||
|
fflush(f);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
void writeLog(const TCHAR *logFileName, const char *log2write)
|
void writeLog(const TCHAR *logFileName, const char *log2write)
|
||||||
{
|
{
|
||||||
FILE *f = generic_fopen(logFileName, TEXT("a+"));
|
FILE *f = generic_fopen(logFileName, TEXT("a+"));
|
||||||
|
@ -108,6 +108,9 @@ std::string wstring2string(const std::wstring & rwString, UINT codepage);
|
|||||||
bool isInList(const TCHAR *token, const TCHAR *list);
|
bool isInList(const TCHAR *token, const TCHAR *list);
|
||||||
generic_string BuildMenuFileName(int filenameLen, unsigned int pos, const generic_string &filename);
|
generic_string BuildMenuFileName(int filenameLen, unsigned int pos, const generic_string &filename);
|
||||||
|
|
||||||
|
std::string getFileContent(const TCHAR *file2read);
|
||||||
|
void writeFileContent(const TCHAR *file2write, const char *content2write);
|
||||||
|
|
||||||
class WcharMbcsConvertor {
|
class WcharMbcsConvertor {
|
||||||
public:
|
public:
|
||||||
static WcharMbcsConvertor * getInstance() {return _pSelf;};
|
static WcharMbcsConvertor * getInstance() {return _pSelf;};
|
||||||
|
@ -1422,11 +1422,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
if (_pTrayIco)
|
if (_pTrayIco)
|
||||||
_pTrayIco->doTrayIcon(REMOVE);
|
_pTrayIco->doTrayIcon(REMOVE);
|
||||||
|
|
||||||
bool isSnapshotMode = pNppParam->getNppGUI().isSnapshotMode();
|
const NppGUI & nppgui = pNppParam->getNppGUI();
|
||||||
|
|
||||||
|
bool isSnapshotMode = nppgui.isSnapshotMode();
|
||||||
if (isSnapshotMode)
|
if (isSnapshotMode)
|
||||||
MainFileManager->backupCurrentBuffer();
|
MainFileManager->backupCurrentBuffer();
|
||||||
|
|
||||||
const NppGUI & nppgui = pNppParam->getNppGUI();
|
|
||||||
Session currentSession;
|
Session currentSession;
|
||||||
if (nppgui._rememberLastSession)
|
if (nppgui._rememberLastSession)
|
||||||
{
|
{
|
||||||
@ -1462,22 +1463,38 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
scnN.nmhdr.idFrom = 0;
|
scnN.nmhdr.idFrom = 0;
|
||||||
_pluginsManager.notify(&scnN);
|
_pluginsManager.notify(&scnN);
|
||||||
|
|
||||||
//
|
|
||||||
// saving config.xml
|
|
||||||
//
|
|
||||||
saveFindHistory(); //writeFindHistory
|
saveFindHistory(); //writeFindHistory
|
||||||
_lastRecentFileList.saveLRFL(); //writeRecentFileHistorySettings, writeHistory
|
_lastRecentFileList.saveLRFL(); //writeRecentFileHistorySettings, writeHistory
|
||||||
saveScintillaParams(); //writeScintillaParams
|
saveScintillaParams(); //writeScintillaParams
|
||||||
saveGUIParams(); //writeGUIParams
|
saveGUIParams(); //writeGUIParams
|
||||||
saveProjectPanelsParams(); //writeProjectPanelsSettings
|
saveProjectPanelsParams(); //writeProjectPanelsSettings
|
||||||
|
//
|
||||||
|
// saving config.xml
|
||||||
|
//
|
||||||
pNppParam->saveConfig_xml();
|
pNppParam->saveConfig_xml();
|
||||||
|
|
||||||
|
//
|
||||||
|
// saving userDefineLang.xml
|
||||||
|
//
|
||||||
saveUserDefineLangs();
|
saveUserDefineLangs();
|
||||||
|
|
||||||
|
//
|
||||||
|
// saving shortcuts.xml
|
||||||
|
//
|
||||||
saveShortcuts();
|
saveShortcuts();
|
||||||
|
|
||||||
|
//
|
||||||
|
// saving session.xml
|
||||||
|
//
|
||||||
if (nppgui._rememberLastSession && !nppgui._isCmdlineNosessionActivated)
|
if (nppgui._rememberLastSession && !nppgui._isCmdlineNosessionActivated)
|
||||||
saveSession(currentSession);
|
saveSession(currentSession);
|
||||||
|
|
||||||
|
// write settings on cloud if enabled
|
||||||
|
if (nppgui._cloudChoice == dropbox)
|
||||||
|
{
|
||||||
|
pNppParam->writeSettingsFilesOnCloud(dropbox);
|
||||||
|
}
|
||||||
|
|
||||||
//Sends WM_DESTROY, Notepad++ will end
|
//Sends WM_DESTROY, Notepad++ will end
|
||||||
if(Message == WM_CLOSE)
|
if(Message == WM_CLOSE)
|
||||||
::DestroyWindow(hwnd);
|
::DestroyWindow(hwnd);
|
||||||
|
@ -798,6 +798,69 @@ bool NppParameters::reloadLang()
|
|||||||
return loadOkay;
|
return loadOkay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generic_string NppParameters::getCloudSettingsPath(const generic_string & cloudChoicePath)
|
||||||
|
{
|
||||||
|
// check if dropbox is present
|
||||||
|
generic_string cloudSettingsPath = TEXT("");
|
||||||
|
ITEMIDLIST *pidl;
|
||||||
|
SHGetSpecialFolderLocation(NULL, CSIDL_PROFILE, &pidl);
|
||||||
|
TCHAR tmp[MAX_PATH];
|
||||||
|
SHGetPathFromIDList(pidl, tmp);
|
||||||
|
|
||||||
|
cloudSettingsPath = tmp;
|
||||||
|
PathAppend(cloudSettingsPath, TEXT("Dropbox"));
|
||||||
|
if (PathFileExists(cloudSettingsPath.c_str()))
|
||||||
|
_nppGUI._availableClouds |= DROPBOX_AVAILABLE;
|
||||||
|
|
||||||
|
if (!PathFileExists(cloudChoicePath.c_str()))
|
||||||
|
return TEXT("");
|
||||||
|
|
||||||
|
// Read cloud choice
|
||||||
|
std::string cloudChoice = getFileContent(cloudChoicePath.c_str());
|
||||||
|
|
||||||
|
|
||||||
|
if (cloudChoice == "dropbox" && _nppGUI._availableClouds & DROPBOX_AVAILABLE)
|
||||||
|
{
|
||||||
|
PathAppend(cloudSettingsPath, TEXT("Notepad++"));
|
||||||
|
|
||||||
|
// The folder %userprofile%\Dropbox\Notepad++ should exist.
|
||||||
|
// if it doesn't, it means this folder was removed by user, we create it anyway
|
||||||
|
if (!PathFileExists(cloudSettingsPath.c_str()))
|
||||||
|
{
|
||||||
|
::CreateDirectory(cloudSettingsPath.c_str(), NULL);
|
||||||
|
}
|
||||||
|
_nppGUI._cloudChoice = dropbox;
|
||||||
|
}
|
||||||
|
else if (cloudChoice == "oneDrive")
|
||||||
|
{
|
||||||
|
_nppGUI._cloudChoice = oneDrive;
|
||||||
|
}
|
||||||
|
else if (cloudChoice == "googleDrive")
|
||||||
|
{
|
||||||
|
_nppGUI._cloudChoice = googleDrive;
|
||||||
|
}
|
||||||
|
return cloudSettingsPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
generic_string NppParameters::getSettingsFolder()
|
||||||
|
{
|
||||||
|
generic_string settingsFolderPath;
|
||||||
|
if (_isLocal)
|
||||||
|
{
|
||||||
|
return _nppPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ITEMIDLIST *pidl;
|
||||||
|
SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &pidl);
|
||||||
|
TCHAR tmp[MAX_PATH];
|
||||||
|
SHGetPathFromIDList(pidl, tmp);
|
||||||
|
generic_string settingsFolderPath = tmp;
|
||||||
|
PathAppend(settingsFolderPath, TEXT("Notepad++"));
|
||||||
|
return settingsFolderPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool NppParameters::load()
|
bool NppParameters::load()
|
||||||
{
|
{
|
||||||
L_END = L_EXTERNAL;
|
L_END = L_EXTERNAL;
|
||||||
@ -815,7 +878,7 @@ bool NppParameters::load()
|
|||||||
// if Notepad++ is installed in "program files" directory, because of UAC
|
// if Notepad++ is installed in "program files" directory, because of UAC
|
||||||
if (_isLocal)
|
if (_isLocal)
|
||||||
{
|
{
|
||||||
// We check if OS is Vista or above
|
// We check if OS is Vista or greater version
|
||||||
if (_winVersion >= WV_VISTA)
|
if (_winVersion >= WV_VISTA)
|
||||||
{
|
{
|
||||||
ITEMIDLIST *pidl;
|
ITEMIDLIST *pidl;
|
||||||
@ -852,6 +915,21 @@ bool NppParameters::load()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_sessionPath = _userPath; // Session stock the absolute file path, it should never be on cloud
|
||||||
|
|
||||||
|
// Detection cloud settings
|
||||||
|
//bool isCloud = false;
|
||||||
|
generic_string cloudChoicePath = _userPath;
|
||||||
|
cloudChoicePath += TEXT("\\cloud\\choice");
|
||||||
|
|
||||||
|
generic_string cloudPath = getCloudSettingsPath(cloudChoicePath);
|
||||||
|
if (cloudPath != TEXT(""))
|
||||||
|
{
|
||||||
|
_userPath = cloudPath;
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------//
|
//-------------------------------------//
|
||||||
// Transparent function for w2k and xp //
|
// Transparent function for w2k and xp //
|
||||||
//-------------------------------------//
|
//-------------------------------------//
|
||||||
@ -1115,7 +1193,7 @@ bool NppParameters::load()
|
|||||||
//----------------------------//
|
//----------------------------//
|
||||||
// session.xml : for per user //
|
// session.xml : for per user //
|
||||||
//----------------------------//
|
//----------------------------//
|
||||||
_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!!
|
||||||
@ -2277,6 +2355,109 @@ LangType NppParameters::getLangFromExt(const TCHAR *ext)
|
|||||||
return L_TEXT;
|
return L_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NppParameters::writeSettingsFilesOnCloud(CloudChoice choice)
|
||||||
|
{
|
||||||
|
generic_string cloudSettingsPath;
|
||||||
|
|
||||||
|
if (choice == dropbox)
|
||||||
|
{
|
||||||
|
cloudSettingsPath = TEXT("");
|
||||||
|
ITEMIDLIST *pidl;
|
||||||
|
SHGetSpecialFolderLocation(NULL, CSIDL_PROFILE, &pidl);
|
||||||
|
TCHAR tmp[MAX_PATH];
|
||||||
|
SHGetPathFromIDList(pidl, tmp);
|
||||||
|
|
||||||
|
cloudSettingsPath = tmp;
|
||||||
|
PathAppend(cloudSettingsPath, TEXT("Dropbox"));
|
||||||
|
if (!::PathFileExists(cloudSettingsPath.c_str()))
|
||||||
|
return;
|
||||||
|
PathAppend(cloudSettingsPath, TEXT("Notepad++"));
|
||||||
|
if (!::PathFileExists(cloudSettingsPath.c_str()))
|
||||||
|
{
|
||||||
|
::CreateDirectory(cloudSettingsPath.c_str(), NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// config.xml
|
||||||
|
generic_string cloudConfigPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudConfigPath, TEXT("config.xml"));
|
||||||
|
if (!::PathFileExists(cloudConfigPath.c_str()) && _pXmlUserDoc)
|
||||||
|
{
|
||||||
|
_pXmlUserDoc->SaveFile(cloudConfigPath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// stylers.xml
|
||||||
|
generic_string cloudStylersPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudStylersPath, TEXT("stylers.xml"));
|
||||||
|
if (!::PathFileExists(cloudStylersPath.c_str()) && _pXmlUserStylerDoc)
|
||||||
|
{
|
||||||
|
_pXmlUserStylerDoc->SaveFile(cloudStylersPath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// langs.xml
|
||||||
|
generic_string cloudLangsPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudLangsPath, TEXT("langs.xml"));
|
||||||
|
if (!::PathFileExists(cloudLangsPath.c_str()) && _pXmlUserDoc)
|
||||||
|
{
|
||||||
|
_pXmlDoc->SaveFile(cloudLangsPath.c_str());
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
// session.xml: Session stock the absolute file path, it should never be on cloud
|
||||||
|
generic_string cloudSessionPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudSessionPath, TEXT("session.xml"));
|
||||||
|
if (!::PathFileExists(cloudSessionPath.c_str()) && _pXmlSessionDoc)
|
||||||
|
{
|
||||||
|
_pXmlSessionDoc->SaveFile(cloudSessionPath.c_str());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// userDefineLang.xml
|
||||||
|
generic_string cloudUserLangsPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudUserLangsPath, TEXT("userDefineLang.xml"));
|
||||||
|
if (!::PathFileExists(cloudUserLangsPath.c_str()) && _pXmlUserLangDoc)
|
||||||
|
{
|
||||||
|
_pXmlUserLangDoc->SaveFile(cloudUserLangsPath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// shortcuts.xml
|
||||||
|
generic_string cloudShortcutsPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudShortcutsPath, TEXT("shortcuts.xml"));
|
||||||
|
if (!::PathFileExists(cloudShortcutsPath.c_str()) && _pXmlShortcutDoc)
|
||||||
|
{
|
||||||
|
_pXmlShortcutDoc->SaveFile(cloudShortcutsPath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// contextMenu.xml
|
||||||
|
generic_string cloudContextMenuPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudContextMenuPath, TEXT("contextMenu.xml"));
|
||||||
|
if (!::PathFileExists(cloudContextMenuPath.c_str()) && _pXmlContextMenuDocA)
|
||||||
|
{
|
||||||
|
_pXmlContextMenuDocA->SaveUnicodeFilePath(cloudContextMenuPath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// nativeLang.xml
|
||||||
|
generic_string cloudNativeLangPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudNativeLangPath, TEXT("nativeLang.xml"));
|
||||||
|
if (!::PathFileExists(cloudNativeLangPath.c_str()) && _pXmlNativeLangDocA)
|
||||||
|
{
|
||||||
|
_pXmlNativeLangDocA->SaveUnicodeFilePath(cloudNativeLangPath.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// functionList.xml
|
||||||
|
generic_string cloudFunctionListPath = cloudSettingsPath;
|
||||||
|
PathAppend(cloudFunctionListPath, TEXT("functionList.xml"));
|
||||||
|
if (!::PathFileExists(cloudFunctionListPath.c_str()))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NppParameters::writeUserDefinedLang()
|
void NppParameters::writeUserDefinedLang()
|
||||||
{
|
{
|
||||||
if (!_pXmlUserLangDoc)
|
if (!_pXmlUserLangDoc)
|
||||||
|
@ -103,6 +103,7 @@ enum ChangeDetect {cdDisabled=0, cdEnabled=1, cdAutoUpdate=2, cdGo2end=3, cdAuto
|
|||||||
enum BackupFeature {bak_none = 0, bak_simple = 1, bak_verbose = 2};
|
enum BackupFeature {bak_none = 0, bak_simple = 1, bak_verbose = 2};
|
||||||
enum OpenSaveDirSetting {dir_followCurrent = 0, dir_last = 1, dir_userDef = 2};
|
enum OpenSaveDirSetting {dir_followCurrent = 0, dir_last = 1, dir_userDef = 2};
|
||||||
enum MultiInstSetting {monoInst = 0, multiInstOnSession = 1, multiInst = 2};
|
enum MultiInstSetting {monoInst = 0, multiInstOnSession = 1, multiInst = 2};
|
||||||
|
enum CloudChoice {noCloud = 0, dropbox = 1, oneDrive = 2, googleDrive = 3};
|
||||||
|
|
||||||
const int LANG_INDEX_INSTR = 0;
|
const int LANG_INDEX_INSTR = 0;
|
||||||
const int LANG_INDEX_INSTR2 = 1;
|
const int LANG_INDEX_INSTR2 = 1;
|
||||||
@ -124,6 +125,11 @@ const int COPYDATA_FILENAMESW = 2;
|
|||||||
#define DECSEP_COMMA 1
|
#define DECSEP_COMMA 1
|
||||||
#define DECSEP_BOTH 2
|
#define DECSEP_BOTH 2
|
||||||
|
|
||||||
|
|
||||||
|
#define DROPBOX_AVAILABLE 1
|
||||||
|
#define ONEDRIVE_AVAILABLE 2
|
||||||
|
#define GOOGLEDRIVE_AVAILABLE 4
|
||||||
|
|
||||||
const TCHAR fontSizeStrs[][3] = {TEXT(""), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("10"), TEXT("11"), TEXT("12"), TEXT("14"), TEXT("16"), TEXT("18"), TEXT("20"), TEXT("22"), TEXT("24"), TEXT("26"), TEXT("28")};
|
const TCHAR fontSizeStrs[][3] = {TEXT(""), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("10"), TEXT("11"), TEXT("12"), TEXT("14"), TEXT("16"), TEXT("18"), TEXT("20"), TEXT("22"), TEXT("24"), TEXT("26"), TEXT("28")};
|
||||||
|
|
||||||
const TCHAR localConfFile[] = TEXT("doLocalConf.xml");
|
const TCHAR localConfFile[] = TEXT("doLocalConf.xml");
|
||||||
@ -711,7 +717,7 @@ struct NppGUI
|
|||||||
_checkHistoryFiles(true) ,_enableSmartHilite(true), _disableSmartHiliteTmp(false), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true), _enableHiliteNonHTMLZone(false),\
|
_checkHistoryFiles(true) ,_enableSmartHilite(true), _disableSmartHiliteTmp(false), _enableTagsMatchHilite(true), _enableTagAttrsHilite(true), _enableHiliteNonHTMLZone(false),\
|
||||||
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _isCmdlineNosessionActivated(false), _detectEncoding(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
|
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _isCmdlineNosessionActivated(false), _detectEncoding(true), _backup(bak_none), _useDir(false), _backupDir(TEXT("")),\
|
||||||
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
|
_doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\
|
||||||
_autocStatus(autoc_both), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")),\
|
_autocStatus(autoc_both), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _cloudChoice(noCloud), _availableClouds(0),\
|
||||||
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\
|
_doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _enableMultiSelection(false), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false),\
|
||||||
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst),\
|
_smartHiliteCaseSensitive(false), _leftmostDelimiter('('), _rightmostDelimiter(')'), _delimiterSelectionOnEntireDocument(false), _multiInstSetting(monoInst),\
|
||||||
_fileSwitcherWithoutExtColumn(false), _isSnapshotMode(true), _snapshotBackupTiming(7000), _backSlashIsEscapeCharacterForSql(true) {
|
_fileSwitcherWithoutExtColumn(false), _isSnapshotMode(true), _snapshotBackupTiming(7000), _backSlashIsEscapeCharacterForSql(true) {
|
||||||
@ -819,6 +825,8 @@ struct NppGUI
|
|||||||
bool isSnapshotMode() const {return _isSnapshotMode && _rememberLastSession && !_isCmdlineNosessionActivated;};
|
bool isSnapshotMode() const {return _isSnapshotMode && _rememberLastSession && !_isCmdlineNosessionActivated;};
|
||||||
bool _isSnapshotMode;
|
bool _isSnapshotMode;
|
||||||
size_t _snapshotBackupTiming;
|
size_t _snapshotBackupTiming;
|
||||||
|
CloudChoice _cloudChoice; // this option will never be read/written from/to config.xml
|
||||||
|
unsigned char _availableClouds; // this option will never be read/written from/to config.xml
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScintillaViewParams
|
struct ScintillaViewParams
|
||||||
@ -1200,6 +1208,8 @@ public:
|
|||||||
bool reloadLang();
|
bool reloadLang();
|
||||||
bool reloadStylers(TCHAR *stylePath = NULL);
|
bool reloadStylers(TCHAR *stylePath = NULL);
|
||||||
void destroyInstance();
|
void destroyInstance();
|
||||||
|
generic_string getCloudSettingsPath(const generic_string & cloudChoicePath);
|
||||||
|
generic_string getSettingsFolder();
|
||||||
|
|
||||||
bool _isTaskListRBUTTONUP_Active;
|
bool _isTaskListRBUTTONUP_Active;
|
||||||
int L_END;
|
int L_END;
|
||||||
@ -1538,6 +1548,8 @@ public:
|
|||||||
return _userPath;
|
return _userPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void writeSettingsFilesOnCloud(CloudChoice choice);
|
||||||
|
|
||||||
DPIManager _dpiManager;
|
DPIManager _dpiManager;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -825,6 +825,18 @@ bool TiXmlDocumentA::SaveFile( const char * filename ) const
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
bool TiXmlDocumentA::SaveUnicodeFilePath( const TCHAR* filename ) const
|
||||||
|
{
|
||||||
|
// The old c stuff lives on...
|
||||||
|
FILE* fp = generic_fopen( filename, TEXT("w") );
|
||||||
|
if ( fp )
|
||||||
|
{
|
||||||
|
Print( fp, 0 );
|
||||||
|
fclose( fp );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TiXmlNodeA* TiXmlDocumentA::Clone() const
|
TiXmlNodeA* TiXmlDocumentA::Clone() const
|
||||||
|
@ -1004,7 +1004,9 @@ public:
|
|||||||
/// Save a file using the given filename. Returns true if successful.
|
/// Save a file using the given filename. Returns true if successful.
|
||||||
bool SaveFile( const char * filename ) const;
|
bool SaveFile( const char * filename ) const;
|
||||||
|
|
||||||
bool LoadUnicodeFilePath(const TCHAR* filename);
|
/// Load and Save a file using the given unicode filename. Returns true if successful.
|
||||||
|
bool LoadUnicodeFilePath( const TCHAR* filename );
|
||||||
|
bool SaveUnicodeFilePath( const TCHAR* filename ) const;
|
||||||
|
|
||||||
#ifdef TIXMLA_USE_STL
|
#ifdef TIXMLA_USE_STL
|
||||||
bool LoadFile( const std::string& filename ) ///< STL std::string version.
|
bool LoadFile( const std::string& filename ) ///< STL std::string version.
|
||||||
|
@ -36,6 +36,9 @@ FunctionParsersManager::~FunctionParsersManager()
|
|||||||
{
|
{
|
||||||
delete _parsers[i];
|
delete _parsers[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_pXmlFuncListDoc)
|
||||||
|
delete _pXmlFuncListDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FunctionParsersManager::init(generic_string xmlPath, ScintillaEditView ** ppEditView)
|
bool FunctionParsersManager::init(generic_string xmlPath, ScintillaEditView ** ppEditView)
|
||||||
@ -149,6 +152,13 @@ bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, g
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FunctionParsersManager::writeFunctionListXml(const TCHAR *destFoder) const
|
||||||
|
{
|
||||||
|
generic_string dest = destFoder;
|
||||||
|
PathAppend(dest, TEXT("functionList.xml"));
|
||||||
|
if (_pXmlFuncListDoc)
|
||||||
|
_pXmlFuncListDoc->SaveFile(dest.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
bool FunctionParsersManager::getFuncListFromXmlTree()
|
bool FunctionParsersManager::getFuncListFromXmlTree()
|
||||||
{
|
{
|
||||||
|
@ -135,6 +135,7 @@ public:
|
|||||||
~FunctionParsersManager();
|
~FunctionParsersManager();
|
||||||
bool init(generic_string xmlPath, ScintillaEditView ** ppEditView);
|
bool init(generic_string xmlPath, ScintillaEditView ** ppEditView);
|
||||||
bool parse(std::vector<foundInfo> & foundInfos, const AssociationInfo & assoInfo);
|
bool parse(std::vector<foundInfo> & foundInfos, const AssociationInfo & assoInfo);
|
||||||
|
void writeFunctionListXml(const TCHAR *destFoder) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ScintillaEditView **_ppEditView;
|
ScintillaEditView **_ppEditView;
|
||||||
|
@ -370,3 +370,12 @@ BEGIN
|
|||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,109,160,10
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,109,160,10
|
||||||
END
|
END
|
||||||
|
|
||||||
|
IDD_PREFERENCE_SETTINGSONCLOUD_BOX DIALOGEX 0, 0, 455, 185
|
||||||
|
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||||
|
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||||
|
BEGIN
|
||||||
|
GROUPBOX "Settings on cloud",IDC_SETTINGSONCLOUD_GB_STATIC,89,44,268,89,BS_CENTER
|
||||||
|
CONTROL "Dropbox",IDD_SETTINGSONCLOUD_DROPBOX_CHECK,
|
||||||
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,60,160,10
|
||||||
|
END
|
||||||
|
|
||||||
|
@ -139,6 +139,10 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
_delimiterSettingsDlg.init(_hInst, _hSelf);
|
_delimiterSettingsDlg.init(_hInst, _hSelf);
|
||||||
_delimiterSettingsDlg.create(IDD_PREFERENCE_DELIMITERSETTINGS_BOX, false, false);
|
_delimiterSettingsDlg.create(IDD_PREFERENCE_DELIMITERSETTINGS_BOX, false, false);
|
||||||
|
|
||||||
|
_settingsOnCloudDlg.init(_hInst, _hSelf);
|
||||||
|
_settingsOnCloudDlg.create(IDD_PREFERENCE_SETTINGSONCLOUD_BOX, false, false);
|
||||||
|
|
||||||
|
|
||||||
_wVector.push_back(DlgInfo(&_barsDlg, TEXT("General"), TEXT("Global")));
|
_wVector.push_back(DlgInfo(&_barsDlg, TEXT("General"), TEXT("Global")));
|
||||||
_wVector.push_back(DlgInfo(&_marginsDlg, TEXT("Editing"), TEXT("Scintillas")));
|
_wVector.push_back(DlgInfo(&_marginsDlg, TEXT("Editing"), TEXT("Scintillas")));
|
||||||
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document"), TEXT("NewDoc")));
|
_wVector.push_back(DlgInfo(&_defaultNewDocDlg, TEXT("New Document"), TEXT("NewDoc")));
|
||||||
@ -152,6 +156,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
_wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion")));
|
_wVector.push_back(DlgInfo(&_autoCompletionDlg, TEXT("Auto-Completion"), TEXT("AutoCompletion")));
|
||||||
_wVector.push_back(DlgInfo(&_multiInstDlg, TEXT("Multi-Instance"), TEXT("MultiInstance")));
|
_wVector.push_back(DlgInfo(&_multiInstDlg, TEXT("Multi-Instance"), TEXT("MultiInstance")));
|
||||||
_wVector.push_back(DlgInfo(&_delimiterSettingsDlg, TEXT("Delimiter"), TEXT("Delimiter")));
|
_wVector.push_back(DlgInfo(&_delimiterSettingsDlg, TEXT("Delimiter"), TEXT("Delimiter")));
|
||||||
|
_wVector.push_back(DlgInfo(&_settingsOnCloudDlg, TEXT("Cloud"), TEXT("Cloud")));
|
||||||
_wVector.push_back(DlgInfo(&_settingsDlg, TEXT("MISC."), TEXT("MISC")));
|
_wVector.push_back(DlgInfo(&_settingsDlg, TEXT("MISC."), TEXT("MISC")));
|
||||||
|
|
||||||
|
|
||||||
@ -177,6 +182,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
_autoCompletionDlg.reSizeTo(rc);
|
_autoCompletionDlg.reSizeTo(rc);
|
||||||
_multiInstDlg.reSizeTo(rc);
|
_multiInstDlg.reSizeTo(rc);
|
||||||
_delimiterSettingsDlg.reSizeTo(rc);
|
_delimiterSettingsDlg.reSizeTo(rc);
|
||||||
|
_settingsOnCloudDlg.reSizeTo(rc);
|
||||||
|
|
||||||
NppParameters *pNppParam = NppParameters::getInstance();
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
|
ETDTProc enableDlgTheme = (ETDTProc)pNppParam->getEnableThemeDlgTexture();
|
||||||
@ -2780,3 +2786,85 @@ BOOL CALLBACK DelimiterSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPA
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CALLBACK SettingsOnCloudDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
|
||||||
|
{
|
||||||
|
NppGUI & nppGUI = (NppGUI &)((NppParameters::getInstance())->getNppGUI());
|
||||||
|
switch (Message)
|
||||||
|
{
|
||||||
|
case WM_INITDIALOG :
|
||||||
|
{
|
||||||
|
CloudChoice cloudChoice = nppGUI._cloudChoice;
|
||||||
|
::SendDlgItemMessage(_hSelf, IDD_SETTINGSONCLOUD_DROPBOX_CHECK, BM_SETCHECK, cloudChoice == dropbox?BST_CHECKED:BST_UNCHECKED, 0);
|
||||||
|
::EnableWindow(::GetDlgItem(_hSelf, IDD_SETTINGSONCLOUD_DROPBOX_CHECK), (nppGUI._availableClouds & DROPBOX_AVAILABLE) != 0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_COMMAND :
|
||||||
|
{
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case IDD_SETTINGSONCLOUD_DROPBOX_CHECK :
|
||||||
|
{
|
||||||
|
nppGUI._cloudChoice = isCheckedOrNot(IDD_SETTINGSONCLOUD_DROPBOX_CHECK)?dropbox:noCloud;
|
||||||
|
if (nppGUI._cloudChoice == dropbox)
|
||||||
|
{
|
||||||
|
setCloudChoice("dropbox");
|
||||||
|
/*
|
||||||
|
// files on cloud can never be erased or modified while setting cloud
|
||||||
|
if (!hasSettingsFilesInDropBox())
|
||||||
|
{
|
||||||
|
// it's the first time to set Notepad++ settings on cloud
|
||||||
|
changeSettingsFilesPath();
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Notepad++ settings are already on cloud
|
||||||
|
askForRestarting();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
removeCloudChoice();
|
||||||
|
//changeSettingsFilesPath();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsOnCloudDlg::setCloudChoice(const char *choice)
|
||||||
|
{
|
||||||
|
generic_string cloudChoicePath = (NppParameters::getInstance())->getSettingsFolder();
|
||||||
|
cloudChoicePath += TEXT("\\cloud\\");
|
||||||
|
|
||||||
|
if (!PathFileExists(cloudChoicePath.c_str()))
|
||||||
|
{
|
||||||
|
::CreateDirectory(cloudChoicePath.c_str(), NULL);
|
||||||
|
}
|
||||||
|
cloudChoicePath += TEXT("choice");
|
||||||
|
writeFileContent(cloudChoicePath.c_str(), choice);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsOnCloudDlg::removeCloudChoice()
|
||||||
|
{
|
||||||
|
generic_string cloudChoicePath = (NppParameters::getInstance())->getSettingsFolder();
|
||||||
|
//NppParameters *nppParams = ;
|
||||||
|
|
||||||
|
cloudChoicePath += TEXT("\\cloud\\choice");
|
||||||
|
if (PathFileExists(cloudChoicePath.c_str()))
|
||||||
|
{
|
||||||
|
::DeleteFile(cloudChoicePath.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -213,6 +213,17 @@ private :
|
|||||||
RECT _closerRect, _closerLabelRect;
|
RECT _closerRect, _closerLabelRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SettingsOnCloudDlg : public StaticDialog
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
SettingsOnCloudDlg() {};
|
||||||
|
|
||||||
|
private :
|
||||||
|
BOOL CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||||
|
void setCloudChoice(const char *choice);
|
||||||
|
void removeCloudChoice();
|
||||||
|
};
|
||||||
|
|
||||||
class PreferenceDlg : public StaticDialog
|
class PreferenceDlg : public StaticDialog
|
||||||
{
|
{
|
||||||
friend class NativeLangSpeaker;
|
friend class NativeLangSpeaker;
|
||||||
@ -261,6 +272,7 @@ private :
|
|||||||
AutoCompletionDlg _autoCompletionDlg;
|
AutoCompletionDlg _autoCompletionDlg;
|
||||||
MultiInstDlg _multiInstDlg;
|
MultiInstDlg _multiInstDlg;
|
||||||
DelimiterSettingsDlg _delimiterSettingsDlg;
|
DelimiterSettingsDlg _delimiterSettingsDlg;
|
||||||
|
SettingsOnCloudDlg _settingsOnCloudDlg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +111,6 @@
|
|||||||
#define IDC_BORDERWIDTH_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 31)
|
#define IDC_BORDERWIDTH_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 31)
|
||||||
#define IDC_BORDERWIDTHVAL_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 32)
|
#define IDC_BORDERWIDTHVAL_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 32)
|
||||||
#define IDC_BORDERWIDTH_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 33)
|
#define IDC_BORDERWIDTH_SLIDER (IDD_PREFERENCE_MARGEIN_BOX + 33)
|
||||||
|
|
||||||
#define IDC_CHECK_DISABLEADVANCEDSCROLL (IDD_PREFERENCE_MARGEIN_BOX + 34)
|
#define IDC_CHECK_DISABLEADVANCEDSCROLL (IDD_PREFERENCE_MARGEIN_BOX + 34)
|
||||||
|
|
||||||
#define IDD_PREFERENCE_DELIMITERSETTINGS_BOX 6250 //(IDD_PREFERENCE_BOX + 250)
|
#define IDD_PREFERENCE_DELIMITERSETTINGS_BOX 6250 //(IDD_PREFERENCE_BOX + 250)
|
||||||
@ -124,6 +123,10 @@
|
|||||||
#define IDD_STATIC_BLABLA (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 7)
|
#define IDD_STATIC_BLABLA (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 7)
|
||||||
#define IDD_STATIC_BLABLA2NDLINE (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 8)
|
#define IDD_STATIC_BLABLA2NDLINE (IDD_PREFERENCE_DELIMITERSETTINGS_BOX + 8)
|
||||||
|
|
||||||
|
#define IDD_PREFERENCE_SETTINGSONCLOUD_BOX 6260 //(IDD_PREFERENCE_BOX + 250)
|
||||||
|
#define IDC_SETTINGSONCLOUD_GB_STATIC (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 1)
|
||||||
|
#define IDD_SETTINGSONCLOUD_DROPBOX_CHECK (IDD_PREFERENCE_SETTINGSONCLOUD_BOX + 2)
|
||||||
|
|
||||||
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
|
#define IDD_PREFERENCE_SETTING_BOX 6300 //(IDD_PREFERENCE_BOX + 300)
|
||||||
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1)
|
#define IDC_TABSETTING_GB_STATIC (IDD_PREFERENCE_SETTING_BOX + 1)
|
||||||
#define IDC_CHECK_REPLACEBYSPACE (IDD_PREFERENCE_SETTING_BOX + 2)
|
#define IDC_CHECK_REPLACEBYSPACE (IDD_PREFERENCE_SETTING_BOX + 2)
|
||||||
|
Loading…
Reference in New Issue
Block a user