Changeset 214 for oup/current


Ignore:
Timestamp:
Jun 12, 2007, 7:35:56 PM (17 years ago)
Author:
alloc
Message:
 
Location:
oup/current
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • oup/current/FileClasses/TXAN.pas

    r213 r214  
    1010    protected
    1111      procedure InitDatLinks; override;
     12      procedure InitRawList; override;
     13    public
    1214      procedure InitDataFields; override;
    13       procedure InitRawList; override;
    1415  end;
    1516
     
    2223var
    2324  tempi: Integer;
    24   temps: String;
    25   templist: TStringList;
    2625begin
    2726  inherited;
    2827  FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil);
    29   templist := TStringList.Create;
    3028  with FDataFields do
    3129  begin
     
    4947    AddField(TUnused, $1A, 'Unused', '', @tempi);
    5048
     49    tempi := 2;
    5150    with AddField(TArray, $1C, 'AnimTextures array', '', @tempi) do
    5251    begin
     
    5453    end;
    5554  end;
    56   templist.Free;
    5755end;
    5856
  • oup/current/FileClasses/TXMP.pas

    r213 r214  
    1010    protected
    1111      procedure InitDatLinks; override;
     12      procedure InitRawList; override;
     13    public
    1214      procedure InitDataFields; override;
    13       procedure InitRawList; override;
    1415  end;
    1516
  • oup/current/FileClasses/_EmptyFile.pas

    r212 r214  
    1010    protected
    1111      procedure InitDatLinks; override;
     12      procedure InitRawList; override;
     13    public
    1214      procedure InitDataFields; override;
    13       procedure InitRawList; override;
    1415  end;
    1516
     
    2122procedure TFile_Empty.InitDataFields;
    2223begin
     24  inherited;
    2325  FDataFields := TBlock.Create(Self, nil, 0, 'Base', '', nil);
    2426end;
  • oup/current/FileClasses/_FileTypes.pas

    r213 r214  
    44
    55uses
    6   TypeDefs, _DataTypes, Classes;
     6  TypeDefs, _DataTypes, Classes, Forms;
    77
    88
     
    2323      FDataFields: TBlock;
    2424      FRawParts: TRawDataList;
     25
     26      FEditor: TFrame;
     27      FOpened: Boolean;
    2528
    2629      procedure InitDatLinks; virtual; abstract;
     
    3942
    4043      procedure InitDataFields; virtual;
     44      procedure InitEditor; virtual;
    4145
    4246      property FileStream: TMemoryStream read FFileStream;
     
    5054      property Changed: Boolean read FChanged write FChanged;
    5155
     56      property Editor: TFrame read FEditor;
     57      property Opened: Boolean read FOpened write FOpened;
     58
    5259      property ChildCount: Integer read GetChildCount;
    5360      property LinkByOffset[Offset: Integer]: TDatLink read GetDatLinkByOffset;
     
    7885constructor TFile.Create(ConnectionID, FileID: Integer);
    7986var
    80   i: Integer;
    8187  fileinfo: TFileInfo;
    8288begin
     
    100106  InitRawList();
    101107  FDataFields := nil;
     108  FEditor := nil;
    102109
    103110  if not (Self is TFile_Empty) then
     
    164171
    165172function TFile.GetFieldByOffset(Offset: Integer): TDataField;
    166 var
    167   i: Integer;
    168173begin
    169174  Result := FDataFields.FieldByOffset[Offset];
     
    229234end;
    230235
     236procedure TFile.InitEditor;
     237begin
     238  Exit;
     239end;
     240
    231241function GetDatLinkValue(stream: TStream; offset: Integer): Integer;
    232242begin
  • oup/current/FileClasses/_MetaManager.pas

    r213 r214  
    22interface
    33
    4 uses _FileTypes, TXAN, TXMP, _EmptyFile;
     4uses _FileTypes, SUBT, TXAN, TXMP, _EmptyFile;
    55
    66type
     
    1212
    1313const
    14   FileDescs: array[0..1] of TFileDesc = (
     14  FileDescs: array[0..2] of TFileDesc = (
     15    (ext: 'SUBT'; ftype: TFile_SUBT),
    1516    (ext: 'TXAN'; ftype: TFile_TXAN),
    1617    (ext: 'TXMP'; ftype: TFile_TXMP)
     
    3435      property FileById[Id: Integer]: TFile read GetFileById;
    3536  end;
     37
     38var
     39  Meta: TMetaManager;
    3640
    3741implementation
  • oup/current/OniUnPacker.bdsproj

    r212 r214  
    177177                        <Language Name="RootDir"></Language>
    178178                </Language> 
     179   
    179180    <Excluded_Packages>
    180181      <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages>
  • oup/current/OniUnPacker.dpr

    r212 r214  
    3636  _MetaManager in 'FileClasses\_MetaManager.pas',
    3737  _EmptyFile in 'FileClasses\_EmptyFile.pas',
    38   TXAN in 'FileClasses\TXAN.pas';
     38  TXAN in 'FileClasses\TXAN.pas',
     39  SUBT in 'FileClasses\SUBT.pas';
    3940
    4041{$R *.res}
  • oup/current/Tools/MetaEditor.dfm

    r212 r214  
    33  Top = 0
    44  Caption = 'Form_Meta'
    5   ClientHeight = 365
    6   ClientWidth = 446
     5  ClientHeight = 393
     6  ClientWidth = 472
    77  Color = clBtnFace
     8  Constraints.MinHeight = 100
     9  Constraints.MinWidth = 200
    810  Font.Charset = DEFAULT_CHARSET
    911  Font.Color = clWindowText
     
    1719  OnClose = FormClose
    1820  OnCreate = FormCreate
    19   DesignSize = (
    20     446
    21     365)
    2221  PixelsPerInch = 96
    2322  TextHeight = 13
    24   object Label3: TLabel
    25     Left = 3
    26     Top = 6
    27     Width = 61
    28     Height = 13
    29     Caption = 'Connection: '
     23  object Splitter1: TSplitter
     24    Left = 384
     25    Top = 29
     26    Width = 8
     27    Height = 364
     28    Align = alRight
     29    AutoSnap = False
     30    Beveled = True
     31    MinSize = 75
     32    ExplicitLeft = 301
     33    ExplicitHeight = 336
    3034  end
    3135  object VST: TVirtualStringTree
    32     Left = 4
    33     Top = 44
    34     Width = 409
    35     Height = 321
    36     Anchors = [akLeft, akTop, akRight, akBottom]
     36    Left = 0
     37    Top = 29
     38    Width = 384
     39    Height = 364
     40    Align = alClient
    3741    AnimationDuration = 0
    3842    Header.AutoSizeIndex = 0
     
    4650    TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoDeleteMovedNodes]
    4751    TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
     52    OnFocusChanged = VSTFocusChanged
     53    OnFocusChanging = VSTFocusChanging
    4854    OnGetText = VSTGetText
    4955    OnPaintText = VSTPaintText
    5056    OnInitChildren = VSTInitChildren
     57    ExplicitLeft = 4
     58    ExplicitTop = 44
     59    ExplicitWidth = 301
     60    ExplicitHeight = 321
    5161    Columns = <
    5262      item
     
    6878      end>
    6979  end
    70   object Button1: TButton
    71     Left = 204
    72     Top = 1
    73     Width = 75
    74     Height = 25
    75     Anchors = [akTop, akRight]
    76     Caption = 'Load'
    77     Default = True
     80  object Panel1: TPanel
     81    Left = 0
     82    Top = 0
     83    Width = 472
     84    Height = 29
     85    Align = alTop
     86    BevelOuter = bvNone
    7887    TabOrder = 1
    79     OnClick = Button1Click
     88    ExplicitWidth = 446
     89    DesignSize = (
     90      472
     91      29)
     92    object Label3: TLabel
     93      Left = 3
     94      Top = 6
     95      Width = 61
     96      Height = 13
     97      Caption = 'Connection: '
     98    end
     99    object Button1: TButton
     100      Left = 379
     101      Top = 1
     102      Width = 75
     103      Height = 25
     104      Anchors = [akTop, akRight]
     105      Caption = 'Load'
     106      Default = True
     107      TabOrder = 0
     108      OnClick = Button1Click
     109      ExplicitLeft = 196
     110    end
     111    object combo_connection: TComboBox
     112      Left = 64
     113      Top = 3
     114      Width = 309
     115      Height = 21
     116      Style = csDropDownList
     117      Anchors = [akLeft, akTop, akRight]
     118      DropDownCount = 12
     119      ItemHeight = 13
     120      TabOrder = 1
     121      ExplicitWidth = 126
     122    end
    80123  end
    81   object combo_connection: TComboBox
    82     Left = 64
    83     Top = 3
    84     Width = 134
    85     Height = 21
    86     Style = csDropDownList
    87     Anchors = [akLeft, akTop, akRight]
    88     DropDownCount = 12
    89     ItemHeight = 13
     124  object Panel2: TPanel
     125    Left = 392
     126    Top = 29
     127    Width = 80
     128    Height = 364
     129    Align = alRight
     130    BevelOuter = bvNone
     131    Caption = 'Panel2'
    90132    TabOrder = 2
     133    ExplicitLeft = 329
     134    ExplicitHeight = 336
    91135  end
    92136end
  • oup/current/Tools/MetaEditor.pas

    r213 r214  
    33uses
    44  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    5   Dialogs, VirtualTrees, _MetaManager, StdCtrls;
     5  Dialogs, VirtualTrees, _MetaManager, StdCtrls, ExtCtrls;
    66
    77type
    88  TForm_Meta = class(TForm)
    99    VST: TVirtualStringTree;
     10    Panel1: TPanel;
    1011    Button1: TButton;
     12    combo_connection: TComboBox;
    1113    Label3: TLabel;
    12     combo_connection: TComboBox;
     14    Splitter1: TSplitter;
     15    Panel2: TPanel;
    1316    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    1417    procedure FormCreate(Sender: TObject);
     
    2124      const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
    2225      TextType: TVSTTextType);
     26    procedure VSTFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode;
     27      Column: TColumnIndex);
     28    procedure VSTFocusChanging(Sender: TBaseVirtualTree; OldNode,
     29      NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex;
     30      var Allowed: Boolean);
    2331  private
    2432  public
    25     MetaManager: TMetaManager;
    2633  end;
    2734
     
    6471begin
    6572  data := VST.GetNodeData(node);
    66   for i := 0 to MetaManager.FileById[TFile(data.Field).FileID].ChildCount - 1 do
    67   begin
    68     id := MetaManager.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID;
    69     MetaManager.InitFile(id);
    70     newdata.Field := MetaManager.FileById[id];
     73  for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do
     74  begin
     75    id := Meta.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID;
     76    Meta.InitFile(id);
     77    newdata.Field := Meta.FileById[id];
    7178    newnode := AddVSTEntry(VST, Node, newdata);
    72     if MetaManager.FileById[id].ChildCount > 0 then
     79    if Meta.FileById[id].ChildCount > 0 then
    7380      VST.HasChildren[newnode] := True;
    7481  end;
    75   ChildCount := MetaManager.FileById[TFile(data.Field).FileID].ChildCount;
     82  ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount;
    7683end;
    7784
     
    94101    QueryPerformanceFrequency(c);
    95102    QueryPerformanceCounter(a);
    96     MetaManager := TMetaManager.Create(conid);
     103    if not Assigned(Meta) then
     104      Meta := TMetaManager.Create(conid);
    97105    QueryPerformanceCounter(b);
    98106    ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's');
     
    100108    VST.Clear;
    101109    VST.BeginUpdate;
    102     for i := 0 to MetaManager.FileCount - 1 do
    103     begin
    104       if Assigned(MetaManager.FileById[i]) then
     110    for i := 0 to Meta.FileCount - 1 do
     111    begin
     112      if Assigned(Meta.FileById[i]) then
    105113      begin
    106         data.Field := MetaManager.FileById[i];
     114        data.Field := Meta.FileById[i];
    107115        node := AddVSTEntry(VST, nil, data);
    108         if MetaManager.FileById[i].ChildCount > 0 then
     116        if Meta.FileById[i].ChildCount > 0 then
    109117          VST.HasChildren[node] := True;
    110118      end;
     
    116124procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction);
    117125begin
    118   MetaManager.Free;
     126  Meta.Free;
    119127  Action := caFree;
    120128end;
     
    158166
    159167
     168
     169procedure TForm_Meta.VSTFocusChanged(Sender: TBaseVirtualTree;
     170  Node: PVirtualNode; Column: TColumnIndex);
     171var
     172  data: PNodeData;
     173begin
     174  data := Sender.GetNodeData(Node);
     175  if data.Field is TFile then
     176  begin
     177    TFile(data.Field).InitEditor;
     178    if Assigned(TFile(data.Field).Editor) then
     179    begin
     180      panel2.InsertControl(TFile(data.Field).Editor);
     181      TFile(data.Field).Opened := True;
     182    end;
     183  end;
     184end;
     185
     186procedure TForm_Meta.VSTFocusChanging(Sender: TBaseVirtualTree; OldNode,
     187  NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex;
     188  var Allowed: Boolean);
     189var
     190  data: PNodeData;
     191  i: Integer;
     192begin
     193  data := Sender.GetNodeData(NewNode);
     194  if data.Field is TFile then
     195  begin
     196    TFile(data.Field).InitEditor;
     197    if Assigned(TFile(data.Field).Editor) then
     198      Allowed := not TFile(data.Field).Opened
     199    else
     200      Allowed := True;
     201  end;
     202  if Allowed and Assigned(OldNode) then
     203  begin
     204    data := Sender.GetNodeData(OldNode);
     205    if data.Field is TFile then
     206    begin
     207      if TFile(data.Field).Opened then
     208      begin
     209        if panel2.ControlCount > 0 then
     210          for i := 0 to panel2.ControlCount - 1 do
     211            panel2.RemoveControl(panel2.Controls[i]);
     212        TFile(data.Field).Opened := False;
     213      end;
     214    end;
     215  end;
     216end;
    160217
    161218procedure TForm_Meta.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
  • oup/current/Tools/TxmpReplace.pas

    r209 r214  
    225225
    226226procedure TForm_TxmpReplace.FormCreate(Sender: TObject);
    227 var
    228   TXMP: TFile_TXMP;
    229227begin
    230228  inherited;
Note: See TracChangeset for help on using the changeset viewer.