/NppPlugin/NppSync.dpr

https://github.com/vor0nwe/nppsync · Pascal · 83 lines · 60 code · 13 blank · 10 comment · 0 complexity · c7744f575cd60e09bd80ba44f83c31ed MD5 · raw file

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