diff --git a/tim2view.dproj b/tim2view.dproj index 89fde48..51de921 100644 --- a/tim2view.dproj +++ b/tim2view.dproj @@ -5,7 +5,7 @@ VCL tim2view.dpr True - Debug + Release Win32 1 Application @@ -102,6 +102,7 @@ 0 + 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= true true madExcept;LeakChecking;$(DCC_Define) diff --git a/tim2view.res b/tim2view.res index 72d0490..fadbcb1 100644 Binary files a/tim2view.res and b/tim2view.res differ diff --git a/units/uCommon.pas b/units/uCommon.pas index cd7b696..7d99c3a 100644 --- a/units/uCommon.pas +++ b/units/uCommon.pas @@ -7,7 +7,7 @@ uses const cProgramName = 'Tim2View by [Lab 313]'; - cProgramVersion = '2.0'; + cProgramVersion = '2.0 r48 Release'; cExtractedTimsDir = 'TIMS'; cMaxFileSize = $2EAEED80; diff --git a/units/uMain.dfm b/units/uMain.dfm index d9908be..e79adf7 100644 --- a/units/uMain.dfm +++ b/units/uMain.dfm @@ -1,8 +1,9 @@ object frmMain: TfrmMain Left = 0 Top = 0 - Width = 754 + Width = 780 Height = 591 + ActiveControl = pnlList AutoScroll = True Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -494,7 +495,7 @@ object frmMain: TfrmMain object pnlStatus: TPanel Left = 0 Top = 502 - Width = 738 + Width = 764 Height = 30 Align = alBottom BevelOuter = bvLowered @@ -502,19 +503,19 @@ object frmMain: TfrmMain object lblStatus: TLabel Left = 76 Top = 1 - Width = 157 + Width = 164 Height = 28 Align = alClient Alignment = taRightJustify Layout = tlCenter - ExplicitLeft = 230 + ExplicitLeft = 237 ExplicitWidth = 3 ExplicitHeight = 13 end object pbProgress: TProgressBar - Left = 233 + Left = 240 Top = 1 - Width = 504 + Width = 523 Height = 28 Align = alRight Anchors = [akLeft, akTop, akRight, akBottom] @@ -536,7 +537,7 @@ object frmMain: TfrmMain object cbbFiles: TComboBox Left = 0 Top = 0 - Width = 738 + Width = 764 Height = 21 Align = alTop AutoDropDown = True @@ -550,13 +551,13 @@ object frmMain: TfrmMain object pnlMain: TPanel Left = 0 Top = 21 - Width = 738 + Width = 764 Height = 481 Align = alClient BevelOuter = bvNone TabOrder = 1 object splMain: TSplitter - Left = 233 + Left = 240 Top = 0 Height = 481 ResizeStyle = rsUpdate @@ -565,7 +566,7 @@ object frmMain: TfrmMain object pnlList: TPanel Left = 0 Top = 0 - Width = 233 + Width = 240 Height = 481 Align = alLeft BevelOuter = bvNone @@ -573,7 +574,7 @@ object frmMain: TfrmMain object lvList: TListView Left = 0 Top = 0 - Width = 233 + Width = 240 Height = 481 Align = alClient Columns = < @@ -583,11 +584,17 @@ object frmMain: TfrmMain end item Alignment = taCenter - Caption = 'Resolution' - Width = 95 + Caption = 'W x H' + Width = 70 end item + Alignment = taCenter Caption = 'BPP' + Width = 35 + end + item + Alignment = taCenter + Caption = 'CLUTs' end> ColumnClick = False DoubleBuffered = True @@ -607,9 +614,9 @@ object frmMain: TfrmMain end end object pnlImage: TPanel - Left = 236 + Left = 243 Top = 0 - Width = 502 + Width = 521 Height = 481 Align = alClient BevelOuter = bvLowered @@ -617,31 +624,31 @@ object frmMain: TfrmMain object splImageClut: TSplitter Left = 1 Top = 1 - Width = 500 + Width = 519 Height = 3 Cursor = crVSplit Align = alTop Beveled = True ResizeStyle = rsUpdate ExplicitTop = 274 + ExplicitWidth = 500 end object pbTim: TImage AlignWithMargins = True Left = 4 Top = 7 - Width = 494 - Height = 290 + Width = 513 + Height = 293 Align = alClient Center = True + PopupMenu = pmImage Proportional = True - ExplicitLeft = 6 - ExplicitTop = -59 - ExplicitHeight = 265 + ExplicitWidth = 517 end object grdCurrClut: TDrawGrid Left = 1 - Top = 300 - Width = 500 + Top = 303 + Width = 519 Height = 150 Align = alBottom ColCount = 1 @@ -662,56 +669,37 @@ object frmMain: TfrmMain end object pnlImageOptions: TPanel Left = 1 - Top = 450 - Width = 500 - Height = 30 + Top = 453 + Width = 519 + Height = 27 Align = alBottom - BevelOuter = bvLowered + AutoSize = True + BevelOuter = bvNone 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 - Left = 4 - Top = 4 - Width = 93 + Left = 3 + Top = 3 + Width = 74 Height = 21 Align = alLeft AutoDropDown = True AutoCloseUp = True Style = csDropDownList - Enabled = False - TabOrder = 0 - OnChange = cbbCLUTChange - end - object cbbTransparenceMode: TComboBox - AlignWithMargins = True - Left = 103 - Top = 4 - Width = 122 - Height = 21 - Align = alLeft - Style = csDropDownList + Anchors = [] Enabled = False ItemIndex = 0 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' OnChange = cbbBitModeChange Items.Strings = ( @@ -721,26 +709,43 @@ object frmMain: TfrmMain '16 BPP' '24 BPP') end - object chkStretch: TCheckBox + object cbbTransparenceMode: TComboBox AlignWithMargins = True - Left = 311 - Top = 4 - Width = 81 - Height = 22 - Action = actStretch - Align = alClient + Left = 83 + Top = 3 + Width = 122 + Height = 21 + Align = alLeft + AutoDropDown = True + AutoCloseUp = True + Style = csDropDownList + Anchors = [] Enabled = False - TabOrder = 3 + ItemIndex = 0 + TabOrder = 2 + Text = 'Full transparence' + OnChange = cbbTransparenceModeChange + Items.Strings = ( + 'Full transparence' + 'Black Transparence' + 'Semi Transparence' + 'No Transparence') end - object btnShowClut: TButton - Left = 395 - Top = 1 - Width = 104 - Height = 28 + object cbbCLUT: TComboBox + AlignWithMargins = True + Left = 355 + Top = 3 + Width = 109 + Height = 21 Align = alRight - Caption = 'Show/Hide CLUT' - TabOrder = 4 - OnClick = btnShowClutClick + AutoDropDown = True + AutoCloseUp = True + Style = csDropDownList + Anchors = [] + DoubleBuffered = False + DropDownCount = 16 + ParentDoubleBuffered = False + TabOrder = 3 end end end @@ -895,7 +900,7 @@ object frmMain: TfrmMain end object actStretch: TAction AutoCheck = True - Caption = '&Stretch' + Caption = '&Stretch Image' OnExecute = actStretchExecute end object actTimInfo: TAction @@ -913,6 +918,12 @@ object frmMain: TfrmMain ShortCut = 112 OnExecute = actExtractListExecute end + object actChangeClutIdx: TAction + Caption = 'actChangeClutIdx' + end + object actChangeBackColor: TAction + Caption = '&Change Background Color' + end end object pmList: TPopupMenu Left = 640 @@ -939,4 +950,18 @@ object frmMain: TfrmMain Action = actTimInfo 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 diff --git a/units/uMain.pas b/units/uMain.pas index 8652320..1c20ec4 100644 --- a/units/uMain.pas +++ b/units/uMain.pas @@ -46,7 +46,6 @@ type pnlList: TPanel; lvList: TListView; pnlImageOptions: TPanel; - cbbCLUT: TComboBox; cbbTransparenceMode: TComboBox; grdCurrClut: TDrawGrid; pnlImage: TPanel; @@ -71,7 +70,6 @@ type N2: TMenuItem; SaveasPNG1: TMenuItem; cbbBitMode: TComboBox; - chkStretch: TCheckBox; actStretch: TAction; actTimInfo: TAction; mnTIMInfo: TMenuItem; @@ -83,6 +81,8 @@ type ExtractTIMs1: TMenuItem; pbTim: TImage; btnShowClut: TButton; + cbbCLUT: TComboBox; + actChangeBackColor: TAction; procedure btnStopScanClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure lvListData(Sender: TObject; Item: TListItem); @@ -239,7 +239,7 @@ end; procedure TfrmMain.actAboutExecute(Sender: TObject); begin - MessageBox(Handle, 'Test version!', 'About', MB_OK + MB_ICONINFORMATION); + MessageBox(Handle, 'Some "about strings" should be here!:)', 'About', MB_OK + MB_ICONINFORMATION); end; procedure TfrmMain.actAssocTimsExecute(Sender: TObject); @@ -282,10 +282,6 @@ begin DrawSelTim; DrawSelClut; - cbbCLUT.Items.BeginUpdate; - if (cbbCLUT.Items.Count > 0) then cbbCLUT.Items.Delete(cbbCLUT.ItemIndex); - cbbCLUT.Items.EndUpdate; - SetCLUTListToNoCLUT; cbbFiles.Items.Delete(cbbFiles.ItemIndex); @@ -548,7 +544,7 @@ begin cbbCLUT.Enabled := actReplaceTim.Enabled; cbbTransparenceMode.Enabled := actReplaceTim.Enabled; cbbBitMode.Enabled := actReplaceTim.Enabled; - chkStretch.Enabled := actReplaceTim.Enabled; + //actStretch.Enabled := actReplaceTim.Enabled; end; function TfrmMain.SelTIM(NewBitMode: Integer = $FF): PTIM; @@ -635,7 +631,7 @@ begin PNG.AssignTo(pbTim.Picture.Bitmap); FreeTIM(TIM); - pbTim.Stretch := chkStretch.Checked; + pbTim.Stretch := actStretch.Checked; end; function TfrmMain.ScanRes: TScanResult; @@ -663,6 +659,8 @@ begin hGridRect.Bottom := -1; grdCurrClut.Selection := hGridRect; + pbTim.Parent.DoubleBuffered := true; + ScanThreads := TList.Create; ScanResult := TList.Create; StartedScans := 0; @@ -812,8 +810,9 @@ begin H := TimIdx(Item.Index).Height; Item.Caption := Format('%.6d', [Item.Index + 1]); - Item.SubItems.Add(Format('%dx%d', [W, H])); - Item.SubItems.Add(Format('%d', [TimIdx(Item.Index).BitMode])); + Item.SubItems.Add(Format('%.3dx%.3d', [W, H])); + Item.SubItems.Add(Format('%.2d', [TimIdx(Item.Index).BitMode])); + Item.SubItems.Add(Format('%.2d', [TimIdx(Item.Index).Cluts])); end; procedure TfrmMain.lvListSelectItem(Sender: TObject; Item: TListItem; @@ -901,11 +900,23 @@ begin end; procedure TfrmMain.SetCLUTListToNoCLUT; +var + I: Integer; begin - cbbCLUT.Items.BeginUpdate; - cbbCLUT.Items.Clear; - cbbCLUT.Items.Add(sThisTimHasNoClut); - cbbCLUT.Items.EndUpdate; + if cbbCLUT.Items.Count > 0 then + begin + cbbCLUT.Items.BeginUpdate; + + 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; end; @@ -918,14 +929,15 @@ begin if TIM = nil then Exit; CLUTS := GetTIMClutsCount(TIM); - cbbCLUT.Clear; + //cbbCLUT.Items.Clear; - for I := 1 to CLUTS do - begin - cbbCLUT.Items.BeginUpdate; - cbbCLUT.Items.Add(Format('CLUT [%d/%d]', [I, CLUTS])); - cbbCLUT.Items.EndUpdate; - end; + cbbCLUT.Items.BeginUpdate; + for I := 0 to cbbCLUT.Items.Count -1 do + cbbCLUT.Items[i] := Format('CLUT [%.2d/%.2d]', [I + 1, CLUTS]); + + for I := cbbCLUT.Items.Count + 1 to CLUTS do + cbbCLUT.Items.Add(Format('CLUT [%.2d/%.2d]', [I, CLUTS])); + cbbCLUT.Items.EndUpdate; cbbCLUT.ItemIndex := 0; @@ -959,4 +971,4 @@ begin end; -end. +end. \ No newline at end of file diff --git a/units/uScanResult.pas b/units/uScanResult.pas index a1791e6..404467e 100644 --- a/units/uScanResult.pas +++ b/units/uScanResult.pas @@ -9,6 +9,7 @@ type Width: Integer; Height: Integer; BitMode: Byte; + Cluts: Integer; Good: Boolean; end; diff --git a/units/uScanThread.pas b/units/uScanThread.pas index a66cc3b..c86b804 100644 --- a/units/uScanThread.pas +++ b/units/uScanThread.pas @@ -68,6 +68,12 @@ begin ScanTim.Width := GetTimRealWidth(TIM); ScanTim.Height := GetTimHeight(TIM); ScanTim.Bitmode := BppToBitMode(TIM); + + if TIMHasCLUT(TIM) then + ScanTim.Cluts := GetTimClutsCount(TIM) + else + ScanTim.Cluts := 0; + ScanTim.Good := TIMIsGood(TIM); pScanResult.Count := TIM^.dwTimNumber;