diff --git a/tim2view.lpi b/tim2view.lpi
index e287cbb..4829e37 100644
--- a/tim2view.lpi
+++ b/tim2view.lpi
@@ -24,6 +24,7 @@
+
@@ -42,7 +43,7 @@
-
+
@@ -111,6 +112,10 @@
+
+
+
+
@@ -130,15 +135,7 @@
-
-
-
-
-
-
-
-
diff --git a/tim2view.lps b/tim2view.lps
index 73147d7..7383ba3 100644
--- a/tim2view.lps
+++ b/tim2view.lps
@@ -1,138 +1,155 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tim2view.res b/tim2view.res
index 6528d25..a694ad7 100644
Binary files a/tim2view.res and b/tim2view.res differ
diff --git a/ucommon.pas b/ucommon.pas
index cd495e0..7257061 100644
--- a/ucommon.pas
+++ b/ucommon.pas
@@ -3,7 +3,7 @@ unit ucommon;
interface
const
- cProgramName = 'Tim2View SVN.r67 by [Lab 313] (for ' +
+ cProgramName = 'Tim2View SVN.r70 by [Lab 313] (for ' +
{$IFDEF Linux}'Linux' + {$IFEND}
{$IFDEF Darwin}'Mac OS X' + {$IFEND}
{$IFDEF Windows}'Windows' + {$IFEND}
@@ -18,7 +18,7 @@ const
sStatusBarScanningFile = 'Scanning File...';
sStatusBarTimsExtracting = 'TIMs Extracting...';
sStatusBarPngsExtracting = 'PNGs Extracting...';
- sStatusBarExtracted = 'Exctracted Successfully!';
+ sStatusBarExtracted = 'Extracted Successfully!';
sStatusBarParsingResult = 'Parsing Result...';
sScanResultGood = 'Scan completed!';
sSelectDirCaption = 'Please, select directory for scan...';
diff --git a/umain.lfm b/umain.lfm
index 2000cba..1e8ceff 100644
--- a/umain.lfm
+++ b/umain.lfm
@@ -1,7 +1,7 @@
object frmMain: TfrmMain
- Left = 561
+ Left = 807
Height = 590
- Top = 213
+ Top = 193
Width = 780
HorzScrollBar.Page = 780
HorzScrollBar.Range = 489
@@ -524,6 +524,7 @@ object frmMain: TfrmMain
Anchors = [akTop, akLeft, akRight, akBottom]
Smooth = True
TabOrder = 1
+ BarShowText = True
end
object btnStopScan: TButton
Left = 1
@@ -581,7 +582,6 @@ object frmMain: TfrmMain
Top = 28
Width = 253
Align = alClient
- AutoWidthLastColumn = True
Columns = <
item
Caption = '# / 0'
@@ -600,7 +600,7 @@ object frmMain: TfrmMain
item
Alignment = taCenter
Caption = 'CLUTs'
- Width = 84
+ Width = 57
end>
ColumnClick = False
GridLines = True
@@ -656,61 +656,23 @@ object frmMain: TfrmMain
Color = clBtnFace
ParentColor = False
TabOrder = 1
- object splImageClut: TSplitter
- Cursor = crVSplit
- Left = 1
- Height = 3
- Top = 1
- Width = 520
- Align = alTop
- Beveled = True
- Color = clBtnFace
- ParentColor = False
- ResizeAnchor = akTop
- end
- object grdCurrClut: TDrawGrid
- Left = 1
- Height = 150
- Top = 320
- Width = 520
- Align = alBottom
- AutoEdit = False
- ColCount = 1
- DefaultColWidth = 14
- DefaultRowHeight = 14
- Enabled = False
- ExtendedSelect = False
- FixedCols = 0
- FixedRows = 0
- Options = [goFixedVertLine, goFixedHorzLine, goDrawFocusSelected]
- RowCount = 1
- ScrollBars = ssAutoVertical
- TabOrder = 0
- TitleFont.Color = clWindowText
- TitleFont.Height = -11
- TitleFont.Name = 'Tahoma'
- UseXORFeatures = True
- Visible = False
- OnDblClick = grdCurrClutDblClick
- OnDrawCell = grdCurrClutDrawCell
- end
object pnlImageOptions: TPanel
Left = 1
- Height = 25
- Top = 470
+ Height = 27
+ Top = 468
Width = 520
Align = alBottom
AutoSize = True
- BevelOuter = bvNone
- ClientHeight = 25
+ BevelOuter = bvLowered
+ ClientHeight = 27
ClientWidth = 520
Color = clBtnFace
ParentColor = False
- TabOrder = 1
+ TabOrder = 0
object btnShowClut: TButton
- Left = 467
+ Left = 466
Height = 23
- Top = 1
+ Top = 2
Width = 52
Align = alRight
BorderSpacing.Around = 1
@@ -719,18 +681,20 @@ object frmMain: TfrmMain
TabOrder = 0
end
object cbbBitMode: TComboBox
- Left = 1
+ Left = 2
Height = 21
- Top = 1
- Width = 90
+ Top = 2
+ Width = 159
Align = alLeft
BorderSpacing.Around = 1
ItemHeight = 13
ItemIndex = 0
Items.Strings = (
'Real'
- '4 BPP'
- '8 BPP'
+ '4 BPP (Inner palette)'
+ '4 BPP (Random palette) '
+ '8 BPP (Inner palette)'
+ '8 BPP (Random palette)'
'16 BPP'
'24 BPP'
)
@@ -741,9 +705,9 @@ object frmMain: TfrmMain
Text = 'Real'
end
object cbbTranspMode: TComboBox
- Left = 92
+ Left = 162
Height = 21
- Top = 1
+ Top = 2
Width = 136
Align = alLeft
BorderSpacing.Around = 1
@@ -762,9 +726,9 @@ object frmMain: TfrmMain
Text = 'Full transparence'
end
object cbbCLUT: TComboBox
- Left = 357
+ Left = 356
Height = 21
- Top = 1
+ Top = 2
Width = 109
Align = alRight
BorderSpacing.Around = 1
@@ -775,10 +739,49 @@ object frmMain: TfrmMain
TabOrder = 3
end
end
+ object pnlClut: TPanel
+ Left = 1
+ Height = 116
+ Top = 352
+ Width = 520
+ Align = alBottom
+ BevelOuter = bvLowered
+ ClientHeight = 116
+ ClientWidth = 520
+ Color = clBtnFace
+ ParentColor = False
+ TabOrder = 1
+ Visible = False
+ object grdClut: TDrawGrid
+ Left = 1
+ Height = 114
+ Top = 1
+ Width = 518
+ Align = alClient
+ AutoEdit = False
+ ColCount = 1
+ DefaultColWidth = 14
+ DefaultRowHeight = 14
+ Enabled = False
+ ExtendedSelect = False
+ FixedCols = 0
+ FixedRows = 0
+ Options = [goFixedVertLine, goFixedHorzLine, goDrawFocusSelected]
+ RowCount = 1
+ ScrollBars = ssAutoVertical
+ TabOrder = 0
+ TitleFont.Color = clWindowText
+ TitleFont.Height = -11
+ TitleFont.Name = 'Tahoma'
+ UseXORFeatures = True
+ OnDblClick = grdClutDblClick
+ OnDrawCell = grdClutDrawCell
+ end
+ end
object imgTim: TImage
Left = 1
- Height = 316
- Top = 4
+ Height = 351
+ Top = 1
Width = 520
AntialiasingMode = amOff
Align = alClient
@@ -825,7 +828,7 @@ object frmMain: TfrmMain
Title = 'Please, select File...'
DefaultExt = '.bin'
Filter = 'All Files (*.*)|*.*'
- Options = [ofHideReadOnly, ofNoChangeDir, ofAllowMultiSelect, ofFileMustExist, ofNoNetworkButton, ofEnableSizing, ofForceShowHidden]
+ Options = [ofHideReadOnly, ofNoChangeDir, ofAllowMultiSelect, ofNoNetworkButton, ofEnableSizing, ofForceShowHidden]
left = 664
top = 448
end
@@ -1076,7 +1079,7 @@ object frmMain: TfrmMain
end
end
object dlgSelectDir: TSelectDirectoryDialog
- Options = [ofNoChangeDir, ofPathMustExist, ofNoNetworkButton, ofEnableSizing, ofViewDetail]
+ Options = [ofNoChangeDir, ofNoNetworkButton, ofEnableSizing, ofViewDetail]
left = 449
top = 450
end
diff --git a/umain.pas b/umain.pas
index 720e7f8..6d019d0 100644
--- a/umain.pas
+++ b/umain.pas
@@ -10,6 +10,8 @@ uses
uscanresult, uscanthread, usettings, utim, udrawtim;
+{$INCLUDE todos.inc}
+
type
{ TfrmMain }
@@ -49,7 +51,7 @@ type
dlgSavePNG: TSavePictureDialog;
dlgSaveTIM: TSaveDialog;
ExtractTIM1: TMenuItem;
- grdCurrClut: TDrawGrid;
+ grdClut: TDrawGrid;
imgTim: TImage;
lblStatus: TLabel;
lvList: TListView;
@@ -83,6 +85,7 @@ type
N1: TMenuItem;
N3: TMenuItem;
N5: TMenuItem;
+ pnlClut: TPanel;
pbProgress: TProgressBar;
pnlExtractAll: TPanel;
pnlImage: TPanel;
@@ -95,7 +98,6 @@ type
ReplaceTIM1: TMenuItem;
SaveasPNG1: TMenuItem;
dlgSelectDir: TSelectDirectoryDialog;
- splImageClut: TSplitter;
splMain: TSplitter;
sbMain: TStatusBar;
procedure actAboutExecute(Sender: TObject);
@@ -124,8 +126,8 @@ type
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
- procedure grdCurrClutDblClick(Sender: TObject);
- procedure grdCurrClutDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
+ procedure grdClutDblClick(Sender: TObject);
+ procedure grdClutDrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
procedure lvListData(Sender: TObject; Item: TListItem);
procedure lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
private
@@ -165,6 +167,7 @@ type
function FormatPngName(const FileName: string; ListIdx_, BitMode, Clut: Integer): string;
procedure ShowTim;
procedure ShowTimInfo(ShowInfo: Boolean);
+ procedure RemoveGridSelection;
public
{ public declarations }
ScanResults: TScanResultList; //List of finished scan results
@@ -182,6 +185,10 @@ uses ucdimage, ucpucount, lcltype, ucommon, LCLIntf
{$IFDEF windows}
,registry
{$IFEND}
+
+{$IFDEF Linux}
+,BaseUnix
+{$IFEND}
;
{$R *.lfm}
@@ -229,11 +236,12 @@ begin
if not dlgSavePNG.Execute then Exit;
Surf^.SaveToFile(UTF8ToSys(dlgSavePNG.FileName));
+ {$IFDEF Linux}FpChmod(dlgSavePNG.FileName, &777){$IFEND}
end;
procedure TfrmMain.btnShowClutClick(Sender: TObject);
begin
- grdCurrClut.Visible := not grdCurrClut.Visible;
+ pnlClut.Visible := not pnlClut.Visible;
DrawSelClut;
actReturnFocus.Execute;
end;
@@ -262,7 +270,7 @@ end;
procedure TfrmMain.actAboutExecute(Sender: TObject);
begin
- Application.MessageBox(cProgramName + #13 + 'Some "about strings" should be here!:)', 'About', MB_OK + MB_ICONINFORMATION);
+ Application.MessageBox(cProgramName + #13#10#13#10 + 'Some "about strings" should be here!:)', 'About', MB_OK + MB_ICONINFORMATION);
end;
procedure TfrmMain.actAssocTimsExecute(Sender: TObject);
@@ -380,7 +388,9 @@ begin
TIM := LoadTimFromFile(FName, OFFSET, IsImage, SIZE);
TimToPNG(TIM, cbbCLUT.ItemIndex, Surf_, cbbTranspMode.ItemIndex);
- Surf_^.SaveToFile(UTF8ToSys(Path + FormatPngName(FName, I - 1, BIT_MODE, 0)));
+ Path := Path + FormatPngName(FName, I - 1, BIT_MODE, 0);
+ Surf_^.SaveToFile(UTF8ToSys(Path));
+ {$IFDEF Linux}FpChmod(Path, &777){$IFEND}
Surf_^.Free;
Surf_^ := nil;
@@ -404,6 +414,7 @@ begin
TIM := SelectedTim;
SaveTimToFile(dlgSaveTIM.FileName, TIM);
+ {$IFDEF Linux}FpChmod(dlgSaveTIM.FileName, &777){$IFEND}
FreeTIM(TIM);
end;
@@ -435,7 +446,9 @@ begin
CreateDirUTF8(Path);
TIM := LoadTimFromFile(FName, OFFSET, IsImage, SIZE);
- SaveTimToFile(Path + FormatTimName(FName, I - 1, BIT_MODE), TIM);
+ Path := Path + FormatTimName(FName, I - 1, BIT_MODE);
+ SaveTimToFile(Path, TIM);
+ {$IFDEF Linux}FpChmod(Path, &777){$IFEND}
FreeTIM(TIM);
pbProgress.Position := I;
@@ -501,24 +514,15 @@ begin
end;
procedure TfrmMain.FormCreate(Sender: TObject);
-var
- hGridRect: TGridRect;
begin
- {$IFnDEF Windows}mnOptions.Enabled := False;{$IFEND}
-
Settings := TSettings.Create(ExtractFilePath(ParamStrUTF8(0)));
actStretch.Checked := Settings.StretchMode;
cbbTranspMode.ItemIndex := Settings.TranspMode;
LastDir := Settings.LastDir;
+ cbbBitMode.ItemIndex := Settings.BitMode;
pnlImage.Color := Settings.BackColor;
- hGridRect.Top := -1;
- hGridRect.Left := -1;
- hGridRect.Right := -1;
- hGridRect.Bottom := -1;
- grdCurrClut.Selection := hGridRect;
-
ScanThreads := TScanThreadList.Create(False); //False - to able scan thread remove itself from this list
ScanResults := TScanResultList.Create(False);
StartedScans := 0;
@@ -543,7 +547,7 @@ begin
ScanPath(FileNames[i - 1]);
end;
-procedure TfrmMain.grdCurrClutDblClick(Sender: TObject);
+procedure TfrmMain.grdClutDblClick(Sender: TObject);
var
TIM: PTIM;
I, SELECTED_CELL, W, DIALOG_COLOR, CLUT_NUM: Integer;
@@ -553,7 +557,7 @@ begin
TIM := SelectedTim;
if TIM = nil then Exit;
- SELECTED_CELL := grdCurrCLUT.Row * grdCurrCLUT.ColCount + grdCurrCLUT.Col;
+ SELECTED_CELL := grdClut.Row * grdClut.ColCount + grdClut.Col;
W := GetTimColorsCount(TIM);
if SELECTED_CELL >= W then
@@ -603,7 +607,7 @@ begin
end;
-procedure TfrmMain.grdCurrClutDrawCell(Sender: TObject; aCol, aRow: Integer;
+procedure TfrmMain.grdClutDrawCell(Sender: TObject; aCol, aRow: Integer;
aRect: TRect; aState: TGridDrawState);
var
TIM: PTIM;
@@ -617,7 +621,7 @@ begin
Exit;
end;
- DrawClutCell(TIM, cbbCLUT.ItemIndex, @grdCurrCLUT, ACol, ARow);
+ DrawClutCell(TIM, cbbCLUT.ItemIndex, @grdClut, ACol, ARow);
FreeTIM(TIM);
end;
@@ -763,6 +767,8 @@ end;
procedure TfrmMain.CheckButtonsAndMainMenu;
begin
+ RemoveGridSelection;
+
cbbFiles.Enabled := (cbbFiles.Items.Count <> 0);
pnlList.Enabled := cbbFiles.Enabled;
@@ -827,7 +833,6 @@ begin
if TIM = nil then Exit;
CLUTS := GetTIMClutsCount(TIM);
- //cbbCLUT.Items.Clear;
cbbCLUT.Items.BeginUpdate;
for I := 0 to cbbCLUT.Items.Count -1 do
@@ -854,9 +859,11 @@ begin
case cbbBitMode.ItemIndex of
1: mode := cTIM4C;
- 2: mode := cTIM8C;
- 3: mode := cTIM16NC;
- 4: mode := cTIM24NC;
+ 2: mode := cTIM4NC;
+ 3: mode := cTIM8C;
+ 4: mode := cTIM8NC;
+ 5: mode := cTIM16NC;
+ 6: mode := cTIM24NC;
else
mode := $FF;
end;
@@ -878,26 +885,26 @@ procedure TfrmMain.DrawSelClut;
var
TIM: PTIM;
begin
- if not grdCurrClut.Visible then Exit;
+ if not pnlClut.Visible then Exit;
- ClearGrid(@grdCurrCLUT);
+ ClearGrid(@grdClut);
TIM := SelectedTim;
if TIM = nil then
begin
- grdCurrCLUT.ColCount := 1;
- grdCurrCLUT.RowCount := 1;
+ grdClut.ColCount := 1;
+ grdClut.RowCount := 1;
Exit;
end;
- grdCurrCLUT.Enabled := TIMHasCLUT(TIM);
+ grdClut.Enabled := TIMHasCLUT(TIM);
if TIMHasCLUT(TIM) then
- DrawCLUT(TIM, cbbCLUT.ItemIndex, @grdCurrCLUT)
+ DrawCLUT(TIM, cbbCLUT.ItemIndex, @grdClut)
else
begin
- grdCurrCLUT.ColCount := 1;
- grdCurrCLUT.RowCount := 1;
+ grdClut.ColCount := 1;
+ grdClut.RowCount := 1;
end;
FreeTIM(TIM);
@@ -927,7 +934,8 @@ begin
if (lvList.Selected = nil) then Exit;
if (lvList.Items.Count = 0) then Exit;
- cbbBitMode.ItemIndex := 0;
+ { TODO : Reset bitmode or not? }
+ //cbbBitMode.ItemIndex := 0;
UpdateCLUTInfo;
DrawSelTim;
@@ -981,5 +989,16 @@ begin
FreeTIM(TIM);
end;
+procedure TfrmMain.RemoveGridSelection;
+var
+ hGrid: TGridRect;
+begin
+ hGrid.Top := -1;
+ hGrid.Left := -1;
+ hGrid.Right := -1;
+ hGrid.Bottom := -1;
+ grdClut.Selection := hGrid;
+end;
+
end.
diff --git a/usettings.pas b/usettings.pas
index d3784f6..6f03c8b 100644
--- a/usettings.pas
+++ b/usettings.pas
@@ -22,6 +22,8 @@ type
function FLastDirRead(): string;
procedure FBackColorWrite(Color: TColor);
function FBackColorRead(): TColor;
+ procedure FBitModeWrite(Mode: Integer);
+ function FBitModeRead(): Integer;
public
constructor Create(const DirPath: string);
destructor Destroy; override;
@@ -29,6 +31,7 @@ type
property StretchMode: Boolean read FStretchModeRead write FStretchModeWrite;
property LastDir: string read FLastDirRead write FLastDirWrite;
property BackColor: TColor read FBackColorRead write FBackColorWrite;
+ property BitMode: Integer read FBitModeRead write FBitModeWrite;
end;
implementation
@@ -79,6 +82,16 @@ begin
Result := FIniFile.ReadInteger(sMain, 'BackColor', clBtnFace);
end;
+procedure TSettings.FBitModeWrite(Mode: Integer);
+begin
+ FIniFile.WriteInteger(sMain, 'BitMode', Mode);
+end;
+
+function TSettings.FBitModeRead: Integer;
+begin
+ Result := FIniFile.ReadInteger(sMain, 'BitMode', 0);
+end;
+
constructor TSettings.Create(const DirPath: string);
begin
inherited Create;