diff --git a/tim2view.lpi b/tim2view.lpi
index 5f7185f..e65cda9 100644
--- a/tim2view.lpi
+++ b/tim2view.lpi
@@ -23,8 +23,8 @@
-
-
+
+
@@ -365,8 +365,6 @@
-
-
diff --git a/tim2view.lps b/tim2view.lps
index 095d910..5ace0f4 100644
--- a/tim2view.lps
+++ b/tim2view.lps
@@ -3,7 +3,7 @@
-
+
@@ -23,11 +23,10 @@
-
-
-
+
+
@@ -51,10 +50,11 @@
+
-
+
@@ -86,8 +86,8 @@
-
-
+
+
@@ -108,8 +108,8 @@
-
-
+
+
@@ -130,8 +130,8 @@
-
-
+
+
@@ -160,7 +160,7 @@
-
+
diff --git a/tim2view.res b/tim2view.res
index c6f48d1..e5974d3 100644
Binary files a/tim2view.res and b/tim2view.res differ
diff --git a/ucommon.pas b/ucommon.pas
index cb32504..f72ced9 100644
--- a/ucommon.pas
+++ b/ucommon.pas
@@ -3,7 +3,7 @@ unit ucommon;
interface
const
- cProgramName = 'Tim2View SVN.r79 by [Lab 313] (for ' +
+ cProgramName = 'Tim2View SVN.r80 by [Lab 313] (for ' +
{$IFDEF Linux}'Linux' + {$IFEND}
{$IFDEF Darwin}'Mac OS X' + {$IFEND}
{$IFDEF Windows}'Windows' + {$IFEND}
diff --git a/udrawtim.pas b/udrawtim.pas
index 471457f..e066217 100644
--- a/udrawtim.pas
+++ b/udrawtim.pas
@@ -351,7 +351,11 @@ begin
if (FC.alpha = 0) or (FC.alpha = $8080) then
begin
- Grid^.Canvas.Brush.COLOR := clWhite;
+ if (R + G + B)/3 > 128 then
+ Grid^.Canvas.Brush.COLOR := clBlack
+ else
+ Grid^.Canvas.Brush.COLOR := clWhite;
+
if FC.ALPHA = 0 then
Rect.Bottom := Rect.Top + ((Rect.Bottom - Rect.Top) div 2)
else
diff --git a/umain.lfm b/umain.lfm
index 8c0c82e..8fd5bac 100644
--- a/umain.lfm
+++ b/umain.lfm
@@ -1,16 +1,16 @@
object frmMain: TfrmMain
Left = 919
- Height = 590
+ Height = 647
Top = 209
- Width = 780
+ Width = 790
HorzScrollBar.Page = 780
HorzScrollBar.Range = 489
VertScrollBar.Page = 570
VertScrollBar.Range = 344
ActiveControl = pnlList
AllowDropFiles = True
- ClientHeight = 570
- ClientWidth = 780
+ ClientHeight = 627
+ ClientWidth = 790
Color = clBtnFace
Font.Color = clWindowText
Font.Height = -11
@@ -498,12 +498,12 @@ object frmMain: TfrmMain
object pnlStatus: TPanel
Left = 0
Height = 30
- Top = 517
- Width = 780
+ Top = 574
+ Width = 790
Align = alBottom
BevelOuter = bvLowered
ClientHeight = 30
- ClientWidth = 780
+ ClientWidth = 790
TabOrder = 2
object lblStatus: TLabel
Left = 76
@@ -519,7 +519,7 @@ object frmMain: TfrmMain
Left = 258
Height = 28
Top = 1
- Width = 521
+ Width = 531
Align = alRight
Anchors = [akTop, akLeft, akRight, akBottom]
Smooth = True
@@ -540,7 +540,7 @@ object frmMain: TfrmMain
Left = 0
Height = 21
Top = 0
- Width = 780
+ Width = 790
Align = alTop
DropDownCount = 30
Enabled = False
@@ -552,33 +552,33 @@ object frmMain: TfrmMain
end
object pnlMain: TPanel
Left = 0
- Height = 496
+ Height = 553
Top = 21
- Width = 780
+ Width = 790
Align = alClient
BevelOuter = bvNone
- ClientHeight = 496
- ClientWidth = 780
+ ClientHeight = 553
+ ClientWidth = 790
TabOrder = 1
object splMain: TSplitter
Left = 253
- Height = 496
+ Height = 553
Top = 0
Width = 5
end
object pnlList: TPanel
Left = 0
- Height = 496
+ Height = 553
Top = 0
Width = 253
Align = alLeft
BevelOuter = bvNone
- ClientHeight = 496
+ ClientHeight = 553
ClientWidth = 253
TabOrder = 0
object lvList: TListView
Left = 0
- Height = 468
+ Height = 525
Top = 28
Width = 253
Align = alClient
@@ -646,31 +646,31 @@ object frmMain: TfrmMain
end
object pnlImage: TPanel
Left = 258
- Height = 496
+ Height = 553
Top = 0
- Width = 522
+ Width = 532
Align = alClient
BevelOuter = bvLowered
- ClientHeight = 496
- ClientWidth = 522
+ ClientHeight = 553
+ ClientWidth = 532
Color = clBtnFace
ParentColor = False
TabOrder = 1
object pnlImageOptions: TPanel
Left = 1
Height = 27
- Top = 468
- Width = 520
+ Top = 525
+ Width = 530
Align = alBottom
AutoSize = True
BevelOuter = bvLowered
ClientHeight = 27
- ClientWidth = 520
+ ClientWidth = 530
Color = clBtnFace
ParentColor = False
TabOrder = 0
object btnShowClut: TButton
- Left = 466
+ Left = 476
Height = 23
Top = 2
Width = 52
@@ -712,7 +712,7 @@ object frmMain: TfrmMain
Align = alLeft
BorderSpacing.Around = 1
ItemHeight = 13
- ItemIndex = 0
+ ItemIndex = 1
Items.Strings = (
'Full transparence'
'Black Transparence'
@@ -723,10 +723,10 @@ object frmMain: TfrmMain
OnCloseUp = actReturnFocusExecute
Style = csDropDownList
TabOrder = 2
- Text = 'Full transparence'
+ Text = 'Black Transparence'
end
object cbbCLUT: TComboBox
- Left = 356
+ Left = 366
Height = 21
Top = 2
Width = 109
@@ -741,22 +741,22 @@ object frmMain: TfrmMain
end
object pnlClut: TPanel
Left = 1
- Height = 129
- Top = 339
- Width = 520
+ Height = 157
+ Top = 368
+ Width = 530
Align = alBottom
BevelOuter = bvLowered
- ClientHeight = 129
- ClientWidth = 520
+ ClientHeight = 157
+ ClientWidth = 530
Color = clBtnFace
ParentColor = False
TabOrder = 1
Visible = False
object grdClut: TDrawGrid
Left = 1
- Height = 127
+ Height = 116
Top = 1
- Width = 518
+ Width = 528
Align = alClient
AutoEdit = False
ColCount = 1
@@ -775,13 +775,26 @@ object frmMain: TfrmMain
TitleFont.Name = 'Tahoma'
OnDblClick = grdClutDblClick
OnDrawCell = grdClutDrawCell
+ OnKeyUp = grdClutKeyUp
+ end
+ object lblClutHint: TLabel
+ Left = 1
+ Height = 39
+ Top = 117
+ Width = 528
+ Align = alBottom
+ Alignment = taCenter
+ Caption = 'Press "Space" key to invert Transparence bit.'#13#10'H-splitted color = black transparent.'#13#10'V-splitted color = non-black transparent.'
+ Layout = tlCenter
+ ParentColor = False
+ WordWrap = True
end
end
object imgTim: TImage
Left = 1
- Height = 338
+ Height = 367
Top = 1
- Width = 520
+ Width = 530
AntialiasingMode = amOff
Align = alClient
Center = True
@@ -793,8 +806,8 @@ object frmMain: TfrmMain
object sbMain: TStatusBar
Left = 0
Height = 23
- Top = 547
- Width = 780
+ Top = 604
+ Width = 790
Panels = <
item
Width = 50
diff --git a/umain.pas b/umain.pas
index 4375bf2..e1bd4ce 100644
--- a/umain.pas
+++ b/umain.pas
@@ -8,7 +8,7 @@ uses
Classes, SysUtils, FileUtil, Forms, Dialogs, ActnList,
Menus, StdCtrls, ExtCtrls, ComCtrls, Grids, ExtDlgs,
- uscanresult, uscanthread, usettings, utim, udrawtim, types;
+ uscanresult, uscanthread, usettings, utim, udrawtim, types, Controls;
{$INCLUDE todos.inc}
@@ -54,6 +54,7 @@ type
ExtractTIM1: TMenuItem;
grdClut: TDrawGrid;
imgTim: TImage;
+ lblClutHint: TLabel;
lblStatus: TLabel;
lvList: TListView;
MenuItem1: TMenuItem;
@@ -133,6 +134,7 @@ type
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
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 lvListData(Sender: TObject; Item: TListItem);
procedure lvListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
private
@@ -674,6 +676,39 @@ begin
FreeTIM(TIM);
end;
+procedure TfrmMain.grdClutKeyUp(Sender: TObject; var Key: Word;
+ Shift: TShiftState);
+var
+ TIM: PTIM;
+ SELECTED_CELL, CLUT_NUM: Integer;
+ CLUT_COLOR: TCLUT_COLOR;
+begin
+ if Key <> VK_SPACE then Exit;
+
+ TIM := SelectedTimInMode;
+ if TIM = nil then Exit;
+
+ SELECTED_CELL := grdClut.Row * grdClut.ColCount + grdClut.Col;
+
+ if SELECTED_CELL >= GetTimColorsCount(TIM) then
+ begin
+ FreeTIM(TIM);
+ Exit;
+ end;
+
+ CLUT_NUM := cbbCLUT.ItemIndex;
+ CLUT_COLOR := GetCLUTColor(TIM, CLUT_NUM, SELECTED_CELL);
+ CLUT_COLOR.STP := CLUT_COLOR.STP xor 1;
+
+ WriteCLUTColor(TIM, CLUT_NUM, SELECTED_CELL, CLUT_COLOR);
+
+ ReplaceTimInFileFromMemory(SelectedScanResult.ScanFile, TIM, SelectedTimInfo.Position, SelectedScanResult.IsImage);
+
+ FreeTIM(TIM);
+
+ UpdateTim(True, True, False);
+end;
+
procedure TfrmMain.lvListData(Sender: TObject; Item: TListItem);
var
W, H: Word;
diff --git a/usettings.pas b/usettings.pas
index 254240c..b63dcb7 100644
--- a/usettings.pas
+++ b/usettings.pas
@@ -49,7 +49,7 @@ end;
function TSettings.FTranspModeRead: Integer;
begin
- Result := FIniFile.ReadInteger(sMain, 'TranspMode', 0);
+ Result := FIniFile.ReadInteger(sMain, 'TranspMode', 1);
end;
procedure TSettings.FStretchModeWrite(Value: Boolean);