Skip to content

Commit 40869f3

Browse files
committed
Package form: Dont expand all release notes
1 parent 9d240e1 commit 40869f3

File tree

2 files changed

+116
-64
lines changed

2 files changed

+116
-64
lines changed

Source/ide/simba.form_package.lfm

Lines changed: 59 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
object SimbaPackageForm: TSimbaPackageForm
22
Left = -1860
3-
Height = 550
3+
Height = 962
44
Top = 325
5-
Width = 782
5+
Width = 1368
66
Caption = 'Simba Packages'
7-
ClientHeight = 0
8-
ClientWidth = 0
9-
Constraints.MinHeight = 250
10-
Constraints.MinWidth = 250
11-
OnShow = FormShow
7+
ClientHeight = 962
8+
ClientWidth = 1368
9+
Constraints.MinHeight = 438
10+
Constraints.MinWidth = 438
11+
DesignTimePPI = 168
1212
Position = poMainFormCenter
1313
ShowInTaskBar = stAlways
14-
LCLVersion = '3.8.0.0'
14+
OnShow = FormShow
1515
object Notebook1: TNotebook
1616
Left = 0
17-
Height = 477
17+
Height = 873
1818
Top = 0
19-
Width = 782
19+
Width = 1368
2020
PageIndex = 0
2121
Align = alClient
2222
TabOrder = 0
2323
object MainPage: TPage
2424
object ListPanel: TPanel
2525
Left = 0
26-
Height = 314
26+
Height = 550
2727
Top = 0
28-
Width = 782
28+
Width = 1368
2929
Align = alTop
3030
BevelOuter = bvNone
3131
TabOrder = 0
3232
end
3333
object BottomNotebook: TNotebook
3434
Left = 0
35-
Height = 158
36-
Top = 319
37-
Width = 782
35+
Height = 314
36+
Top = 559
37+
Width = 1368
3838
PageIndex = 0
3939
Align = alClient
4040
TabOrder = 1
4141
object PageVersions: TPage
4242
object ScrollBox1: TScrollBox
4343
Left = 0
44-
Height = 158
44+
Height = 314
4545
Top = 0
46-
Width = 782
46+
Width = 1368
4747
HorzScrollBar.Increment = 1
4848
HorzScrollBar.Page = 1
4949
HorzScrollBar.Smooth = True
@@ -66,16 +66,16 @@ object SimbaPackageForm: TSimbaPackageForm
6666
Top = 12
6767
Width = 954
6868
Align = alClient
69-
BorderSpacing.Around = 10
70-
Font.Height = -10
69+
BorderSpacing.Around = 18
70+
Font.Height = -18
7171
Font.Name = 'Courier New'
7272
Font.Pitch = fpFixed
7373
Font.Quality = fqCleartypeNatural
7474
ParentColor = False
7575
ParentFont = False
7676
TabOrder = 0
7777
Gutter.Visible = False
78-
Gutter.Width = 53
78+
Gutter.Width = 84
7979
Gutter.MouseActions = <>
8080
RightGutter.Width = 0
8181
RightGutter.MouseActions = <>
@@ -118,11 +118,13 @@ object SimbaPackageForm: TSimbaPackageForm
118118
LineHighlightColor.Foreground = clNone
119119
inline SynLeftGutterPartList1: TSynGutterPartList
120120
object SynGutterMarks1: TSynGutterMarks
121-
Width = 24
121+
Width = 42
122122
MouseActions = <>
123+
MaxExtraMarksColums = 0
124+
Options = [sgmoDeDuplicateMarksOnOverflow]
123125
end
124126
object SynGutterLineNumber1: TSynGutterLineNumber
125-
Width = 13
127+
Width = 23
126128
MouseActions = <>
127129
MarkupInfo.Background = clBtnFace
128130
MarkupInfo.Foreground = clNone
@@ -132,18 +134,19 @@ object SimbaPackageForm: TSimbaPackageForm
132134
LeadingZeros = False
133135
end
134136
object SynGutterChanges1: TSynGutterChanges
135-
Width = 4
137+
Width = 7
136138
MouseActions = <>
137139
ModifiedColor = 59900
138140
SavedColor = clGreen
139141
end
140142
object SynGutterSeparator1: TSynGutterSeparator
141-
Width = 2
143+
Width = 4
142144
MouseActions = <>
143145
MarkupInfo.Background = clWhite
144146
MarkupInfo.Foreground = clGray
145147
end
146148
object SynGutterCodeFolding1: TSynGutterCodeFolding
149+
Width = 18
147150
MouseActions = <>
148151
MarkupInfo.Background = clNone
149152
MarkupInfo.Foreground = clGray
@@ -159,9 +162,9 @@ object SimbaPackageForm: TSimbaPackageForm
159162
Width = 954
160163
Align = alBottom
161164
AutoSize = True
162-
BorderSpacing.Left = 10
163-
BorderSpacing.Right = 10
164-
BorderSpacing.Bottom = 10
165+
BorderSpacing.Left = 18
166+
BorderSpacing.Right = 18
167+
BorderSpacing.Bottom = 18
165168
Caption = 'Installing...'
166169
TabOrder = 1
167170
OnClick = InstallingButtonClick
@@ -171,9 +174,9 @@ object SimbaPackageForm: TSimbaPackageForm
171174
object Splitter1: TSplitter
172175
Cursor = crVSplit
173176
Left = 0
174-
Height = 5
175-
Top = 314
176-
Width = 782
177+
Height = 9
178+
Top = 550
179+
Width = 1368
177180
Align = alTop
178181
ResizeAnchor = akTop
179182
end
@@ -184,9 +187,9 @@ object SimbaPackageForm: TSimbaPackageForm
184187
AnchorSideLeft.Side = asrCenter
185188
AnchorSideTop.Control = LoadingPage
186189
AnchorSideTop.Side = asrCenter
187-
Left = 256
190+
Left = 448
188191
Height = 25
189-
Top = 235
192+
Top = 411
190193
Width = 339
191194
Caption = 'Downloading package list. Please wait...'
192195
Font.Style = [fsBold]
@@ -197,21 +200,21 @@ object SimbaPackageForm: TSimbaPackageForm
197200
end
198201
object PanelBottom: TPanel
199202
Left = 0
200-
Height = 73
201-
Top = 477
202-
Width = 782
203+
Height = 89
204+
Top = 873
205+
Width = 1368
203206
Align = alBottom
204207
Anchors = [akLeft, akBottom]
205208
AutoSize = True
206209
BevelOuter = bvNone
207-
ClientHeight = 73
208-
ClientWidth = 782
210+
ClientHeight = 89
211+
ClientWidth = 1368
209212
TabOrder = 1
210213
object Bevel3: TBevel
211214
Left = 0
212-
Height = 2
215+
Height = 4
213216
Top = 0
214-
Width = 782
217+
Width = 1368
215218
Align = alTop
216219
Shape = bsTopLine
217220
end
@@ -220,24 +223,24 @@ object SimbaPackageForm: TSimbaPackageForm
220223
AnchorSideLeft.Side = asrCenter
221224
AnchorSideTop.Control = Bevel3
222225
AnchorSideTop.Side = asrBottom
223-
Left = 288
224-
Height = 71
225-
Top = 2
226-
Width = 206
226+
Left = 560
227+
Height = 85
228+
Top = 4
229+
Width = 248
227230
AutoSize = True
228231
BevelOuter = bvNone
229-
ClientHeight = 71
230-
ClientWidth = 206
232+
ClientHeight = 85
233+
ClientWidth = 248
231234
TabOrder = 0
232235
object ToolBar: TToolBar
233236
Left = 0
234-
Height = 67
235-
Top = 2
236-
Width = 206
237+
Height = 77
238+
Top = 4
239+
Width = 248
237240
Align = alBottom
238241
AutoSize = True
239-
BorderSpacing.Top = 2
240-
BorderSpacing.Bottom = 2
242+
BorderSpacing.Top = 4
243+
BorderSpacing.Bottom = 4
241244
ButtonHeight = 0
242245
ButtonWidth = 0
243246
EdgeBorders = []
@@ -258,15 +261,15 @@ object SimbaPackageForm: TSimbaPackageForm
258261
OnClick = ButtonRefreshClick
259262
end
260263
object ButtonAddRepository: TToolButton
261-
Left = 73
264+
Left = 95
262265
Top = 0
263266
AutoSize = True
264267
Caption = 'Add Repository'
265268
ImageIndex = 0
266269
OnClick = ButtonAddRepositoryClick
267270
end
268271
object ToolButton1: TToolButton
269-
Left = 67
272+
Left = 81
270273
Height = 0
271274
Top = 0
272275
Caption = 'ToolButton1'
@@ -278,8 +281,8 @@ object SimbaPackageForm: TSimbaPackageForm
278281
object ImageList36: TImageList
279282
Height = 36
280283
Width = 36
281-
Left = 32
282-
Top = 70
284+
Left = 56
285+
Top = 123
283286
Bitmap = {
284287
4C7A010000002400000024000000600800000000000078DAED987B70D4D515C7
285288
3710A80F04A90F6CA342AB88D882A88D552A6865C0A90E2D4C41A42204228F52
@@ -354,8 +357,8 @@ object SimbaPackageForm: TSimbaPackageForm
354357
object ImageList: TImageList
355358
Height = 32
356359
Width = 32
357-
Left = 32
358-
Top = 134
360+
Left = 56
361+
Top = 235
359362
Bitmap = {
360363
4C7A020000002000000020000000980900000000000078DAED98095055E715C7
361364
BFF79E3C4529221AC749B489D692E8683560A78D1347DCADD1AA89BBB86F0DAE

Source/ide/simba.ide_package_components.pas

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ TVersionHeader = class
6565
Age: String;
6666
end;
6767
TVersionInfo = class
68+
Expanded: Boolean;
6869
Notes: String;
6970
Wrapped: TStringArray;
7071
end;
@@ -74,6 +75,9 @@ TVersionInfo = class
7475
FFixedCharWidth: Integer;
7576
FFixedCharHeight: Integer;
7677

78+
// forward scroll events
79+
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
80+
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
7781
procedure FontChanged(Sender: TObject); override;
7882

7983
procedure DoOnResize; override;
@@ -572,6 +576,38 @@ procedure TPackageInfoGrid.SetInfo(HomepageURL, InstalledVer, LatestVer: String)
572576
Cells[1, 3] := LatestVer;
573577
end;
574578

579+
function TPackageVersionGrid.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean;
580+
begin
581+
Result := inherited DoMouseWheel(Shift, WheelDelta, MousePos);
582+
if (Parent is TScrollBox) then
583+
TScrollBox(Parent).VertScrollBar.Position := TScrollBox(Parent).VertScrollBar.Position - WheelDelta;
584+
end;
585+
586+
procedure TPackageVersionGrid.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
587+
var
588+
ColIndex, RowIndex: Integer;
589+
Data: TObject;
590+
begin
591+
inherited MouseUp(Button, Shift, X, Y);
592+
593+
MouseToCell(X, Y, ColIndex, RowIndex);
594+
Data := Objects[ColIndex, RowIndex];
595+
if (Data is TVersionInfo) then
596+
begin
597+
BeginUpdate();
598+
try
599+
if TVersionInfo(Data).Expanded then
600+
RowHeights[RowIndex] := FFixedCharHeight + varCellpadding
601+
else
602+
RowHeights[RowIndex] := (Length(TVersionInfo(Data).Wrapped) * FFixedCharHeight) + varCellPadding;
603+
TVersionInfo(Data).Expanded := not TVersionInfo(Data).Expanded;
604+
Height := GridHeight;
605+
finally
606+
EndUpdate();
607+
end;
608+
end;
609+
end;
610+
575611
procedure TPackageVersionGrid.FontChanged(Sender: TObject);
576612
begin
577613
inherited FontChanged(Sender);
@@ -627,11 +663,19 @@ procedure TPackageVersionGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect; aS
627663
Inc(ARect.Top, varCellPadding div 2);
628664
Inc(ARect.Left, varCellPadding);
629665

630-
for Line in Info.Wrapped do
666+
if Info.Expanded then
631667
begin
632-
Canvas.TextOut(ARect.Left, ARect.Top, Line.TrimRight());
668+
for Line in Info.Wrapped do
669+
begin
670+
Canvas.TextOut(ARect.Left, ARect.Top, Line.TrimRight());
633671

634-
Inc(ARect.Top, FFixedCharHeight);
672+
Inc(ARect.Top, FFixedCharHeight);
673+
end;
674+
end
675+
else begin
676+
Canvas.Font.Underline := True;
677+
Canvas.TextOut(ARect.Left, ARect.Top, 'View notes');
678+
Canvas.Font.Underline := False;
635679
end;
636680

637681
Exit;
@@ -680,7 +724,7 @@ constructor TPackageVersionGrid.Create(AOwner: TComponent);
680724
GridLineWidth := 0;
681725
AutoFillColumns := True;
682726
ScrollBars := ssNone;
683-
Enabled := False;
727+
Enabled := True;
684728

685729
FixedCols := 0;
686730
FixedRows := 1;
@@ -790,18 +834,23 @@ procedure TPackageVersionGrid.DoLineWrapping(Foo: PtrInt);
790834
begin
791835
Data := Objects[0, I];
792836

793-
if Data is TVersionInfo then
837+
if (Data is TVersionInfo) then
794838
begin
795839
Info.Wrapped := UTF8WrapText(Info.Notes, MaxCol).Split(LineEnding);
796840

797-
RowHeights[I] := (Length(Info.Wrapped) * FFixedCharHeight) + varCellPadding;
841+
// Have the first one always expanded
842+
if (I = FixedRows+1) then
843+
begin
844+
RowHeights[I] := (Length(TVersionInfo(Data).Wrapped) * FFixedCharHeight) + varCellpadding;
845+
TVersionInfo(Data).Expanded := True;
846+
end else
847+
RowHeights[I] := FFixedCharHeight + varCellpadding;
798848
end;
799849
end;
850+
Height := GridHeight;
800851
finally
801852
EndUpdate();
802853
end;
803-
804-
Height := GridHeight;
805854
end;
806855

807856
procedure TPackageVersionGrid.DoFontCalculate;

0 commit comments

Comments
 (0)