mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 13:54:54 +02:00
Add Insert Date Time commands
Add Insert Date Time commands for both short & long format. Fix #497, fix #2821, fix #8184, fix #8302
This commit is contained in:
parent
0c16f87a18
commit
0733e6f241
@ -428,6 +428,11 @@ BEGIN
|
|||||||
MENUITEM "&Select All", IDM_EDIT_SELECTALL
|
MENUITEM "&Select All", IDM_EDIT_SELECTALL
|
||||||
MENUITEM "Begin/End &Select", IDM_EDIT_BEGINENDSELECT
|
MENUITEM "Begin/End &Select", IDM_EDIT_BEGINENDSELECT
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
|
POPUP "Insert"
|
||||||
|
BEGIN
|
||||||
|
MENUITEM "Date Time (short)", IDM_EDIT_INSERT_DATETIME_SHORT
|
||||||
|
MENUITEM "Date Time (long)", IDM_EDIT_INSERT_DATETIME_LONG
|
||||||
|
END
|
||||||
POPUP "Cop&y to Clipboard"
|
POPUP "Cop&y to Clipboard"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "Current Full File path to Clipboard", IDM_EDIT_FULLPATHTOCLIP
|
MENUITEM "Current Full File path to Clipboard", IDM_EDIT_FULLPATHTOCLIP
|
||||||
|
@ -66,6 +66,28 @@ void Notepad_plus::command(int id)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDM_EDIT_INSERT_DATETIME_SHORT:
|
||||||
|
case IDM_EDIT_INSERT_DATETIME_LONG:
|
||||||
|
{
|
||||||
|
SYSTEMTIME st = { 0 };
|
||||||
|
::GetLocalTime(&st);
|
||||||
|
|
||||||
|
wchar_t dateStr[128] = { 0 };
|
||||||
|
wchar_t timeStr[128] = { 0 };
|
||||||
|
|
||||||
|
int dateFlag = (id == IDM_EDIT_INSERT_DATETIME_SHORT) ? DATE_SHORTDATE : DATE_LONGDATE;
|
||||||
|
GetDateFormatEx(LOCALE_NAME_USER_DEFAULT, dateFlag, &st, NULL, dateStr, sizeof(dateStr) / sizeof(dateStr[0]), NULL);
|
||||||
|
GetTimeFormatEx(LOCALE_NAME_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, timeStr, sizeof(timeStr) / sizeof(timeStr[0]));
|
||||||
|
|
||||||
|
generic_string dateTimeStr = timeStr;
|
||||||
|
dateTimeStr += TEXT(" ");
|
||||||
|
dateTimeStr += dateStr;
|
||||||
|
|
||||||
|
_pEditView->execute(SCI_REPLACESEL, 0, reinterpret_cast<LPARAM>(""));
|
||||||
|
_pEditView->addGenericText(dateTimeStr.c_str());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDM_FILE_OPEN:
|
case IDM_FILE_OPEN:
|
||||||
{
|
{
|
||||||
fileOpen();
|
fileOpen();
|
||||||
|
@ -44,16 +44,17 @@ MenuPosition menuPos[] = {
|
|||||||
{ 0, 13, -1, "file-closeMore" },
|
{ 0, 13, -1, "file-closeMore" },
|
||||||
{ 0, 22, -1, "file-recentFiles" },
|
{ 0, 22, -1, "file-recentFiles" },
|
||||||
|
|
||||||
{ 1, 10, -1, "edit-copyToClipboard" },
|
{ 1, 10, -1, "edit-insert" },
|
||||||
{ 1, 11, -1, "edit-indent" },
|
{ 1, 11, -1, "edit-copyToClipboard" },
|
||||||
{ 1, 12, -1, "edit-convertCaseTo" },
|
{ 1, 12, -1, "edit-indent" },
|
||||||
{ 1, 13, -1, "edit-lineOperations" },
|
{ 1, 13, -1, "edit-convertCaseTo" },
|
||||||
{ 1, 14, -1, "edit-comment" },
|
{ 1, 14, -1, "edit-lineOperations" },
|
||||||
{ 1, 15, -1, "edit-autoCompletion" },
|
{ 1, 15, -1, "edit-comment" },
|
||||||
{ 1, 16, -1, "edit-eolConversion" },
|
{ 1, 16, -1, "edit-autoCompletion" },
|
||||||
{ 1, 17, -1, "edit-blankOperations" },
|
{ 1, 17, -1, "edit-eolConversion" },
|
||||||
{ 1, 18, -1, "edit-pasteSpecial" },
|
{ 1, 18, -1, "edit-blankOperations" },
|
||||||
{ 1, 19, -1, "edit-onSelection" },
|
{ 1, 19, -1, "edit-pasteSpecial" },
|
||||||
|
{ 1, 20, -1, "edit-onSelection" },
|
||||||
|
|
||||||
{ 2, 18, -1, "search-markAll" },
|
{ 2, 18, -1, "search-markAll" },
|
||||||
{ 2, 19, -1, "search-markOne" },
|
{ 2, 19, -1, "search-markOne" },
|
||||||
|
@ -165,6 +165,8 @@
|
|||||||
#define IDM_EDIT_SORTLINES_LEXICO_CASE_INSENS_DESCENDING (IDM_EDIT + 81)
|
#define IDM_EDIT_SORTLINES_LEXICO_CASE_INSENS_DESCENDING (IDM_EDIT + 81)
|
||||||
#define IDM_EDIT_COPY_LINK (IDM_EDIT + 82)
|
#define IDM_EDIT_COPY_LINK (IDM_EDIT + 82)
|
||||||
#define IDM_EDIT_SORTLINES_REVERSE_ORDER (IDM_EDIT + 83)
|
#define IDM_EDIT_SORTLINES_REVERSE_ORDER (IDM_EDIT + 83)
|
||||||
|
#define IDM_EDIT_INSERT_DATETIME_SHORT (IDM_EDIT + 84)
|
||||||
|
#define IDM_EDIT_INSERT_DATETIME_LONG (IDM_EDIT + 85)
|
||||||
|
|
||||||
#define IDM_EDIT_AUTOCOMPLETE (50000 + 0)
|
#define IDM_EDIT_AUTOCOMPLETE (50000 + 0)
|
||||||
#define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1)
|
#define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user