fixed resizing synedit

git-svn-id: trunk@5103 -
This commit is contained in:
mattias 2004-01-26 11:55:35 +00:00
parent bcaf17830b
commit 4a6d4fbb68
5 changed files with 53 additions and 24 deletions

View File

@ -2180,7 +2180,7 @@ var
begin
// Get the invalidated rect. Compute the invalid area in lines / columns.
{$IFDEF SYN_LAZARUS}
rcClip:=Rect(0,0,Width,Height);
rcClip:=Rect(0,0,ClientWidth,ClientHeight);
StartPaintBuffer(rcClip);
Include(fStateFlags,sfPainting);
{$ELSE}
@ -3213,15 +3213,22 @@ end;
{$IFDEF SYN_LAZARUS}
procedure TCustomSynEdit.StartPaintBuffer(const ClipRect: TRect);
var
NewBufferWidth: Integer;
NewBufferHeight: Integer;
begin
if (SavedCanvas<>nil) then RaiseGDBException('');
{$IFNDEF DisableDoubleBuf}
if BufferBitmap=nil then
BufferBitmap:=TBitmap.Create;
if BufferBitmap.Width<ClipRect.Right then
BufferBitmap.Width:=ClipRect.Right;
if BufferBitmap.Height<ClipRect.Bottom then
BufferBitmap.Height:=ClipRect.Bottom;
NewBufferWidth:=BufferBitmap.Width;
NewBufferHeight:=BufferBitmap.Height;
if NewBufferWidth<ClipRect.Right then
NewBufferWidth:=ClipRect.Right;
if NewBufferHeight<ClipRect.Bottom then
NewBufferHeight:=ClipRect.Bottom;
BufferBitmap.Width:=NewBufferWidth;
BufferBitmap.Height:=NewBufferHeight;
SavedCanvas:=Canvas;
Canvas:=BufferBitmap.Canvas;
{$ENDIF}
@ -3236,9 +3243,7 @@ begin
if not (SavedCanvas is TControlCanvas) then RaiseGDBException('');
Canvas:=SavedCanvas;
SavedCanvas:=nil;
//writeln('TCustomSynEdit.EndPaintBuffer A');
Canvas.CopyRect(ClipRect,BufferBitmap.Canvas,ClipRect);
//writeln('TCustomSynEdit.EndPaintBuffer END');
{$ENDIF}
end;

View File

