📄 ft.dpr
字号:
library Ft;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes,
Forms,
windows,
Controls,
uIHintInf,
uDllfrmList,
Dialogs,
Variants,
uSecPlugInf,
uTxtfrm in 'uTxtfrm.pas' {TxtFrm};
{$R *.res}
var
OldApp:TApplication;
OldScr:TScreen;
OldHint:THintWindowClass;
OldDllfrmList:TDllfrmList;
procedure LibraryProc(Reason: Integer);
begin
if Reason = DLL_PROCESS_DETACH then
begin
Screen:=OldScr;
Application:=OldApp;
HintWindowClass:=OldHint;
DllfrmList:=OldDllfrmList;
end;
end;
procedure ShowTxtfrm(OprList:IOprList;FoldersID:integer;FormStyle:TFormStyle);stdcall;
var
frm:TTxtFrm;
i,index:integer;
begin
Application:=OprList.Application;
Screen:=OprList.Screen;
DllfrmList:=OprList.DllfrmList;
HintWindowClass:=OprList.HintWindow;
index:=-1;
if FormStyle<>fsNormal then
begin
for i:=0 to DllfrmList.DllTxt.Count-1 do
if TTxtFrm(DllfrmList.DllTxt[i]).ID=FoldersID then
begin
index:=i;
break;
end;
end;
if index=-1 then
begin
frm:=TTxtFrm.Create(Application);
frm.FormStyle:=FormStyle;
frm.ID:=FoldersID;
frm.DllType:=atext;
if FormStyle=fsMDIChild then
DllfrmList.DllTxt.Add(frm);
frm.OprList:=OprList;
frm.InitData;
end
else
begin
frm:=TTxtfrm(DllfrmList.DllTxt[index]);
frm.Show;
end;
frm.AfterInitData;
end;
procedure CopyText(frm:TForm);stdcall;
begin
if TTxtFrm(frm).RichEdit.Focused then
TTxtFrm(frm).RichEdit.CopyDef;
end;
procedure CutText(frm:TForm);stdcall
begin
if TTxtFrm(frm).RichEdit.Focused then
TTxtFrm(frm).RichEdit.CutDef;
end;
procedure PasteText(frm:TForm);stdcall;
begin
if TTxtFrm(frm).RichEdit.Focused then
TTxtFrm(frm).RichEdit.Paste;
end;
procedure SaveText(frm:TForm);stdcall;
begin
TTxtFrm(frm).SaveFile;
end;
procedure SaveAsText(frm:TForm);stdcall;
begin
TTxtFrm(frm).SaveAsFile;
end;
procedure InsAccessories(frm:TForm);stdcall;
begin
TTxtFrm(frm).InsAccessories;
end;
procedure DelAccessories(frm:TForm);stdcall;
begin
TTxtFrm(frm).DelAccessories;
end;
procedure InsPic(frm:TForm);stdcall;
begin
TTxtFrm(frm).InsPic;
end;
procedure InsSymbol(frm:TForm);stdcall;
begin
TTxtFrm(frm).InsSymbol;
end;
procedure SetAlignmentLeft(frm:TForm);stdcall;
begin
TTxtFrm(frm).SetAlignmentLeft;
end;
procedure SetAlignmentCenter(frm:TForm);stdcall;
begin
TTxtFrm(frm).SetAlignmentCenter;
end;
procedure SetAlignmentRight(frm:TForm);stdcall;
begin
TTxtFrm(frm).SetAlignmentRight;
end;
procedure SelectAll(frm:TForm);stdcall;
begin
TTxtFrm(frm).SelectAll;
end;
procedure Undo(frm:TForm);stdcall;
begin
TTxtfrm(frm).Undo;
end;
procedure Redo(frm:TForm);stdcall;
begin
TTxtfrm(frm).Redo;
end;
procedure DeleteSelection(frm:TForm);stdcall;
begin
TTxtfrm(frm).DeleteSelection;
end;
procedure InsertBreak(frm:TForm);stdcall;
begin
TTxtfrm(frm).InsertBreak;
end;
procedure InsertFile(frm:TForm);stdcall;
begin
TTxtfrm(frm).InsertFile;
end;
procedure SearchText(frm:TForm);stdcall;
begin
TTxtfrm(frm).Search;
end;
procedure SearchTextNext(frm:TForm);stdcall;
begin
TTxtfrm(frm).SearchNext;
end;
procedure Replace(frm:TForm);stdcall;
begin
TTxtfrm(frm).Replace;
end;
procedure Preview(frm:TForm);stdcall;
begin
TTxtfrm(frm).Preview;
end;
procedure Print(frm:TForm);stdcall;
begin
TTxtfrm(frm).Print;
end;
procedure PrintDefault(frm:TForm);stdcall;
begin
TTxtfrm(frm).PrintDefault;
end;
procedure PageSetup(frm:TForm);stdcall;
begin
TTxtfrm(frm).PageSetup;
end;
procedure SetReadOnly(frm:TForm);stdcall;
begin
TTxtfrm(frm).SetReadOnly;
end;
procedure ExportFile(frm:TForm);stdcall;
begin
TTxtfrm(frm).ExportFile;
end;
procedure InsertTable(frm:TForm);stdcall;
begin
TTxtfrm(frm).InsertTable;
end;
procedure MergeTable(frm:TForm);stdcall;
begin
TTxtfrm(frm).MergeTable;
end;
procedure SplitTable(frm:TForm);stdcall;
begin
TTxtfrm(frm).SplitTable;
end;
procedure InsHyperlink(frm:TForm);stdcall;
begin
TTxtfrm(frm).InsHyperlink;
end;
procedure ExportDBFile(frm:TForm);stdcall;
begin
TTxtfrm(frm).ExportDBFile;
end;
procedure ImportDBFile(frm:TForm);stdcall;
begin
TTxtfrm(frm).ImportDBFile;
end;
procedure CreatePlugBtn(const AFrm:TForm;const ASecPlug:ISecPlug);stdcall;
var
FFrm:TTxtfrm;
begin
FFrm:=TTxtfrm(AFrm);
FFrm.CreatePlugBtn(ASecPlug);
end;
procedure DeletePlugBtn(const AFrm:TForm;const AName:widestring);stdcall;
var
FFrm:TTxtFrm;
begin
FFrm:=TTxtFrm(AFrm);
FFrm.DeletePlugBtn(AName);
end;
procedure Refreshfrm(AfrmType:integer;ACaption:Pchar;UpDateCaption:Boolean;index,ParentIndex:integer);stdcall;//有多余的参数,是为了也list.dll里的Refreshfrm对应
var
i:integer;
begin
for i:=0 to DllfrmList.DllTxt.Count-1 do
begin
if (TTxtfrm(DllfrmList.DllTxt.Items[i]).ID=AfrmType)then
begin
if UpDateCaption
and (index=TTxtfrm(DllfrmList.DllTxt.Items[i]).ID) then
begin
TTxtfrm(DllfrmList.DllTxt.Items[i]).Caption:=strpas(ACaption);
end;
break;
end;
end;
end;
procedure Closefrm(IDs:array of integer);stdcall;
var
i,j:integer;
begin
for i:=low(IDs) to high(IDs) do
for j:=DllfrmList.DllTxt.Count-1 downto 0 do
begin
if TTxtfrm(DllfrmList.DllTxt.Items[j]).ID=IDs[i] then
begin
TTxtfrm(DllfrmList.DllTxt.Items[j]).OnCloseQuery:=nil;
TTxtfrm(DllfrmList.DllTxt.Items[j]).Close;
end;
end;
end;
exports
ShowTxtfrm,
CopyText,
CutText,
PasteText,
SaveText,
SaveAsText,
InsPic,
InsSymbol,
InsAccessories,
DelAccessories,
SetAlignmentLeft,
SetAlignmentCenter,
SetAlignmentRight,
SelectAll,
Undo,
Redo,
DeleteSelection,
InsertBreak,
InsertFile,
SearchText,
SearchTextNext,
Replace,
Preview,
Print,
PrintDefault,
PageSetup,
SetReadOnly,
ExportFile,
InsertTable,
MergeTable,
SplitTable,
InsHyperlink,
ExportDBFile,
ImportDBFile,
Refreshfrm,
Closefrm,
CreatePlugBtn,
DeletePlugBtn;
begin
OldApp:=Application;
OldScr:=Screen;
OldHint:=HintWindowClass;
OldDllfrmList:=DllfrmList;
DLLProc:=@LibraryProc;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -