[NEW_FEATURE] Enable/disable Notepad++ updater via preference dialog.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@71 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-11-10 21:24:45 +00:00
parent a501b3f659
commit a89f6010de
8 changed files with 75 additions and 30 deletions

View File

@ -3207,7 +3207,7 @@ void Notepad_plus::command(int id)
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
nppgui._tabReplacedBySpace = !nppgui._tabReplacedBySpace;
_pEditView->execute(SCI_SETUSETABS, !nppgui._tabReplacedBySpace);
checkMenuItem(IDM_SETTING_TAB_REPLCESPACE, nppgui._tabReplacedBySpace);
//checkMenuItem(IDM_SETTING_TAB_REPLCESPACE, nppgui._tabReplacedBySpace);
break;
}
@ -3248,7 +3248,7 @@ void Notepad_plus::command(int id)
}
break;
}
/*
case IDM_SETTING_HISTORY_DONT_CHECK :
{
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
@ -3256,7 +3256,7 @@ void Notepad_plus::command(int id)
checkMenuItem(IDM_SETTING_HISTORY_DONT_CHECK, !nppgui._checkHistoryFiles);
break;
}
*/
case IDM_SETTING_FILEASSOCIATION_DLG :
{
RegExtDlg regExtDlg;
@ -3292,7 +3292,7 @@ void Notepad_plus::command(int id)
nppgui._fileAutoDetection = cdAutoUpdate;
break;
}
/*
case IDM_SETTING_TRAYICON :
{
NppGUI & nppgui = (NppGUI &)(pNppParam->getNppGUI());
@ -3308,7 +3308,7 @@ void Notepad_plus::command(int id)
checkMenuItem(IDM_SETTING_REMEMBER_LAST_SESSION, nppgui._rememberLastSession);
break;
}
*/
case IDM_SETTING_PREFERECE :
{
bool isFirstTime = !_preference.isCreated();
@ -5581,9 +5581,9 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_mainEditView.showWrapSymbol(svp1._wrapSymbolShow);
_subEditView.showWrapSymbol(svp2._wrapSymbolShow);
checkMenuItem(IDM_SETTING_HISTORY_DONT_CHECK, !nppGUI._checkHistoryFiles);
checkMenuItem(IDM_SETTING_TRAYICON, nppGUI._isMinimizedToTray);
checkMenuItem(IDM_SETTING_REMEMBER_LAST_SESSION, nppGUI._rememberLastSession);
//checkMenuItem(IDM_SETTING_HISTORY_DONT_CHECK, !nppGUI._checkHistoryFiles);
//checkMenuItem(IDM_SETTING_TRAYICON, nppGUI._isMinimizedToTray);
//checkMenuItem(IDM_SETTING_REMEMBER_LAST_SESSION, nppGUI._rememberLastSession);
_mainEditView.performGlobalStyles();
_subEditView.performGlobalStyles();
@ -5646,7 +5646,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_statusBar.setPartWidth(STATUSBAR_TYPING_MODE, 30);
_statusBar.display(willBeShown);
//
checkMenuItem(IDM_VIEW_STATUSBAR, willBeShown);
//checkMenuItem(IDM_VIEW_STATUSBAR, willBeShown);
_findReplaceDlg.init(_hInst, hwnd, &_pEditView);
_incrementFindDlg.init(_hInst, hwnd, &_findReplaceDlg);
@ -5656,7 +5656,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_runDlg.init(_hInst, hwnd);
_runMacroDlg.init(_hInst, hwnd);
checkMenuItem(IDM_SETTING_TAB_REPLCESPACE, nppGUI._tabReplacedBySpace);
//checkMenuItem(IDM_SETTING_TAB_REPLCESPACE, nppGUI._tabReplacedBySpace);
_pMainWindow = &_mainDocTab;

View File

@ -21,9 +21,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "resource.h"
#include "menuCmdID.h"
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.5"
#define VERSION_VALUE "4.5\0"
#define VERSION_DIGITALVALUE 4, 5, 0, 0
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.6"
#define VERSION_VALUE "4.6\0"
#define VERSION_DIGITALVALUE 4, 6, 0, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_DIGITALVALUE

View File

@ -2230,6 +2230,18 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
_nppGUI._definedSessionExt = val;
}
}
else if (!strcmp(nm, "noUpdate"))
{
TiXmlNode *n = childNode->FirstChild();
if (n)
{
val = n->Value();
if (val)
{
_nppGUI._neverUpdate = (!strcmp(val, "yes"))?true:false;
}
}
}
}
}
@ -2505,6 +2517,7 @@ void NppParameters::writeGUIParams()
bool globalOverrideExist = false;
bool autocExist = false;
bool sessionExtExist = false;
bool noUpdateExist = false;
TiXmlNode *dockingParamNode = NULL;
@ -2756,6 +2769,22 @@ void NppParameters::writeGUIParams()
else
childNode->InsertEndChild(TiXmlText(_nppGUI._definedSessionExt.c_str()));
}
else if (!strcmp(nm, "noUpdate"))
{
noUpdateExist = true;
const char *pStr = _nppGUI._neverUpdate?"yes":"no";
TiXmlNode *n = childNode->FirstChild();
if (n)
n->SetValue(pStr);
else
childNode->InsertEndChild(TiXmlText(pStr));
}
}
if (!noUpdateExist)
{
insertGUIConfigBoolNode(GUIRoot, "noUpdate", _nppGUI._neverUpdate);
}
if (!autoDetectionExist)

