MG: small bugfixes

git-svn-id: trunk@1887 -
This commit is contained in:
lazarus 2002-08-17 23:39:39 +00:00
parent 30ad4f3cd3
commit 2d99e6a27b

View File

@ -2503,74 +2503,76 @@ begin
WriteLn('WARNING: [TgtkObject.ExtTextOut] Uninitialized GC'); WriteLn('WARNING: [TgtkObject.ExtTextOut] Uninitialized GC');
Result := False; Result := False;
end end
else begin else if UseFont = nil then begin
If UseFont = nil then begin WriteLn('WARNING: [TgtkObject.ExtTextOut] Missing Font');
WriteLn('WARNING: [TgtkObject.ExtTextOut] Missing Font'); Result := False;
Result := False; end
end else if ((Options and (ETO_OPAQUE+ETO_CLIPPED)) <> 0)
else begin and (Rect=nil) then begin
// TODO: implement other parameters. WriteLn('WARNING: [TgtkObject.ExtTextOut] Rect=nil');
//ADC := SaveDC(DC); Result := False;
DCOrigin:=GetDCOffset(PDeviceContext(DC)); end else begin
if (Options and ETO_OPAQUE) <> 0 then // TODO: implement other parameters.
begin //ADC := SaveDC(DC);
Width := Rect^.Right - Rect^.Left; DCOrigin:=GetDCOffset(PDeviceContext(DC));
Height := Rect^.Bottom - Rect^.Top; if ((Options and ETO_OPAQUE) <> 0) then
gdk_gc_set_fill(GC, GDK_SOLID); begin
gdk_gc_set_foreground(GC, @CurrentBackColor); Width := Rect^.Right - Rect^.Left;
gdk_draw_rectangle(Drawable, GC, 1, Height := Rect^.Bottom - Rect^.Top;
Rect^.Left+DCOrigin.X, Rect^.Top+DCOrigin.Y, gdk_gc_set_fill(GC, GDK_SOLID);
Width, Height); gdk_gc_set_foreground(GC, @CurrentBackColor);
end; gdk_draw_rectangle(Drawable, GC, 1,
if (Options and ETO_CLIPPED) <> 0 then Rect^.Left+DCOrigin.X, Rect^.Top+DCOrigin.Y,
begin Width, Height);
X := Rect^.Left;
Y := Rect^.Top;
IntersectClipRect(DC, Rect^.Left, Rect^.Top, Rect^.Right,
Rect^.Bottom);
end;
Num := FindChar(#10,Str,Count);
AY := Y;
GetTextMetrics(DC, TM);
TxtPt.X := X;
{$IfDef Win32}
TxtPt.Y := AY + TM.tmHeight div 2;
{$Else}
TxtPt.Y := AY + TM.tmAscent;
{$EndIf}
SelectGDKTextProps(DC);
if Num < 0 then begin
if Count> 0 then
gdk_draw_text(Drawable, UseFont, GC,
TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count);
end else
Begin //write multiple lines
LineStart:=Str;
StrEnd:=Str+Count;
while LineStart < StrEnd do begin
LineEnd:=LineStart+Num;
if Num>0 then
gdk_draw_text(Drawable, UseFont, GC,
TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, LineStart, Num);
AY := TxtPt.Y;
{$IfDef Win32}
TxtPt.Y := AY + TM.tmHeight div 2;
{$Else}
TxtPt.Y := AY + TM.tmAscent;
{$EndIf}
LineStart:=LineEnd+1; // skip #10
if (LineStart<StrEnd) and (LineStart^=#13) then
inc(LineStart); // skip #10
Count:=StrEnd-LineStart;
Num:=FindChar(#10,LineStart,Count);
if Num<0 then
Num:=Count;
end;
end;
//RestoreDC(DC, ADC);
If UnRef then
GDK_Font_UnRef(UseFont);
end; end;
if (Options and ETO_CLIPPED) <> 0 then
begin
X := Rect^.Left;
Y := Rect^.Top;
IntersectClipRect(DC, Rect^.Left, Rect^.Top,
Rect^.Right, Rect^.Bottom);
end;
Num := FindChar(#10,Str,Count);
AY := Y;
GetTextMetrics(DC, TM);
TxtPt.X := X;
{$IfDef Win32}
TxtPt.Y := AY + TM.tmHeight div 2;
{$Else}
TxtPt.Y := AY + TM.tmAscent;
{$EndIf}
SelectGDKTextProps(DC);
if Num < 0 then begin
if Count> 0 then
gdk_draw_text(Drawable, UseFont, GC,
TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count);
end else
Begin //write multiple lines
LineStart:=Str;
StrEnd:=Str+Count;
while LineStart < StrEnd do begin
LineEnd:=LineStart+Num;
if Num>0 then
gdk_draw_text(Drawable, UseFont, GC,
TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, LineStart, Num);
AY := TxtPt.Y;
{$IfDef Win32}
TxtPt.Y := AY + TM.tmHeight div 2;
{$Else}
TxtPt.Y := AY + TM.tmAscent;
{$EndIf}
LineStart:=LineEnd+1; // skip #10
if (LineStart<StrEnd) and (LineStart^=#13) then
inc(LineStart); // skip #10
Count:=StrEnd-LineStart;
Num:=FindChar(#10,LineStart,Count);
if Num<0 then
Num:=Count;
end;
end;
//RestoreDC(DC, ADC);
If UnRef then
GDK_Font_UnRef(UseFont);
end; end;
end; end;
Assert(False, Format('trace:< [TgtkObject.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count])); Assert(False, Format('trace:< [TgtkObject.ExtTextOut] DC:0x%x, X:%d, Y:%d, Options:%d, Str:''%s'', Count: %d', [DC, X, Y, Options, Str, Count]));
@ -5926,13 +5928,14 @@ begin
Page_Increment := nPage; Page_Increment := nPage;
end; end;
{writeln('[TgtkObject.SetScrollInfo] Result=',Result, {writeln('');
' Lower=',round(Lower), writeln('[TgtkObject.SetScrollInfo] Result=',Result,
' Upper=',round(Upper), ' Lower=',round(Lower),
' Page_Size=',round(Page_Size), ' Upper=',round(Upper),
' Page_Increment=',round(Page_Increment), ' Page_Size=',round(Page_Size),
' bRedraw=',bRedraw, ' Page_Increment=',round(Page_Increment),
' Handle=',HexStr(Cardinal(Handle),8));} ' bRedraw=',bRedraw,
' Handle=',HexStr(Cardinal(Handle),8));}
// do we have to set this allways ? // do we have to set this allways ?
if bRedraw then if bRedraw then
@ -5961,14 +5964,15 @@ begin
gtk_widget_hide(PGTKWidget(Scroll)) gtk_widget_hide(PGTKWidget(Scroll))
end; end;
end; end;
{ writeln('TgtkObject.SetScrollInfo: ', {writeln('');
' lower=',lower,'/',nMin, writeln('TgtkObject.SetScrollInfo: ',
' upper=',upper,'/',nMax, ' lower=',round(lower),'/',nMin,
' value=',value,'/',nPos, ' upper=',round(upper),'/',nMax,
' step_increment=',step_increment,'/',1, ' value=',round(value),'/',nPos,
' page_increment=',page_increment,'/',nPage, ' step_increment=',round(step_increment),'/',1,
' page_size=',page_size,'/',nPage, ' page_increment=',round(page_increment),'/',nPage,
'');} ' page_size=',round(page_size),'/',nPage,
'');}
gtk_adjustment_changed(Adjustment); gtk_adjustment_changed(Adjustment);
end; end;
@ -6955,6 +6959,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.131 2002/09/12 15:35:57 lazarus
MG: small bugfixes
Revision 1.130 2002/09/12 05:56:17 lazarus Revision 1.130 2002/09/12 05:56:17 lazarus
MG: gradient fill, minor issues from Andrew MG: gradient fill, minor issues from Andrew