Rev 30 | Rev 32 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 30 | Rev 31 | ||
---|---|---|---|
Line 17... | Line 17... | ||
17 | // TODO: wieso kommt syntax fehler zweimal? einmal stderr einmal stdout? |
17 | // TODO: wieso kommt syntax fehler zweimal? einmal stderr einmal stdout? |
18 | // TODO: Browser titlebar (link preview) |
18 | // TODO: Browser titlebar (link preview) |
19 | // TODO: todo liste |
19 | // TODO: todo liste |
20 | 20 | ||
21 | // Future ideas |
21 | // Future ideas |
22 | // - code explorer / code insight |
22 | // - code insight |
23 | // - verschiedene php versionen? |
23 | // - verschiedene php versionen? |
24 | // - webbrowser1 nur laden, wenn man den tab anwählt? |
24 | // - webbrowser1 nur laden, wenn man den tab anwählt? |
25 | // - doppelklick auf tab soll diesen schließen |
25 | // - doppelklick auf tab soll diesen schließen |
26 | // - Onlinehelp (www) aufrufen |
26 | // - Onlinehelp (www) aufrufen |
27 | // - Let all colors be adjustable |
27 | // - Let all colors be adjustable |
Line 116... | Line 116... | ||
116 | procedure Timer1Timer(Sender: TObject); |
116 | procedure Timer1Timer(Sender: TObject); |
117 | procedure ActionSpaceToTabExecute(Sender: TObject); |
117 | procedure ActionSpaceToTabExecute(Sender: TObject); |
118 | procedure TreeView1DblClick(Sender: TObject); |
118 | procedure TreeView1DblClick(Sender: TObject); |
119 | procedure SynEdit1GutterClick(Sender: TObject; Button: TMouseButton; X, Y, |
119 | procedure SynEdit1GutterClick(Sender: TObject; Button: TMouseButton; X, Y, |
120 | Line: Integer; Mark: TSynEditMark); |
120 | Line: Integer; Mark: TSynEditMark); |
- | 121 | procedure SynEdit1PaintTransient(Sender: TObject; Canvas: TCanvas; |
|
- | 122 | TransientType: TTransientType); |
|
121 | private |
123 | private |
122 | CurSearchTerm: string; |
124 | CurSearchTerm: string; |
123 | HlpPrevPageIndex: integer; |
125 | HlpPrevPageIndex: integer; |
124 | SrcRep: TSynEditFindReplace; |
126 | SrcRep: TSynEditFindReplace; |
125 | {$IFDEF OnlineHelp} |
127 | {$IFDEF OnlineHelp} |
126 | gOnlineHelpWord: string; |
128 | gOnlineHelpWord: string; |
127 | {$ENDIF} |
129 | {$ENDIF} |
128 | procedure Help; |
130 | procedure Help; |
129 | function MarkUpLineReference(cont: string): string; |
131 | function MarkUpLineReference(cont: string): string; |
130 | function InputRequestCallback: string; |
132 | function InputRequestCallback: AnsiString; |
131 | procedure OutputNotifyCallback(const data: string); |
133 | procedure OutputNotifyCallback(const data: AnsiString); |
132 | protected |
134 | protected |
133 | ChmIndex: TMemIniFile; |
135 | ChmIndex: TMemIniFile; |
134 | FScrapFile: string; |
136 | FScrapFile: string; |
135 | codeExplorer: TRunCodeExplorer; |
137 | codeExplorer: TRunCodeExplorer; |
136 | procedure GotoLineNo(LineNo: integer); |
138 | procedure GotoLineNo(LineNo: integer); |
Line 411... | Line 413... | ||
411 | Handled := true; |
413 | Handled := true; |
412 | end |
414 | end |
413 | else Handled := false; |
415 | else Handled := false; |
414 | end; |
416 | end; |
415 | 417 | ||
- | 418 | procedure TForm1.SynEdit1PaintTransient(Sender: TObject; Canvas: TCanvas; TransientType: TTransientType); |
|
- | 419 | var |
|
- | 420 | Editor: TSynEdit; |
|
- | 421 | OpenChars: array of WideChar;//[0..2] of WideChar=(); |
|
- | 422 | CloseChars: array of WideChar;//[0..2] of WideChar=(); |
|
- | 423 | ||
- | 424 | function IsCharBracket(AChar: WideChar): Boolean; |
|
- | 425 | begin |
|
- | 426 | case AChar of |
|
- | 427 | '{','[','(','<','}',']',')','>': |
|
- | 428 | Result := True; |
|
- | 429 | else |
|
- | 430 | Result := False; |
|
- | 431 | end; |
|
- | 432 | end; |
|
- | 433 | ||
- | 434 | function CharToPixels(P: TBufferCoord): TPoint; |
|
- | 435 | begin |
|
- | 436 | Result := Editor.RowColumnToPixels(Editor.BufferToDisplayPos(P)); |
|
- | 437 | end; |
|
- | 438 | ||
- | 439 | const |
|
- | 440 | COLOR_FG = clRed; |
|
- | 441 | COLOR_BG = clInfoBk; |
|
- | 442 | var |
|
- | 443 | P: TBufferCoord; |
|
- | 444 | Pix: TPoint; |
|
- | 445 | D: TDisplayCoord; |
|
- | 446 | S: UnicodeString; |
|
- | 447 | I: Integer; |
|
- | 448 | Attri: TSynHighlighterAttributes; |
|
- | 449 | ArrayLength: Integer; |
|
- | 450 | start: Integer; |
|
- | 451 | TmpCharA, TmpCharB: WideChar; |
|
- | 452 | begin |
|
- | 453 | // Source: https://github.com/SynEdit/SynEdit/blob/master/Demos/OnPaintTransientDemo/Unit1.pas |
|
- | 454 | ||
- | 455 | if TSynEdit(Sender).SelAvail then exit; |
|
- | 456 | Editor := TSynEdit(Sender); |
|
- | 457 | ArrayLength:= 3; |
|
- | 458 | ||
- | 459 | (* |
|
- | 460 | if (Editor.Highlighter = shHTML) or (Editor.Highlighter = shXML) then |
|
- | 461 | inc(ArrayLength); |
|
- | 462 | *) |
|
- | 463 | ||
- | 464 | SetLength(OpenChars, ArrayLength); |
|
- | 465 | SetLength(CloseChars, ArrayLength); |
|
- | 466 | for i := 0 to ArrayLength - 1 do |
|
- | 467 | begin |
|
- | 468 | case i of |
|
- | 469 | 0: begin OpenChars[i] := '('; CloseChars[i] := ')'; end; |
|
- | 470 | 1: begin OpenChars[i] := '{'; CloseChars[i] := '}'; end; |
|
- | 471 | 2: begin OpenChars[i] := '['; CloseChars[i] := ']'; end; |
|
- | 472 | 3: begin OpenChars[i] := '<'; CloseChars[i] := '>'; end; |
|
- | 473 | end; |
|
- | 474 | end; |
|
- | 475 | ||
- | 476 | P := Editor.CaretXY; |
|
- | 477 | D := Editor.DisplayXY; |
|
- | 478 | ||
- | 479 | Start := Editor.SelStart; |
|
- | 480 | ||
- | 481 | if (Start > 0) and (Start <= length(Editor.Text)) then |
|
- | 482 | TmpCharA := Editor.Text[Start] |
|
- | 483 | else |
|
- | 484 | TmpCharA := #0; |
|
- | 485 | ||
- | 486 | if (Start < length(Editor.Text)) then |
|
- | 487 | TmpCharB := Editor.Text[Start + 1] |
|
- | 488 | else |
|
- | 489 | TmpCharB := #0; |
|
- | 490 | ||
- | 491 | if not IsCharBracket(TmpCharA) and not IsCharBracket(TmpCharB) then exit; |
|
- | 492 | S := TmpCharB; |
|
- | 493 | if not IsCharBracket(TmpCharB) then |
|
- | 494 | begin |
|
- | 495 | P.Char := P.Char - 1; |
|
- | 496 | S := TmpCharA; |
|
- | 497 | end; |
|
- | 498 | Editor.GetHighlighterAttriAtRowCol(P, S, Attri); |
|
- | 499 | ||
- | 500 | if (Editor.Highlighter.SymbolAttribute = Attri) then |
|
- | 501 | begin |
|
- | 502 | for i := low(OpenChars) to High(OpenChars) do |
|
- | 503 | begin |
|
- | 504 | if (S = OpenChars[i]) or (S = CloseChars[i]) then |
|
- | 505 | begin |
|
- | 506 | Pix := CharToPixels(P); |
|
- | 507 | ||
- | 508 | Editor.Canvas.Brush.Style := bsSolid;//Clear; |
|
- | 509 | Editor.Canvas.Font.Assign(Editor.Font); |
|
- | 510 | Editor.Canvas.Font.Style := Attri.Style; |
|
- | 511 | ||
- | 512 | if (TransientType = ttAfter) then |
|
- | 513 | begin |
|
- | 514 | Editor.Canvas.Font.Color := COLOR_FG; |
|
- | 515 | Editor.Canvas.Brush.Color := COLOR_BG; |
|
- | 516 | end |
|
- | 517 | else |
|
- | 518 | begin |
|
- | 519 | Editor.Canvas.Font.Color := Attri.Foreground; |
|
- | 520 | Editor.Canvas.Brush.Color := Attri.Background; |
|
- | 521 | end; |
|
- | 522 | if Editor.Canvas.Font.Color = clNone then |
|
- | 523 | Editor.Canvas.Font.Color := Editor.Font.Color; |
|
- | 524 | if Editor.Canvas.Brush.Color = clNone then |
|
- | 525 | Editor.Canvas.Brush.Color := Editor.Color; |
|
- | 526 | ||
- | 527 | Editor.Canvas.TextOut(Pix.X, Pix.Y, S); |
|
- | 528 | P := Editor.GetMatchingBracketEx(P); |
|
- | 529 | ||
- | 530 | if (P.Char > 0) and (P.Line > 0) then |
|
- | 531 | begin |
|
- | 532 | Pix := CharToPixels(P); |
|
- | 533 | if Pix.X > Editor.Gutter.Width then |
|
- | 534 | begin |
|
- | 535 | {$REGION 'Added by ViaThinkSoft'} |
|
- | 536 | if (TransientType = ttAfter) then |
|
- | 537 | begin |
|
- | 538 | Editor.Canvas.Font.Color := COLOR_FG; |
|
- | 539 | Editor.Canvas.Brush.Color := COLOR_BG; |
|
- | 540 | end |
|
- | 541 | else |
|
- | 542 | begin |
|
- | 543 | Editor.Canvas.Font.Color := Attri.Foreground; |
|
- | 544 | Editor.Canvas.Brush.Color := Attri.Background; |
|
- | 545 | end; |
|
- | 546 | if Editor.Canvas.Font.Color = clNone then |
|
- | 547 | Editor.Canvas.Font.Color := Editor.Font.Color; |
|
- | 548 | if Editor.Canvas.Brush.Color = clNone then |
|
- | 549 | Editor.Canvas.Brush.Color := Editor.Color; |
|
- | 550 | {$ENDREGION} |
|
- | 551 | if S = OpenChars[i] then |
|
- | 552 | Editor.Canvas.TextOut(Pix.X, Pix.Y, CloseChars[i]) |
|
- | 553 | else Editor.Canvas.TextOut(Pix.X, Pix.Y, OpenChars[i]); |
|
- | 554 | end; |
|
- | 555 | end; |
|
- | 556 | end; |
|
- | 557 | end; |
|
- | 558 | Editor.Canvas.Brush.Style := bsSolid; |
|
- | 559 | end; |
|
- | 560 | end; |
|
- | 561 | ||
416 | procedure TForm1.SynEditFocusTimerTimer(Sender: TObject); |
562 | procedure TForm1.SynEditFocusTimerTimer(Sender: TObject); |
417 | begin |
563 | begin |
418 | SynEditFocusTimer.Enabled := false; |
564 | SynEditFocusTimer.Enabled := false; |
419 | Button1.SetFocus; // Workaround for weird bug... This (and the timer) is necessary to get the focus to SynEdit1 |
565 | Button1.SetFocus; // Workaround for weird bug... This (and the timer) is necessary to get the focus to SynEdit1 |
420 | SynEdit1.SetFocus; |
566 | SynEdit1.SetFocus; |
Line 827... | Line 973... | ||
827 | {$ENDREGION} |
973 | {$ENDREGION} |
828 | 974 | ||
829 | result := cont; |
975 | result := cont; |
830 | end; |
976 | end; |
831 | 977 | ||
832 | function TForm1.InputRequestCallback: string; |
978 | function TForm1.InputRequestCallback: AnsiString; |
833 | begin |
979 | begin |
834 | result := SynEdit1.Text; |
980 | result := UTF8Encode(SynEdit1.Text); |
835 | end; |
981 | end; |
836 | 982 | ||
837 | procedure TForm1.OutputNotifyCallback(const data: string); |
983 | procedure TForm1.OutputNotifyCallback(const data: AnsiString); |
838 | begin |
984 | begin |
839 | TreeView1.FillWithFastPHPData(data); |
985 | TreeView1.FillWithFastPHPData(data); |
840 | end; |
986 | end; |
841 | 987 | ||
842 | end. |
988 | end. |