Just commit. Moved ListView to StringGrid.

This commit is contained in:
Vladimir Kryvian
2015-08-06 18:43:44 +03:00
parent 08eb322ba7
commit 61ff39502e
4 changed files with 85 additions and 76 deletions

View File

@@ -27,7 +27,7 @@
<AutoIncrementBuild Value="True"/> <AutoIncrementBuild Value="True"/>
<MajorVersionNr Value="1"/> <MajorVersionNr Value="1"/>
<RevisionNr Value="90"/> <RevisionNr Value="90"/>
<BuildNr Value="68"/> <BuildNr Value="70"/>
<StringTable CompanyName="Lab 313" FileDescription="The best TIMs tool ever!:)" ProductVersion=""/> <StringTable CompanyName="Lab 313" FileDescription="The best TIMs tool ever!:)" ProductVersion=""/>
</VersionInfo> </VersionInfo>
<BuildModes Count="6"> <BuildModes Count="6">

104
umain.lfm
View File

@@ -576,54 +576,6 @@ object frmMain: TfrmMain
ClientHeight = 597 ClientHeight = 597
ClientWidth = 253 ClientWidth = 253
TabOrder = 0 TabOrder = 0
object lvList: TListView
Left = 0
Height = 412
Top = 0
Width = 253
Align = alClient
Columns = <
item
AutoSize = True
Caption = '# / 0'
Width = 249
end
item
Alignment = taCenter
AutoSize = True
Caption = 'BPP'
Width = 30
end
item
Alignment = taCenter
AutoSize = True
Caption = 'CLUTs'
Width = 42
end
item
Alignment = taCenter
AutoSize = True
Caption = 'Type'
Width = 36
end
item
Alignment = taCenter
AutoSize = True
Caption = 'W x H'
Width = 41
end>
ColumnClick = False
OwnerData = True
PopupMenu = pmList
ReadOnly = True
RowSelect = True
ScrollBars = ssAutoBoth
TabOrder = 0
ToolTips = False
ViewStyle = vsReport
OnData = lvListData
OnSelectItem = lvListSelectItem
end
object tblTimInfo: TStringGrid object tblTimInfo: TStringGrid
Left = 0 Left = 0
Height = 185 Height = 185
@@ -638,13 +590,13 @@ object frmMain: TfrmMain
Flat = True Flat = True
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goSmoothScroll] Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goSmoothScroll]
RowCount = 9 RowCount = 9
TabOrder = 1 TabOrder = 0
TitleFont.Color = clWindowText TitleFont.Color = clWindowText
TitleFont.Height = -11 TitleFont.Height = -11
TitleFont.Name = 'Tahoma' TitleFont.Name = 'Tahoma'
ColWidths = ( ColWidths = (
102 102
133 150
) )
Cells = ( Cells = (
10 10
@@ -680,6 +632,58 @@ object frmMain: TfrmMain
'IMAGE' 'IMAGE'
) )
end end
object grdTimsList: TStringGrid
Left = 0
Height = 412
Top = 0
Width = 253
Align = alClient
AutoEdit = False
AutoFillColumns = True
ColumnClickSorts = True
Columns = <
item
Title.Caption = '#'
Width = 50
end
item
Title.Caption = 'BPP'
Width = 50
end
item
Title.Caption = 'CLUTs'
Width = 50
end
item
Title.Caption = 'Type'
Width = 50
end
item
Title.Caption = 'W x H'
Width = 52
end>
ExtendedSelect = False
FixedCols = 0
Flat = True
Options = [goFixedVertLine, goDrawFocusSelected, goRowSelect, goSmoothScroll, goHeaderHotTracking, goHeaderPushedLook, goSelectionActive, goTruncCellHints, goRowHighlight]
PopupMenu = pmList
RowCount = 1
TabOrder = 1
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
TitleStyle = tsNative
UseXORFeatures = True
OnDrawCell = grdTimsListDrawCell
OnSelection = grdTimsListSelection
ColWidths = (
50
50
50
50
52
)
end
end end
object pnlImage: TPanel object pnlImage: TPanel
Left = 258 Left = 258

