mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-31 18:12:34 +02:00
renamed DrawByRows to DrawAllRows
git-svn-id: trunk@8644 -
This commit is contained in:
parent
ee01d36329
commit
0c9ab7d58b
@ -1,9 +1,11 @@
|
||||
object MessagesView: TMessagesView
|
||||
ActiveControl = MessageView
|
||||
BorderStyle = bsSizeToolWin
|
||||
Caption = 'MessagesView'
|
||||
ClientHeight = 79
|
||||
ClientWidth = 722
|
||||
KeyPreview = True
|
||||
OnDeactivate = FormDeactivate
|
||||
OnKeyDown = MessagesViewKeyDown
|
||||
PixelsPerInch = 112
|
||||
HorzScrollBar.Page = 721
|
||||
@ -15,6 +17,7 @@ object MessagesView: TMessagesView
|
||||
object MessageView: TListBox
|
||||
Align = alClient
|
||||
MultiSelect = True
|
||||
OnExit = MessageViewExit
|
||||
PopupMenu = MainPopupMenu
|
||||
TabOrder = 0
|
||||
TopIndex = -1
|
||||
|
@ -1,12 +1,14 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TMessagesView','FORMDATA',[
|
||||
'TPF0'#13'TMessagesView'#12'MessagesView'#11'BorderStyle'#7#13'bsSizeToolWin'
|
||||
+#7'Caption'#6#12'MessagesView'#12'ClientHeight'#2'O'#11'ClientWidth'#3#210#2
|
||||
+#10'KeyPreview'#9#9'OnKeyDown'#7#19'MessagesViewKeyDown'#13'PixelsPerInch'#2
|
||||
'TPF0'#13'TMessagesView'#12'MessagesView'#13'ActiveControl'#7#11'MessageView'
|
||||
+#11'BorderStyle'#7#13'bsSizeToolWin'#7'Caption'#6#12'MessagesView'#12'Client'
|
||||
+'Height'#2'O'#11'ClientWidth'#3#210#2#10'KeyPreview'#9#12'OnDeactivate'#7#14
|
||||
+'FormDeactivate'#9'OnKeyDown'#7#19'MessagesViewKeyDown'#13'PixelsPerInch'#2
|
||||
+'p'#18'HorzScrollBar.Page'#3#209#2#18'VertScrollBar.Page'#2'N'#4'Left'#3#6#1
|
||||
+#6'Height'#2'O'#3'Top'#3#6#2#5'Width'#3#210#2#0#8'TListBox'#11'MessageView'#5
|
||||
+'Align'#7#8'alClient'#11'MultiSelect'#9#9'PopupMenu'#7#13'MainPopupMenu'#8'T'
|
||||
+'abOrder'#2#0#8'TopIndex'#2#255#6'Height'#2'O'#5'Width'#3#210#2#0#0#10'TPopu'
|
||||
+'pMenu'#13'MainPopupMenu'#4'left'#2'.'#3'top'#2')'#0#0#0
|
||||
+'Align'#7#8'alClient'#11'MultiSelect'#9#6'OnExit'#7#15'MessageViewExit'#9'Po'
|
||||
+'pupMenu'#7#13'MainPopupMenu'#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'#2
|
||||
+'O'#5'Width'#3#210#2#0#0#10'TPopupMenu'#13'MainPopupMenu'#4'left'#2'.'#3'top'
|
||||
+#2')'#0#0#0
|
||||
]);
|
||||
|
@ -90,9 +90,11 @@ type
|
||||
procedure CopyAllMenuItemClick(Sender: TObject);
|
||||
procedure CopyAllAndHiddenMenuItemClick(Sender: TObject);
|
||||
procedure CopyMenuItemClick(Sender: TObject);
|
||||
procedure FormDeactivate(Sender: TObject);
|
||||
procedure HelpMenuItemClick(Sender: TObject);
|
||||
procedure MessageViewDblClicked(Sender: TObject);
|
||||
procedure MessageViewClicked(Sender: TObject);
|
||||
procedure MessageViewExit(Sender: TObject);
|
||||
procedure MessagesViewKeyDown(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState);
|
||||
procedure MessageViewDrawItem(Control: TWinControl; Index: Integer;
|
||||
@ -512,6 +514,11 @@ begin
|
||||
Clipboard.AsText := MessageView.GetSelectedText;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.FormDeactivate(Sender: TObject);
|
||||
begin
|
||||
FLastSelectedIndex:=-1;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.HelpMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
ExecuteIDECommand(Self, ecContextHelp);
|
||||
@ -524,6 +531,11 @@ begin
|
||||
DoSelectionChange;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.MessageViewExit(Sender: TObject);
|
||||
begin
|
||||
FLastSelectedIndex:=-1;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
|
@ -321,7 +321,7 @@ type
|
||||
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
|
||||
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
|
||||
procedure DoOnChangeBounds; override;
|
||||
procedure DrawByRows; override;
|
||||
procedure DrawAllRows; override;
|
||||
procedure DrawFocusRect(aCol,aRow:Integer; ARect:TRect); override;
|
||||
procedure DrawRow(ARow: Integer); override;
|
||||
procedure DrawCell(aCol,aRow: Integer; aRect: TRect; aState:TGridDrawState); override;
|
||||
@ -2196,7 +2196,7 @@ begin
|
||||
{$ifdef dbgdbgrid}DebugLn('DbGrid.MoveSelection FIN');{$Endif}
|
||||
end;
|
||||
|
||||
procedure TCustomDbGrid.DrawByRows;
|
||||
procedure TCustomDbGrid.DrawAllRows;
|
||||
var
|
||||
CurActiveRecord: Integer;
|
||||
begin
|
||||
@ -2204,7 +2204,7 @@ begin
|
||||
CurActiveRecord:=FDataLink.ActiveRecord;
|
||||
end;
|
||||
try
|
||||
inherited DrawByRows;
|
||||
inherited DrawAllRows;
|
||||
finally
|
||||
if FDataLink.Active then
|
||||
FDataLink.ActiveRecord:=CurActiveRecord;
|
||||
|
120
lcl/grids.pas
120
lcl/grids.pas
@ -472,7 +472,7 @@ type
|
||||
ClientHeight: Integer; // Height-HorzScrollbar.Size
|
||||
ScrollWidth: Integer; // ClientWidth-FixedWidth
|
||||
ScrollHeight: Integer; // ClientHeight-FixedHeight
|
||||
VisibleGrid: TRect; // Visible non fixed rectagle of cells
|
||||
VisibleGrid: TRect; // Visible non fixed rectangle of cellcoordinates
|
||||
MaxClientXY: Tpoint; // VisibleGrid.BottomRight (pixel) coordinates
|
||||
ValidRows: boolean; // true if there are not fixed columns to show
|
||||
ValidCols: boolean; // true if there are not fixed rows to show
|
||||
@ -687,7 +687,7 @@ type
|
||||
procedure DoPasteFromClipboard; virtual;
|
||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
|
||||
procedure DrawBorder;
|
||||
procedure DrawByRows; virtual;
|
||||
procedure DrawAllRows; virtual;
|
||||
procedure DrawCell(aCol,aRow:Integer; aRect:TRect; aState:TGridDrawState); virtual;
|
||||
procedure DrawCellGrid(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState); virtual;
|
||||
procedure DrawCellText(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState; aText: String); virtual;
|
||||
@ -1711,6 +1711,7 @@ begin
|
||||
CheckFixedCount(ColCount, RowCount, FFixedCols, AValue);
|
||||
FFixedRows:=AValue;
|
||||
fTopLeft.y:=AValue;
|
||||
//DebugLn('TCustomGrid.SetFixedRows ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
FRow:=AValue;
|
||||
UpdateSelectionRange;
|
||||
if not (csLoading in ComponentState) then
|
||||
@ -1805,6 +1806,7 @@ begin
|
||||
if RowCount=0 then begin
|
||||
FFixedRows:=0;
|
||||
FTopLeft.Y:=0;
|
||||
//DebugLn('TCustomGrid.AdjustCount A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
AddDel(FRows, 1);
|
||||
FGCache.AccumHeight.Count:=1;
|
||||
end;
|
||||
@ -1816,6 +1818,7 @@ begin
|
||||
OldCount:=ColCount;
|
||||
if (OldValue=0)and(NewValue>=0) then begin
|
||||
FTopleft.Y:=FFixedRows;
|
||||
//DebugLn('TCustomGrid.AdjustCount B ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
if FCols.Count=0 then begin
|
||||
FFixedCols:=0;
|
||||
FTopLeft.X:=0;
|
||||
@ -2286,7 +2289,6 @@ var
|
||||
OldTopLeft:TPoint;
|
||||
Xinc,YInc: Integer;
|
||||
begin
|
||||
|
||||
OldTopLeft:=fTopLeft;
|
||||
|
||||
while (fTopLeft.x>=0) and
|
||||
@ -2300,7 +2302,7 @@ begin
|
||||
if Rnew.Left + FGCache.TLColOff < FGCache.FixedWidth then Xinc:=-1
|
||||
else if RNew.Right + FGCache.TLColOff > FGCache.ClientWidth then XInc:=1;
|
||||
Yinc:=0;
|
||||
if RNew.Top + FGCAche.TLRowOff < FGcache.FixedHeight then Yinc:=-1
|
||||
if RNew.Top + FGCache.TLRowOff < FGCache.FixedHeight then Yinc:=-1
|
||||
else if RNew.Bottom + FGCache.TLRowOff > FGCache.ClientHeight then YInc:=1;
|
||||
|
||||
with FTopLeft do
|
||||
@ -2316,6 +2318,7 @@ begin
|
||||
Inc(FTopLeft.x, XInc);
|
||||
Inc(FTopLeft.y, YInc);
|
||||
end;
|
||||
//DebugLn('TCustomGrid.ScrollToCell A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
|
||||
Result:=not PointIgual(OldTopleft,FTopLeft);
|
||||
if result then doTopleftChange(False)
|
||||
@ -2389,7 +2392,7 @@ begin
|
||||
inherited Paint;
|
||||
if FUpdateCount=0 then begin
|
||||
DrawEdges;
|
||||
DrawByRows;
|
||||
DrawAllRows;
|
||||
DrawColRowMoving;
|
||||
DrawBorder;
|
||||
end;
|
||||
@ -2604,7 +2607,7 @@ begin
|
||||
DrawCellGrid(aCol,aRow,aRect,aState);
|
||||
end;
|
||||
|
||||
procedure TCustomGrid.DrawByRows;
|
||||
procedure TCustomGrid.DrawAllRows;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
@ -2880,7 +2883,7 @@ begin
|
||||
if FEditor<>nil then
|
||||
EditorGetValue;
|
||||
|
||||
TL:= PtrInt(FGCache.AccumWidth[ FGCache.MaxTopLeft.X ]) - FGCAche.FixedWidth;
|
||||
TL:= PtrInt(FGCache.AccumWidth[ FGCache.MaxTopLeft.X ]) - FGCache.FixedWidth;
|
||||
CTL:= PtrInt(FGCache.AccumWidth[ FtopLeft.X ]) - FGCache.FixedWidth;
|
||||
|
||||
case message.ScrollCode of
|
||||
@ -2959,7 +2962,7 @@ begin
|
||||
EditorGetValue;
|
||||
|
||||
TL:= PtrInt(FGCache.AccumHeight[ FGCache.MaxTopLeft.Y ]) - FGCache.FixedHeight;
|
||||
CTL:= PtrInt(FGCache.AccumHeight[ FtopLeft.Y ]) - FGCache.FixedHeight;
|
||||
CTL:= PtrInt(FGCache.AccumHeight[ FTopLeft.Y ]) - FGCache.FixedHeight;
|
||||
|
||||
case message.ScrollCode of
|
||||
// Scrolls to start / end of the text
|
||||
@ -2983,7 +2986,7 @@ begin
|
||||
SB_ENDSCROLL: Exit;
|
||||
end;
|
||||
|
||||
if C > Tl then C := TL else
|
||||
if C > TL then C := TL else
|
||||
if C < 0 then C := 0;
|
||||
|
||||
{$Ifdef dbgScroll}
|
||||
@ -3085,6 +3088,7 @@ begin
|
||||
TryTL:=ScrollGrid(False,aCol, aRow);
|
||||
if not PointIgual(TryTL, FTopLeft) then begin
|
||||
FTopLeft:=TryTL;
|
||||
//DebugLn('TCustomGrid.TryScrollTo A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
doTopleftChange(False);
|
||||
end;
|
||||
end;
|
||||
@ -3221,21 +3225,24 @@ begin
|
||||
OldTopLeft := FTopLeft;
|
||||
Result:= False;
|
||||
|
||||
with FTopleft do
|
||||
if CheckCols and (X>FixedCols) then begin
|
||||
W := FGCache.ScrollWidth-ColWidths[aCol]-PtrInt(FGCache.AccumWidth[aCol]);
|
||||
while (x>FixedCols)and(W+PtrInt(FGCache.AccumWidth[x])>=ColWidths[x-1]) do
|
||||
begin
|
||||
Dec(x);
|
||||
with FTopleft do begin
|
||||
if CheckCols and (X>FixedCols) then begin
|
||||
W := FGCache.ScrollWidth-ColWidths[aCol]-PtrInt(FGCache.AccumWidth[aCol]);
|
||||
while (x>FixedCols)and(W+PtrInt(FGCache.AccumWidth[x])>=ColWidths[x-1]) do
|
||||
begin
|
||||
Dec(x);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
with FTopleft do
|
||||
if CheckRows and (Y > FixedRows) then begin
|
||||
W := FGCache.ScrollHeight-RowHeights[aRow]-PtrInt(FGCache.AccumHeight[aRow]);
|
||||
while (y>FixedRows)and(W+PtrInt(FGCache.AccumHeight[y])>=RowHeights[y-1]) do
|
||||
begin
|
||||
Dec(y);
|
||||
with FTopleft do begin
|
||||
if CheckRows and (Y > FixedRows) then begin
|
||||
W := FGCache.ScrollHeight-RowHeights[aRow]-PtrInt(FGCache.AccumHeight[aRow]);
|
||||
while (y>FixedRows)and(W+PtrInt(FGCache.AccumHeight[y])>=RowHeights[y-1]) do
|
||||
begin
|
||||
Dec(y);
|
||||
end;
|
||||
//DebugLn('TCustomGrid.CheckTopLeft A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3641,43 +3648,45 @@ begin
|
||||
Offset := Offset - GetBorderWidth;
|
||||
if Offset<0 then Exit; // Out of Range;
|
||||
|
||||
with FGCache do
|
||||
if IsCol then begin
|
||||
// begin to count Cols from 0 but ...
|
||||
if Fisical and (Offset>FixedWidth-1) then begin
|
||||
Index := FTopLeft.X; // In scrolled view, then begin from FtopLeft col
|
||||
if (Index>=0) and (Index<ColCount) then
|
||||
Offset:=Offset-FixedWidth+PtrInt(AccumWidth[Index])+TLColOff;
|
||||
if (Index<0) or (Index>=ColCount) or (Offset>GridWidth-1) then begin
|
||||
Index := ColCount-1;
|
||||
exit;
|
||||
with FGCache do begin
|
||||
if IsCol then begin
|
||||
// begin to count Cols from 0 but ...
|
||||
if Fisical and (Offset>FixedWidth-1) then begin
|
||||
Index := FTopLeft.X; // In scrolled view, then begin from FTopLeft col
|
||||
if (Index>=0) and (Index<ColCount) then
|
||||
Offset:=Offset-FixedWidth+PtrInt(AccumWidth[Index])+TLColOff;
|
||||
if (Index<0) or (Index>=ColCount) or (Offset>GridWidth-1) then begin
|
||||
Index := ColCount-1;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
while Offset>(PtrInt(AccumWidth[Index])+GetColWidths(Index)-1) do
|
||||
Inc(Index);
|
||||
while Offset>(PtrInt(AccumWidth[Index])+GetColWidths(Index)-1) do
|
||||
Inc(Index);
|
||||
|
||||
Rest:=Offset;
|
||||
if Index<>0 then Rest:=Offset-PtrInt(AccumWidth[Index]);
|
||||
Rest:=Offset;
|
||||
if Index<>0 then Rest:=Offset-PtrInt(AccumWidth[Index]);
|
||||
|
||||
end else begin
|
||||
end else begin
|
||||
|
||||
if Fisical and (Offset>FixedHeight-1) then begin
|
||||
Index:=FTopLeft.Y;
|
||||
if (Index>=0) and (Index<RowCount) then
|
||||
Offset:=Offset-FixedHeight+PtrInt(AccumHeight[Index])+TLRowOff;
|
||||
if (Index<0) or (Index>=RowCount) or (Offset>GridHeight-1) then begin
|
||||
Index:=RowCount-1;
|
||||
Exit; // Out of Range
|
||||
//DebugLn('TCustomGrid.OffsetToColRow ',DbgSName(Self),' Fisical=',dbgs(Fisical),' Offset=',dbgs(Offset),' FixedHeight=',dbgs(FixedHeight),' FTopLeft=',dbgs(FTopLeft),' RowCount=',dbgs(RowCount),' TLRowOff=',dbgs(TLRowOff));
|
||||
if Fisical and (Offset>FixedHeight-1) then begin
|
||||
Index:=FTopLeft.Y;
|
||||
if (Index>=0) and (Index<RowCount) then
|
||||
Offset:=Offset-FixedHeight+PtrInt(AccumHeight[Index])+TLRowOff;
|
||||
if (Index<0) or (Index>=RowCount) or (Offset>GridHeight-1) then begin
|
||||
Index:=RowCount-1;
|
||||
Exit; // Out of Range
|
||||
end;
|
||||
end;
|
||||
|
||||
while Offset>(PtrInt(AccumHeight[Index])+GetRowHeights(Index)-1) do
|
||||
Inc(Index);
|
||||
|
||||
Rest:=Offset;
|
||||
if Index<>0 then Rest:=Offset-PtrInt(AccumHeight[Index]);
|
||||
|
||||
end;
|
||||
|
||||
while Offset>(PtrInt(AccumHeight[Index])+GetRowHeights(Index)-1) do
|
||||
Inc(Index);
|
||||
|
||||
Rest:=Offset;
|
||||
if Index<>0 then Rest:=Offset-PtrInt(AccumHeight[Index]);
|
||||
|
||||
end;
|
||||
result := True;
|
||||
end;
|
||||
@ -3888,6 +3897,7 @@ procedure TCustomGrid.DoOPDeleteColRow(IsColumn: Boolean; index: Integer);
|
||||
if Index<FixedRows then begin
|
||||
Dec(FFixedRows);
|
||||
FTopLeft.y := FFixedRows;
|
||||
//DebugLn('TCustomGrid.doDeleteColumn A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
end;
|
||||
FRows.Delete(Index);
|
||||
FGCache.AccumHeight.Delete(Index);
|
||||
@ -4261,7 +4271,7 @@ procedure TCustomGrid.DoEditorShow;
|
||||
begin
|
||||
{$ifdef dbgGrid}DebugLn('grid.DoEditorShow INIT');{$endif}
|
||||
ScrollToCell(FCol,FRow);
|
||||
Editor.parent := nil;
|
||||
Editor.Parent := nil;
|
||||
EditorSetValue;
|
||||
Editor.Parent:=Self;
|
||||
Editor.Visible:=True;
|
||||
@ -4312,6 +4322,7 @@ begin
|
||||
end else begin
|
||||
{$IfDef dbgGrid}DebugLn('DoEnter - Ext');{$Endif}
|
||||
if EditorAlwaysShown then begin
|
||||
|
||||
SelectEditor;
|
||||
if Feditor<>nil then
|
||||
EditorShow(true);
|
||||
@ -4490,9 +4501,9 @@ end;
|
||||
|
||||
procedure TCustomGrid.MouseToCell(X, Y: Integer; var ACol, ARow: Longint);
|
||||
var
|
||||
dummy: Integer;
|
||||
dummy: Integer;
|
||||
begin
|
||||
//TODO: Raise Exception if out of range?,
|
||||
// Do not raise Exception if out of range
|
||||
OffsetToColRow(True, True, X, ACol, dummy);
|
||||
OffsetToColRow(False,True, Y, ARow, dummy);
|
||||
end;
|
||||
@ -5207,6 +5218,7 @@ procedure TCustomGrid.FixPosition;
|
||||
end;
|
||||
if not PointIgual(OldTL, FTopleft) then begin
|
||||
fTopLeft := OldTL;
|
||||
//DebugLn('TCustomGrid.FixPosition ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
|
||||
topleftChanged;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user