[NEW_FEATURE] Add NPPM_ACTIVATEDOCMENU message.

Fix NPPN_SHUTDOWN notification bug.
Fix Russian display problem in the shortcut mapper.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@63 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2007-10-25 00:25:26 +00:00
parent d24b0372ad
commit 249b9a79d8
5 changed files with 66 additions and 17 deletions

View File

@ -170,6 +170,9 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
// in the beginning of this file then use the command symbols defined in "menuCmdID.h" file
// to access all the Notepad++ menu command items
#define NPPM_ACTIVATEDOCMENU (NPPMSG + 49)
//void NPPM_ACTIVATEDOCMENU(int view, int index2Activate)
#define RUNCOMMAND_USER (WM_USER + 3000)
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
#define NPPM_GETCURRENTDIRECTORY (RUNCOMMAND_USER + CURRENT_DIRECTORY)
@ -232,8 +235,8 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
//scnNotification->nmhdr.idFrom = 0;
#define NPPN_SHOUTDOWN (NPPN_FIRST + 9) // To notify plugins that Notepad++ is about to be shutdowned.
//scnNotification->nmhdr.code = NPPN_SHOUTDOWN;
#define NPPN_SHUTDOWN (NPPN_FIRST + 9) // To notify plugins that Notepad++ is about to be shutdowned.
//scnNotification->nmhdr.code = NPPN_SHUTDOWN;
//scnNotification->nmhdr.hwndFrom = hwndNpp;
//scnNotification->nmhdr.idFrom = 0;

View File

@ -492,6 +492,9 @@ bool Notepad_plus::doOpen(const char *fileName, bool isReadOnly)
(_pEditView->getCurrentBuffer()).determinateFormat(isNotEmpty?UnicodeConvertor.getNewBuf():(char *)(""));
_pEditView->execute(SCI_SETEOLMODE, _pEditView->getCurrentBuffer().getFormat());
// detect if it's a binary file (non ascii file)
//(_pEditView->getCurrentBuffer()).detectBin(isNotEmpty?UnicodeConvertor.getNewBuf():(char *)(""));
UniMode unicodeMode = static_cast<UniMode>(UnicodeConvertor.getEncoding());
(_pEditView->getCurrentBuffer()).setUnicodeMode(unicodeMode);
@ -2335,6 +2338,7 @@ void Notepad_plus::command(int id)
{
int eolMode = int(_pEditView->execute(SCI_GETEOLMODE));
_pEditView->execute(WM_PASTE);
//if (!(_pEditView->getCurrentBuffer()).isBin())
_pEditView->execute(SCI_CONVERTEOLS, eolMode);
}
break;
@ -6386,7 +6390,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case NPPM_ENCODESCI:
{
/* convert */
// convert
Utf8_16_Read UnicodeConvertor;
UINT length = 0;
char* buffer = NULL;
@ -6429,7 +6433,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return um;
}
/*
case NPPM_ACTIVATEDOC :
{
int whichView = ((wParam != MAIN_VIEW) && (wParam != SUB_VIEW))?getCurrentView():wParam;
@ -6441,6 +6445,30 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return TRUE;
}
*/ case NPPM_ACTIVATEDOC :
case NPPM_ACTIVATEDOCMENU:
{
// similar to NPPM_ACTIVEDOC
int whichView = ((wParam != MAIN_VIEW) && (wParam != SUB_VIEW))?getCurrentView():wParam;
int index = lParam;
switchEditViewTo(whichView);
activateDoc(index);
if (Message == NPPM_ACTIVATEDOCMENU)
{
// open here tab menu
NMHDR nmhdr;
nmhdr.code = NM_RCLICK;
nmhdr.hwndFrom = (whichView == MAIN_VIEW)?_mainDocTab.getHSelf():_subDocTab.getHSelf();
nmhdr.idFrom = ::GetDlgCtrlID(nmhdr.hwndFrom);
::SendMessage(_hSelf, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr);
}
return TRUE;
}
case WM_ISCURRENTMACRORECORDED :
return (!_macro.empty() && !_recordingMacro);
@ -6764,12 +6792,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case WM_QUERYENDSESSION:
case WM_CLOSE:
{
SCNotification scnN;
scnN.nmhdr.code = NPPN_SHOUTDOWN;
scnN.nmhdr.hwndFrom = _hSelf;
scnN.nmhdr.idFrom = 0;
_pluginsManager.notify(&scnN);
if (_isfullScreen)
fullScreenToggle();
@ -6784,6 +6806,12 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
if (fileCloseAll())
{
SCNotification scnN;
scnN.nmhdr.code = NPPN_SHUTDOWN;
scnN.nmhdr.hwndFrom = _hSelf;
scnN.nmhdr.idFrom = 0;
_pluginsManager.notify(&scnN);
_lastRecentFileList.saveLRFL();
saveScintillaParams(SCIV_PRIMARY);

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.4.1"
#define VERSION_VALUE "4.4.1\0"
#define VERSION_DIGITALVALUE 4, 4, 1, 0
#define NOTEPAD_PLUS_VERSION "Notepad++ v4.5"
#define VERSION_VALUE "4.5\0"
#define VERSION_DIGITALVALUE 4, 5, 0, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_DIGITALVALUE

View File

@ -106,7 +106,7 @@ public :
Buffer(const Buffer & buf) : _isDirty(buf._isDirty), _doc(buf._doc), _lang(buf._lang),
_timeStamp(buf._timeStamp), _isReadOnly(buf._isReadOnly), _isSetReadOnly(buf._isSetReadOnly), _pos(buf._pos),
_format(buf._format),_unicodeMode(buf._unicodeMode), _foldState(buf._foldState), _recentTag(buf._recentTag)
_format(buf._format),_unicodeMode(buf._unicodeMode), _foldState(buf._foldState), _recentTag(buf._recentTag)/*, _isBinary(false)*/
{
strcpy(_fullPathName, buf._fullPathName);
strcpy(_userLangExt, buf._userLangExt);
@ -252,7 +252,22 @@ public :
}
_format = WIN_FORMAT;
};
/*
void detectBin(char *data) {
size_t len = strlen(data);
const size_t lenMax = 2048;
size_t size2Detect = (len > lenMax)?lenMax:len;
for (size_t i = 0 ; i < size2Detect ; i++)
{
if (isNotPrintableChar(data[i]))
{
_isBinary = true;
break;
}
}
};
*/
formatType getFormat() const {
return _format;
};
@ -303,6 +318,8 @@ public :
_pos = pos;
};
//bool isBin() const {return _isBinary;};
private :
bool _isDirty;
Document _doc;
@ -319,6 +336,7 @@ private :
std::vector<HeaderLineState> _foldState;
long _recentTag;
static long _recentTagCtr;
//bool _isBinary;
Lang * getCurrentLang() const {
int i = 0 ;

View File

@ -3054,14 +3054,14 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
hfontbody=CreateFont(16,0,0, 0,
100,
FALSE,
FALSE,FALSE,ANSI_CHARSET,
FALSE,FALSE,DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
0,
0 ,
"MS Shell Dlg");
hfontheader=CreateFont(18,0,0, 0,FW_HEAVY,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,0,0,"MS Shell Dlg");
hfonttitle=CreateFont(20,0,0, 0,FW_HEAVY,FALSE,FALSE,FALSE,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,0,0,"MS Shell Dlg");
hfontheader=CreateFont(18,0,0, 0,FW_HEAVY,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,0,0,"MS Shell Dlg");
hfonttitle=CreateFont(20,0,0, 0,FW_HEAVY,FALSE,FALSE,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,0,0,"MS Shell Dlg");
}