[UPDATE] Integrate the newest GUP into Notepad++.

Add "Update Notepad++" menu item.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@79 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-12-06 00:03:41 +00:00
parent 4beac9434b
commit e4e465b092
7 changed files with 46 additions and 73 deletions

View File

@ -244,7 +244,6 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi
if (PathFileExists(cmdLine))
{
doOpen(cmdLine, cmdLineParams->_isReadOnly);
if (lt != L_TXT)
@ -3392,6 +3391,18 @@ void Notepad_plus::command(int id)
break;
}
case IDM_UPDATE_NPP :
{
string updaterDir = pNppParam->getNppPath();
updaterDir += "\\updater\\";
string updaterFullPath = updaterDir + "gup.exe";
string param = "-verbose -v";
param += VERSION_VALUE;
Process updater(updaterFullPath.c_str(), param.c_str(), updaterDir.c_str());
updater.run();
break;
}
case IDM_EDIT_AUTOCOMPLETE :
showAutoComp();
break;
@ -5811,6 +5822,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
_scintillaCtrls4Plugins.init(_hInst, hwnd);
// Updater menu item
if (!nppGUI._doesExistUpdater)
{
//::MessageBox(NULL, "pas de updater", "", MB_OK);
::DeleteMenu(::GetMenu(_hSelf), IDM_UPDATE_NPP, MF_BYCOMMAND);
::DrawMenuBar(hwnd);
}
// Plugin Manager
NppData nppData;
nppData._nppHandle = _hSelf;

View File

@ -45,6 +45,7 @@
#include "WindowsDlg.h"
#include "RunMacroDlg.h"
#include "DockingManager.h"
#include "Process.h"
#define NOTEPAD_PP_CLASS_NAME "Notepad++"

View File

@ -476,6 +476,8 @@ BEGIN
MENUITEM "Online help", IDM_ONLINEHELP
MENUITEM "Forum", IDM_FORUM
MENUITEM "Get more plugins", IDM_PLUGINSHOME
MENUITEM SEPARATOR
MENUITEM "Update Notepad++", IDM_UPDATE_NPP
MENUITEM "About Notepad++\tF1", IDM_ABOUT
END

View File

@ -237,6 +237,7 @@
#define IDM_ONLINEHELP (IDM_ABOUT + 3)
#define IDM_FORUM (IDM_ABOUT + 4)
#define IDM_PLUGINSHOME (IDM_ABOUT + 5)
#define IDM_UPDATE_NPP (IDM_ABOUT + 6)

View File

@ -18,9 +18,9 @@
#ifndef RESOURCE_H
#define RESOURCE_H
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.6"
#define VERSION_VALUE "4.6\0"
#define VERSION_DIGITALVALUE 4, 6, 0, 0
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.7"
#define VERSION_VALUE "4.7\0"
#define VERSION_DIGITALVALUE 4, 7, 0, 0
#ifndef IDC_STATIC
#define IDC_STATIC -1

View File

@ -63,11 +63,10 @@ static bool isInList(const char *token2Find, char *list2Clean) {
return false;
};
static LangType getLangTypeFromParam(char *list2Clean) {
static string getParamVal(char c, char *list2Clean) {
char word[1024];
bool checkDash = true;
bool checkL = false;
bool checkCh = false;
bool action = false;
bool isFileNamePart = false;
int pos2Erase = 0;
@ -87,7 +86,7 @@ static LangType getLangTypeFromParam(char *list2Clean) {
list2Clean[pos2Erase] = '\0';
return NppParameters::getLangIDFromStr(word);
return word;
}
checkDash = true;
}
@ -105,83 +104,34 @@ static LangType getLangTypeFromParam(char *list2Clean) {
else if (checkDash)
{
if (list2Clean[i] == '-')
checkL = true;
checkCh = true;
if (list2Clean[i] != ' ')
checkDash = false;
}
else if (checkL)
else if (checkCh)
{
if (list2Clean[i] == 'l')
if (list2Clean[i] == c)
{
action = true;
pos2Erase = i-1;
}
checkL = false;
checkCh = false;
}
}
}
return L_TXT;
return "";
};
static LangType getLangTypeFromParam(char *list2Clean) {
string langStr = getParamVal('l', list2Clean);
return NppParameters::getLangIDFromStr(langStr.c_str());
};
static int getLn2GoFromParam(char *list2Clean) {
char word[16];
bool checkDash = true;
bool checkN = false;
bool action = false;
bool isFileNamePart = false;
int pos2Erase = 0;
for (int i = 0, j = 0 ; i <= int(strlen(list2Clean)) ; i++)
{
if ((list2Clean[i] == ' ') || (list2Clean[i] == '\0'))
{
if (action)
{
word[j] = '\0';
j = 0;
action = false;
for (i = i + 1 ; i <= int(strlen(list2Clean)) ; i++, pos2Erase++)
list2Clean[pos2Erase] = list2Clean[i];
list2Clean[pos2Erase] = '\0';
return atoi(word);
}
checkDash = true;
}
else if (list2Clean[i] == '"')
{
isFileNamePart = !isFileNamePart;
}
if (!isFileNamePart)
{
if (action)
{
word[j++] = list2Clean[i];
}
else if (checkDash)
{
if (list2Clean[i] == '-')
checkN = true;
if (list2Clean[i] != ' ')
checkDash = false;
}
else if (checkN)
{
if (list2Clean[i] == 'n')
{
action = true;
pos2Erase = i-1;
}
checkN = false;
}
}
}
return -1;
};
string lineNumStr = getParamVal('n', list2Clean);
return atoi(lineNumStr.c_str());
};
const char FLAG_MULTI_INSTANCE[] = "-multiInst";
const char FLAG_NO_PLUGIN[] = "-noPlugin";
@ -274,7 +224,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh
string updaterFullPath = updaterDir + "gup.exe";
string version = VERSION_VALUE;
string version = "-v";
version += VERSION_VALUE;
bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE);
bool doUpdate = !nppGui._neverUpdate;

View File

@ -573,11 +573,11 @@
>
</File>
<File
RelativePath="..\src\WinControls\Preference\resource.h"
RelativePath="..\src\resource.h"
>
</File>
<File
RelativePath="..\src\resource.h"
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File