|
|
unit u_op_seae_difftd;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, bsSkinCtrls, BusinessSkinForm, ExtCtrls, StdCtrls, ComCtrls,
|
|
|
DBCtrls,DB;
|
|
|
|
|
|
type
|
|
|
Tfrm_op_seae_difftd = class(TForm)
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
Splitter1: TSplitter;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
bsSkinPanel4: TbsSkinPanel;
|
|
|
chgafter: TDBRichEdit;
|
|
|
bsSkinPanel5: TbsSkinPanel;
|
|
|
chgbefore: TDBRichEdit;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
procedure setdifcolor ;
|
|
|
function replace(str,s1,s2:string):string;
|
|
|
Function After(Src,S:string ) : string ;
|
|
|
Function Before(Src,S:string):string ;
|
|
|
Function middle( Src,S1,S2:string ) : string ;
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
procedure showchgtd(ds1,ds2:TDataSource;fl1:string) ;
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_op_seae_difftd: Tfrm_op_seae_difftd;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
uses u_main ;
|
|
|
|
|
|
procedure Tfrm_op_seae_difftd.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close ;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_difftd.setdifcolor;
|
|
|
var i,j,count1,count2,min:integer ;
|
|
|
wordat:integer ;
|
|
|
paramstr1,paramstr2:Tstringlist ;
|
|
|
tmpstr1,tmpstr2:string ;
|
|
|
tmp:string ;
|
|
|
begin
|
|
|
tmpstr1:=chgbefore.Text ;
|
|
|
tmpstr2:=chgafter.Text ;
|
|
|
if AnsiCompareStr(tmpstr1,tmpstr2)=0 then exit ;
|
|
|
try
|
|
|
paramstr1:=tstringlist.create ;
|
|
|
paramstr2:=tstringlist.Create ;
|
|
|
tmp:=Before(tmpstr1,#13#10) ;
|
|
|
while tmp<>'' do
|
|
|
begin
|
|
|
paramstr1.add(tmp);
|
|
|
tmpstr1:=after(tmpstr1,#13#10);
|
|
|
tmp:=Before(tmpstr1,#13#10) ;
|
|
|
end ;
|
|
|
if tmpstr1<>'' then paramstr1.add(tmpstr1);
|
|
|
tmp:=Before(tmpstr2,#13#10) ;
|
|
|
while tmp<>'' do
|
|
|
begin
|
|
|
paramstr2.add(tmp);
|
|
|
tmpstr2:=after(tmpstr2,#13#10);
|
|
|
tmp:=Before(tmpstr2,#13#10) ;
|
|
|
end ;
|
|
|
if tmpstr2<>'' then paramstr2.add(tmpstr2);
|
|
|
count1:=paramstr1.Count ;
|
|
|
count2:=paramstr2.Count ;
|
|
|
|
|
|
for i:=0 to count1-1 do
|
|
|
begin
|
|
|
tmp:=paramstr1[i] ;
|
|
|
wordat:=pos(tmp,chgafter.Text) ;
|
|
|
if wordat<=0 then
|
|
|
begin
|
|
|
wordat:=0 ;
|
|
|
for j:=0 to i-1 do wordat:=wordat+length(paramstr1[j]);
|
|
|
chgbefore.SelStart:=wordat ;
|
|
|
chgbefore.SelLength:=length(tmp)+1;
|
|
|
chgbefore.SelAttributes.Color:=clred ;
|
|
|
end ;
|
|
|
end ;
|
|
|
|
|
|
for i:=0 to count2-1 do
|
|
|
begin
|
|
|
tmp:=paramstr2[i] ;
|
|
|
wordat:=pos(tmp,chgbefore.Text) ;
|
|
|
if wordat<=0 then
|
|
|
begin
|
|
|
wordat:=0 ;
|
|
|
for j:=0 to i-1 do wordat:=wordat+length(paramstr2[j]);
|
|
|
chgafter.SelStart:=wordat ;
|
|
|
chgafter.SelLength:=length(tmp)+1;
|
|
|
chgafter.SelAttributes.Color:=clblue ;
|
|
|
end ;
|
|
|
end ;
|
|
|
|
|
|
finally
|
|
|
paramstr1.Free ;
|
|
|
paramstr2.Free ;
|
|
|
end ;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_op_seae_difftd.showchgtd(ds1, ds2: TDataSource; fl1: string);
|
|
|
begin
|
|
|
chgbefore.DataSource:=ds1 ;
|
|
|
chgbefore.DataField:=fl1 ;
|
|
|
chgafter.DataSource:=ds2 ;
|
|
|
chgafter.DataField:=fl1 ;
|
|
|
showmodal ;
|
|
|
end;
|
|
|
|
|
|
////////////////////////////////////////////////
|
|
|
Function Tfrm_op_seae_difftd.After(Src,S:string ) : string ;
|
|
|
Var F : Word ;
|
|
|
begin
|
|
|
F := POS (s,Src) ;
|
|
|
if F=0 then result:=''
|
|
|
else
|
|
|
result:= COPY(Src , F+1,length(Src)) ;
|
|
|
end ;
|
|
|
|
|
|
//<2F><>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
Function Tfrm_op_seae_difftd.Before(Src,S:string):string ;
|
|
|
Var F:Word ;
|
|
|
begin
|
|
|
F := POS (s,Src) ;
|
|
|
if F=0 then result:=''
|
|
|
else
|
|
|
result := COPY(Src,1,F-1) ;
|
|
|
end ;
|
|
|
|
|
|
Function Tfrm_op_seae_difftd.middle( Src,S1,S2:string ) : string ;
|
|
|
Var F1,F2:Word ;
|
|
|
begin
|
|
|
F1:= POS (s1,Src) ;
|
|
|
F2:= POS (s2,Src) ;
|
|
|
if F2<=0 then result:=Src else
|
|
|
result := COPY(Src,F1+1,F2-F1-1) ;
|
|
|
end ;
|
|
|
|
|
|
function Tfrm_op_seae_difftd.replace(str,s1,s2:string):string;
|
|
|
var
|
|
|
i:integer;
|
|
|
s,t:string;
|
|
|
begin
|
|
|
s:='';
|
|
|
t:=str;
|
|
|
repeat
|
|
|
i:=pos(lowercase(s1),lowercase(t));
|
|
|
if i>0 then begin
|
|
|
s:=s+Copy(t,1,i-1)+s2;
|
|
|
t:=Copy(t,i+Length(s1),MaxInt);
|
|
|
end else s:=s+t;
|
|
|
until i<=0;
|
|
|
result:=s;
|
|
|
end;
|
|
|
procedure Tfrm_op_seae_difftd.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
setdifcolor;
|
|
|
end;
|
|
|
|
|
|
end.
|