View File

@@ -64,7 +64,6 @@ type
imgTim: TImage; imgTim: TImage;
lblClutHint: TLabel; lblClutHint: TLabel;
lblStatus: TLabel; lblStatus: TLabel;
lvList: TListView;
MenuItem1: TMenuItem; MenuItem1: TMenuItem;
mnImportPng1: TMenuItem; mnImportPng1: TMenuItem;
mnShowTimInfo: TMenuItem; mnShowTimInfo: TMenuItem;
@@ -113,6 +112,7 @@ type
mnSaveToPNG1: TMenuItem; mnSaveToPNG1: TMenuItem;
dlgSelectDir: TSelectDirectoryDialog; dlgSelectDir: TSelectDirectoryDialog;
splMain: TSplitter; splMain: TSplitter;
grdTimsList: TStringGrid;
tblTimInfo: TStringGrid; tblTimInfo: TStringGrid;
procedure actAboutExecute(Sender: TObject); procedure actAboutExecute(Sender: TObject);
procedure actAddToSendtoExecute(Sender: TObject); procedure actAddToSendtoExecute(Sender: TObject);
@@ -147,6 +147,9 @@ type
procedure grdClutDblClick(Sender: TObject); procedure grdClutDblClick(Sender: TObject);
procedure grdClutDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState); procedure grdClutDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
procedure grdClutKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure grdClutKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure grdTimsListDrawCell(Sender: TObject; aCol, aRow: Integer;
aRect: TRect; aState: TGridDrawState);
procedure grdTimsListSelection(Sender: TObject; aCol, aRow: Integer);
procedure lvListData(Sender: TObject; Item: TListItem); procedure lvListData(Sender: TObject; Item: TListItem);
procedure lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); procedure lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
private private
@@ -306,17 +309,11 @@ begin
SetTimsListCount(SelectedScanResult.Count); SetTimsListCount(SelectedScanResult.Count);
actReturnFocus.Execute; actReturnFocus.Execute;
if lvList.Items.Count = 0 then Exit; if grdTimsList.RowCount = 1 then Exit;
//if lvList.Selected <> nil then grdTimsList.Row := 1;
// lvList.Selected.Index := -1; grdTimsListSelection(Self, 0, 1);
lvList.ItemIndex:= -1; grdTimsList.SetFocus;
lvList.Update;
lvList.ItemIndex := 0;
lvList.Items[0].Focused := True;
lvList.Items[0].Selected := True;
lvList.Items[0].MakeVisible(False);
end; end;
procedure TfrmMain.actAboutExecute(Sender: TObject); procedure TfrmMain.actAboutExecute(Sender: TObject);
@@ -631,7 +628,7 @@ end;
procedure TfrmMain.actReturnFocusExecute(Sender: TObject); procedure TfrmMain.actReturnFocusExecute(Sender: TObject);
begin begin
if pnlList.Enabled then lvList.SetFocus; if pnlList.Enabled then grdTimsList.SetFocus;
end; end;
procedure TfrmMain.actScanDirExecute(Sender: TObject); procedure TfrmMain.actScanDirExecute(Sender: TObject);
@@ -811,6 +808,19 @@ begin
UpdateTim(True, True, False); UpdateTim(True, True, False);
end; end;
procedure TfrmMain.grdTimsListDrawCell(Sender: TObject; aCol, aRow: Integer;
aRect: TRect; aState: TGridDrawState);
begin
end;
procedure TfrmMain.grdTimsListSelection(Sender: TObject; aCol, aRow: Integer);
begin
if (aCol < 1) and (aRow < 1) then Exit;
ShowTim;
end;
procedure TfrmMain.lvListData(Sender: TObject; Item: TListItem); procedure TfrmMain.lvListData(Sender: TObject; Item: TListItem);
var var
W, H: Word; W, H: Word;
@@ -830,9 +840,7 @@ end;
procedure TfrmMain.lvListSelectItem(Sender: TObject; Item: TListItem; procedure TfrmMain.lvListSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean); Selected: Boolean);
begin begin
if (Item = nil) then Exit;
if Selected then ShowTim;
end; end;
function TfrmMain.FGetSelectedScanResult: TScanResult; function TfrmMain.FGetSelectedScanResult: TScanResult;
@@ -843,7 +851,7 @@ end;
function TfrmMain.FGetSelectedTimIdx: Integer; function TfrmMain.FGetSelectedTimIdx: Integer;
begin begin
Result := lvList.ItemIndex; Result := grdTimsList.Row - 1;
end; end;
function TfrmMain.FGetSelectedTimInfo: TTimInfo; function TfrmMain.FGetSelectedTimInfo: TTimInfo;
@@ -862,8 +870,6 @@ var
begin begin
Result := nil; Result := nil;
if lvList.Selected = nil then Exit;
P := SelectedTimInfo.Position; P := SelectedTimInfo.Position;
Result := LoadTimFromFile(SelectedScanResult.ScanFile, P, SelectedScanResult.IsImage, SelectedTimInfo.Size); Result := LoadTimFromFile(SelectedScanResult.ScanFile, P, SelectedScanResult.IsImage, SelectedTimInfo.Size);
@@ -957,7 +963,7 @@ begin
actScanFile.Enabled := ScanThreads.Count = 0; actScanFile.Enabled := ScanThreads.Count = 0;
actScanDir.Enabled := ScanThreads.Count = 0; actScanDir.Enabled := ScanThreads.Count = 0;
actReplaceTim.Enabled := (lvList.Selected <> nil) and (lvList.Selected.Index <> -1); actReplaceTim.Enabled := not (grdTimsList.Row < 1);
actPngExport.Enabled := (Surf^ <> nil) and actReplaceTim.Enabled; actPngExport.Enabled := (Surf^ <> nil) and actReplaceTim.Enabled;
actPngImport.Enabled := actReplaceTim.Enabled; actPngImport.Enabled := actReplaceTim.Enabled;
@@ -1016,10 +1022,10 @@ end;
procedure TfrmMain.SetTimsListCount(Count: Integer); procedure TfrmMain.SetTimsListCount(Count: Integer);
begin begin
lvList.Items.BeginUpdate; grdTimsList.BeginUpdate;
lvList.Items.Count := Count; grdTimsList.RowCount := Count + 1;
lvList.Column[0].Caption := Format('# / %d', [Count]); grdTimsList.Columns[0].Title.Caption := Format('# / %d', [Count]);
lvList.Items.EndUpdate; grdTimsList.EndUpdate;
end; end;
procedure TfrmMain.UpdateCLUTInfo; procedure TfrmMain.UpdateCLUTInfo;
@@ -1112,8 +1118,7 @@ end;
procedure TfrmMain.ShowTim; procedure TfrmMain.ShowTim;
begin begin
if (lvList.Selected = nil) then Exit; if (grdTimsList.RowCount = 1) then Exit;
if (lvList.Items.Count = 0) then Exit;
{ TODO : Reset bitmode or not? } { TODO : Reset bitmode or not? }
//cbbBitMode.ItemIndex := 0; //cbbBitMode.ItemIndex := 0;

View File

@@ -202,7 +202,7 @@ end;
procedure TScanThread.UpdateProgressBar; procedure TScanThread.UpdateProgressBar;
begin begin
frmMain.pbProgress.Position := pFilePos; frmMain.pbProgress.Position := pFilePos;
frmMain.lvList.Column[0].Caption := Format('# / %d', [pScanResult.Count]); frmMain.grdTimsList.Columns[0].Title.Caption := Format('# / %d', [pScanResult.Count]);
end; end;
procedure TScanThread.ClearSectorBuffer(SectorBuffer, ClearBuffer: PBytesArray); procedure TScanThread.ClearSectorBuffer(SectorBuffer, ClearBuffer: PBytesArray);