From 7dc9c2a8a2d93052727a8cb55679a97fc98e3cb6 Mon Sep 17 00:00:00 2001 From: macpgmr Date: Sat, 5 Dec 2009 23:25:47 +0000 Subject: [PATCH] Win32 and GTK2 widgetset endless loop eliminated git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1033 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/thtmlport/demo_src/fdemunit.pas | 26 +++++++++++++++++----- components/thtmlport/demo_src/fontdlg.pas | 11 +++++++++ components/thtmlport/package/htmlcomp.lpk | 2 +- components/thtmlport/package/htmlview.pas | 6 +++-- components/thtmlport/package/styleun.pas | 10 +++++++++ 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/components/thtmlport/demo_src/fdemunit.pas b/components/thtmlport/demo_src/fdemunit.pas index 6ccb51280..3adbbf8ff 100755 --- a/components/thtmlport/demo_src/fdemunit.pas +++ b/components/thtmlport/demo_src/fdemunit.pas @@ -275,7 +275,11 @@ if (I <= 2) or (J > 0) then ShellExecute(Handle, nil, StrPCopy(PC, S), StrPCopy(PC2, Params), nil, SW_SHOWNORMAL); {$ELSE} - Shell('Open ' + S); + {$IFDEF LCLCarbon} + Shell('Open "' + S + '.app"'); + {$ELSE} + Shell('"' + S + '" "' + Params + '"'); + {$ENDIF} {$ENDIF} {$ENDIF} end @@ -304,7 +308,11 @@ if (I > 0) or (J > 0) then {$IFDEF MSWINDOWS} ShellExecute(Handle, nil, StrPCopy(PC, URL), nil, nil, SW_SHOWNORMAL); {$ELSE} - Shell('Open ' + URL); + {$IFDEF LCLCarbon} + Shell('Open "' + URL + '.app"'); + {$ELSE} + Shell('"' + URL + '"'); + {$ENDIF} {$ENDIF} Handled := True; Exit; @@ -355,7 +363,7 @@ var S: string; I: integer; begin -{$IFNDEF DARWIN} //Launched file name not passed via command line with OS X. +{$IFNDEF LCLCarbon} //Launched file name not passed via command line with app bundle. if (ParamCount >= 1) then begin {Parameter is file to load} {$IFNDEF LCL} @@ -605,7 +613,11 @@ if FileExists(S) then ShellExecute(Handle, nil, StrPCopy(PC, ParamStr(0)), StrPCopy(PC2, S+Dest), nil, SW_SHOWNORMAL); {$ELSE} - Shell('Open ' + ParamStr(0)); + {$IFDEF LCLCarbon} + Shell('Open "' + ParamStr(0) + '.app"'); + {$ELSE} + Shell('"' + ParamStr(0) + '" "' + S+Dest + '"'); + {$ENDIF} {$ENDIF} {$ENDIF} end; @@ -838,7 +850,11 @@ begin ShellExecute(Handle, nil, StrPCopy(PC, ParamStr(0)), StrPCopy(PC2, NewWindowFile), nil, SW_SHOWNORMAL); {$ELSE} - Shell('Open ' + ParamStr(0)); + {$IFDEF LCLCarbon} + Shell('Open "' + ParamStr(0) + '.app"'); + {$ELSE} + Shell('"' + ParamStr(0) + '" "' + NewWindowFile + '"'); + {$ENDIF} {$ENDIF} {$ENDIF} end; diff --git a/components/thtmlport/demo_src/fontdlg.pas b/components/thtmlport/demo_src/fontdlg.pas index e1045859b..8e3a49dd5 100755 --- a/components/thtmlport/demo_src/fontdlg.pas +++ b/components/thtmlport/demo_src/fontdlg.pas @@ -101,6 +101,13 @@ end; function TFontForm.GetFontName: TFontName; begin +{$IFNDEF MSWINDOWS} + if Screen.Fonts.Count = 0 then //GTK2 without HasX defined (empty list)? + begin + Result := FontViewer.DefFontName; + Exit; + end; +{$ENDIF} try Result := FontListBox.Items[FontListBox.ItemIndex]; except @@ -118,6 +125,7 @@ if I < 0 then {$IFNDEF MSWINDOWS} //System font only makes sense on Windows, so just select first font if I < 0 then I := 0; +if Screen.Fonts.Count > 0 then //Check in case GTK2 without HasX defined {$ENDIF} FontListBox.ItemIndex := I; FontViewer.DefFontName := Value; @@ -212,6 +220,9 @@ end; procedure TFontForm.ListBoxClicks(Sender: TObject); begin if Sender = FontListBox then +{$IFNDEF MSWINDOWS} + if Screen.Fonts.Count = 0 then else //Check in case GTK2 without HasX defined +{$ENDIF} FontName := FontListBox.Items[FontListBox.ItemIndex] else if Sender = BackListBox then Background := StringToColor(BackListBox.Items[BackListBox.ItemIndex]) diff --git a/components/thtmlport/package/htmlcomp.lpk b/components/thtmlport/package/htmlcomp.lpk index 9fc411e4c..06cd95475 100644 --- a/components/thtmlport/package/htmlcomp.lpk +++ b/components/thtmlport/package/htmlcomp.lpk @@ -26,7 +26,7 @@ - + diff --git a/components/thtmlport/package/htmlview.pas b/components/thtmlport/package/htmlview.pas index aa159a6f3..46c36c56c 100755 --- a/components/thtmlport/package/htmlview.pas +++ b/components/thtmlport/package/htmlview.pas @@ -4333,7 +4333,7 @@ end; procedure ThtmlViewer.PaintWindow(DC: HDC); begin PaintPanel.RePaint; -BorderPanel.RePaint; +BorderPanel.RePaint; VScrollbar.RePaint; HScrollbar.RePaint; end; @@ -5049,7 +5049,9 @@ var begin if FViewer.DontDraw or (Canvas2 <> Nil) then Exit; -FViewer.DrawBorder; +{$IFNDEF LCL} +FViewer.DrawBorder; //Causes endless loop for some reason on win32 and gtk2. +{$ENDIF} OldPal := 0; Canvas.Font := Font; Canvas.Brush.Color := Color; diff --git a/components/thtmlport/package/styleun.pas b/components/thtmlport/package/styleun.pas index 9c51430f2..e93c67353 100644 --- a/components/thtmlport/package/styleun.pas +++ b/components/thtmlport/package/styleun.pas @@ -1650,6 +1650,11 @@ Done := False; S1 := NextFontName; while (S1 <> '') and not Done do begin +{$IFDEF LCL} //Generic2 fonts won't be in Screen.Fonts with GTK2, so make + // sure first font for family is selected. + if Result = '' then + Result := S1; +{$ENDIF} Done := Screen.Fonts.IndexOf(S1) >= 0; if Done then Result := S1 @@ -1725,6 +1730,11 @@ S := Props[FontFamily]; S1 := NextFontName; while (S1 <> '') and not Done do begin +{$IFDEF LCL} //Generic2 fonts won't be in Screen.Fonts with GTK2, so make + // sure first font for family is selected. + if Font.iName = '' then + Font.iName := S1; +{$ENDIF} Done := Screen.Fonts.IndexOf(S1) >= 0; if Done then begin