[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:
parent
4beac9434b
commit
e4e465b092
@ -244,7 +244,6 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi
|
|||||||
|
|
||||||
if (PathFileExists(cmdLine))
|
if (PathFileExists(cmdLine))
|
||||||
{
|
{
|
||||||
|
|
||||||
doOpen(cmdLine, cmdLineParams->_isReadOnly);
|
doOpen(cmdLine, cmdLineParams->_isReadOnly);
|
||||||
|
|
||||||
if (lt != L_TXT)
|
if (lt != L_TXT)
|
||||||
@ -3392,6 +3391,18 @@ void Notepad_plus::command(int id)
|
|||||||
break;
|
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 :
|
case IDM_EDIT_AUTOCOMPLETE :
|
||||||
showAutoComp();
|
showAutoComp();
|
||||||
break;
|
break;
|
||||||
@ -5811,6 +5822,13 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
_scintillaCtrls4Plugins.init(_hInst, hwnd);
|
_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
|
// Plugin Manager
|
||||||
NppData nppData;
|
NppData nppData;
|
||||||
nppData._nppHandle = _hSelf;
|
nppData._nppHandle = _hSelf;
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "WindowsDlg.h"
|
#include "WindowsDlg.h"
|
||||||
#include "RunMacroDlg.h"
|
#include "RunMacroDlg.h"
|
||||||
#include "DockingManager.h"
|
#include "DockingManager.h"
|
||||||
|
#include "Process.h"
|
||||||
|
|
||||||
#define NOTEPAD_PP_CLASS_NAME "Notepad++"
|
#define NOTEPAD_PP_CLASS_NAME "Notepad++"
|
||||||
|
|
||||||
|
@ -476,6 +476,8 @@ BEGIN
|
|||||||
MENUITEM "Online help", IDM_ONLINEHELP
|
MENUITEM "Online help", IDM_ONLINEHELP
|
||||||
MENUITEM "Forum", IDM_FORUM
|
MENUITEM "Forum", IDM_FORUM
|
||||||
MENUITEM "Get more plugins", IDM_PLUGINSHOME
|
MENUITEM "Get more plugins", IDM_PLUGINSHOME
|
||||||
|
MENUITEM SEPARATOR
|
||||||
|
MENUITEM "Update Notepad++", IDM_UPDATE_NPP
|
||||||
MENUITEM "About Notepad++\tF1", IDM_ABOUT
|
MENUITEM "About Notepad++\tF1", IDM_ABOUT
|
||||||
END
|
END
|
||||||
|
|
||||||
|
@ -237,6 +237,7 @@
|
|||||||
#define IDM_ONLINEHELP (IDM_ABOUT + 3)
|
#define IDM_ONLINEHELP (IDM_ABOUT + 3)
|
||||||
#define IDM_FORUM (IDM_ABOUT + 4)
|
#define IDM_FORUM (IDM_ABOUT + 4)
|
||||||
#define IDM_PLUGINSHOME (IDM_ABOUT + 5)
|
#define IDM_PLUGINSHOME (IDM_ABOUT + 5)
|
||||||
|
#define IDM_UPDATE_NPP (IDM_ABOUT + 6)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
#ifndef RESOURCE_H
|
#ifndef RESOURCE_H
|
||||||
#define RESOURCE_H
|
#define RESOURCE_H
|
||||||
|
|
||||||
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.6"
|
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.7"
|
||||||
#define VERSION_VALUE "4.6\0"
|
#define VERSION_VALUE "4.7\0"
|
||||||
#define VERSION_DIGITALVALUE 4, 6, 0, 0
|
#define VERSION_DIGITALVALUE 4, 7, 0, 0
|
||||||
|
|
||||||
#ifndef IDC_STATIC
|
#ifndef IDC_STATIC
|
||||||
#define IDC_STATIC -1
|
#define IDC_STATIC -1
|
||||||
|
@ -63,11 +63,10 @@ static bool isInList(const char *token2Find, char *list2Clean) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static string getParamVal(char c, char *list2Clean) {
|
||||||
static LangType getLangTypeFromParam(char *list2Clean) {
|
|
||||||
char word[1024];
|
char word[1024];
|
||||||
bool checkDash = true;
|
bool checkDash = true;
|
||||||
bool checkL = false;
|
bool checkCh = false;
|
||||||
bool action = false;
|
bool action = false;
|
||||||
bool isFileNamePart = false;
|
bool isFileNamePart = false;
|
||||||
int pos2Erase = 0;
|
int pos2Erase = 0;
|
||||||
@ -87,7 +86,7 @@ static LangType getLangTypeFromParam(char *list2Clean) {
|
|||||||
|
|
||||||
list2Clean[pos2Erase] = '\0';
|
list2Clean[pos2Erase] = '\0';
|
||||||
|
|
||||||
return NppParameters::getLangIDFromStr(word);
|
return word;
|
||||||
}
|
}
|
||||||
checkDash = true;
|
checkDash = true;
|
||||||
}
|
}
|
||||||
@ -105,83 +104,34 @@ static LangType getLangTypeFromParam(char *list2Clean) {
|
|||||||
else if (checkDash)
|
else if (checkDash)
|
||||||
{
|
{
|
||||||
if (list2Clean[i] == '-')
|
if (list2Clean[i] == '-')
|
||||||
checkL = true;
|
checkCh = true;
|
||||||
|
|
||||||
if (list2Clean[i] != ' ')
|
if (list2Clean[i] != ' ')
|
||||||
checkDash = false;
|
checkDash = false;
|
||||||
}
|
}
|
||||||
else if (checkL)
|
else if (checkCh)
|
||||||
{
|
{
|
||||||
if (list2Clean[i] == 'l')
|
if (list2Clean[i] == c)
|
||||||
{
|
{
|
||||||
action = true;
|
action = true;
|
||||||
pos2Erase = i-1;
|
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) {
|
static int getLn2GoFromParam(char *list2Clean) {
|
||||||
char word[16];
|
string lineNumStr = getParamVal('n', list2Clean);
|
||||||
bool checkDash = true;
|
return atoi(lineNumStr.c_str());
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
||||||
const char FLAG_MULTI_INSTANCE[] = "-multiInst";
|
const char FLAG_MULTI_INSTANCE[] = "-multiInst";
|
||||||
const char FLAG_NO_PLUGIN[] = "-noPlugin";
|
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 updaterFullPath = updaterDir + "gup.exe";
|
||||||
|
|
||||||
string version = VERSION_VALUE;
|
string version = "-v";
|
||||||
|
version += VERSION_VALUE;
|
||||||
|
|
||||||
bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE);
|
bool isUpExist = nppGui._doesExistUpdater = (::PathFileExists(updaterFullPath.c_str()) == TRUE);
|
||||||
bool doUpdate = !nppGui._neverUpdate;
|
bool doUpdate = !nppGui._neverUpdate;
|
||||||
|
@ -573,11 +573,11 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
RelativePath="..\src\resource.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\src\resource.h"
|
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
|
Loading…
Reference in New Issue
Block a user