[REVERT] menuID2LangType function is reverted due to its performance issue.
[NEW_FEATURE] Add "Display loading time" feature (via command line argument "-loadingTime"). [NEW] Add NPPM_INTERNAL_DISABLEAUTOUPDATE message (which can be triggered by GUP.exe). git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@609 f5eea248-9336-0410-98b8-ebc06183d4e3remotes/x64
parent
689d434a9f
commit
e098cbc677
Binary file not shown.
|
@ -44,7 +44,7 @@
|
|||
<!-- Optional.
|
||||
This is the title to display on the messagebox title bar.
|
||||
-->
|
||||
<MessageBoxTitle>Notepad++ update</MessageBoxTitle>
|
||||
<MessageBoxTitle extraCmd="1034" ecWparam="" ecLparam="">Notepad++ update</MessageBoxTitle>
|
||||
|
||||
<!-- optional. YES by default.
|
||||
This parameter can hide all the network error message.
|
||||
|
|
|
@ -203,7 +203,11 @@ Notepad_plus::~Notepad_plus()
|
|||
}
|
||||
|
||||
void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdLineParams *cmdLineParams)
|
||||
{
|
||||
{
|
||||
time_t timestampBegin = 0;
|
||||
if (cmdLineParams->_showLoadingTime)
|
||||
timestampBegin = time(NULL);
|
||||
|
||||
Window::init(hInst, parent);
|
||||
WNDCLASS nppClass;
|
||||
|
||||
|
@ -368,6 +372,16 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLine, CmdL
|
|||
scnN.nmhdr.hwndFrom = _hSelf;
|
||||
scnN.nmhdr.idFrom = 0;
|
||||
_pluginsManager.notify(&scnN);
|
||||
|
||||
if (cmdLineParams->_showLoadingTime)
|
||||
{
|
||||
time_t timestampEnd = time(NULL);
|
||||
double loadTime = difftime(timestampEnd, timestampBegin);
|
||||
|
||||
char dest[256];
|
||||
sprintf(dest, "Loading time : %.2lf seconds", loadTime);
|
||||
::MessageBoxA(NULL, dest, "", MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2585,46 +2599,128 @@ void Notepad_plus::setLanguage(LangType langType) {
|
|||
}
|
||||
};
|
||||
|
||||
//NEW-2: 41 lines, 53 bytes code, 54 items: 108 bytes data = 161 bytes
|
||||
#define LANG_MAP(x) { (IDM_LANG_##x - IDM_LANG), (L_##x) }
|
||||
|
||||
enum LangType Notepad_plus::menuID2LangType(int cmdID)
|
||||
{
|
||||
static struct Mapping {
|
||||
unsigned char mapFrom;
|
||||
unsigned char mapTo;
|
||||
} mappings[]= {
|
||||
LANG_MAP(ADA), LANG_MAP(ASM), LANG_MAP(ASP),
|
||||
LANG_MAP(AU3), LANG_MAP(BATCH), LANG_MAP(C),
|
||||
LANG_MAP(CAML), LANG_MAP(CMAKE), LANG_MAP(COBOL),
|
||||
LANG_MAP(CPP), LANG_MAP(CS), LANG_MAP(CSS),
|
||||
LANG_MAP(D), LANG_MAP(DIFF), LANG_MAP(FLASH),
|
||||
LANG_MAP(FORTRAN), LANG_MAP(GUI4CLI), LANG_MAP(HASKELL),
|
||||
LANG_MAP(HTML), LANG_MAP(INI), LANG_MAP(INNO),
|
||||
LANG_MAP(JAVA), LANG_MAP(JS), LANG_MAP(KIX),
|
||||
LANG_MAP(LISP), LANG_MAP(LUA), LANG_MAP(MAKEFILE),
|
||||
LANG_MAP(MATLAB), LANG_MAP(NSIS), LANG_MAP(OBJC),
|
||||
LANG_MAP(PASCAL), LANG_MAP(PERL), LANG_MAP(PHP),
|
||||
LANG_MAP(POWERSHELL), LANG_MAP(PROPS), LANG_MAP(PS),
|
||||
LANG_MAP(PYTHON), LANG_MAP(R), LANG_MAP(RC),
|
||||
LANG_MAP(RUBY), LANG_MAP(SCHEME), LANG_MAP(SMALLTALK),
|
||||
LANG_MAP(SQL), LANG_MAP(TCL), LANG_MAP(TEX),
|
||||
LANG_MAP(VB), LANG_MAP(VERILOG), LANG_MAP(VHDL),
|
||||
LANG_MAP(XML), LANG_MAP(YAML), LANG_MAP(BASH),
|
||||
LANG_MAP(ASCII), LANG_MAP(TEXT),
|
||||
{ 0xFF, L_EXTERNAL }
|
||||
};
|
||||
|
||||
if (cmdID >= IDM_LANG_USER && cmdID <= IDM_LANG_USER_LIMIT)
|
||||
return L_USER;
|
||||
else
|
||||
switch (cmdID)
|
||||
{
|
||||
// scan mapping table - ends at L_EXTERNAL entry if not found.
|
||||
Mapping *map;
|
||||
for(map = mappings; map->mapFrom != 0xFF; ++map)
|
||||
if((cmdID-IDM_LANG) == map->mapFrom) break;
|
||||
return (LangType) (map->mapTo);
|
||||
case IDM_LANG_C :
|
||||
return L_C;
|
||||
case IDM_LANG_CPP :
|
||||
return L_CPP;
|
||||
case IDM_LANG_JAVA :
|
||||
return L_JAVA;
|
||||
case IDM_LANG_CS :
|
||||
return L_CS;
|
||||
case IDM_LANG_HTML :
|
||||
return L_HTML;
|
||||
case IDM_LANG_XML :
|
||||
return L_XML;
|
||||
case IDM_LANG_JS :
|
||||
return L_JS;
|
||||
case IDM_LANG_PHP :
|
||||
return L_PHP;
|
||||
case IDM_LANG_ASP :
|
||||
return L_ASP;
|
||||
case IDM_LANG_JSP :
|
||||
return L_JSP;
|
||||
case IDM_LANG_CSS :
|
||||
return L_CSS;
|
||||
case IDM_LANG_LUA :
|
||||
return L_LUA;
|
||||
case IDM_LANG_PERL :
|
||||
return L_PERL;
|
||||
case IDM_LANG_PYTHON :
|
||||
return L_PYTHON;
|
||||
case IDM_LANG_PASCAL :
|
||||
return L_PASCAL;
|
||||
case IDM_LANG_BATCH :
|
||||
return L_BATCH;
|
||||
case IDM_LANG_OBJC :
|
||||
return L_OBJC;
|
||||
case IDM_LANG_VB :
|
||||
return L_VB;
|
||||
case IDM_LANG_SQL :
|
||||
return L_SQL;
|
||||
case IDM_LANG_ASCII :
|
||||
return L_ASCII;
|
||||
case IDM_LANG_TEXT :
|
||||
return L_TEXT;
|
||||
case IDM_LANG_RC :
|
||||
return L_RC;
|
||||
case IDM_LANG_MAKEFILE :
|
||||
return L_MAKEFILE;
|
||||
case IDM_LANG_INI :
|
||||
return L_INI;
|
||||
case IDM_LANG_TEX :
|
||||
return L_TEX;
|
||||
case IDM_LANG_FORTRAN :
|
||||
return L_FORTRAN;
|
||||
case IDM_LANG_BASH :
|
||||
return L_BASH;
|
||||
case IDM_LANG_FLASH :
|
||||
return L_FLASH;
|
||||
case IDM_LANG_NSIS :
|
||||
return L_NSIS;
|
||||
case IDM_LANG_TCL :
|
||||
return L_TCL;
|
||||
case IDM_LANG_LISP :
|
||||
return L_LISP;
|
||||
case IDM_LANG_SCHEME :
|
||||
return L_SCHEME;
|
||||
case IDM_LANG_ASM :
|
||||
return L_ASM;
|
||||
case IDM_LANG_DIFF :
|
||||
return L_DIFF;
|
||||
case IDM_LANG_PROPS :
|
||||
return L_PROPS;
|
||||
case IDM_LANG_PS:
|
||||
return L_PS;
|
||||
case IDM_LANG_RUBY:
|
||||
return L_RUBY;
|
||||
case IDM_LANG_SMALLTALK:
|
||||
return L_SMALLTALK;
|
||||
case IDM_LANG_VHDL :
|
||||
return L_VHDL;
|
||||
case IDM_LANG_KIX :
|
||||
return L_KIX;
|
||||
case IDM_LANG_CAML :
|
||||
return L_CAML;
|
||||
case IDM_LANG_ADA :
|
||||
return L_ADA;
|
||||
case IDM_LANG_VERILOG :
|
||||
return L_VERILOG;
|
||||
case IDM_LANG_MATLAB :
|
||||
return L_MATLAB;
|
||||
case IDM_LANG_HASKELL :
|
||||
return L_HASKELL;
|
||||
case IDM_LANG_AU3 :
|
||||
return L_AU3;
|
||||
case IDM_LANG_INNO :
|
||||
return L_INNO;
|
||||
case IDM_LANG_CMAKE :
|
||||
return L_CMAKE;
|
||||
case IDM_LANG_YAML :
|
||||
return L_YAML;
|
||||
case IDM_LANG_COBOL :
|
||||
return L_COBOL;
|
||||
case IDM_LANG_D :
|
||||
return L_D;
|
||||
case IDM_LANG_GUI4CLI :
|
||||
return L_GUI4CLI;
|
||||
case IDM_LANG_POWERSHELL :
|
||||
return L_POWERSHELL;
|
||||
case IDM_LANG_R :
|
||||
return L_R;
|
||||
|
||||
case IDM_LANG_USER :
|
||||
return L_USER;
|
||||
default: {
|
||||
if (cmdID >= IDM_LANG_USER && cmdID <= IDM_LANG_USER_LIMIT) {
|
||||
return L_USER;
|
||||
}
|
||||
break; }
|
||||
}
|
||||
return L_EXTERNAL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -7121,6 +7217,14 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_DISABLEAUTOUPDATE :
|
||||
{
|
||||
//printStr(TEXT("you've got me"));
|
||||
NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI();
|
||||
nppGUI._autoUpdateOpt._doAutoUpdate = false;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_INITMENUPOPUP:
|
||||
{
|
||||
_windowsMenu.initPopupMenu((HMENU)wParam, _pDocTab);
|
||||
|
|
|
@ -154,6 +154,7 @@ struct CmdLineParams {
|
|||
bool _isNoSession;
|
||||
bool _isNoTab;
|
||||
bool _isPreLaunch;
|
||||
bool _showLoadingTime;
|
||||
|
||||
int _line2go;
|
||||
int _column2go;
|
||||
|
@ -166,8 +167,8 @@ struct CmdLineParams {
|
|||
};
|
||||
|
||||
LangType _langType;
|
||||
CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false),\
|
||||
_line2go(-1), _column2go(-1), _langType(L_EXTERNAL), _isPointXValid(false), _isPointYValid(false)
|
||||
CmdLineParams() : _isNoPlugin(false), _isReadOnly(false), _isNoSession(false), _isNoTab(false),_showLoadingTime(false),\
|
||||
_isPreLaunch(false), _line2go(-1), _column2go(-1), _langType(L_EXTERNAL), _isPointXValid(false), _isPointYValid(false)
|
||||
{
|
||||
_point.x = 0;
|
||||
_point.y = 0;
|
||||
|
@ -600,7 +601,7 @@ public:
|
|||
_year = timeinfo->tm_year+1900;
|
||||
_month = timeinfo->tm_mon+1;
|
||||
_day = timeinfo->tm_mday;
|
||||
}
|
||||
};
|
||||
|
||||
generic_string toString() { // Return Notepad++ date format : YYYYMMDD
|
||||
TCHAR dateStr[8+1];
|
||||
|
|
|
@ -301,7 +301,7 @@
|
|||
#define NPPM_INTERNAL_SCINTILLAKEYMODIFIED (NOTEPADPLUS_USER_INTERNAL + 7)
|
||||
#define NPPM_INTERNAL_SCINTILLAFINFERCOLLAPSE (NOTEPADPLUS_USER_INTERNAL + 8)
|
||||
#define NPPM_INTERNAL_SCINTILLAFINFERUNCOLLAPSE (NOTEPADPLUS_USER_INTERNAL + 9)
|
||||
//#define NPPM_INTERNAL_DOCSWITCHOFF (NOTEPADPLUS_USER_INTERNAL + 10)
|
||||
#define NPPM_INTERNAL_DISABLEAUTOUPDATE (NOTEPADPLUS_USER_INTERNAL + 10)
|
||||
//#define NPPM_INTERNAL_DOCSWITCHIN (NOTEPADPLUS_USER_INTERNAL + 11)
|
||||
#define NPPM_INTERNAL_ISTABBARREDUCED (NOTEPADPLUS_USER_INTERNAL + 12)
|
||||
#define NPPM_INTERNAL_ISFOCUSEDTAB (NOTEPADPLUS_USER_INTERNAL + 13)
|
||||
|
|
|
@ -144,11 +144,12 @@ const TCHAR FLAG_READONLY[] = TEXT("-ro");
|
|||
const TCHAR FLAG_NOSESSION[] = TEXT("-nosession");
|
||||
const TCHAR FLAG_NOTABBAR[] = TEXT("-notabbar");
|
||||
const TCHAR FLAG_SYSTRAY[] = TEXT("-systemtray");
|
||||
const TCHAR FLAG_LOADINGTIME[] = TEXT("-loadingTime");
|
||||
const TCHAR FLAG_HELP[] = TEXT("--help");
|
||||
|
||||
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
||||
\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [fullFilePathName]\r\
|
||||
notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [fullFilePathName]\r\
|
||||
\r\
|
||||
--help : This help message\r\
|
||||
-multiInst : Launch another Notepad++ instance\r\
|
||||
|
@ -162,6 +163,7 @@ notepad++ [--help] [-multiInst] [-noPlugins] [-lLanguage] [-nLineNumber] [-cColu
|
|||
-notabbar : Launch Notepad++ without tabbar\r\
|
||||
-ro : Launch Notepad++ and make the file to open read only\r\
|
||||
-systemtray : Launch Notepad++ directly in system tray\r\
|
||||
-loadingTime : Display Notepad++ loading time\r\
|
||||
fullFilePathName : file name to open (absolute or relative path name)\r\
|
||||
");
|
||||
|
||||
|
@ -191,6 +193,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||
cmdLineParams._isReadOnly = isInList(FLAG_READONLY, params);
|
||||
cmdLineParams._isNoSession = isInList(FLAG_NOSESSION, params);
|
||||
cmdLineParams._isPreLaunch = isInList(FLAG_SYSTRAY, params);
|
||||
cmdLineParams._showLoadingTime = isInList(FLAG_LOADINGTIME, params);
|
||||
cmdLineParams._langType = getLangTypeFromParam(params);
|
||||
cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);
|
||||
cmdLineParams._column2go = getNumberFromParam('c', params, isParamePresent);
|
||||
|
@ -313,7 +316,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
|
|||
doUpdate = false;
|
||||
}
|
||||
|
||||
// Vista/Win7 UAC de mes couilles!!!
|
||||
// Vista/Win7 UAC issue
|
||||
bool isVista = (curWinVer >= WV_VISTA);
|
||||
|
||||
if (!winSupported)
|
||||
|
|
Loading…
Reference in New Issue