View File

@ -511,7 +511,7 @@ struct NppGUI
_tabReplacedBySpace(false), _fileAutoDetection(cdEnabled), _checkHistoryFiles(true),\
_isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\
_doTaskList(true), _maitainIndent(true), _saveOpenKeepInSameDir(false), _styleMRU(true), _styleURL(0),
_autocStatus(autoc_none), _definedSessionExt("") {
_autocStatus(autoc_none), _definedSessionExt(""), _neverUpdate(false), _doesExistUpdater(false){
_appPos.left = 0;
_appPos.top = 0;
_appPos.right = 700;
@ -566,6 +566,8 @@ struct NppGUI
enum AutocStatus{autoc_none, autoc_func, autoc_word};
AutocStatus _autocStatus;
string _definedSessionExt;
bool _neverUpdate;
bool _doesExistUpdater;
};
struct ScintillaViewParams

View File

@ -100,8 +100,8 @@ BEGIN
LTEXT "0",IDC_MAXNBFILEVAL_STATIC,266,18,15,8
CONTROL "Enable",IDC_CHECK_FILEAUTODETECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,65,98,10
CONTROL "Minimize to sys tray",IDC_CHECK_MIN2SYSTRAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,101,130,10
CONTROL "Remember the current session for next launch",IDC_CHECK_REMEMBERSESSION,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,111,160,23
CONTROL "Remember the current session for next launch",IDC_CHECK_REMEMBERSESSION, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,111,160,23
CONTROL "Enable Notepad++ auto-updater",IDC_CHECK_AUTOUPDATE, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,134,150,10
GROUPBOX "File Status Auto-detection",IDC_FILEAUTODETECTION_STATIC,11,54,120,39,BS_CENTER
CONTROL "Update silently",IDC_CHECK_UPDATESILENTLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,78,98,10
//GROUPBOX "Backup Option",IDC_BACKUP_GB_STATIC,11,98,120,46,BS_CENTER

View File

@ -471,6 +471,9 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
::SendDlgItemMessage(_hSelf, IDC_CHECK_MIN2SYSTRAY, BM_SETCHECK, nppGUI._isMinimizedToTray, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_REMEMBERSESSION, BM_SETCHECK, nppGUI._rememberLastSession, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_AUTOUPDATE, BM_SETCHECK, !nppGUI._neverUpdate, 0);
::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_AUTOUPDATE), nppGUI._doesExistUpdater?SW_SHOW:SW_HIDE);
BOOL linkEnable = FALSE;
BOOL dontUnderline = FALSE;
@ -523,8 +526,10 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
case IDC_CHECK_REPLACEBYSPACE:
::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_TAB_REPLCESPACE, 0);
return TRUE;
case IDC_CHECK_DONTCHECKHISTORY:
::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_HISTORY_DONT_CHECK, 0);
nppGUI._checkHistoryFiles = isCheckedOrNot(IDC_CHECK_DONTCHECKHISTORY);
//::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_HISTORY_DONT_CHECK, 0);
return TRUE;
case IDC_CHECK_FILEAUTODETECTION:
@ -563,12 +568,19 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
}
return TRUE;
case IDC_CHECK_AUTOUPDATE:
nppGUI._neverUpdate = !isCheckedOrNot(wParam);
return TRUE;
case IDC_CHECK_MIN2SYSTRAY:
::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_TRAYICON, 0);
nppGUI._isMinimizedToTray = isCheckedOrNot(wParam);
return TRUE;
case IDC_CHECK_REMEMBERSESSION:
::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_REMEMBER_LAST_SESSION, 0);
//::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_REMEMBER_LAST_SESSION, 0);
nppGUI._rememberLastSession = isCheckedOrNot(wParam);
return TRUE;
case IDM_SETTING_TAB_SIZE:
{
::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_TAB_SIZE, 0);
@ -581,7 +593,7 @@ BOOL CALLBACK SettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
{
::SendMessage(_hParent, WM_COMMAND, IDM_SETTING_HISTORY_SIZE, 0);
char nbStr[10];
itoa(pNppParam->getNbMaxFile(), nbStr, 10);
sprintf(nbStr, "%d", pNppParam->getNbMaxFile());
::SetWindowText(::GetDlgItem(_hSelf, IDC_MAXNBFILEVAL_STATIC), nbStr);
return TRUE;
}
@ -828,7 +840,6 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
::EnableWindow(::GetDlgItem(_hSelf, idButton2Disable), FALSE);
HWND grandParent;
//::SendMessage(_hParent, WM_GETPARENTOF, (WPARAM)&grandParent, 0);
grandParent = ::GetParent(_hParent);
if (LOWORD(wParam)==IDC_BUTTON_REMOVE)

