Added new "CLUTs" column; Simplified design; Some commands was moved to image's context menu; Image's and cluts list's flickering removed.

This commit is contained in:
meffi@lab313.ru
2014-04-09 18:47:18 +00:00
parent c3f38c670f
commit 0b7d0387d0
7 changed files with 149 additions and 104 deletions

View File

@@ -5,7 +5,7 @@
<FrameworkType>VCL</FrameworkType> <FrameworkType>VCL</FrameworkType>
<MainSource>tim2view.dpr</MainSource> <MainSource>tim2view.dpr</MainSource>
<Base>True</Base> <Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config> <Config Condition="'$(Config)'==''">Release</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform> <Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms> <TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType> <AppType>Application</AppType>
@@ -102,6 +102,7 @@
<DCC_DebugInformation>0</DCC_DebugInformation> <DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''"> <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_Keys>CompanyName=Lab 313;FileDescription=The best TIMs tool ever!:);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<DCC_DebugInformation>true</DCC_DebugInformation> <DCC_DebugInformation>true</DCC_DebugInformation>
<DCC_LocalDebugSymbols>true</DCC_LocalDebugSymbols> <DCC_LocalDebugSymbols>true</DCC_LocalDebugSymbols>
<DCC_Define>madExcept;LeakChecking;$(DCC_Define)</DCC_Define> <DCC_Define>madExcept;LeakChecking;$(DCC_Define)</DCC_Define>

Binary file not shown.

View File

@@ -7,7 +7,7 @@ uses
const const
cProgramName = 'Tim2View by [Lab 313]'; cProgramName = 'Tim2View by [Lab 313]';
cProgramVersion = '2.0'; cProgramVersion = '2.0 r48 Release';
cExtractedTimsDir = 'TIMS'; cExtractedTimsDir = 'TIMS';
cMaxFileSize = $2EAEED80; cMaxFileSize = $2EAEED80;

View File

