OSDN Git Service

置換プリセットエディタの形を作成。フレームからフォームに変更
authornaru <bottle@mikage.to>
Fri, 19 Mar 2004 06:07:28 +0000 (06:07 +0000)
committernaru <bottle@mikage.to>
Fri, 19 Mar 2004 06:07:28 +0000 (06:07 +0000)
bottleclient/ReplacePresetEditor.dfm
bottleclient/ReplacePresetEditor.pas

index 9c039c3..e9992d6 100644 (file)
@@ -1,73 +1,78 @@
 object frmReplacePresetEditor: TfrmReplacePresetEditor
-  Left = 0
-  Top = 0
-  Width = 377
-  Height = 274
-  TabOrder = 0
-  object tvwPresets: TTreeView
+  Left = 445
+  Top = 303
+  Width = 389
+  Height = 344
+  Caption = #25991#23383#21015#12398#32622#25563#12503#12522#12475#12483#12488
+  Color = clBtnFace
+  Font.Charset = SHIFTJIS_CHARSET
+  Font.Color = clWindowText
+  Font.Height = -12
+  Font.Name = #65325#65331' '#65328#12468#12471#12483#12463
+  Font.Style = []
+  OldCreateOrder = True
+  PixelsPerInch = 96
+  TextHeight = 12
+  object lvwPairs: TListView
     Left = 0
     Top = 0
-    Width = 377
-    Height = 161
+    Width = 381
+    Height = 129
     Align = alTop
-    Indent = 19
+    Columns = <
+      item
+        Caption = #32622#25563#21069
+        Width = 130
+      end
+      item
+        Caption = #32622#25563#24460
+        Width = 130
+      end
+      item
+        Caption = #12458#12503#12471#12519#12531
+        Width = 70
+      end>
+    ReadOnly = True
     TabOrder = 0
+    ViewStyle = vsReport
   end
-  object PageControl: TPageControl
-    Left = 0
-    Top = 161
-    Width = 377
-    Height = 113
-    ActivePage = tstPreset
-    Align = alClient
-    Style = tsButtons
+  object btnAdd: TButton
+    Left = 80
+    Top = 240
+    Width = 67
+    Height = 25
+    Caption = #36861#21152'(&I)'
     TabOrder = 1
-    object tstPreset: TTabSheet
-      Caption = #12503#12522#12475#12483#12488
-      TabVisible = False
-      object Label1: TLabel
-        Left = 8
-        Top = 16
-        Width = 54
-        Height = 12
-        Caption = #35373#23450#21517'(&N):'
-        FocusControl = edtTitle
-      end
-      object Label2: TLabel
-        Left = 8
-        Top = 48
-        Width = 83
-        Height = 12
-        Caption = #12471#12519#12540#12488#12459#12483#12488'(&S):'
-        FocusControl = cbxShortCut
-      end
-      object edtTitle: TEdit
-        Left = 96
-        Top = 8
-        Width = 265
-        Height = 20
-        TabOrder = 0
-      end
-      object cbxShortCut: TComboBox
-        Left = 96
-        Top = 40
-        Width = 145
-        Height = 20
-        ItemHeight = 12
-        TabOrder = 1
-      end
-    end
-    object tstPair: TTabSheet
-      Caption = #12506#12450
-      ImageIndex = 1
-      TabVisible = False
-      inline frmStrReplaceFrame: TfrmStrReplaceFrame
-        Left = 8
-        Top = 3
-        Width = 354
-        Height = 100
-        TabOrder = 0
-      end
-    end
+  end
+  object btnDelete: TButton
+    Left = 152
+    Top = 240
+    Width = 67
+    Height = 25
+    Caption = #21066#38500'(&D)'
+    TabOrder = 2
+  end
+  object btnMoveUp: TButton
+    Left = 232
+    Top = 240
+    Width = 67
+    Height = 25
+    Caption = #19978#12408'(&U)'
+    TabOrder = 3
+  end
+  object btnMoveDown: TButton
+    Left = 304
+    Top = 240
+    Width = 67
+    Height = 25
+    Caption = #19979#12408'(&O)'
+    TabOrder = 4
+  end
+  inline StrReplaceFrame: TfrmStrReplaceFrame
+    Left = 7
+    Top = 136
+    Width = 354
+    Height = 100
+    TabOrder = 5
   end
 end
index c09bbaa..51ad643 100644 (file)
@@ -3,28 +3,74 @@ unit ReplacePresetEditor;
 interface
 
 uses
-  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, 
+  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
   Dialogs, ComCtrls, StrReplaceFrame, StdCtrls, StrReplace;
 
 type
-  TfrmReplacePresetEditor = class(TFrame)
-    tvwPresets: TTreeView;
-    PageControl: TPageControl;
-    tstPreset: TTabSheet;
-    tstPair: TTabSheet;
-    frmStrReplaceFrame: TfrmStrReplaceFrame;
-    Label1: TLabel;
-    Label2: TLabel;
-    edtTitle: TEdit;
-    cbxShortCut: TComboBox;
+  TfrmReplacePresetEditor = class(TForm)
+    lvwPairs: TListView;
+    btnAdd: TButton;
+    btnDelete: TButton;
+    btnMoveUp: TButton;
+    btnMoveDown: TButton;
+    StrReplaceFrame: TfrmStrReplaceFrame;
   private
-    { Private \90é\8c¾ }
+    FPairs: TReplacePairs;
+    procedure SetPairs(const Value: TReplacePairs);
+  protected
+    procedure UpdateControls;
   public
-    { Public \90é\8c¾ }
+    constructor Create(AOwner: TCOmponent); override;
+    destructor Destroy; override;
+    property Pairs: TReplacePairs read FPairs write SetPairs;
   end;
 
 implementation
 
 {$R *.dfm}
 
+{ TfrmReplacePresetEditor }
+
+constructor TfrmReplacePresetEditor.Create(AOwner: TCOmponent);
+begin
+  inherited;
+  FPairs := TReplacePairs.Create(nil);
+end;
+
+destructor TfrmReplacePresetEditor.Destroy;
+begin
+  FPairs.Free;
+  inherited;
+end;
+
+procedure TfrmReplacePresetEditor.SetPairs(const Value: TReplacePairs);
+begin
+  FPairs.Assign(Value);
+  UpdateControls;
+end;
+
+procedure TfrmReplacePresetEditor.UpdateControls;
+var
+  i: Integer;
+  Pair: TReplacePair;
+  Option: string;
+begin
+  lvwPairs.Items.Clear;
+  for i := 0 to FPairs.Count-1 do
+  begin
+    Pair := FPairs.Pair[i];
+    with lvwPairs.Items.Add do
+    begin
+      Caption := Pair.BeforeStr;
+      SubItems.Add(Pair.AfterStr);
+      Option := '';
+      if Pair.UseRegExp then
+        Option := Option + 'R';
+      if Pair.IgnoreCase then
+        Option := Option + 'C';
+      SubItems.Add(Option);
+    end;
+  end;
+end;
+
 end.