-
Notifications
You must be signed in to change notification settings - Fork 2
/
event_map.c
83 lines (71 loc) · 2.93 KB
/
event_map.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*
This file is part of NppEventExec
Copyright (C) 2016-2017 Mihail Ivanchev
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "base.h"
#include "event_map.h"
#include "Notepad_plus_msgs.h"
#define ENTRY(c, m) { NPPN_ ## c, L"NPPN_" STRW(c) }
const EventMapEntry eventMap[] =
{
ENTRY(READY, L"Notepad++ was fully initialized"),
ENTRY(FILEBEFORECLOSE, L"A file is about to be closed"),
ENTRY(FILECLOSED, L"A file was just closed"),
ENTRY(FILEBEFOREOPEN, L"A file is about to be opened"),
ENTRY(FILEOPENED, L"A file was just opened"),
ENTRY(FILEBEFORESAVE, L"A file is about to be saved"),
ENTRY(FILESAVED, L"A file was just saved"),
ENTRY(FILEBEFORELOAD, L"A file is about to be loaded"),
ENTRY(FILELOADFAILED, L"A file failed to load"),
ENTRY(FILEBEFOREDELETE, L"A file is about to be deleted"),
ENTRY(FILEDELETEFAILED, L"The deletion of a file failed"),
ENTRY(FILEDELETED, L"A file is about to be deleted"),
ENTRY(FILEBEFORERENAME, L"A file is about to be renamed"),
ENTRY(FILERENAMECANCEL, L"The renaming of a file was canceled"),
ENTRY(FILERENAMED, L"A file was renamed"),
ENTRY(BEFORESHUTDOWN, L"Notepad++ is about to shutdown"),
ENTRY(CANCELSHUTDOWN, L"Notepad++'s shutdown was canceled"),
ENTRY(SHUTDOWN, L"Notepad++ is shutting down"),
ENTRY(BUFFERACTIVATED, L"A buffer was just activated"),
ENTRY(LANGCHANGED, L"A document's language was changed"),
ENTRY(WORDSTYLESUPDATED,
L"A change was initiated using the word style dialog"),
ENTRY(SHORTCUTREMAPPED, L"A command shortcut was remapped"),
ENTRY(READONLYCHANGED, L"A read-only status was changed"),
ENTRY(DOCORDERCHANGED, L"The document order was changed"),
ENTRY(SNAPSHOTDIRTYFILELOADED, L"An unsaved file was restored on startup"),
};
const size_t eventMapSize = BUFLEN(eventMap);
int getEventMapEntryIndex(unsigned int event, size_t *index)
{
size_t ii;
for (ii = 0; ii < eventMapSize; ii++)
{
if (eventMap[ii].event == event)
{
*index = ii;
return 1;
}
}
return 0;
}
const EventMapEntry* getEventMapEntry(unsigned int event)
{
size_t ii;
for (ii = 0; ii < eventMapSize; ii++)
{
if (eventMap[ii].event == event)
return &eventMap[ii];
}
return NULL;
}