This commit is contained in:
44
tim2view.lps
44
tim2view.lps
@@ -23,8 +23,8 @@
|
||||
<UnitName Value="umain"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="362"/>
|
||||
<CursorPos X="48" Y="368"/>
|
||||
<TopLine Value="787"/>
|
||||
<CursorPos X="42" Y="802"/>
|
||||
<UsageCount Value="816"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -48,10 +48,10 @@
|
||||
<Filename Value="ucommon.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ucommon"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="45" Y="10"/>
|
||||
<TopLine Value="17"/>
|
||||
<CursorPos X="20" Y="35"/>
|
||||
<UsageCount Value="816"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
@@ -59,7 +59,7 @@
|
||||
<Filename Value="utim.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="utim"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<EditorIndex Value="10"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="185"/>
|
||||
<CursorPos X="1" Y="204"/>
|
||||
@@ -70,7 +70,7 @@
|
||||
<Filename Value="ucdimage.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ucdimage"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="112"/>
|
||||
<CursorPos X="50" Y="117"/>
|
||||
@@ -81,7 +81,7 @@
|
||||
<Filename Value="usettings.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="usettings"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<EditorIndex Value="9"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="41"/>
|
||||
<CursorPos X="60" Y="56"/>
|
||||
@@ -92,10 +92,10 @@
|
||||
<Filename Value="uscanresult.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="uscanresult"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="10" Y="5"/>
|
||||
<TopLine Value="35"/>
|
||||
<CursorPos X="79" Y="80"/>
|
||||
<UsageCount Value="816"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit8>
|
||||
@@ -103,11 +103,10 @@
|
||||
<Filename Value="uscanthread.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="uscanthread"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="7"/>
|
||||
<EditorIndex Value="8"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="171"/>
|
||||
<CursorPos X="79" Y="182"/>
|
||||
<TopLine Value="178"/>
|
||||
<CursorPos X="72" Y="197"/>
|
||||
<UsageCount Value="816"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit9>
|
||||
@@ -115,7 +114,7 @@
|
||||
<Filename Value="ucpucount.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="ucpucount"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="19"/>
|
||||
<CursorPos X="87" Y="34"/>
|
||||
@@ -126,7 +125,7 @@
|
||||
<Filename Value="udrawtim.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="udrawtim"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="15" Y="6"/>
|
||||
@@ -145,20 +144,23 @@
|
||||
<Unit13>
|
||||
<Filename Value="todos.inc"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="1"/>
|
||||
<CursorPos X="48" Y="2"/>
|
||||
<CursorPos X="44" Y="3"/>
|
||||
<UsageCount Value="802"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="uexportimport.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="uexportimport"/>
|
||||
<EditorIndex Value="5"/>
|
||||
<EditorIndex Value="6"/>
|
||||
<WindowIndex Value="0"/>
|
||||
<TopLine Value="7"/>
|
||||
<CursorPos X="20" Y="16"/>
|
||||
<UsageCount Value="71"/>
|
||||
<UsageCount Value="72"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
</Units>
|
||||
@@ -187,7 +189,7 @@
|
||||
<WatchScope Value="wpsLocal"/>
|
||||
<WatchKind Value="wpkWrite"/>
|
||||
<Source Value="umain.pas"/>
|
||||
<Line Value="812"/>
|
||||
<Line Value="797"/>
|
||||
</Item3>
|
||||
</BreakPoints>
|
||||
<Watches Count="3">
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
{ TODO : Zooming? }
|
||||
{ TODO : Add different PNG output for Export. }
|
||||
{ TODO : Add file to filelist }
|
||||
{ TODO : StartScan - remove refs to umain }
|
||||
@@ -584,8 +584,9 @@ object frmMain: TfrmMain
|
||||
Align = alClient
|
||||
Columns = <
|
||||
item
|
||||
AutoSize = True
|
||||
Caption = '# / 0'
|
||||
Width = 60
|
||||
Width = 41
|
||||
end
|
||||
item
|
||||
Alignment = taCenter
|
||||
@@ -603,7 +604,7 @@ object frmMain: TfrmMain
|
||||
Alignment = taCenter
|
||||
AutoSize = True
|
||||
Caption = 'W x H'
|
||||
Width = 91
|
||||
Width = 128
|
||||
end>
|
||||
ColumnClick = False
|
||||
GridLines = True
|
||||
|
||||
19
umain.pas
19
umain.pas
@@ -179,7 +179,6 @@ type
|
||||
{ public declarations }
|
||||
ScanResults: TScanResultList; //List of finished scan results
|
||||
ScanThreads: TScanThreadList; //List of currently started scans
|
||||
function CheckForFileOpened(const FileName: string): boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
@@ -774,20 +773,6 @@ begin
|
||||
Result^.HEAD^.bBPP := Integer(cbbBitMode.Tag);
|
||||
end;
|
||||
|
||||
function TfrmMain.CheckForFileOpened(const FileName: string): boolean;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
for I := 1 to ScanResults.Count do
|
||||
if ScanResults[I - 1].ScanFile = FileName then
|
||||
begin
|
||||
Result := True;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.ScanPath(const Path: string);
|
||||
begin
|
||||
if Path = '' then Exit;
|
||||
@@ -806,7 +791,7 @@ begin
|
||||
LastDir := ExtractFilePath(FileName);
|
||||
Settings.LastDir := LastDir;
|
||||
|
||||
if CheckForFileOpened(FileName) then
|
||||
if CheckForFileOpened(@ScanResults, FileName) then
|
||||
begin
|
||||
cbbFiles.ItemIndex := cbbFiles.Items.IndexOf(FileName);
|
||||
actChangeFile.Execute;
|
||||
@@ -818,7 +803,7 @@ begin
|
||||
|
||||
if not Boolean(actStopScan.Tag) then
|
||||
begin
|
||||
ScanThreads.Add(TScanThread.Create(FileName, GetImageScan(FileName)));
|
||||
ScanThreads.Add(TScanThread.Create(FileName, GetImageScan(FileName), @ScanResults));
|
||||
ScanThreads.Last.FreeOnTerminate := True;
|
||||
ScanThreads.Last.Priority := tpNormal;
|
||||
ScanThreads.Last.OnTerminate := @ScanFinished;
|
||||
|
||||
@@ -39,6 +39,9 @@ type
|
||||
property ScanTim[index: Integer]: TTimInfo read fGetTim write fSetTim;
|
||||
end;
|
||||
TScanResultList = specialize TFPGObjectList<TScanResult>;
|
||||
PScanResultList = ^TScanResultList;
|
||||
|
||||
function CheckForFileOpened(ScanResults: PScanResultList; const FileName: string): boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@@ -77,4 +80,18 @@ begin
|
||||
pTims[Index] := Value;
|
||||
end;
|
||||
|
||||
end.
|
||||
function CheckForFileOpened(ScanResults: PScanResultList; const FileName: string): boolean;
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
for I := 1 to ScanResults^.Count do
|
||||
if ScanResults^[I - 1].ScanFile = FileName then
|
||||
begin
|
||||
Result := True;
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -10,6 +10,7 @@ type
|
||||
private
|
||||
{ Private declarations }
|
||||
pScanResult: TScanResult;
|
||||
pResults: PScanResultList;
|
||||
pFileSize: Integer;
|
||||
pFilePos: Integer;
|
||||
pStatusText: string;
|
||||
@@ -27,7 +28,7 @@ type
|
||||
protected
|
||||
procedure Execute; override;
|
||||
public
|
||||
constructor Create(const FileToScan: string; ImageScan: boolean);
|
||||
constructor Create(const FileToScan: string; ImageScan: boolean; Results: PScanResultList);
|
||||
//property Started: boolean read pStarted write pStarted;
|
||||
property StopScan: boolean read pStopScan write pStopScan;
|
||||
end;
|
||||
@@ -44,7 +45,7 @@ const
|
||||
|
||||
{ TScanThread }
|
||||
|
||||
constructor TScanThread.Create(const FileToScan: string; ImageScan: boolean);
|
||||
constructor TScanThread.Create(const FileToScan: string; ImageScan: boolean; Results: PScanResultList);
|
||||
begin
|
||||
inherited Create(True);
|
||||
FreeOnTerminate := True;
|
||||
@@ -57,6 +58,7 @@ begin
|
||||
pScanResult := TScanResult.Create;
|
||||
pScanResult.ScanFile := FileToScan;
|
||||
pScanResult.IsImage := ImageScan;
|
||||
pResults := Results;
|
||||
end;
|
||||
|
||||
procedure TScanThread.AddResult(TIM: PTIM);
|
||||
@@ -170,7 +172,7 @@ begin
|
||||
pFilePos := 0;
|
||||
pStatusText := '';
|
||||
|
||||
Synchronize(@FinishScan);
|
||||
FinishScan;
|
||||
end;
|
||||
|
||||
procedure TScanThread.FinishScan;
|
||||
@@ -184,11 +186,8 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if not frmMain.CheckForFileOpened(pScanResult.ScanFile) then
|
||||
begin
|
||||
frmMain.ScanResults.Add(pScanResult);
|
||||
frmMain.cbbFiles.Items.Add(pScanResult.ScanFile);
|
||||
end
|
||||
if not CheckForFileOpened(pResults, pScanResult.ScanFile) then
|
||||
pResults^.Add(pScanResult)
|
||||
else
|
||||
pScanResult.Free;
|
||||
end;
|
||||
@@ -230,4 +229,4 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
end.
|
||||
Reference in New Issue
Block a user