Added sorting for TIMs list. Increased CLUTs count.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -27,7 +27,7 @@
|
|||||||
<AutoIncrementBuild Value="True"/>
|
<AutoIncrementBuild Value="True"/>
|
||||||
<MajorVersionNr Value="1"/>
|
<MajorVersionNr Value="1"/>
|
||||||
<RevisionNr Value="90"/>
|
<RevisionNr Value="90"/>
|
||||||
<BuildNr Value="70"/>
|
<BuildNr Value="72"/>
|
||||||
<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">
|
||||||
|
|||||||
@@ -3,11 +3,7 @@ unit ucommon;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
cProgramName = 'Tim2View r90 by [Lab 313] (for ' +
|
cProgramName = 'Tim2View r90 by [Lab 313]';
|
||||||
{$IFDEF Linux}'Linux' + {$IFEND}
|
|
||||||
{$IFDEF Darwin}'Mac OS X' + {$IFEND}
|
|
||||||
{$IFDEF Windows}'Windows' + {$IFEND}
|
|
||||||
')';
|
|
||||||
cExtractedFilesDir = 'FILES';
|
cExtractedFilesDir = 'FILES';
|
||||||
cExtractedPngsDir = 'PNGS';
|
cExtractedPngsDir = 'PNGS';
|
||||||
cMaxFileSize = $2EAEED80;
|
cMaxFileSize = $2EAEED80;
|
||||||
|
|||||||
10
umain.lfm
10
umain.lfm
@@ -596,7 +596,7 @@ object frmMain: TfrmMain
|
|||||||
TitleFont.Name = 'Tahoma'
|
TitleFont.Name = 'Tahoma'
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
102
|
102
|
||||||
150
|
133
|
||||||
)
|
)
|
||||||
Cells = (
|
Cells = (
|
||||||
10
|
10
|
||||||
@@ -638,6 +638,7 @@ object frmMain: TfrmMain
|
|||||||
Top = 0
|
Top = 0
|
||||||
Width = 253
|
Width = 253
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
AutoAdvance = aaDown
|
||||||
AutoEdit = False
|
AutoEdit = False
|
||||||
AutoFillColumns = True
|
AutoFillColumns = True
|
||||||
ColumnClickSorts = True
|
ColumnClickSorts = True
|
||||||
@@ -662,10 +663,10 @@ object frmMain: TfrmMain
|
|||||||
Title.Caption = 'W x H'
|
Title.Caption = 'W x H'
|
||||||
Width = 52
|
Width = 52
|
||||||
end>
|
end>
|
||||||
ExtendedSelect = False
|
|
||||||
FixedCols = 0
|
FixedCols = 0
|
||||||
Flat = True
|
Flat = True
|
||||||
Options = [goFixedVertLine, goDrawFocusSelected, goRowSelect, goSmoothScroll, goHeaderHotTracking, goHeaderPushedLook, goSelectionActive, goTruncCellHints, goRowHighlight]
|
MouseWheelOption = mwGrid
|
||||||
|
Options = [goFixedVertLine, goDrawFocusSelected, goRowSelect, goThumbTracking, goRelaxedRowSelect, goDblClickAutoSize, goHeaderHotTracking, goHeaderPushedLook, goSelectionActive, goTruncCellHints, goRowHighlight]
|
||||||
PopupMenu = pmList
|
PopupMenu = pmList
|
||||||
RowCount = 1
|
RowCount = 1
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@@ -674,7 +675,8 @@ object frmMain: TfrmMain
|
|||||||
TitleFont.Name = 'Tahoma'
|
TitleFont.Name = 'Tahoma'
|
||||||
TitleStyle = tsNative
|
TitleStyle = tsNative
|
||||||
UseXORFeatures = True
|
UseXORFeatures = True
|
||||||
OnDrawCell = grdTimsListDrawCell
|
OnCompareCells = grdTimsListCompareCells
|
||||||
|
OnHeaderClick = grdTimsListHeaderClick
|
||||||
OnSelection = grdTimsListSelection
|
OnSelection = grdTimsListSelection
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
50
|
50
|
||||||
|
|||||||
116
umain.pas
116
umain.pas
@@ -147,11 +147,11 @@ 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;
|
procedure grdTimsListCompareCells(Sender: TObject; ACol, ARow, BCol,
|
||||||
aRect: TRect; aState: TGridDrawState);
|
BRow: Integer; var Result: integer);
|
||||||
|
procedure grdTimsListHeaderClick(Sender: TObject; IsColumn: Boolean;
|
||||||
|
Index: Integer);
|
||||||
procedure grdTimsListSelection(Sender: TObject; aCol, aRow: Integer);
|
procedure grdTimsListSelection(Sender: TObject; aCol, aRow: Integer);
|
||||||
procedure lvListData(Sender: TObject; Item: TListItem);
|
|
||||||
procedure lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
|
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
StartedScans: Integer; //Count of currently started scans
|
StartedScans: Integer; //Count of currently started scans
|
||||||
@@ -808,50 +808,75 @@ begin
|
|||||||
UpdateTim(True, True, False);
|
UpdateTim(True, True, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.grdTimsListDrawCell(Sender: TObject; aCol, aRow: Integer;
|
procedure TfrmMain.grdTimsListCompareCells(Sender: TObject; ACol, ARow, BCol,
|
||||||
aRect: TRect; aState: TGridDrawState);
|
BRow: Integer; var Result: integer);
|
||||||
|
var
|
||||||
|
AIdx, BIdx: Integer;
|
||||||
|
AW, AH, BW, BH, AP, BP: Integer;
|
||||||
|
AWxH, BWxH: string;
|
||||||
begin
|
begin
|
||||||
|
case ACol of
|
||||||
|
0, 1, 2:
|
||||||
|
begin
|
||||||
|
AIdx := StrToIntDef(grdTimsList.Cells[ACol, ARow], 0);
|
||||||
|
BIdx := StrToIntDef(grdTimsList.Cells[BCol, BRow], 0);
|
||||||
|
|
||||||
|
// Result will be either <0, =0, or >0 for normal order.
|
||||||
|
Result := AIdx - BIdx;
|
||||||
|
end;
|
||||||
|
3:
|
||||||
|
begin
|
||||||
|
Result := AnsiCompareStr(grdTimsList.Cells[ACol, ARow], grdTimsList.Cells[BCol, BRow]);
|
||||||
|
end;
|
||||||
|
4:
|
||||||
|
begin
|
||||||
|
AWxH := grdTimsList.Cells[ACol, ARow];
|
||||||
|
BWxH := grdTimsList.Cells[BCol, BRow];
|
||||||
|
|
||||||
|
AP := Pos('x', AWxH);
|
||||||
|
BP := Pos('x', BWxH);
|
||||||
|
|
||||||
|
AW := StrToIntDef(Copy(AWxH, 1, AP - 1), 0);
|
||||||
|
BW := StrToIntDef(Copy(BWxH, 1, BP - 1), 0);
|
||||||
|
|
||||||
|
AH := StrToIntDef(Copy(AWxH, AP + 1, Length(AWxH) - AP), 0);
|
||||||
|
BH := StrToIntDef(Copy(BWxH, BP + 1, Length(BWxH) - BP), 0);
|
||||||
|
|
||||||
|
if (AW = BW) then
|
||||||
|
Result := BH - AH
|
||||||
|
else
|
||||||
|
Result := BW - AW;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// For inverse order, just negate the result (eg. based on grid's SortOrder).
|
||||||
|
if grdTimsList.SortOrder = soAscending then
|
||||||
|
Result := -Result;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.grdTimsListHeaderClick(Sender: TObject; IsColumn: Boolean;
|
||||||
|
Index: Integer);
|
||||||
|
begin
|
||||||
|
if (grdTimsList.Row < grdTimsList.VisibleRowCount) then
|
||||||
|
grdTimsList.TopRow := 1
|
||||||
|
else
|
||||||
|
grdTimsList.TopRow := grdTimsList.Row - grdTimsList.VisibleRowCount + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.grdTimsListSelection(Sender: TObject; aCol, aRow: Integer);
|
procedure TfrmMain.grdTimsListSelection(Sender: TObject; aCol, aRow: Integer);
|
||||||
begin
|
begin
|
||||||
if (aCol < 1) and (aRow < 1) then Exit;
|
if (aRow < 1) then Exit;
|
||||||
|
|
||||||
ShowTim;
|
ShowTim;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.lvListData(Sender: TObject; Item: TListItem);
|
|
||||||
var
|
|
||||||
W, H: Word;
|
|
||||||
begin
|
|
||||||
if cbbFiles.ItemIndex = -1 then Exit;
|
|
||||||
|
|
||||||
W := TimInfoByIdx[Item.Index].Width;
|
|
||||||
H := TimInfoByIdx[Item.Index].Height;
|
|
||||||
|
|
||||||
Item.Caption := Format('%.6d', [Item.Index + 1]);
|
|
||||||
Item.SubItems.Add(Format('%.2d', [TimInfoByIdx[Item.Index].BitMode]));
|
|
||||||
Item.SubItems.Add(Format('%.2d', [TimInfoByIdx[Item.Index].Cluts]));
|
|
||||||
Item.SubItems.Add(Format('%s', [AnsiUpperCase(TIMTypeStr(TimInfoByIdx[Item.Index].Magic))]));
|
|
||||||
Item.SubItems.Add(Format('%.3dx%.3d', [W, H]));
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TfrmMain.lvListSelectItem(Sender: TObject; Item: TListItem;
|
|
||||||
Selected: Boolean);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TfrmMain.FGetSelectedScanResult: TScanResult;
|
function TfrmMain.FGetSelectedScanResult: TScanResult;
|
||||||
begin
|
begin
|
||||||
if cbbFiles.ItemIndex = -1 then Exit;
|
|
||||||
Result := ScanResults[cbbFiles.ItemIndex];
|
Result := ScanResults[cbbFiles.ItemIndex];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TfrmMain.FGetSelectedTimIdx: Integer;
|
function TfrmMain.FGetSelectedTimIdx: Integer;
|
||||||
begin
|
begin
|
||||||
Result := grdTimsList.Row - 1;
|
Result := StrToIntDef(grdTimsList.Cells[0, grdTimsList.Row], 1) - 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TfrmMain.FGetSelectedTimInfo: TTimInfo;
|
function TfrmMain.FGetSelectedTimInfo: TTimInfo;
|
||||||
@@ -870,6 +895,8 @@ var
|
|||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
|
||||||
|
if (grdTimsList.RowCount = 1) 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);
|
||||||
|
|
||||||
@@ -914,8 +941,6 @@ begin
|
|||||||
ScanThreads.Last.Priority := tpNormal;
|
ScanThreads.Last.Priority := tpNormal;
|
||||||
ScanThreads.Last.OnTerminate := @ScanFinished;
|
ScanThreads.Last.OnTerminate := @ScanFinished;
|
||||||
|
|
||||||
ScanThreads.Pack;
|
|
||||||
|
|
||||||
if StartedScans < GetLogicalCpuCount then
|
if StartedScans < GetLogicalCpuCount then
|
||||||
begin
|
begin
|
||||||
BeforeScan(ScanThreads.Last.FileLength);
|
BeforeScan(ScanThreads.Last.FileLength);
|
||||||
@@ -977,6 +1002,7 @@ end;
|
|||||||
procedure TfrmMain.ScanFinished(Sender: TObject);
|
procedure TfrmMain.ScanFinished(Sender: TObject);
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
|
W, H: Word;
|
||||||
begin
|
begin
|
||||||
ScanThreads.Remove(Sender as TScanThread);
|
ScanThreads.Remove(Sender as TScanThread);
|
||||||
Dec(StartedScans);
|
Dec(StartedScans);
|
||||||
@@ -994,8 +1020,6 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ScanThreads.Count <> 0 then SetTimsListCount(ScanResults.Last.Count);
|
|
||||||
|
|
||||||
CheckButtonsAndMainMenu;
|
CheckButtonsAndMainMenu;
|
||||||
|
|
||||||
if cbbFiles.Enabled then
|
if cbbFiles.Enabled then
|
||||||
@@ -1004,6 +1028,22 @@ begin
|
|||||||
actChangeFile.Execute;
|
actChangeFile.Execute;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if (ScanResults.Count = 0) then Exit;
|
||||||
|
|
||||||
|
grdTimsList.BeginUpdate;
|
||||||
|
for I := 1 to ScanResults.Last.Count do
|
||||||
|
begin
|
||||||
|
W := TimInfoByIdx[I - 1].Width;
|
||||||
|
H := TimInfoByIdx[I - 1].Height;
|
||||||
|
|
||||||
|
grdTimsList.Cells[0, I] := Format('%.6d', [I]);
|
||||||
|
grdTimsList.Cells[1, I] := Format('%.2d', [TimInfoByIdx[I - 1].BitMode]);
|
||||||
|
grdTimsList.Cells[2, I] := Format('%.2d', [TimInfoByIdx[I - 1].Cluts]);
|
||||||
|
grdTimsList.Cells[3, I] := Format('%s', [AnsiUpperCase(TIMTypeStr(TimInfoByIdx[I - 1].Magic))]);
|
||||||
|
grdTimsList.Cells[4, I] := Format('%.3dx%.3d', [W, H]);
|
||||||
|
end;
|
||||||
|
grdTimsList.EndUpdate;
|
||||||
|
|
||||||
actStopScan.Enabled := False;
|
actStopScan.Enabled := False;
|
||||||
actStopScan.Tag := NativeInt(True);
|
actStopScan.Tag := NativeInt(True);
|
||||||
end;
|
end;
|
||||||
@@ -1037,9 +1077,9 @@ begin
|
|||||||
if TIM = nil then Exit;
|
if TIM = nil then Exit;
|
||||||
|
|
||||||
CLUTS := GetTIMClutsCount(TIM);
|
CLUTS := GetTIMClutsCount(TIM);
|
||||||
cbbCLUT.Items.Clear;
|
|
||||||
|
|
||||||
cbbCLUT.Items.BeginUpdate;
|
cbbCLUT.Items.BeginUpdate;
|
||||||
|
cbbCLUT.Items.Clear;
|
||||||
for I := 1 to CLUTS do
|
for I := 1 to CLUTS do
|
||||||
cbbCLUT.Items.Add(Format('CLUT [%.2d/%.2d]', [I, CLUTS]));
|
cbbCLUT.Items.Add(Format('CLUT [%.2d/%.2d]', [I, CLUTS]));
|
||||||
cbbCLUT.Items.EndUpdate;
|
cbbCLUT.Items.EndUpdate;
|
||||||
@@ -1118,7 +1158,7 @@ end;
|
|||||||
|
|
||||||
procedure TfrmMain.ShowTim;
|
procedure TfrmMain.ShowTim;
|
||||||
begin
|
begin
|
||||||
if (grdTimsList.RowCount = 1) then Exit;
|
if (grdTimsList.Row < 1) then Exit;
|
||||||
|
|
||||||
{ TODO : Reset bitmode or not? }
|
{ TODO : Reset bitmode or not? }
|
||||||
//cbbBitMode.ItemIndex := 0;
|
//cbbBitMode.ItemIndex := 0;
|
||||||
|
|||||||
2
utim.pas
2
utim.pas
@@ -68,7 +68,7 @@ type
|
|||||||
//Constants
|
//Constants
|
||||||
const
|
const
|
||||||
cCLUTColorsMax = 1024;
|
cCLUTColorsMax = 1024;
|
||||||
cCLUTCountMax = 512;
|
cCLUTCountMax = 1024;
|
||||||
cIMAGEWidthMax = 1024;
|
cIMAGEWidthMax = 1024;
|
||||||
cIMAGEHeightMax = 1024;
|
cIMAGEHeightMax = 1024;
|
||||||
cTIMMaxSize = SizeOf(TTIMHeader) + cCLUTColorsMax * cCLUTCountMax * 2 + SizeOf(TCLUTHeader) + cIMAGEWidthMax * cIMAGEHeightMax * 2 + SizeOf(TIMAGEHeader);
|
cTIMMaxSize = SizeOf(TTIMHeader) + cCLUTColorsMax * cCLUTCountMax * 2 + SizeOf(TCLUTHeader) + cIMAGEWidthMax * cIMAGEHeightMax * 2 + SizeOf(TIMAGEHeader);
|
||||||
|
|||||||
Reference in New Issue
Block a user