You've already forked lazarus-ccr
initial checkin
new festures than in package: *langauge independent *removes notoc *removes page templates git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@95 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
724
applications/wikihelp/src/Utils.pas
Normal file
724
applications/wikihelp/src/Utils.pas
Normal file
@ -0,0 +1,724 @@
|
||||
UNIT Utils;
|
||||
|
||||
INTERFACE
|
||||
|
||||
{$H+}
|
||||
|
||||
uses Classes,SysUtils,Graphics,Forms,Process,Dialogs,Clipbrd,FileUtil,Translations
|
||||
{$IFDEF MSWINDOWS}
|
||||
,Registry,Windows
|
||||
{$ENDIF}
|
||||
;
|
||||
|
||||
{$IFNDEF FPC}
|
||||
CONST
|
||||
DirectorySeparator = '\';
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
TRoundToRange = -37..37;
|
||||
TProcessinfoTyp = (piOpen,piPrint);
|
||||
{$ifdef WINDOWS}
|
||||
PFNSHGetFolderPath = Function(Ahwnd: HWND; Csidl: Integer; Token: THandle; Flags: DWord; Path: PChar): HRESULT; stdcall;
|
||||
{$endif}
|
||||
|
||||
function ClearDir (Path: string): boolean;
|
||||
function RPos(const Substr: string; const S: string): Integer;
|
||||
FUNCTION IsNumeric(s: STRING): boolean;
|
||||
FUNCTION StrTimeToValue(val : string) : LongInt;
|
||||
procedure DrawText(Canvas : TCanvas;Rect : TRect;Str : string;CenterV : Boolean = False;CenterH : Boolean = False);
|
||||
function InstallExt(Extension, ExtDescription, FileDescription,OpenWith, ParamString: string; IconIndex: Integer = 0): Boolean;
|
||||
function SystemUserName : string;
|
||||
function HTTPEncode(const str : String) : string;
|
||||
function StripHTML(S: string): string;
|
||||
function ValidateFileName(old : string) : string;
|
||||
function ValidateFileDir(old : string) : string;
|
||||
function ValidateDate(D : string) : string;
|
||||
function GetTempPath : string;
|
||||
function GetConfigDir(app : string) : string;
|
||||
function GetGlobalConfigDir(app : string) : string;
|
||||
function SizeToText(size : Longint) : string;
|
||||
function GetMainIconHandle : Cardinal;
|
||||
function CanWriteToProgramDir : Boolean;
|
||||
function OpenBrowser(Site : string) : Boolean;
|
||||
function HexToBin(h: STRING): dword;
|
||||
procedure LoadLanguage(lang : string);
|
||||
function RoundTo(const AValue : extended ; const ADigit : TRoundToRange) : extended ;
|
||||
function TimeTotext(Seconds : Integer) : string;
|
||||
procedure ExecProcess(CommandLine : string;CurDir : string = '';Waitfor : Boolean = True);
|
||||
procedure ExecVisualProcess(CommandLine : string;CurDir : string = '';Waitfor : Boolean = True);
|
||||
function ExecProcessEx(CommandLine : string;CurDir : string = '') : string;
|
||||
function GetProcessforExtension(InfoTyp : TProcessinfoTyp;Extension : string) : string;
|
||||
function GetMimeTypeforExtension(Extension : string) : string;
|
||||
function GetSystemLang : string;
|
||||
|
||||
IMPLEMENTATION
|
||||
|
||||
function ExecProcessEx(CommandLine : string;CurDir : string = '') : string;
|
||||
const
|
||||
READ_BYTES = 2048;
|
||||
var
|
||||
process : TProcess;
|
||||
ms: tmemorystream;
|
||||
bytesread: integer;
|
||||
n: longint;
|
||||
tmps: tstringlist;
|
||||
err : string;
|
||||
begin
|
||||
BytesRead := 0;
|
||||
Process := TProcess.Create(nil);
|
||||
Process.Options := [poUsePipes];
|
||||
Process.ShowWindow := swoHide;
|
||||
Process.CommandLine := CommandLine;
|
||||
if CurDir <> '' then
|
||||
Process.CurrentDirectory := CurDir;
|
||||
BytesRead := 0;
|
||||
MS := TmemoryStream.create;
|
||||
try
|
||||
Process.Execute;
|
||||
while Process.Running do
|
||||
begin
|
||||
MS.SetSize(BytesRead+READ_BYTES);
|
||||
n := Process.OutPut.Read((MS.Memory+BytesRead)^,READ_BYTES);
|
||||
if n > 0 then
|
||||
inc(BytesRead,n)
|
||||
else
|
||||
sleep(50);
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
err := err+#13+e.Message;
|
||||
end;
|
||||
MS.SetSize(BytesRead+READ_BYTES);
|
||||
n := Process.OutPut.Read((MS.Memory+BytesRead)^,READ_BYTES);
|
||||
if n > 0 then
|
||||
inc(Bytesread,n);
|
||||
MS.SetSize(BytesRead);
|
||||
Process.Free;
|
||||
tmps := TStringList.Create;
|
||||
tmps.LoadFromStream(MS);
|
||||
Result := tmps.Text;
|
||||
tmps.Free;
|
||||
MS.Free;
|
||||
if err <> '' then
|
||||
Result := 'errors:'+err+#13+Result;
|
||||
end;
|
||||
|
||||
procedure ExecProcess(CommandLine : string;CurDir : string = '';Waitfor : Boolean = True);
|
||||
var
|
||||
{$IFDEF WINDOWS}
|
||||
SUInfo: TStartupInfo;
|
||||
ProcInfo: TProcessInformation;
|
||||
CmdLine: string;
|
||||
Res: Boolean;
|
||||
{$ELSE}
|
||||
process : TProcess;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF WINDOWS}
|
||||
FillChar(SUInfo, SizeOf(SUInfo), #0);
|
||||
with SUInfo do begin
|
||||
cb := SizeOf(SUInfo);
|
||||
dwFlags := STARTF_USESHOWWINDOW;
|
||||
wShowWindow := SW_HIDE
|
||||
end;
|
||||
Res := CreateProcess(NIL, PChar(CommandLine), NIL, NIL, FALSE,
|
||||
CREATE_NEW_CONSOLE or
|
||||
NORMAL_PRIORITY_CLASS, NIL,
|
||||
PChar(CurDir),
|
||||
SUInfo, ProcInfo);
|
||||
{ Wait for it to finish. }
|
||||
if Res and Waitfor then
|
||||
WaitForSingleObject(ProcInfo.hProcess, INFINITE);
|
||||
{$ELSE}
|
||||
Process := TProcess.Create(nil);
|
||||
if CurDir <> '' then
|
||||
Process.CurrentDirectory := CurDir;
|
||||
Process.CommandLine := CommandLine;
|
||||
if Waitfor then
|
||||
Process.Options := [poNewConsole{poNoConsole},poWaitOnExit]
|
||||
else
|
||||
Process.Options := [poNewConsole{poNoConsole}];
|
||||
// Process.ShowWindow := swoHide;
|
||||
Process.Execute;
|
||||
if Waitfor then Process.Free;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure ExecVisualProcess(CommandLine : string;CurDir : string = '';Waitfor : Boolean = True);
|
||||
var
|
||||
process : TProcess;
|
||||
begin
|
||||
Process := TProcess.Create(nil);
|
||||
if CurDir <> '' then
|
||||
Process.CurrentDirectory := CurDir;
|
||||
Process.CommandLine := CommandLine;
|
||||
if Waitfor then
|
||||
Process.Options := [poWaitOnExit]
|
||||
else
|
||||
Process.Options := [];
|
||||
Process.Execute;
|
||||
if Waitfor then Process.Free;
|
||||
end;
|
||||
|
||||
function TimeTotext(Seconds : Integer) : string;
|
||||
var
|
||||
tmp : Integer;
|
||||
begin
|
||||
if Seconds > 60*60 then
|
||||
begin
|
||||
Result := IntToStr(Trunc(Seconds/(60*60))) +' h';
|
||||
tmp := Seconds mod (60*60);
|
||||
Result := Result +' '+IntToStr(Trunc(tmp/(60))) +' m';
|
||||
tmp := Seconds mod 60;
|
||||
Result := Result +' '+IntToStr(tmp) +' s';
|
||||
end
|
||||
else if Seconds > 60 then
|
||||
begin
|
||||
Result := IntToStr(Trunc(Seconds/(60))) +' m';
|
||||
tmp := Seconds mod 60;
|
||||
Result := Result +' '+IntToStr(tmp) +' s';
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result := IntToStr(Seconds)+' s';
|
||||
end
|
||||
end;
|
||||
|
||||
function RoundTo(const AValue : extended ; const ADigit : TRoundToRange) : extended ;
|
||||
var X : extended ; i : integer ;
|
||||
begin
|
||||
X := 1.0 ;
|
||||
for i := 1 to Abs(ADigit) do X := X * 10 ;
|
||||
if ADigit<0 then
|
||||
Result := Round(AValue * X) / X
|
||||
else
|
||||
Result := Round(AValue / X) * X;
|
||||
end;
|
||||
|
||||
function HexToBin(h: STRING): dword;
|
||||
FUNCTION HexDigitToInt(c: Char): Integer;
|
||||
BEGIN
|
||||
IF (c >= '0') AND (c <= '9') THEN Result := Ord(c) - Ord('0')
|
||||
ELSE IF (c >= 'A') AND (c <= 'F') THEN Result := Ord(c) - Ord('A') + 10
|
||||
ELSE IF (c >= 'a') AND (c <= 'f') THEN Result := Ord(c) - Ord('a') + 10
|
||||
ELSE Result := -1;
|
||||
END;
|
||||
VAR
|
||||
buf: ARRAY[0..16] OF Byte;
|
||||
digit1: Integer;
|
||||
bytes: Integer;
|
||||
index: Integer;
|
||||
BEGIN
|
||||
bytes := 0;
|
||||
index := 0;
|
||||
result := 0;
|
||||
IF frac(length(h) / 2) = 0.5 THEN
|
||||
h := '0' + h;
|
||||
WHILE (bytes < 16) DO
|
||||
BEGIN
|
||||
if length(h) > index+1 then
|
||||
digit1 := HexDigitToInt(h[index + 1])
|
||||
else
|
||||
digit1 := -1;
|
||||
IF digit1 < 0 THEN
|
||||
break;
|
||||
buf[bytes] := (digit1 SHL 4) OR HexDigitToInt(h[index + 2]);
|
||||
Inc(index, 2);
|
||||
Inc(bytes);
|
||||
END;
|
||||
dec(bytes);
|
||||
FOR index := bytes DOWNTO 0 DO
|
||||
Result := Result + (buf[index] shl ((bytes-index)*8));
|
||||
END;
|
||||
|
||||
procedure LoadLanguage(lang: string);
|
||||
begin
|
||||
if FileExists(ProgramDirectory+'languages'+Directoryseparator+Lang+'.po') then
|
||||
TranslateUnitResourceStrings('uintfstrconsts',ProgramDirectory+'languages'+Directoryseparator+Lang+'.po');
|
||||
// TranslateResourcestrings(ProgramDirectory+'languages'+Directoryseparator+Lang+'.mo');
|
||||
end;
|
||||
|
||||
function GetProcessforExtension(InfoTyp : TProcessinfoTyp;Extension : string) : string;
|
||||
{$ifdef MSWINDOWS}
|
||||
var
|
||||
reg : TRegistry;
|
||||
ot : string;
|
||||
FileClass: string;
|
||||
chrResult: array[0..1023] of Char;
|
||||
wrdReturn: DWORD;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef WINDOWS}
|
||||
case InfoTyp of
|
||||
piOpen:ot := 'open';
|
||||
piPrint:ot := 'print';
|
||||
end;
|
||||
Result := '';
|
||||
Reg := TRegistry.Create(KEY_READ);
|
||||
Reg.RootKey := HKEY_CLASSES_ROOT;
|
||||
FileClass := '';
|
||||
if Reg.OpenKeyReadOnly(ExtractFileExt('.'+Extension)) then
|
||||
begin
|
||||
FileClass := Reg.ReadString('');
|
||||
Reg.CloseKey;
|
||||
end;
|
||||
if FileClass <> '' then begin
|
||||
if Reg.OpenKeyReadOnly(FileClass + '\Shell\'+ot+'\Command') then
|
||||
begin
|
||||
wrdReturn := ExpandEnvironmentStrings(PChar(StringReplace(Reg.ReadString(''),'%1','%s',[rfReplaceAll])), chrResult, 1024);
|
||||
if wrdReturn = 0 then
|
||||
Result := StringReplace(Reg.ReadString(''),'%1','%s',[rfReplaceAll])
|
||||
else
|
||||
Result := Trim(chrResult);
|
||||
Reg.CloseKey;
|
||||
end;
|
||||
end;
|
||||
Reg.Free;
|
||||
{$ELSE}
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function GetMimeTypeforExtension(Extension : string) : string;
|
||||
{$ifdef MSWINDOWS}
|
||||
var
|
||||
reg : TRegistry;
|
||||
{$endif}
|
||||
begin
|
||||
{$ifdef WINDOWS}
|
||||
Result := '';
|
||||
Reg := TRegistry.Create(KEY_READ);
|
||||
Reg.RootKey := HKEY_CLASSES_ROOT;
|
||||
if Reg.OpenKeyReadOnly(ExtractFileExt('.'+Extension)) then
|
||||
begin
|
||||
Result := Reg.ReadString('Content Type');
|
||||
Reg.CloseKey;
|
||||
end;
|
||||
Reg.Free;
|
||||
{$ELSE}
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function GetSystemLang: string;
|
||||
{$IFDEF WINDOWS}
|
||||
var
|
||||
Ident: Integer;
|
||||
MyLang: PChar;
|
||||
const
|
||||
Size: Integer = 250;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF WINDOWS}
|
||||
GetMem(MyLang, Size);
|
||||
Ident:=GetSystemDefaultLangID;
|
||||
VerLanguageName(Ident, MyLang, Size);
|
||||
Result:=StrPas(MyLang);
|
||||
FreeMem(MyLang);
|
||||
{$ELSE}
|
||||
Result := GetEnvironmentVariable('LANG');
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function OpenBrowser(Site : string) : Boolean;
|
||||
var
|
||||
cmd : string;
|
||||
proc : TProcess;
|
||||
begin
|
||||
cmd := GetProcessforExtension(piOpen,'html');
|
||||
{$ifndef WINDOWS}
|
||||
cmd := ExecProcessEx('gconftool-2 --get /desktop/gnome/url-handlers/http/command');
|
||||
if (cmd = '') or (pos('errors',cmd) > 0) then
|
||||
cmd := GetEnvironmentVariable('BROWSER');
|
||||
if (cmd = '') then
|
||||
cmd := 'kfmclient openURL %s';
|
||||
{$ENDIF}
|
||||
if cmd = '' then exit;
|
||||
proc := TProcess.Create(nil);
|
||||
proc.CommandLine := StringReplace(cmd,'%s',Site,[rfReplaceAll]);
|
||||
proc.Options := [poNewConsole];
|
||||
proc.Execute;
|
||||
while Proc.Running do
|
||||
Application.ProcessMessages;
|
||||
proc.free;
|
||||
end;
|
||||
|
||||
|
||||
function CanWriteToProgramDir : Boolean;
|
||||
var
|
||||
f : TextFile;
|
||||
begin
|
||||
AssignFile(f,ExtractFilePath(Application.Exename)+'writetest.tmp');
|
||||
try
|
||||
Rewrite(f);
|
||||
except
|
||||
Result := False;
|
||||
exit;
|
||||
end;
|
||||
CloseFile(f);
|
||||
SysUtils.DeleteFile(ExtractFilePath(Application.Exename)+'writetest.tmp');
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function SizeToText(size : Longint) : string;
|
||||
begin
|
||||
if size > 1024*1024*1024 then
|
||||
Result := FormatFloat('0.00',size/(1024*1024*1024))+' Gb'
|
||||
else if size > 1024*1024 then
|
||||
Result := FormatFloat('0.00',size/(1024*1024))+' Mb'
|
||||
else if size > 1024 then
|
||||
Result := FormatFloat('0.00',size/(1024))+' Kb'
|
||||
else
|
||||
Result := IntToStr(size)+' byte'
|
||||
end;
|
||||
|
||||
function GetMainIconHandle : Cardinal;
|
||||
begin
|
||||
{$ifdef MSWINDOWS}
|
||||
Result := LoadIcon(hInstance, 'MAINICON');
|
||||
{$else}
|
||||
Result := 0;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function GetConfigDir(app : string) : string;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
Result := copy(GetAppConfigDir(False),0,length(GetAppConfigDir(False))-length(ApplicationName))+app;
|
||||
{$ELSE}
|
||||
Result:=GetEnvironmentVariable('HOME');
|
||||
If (Result<>'') then
|
||||
Result:=IncludeTrailingPathDelimiter(Result)+'.'+app;
|
||||
{$ENDIF}
|
||||
Result := IncludeTrailingPathDelimiter(result);
|
||||
end;
|
||||
|
||||
function GetGlobalConfigDir(app : string) : string;
|
||||
{$IFDEF MSWINDOWS}
|
||||
const
|
||||
CSIDL_COMMON_APPDATA = $0023; // All Users\Application Data
|
||||
CSIDL_FLAG_CREATE = $8000; { (force creation of requested folder if it doesn't exist yet) }
|
||||
var
|
||||
Path: array [0..1024] of char;
|
||||
P : Pointer;
|
||||
SHGetFolderPath : PFNSHGetFolderPath = Nil;
|
||||
CFGDLLHandle : THandle = 0;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
CFGDLLHandle:=LoadLibrary('shell32.dll');
|
||||
if (CFGDLLHandle<>0) then
|
||||
begin
|
||||
P:=GetProcAddress(CFGDLLHandle,'SHGetFolderPathA');
|
||||
If (P=Nil) then
|
||||
begin
|
||||
FreeLibrary(CFGDLLHandle);
|
||||
CFGDllHandle:=0;
|
||||
end
|
||||
else
|
||||
SHGetFolderPath:=PFNSHGetFolderPath(P);
|
||||
end;
|
||||
If (P=Nil) then
|
||||
begin
|
||||
CFGDLLHandle:=LoadLibrary('shfolder.dll');
|
||||
if (CFGDLLHandle<>0) then
|
||||
begin
|
||||
P:=GetProcAddress(CFGDLLHandle,'SHGetFolderPathA');
|
||||
If (P=Nil) then
|
||||
begin
|
||||
FreeLibrary(CFGDLLHandle);
|
||||
CFGDllHandle:=0;
|
||||
end
|
||||
else
|
||||
ShGetFolderPath:=PFNSHGetFolderPath(P);
|
||||
end;
|
||||
end;
|
||||
Result := ExtractFilePath(Application.Exename);
|
||||
If (@ShGetFolderPath<>Nil) then
|
||||
if SHGetFolderPath(0,CSIDL_COMMON_APPDATA or CSIDL_FLAG_CREATE,0,0,@PATH[0])=S_OK then
|
||||
Result:=IncludeTrailingPathDelimiter(StrPas(@Path[0]))+app;
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
Result := IncludeTrailingPathDelimiter(result);
|
||||
end;
|
||||
|
||||
function GetTempPath : string;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
TD : PChar;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
GetMem(TD, 256);
|
||||
try
|
||||
FillChar(TD^, 256, 0);
|
||||
Windows.GetTempPath(256, TD);
|
||||
Result := TD;
|
||||
finally
|
||||
FreeMem(TD, 256);
|
||||
end;
|
||||
{$ELSE}
|
||||
Result := '/temp';
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function ValidateFileDir(old: string): string;
|
||||
begin
|
||||
Result := old;
|
||||
if DirectorySeparator <> '/' then
|
||||
Result := StringReplace(Result,'/','',[rfReplaceAll]);
|
||||
Result := StringReplace(Result,'@','',[rfReplaceAll]);
|
||||
Result := StringReplace(Result,';','',[rfReplaceAll]);
|
||||
end;
|
||||
|
||||
function ValidateDate(D : string) : string;
|
||||
begin
|
||||
if pos('.',D) > 0 then
|
||||
Result := StringReplace(D,'-','.',[rfReplaceAll]);
|
||||
if length(D) = 4 then
|
||||
Result := '01.01.'+D;
|
||||
end;
|
||||
|
||||
function ValidateFileName(old : string) : string;
|
||||
begin
|
||||
Result := StringReplace(old,'\','',[rfReplaceAll]);
|
||||
Result := StringReplace(Result,'/','',[rfReplaceAll]);
|
||||
Result := StringReplace(Result,'@','',[rfReplaceAll]);
|
||||
Result := StringReplace(Result,';','',[rfReplaceAll]);
|
||||
end;
|
||||
|
||||
function StripHTML(S: string): string;
|
||||
var
|
||||
TagBegin, TagEnd, TagLength: integer;
|
||||
begin
|
||||
TagBegin := Pos( '<', S); // search position of first <
|
||||
|
||||
while (TagBegin > 0) do begin // while there is a < in S
|
||||
TagEnd := Pos('>', S); // find the matching >
|
||||
TagLength := TagEnd - TagBegin + 1;
|
||||
Delete(S, TagBegin, TagLength); // delete the tag
|
||||
TagBegin:= Pos( '<', S); // search for next <
|
||||
end;
|
||||
|
||||
S := Stringreplace(S,' ',' ',[rfReplaceAll]);
|
||||
S := Stringreplace(S,'&','&',[rfReplaceAll]);
|
||||
S := Stringreplace(S,'<','<',[rfReplaceAll]);
|
||||
S := Stringreplace(S,'>','>',[rfReplaceAll]);
|
||||
S := Stringreplace(S,'"','"',[rfReplaceAll]);
|
||||
Result := S; // give the result
|
||||
end;
|
||||
|
||||
function HTTPEncode(const str : String) : string;
|
||||
const
|
||||
noconvert = ['A'..'Z','a'..'z','*','@','.','_','-','0'..'9','$','!','''','(',')'];
|
||||
hex2str : array[0..15] of char = '0123456789ABCDEF';
|
||||
var
|
||||
i : integer;
|
||||
c : char;
|
||||
begin
|
||||
Result := '';
|
||||
for i:=1 to length(str) do
|
||||
begin
|
||||
c:=str[i];
|
||||
if c in noconvert then
|
||||
Result:=Result+c
|
||||
else
|
||||
Result:=Result+'%'+hex2str[ord(c) shr 4]+hex2str[ord(c) and $f];
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
function SystemUserName : string;
|
||||
var userNameBuffer : string[255];
|
||||
sizeBuffer : DWord;
|
||||
begin
|
||||
SizeBuffer := 256;
|
||||
getUserName(@userNameBuffer+1, sizeBuffer);
|
||||
result := userNameBuffer;
|
||||
end;
|
||||
{$ELSIF LINUX}
|
||||
{$IFNDEF WINDOWS}
|
||||
function SystemUserName : string;
|
||||
begin
|
||||
Result := GetEnvironmentVariable('USERNAME');
|
||||
if Result = '' then
|
||||
Result := GetEnvironmentVariable('USER');
|
||||
end;
|
||||
{$ENDIF}
|
||||
{$ELSE}
|
||||
function SystemUserName : string;
|
||||
begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function InstallExt(Extension, ExtDescription, FileDescription,OpenWith, ParamString: string; IconIndex: Integer = 0): Boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
var
|
||||
Reg: TRegistry;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Result := False;
|
||||
if Extension <> '' then
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
if Extension[1] <> '.' then
|
||||
Extension := '.' + Extension;
|
||||
Reg := TRegistry.Create;
|
||||
try
|
||||
Reg.RootKey := HKEY_CLASSES_ROOT;
|
||||
if Reg.OpenKey(Extension, True) then
|
||||
begin
|
||||
Reg.WriteString('', ExtDescription);
|
||||
if Reg.OpenKey('\' + ExtDescription, True) then
|
||||
begin
|
||||
Reg.WriteString('', FileDescription);
|
||||
if Reg.OpenKey('DefaultIcon', True) then
|
||||
begin
|
||||
Reg.WriteString('', Format('%s,%d', [OpenWith, IconIndex]));
|
||||
if Reg.OpenKey('\' + ExtDescription + '\Shell\Open\Command', True) then
|
||||
begin
|
||||
Reg.WriteString('', Format('"%s" "%s"', [OpenWith, ParamString]));
|
||||
Result:=True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Reg.Free;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DrawText(Canvas : TCanvas;Rect : TRect;Str : string;CenterV : Boolean = False;CenterH : Boolean = False);
|
||||
var
|
||||
TextPosY,
|
||||
TextPosX: Integer;
|
||||
begin
|
||||
TextPosX := Rect.Left;
|
||||
if CenterH then
|
||||
TextPosX := TextPosX+((Rect.Right-Rect.Left-Canvas.TextWidth(Str)) div 2);
|
||||
TextPosY := Rect.Top;
|
||||
if CenterV then
|
||||
TextPosY := TextPosY+((Rect.Bottom-Rect.Top)-Canvas.TextHeight(Str)) div 2;
|
||||
Canvas.TextOut(TextPosX,TextPosY,Str);
|
||||
end;
|
||||
|
||||
FUNCTION StrTimeToValue(val : string) : LongInt;
|
||||
var
|
||||
i : Integer;
|
||||
un : string;
|
||||
begin
|
||||
//TODO:replace ',' with system delemiter
|
||||
un := '';
|
||||
FOR i := 1 TO length(val) DO
|
||||
IF NOT ((Char(Val[i]) IN ['0'..'9']) or (Char(Val[i]) = DecimalSeparator)) THEN
|
||||
begin
|
||||
un := trim(copy(Val,i,length(Val)));
|
||||
break;
|
||||
end;
|
||||
if copy(Val,0,i-1) = '' then
|
||||
begin
|
||||
Result := -1;
|
||||
exit;
|
||||
end;
|
||||
if (UpperCase(un) = 'MS') or (un = '') then
|
||||
Result := Round(StrToFloat(copy(Val,0,i-1)))
|
||||
else if UpperCase(un) = 'S' then
|
||||
Result := Round(1000*StrToFloat(copy(Val,0,i-1)))
|
||||
else if UpperCase(un) = 'M' then
|
||||
Result := Round(60*1000*StrToFloat(copy(Val,0,i-1)))
|
||||
else
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
FUNCTION IsNumeric(s: STRING): boolean;
|
||||
VAR
|
||||
i : integer;
|
||||
hassign: boolean;
|
||||
BEGIN
|
||||
// TODO:Replace ',' with Systemdelemiter
|
||||
// ge�ndert von schnullerbacke
|
||||
// DecimalSeparator auf . gesetzt falls ,
|
||||
// doppeltes Vorkommen von sign verhindert
|
||||
if DecimalSeparator = ',' then begin
|
||||
// replace DecimalSeparator wenn n�tig
|
||||
i:= Pos(',', s);
|
||||
s[i]:= '.';
|
||||
end;
|
||||
Result:= (Pos('.', s) > 0) and (length(s) > 0);
|
||||
if Result then begin
|
||||
// l�sche DecimalSeparator
|
||||
Delete(s, i, 1);
|
||||
hassign:= (Pos('-', s) > 0) or (Pos('+',s) > 0);
|
||||
if hassign then begin
|
||||
// l�sche Vorkommen eines signs
|
||||
i:= Pos('-', s);
|
||||
if i = 0 then i:= Pos('+', s);
|
||||
if i > 0 then Delete(s, i, 1);
|
||||
end;
|
||||
i:= 1;
|
||||
while (i <= length(s)) and Result do begin
|
||||
// nur noch Test auf Digit n�tig
|
||||
Result:= (Char(s[i]) IN ['0'..'9']);
|
||||
IF Result then inc(i);
|
||||
END; // of while (i <= length(s)) and Result do begin
|
||||
end; // of if Result then begin
|
||||
END;
|
||||
|
||||
function RPos(const Substr: string; const S: string): Integer;
|
||||
var
|
||||
SL, i : Integer;
|
||||
begin
|
||||
SL := Length(Substr);
|
||||
i := Length(S);
|
||||
if (Substr = '') or (S = '') or (SL > i) then begin
|
||||
Result := 0;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
while i >= SL do begin
|
||||
if S[i] = Substr[SL] then begin
|
||||
if Copy(S, i - SL + 1, SL) = Substr then begin
|
||||
Result := i - SL + 1;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
Dec(i);
|
||||
end;
|
||||
Result := i;
|
||||
end;
|
||||
|
||||
{ Make sure given file path is ended with backslash ("\") }
|
||||
{ Clears Directory: Removes all files and directories contained }
|
||||
function ClearDir (Path: string): boolean;
|
||||
var
|
||||
Res: integer;
|
||||
SRec: SysUtils.TSearchRec;
|
||||
begin
|
||||
Result := false;
|
||||
try
|
||||
if copy(path,length(path)-1,1) <> DirectorySeparator then
|
||||
Path := Path+DirectorySeparator;
|
||||
Res := FindFirst (Path + '*.*', faAnyFile, SRec);
|
||||
while Res = 0 do
|
||||
begin
|
||||
if (SRec.Attr = faDirectory) and (SRec.Name[1] <> '.') then
|
||||
begin
|
||||
ClearDir (Path + SRec.Name); { Clear before removing }
|
||||
if not RemoveDir (pchar(Path + SRec.Name)) then
|
||||
exit;
|
||||
end
|
||||
else
|
||||
SysUtils.DeleteFile(Path + SRec.Name);
|
||||
Res := FindNext(SRec);
|
||||
end;
|
||||
SysUtils.FindClose(SRec);
|
||||
Result := true;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
END.
|
||||
|
||||
|
22
applications/wikihelp/src/uappconsts.pas
Normal file
22
applications/wikihelp/src/uappconsts.pas
Normal file
@ -0,0 +1,22 @@
|
||||
unit uAppconsts;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
const
|
||||
vAppName = 'wikihelp';
|
||||
vRevision = 2;
|
||||
vVersion = 0.5;
|
||||
vProgramname = 'WikiHelp';
|
||||
vTimeOutYear = 0;
|
||||
vTimeOutMonth = 0;
|
||||
vTimeOutDay = 0;
|
||||
vCopyright = '2007 Christian Ulrich';
|
||||
vTracker_url = 'mantis.ullihome.de';
|
||||
vProject_id = 5;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
160
applications/wikihelp/src/umain.lfm
Normal file
160
applications/wikihelp/src/umain.lfm
Normal file
@ -0,0 +1,160 @@
|
||||
object fWikiHelp: TfWikiHelp
|
||||
Left = 324
|
||||
Height = 322
|
||||
Top = 221
|
||||
Width = 428
|
||||
HorzScrollBar.Page = 427
|
||||
VertScrollBar.Page = 321
|
||||
ActiveControl = eWikiPage
|
||||
Caption = 'WikiHelp'
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
object lWikiPage: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 8
|
||||
Width = 44
|
||||
Caption = 'WikiPage'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object lPageOffset: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 60
|
||||
Width = 58
|
||||
Caption = 'lPageOffset'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object eFoundPages: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 104
|
||||
Width = 66
|
||||
Caption = 'eFoundPages'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object lOutputDir: TLabel
|
||||
Left = 8
|
||||
Height = 14
|
||||
Top = 240
|
||||
Width = 51
|
||||
Caption = 'Output Dir'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object lLanguage: TLabel
|
||||
Left = 288
|
||||
Height = 14
|
||||
Top = 8
|
||||
Width = 48
|
||||
Caption = 'Language'
|
||||
Color = clNone
|
||||
ParentColor = False
|
||||
end
|
||||
object eWikiPage: TEdit
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 28
|
||||
Width = 268
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 0
|
||||
Text = 'http://www.ullihome.de/index.php/'
|
||||
end
|
||||
object ePageOffset: TEdit
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 76
|
||||
Width = 412
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 1
|
||||
end
|
||||
object lbFoundPages: TListBox
|
||||
Left = 8
|
||||
Height = 95
|
||||
Top = 120
|
||||
Width = 332
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
TabOrder = 2
|
||||
end
|
||||
object bSearch: TButton
|
||||
Left = 345
|
||||
Height = 25
|
||||
Top = 120
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Search'
|
||||
OnClick = bSearchClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object bCreate: TButton
|
||||
Left = 345
|
||||
Height = 25
|
||||
Top = 286
|
||||
Width = 75
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.InnerBorder = 4
|
||||
Caption = 'Create'
|
||||
OnClick = bCreateClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object pbProgress: TProgressBar
|
||||
Left = 8
|
||||
Height = 20
|
||||
Top = 287
|
||||
Width = 332
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
Max = 100
|
||||
end
|
||||
object eOutputDir: TDirectoryEdit
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 259
|
||||
Width = 332
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
ParentColor = False
|
||||
TabOrder = 5
|
||||
end
|
||||
object cbLanguage: TComboBox
|
||||
Left = 288
|
||||
Height = 21
|
||||
Top = 28
|
||||
Width = 132
|
||||
Anchors = [akTop, akRight]
|
||||
AutoCompleteText = [cbactEndOfLineComplete, cbactSearchAscending]
|
||||
Items.Strings = (
|
||||
'Special:Allpages'
|
||||
'Spezial:Allpages'
|
||||
)
|
||||
MaxLength = 0
|
||||
OnSelect = cbLanguageSelect
|
||||
TabOrder = 6
|
||||
end
|
||||
object cbAddLinkedPages: TCheckBox
|
||||
Left = 8
|
||||
Height = 13
|
||||
Top = 220
|
||||
Width = 103
|
||||
Caption = 'Add linked Pages'
|
||||
TabOrder = 7
|
||||
end
|
||||
object Properties: TXMLPropStorage
|
||||
StoredValues = <
|
||||
item
|
||||
Name = 'OUTPUTDIR'
|
||||
end
|
||||
item
|
||||
Name = 'WIKIPAGE'
|
||||
end
|
||||
item
|
||||
Name = 'PAGEOFFSET'
|
||||
end>
|
||||
left = 4
|
||||
top = 4
|
||||
end
|
||||
end
|
44
applications/wikihelp/src/umain.lrs
Normal file
44
applications/wikihelp/src/umain.lrs
Normal file
@ -0,0 +1,44 @@
|
||||
{ Das ist eine automatisch erzeugte Lazarus-Ressourcendatei }
|
||||
|
||||
LazarusResources.Add('TfWikiHelp','FORMDATA',[
|
||||
'TPF0'#10'TfWikiHelp'#9'fWikiHelp'#4'Left'#3'D'#1#6'Height'#3'B'#1#3'Top'#3
|
||||
+#221#0#5'Width'#3#172#1#18'HorzScrollBar.Page'#3#171#1#18'VertScrollBar.Page'
|
||||
+#3'A'#1#13'ActiveControl'#7#9'eWikiPage'#7'Caption'#6#8'WikiHelp'#7'OnClose'
|
||||
+#7#9'FormClose'#8'OnCreate'#7#10'FormCreate'#0#6'TLabel'#9'lWikiPage'#4'Left'
|
||||
+#2#8#6'Height'#2#14#3'Top'#2#8#5'Width'#2','#7'Caption'#6#8'WikiPage'#5'Colo'
|
||||
+'r'#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#11'lPageOffset'#4'Left'#2#8#6
|
||||
+'Height'#2#14#3'Top'#2'<'#5'Width'#2':'#7'Caption'#6#11'lPageOffset'#5'Color'
|
||||
+#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#11'eFoundPages'#4'Left'#2#8#6'H'
|
||||
+'eight'#2#14#3'Top'#2'h'#5'Width'#2'B'#7'Caption'#6#11'eFoundPages'#5'Color'
|
||||
+#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#10'lOutputDir'#4'Left'#2#8#6'He'
|
||||
+'ight'#2#14#3'Top'#3#240#0#5'Width'#2'3'#7'Caption'#6#10'Output Dir'#5'Color'
|
||||
+#7#6'clNone'#11'ParentColor'#8#0#0#6'TLabel'#9'lLanguage'#4'Left'#3' '#1#6'H'
|
||||
+'eight'#2#14#3'Top'#2#8#5'Width'#2'0'#7'Caption'#6#8'Language'#5'Color'#7#6
|
||||
+'clNone'#11'ParentColor'#8#0#0#5'TEdit'#9'eWikiPage'#4'Left'#2#8#6'Height'#2
|
||||
+#23#3'Top'#2#28#5'Width'#3#12#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0
|
||||
+#8'TabOrder'#2#0#4'Text'#6'!http://www.ullihome.de/index.php/'#0#0#5'TEdit'
|
||||
+#11'ePageOffset'#4'Left'#2#8#6'Height'#2#23#3'Top'#2'L'#5'Width'#3#156#1#7'A'
|
||||
+'nchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'TabOrder'#2#1#0#0#8'TListBox'
|
||||
+#12'lbFoundPages'#4'Left'#2#8#6'Height'#2'_'#3'Top'#2'x'#5'Width'#3'L'#1#7'A'
|
||||
+'nchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabOrder'#2#2#0#0#7
|
||||
+'TButton'#7'bSearch'#4'Left'#3'Y'#1#6'Height'#2#25#3'Top'#2'x'#5'Width'#2'K'
|
||||
+#7'Anchors'#11#5'akTop'#7'akRight'#0#25'BorderSpacing.InnerBorder'#2#4#7'Cap'
|
||||
+'tion'#6#6'Search'#7'OnClick'#7#12'bSearchClick'#8'TabOrder'#2#3#0#0#7'TButt'
|
||||
+'on'#7'bCreate'#4'Left'#3'Y'#1#6'Height'#2#25#3'Top'#3#30#1#5'Width'#2'K'#7
|
||||
+'Anchors'#11#7'akRight'#8'akBottom'#0#25'BorderSpacing.InnerBorder'#2#4#7'Ca'
|
||||
+'ption'#6#6'Create'#7'OnClick'#7#12'bCreateClick'#8'TabOrder'#2#4#0#0#12'TPr'
|
||||
+'ogressBar'#10'pbProgress'#4'Left'#2#8#6'Height'#2#20#3'Top'#3#31#1#5'Width'
|
||||
+#3'L'#1#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#3'Max'#2'd'#0#0#14
|
||||
+'TDirectoryEdit'#10'eOutputDir'#4'Left'#2#8#6'Height'#2#23#3'Top'#3#3#1#5'Wi'
|
||||
+'dth'#3'L'#1#11'ButtonWidth'#2#23#9'NumGlyphs'#2#1#7'Anchors'#11#6'akLeft'#7
|
||||
+'akRight'#8'akBottom'#0#11'ParentColor'#8#8'TabOrder'#2#5#0#0#9'TComboBox'#10
|
||||
+'cbLanguage'#4'Left'#3' '#1#6'Height'#2#21#3'Top'#2#28#5'Width'#3#132#0#7'An'
|
||||
+'chors'#11#5'akTop'#7'akRight'#0#16'AutoCompleteText'#11#22'cbactEndOfLineCo'
|
||||
+'mplete'#20'cbactSearchAscending'#0#13'Items.Strings'#1#6#16'Special:Allpage'
|
||||
+'s'#6#16'Spezial:Allpages'#0#9'MaxLength'#2#0#8'OnSelect'#7#16'cbLanguageSel'
|
||||
+'ect'#8'TabOrder'#2#6#0#0#9'TCheckBox'#16'cbAddLinkedPages'#4'Left'#2#8#6'He'
|
||||
+'ight'#2#13#3'Top'#3#220#0#5'Width'#2'g'#7'Caption'#6#16'Add linked Pages'#8
|
||||
+'TabOrder'#2#7#0#0#15'TXMLPropStorage'#10'Properties'#12'StoredValues'#14#1#4
|
||||
+'Name'#6#9'OUTPUTDIR'#0#1#4'Name'#6#8'WIKIPAGE'#0#1#4'Name'#6#10'PAGEOFFSET'
|
||||
+#0#0#4'left'#2#4#3'top'#2#4#0#0#0
|
||||
]);
|
563
applications/wikihelp/src/umain.pas
Normal file
563
applications/wikihelp/src/umain.pas
Normal file
@ -0,0 +1,563 @@
|
||||
unit uMain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Buttons,httpsend, ComCtrls, Utils, xmlread,dom, EditBtn, FileUtil,
|
||||
XMLPropStorage,Clipbrd;
|
||||
|
||||
type
|
||||
|
||||
{ TfWikiHelp }
|
||||
|
||||
TfWikiHelp = class(TForm)
|
||||
bSearch: TButton;
|
||||
bCreate: TButton;
|
||||
eOutputDir: TDirectoryEdit;
|
||||
ePageOffset: TEdit;
|
||||
eWikiPage: TEdit;
|
||||
eFoundPages: TLabel;
|
||||
lOutputDir: TLabel;
|
||||
lbFoundPages: TListBox;
|
||||
lPageOffset: TLabel;
|
||||
lWikiPage: TLabel;
|
||||
pbProgress: TProgressBar;
|
||||
Properties: TXMLPropStorage;
|
||||
cbLanguage: TComboBox;
|
||||
lLanguage: TLabel;
|
||||
cbAddLinkedPages: TCheckBox;
|
||||
procedure bCreateClick(Sender: TObject);
|
||||
procedure bSearchClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
procedure cbLanguageSelect(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
SpecialPageURL : string;
|
||||
ExportPageURL : string;
|
||||
ImageTagName : string;
|
||||
public
|
||||
{ public declarations }
|
||||
procedure Wiki2Html(wname : string;OutputDir : string;content : string);
|
||||
end;
|
||||
|
||||
var
|
||||
fWikiHelp: TfWikiHelp;
|
||||
|
||||
implementation
|
||||
|
||||
uses uAppconsts;
|
||||
|
||||
{ TfWikiHelp }
|
||||
|
||||
procedure TfWikiHelp.bSearchClick(Sender: TObject);
|
||||
var
|
||||
http : THttpSend;
|
||||
ss : TStringStream;
|
||||
s : string;
|
||||
begin
|
||||
lbFoundPages.Items.Clear;
|
||||
ss := TStringStream.Create('');
|
||||
http := THttpSend.Create;
|
||||
http.HTTPMethod('GET',eWikiPage.Text+SpecialPageURL);
|
||||
http.Document.SaveToStream(ss);
|
||||
http.Free;
|
||||
s := ss.DataString;
|
||||
s := copy(s,pos('<table style="background: inherit;" border="0" width="100%"><tr><td>',s),length(s));
|
||||
s := copy(s,0,pos('</td></tr></table><div class="printfooter">',s));
|
||||
if s = '' then
|
||||
begin
|
||||
Showmessage('Special Page not found !');
|
||||
exit;
|
||||
end;
|
||||
ss.Free;
|
||||
while pos('<a href="',s) > 0 do
|
||||
begin
|
||||
s := copy(s,pos('<a href="',s)+10,length(s));
|
||||
if copy(copy(s,0,pos('"',s)-1),0,length(ePageOffset.Text)) = ePageOffset.Text then
|
||||
lbFoundPages.Items.Add(copy(s,0,pos('"',s)-1));
|
||||
s := copy(s,pos('"',s)+1,length(s));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfWikiHelp.FormCreate(Sender: TObject);
|
||||
var
|
||||
FindRec: TSearchRec;
|
||||
begin
|
||||
if not DirectoryExists(GetConfigDir(vAppname)) then
|
||||
ForceDirectories(GetConfigDir(vAppname));
|
||||
Properties.FileName := GetConfigDir(vAppname)+'config.xml';
|
||||
Properties.Restore;
|
||||
if Properties.StoredValue['WIKIPAGE'] <> '' then
|
||||
eWikiPage.Text := Properties.StoredValue['WIKIPAGE'];
|
||||
ePageOffset.Text := Properties.StoredValue['PAGEOFFSET'];
|
||||
eOutputDir.Text := Properties.StoredValue['OUTPUTDIR'];
|
||||
cbLanguage.Items.Clear;
|
||||
IF FindFirst(ExtractFileDir(Application.Exename) + DirectorySeparator + '*.xml', faAnyFile, FindRec) = 0 THEN
|
||||
REPEAT
|
||||
IF (FindRec.Name <> '.') AND (FindRec.Name <> '..') THEN
|
||||
cbLanguage.Items.Add(copy(FindRec.Name,0,rpos('.',FindRec.Name)-1));
|
||||
UNTIL FindNext(FindRec) <> 0;
|
||||
FindClose(FindRec);
|
||||
end;
|
||||
|
||||
procedure TfWikiHelp.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
begin
|
||||
Properties.StoredValue['WIKIPAGE'] := eWikiPage.Text;
|
||||
Properties.StoredValue['PAGEOFFSET'] := ePageOffset.Text;
|
||||
Properties.StoredValue['OUTPUTDIR'] := eOutputDir.Text;
|
||||
end;
|
||||
|
||||
procedure TfWikiHelp.cbLanguageSelect(Sender: TObject);
|
||||
var
|
||||
xml: TXMLDocument;
|
||||
iNode: TDOMNode;
|
||||
begin
|
||||
if FileExists(ExtractFilePath(Application.Exename)+DirectorySeparator+cbLanguage.Text+'.xml') then
|
||||
begin
|
||||
xml := TXMLDocument.Create;
|
||||
ReadXMLFile(xml,ExtractFilePath(Application.Exename)+DirectorySeparator+cbLanguage.Text+'.xml');
|
||||
iNode := xml.DocumentElement.FindNode('SpecialPageURL');
|
||||
SpecialPageURL := iNode.FirstChild.NodeValue;
|
||||
iNode := xml.DocumentElement.FindNode('ExportPageURL');
|
||||
if Assigned(iNode) then
|
||||
ExportPageURL := StringReplace(iNode.FirstChild.NodeValue,#10,'',[rfReplaceAll]);
|
||||
iNode := xml.DocumentElement.FindNode('ImageTagName');
|
||||
if Assigned(iNode) then
|
||||
ImageTagName := iNode.FirstChild.NodeValue;
|
||||
xml.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DoReplace(var InStr,OutStr : string;ReplaceTag,NewTag : string;MustbeInOneLine : Boolean = False);
|
||||
var
|
||||
NewLine: String;
|
||||
begin
|
||||
while pos(ReplaceTag,instr) > 0 do
|
||||
begin
|
||||
NewLine := copy(instr,pos(ReplaceTag,instr)+length(ReplaceTag),length(instr));
|
||||
if MustBeInOneLine
|
||||
and ((pos(#10,NewLine) < pos(ReplaceTag,NewLine))) and (not (length(NewLine) = pos(ReplaceTag,NewLine)+length(ReplaceTag)-1)) then
|
||||
break;
|
||||
outstr := outstr+copy(instr,0,pos(ReplaceTag,instr)-1);
|
||||
instr := copy(instr,pos(replaceTag,instr)+length(ReplaceTag),length(instr));
|
||||
outstr := outstr+'<'+NewTag+'>'+copy(instr,0,pos(ReplaceTag,instr)-1)+'</'+NewTag+'>';
|
||||
instr := copy(instr,pos(ReplaceTag,instr)+length(ReplaceTag),length(instr));
|
||||
end;
|
||||
outstr := outstr+instr;
|
||||
instr := outstr;
|
||||
outstr := '';
|
||||
end;
|
||||
|
||||
procedure TfWikiHelp.Wiki2Html(wname: string;OutputDir : string;content: string);
|
||||
var
|
||||
f : TextFile;
|
||||
istr : string;
|
||||
ostr : string;
|
||||
http : THttpSend;
|
||||
open_uls,act_uls : integer;
|
||||
i: LongInt;
|
||||
intd: Boolean;
|
||||
tstr: String;
|
||||
aWikiStart: String;
|
||||
linkcontent: String;
|
||||
begin
|
||||
istr := content;
|
||||
ForceDirectories(OutputDir);
|
||||
AssignFile(f,AppendPathDelim(OutputDir)+ValidateFileName(lowercase(wname))+'.html');
|
||||
Rewrite(f);
|
||||
ostr := '';
|
||||
open_uls := 0;
|
||||
act_uls := 0;
|
||||
//Remove NOTOC
|
||||
istr := StringReplace(istr,'__NOTOC__','',[rfReplaceAll]);
|
||||
//Remove Templates
|
||||
while pos('{{',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('{{',istr)-1);
|
||||
istr := copy(istr,pos('{{',istr)+2,length(istr));
|
||||
|
||||
istr := copy(istr,pos('}}',istr)+2,length(istr));
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace Lists
|
||||
while pos('*',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('*',istr)-1);
|
||||
istr := copy(istr,pos('*',istr)+1,length(istr));
|
||||
inc(act_uls);
|
||||
while istr[1] = '*' do
|
||||
begin
|
||||
inc(act_uls);
|
||||
istr := copy(istr,2,length(istr));
|
||||
end;
|
||||
if open_uls < act_uls then
|
||||
begin
|
||||
for i := open_uls to act_uls-1 do
|
||||
ostr := ostr+'<ul>';
|
||||
end
|
||||
else
|
||||
begin
|
||||
for i := act_uls to open_uls-1 do
|
||||
ostr := ostr+'</ul>';
|
||||
end;
|
||||
open_uls := act_uls;
|
||||
act_uls := 0;
|
||||
ostr := ostr+'<li>';
|
||||
if pos(#10,istr) > 0 then
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos(#10,istr)-1);
|
||||
istr := copy(istr,pos(#10,istr)+1,length(istr));
|
||||
end
|
||||
else
|
||||
begin
|
||||
ostr := ostr+istr;
|
||||
istr := '';
|
||||
end;
|
||||
ostr := ostr+'</li>';
|
||||
if (length(istr) > 0) and (istr[1] <> '*') then
|
||||
begin
|
||||
for i := 0 to open_uls-1 do
|
||||
ostr := ostr+'</ul>';
|
||||
open_uls := 0;
|
||||
end;
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
open_uls := 0;
|
||||
act_uls := 0;
|
||||
//Replace Numerated Lists
|
||||
while pos('#',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('#',istr)-1);
|
||||
istr := copy(istr,pos('#',istr)+1,length(istr));
|
||||
inc(act_uls);
|
||||
while istr[1] = '#' do
|
||||
begin
|
||||
inc(act_uls);
|
||||
istr := copy(istr,2,length(istr));
|
||||
end;
|
||||
if open_uls < act_uls then
|
||||
begin
|
||||
for i := open_uls to act_uls-1 do
|
||||
ostr := ostr+'<ol>';
|
||||
end
|
||||
else
|
||||
begin
|
||||
for i := act_uls to open_uls-1 do
|
||||
ostr := ostr+'</ol>';
|
||||
end;
|
||||
open_uls := act_uls;
|
||||
act_uls := 0;
|
||||
ostr := ostr+'<li>';
|
||||
if pos(#10,istr) > 0 then
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos(#10,istr)-1);
|
||||
istr := copy(istr,pos(#10,istr)+1,length(istr));
|
||||
end
|
||||
else
|
||||
begin
|
||||
ostr := ostr+istr;
|
||||
istr := '';
|
||||
end;
|
||||
ostr := ostr+'</li>';
|
||||
if (length(istr) > 0) and (istr[1] <> '#') then
|
||||
begin
|
||||
for i := 0 to open_uls-1 do
|
||||
ostr := ostr+'</ol>';
|
||||
open_uls := 0;
|
||||
end;
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace Tables
|
||||
while pos('{|',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('{|',istr)-1);
|
||||
istr := copy(istr,pos('{|',istr)+2,length(istr));
|
||||
//remove also content behing {|
|
||||
istr := copy(istr,pos(#10,istr)-1,length(istr));
|
||||
tstr := copy(istr,0,pos(#10+'|}',istr)-1);
|
||||
istr := copy(istr,pos(#10+'|}',istr)+3,length(istr));
|
||||
ostr := ostr+'<table><tr>';
|
||||
tstr := StringReplace(tstr,'|-','</tr><tr>',[rfReplaceAll]);
|
||||
intd := False;
|
||||
while length(tstr) > 2 do
|
||||
begin
|
||||
if ((tstr[1] = #10) and (tstr[2] = '|'))
|
||||
or ((tstr[1] = #10) and (tstr[2] = '!')) then
|
||||
begin
|
||||
if inTD then
|
||||
ostr := ostr+'</td>'
|
||||
else
|
||||
ostr := ostr+'<td>';
|
||||
inTD := not inTD;
|
||||
tstr := copy(tstr,3,length(tstr));
|
||||
end
|
||||
else if ((tstr[1] = '!') and (tstr[2] = '!'))
|
||||
or ((tstr[1] = '|') and (tstr[2] = '|')) then
|
||||
begin
|
||||
if inTD then
|
||||
begin
|
||||
ostr := ostr+'</td><td>'
|
||||
end
|
||||
else //Schould never happen
|
||||
begin
|
||||
ostr := ostr+'<td>';
|
||||
inTD := True;
|
||||
end;
|
||||
tstr := copy(tstr,3,length(tstr));
|
||||
end
|
||||
else
|
||||
begin
|
||||
if (tstr[1] = #10) and InTD then
|
||||
begin
|
||||
ostr := ostr+'</td>';
|
||||
InTD := False;
|
||||
end
|
||||
else
|
||||
ostr := ostr+tstr[1];
|
||||
tstr := copy(tstr,2,length(tstr));
|
||||
end;
|
||||
end;
|
||||
ostr := ostr+tstr+'</tr></table>';
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace Images
|
||||
while pos('[['+ImageTagName+':',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('[['+ImageTagName+':',istr)-1);
|
||||
istr := copy(istr,pos('[['+ImageTagName+':',istr)+length(ImageTagname)+3,length(istr));
|
||||
if (pos('|',istr) > 0) and (pos('|',istr) < pos(']]',istr)) then
|
||||
begin
|
||||
http := THttpSend.Create;
|
||||
http.HTTPMethod('GET','/images/'+copy(istr,0,pos('|',istr)-1));
|
||||
http.Document.SaveToFile(AppendPathDelim(OutputDir)+ValidateFileName(lowercase(copy(istr,0,pos('|',istr)-1))));
|
||||
http.Free;
|
||||
ostr := ostr+'<img src="'+ValidateFileName(lowercase(copy(istr,0,pos('|',istr)-1)))+'" alt="';
|
||||
istr := copy(istr,0,pos('|',istr)+1);
|
||||
ostr := ostr+copy(istr,0,pos(']]',istr)-1)+'"></img>';
|
||||
istr := copy(istr,pos(']]',istr)+2,length(istr));
|
||||
end
|
||||
else
|
||||
begin
|
||||
aWikiStart := eWikiPage.Text;
|
||||
if pos('index.php',aWikiStart) > 0 then
|
||||
aWikiStart := copy(aWikiStart,0,pos('index.php',aWikiStart)-1);
|
||||
http := THttpSend.Create;
|
||||
http.HTTPMethod('GET',aWikiStart+'/images/'+copy(istr,0,pos(']]',istr)-1));
|
||||
http.Document.SaveToFile(AppendPathDelim(OutputDir)+ValidateFileName(lowercase(copy(istr,0,pos(']]',istr)-1))));
|
||||
http.Free;
|
||||
ostr := ostr+'<img src="'+ValidateFileName(lowercase(copy(istr,0,pos(']]',istr)-1)))+'" alt="'+copy(istr,0,pos(']]',istr)-1)+'"></img>';
|
||||
istr := copy(istr,pos(']]',istr)+2,length(istr));
|
||||
end;
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace Links
|
||||
while pos('[[',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('[[',istr)-1);
|
||||
istr := copy(istr,pos('[[',istr)+2,length(istr));
|
||||
if (pos('|',istr) > 0) and (pos('|',istr) < pos(']]',istr)) then
|
||||
begin
|
||||
linkcontent := copy(istr,0,pos('|',istr)-1);
|
||||
if (cbAddLinkedPages.Checked and (lbFoundPages.Items.IndexOf(linkcontent) = -1)) then
|
||||
begin
|
||||
lbFoundPages.Items.Add(linkcontent);
|
||||
pbProgress.Max := pbProgress.Max+1;
|
||||
end;
|
||||
if lbFoundPages.Items.IndexOf(linkcontent) > -1 then
|
||||
begin
|
||||
ostr := ostr+'<a href="'+ValidateFileName(linkcontent)+'.html">';
|
||||
istr := copy(istr,pos('|',istr)+1,length(istr));
|
||||
ostr := ostr+copy(istr,0,pos(']]',istr)-1)+'</a>';
|
||||
istr := copy(istr,pos(']]',istr)+2,length(istr));
|
||||
end
|
||||
else
|
||||
begin
|
||||
istr := copy(istr,pos('|',istr)+1,length(istr));
|
||||
ostr := ostr+copy(istr,0,pos(']]',istr)-1);
|
||||
istr := copy(istr,pos(']]',istr)+2,length(istr));
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
linkcontent := copy(istr,0,pos(']]',istr)-1);
|
||||
if (cbAddLinkedPages.Checked and (lbFoundPages.Items.IndexOf(linkcontent) = -1)) then
|
||||
begin
|
||||
lbFoundPages.Items.Add(linkcontent);
|
||||
pbProgress.Max := pbProgress.Max+1;
|
||||
end;
|
||||
if lbFoundPages.Items.IndexOf(linkcontent) > -1 then
|
||||
begin
|
||||
ostr := ostr+'<a href="'+ValidateFileName(linkcontent)+'.html">'+copy(istr,0,pos(']]',istr)-1)+'</a>';
|
||||
istr := copy(istr,pos(']]',istr)+2,length(istr));
|
||||
end
|
||||
else
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos(']]',istr)-1);
|
||||
istr := copy(istr,pos(']]',istr)+2,length(istr));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace extern Links
|
||||
while pos('[http://',lowercase(istr)) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('[http://',lowercase(istr))-1);
|
||||
istr := copy(istr,pos('[http://',lowercase(istr)),length(istr));
|
||||
if (pos(' ',istr) > 0) and (pos(' ',istr) < pos(']',lowercase(istr))) then
|
||||
begin
|
||||
ostr := ostr+'<a href="'+StringReplace(copy(istr,2,pos(' ',istr)-2),'http://./','',[rfReplaceAll])+'" target="_BLANK">';
|
||||
istr := copy(istr,pos(' ',istr)+1,length(istr));
|
||||
ostr := ostr+copy(istr,0,pos(']',lowercase(istr))-1)+'</a>';
|
||||
istr := copy(istr,pos(']',lowercase(istr))+1,length(istr));
|
||||
end
|
||||
else
|
||||
begin
|
||||
ostr := ostr+'<a href="'+StringReplace(copy(istr,2,pos(']',lowercase(istr))-2),'http://./','',[rfReplaceAll])+'" target="_BLANK">'+StringReplace(copy(istr,2,pos(']',lowercase(istr))-2),'http://./','',[rfReplaceAll])+'</a>';
|
||||
istr := copy(istr,pos(']',lowercase(istr))+1,length(istr));
|
||||
end;
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace Bold Text
|
||||
while pos('''''''',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('''''''',istr)-1);
|
||||
istr := copy(istr,pos('''''''',istr)+3,length(istr));
|
||||
ostr := ostr+'<b>'+copy(istr,0,pos('''''''',istr)-1)+'</b>';
|
||||
istr := copy(istr,pos('''''''',istr)+3,length(istr));
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace Italic Text
|
||||
while pos('''''',istr) > 0 do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos('''''',istr)-1);
|
||||
istr := copy(istr,pos('''''',istr)+2,length(istr));
|
||||
ostr := ostr+'<i>'+copy(istr,0,pos('''''',istr)-1)+'</i>';
|
||||
istr := copy(istr,pos('''''',istr)+2,length(istr));
|
||||
end;
|
||||
ostr := ostr+istr;
|
||||
istr := ostr;
|
||||
ostr := '';
|
||||
//Replace Header Level 5
|
||||
DoReplace(istr,ostr,'=====','h6',True);
|
||||
//Replace Header Level 4
|
||||
DoReplace(istr,ostr,'====','h5',True);
|
||||
//Replace Header Level 3
|
||||
DoReplace(istr,ostr,'===','h4',True);
|
||||
//Replace Header Level 2
|
||||
DoReplace(istr,ostr,'==','h3',True);
|
||||
//Replace Header Level 1
|
||||
// DoReplace(istr,ostr,'=','h2',True); //Too many problems at time TODO: check if we are in an html tag bevore replace
|
||||
//Process unformated stuff
|
||||
while pos(#10+' ',istr) > 0 do
|
||||
begin
|
||||
//Replace Line breaks in text bevore pre
|
||||
ostr := ostr+StringReplace(StringReplace(copy(istr,0,pos(#10+' ',istr)-1),#10#10,'<br><br>',[rfReplaceAll]),#10,'',[rfReplaceAll]);
|
||||
istr := copy(istr,pos(#10+' ',istr)+2,length(istr));
|
||||
ostr := ostr+'<pre>';
|
||||
while (pos(#10+' ',istr) > 0) do
|
||||
begin
|
||||
ostr := ostr+copy(istr,0,pos(#10,istr));
|
||||
istr := copy(istr,pos(#10,istr)+1,length(istr));
|
||||
if (length(istr) > 0) and (istr[1] <> ' ') then
|
||||
break
|
||||
else
|
||||
istr := copy(istr,2,length(istr));
|
||||
end;
|
||||
ostr := ostr+'</pre>';
|
||||
end;
|
||||
ostr := ostr+StringReplace(StringReplace(istr,#10#10,'<br><br>',[rfReplaceAll]),#10,'',[rfReplaceAll]);
|
||||
//Remove <br> after <h*>
|
||||
ostr := StringReplace(ostr,'</h2><br><br>','</h2>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h3><br><br>','</h3>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h4><br><br>','</h4>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h5><br><br>','</h5>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h6><br><br>','</h6>',[rfReplaceAll]);
|
||||
|
||||
ostr := StringReplace(ostr,'</h2><br>','</h2>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h3><br>','</h3>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h4><br>','</h4>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h5><br>','</h5>',[rfReplaceAll]);
|
||||
ostr := StringReplace(ostr,'</h6><br>','</h6>',[rfReplaceAll]);
|
||||
|
||||
write(f,'<html><head><title>'+wname+'</title></head><body><font face="arial,verdana">'+ostr+'</font></body></html>');
|
||||
CloseFile(f);
|
||||
end;
|
||||
|
||||
procedure TfWikiHelp.bCreateClick(Sender: TObject);
|
||||
var
|
||||
http : THttpSend;
|
||||
xml : TXMLDocument;
|
||||
i: Integer;
|
||||
iNode: TDOMNode;
|
||||
a: Integer;
|
||||
aWikiStart : string;
|
||||
begin
|
||||
bCreate.Enabled := false;
|
||||
Screen.Cursor := crHourglass;
|
||||
pbProgress.Max := lbFoundPages.Items.Count;
|
||||
pbProgress.Position := 0;
|
||||
while lbFoundPages.Items.Count > 0 do
|
||||
begin
|
||||
aWikiStart := eWikiPage.Text;
|
||||
if pos('index.php',aWikiStart) > 0 then
|
||||
aWikiStart := copy(aWikiStart,0,pos('index.php',aWikiStart)-1);
|
||||
http := THttpSend.Create;
|
||||
http.HTTPMethod('POST',aWikiStart+Format(ExportPageURL,[HTTPEncode(lbFoundPages.Items[0])]));
|
||||
if http.ResultCode = 200 then
|
||||
begin
|
||||
xml := TXMLDocument.Create;
|
||||
try
|
||||
ReadXMLFile(xml,http.Document);
|
||||
iNode := xml.DocumentElement.FindNode('page');
|
||||
if Assigned(iNode) then
|
||||
iNode := iNode.FindNode('revision');
|
||||
if Assigned(iNode) then
|
||||
iNode := iNode.FindNode('text');
|
||||
if Assigned(iNode) then
|
||||
begin
|
||||
Wiki2Html(lbFoundPages.Items[0],eOutputDir.Text,iNode.FirstChild.NodeValue);
|
||||
end
|
||||
else
|
||||
Showmessage('Page: '+lbFoundPages.Items[0]+' not found !');
|
||||
xml.Free;
|
||||
except
|
||||
on e : Exception do
|
||||
Showmessage('Error Processing :'+lbFoundPages.Items[0]+':'+e.Message);
|
||||
end;
|
||||
end
|
||||
else
|
||||
Showmessage('Page: '+lbFoundPages.Items[0]+' not found !');
|
||||
http.Free;
|
||||
pbProgress.Position := i+1;
|
||||
lbFoundPages.Items.Delete(0);
|
||||
Application.Processmessages;
|
||||
end;
|
||||
Screen.Cursor := crDefault;
|
||||
bCreate.Enabled := True;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I umain.lrs}
|
||||
|
||||
end.
|
||||
|
372
applications/wikihelp/src/wikihelp.lpi
Normal file
372
applications/wikihelp/src/wikihelp.lpi
Normal file
@ -0,0 +1,372 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ActiveEditorIndexAtStart Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="25">
|
||||
<Unit0>
|
||||
<Filename Value="wikihelp.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="wikihelp"/>
|
||||
<CursorPos X="49" Y="15"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="46"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umain.pas"/>
|
||||
<ComponentName Value="fWikiHelp"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ResourceFilename Value="umain.lrs"/>
|
||||
<UnitName Value="uMain"/>
|
||||
<CursorPos X="55" Y="529"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="46"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\LKomponenten\synapse\httpsend.pas"/>
|
||||
<UnitName Value="httpsend"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="37"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\Programme\lazarus\lcl\interfaces\win32\interfaces.pp"/>
|
||||
<UnitName Value="Interfaces"/>
|
||||
<CursorPos X="38" Y="31"/>
|
||||
<TopLine Value="16"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\general\Utils.pas"/>
|
||||
<UnitName Value="Utils"/>
|
||||
<CursorPos X="1" Y="206"/>
|
||||
<TopLine Value="194"/>
|
||||
<UsageCount Value="13"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\..\Programme\lazarus\fpc\2.1.1\source\fcl\xml\xmlread.pp"/>
|
||||
<UnitName Value="XMLRead"/>
|
||||
<CursorPos X="63" Y="33"/>
|
||||
<TopLine Value="22"/>
|
||||
<UsageCount Value="13"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\Programme\lazarus\fpc\2.1.1\source\fcl\xml\dom.pp"/>
|
||||
<UnitName Value="DOM"/>
|
||||
<CursorPos X="3" Y="449"/>
|
||||
<TopLine Value="461"/>
|
||||
<UsageCount Value="13"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="..\..\general\ubugtracker.pas"/>
|
||||
<ComponentName Value="fBugTracker"/>
|
||||
<HasResources Value="True"/>
|
||||
<UnitName Value="uBugtracker"/>
|
||||
<CursorPos X="14" Y="4"/>
|
||||
<TopLine Value="199"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="..\..\Programme\lazarus\lcl\editbtn.pas"/>
|
||||
<UnitName Value="EditBtn"/>
|
||||
<CursorPos X="70" Y="9"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="..\..\general\uhelp.pas"/>
|
||||
<ComponentName Value="fHelpBrowser"/>
|
||||
<HasResources Value="True"/>
|
||||
<UnitName Value="uHelp"/>
|
||||
<CursorPos X="1" Y="327"/>
|
||||
<TopLine Value="318"/>
|
||||
<UsageCount Value="13"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="..\..\Programme\lazarus\lcl\include\control.inc"/>
|
||||
<CursorPos X="1" Y="2369"/>
|
||||
<TopLine Value="2354"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="..\..\Programme\lazarus\lcl\interfaces\win32\win32listsl.inc"/>
|
||||
<CursorPos X="22" Y="173"/>
|
||||
<TopLine Value="165"/>
|
||||
<UsageCount Value="12"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="..\..\promenteus\help\prometheus-helpde.html"/>
|
||||
<CursorPos X="1024" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<SyntaxHighlighter Value="HTML"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="..\..\promenteus\Src\umain.pas"/>
|
||||
<ComponentName Value="fMain"/>
|
||||
<HasResources Value="True"/>
|
||||
<UnitName Value="umain"/>
|
||||
<CursorPos X="1" Y="154"/>
|
||||
<TopLine Value="144"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="uappconsts.pas"/>
|
||||
<UnitName Value="uAppconsts"/>
|
||||
<CursorPos X="23" Y="9"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="13"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
<Unit15>
|
||||
<Filename Value="..\..\Programme\lazarus\lcl\xmlpropstorage.pas"/>
|
||||
<UnitName Value="XMLPropStorage"/>
|
||||
<CursorPos X="17" Y="131"/>
|
||||
<TopLine Value="117"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit15>
|
||||
<Unit16>
|
||||
<Filename Value="..\..\promenteus\help\prometheus-helpreportdesignertextde.html"/>
|
||||
<CursorPos X="91" Y="2"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<SyntaxHighlighter Value="HTML"/>
|
||||
</Unit16>
|
||||
<Unit17>
|
||||
<Filename Value="..\..\TCS_Programmer\help\tcs_programmer-helpde.html"/>
|
||||
<CursorPos X="1024" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<SyntaxHighlighter Value="HTML"/>
|
||||
</Unit17>
|
||||
<Unit18>
|
||||
<Filename Value="..\..\TCS_Programmer\general\utcsbus.pas"/>
|
||||
<UnitName Value="utcsbus"/>
|
||||
<CursorPos X="1" Y="3648"/>
|
||||
<TopLine Value="3622"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit18>
|
||||
<Unit19>
|
||||
<Filename Value="..\output\i386-win32\deutsch.xml"/>
|
||||
<CursorPos X="1" Y="5"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<SyntaxHighlighter Value="XML"/>
|
||||
</Unit19>
|
||||
<Unit20>
|
||||
<Filename Value="..\output\i386-win32\deutsch2.xml"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<SyntaxHighlighter Value="XML"/>
|
||||
</Unit20>
|
||||
<Unit21>
|
||||
<Filename Value="..\..\lazarus\fpc\2.0.4\source\fcl\xml\dom.pp"/>
|
||||
<UnitName Value="DOM"/>
|
||||
<CursorPos X="25" Y="1504"/>
|
||||
<TopLine Value="1480"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit21>
|
||||
<Unit22>
|
||||
<Filename Value="..\..\lazarus\fpc\2.1.1\source\fcl\xml\dom.pp"/>
|
||||
<UnitName Value="DOM"/>
|
||||
<CursorPos X="14" Y="276"/>
|
||||
<TopLine Value="251"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit22>
|
||||
<Unit23>
|
||||
<Filename Value="..\..\lazarus\fpc\2.0.4\source\fcl\tests\xmldump.pp"/>
|
||||
<UnitName Value="xmldump"/>
|
||||
<CursorPos X="27" Y="8"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit23>
|
||||
<Unit24>
|
||||
<Filename Value="..\..\..\..\test.xml"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<SyntaxHighlighter Value="XML"/>
|
||||
</Unit24>
|
||||
</Units>
|
||||
<JumpHistory Count="29" HistoryIndex="28">
|
||||
<Position1>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="524" Column="24" TopLine="516"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="509" Column="1" TopLine="503"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="510" Column="1" TopLine="495"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="512" Column="1" TopLine="497"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="513" Column="1" TopLine="498"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="514" Column="1" TopLine="499"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="516" Column="1" TopLine="501"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="145" Column="1" TopLine="136"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="520" Column="20" TopLine="506"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="522" Column="1" TopLine="507"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="523" Column="1" TopLine="508"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="525" Column="1" TopLine="510"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="527" Column="1" TopLine="512"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="531" Column="1" TopLine="516"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="539" Column="1" TopLine="522"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="540" Column="1" TopLine="522"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="541" Column="1" TopLine="522"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="542" Column="1" TopLine="522"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="510" Column="1" TopLine="495"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="511" Column="1" TopLine="496"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="513" Column="1" TopLine="498"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="514" Column="1" TopLine="499"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="515" Column="1" TopLine="500"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="517" Column="1" TopLine="502"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="518" Column="1" TopLine="503"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="519" Column="1" TopLine="504"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="523" Column="10" TopLine="514"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="187" Column="1" TopLine="169"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="umain.pas"/>
|
||||
<Caret Line="534" Column="41" TopLine="523"/>
|
||||
</Position29>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="..\..\lkomponenten\synapse\;..\..\general\"/>
|
||||
<UnitOutputDirectory Value="..\output\$(TargetCPU)-$(TargetOS)"/>
|
||||
<SrcPath Value="$(LazarusDir)\lcl\;$(LazarusDir)\lcl\interfaces\$(LCLWidgetType)\"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<BreakPoints Count="1">
|
||||
<Item1>
|
||||
<Source Value="..\..\LKomponenten\tdbf\dbf_common.pas"/>
|
||||
<Line Value="375"/>
|
||||
</Item1>
|
||||
</BreakPoints>
|
||||
</Debugging>
|
||||
</CONFIG>
|
Reference in New Issue
Block a user