/NppPlugin/NppSync.dpr
Pascal | 83 lines | 60 code | 13 blank | 10 comment | 0 complexity | c7744f575cd60e09bd80ba44f83c31ed MD5 | raw file
1library NppSync; 2 3{$R 'Resources.res' 'Resources.rc'} 4 5 6uses 7 Windows, 8 Messages, 9 NppPluginInterface, 10 NppSyncMain in 'NppSyncMain.pas', 11 NppSyncServer in 'NppSyncServer.pas', 12 NppPluginUtils in 'NppPluginUtils.pas'; 13 14{ Gives notepad++ data to the plugin. } 15procedure setInfo(aNppData: TNppData); cdecl; 16begin 17 nppData := aNppData; 18 PluginInitialization; 19end; 20 21{ Returns plugin name to notepad++. } 22function getName: PChar; cdecl; 23begin 24 Result := NPP_PLUGIN_NAME; 25end; 26 27{ Returns function definitions array pointer to notepadd++. } 28function getFuncsArray(aFuncCount: pinteger): PNppPluginCommandShortcut; cdecl; 29begin 30 aFuncCount^ := NPP_PLUGIN_FUNCTION_COUNT; 31 Result := @pluginCommands; 32end; 33 34{ Receives Scintilla notifications from notepad++. } 35procedure beNotified(aNotifyCode: PSCNotification); cdecl; 36begin 37 case aNotifyCode.nmhdr.code of 38 NPPN_READY: 39 StartServer; 40 NPPN_SHUTDOWN: 41 StopServer; 42 end; 43end; 44 45{ Plugin msg proc. } 46function messageProc(aMsg: UINT; aWParam: WPARAM; aLParam: LPARAM): LRESULT; cdecl; 47begin 48 Result := 0; 49end; 50 51{ Is plugin Unicode. } 52function isUnicode: BOOL; cdecl; 53begin 54 Result := {$IFDEF UNICODE}True{$ELSE}False{$ENDIF}; 55end; 56 57{ Entry procedure. } 58procedure EntryProc(aEntryCode: integer); 59begin 60 case aEntryCode of 61 DLL_PROCESS_ATTACH: 62 PluginInitialization; 63 DLL_PROCESS_DETACH: 64 PluginFinalization; 65 end; 66end; 67 68exports 69 setInfo name 'setInfo', 70 getName name 'getName', 71 getFuncsArray name 'getFuncsArray', 72 beNotified name 'beNotified', 73 messageProc name 'messageProc', 74 isUnicode name 'isUnicode'; 75 76begin 77{$IFDEF DEBUG} 78 ReportMemoryLeaksOnShutdown := True; 79{$ENDIF} 80 DllProc := @EntryProc; 81 EntryProc(DLL_PROCESS_ATTACH); 82 83end.