@ -240,6 +240,7 @@ begin
end;
end;
// otherwise create a default handle
if (FImage.FHandle = 0) then begin
case PixelFormat of
pfDevice : n:= ScreenInfo.ColorDepth;
@ -569,12 +570,9 @@ begin
with FImage do
if (FDIB.dsbm.bmHeight <> NewHeight) or (FDIB.dsbm.bmWidth <> NewWidth) then
begin
FreeImage;
FDIB.dsbm.bmWidth := NewWidth;
FDIB.dsbm.bmHeight := NewHeight;
If (NewWidth > 0) and (NewHeight > 0) then
HandleNeeded
else
FreeImage;
Changed(Self);
end;
end;
@ -885,7 +883,7 @@ begin
with FImage do begin
FreeHandle;
FHandle:=Value;
FillChar(FDIB, sizeof(FDIB), 0);
FillChar(FDIB, SizeOf(FDIB), 0);
if FHandle <> 0 then
GetObject(FHandle, SizeOf(FDIB), @FDIB);
Changed(Self);
@ -1013,6 +1011,9 @@ end;
{ =============================================================================
$Log$
Revision 1.56 2004/01/26 11:55:35 mattias
fixed resizing synedit
Revision 1.55 2003/12/25 14:17:07 mattias
fixed many range check warnings

View File

@ -804,7 +804,7 @@ var
PS : PPaintStruct;
DC : TDeviceContext;
begin
if Msg^.Msg=LM_PAINT then begin
if (Msg^.Msg=LM_PAINT) or (Msg^.Msg=LM_INTERNALPAINT) then begin
If Msg^.LParam <> 0 then begin
PS := PPaintStruct(Msg^.LParam);
If Msg^.WParam<>0 then
@ -831,7 +831,7 @@ var
PS : PPaintStruct;
DC : TDeviceContext;
begin
if Msg^.Message=LM_PAINT then begin
if (Msg^.Message=LM_PAINT) or (Msg^.Message=LM_INTERNALPAINT) then begin
If Msg^.LParam <> 0 then begin
PS := PPaintStruct(Msg^.LParam);
If Msg^.WParam<>0 then
@ -2560,6 +2560,7 @@ begin
' Message=',GetMessageName(TLMessage(AMessage).Msg));
{$ENDIF}
if (TLMessage(AMessage).Msg=LM_PAINT)
or (TLMessage(AMessage).Msg=LM_INTERNALPAINT)
or (TLMessage(AMessage).Msg=LM_GtkPaint) then
CurrentSentPaintMessageTarget:=TObject(Target);
try
@ -3465,6 +3466,10 @@ procedure ConnectInternalWidgetsSignals(AWidget: PGtkWidget;
for DesignSignalType:=Low(TDesignSignalType) to High(TDesignSignalType) do
begin
if DesignSignalType=dstUnknown then continue;
if (not DesignSignalBefore[DesignSignalType])
and (not DesignSignalAfter[DesignSignalType]) then
continue;
DesignFlags:=[csfDesignOnly];
if DesignSignalAfter[DesignSignalType] then
Include(DesignFlags,csfAfter);
@ -6205,6 +6210,9 @@ end;
{ =============================================================================
$Log$
Revision 1.249 2004/01/26 11:55:35 mattias
fixed resizing synedit
Revision 1.248 2004/01/23 13:55:30 mattias
style widgets are now realized, so all values are initialized

View File

@ -435,28 +435,39 @@ type
TDesignSignalMask = longint;
const
DesignSignalNames: array[TDesignSignalType] of PChar = (
DesignSignalBefore: array[TDesignSignalType] of boolean = (
true, // dstUnknown
true, // dstMousePress
true, // dstMouseMotion
true, // dstMouseRelease
false, // dstDrawAfter
false // dstExposeAfter
);
DesignSignalAfter: array[TDesignSignalType] of boolean = (
false, // dstUnknown
false, // dstMousePress
false, // dstMouseMotion
false, // dstMouseRelease
false, // dstDrawAfter
false // dstExposeAfter
);
DesignSignalNames: array[TDesignSignalType] of PChar = (
'',
'button-press-event',
'motion-notify-event',
'button-release-event',
{$Ifdef GTK1}
'draw',
{$EndIf}
'expose-event'
);
DesignSignalAfter: array[TDesignSignalType] of boolean =
(false,false,false,false,{$Ifdef GTK1}true,{$EndIf}true);
DesignSignalFuncs: array[TDesignSignalType] of Pointer = (
nil,
@gtkMouseBtnPress,
@gtkMotionNotify,
@gtkMouseBtnRelease,
{$Ifdef GTK1}
@gtkDrawAfter,
{$EndIf}
@gtkExposeEventAfter
);

View File

@ -7448,7 +7448,8 @@ var
//and (TargetObject is TWinControl) then
// SendPaintMessagesForInternalWidgets(TWinControl(TargetObject));
end else
if (AMessage.Msg=LM_PAINT) and (AMessage.WParam<>0) then begin
if ((AMessage.Msg=LM_PAINT) or (AMessage.Msg=LM_INTERNALPAINT))
and (AMessage.WParam<>0) then begin
// free DC
ReleaseDC(0,AMessage.WParam);
AMessage.WParam:=0;
@ -7480,7 +7481,7 @@ begin
// deliver it
Result := DeliverMessage(Target, AMessage);
if (Msg=LM_PAINT) or (Msg=LM_GtkPaint) then begin
if (Msg=LM_PAINT) or (Msg=LM_INTERNALPAINT) or (Msg=LM_GtkPaint) then begin
DisposePaintMessage(Target,AMessage);
end;
end;
@ -8700,6 +8701,9 @@ end;
{ =============================================================================
$Log$
Revision 1.322 2004/01/26 11:55:35 mattias
fixed resizing synedit
Revision 1.321 2004/01/23 13:55:30 mattias
style widgets are now realized, so all values are initialized