@@ -1,8 +1,9 @@
object frmMain: TfrmMain object frmMain: TfrmMain
Left = 0 Left = 0
Top = 0 Top = 0
Width = 754 Width = 780
Height = 591 Height = 591
ActiveControl = pnlList
AutoScroll = True AutoScroll = True
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -494,7 +495,7 @@ object frmMain: TfrmMain
object pnlStatus: TPanel object pnlStatus: TPanel
Left = 0 Left = 0
Top = 502 Top = 502
Width = 738 Width = 764
Height = 30 Height = 30
Align = alBottom Align = alBottom
BevelOuter = bvLowered BevelOuter = bvLowered
@@ -502,19 +503,19 @@ object frmMain: TfrmMain
object lblStatus: TLabel object lblStatus: TLabel
Left = 76 Left = 76
Top = 1 Top = 1
Width = 157 Width = 164
Height = 28 Height = 28
Align = alClient Align = alClient
Alignment = taRightJustify Alignment = taRightJustify
Layout = tlCenter Layout = tlCenter
ExplicitLeft = 230 ExplicitLeft = 237
ExplicitWidth = 3 ExplicitWidth = 3
ExplicitHeight = 13 ExplicitHeight = 13
end end
object pbProgress: TProgressBar object pbProgress: TProgressBar
Left = 233 Left = 240
Top = 1 Top = 1
Width = 504 Width = 523
Height = 28 Height = 28
Align = alRight Align = alRight
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
@@ -536,7 +537,7 @@ object frmMain: TfrmMain
object cbbFiles: TComboBox object cbbFiles: TComboBox
Left = 0 Left = 0
Top = 0 Top = 0
Width = 738 Width = 764
Height = 21 Height = 21
Align = alTop Align = alTop
AutoDropDown = True AutoDropDown = True
@@ -550,13 +551,13 @@ object frmMain: TfrmMain
object pnlMain: TPanel object pnlMain: TPanel
Left = 0 Left = 0
Top = 21 Top = 21
Width = 738 Width = 764
Height = 481 Height = 481
Align = alClient Align = alClient
BevelOuter = bvNone BevelOuter = bvNone
TabOrder = 1 TabOrder = 1
object splMain: TSplitter object splMain: TSplitter
Left = 233 Left = 240
Top = 0 Top = 0
Height = 481 Height = 481
ResizeStyle = rsUpdate ResizeStyle = rsUpdate
@@ -565,7 +566,7 @@ object frmMain: TfrmMain
object pnlList: TPanel object pnlList: TPanel
Left = 0 Left = 0
Top = 0 Top = 0
Width = 233 Width = 240
Height = 481 Height = 481
Align = alLeft Align = alLeft
BevelOuter = bvNone BevelOuter = bvNone
@@ -573,7 +574,7 @@ object frmMain: TfrmMain
object lvList: TListView object lvList: TListView
Left = 0 Left = 0
Top = 0 Top = 0
Width = 233 Width = 240
Height = 481 Height = 481
Align = alClient Align = alClient
Columns = < Columns = <
@@ -583,11 +584,17 @@ object frmMain: TfrmMain
end end
item item
Alignment = taCenter Alignment = taCenter
Caption = 'Resolution' Caption = 'W x H'
Width = 95 Width = 70
end end
item item
Alignment = taCenter
Caption = 'BPP' Caption = 'BPP'
Width = 35
end
item
Alignment = taCenter
Caption = 'CLUTs'
end> end>
ColumnClick = False ColumnClick = False
DoubleBuffered = True DoubleBuffered = True
@@ -607,9 +614,9 @@ object frmMain: TfrmMain
end end
end end
object pnlImage: TPanel object pnlImage: TPanel
Left = 236 Left = 243
Top = 0 Top = 0
Width = 502 Width = 521
Height = 481 Height = 481
Align = alClient Align = alClient
BevelOuter = bvLowered BevelOuter = bvLowered
@@ -617,31 +624,31 @@ object frmMain: TfrmMain
object splImageClut: TSplitter object splImageClut: TSplitter
Left = 1 Left = 1
Top = 1 Top = 1
Width = 500 Width = 519
Height = 3 Height = 3
Cursor = crVSplit Cursor = crVSplit
Align = alTop Align = alTop
Beveled = True Beveled = True
ResizeStyle = rsUpdate ResizeStyle = rsUpdate
ExplicitTop = 274 ExplicitTop = 274
ExplicitWidth = 500
end end
object pbTim: TImage object pbTim: TImage
AlignWithMargins = True AlignWithMargins = True
Left = 4 Left = 4
Top = 7 Top = 7
Width = 494 Width = 513
Height = 290 Height = 293
Align = alClient Align = alClient
Center = True Center = True
PopupMenu = pmImage
Proportional = True Proportional = True
ExplicitLeft = 6 ExplicitWidth = 517
ExplicitTop = -59
ExplicitHeight = 265
end end
object grdCurrClut: TDrawGrid object grdCurrClut: TDrawGrid
Left = 1 Left = 1
Top = 300 Top = 303
Width = 500 Width = 519
Height = 150 Height = 150
Align = alBottom Align = alBottom
ColCount = 1 ColCount = 1
@@ -662,56 +669,37 @@ object frmMain: TfrmMain
end end
object pnlImageOptions: TPanel object pnlImageOptions: TPanel
Left = 1 Left = 1
Top = 450 Top = 453
Width = 500 Width = 519
Height = 30 Height = 27
Align = alBottom Align = alBottom
BevelOuter = bvLowered AutoSize = True
BevelOuter = bvNone
TabOrder = 1 TabOrder = 1
object cbbCLUT: TComboBox object btnShowClut: TButton
Left = 467
Top = 0
Width = 52
Height = 27
Align = alRight
Caption = 'CLUT'
TabOrder = 0
OnClick = btnShowClutClick
end
object cbbBitMode: TComboBox
AlignWithMargins = True AlignWithMargins = True
Left = 4 Left = 3
Top = 4 Top = 3
Width = 93 Width = 74
Height = 21 Height = 21
Align = alLeft Align = alLeft
AutoDropDown = True AutoDropDown = True
AutoCloseUp = True AutoCloseUp = True
Style = csDropDownList Style = csDropDownList
Enabled = False Anchors = []
TabOrder = 0
OnChange = cbbCLUTChange
end
object cbbTransparenceMode: TComboBox
AlignWithMargins = True
Left = 103
Top = 4
Width = 122
Height = 21
Align = alLeft
Style = csDropDownList
Enabled = False Enabled = False
ItemIndex = 0 ItemIndex = 0
TabOrder = 1 TabOrder = 1
Text = 'Full transparence'
OnChange = cbbTransparenceModeChange
Items.Strings = (
'Full transparence'
'Black Transparence'
'Semi Transparence'
'No Transparence')
end
object cbbBitMode: TComboBox
AlignWithMargins = True
Left = 231
Top = 4
Width = 74
Height = 21
Align = alLeft
Style = csDropDownList
Enabled = False
ItemIndex = 0
TabOrder = 2
Text = 'Real' Text = 'Real'
OnChange = cbbBitModeChange OnChange = cbbBitModeChange
Items.Strings = ( Items.Strings = (
@@ -721,26 +709,43 @@ object frmMain: TfrmMain
'16 BPP' '16 BPP'
'24 BPP') '24 BPP')
end end
object chkStretch: TCheckBox object cbbTransparenceMode: TComboBox
AlignWithMargins = True AlignWithMargins = True
Left = 311 Left = 83
Top = 4 Top = 3
Width = 81 Width = 122
Height = 22 Height = 21
Action = actStretch Align = alLeft
Align = alClient AutoDropDown = True
AutoCloseUp = True
Style = csDropDownList
Anchors = []
Enabled = False Enabled = False
TabOrder = 3 ItemIndex = 0
TabOrder = 2
Text = 'Full transparence'
OnChange = cbbTransparenceModeChange
Items.Strings = (
'Full transparence'
'Black Transparence'
'Semi Transparence'
'No Transparence')
end end
object btnShowClut: TButton object cbbCLUT: TComboBox
Left = 395 AlignWithMargins = True
Top = 1 Left = 355
Width = 104 Top = 3
Height = 28 Width = 109
Height = 21
Align = alRight Align = alRight
Caption = 'Show/Hide CLUT' AutoDropDown = True
TabOrder = 4 AutoCloseUp = True
OnClick = btnShowClutClick Style = csDropDownList
Anchors = []
DoubleBuffered = False
DropDownCount = 16
ParentDoubleBuffered = False
TabOrder = 3
end end
end end
end end
@@ -895,7 +900,7 @@ object frmMain: TfrmMain
end end
object actStretch: TAction object actStretch: TAction
AutoCheck = True AutoCheck = True
Caption = '&Stretch' Caption = '&Stretch Image'
OnExecute = actStretchExecute OnExecute = actStretchExecute
end end
object actTimInfo: TAction object actTimInfo: TAction
@@ -913,6 +918,12 @@ object frmMain: TfrmMain
ShortCut = 112 ShortCut = 112
OnExecute = actExtractListExecute OnExecute = actExtractListExecute
end end
object actChangeClutIdx: TAction
Caption = 'actChangeClutIdx'
end
object actChangeBackColor: TAction
Caption = '&Change Background Color'
end
end end
object pmList: TPopupMenu object pmList: TPopupMenu
Left = 640 Left = 640
@@ -939,4 +950,18 @@ object frmMain: TfrmMain
Action = actTimInfo Action = actTimInfo
end end
end end
object pmImage: TPopupMenu
Left = 480
Top = 502
object mnSaveAsPng: TMenuItem
Action = actTim2Png
end
object N5: TMenuItem
Caption = '-'
end
object mnStretch: TMenuItem
Action = actStretch
AutoCheck = True
end
end
end end

