Changeset 214 for oup/current/Tools


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

Legend:

Unmodified
Added
Removed
  • 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.