diff --git a/tim2view.lpi b/tim2view.lpi
index 2451fb9..84bc53d 100644
--- a/tim2view.lpi
+++ b/tim2view.lpi
@@ -27,7 +27,7 @@
-
+
diff --git a/umain.lfm b/umain.lfm
index 33b9bca..1f97d21 100644
--- a/umain.lfm
+++ b/umain.lfm
@@ -576,54 +576,6 @@ object frmMain: TfrmMain
ClientHeight = 597
ClientWidth = 253
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
Left = 0
Height = 185
@@ -638,13 +590,13 @@ object frmMain: TfrmMain
Flat = True
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goSmoothScroll]
RowCount = 9
- TabOrder = 1
+ TabOrder = 0
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
ColWidths = (
102
- 133
+ 150
)
Cells = (
10
@@ -680,6 +632,58 @@ object frmMain: TfrmMain
'IMAGE'
)
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
object pnlImage: TPanel
Left = 258
diff --git a/umain.pas b/umain.pas
index bf567fd..15fb966 100644
--- a/umain.pas
+++ b/umain.pas
@@ -64,7 +64,6 @@ type
imgTim: TImage;
lblClutHint: TLabel;
lblStatus: TLabel;
- lvList: TListView;
MenuItem1: TMenuItem;
mnImportPng1: TMenuItem;
mnShowTimInfo: TMenuItem;
@@ -113,6 +112,7 @@ type
mnSaveToPNG1: TMenuItem;
dlgSelectDir: TSelectDirectoryDialog;
splMain: TSplitter;
+ grdTimsList: TStringGrid;
tblTimInfo: TStringGrid;
procedure actAboutExecute(Sender: TObject);
procedure actAddToSendtoExecute(Sender: TObject);
@@ -147,6 +147,9 @@ type
procedure grdClutDblClick(Sender: TObject);
procedure grdClutDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
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 lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
private
@@ -306,17 +309,11 @@ begin
SetTimsListCount(SelectedScanResult.Count);
actReturnFocus.Execute;
- if lvList.Items.Count = 0 then Exit;
+ if grdTimsList.RowCount = 1 then Exit;
- //if lvList.Selected <> nil then
- // lvList.Selected.Index := -1;
- lvList.ItemIndex:= -1;
- lvList.Update;
- lvList.ItemIndex := 0;
-
- lvList.Items[0].Focused := True;
- lvList.Items[0].Selected := True;
- lvList.Items[0].MakeVisible(False);
+ grdTimsList.Row := 1;
+ grdTimsListSelection(Self, 0, 1);
+ grdTimsList.SetFocus;
end;
procedure TfrmMain.actAboutExecute(Sender: TObject);
@@ -631,7 +628,7 @@ end;
procedure TfrmMain.actReturnFocusExecute(Sender: TObject);
begin
- if pnlList.Enabled then lvList.SetFocus;
+ if pnlList.Enabled then grdTimsList.SetFocus;
end;
procedure TfrmMain.actScanDirExecute(Sender: TObject);
@@ -811,6 +808,19 @@ begin
UpdateTim(True, True, False);
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);
var
W, H: Word;
@@ -830,9 +840,7 @@ end;
procedure TfrmMain.lvListSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
begin
- if (Item = nil) then Exit;
- if Selected then ShowTim;
end;
function TfrmMain.FGetSelectedScanResult: TScanResult;
@@ -843,7 +851,7 @@ end;
function TfrmMain.FGetSelectedTimIdx: Integer;
begin
- Result := lvList.ItemIndex;
+ Result := grdTimsList.Row - 1;
end;
function TfrmMain.FGetSelectedTimInfo: TTimInfo;
@@ -862,8 +870,6 @@ var
begin
Result := nil;
- if lvList.Selected = nil then Exit;
-
P := SelectedTimInfo.Position;
Result := LoadTimFromFile(SelectedScanResult.ScanFile, P, SelectedScanResult.IsImage, SelectedTimInfo.Size);
@@ -957,7 +963,7 @@ begin
actScanFile.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;
actPngImport.Enabled := actReplaceTim.Enabled;
@@ -1016,10 +1022,10 @@ end;
procedure TfrmMain.SetTimsListCount(Count: Integer);
begin
- lvList.Items.BeginUpdate;
- lvList.Items.Count := Count;
- lvList.Column[0].Caption := Format('# / %d', [Count]);
- lvList.Items.EndUpdate;
+ grdTimsList.BeginUpdate;
+ grdTimsList.RowCount := Count + 1;
+ grdTimsList.Columns[0].Title.Caption := Format('# / %d', [Count]);
+ grdTimsList.EndUpdate;
end;
procedure TfrmMain.UpdateCLUTInfo;
@@ -1112,8 +1118,7 @@ end;
procedure TfrmMain.ShowTim;
begin
- if (lvList.Selected = nil) then Exit;
- if (lvList.Items.Count = 0) then Exit;
+ if (grdTimsList.RowCount = 1) then Exit;
{ TODO : Reset bitmode or not? }
//cbbBitMode.ItemIndex := 0;
diff --git a/uscanthread.pas b/uscanthread.pas
index 35aaa83..7eaa19b 100644
--- a/uscanthread.pas
+++ b/uscanthread.pas
@@ -202,7 +202,7 @@ end;
procedure TScanThread.UpdateProgressBar;
begin
frmMain.pbProgress.Position := pFilePos;
- frmMain.lvList.Column[0].Caption := Format('# / %d', [pScanResult.Count]);
+ frmMain.grdTimsList.Columns[0].Title.Caption := Format('# / %d', [pScanResult.Count]);
end;
procedure TScanThread.ClearSectorBuffer(SectorBuffer, ClearBuffer: PBytesArray);