View File

@@ -46,7 +46,6 @@ type
pnlList: TPanel; pnlList: TPanel;
lvList: TListView; lvList: TListView;
pnlImageOptions: TPanel; pnlImageOptions: TPanel;
cbbCLUT: TComboBox;
cbbTransparenceMode: TComboBox; cbbTransparenceMode: TComboBox;
grdCurrClut: TDrawGrid; grdCurrClut: TDrawGrid;
pnlImage: TPanel; pnlImage: TPanel;
@@ -71,7 +70,6 @@ type
N2: TMenuItem; N2: TMenuItem;
SaveasPNG1: TMenuItem; SaveasPNG1: TMenuItem;
cbbBitMode: TComboBox; cbbBitMode: TComboBox;
chkStretch: TCheckBox;
actStretch: TAction; actStretch: TAction;
actTimInfo: TAction; actTimInfo: TAction;
mnTIMInfo: TMenuItem; mnTIMInfo: TMenuItem;
@@ -83,6 +81,8 @@ type
ExtractTIMs1: TMenuItem; ExtractTIMs1: TMenuItem;
pbTim: TImage; pbTim: TImage;
btnShowClut: TButton; btnShowClut: TButton;
cbbCLUT: TComboBox;
actChangeBackColor: TAction;
procedure btnStopScanClick(Sender: TObject); procedure btnStopScanClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure lvListData(Sender: TObject; Item: TListItem); procedure lvListData(Sender: TObject; Item: TListItem);
@@ -239,7 +239,7 @@ end;
procedure TfrmMain.actAboutExecute(Sender: TObject); procedure TfrmMain.actAboutExecute(Sender: TObject);
begin begin
MessageBox(Handle, 'Test version!', 'About', MB_OK + MB_ICONINFORMATION); MessageBox(Handle, 'Some "about strings" should be here!:)', 'About', MB_OK + MB_ICONINFORMATION);
end; end;
procedure TfrmMain.actAssocTimsExecute(Sender: TObject); procedure TfrmMain.actAssocTimsExecute(Sender: TObject);
@@ -282,10 +282,6 @@ begin
DrawSelTim; DrawSelTim;
DrawSelClut; DrawSelClut;
cbbCLUT.Items.BeginUpdate;
if (cbbCLUT.Items.Count > 0) then cbbCLUT.Items.Delete(cbbCLUT.ItemIndex);
cbbCLUT.Items.EndUpdate;
SetCLUTListToNoCLUT; SetCLUTListToNoCLUT;
cbbFiles.Items.Delete(cbbFiles.ItemIndex); cbbFiles.Items.Delete(cbbFiles.ItemIndex);
@@ -548,7 +544,7 @@ begin
cbbCLUT.Enabled := actReplaceTim.Enabled; cbbCLUT.Enabled := actReplaceTim.Enabled;
cbbTransparenceMode.Enabled := actReplaceTim.Enabled; cbbTransparenceMode.Enabled := actReplaceTim.Enabled;
cbbBitMode.Enabled := actReplaceTim.Enabled; cbbBitMode.Enabled := actReplaceTim.Enabled;
chkStretch.Enabled := actReplaceTim.Enabled; //actStretch.Enabled := actReplaceTim.Enabled;
end; end;
function TfrmMain.SelTIM(NewBitMode: Integer = $FF): PTIM; function TfrmMain.SelTIM(NewBitMode: Integer = $FF): PTIM;
@@ -635,7 +631,7 @@ begin
PNG.AssignTo(pbTim.Picture.Bitmap); PNG.AssignTo(pbTim.Picture.Bitmap);
FreeTIM(TIM); FreeTIM(TIM);
pbTim.Stretch := chkStretch.Checked; pbTim.Stretch := actStretch.Checked;
end; end;
function TfrmMain.ScanRes: TScanResult; function TfrmMain.ScanRes: TScanResult;
@@ -663,6 +659,8 @@ begin
hGridRect.Bottom := -1; hGridRect.Bottom := -1;
grdCurrClut.Selection := hGridRect; grdCurrClut.Selection := hGridRect;
pbTim.Parent.DoubleBuffered := true;
ScanThreads := TList<TScanThread>.Create; ScanThreads := TList<TScanThread>.Create;
ScanResult := TList<TScanResult>.Create; ScanResult := TList<TScanResult>.Create;
StartedScans := 0; StartedScans := 0;
@@ -812,8 +810,9 @@ begin
H := TimIdx(Item.Index).Height; H := TimIdx(Item.Index).Height;
Item.Caption := Format('%.6d', [Item.Index + 1]); Item.Caption := Format('%.6d', [Item.Index + 1]);
Item.SubItems.Add(Format('%dx%d', [W, H])); Item.SubItems.Add(Format('%.3dx%.3d', [W, H]));
Item.SubItems.Add(Format('%d', [TimIdx(Item.Index).BitMode])); Item.SubItems.Add(Format('%.2d', [TimIdx(Item.Index).BitMode]));
Item.SubItems.Add(Format('%.2d', [TimIdx(Item.Index).Cluts]));
end; end;
procedure TfrmMain.lvListSelectItem(Sender: TObject; Item: TListItem; procedure TfrmMain.lvListSelectItem(Sender: TObject; Item: TListItem;
@@ -901,11 +900,23 @@ begin
end; end;
procedure TfrmMain.SetCLUTListToNoCLUT; procedure TfrmMain.SetCLUTListToNoCLUT;
var
I: Integer;
begin begin
cbbCLUT.Items.BeginUpdate; if cbbCLUT.Items.Count > 0 then
cbbCLUT.Items.Clear; begin
cbbCLUT.Items.Add(sThisTimHasNoClut); cbbCLUT.Items.BeginUpdate;
cbbCLUT.Items.EndUpdate;
for I := 0 to cbbCLUT.Items.Count - 2 do
cbbCLUT.Items.Delete(I);
cbbCLUT.Items[0] := sThisTimHasNoClut;
cbbCLUT.Items.EndUpdate;
end
else
cbbCLUT.Items.Add(sThisTimHasNoClut);
cbbCLUT.ItemIndex := 0; cbbCLUT.ItemIndex := 0;
end; end;
@@ -918,14 +929,15 @@ begin
if TIM = nil then Exit; if TIM = nil then Exit;
CLUTS := GetTIMClutsCount(TIM); CLUTS := GetTIMClutsCount(TIM);
cbbCLUT.Clear; //cbbCLUT.Items.Clear;
for I := 1 to CLUTS do cbbCLUT.Items.BeginUpdate;
begin for I := 0 to cbbCLUT.Items.Count -1 do
cbbCLUT.Items.BeginUpdate; cbbCLUT.Items[i] := Format('CLUT [%.2d/%.2d]', [I + 1, CLUTS]);
cbbCLUT.Items.Add(Format('CLUT [%d/%d]', [I, CLUTS]));
cbbCLUT.Items.EndUpdate; for I := cbbCLUT.Items.Count + 1 to CLUTS do
end; cbbCLUT.Items.Add(Format('CLUT [%.2d/%.2d]', [I, CLUTS]));
cbbCLUT.Items.EndUpdate;
cbbCLUT.ItemIndex := 0; cbbCLUT.ItemIndex := 0;

View File

@@ -9,6 +9,7 @@ type
Width: Integer; Width: Integer;
Height: Integer; Height: Integer;
BitMode: Byte; BitMode: Byte;
Cluts: Integer;
Good: Boolean; Good: Boolean;
end; end;

View File

@@ -68,6 +68,12 @@ begin
ScanTim.Width := GetTimRealWidth(TIM); ScanTim.Width := GetTimRealWidth(TIM);
ScanTim.Height := GetTimHeight(TIM); ScanTim.Height := GetTimHeight(TIM);
ScanTim.Bitmode := BppToBitMode(TIM); ScanTim.Bitmode := BppToBitMode(TIM);
if TIMHasCLUT(TIM) then
ScanTim.Cluts := GetTimClutsCount(TIM)
else
ScanTim.Cluts := 0;
ScanTim.Good := TIMIsGood(TIM); ScanTim.Good := TIMIsGood(TIM);
pScanResult.Count := TIM^.dwTimNumber; pScanResult.Count := TIM^.dwTimNumber;