Subversion Repositories fastphp

Rev

Rev 2 | Rev 5 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 4
Line 2... Line 2...
2
 
2
 
3
interface
3
interface
4
 
4
 
5
uses
5
uses
6
  Windows, Messages, SysUtils, StrUtils, IniFiles, Classes, Forms, Variants, MsHTML,
6
  Windows, Messages, SysUtils, StrUtils, IniFiles, Classes, Forms, Variants, MsHTML,
7
  SHDocVw, StdCtrls;
7
  SHDocVw_TLB, StdCtrls, SynEdit,
-
 
8
 
-
 
9
 
-
 
10
 
-
 
11
 
-
 
12
 
-
 
13
  dialogs;
8
 
14
 
9
function GetDosOutput(CommandLine: string; Work: string = ''): string;
15
function GetDosOutput(CommandLine: string; Work: string = ''): string;
10
function StrIPos(const SubStr, S: string): Integer;
16
function StrIPos(const SubStr, S: string): Integer;
11
procedure WaitForBrowser(WB: TWebbrowser);
17
procedure WaitForBrowser(WB: TWebbrowser);
12
function LoadFileToStr(const FileName: TFileName): AnsiString;
18
function LoadFileToStr(const FileName: TFileName): AnsiString;
13
function LastPos(const SubStr, S: string): integer;
19
function LastPos(const SubStr, S: string): integer;
14
function ParseCHM(chmFile: string): boolean;
20
function ParseCHM(chmFile: string): boolean;
15
procedure BrowseURL(WebBrowser1: TWebBrowser; url: string);
21
procedure BrowseURL(WebBrowser1: TWebBrowser; url: string);
16
procedure BrowseContent(WebBrowser1: TWebBrowser; html: string);
22
procedure BrowseContent(WebBrowser1: TWebBrowser; html: string);
17
function IsTextHTML(s: string): boolean;
23
function IsTextHTML(s: string): boolean;
18
function GetWordUnderCaret(AMemo: TMemo): string;
24
function GetWordUnderCaret(AMemo: TSynEdit): string;
19
function IsValidPHPExe(const exeFile: string): boolean;
25
function IsValidPHPExe(const exeFile: string): boolean;
20
 
26
 
21
implementation
27
implementation
22
 
28
 
23
function GetDosOutput(CommandLine: string; Work: string = ''): string;
29
function GetDosOutput(CommandLine: string; Work: string = ''): string;
Line 321... Line 327...
321
           _Tag('pre') + _Tag('blockquote') + _Tag('span');
327
           _Tag('pre') + _Tag('blockquote') + _Tag('span');
322
  result := score >= 2;
328
  result := score >= 2;
323
end;
329
end;
324
 
330
 
325
// Template: http://stackoverflow.com/questions/6339446/delphi-get-the-whole-word-where-the-caret-is-in-a-memo
331
// Template: http://stackoverflow.com/questions/6339446/delphi-get-the-whole-word-where-the-caret-is-in-a-memo
326
function GetWordUnderCaret(AMemo: TMemo): string;
332
function GetWordUnderCaret(AMemo: TSynEdit): string;
327
 
333
 
328
  function ValidChar(c: char): boolean;
334
  function ValidChar(c: char): boolean;
329
  begin
335
  begin
330
    result := c in ['a'..'z', 'A'..'Z', '0'..'9', '_'];
336
    result := c in ['a'..'z', 'A'..'Z', '0'..'9', '_'];
331
  end;
337
  end;
Line 336... Line 342...
336
   LineText: string;
342
   LineText: string;
337
   InitPos : Integer;
343
   InitPos : Integer;
338
   EndPos  : Integer;
344
   EndPos  : Integer;
339
begin
345
begin
340
   //Get the caret position
346
   //Get the caret position
-
 
347
   (*
-
 
348
   if AMemo is TMemo then
-
 
349
   begin
341
   Line   := AMemo.Perform(EM_LINEFROMCHAR,AMemo.SelStart, 0) ;
350
     Line   := AMemo.Perform(EM_LINEFROMCHAR,AMemo.SelStart, 0);
342
   Column := AMemo.SelStart - AMemo.Perform(EM_LINEINDEX, Line, 0) ;
351
     Column := AMemo.SelStart - AMemo.Perform(EM_LINEINDEX, Line, 0);
-
 
352
   end;
-
 
353
   *)
-
 
354
   if AMemo is TSynEdit then
-
 
355
   begin
-
 
356
     Line := AMemo.CaretY-1;
-
 
357
     Column := AMemo.CaretX-1;
-
 
358
   end;
-
 
359
 
343
   //Validate the line number
360
   //Validate the line number
344
   if AMemo.Lines.Count-1 < Line then Exit;
361
   if AMemo.Lines.Count-1 < Line then Exit;
345
 
362
 
346
   //Get the text of the line
363
   //Get the text of the line
347
   LineText := AMemo.Lines[Line];
364
   LineText := AMemo.Lines[Line];