You've already forked lazarus-ccr
fpspreadsheet: Add option to BIFFExplorer to dump main info on biff records (record id, description) to a text file
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3231 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -4,7 +4,7 @@ object MainForm: TMainForm
|
||||
Top = 177
|
||||
Width = 1089
|
||||
Caption = 'BIFF Explorer'
|
||||
ClientHeight = 556
|
||||
ClientHeight = 551
|
||||
ClientWidth = 1089
|
||||
Menu = MainMenu
|
||||
OnCloseQuery = FormCloseQuery
|
||||
@ -12,10 +12,10 @@ object MainForm: TMainForm
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
ShowHint = True
|
||||
LCLVersion = '1.3'
|
||||
LCLVersion = '1.2.4.0'
|
||||
object Splitter1: TSplitter
|
||||
Left = 419
|
||||
Height = 507
|
||||
Height = 497
|
||||
Top = 26
|
||||
Width = 5
|
||||
end
|
||||
@ -54,17 +54,17 @@ object MainForm: TMainForm
|
||||
end
|
||||
object DetailPanel: TPanel
|
||||
Left = 424
|
||||
Height = 507
|
||||
Height = 497
|
||||
Top = 26
|
||||
Width = 665
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 507
|
||||
ClientHeight = 497
|
||||
ClientWidth = 665
|
||||
TabOrder = 2
|
||||
object PageControl: TPageControl
|
||||
Left = 0
|
||||
Height = 507
|
||||
Height = 497
|
||||
Top = 0
|
||||
Width = 665
|
||||
ActivePage = PgValues
|
||||
@ -104,12 +104,12 @@ object MainForm: TMainForm
|
||||
end
|
||||
object PgValues: TTabSheet
|
||||
Caption = 'Values'
|
||||
ClientHeight = 479
|
||||
ClientHeight = 464
|
||||
ClientWidth = 657
|
||||
object ValueGrid: TStringGrid
|
||||
Left = 0
|
||||
Height = 158
|
||||
Top = 321
|
||||
Top = 306
|
||||
Width = 657
|
||||
Align = alBottom
|
||||
ColCount = 3
|
||||
@ -140,17 +140,17 @@ object MainForm: TMainForm
|
||||
end
|
||||
object HexPanel: TPanel
|
||||
Left = 0
|
||||
Height = 316
|
||||
Height = 301
|
||||
Top = 0
|
||||
Width = 657
|
||||
Align = alClient
|
||||
Caption = 'HexPanel'
|
||||
ClientHeight = 316
|
||||
ClientHeight = 301
|
||||
ClientWidth = 657
|
||||
TabOrder = 1
|
||||
object HexGrid: TStringGrid
|
||||
Left = 1
|
||||
Height = 314
|
||||
Height = 299
|
||||
Top = 1
|
||||
Width = 390
|
||||
Align = alClient
|
||||
@ -238,7 +238,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object AlphaGrid: TStringGrid
|
||||
Left = 396
|
||||
Height = 314
|
||||
Height = 299
|
||||
Top = 1
|
||||
Width = 260
|
||||
Align = alRight
|
||||
@ -323,7 +323,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object HexDumpSplitter: TSplitter
|
||||
Left = 391
|
||||
Height = 314
|
||||
Height = 299
|
||||
Top = 1
|
||||
Width = 5
|
||||
Align = alRight
|
||||
@ -334,7 +334,7 @@ object MainForm: TMainForm
|
||||
Cursor = crVSplit
|
||||
Left = 0
|
||||
Height = 5
|
||||
Top = 316
|
||||
Top = 301
|
||||
Width = 657
|
||||
Align = alBottom
|
||||
ResizeAnchor = akBottom
|
||||
@ -344,19 +344,19 @@ object MainForm: TMainForm
|
||||
end
|
||||
object TreePanel: TPanel
|
||||
Left = 0
|
||||
Height = 507
|
||||
Height = 497
|
||||
Top = 26
|
||||
Width = 419
|
||||
Align = alLeft
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 507
|
||||
ClientHeight = 497
|
||||
ClientWidth = 419
|
||||
Constraints.MinWidth = 275
|
||||
TabOrder = 3
|
||||
object FindPanel: TPanel
|
||||
Left = 0
|
||||
Height = 36
|
||||
Top = 471
|
||||
Top = 461
|
||||
Width = 419
|
||||
Align = alBottom
|
||||
BevelOuter = bvNone
|
||||
@ -498,10 +498,10 @@ object MainForm: TMainForm
|
||||
end
|
||||
object CbFind: TComboBox
|
||||
Left = 28
|
||||
Height = 23
|
||||
Height = 28
|
||||
Top = 5
|
||||
Width = 183
|
||||
ItemHeight = 15
|
||||
ItemHeight = 20
|
||||
OnChange = CbFindChange
|
||||
OnKeyPress = CbFindKeyPress
|
||||
TabOrder = 0
|
||||
@ -509,7 +509,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
object BIFFTree: TVirtualStringTree
|
||||
Left = 0
|
||||
Height = 471
|
||||
Height = 461
|
||||
Top = 0
|
||||
Width = 419
|
||||
Align = alClient
|
||||
@ -571,8 +571,8 @@ object MainForm: TMainForm
|
||||
end
|
||||
object StatusBar: TStatusBar
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 533
|
||||
Height = 28
|
||||
Top = 523
|
||||
Width = 1089
|
||||
Panels = <
|
||||
item
|
||||
@ -932,6 +932,12 @@ object MainForm: TMainForm
|
||||
object MnuFileReopen: TMenuItem
|
||||
Caption = 'Recently opened files'
|
||||
end
|
||||
object MenuItem9: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MnuDumpToFile: TMenuItem
|
||||
Action = AcDumpToFile
|
||||
end
|
||||
object MenuItem4: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
@ -1118,6 +1124,10 @@ object MainForm: TMainForm
|
||||
OnExecute = AcNodeCollapseExecute
|
||||
OnUpdate = AcNodeCollapseUpdate
|
||||
end
|
||||
object AcDumpToFile: TAction
|
||||
Caption = 'Dump to text file'
|
||||
OnExecute = AcDumpToFileExecute
|
||||
end
|
||||
end
|
||||
object OpenDialog: TOpenDialog
|
||||
DefaultExt = '.xls'
|
||||
@ -1258,4 +1268,10 @@ object MainForm: TMainForm
|
||||
}
|
||||
end
|
||||
end
|
||||
object SaveDialog: TSaveDialog
|
||||
DefaultExt = '.txt'
|
||||
Filter = 'Text files (*.txt)|*.txt'
|
||||
left = 289
|
||||
top = 296
|
||||
end
|
||||
end
|
||||
|
@ -38,6 +38,7 @@ type
|
||||
AcFindClose: TAction;
|
||||
AcNodeExpand: TAction;
|
||||
AcNodeCollapse: TAction;
|
||||
AcDumpToFile: TAction;
|
||||
ActionList: TActionList;
|
||||
BIFFTree: TVirtualStringTree;
|
||||
CbFind: TComboBox;
|
||||
@ -50,6 +51,8 @@ type
|
||||
MenuItem5: TMenuItem;
|
||||
MenuItem6: TMenuItem;
|
||||
MenuItem7: TMenuItem;
|
||||
MnuDumpToFile: TMenuItem;
|
||||
MenuItem9: TMenuItem;
|
||||
MnuFind: TMenuItem;
|
||||
MnuRecord: TMenuItem;
|
||||
MnuFileReopen: TMenuItem;
|
||||
@ -64,6 +67,8 @@ type
|
||||
DetailPanel: TPanel;
|
||||
HexPanel: TPanel;
|
||||
FindPanel: TPanel;
|
||||
SaveDialog: TSaveDialog;
|
||||
SpeedButton3: TSpeedButton;
|
||||
TreePopupMenu: TPopupMenu;
|
||||
TreePanel: TPanel;
|
||||
BtnFindNext: TSpeedButton;
|
||||
@ -85,6 +90,7 @@ type
|
||||
ToolButton1: TToolButton;
|
||||
ToolButton2: TToolButton;
|
||||
procedure AcAboutExecute(Sender: TObject);
|
||||
procedure AcDumpToFileExecute(Sender: TObject);
|
||||
procedure AcFileOpenExecute(Sender: TObject);
|
||||
procedure AcFileQuitExecute(Sender: TObject);
|
||||
procedure AcFindCloseExecute(Sender: TObject);
|
||||
@ -143,6 +149,7 @@ type
|
||||
procedure AnalysisGridDetails(Sender: TObject; ADetails: TStrings);
|
||||
procedure AnalysisGridPrepareCanvas(sender: TObject; aCol, aRow: Integer;
|
||||
aState: TGridDrawState);
|
||||
procedure DumpToFile(const AFileName: String);
|
||||
procedure ExecFind(ANext, AKeep: Boolean);
|
||||
function GetNodeData(ANode: PVirtualNode): TBiffNodeData;
|
||||
function GetRecType: Word;
|
||||
@ -156,6 +163,7 @@ type
|
||||
procedure ReadFromIni;
|
||||
procedure ReadFromStream(AStream: TStream);
|
||||
procedure UpdateCaption;
|
||||
procedure UpdateCmds;
|
||||
procedure WriteToIni;
|
||||
|
||||
public
|
||||
@ -220,6 +228,19 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.AcDumpToFileExecute(Sender: TObject);
|
||||
begin
|
||||
if FFileName = '' then
|
||||
exit;
|
||||
|
||||
with SaveDialog do begin
|
||||
FileName := ChangeFileExt(ExtractFileName(FFileName), '') + '_dumped.txt';
|
||||
if Execute then
|
||||
DumpToFile(FileName);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.AcFileOpenExecute(Sender: TObject);
|
||||
begin
|
||||
with OpenDialog do begin
|
||||
@ -482,6 +503,38 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.DumpToFile(const AFileName: String);
|
||||
var
|
||||
list: TStringList;
|
||||
parentnode, node: PVirtualNode;
|
||||
parentdata, data: TBiffNodeData;
|
||||
ptr: PObjectNodeData;
|
||||
begin
|
||||
list := TStringList.Create;
|
||||
try
|
||||
parentnode := BiffTree.GetFirst;
|
||||
while parentnode <> nil do begin
|
||||
ptr := BiffTree.GetNodeData(parentnode);
|
||||
parentdata := TBiffNodeData(ptr^.Data);
|
||||
list.Add(parentdata.RecordName);
|
||||
node := BIffTree.GetFirstChild(parentnode);
|
||||
while node <> nil do begin
|
||||
ptr := BiffTree.GetNodeData(node);
|
||||
data := TBiffNodeData(ptr^.Data);
|
||||
List.Add(Format(' %.04x %s (%s)', [data.RecordID, data.RecordName, data.RecordDescription]));
|
||||
node := BiffTree.GetNextSibling(node);
|
||||
end;
|
||||
List.Add('');
|
||||
parentnode := BiffTree.GetNextSibling(parentnode);
|
||||
end;
|
||||
|
||||
list.SaveToFile(AFileName);
|
||||
finally
|
||||
list.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.ExecFind(ANext, AKeep: Boolean);
|
||||
var
|
||||
s: String;
|
||||
@ -628,6 +681,8 @@ begin
|
||||
Cells[0, VALUE_ROW_ANSISTRING] := 'AnsiString';
|
||||
Cells[0, VALUE_ROW_WIDESTRING] := 'WideString';
|
||||
end;
|
||||
|
||||
UpdateCmds;
|
||||
end;
|
||||
|
||||
|
||||
@ -1134,6 +1189,8 @@ begin
|
||||
BiffTree.FocusedNode := BiffTree.GetFirst;
|
||||
BiffTree.Selected[BiffTree.FocusedNode] := true;
|
||||
|
||||
UpdateCmds;
|
||||
|
||||
finally
|
||||
Screen.Cursor := crs;
|
||||
end;
|
||||
@ -1162,6 +1219,13 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.UpdateCmds;
|
||||
begin
|
||||
AcDumpToFile.Enabled := FFileName <> '';
|
||||
AcFind.Enabled := FFileName <> '';
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.ValueGridPrepareCanvas(sender: TObject; aCol,
|
||||
aRow: Integer; aState: TGridDrawState);
|
||||
begin
|
||||
|
Reference in New Issue
Block a user