View File

@ -84,6 +84,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define IDC_CHECK_CLICKABLELINK_NOUNDERLINE (IDD_PREFERENCE_SETTING_BOX + 20)
#define IDC_EDIT_SESSIONFILEEXT (IDD_PREFERENCE_SETTING_BOX + 21)
#define IDC_SESSIONFILEEXT_STATIC (IDD_PREFERENCE_SETTING_BOX + 22)
#define IDC_CHECK_AUTOUPDATE (IDD_PREFERENCE_SETTING_BOX + 23)
#define IDD_PREFERENCE_NEWDOCSETTING_BOX 6400 //(IDD_PREFERENCE_BOX + 400)
#define IDC_FORMAT_GB_STATIC (IDD_PREFERENCE_NEWDOCSETTING_BOX + 1)

View File

@ -266,18 +266,20 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh
pNppParameters->load();
Notepad_plus notepad_plus_plus;
NppGUI & nppGui = (NppGUI &)pNppParameters->getNppGUI();
char updaterPath[MAX_PATH];
strcpy(updaterPath, pNppParameters->getNppPath());
strcat(updaterPath, "\\updater\\gup.exe");
bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterPath) == TRUE);
bool doUpdate = !nppGui._neverUpdate;
if (TheFirstOne)
if (TheFirstOne && isUpExist && doUpdate)
{
char updaterPath[MAX_PATH];
strcpy(updaterPath, pNppParameters->getNppPath());
strcat(updaterPath, "\\updater\\gup.exe");
if (::PathFileExists(updaterPath))
{
Process updater(updaterPath, "c:\\");
updater.run();
}
Process updater(updaterPath, "c:\\");
updater.run();
}
MSG msg;
msg.wParam = 0;
try {