OSDN Git Service

タイトルとショートカットを必要に応じて編集できるように修正。
authornaru <bottle@mikage.to>
Sat, 20 Mar 2004 14:32:04 +0000 (14:32 +0000)
committernaru <bottle@mikage.to>
Sat, 20 Mar 2004 14:32:04 +0000 (14:32 +0000)
パネルの包含関係がややこしくちょっとトリック気味なので注意。

bottleclient/ReplacePresetEditor.dfm
bottleclient/ReplacePresetEditor.pas

index b7f849a..9bc9fa9 100644 (file)
@@ -1,10 +1,11 @@
 object frmReplacePresetEditor: TfrmReplacePresetEditor
   Left = 511
   Top = 373
+  AutoSize = True
   BorderStyle = bsDialog
   Caption = #25991#23383#21015#12398#32622#25563#12503#12522#12475#12483#12488
-  ClientHeight = 313
-  ClientWidth = 369
+  ClientHeight = 391
+  ClientWidth = 377
   Color = clBtnFace
   Font.Charset = SHIFTJIS_CHARSET
   Font.Color = clWindowText
@@ -13,106 +14,184 @@ object frmReplacePresetEditor: TfrmReplacePresetEditor
   Font.Style = []
   OldCreateOrder = True
   Position = poDesktopCenter
+  OnCreate = FormCreate
   PixelsPerInch = 96
   TextHeight = 12
-  object lvwPairs: TListView
+  object pnlPairsEditor: TPanel
     Left = 0
     Top = 0
-    Width = 369
-    Height = 129
+    Width = 377
+    Height = 273
     Align = alTop
-    Columns = <
-      item
-        Caption = #32622#25563#21069
-        Width = 125
-      end
-      item
-        Caption = #32622#25563#24460
-        Width = 125
-      end
-      item
-        Caption = #27491#35215#34920#29694
-        Width = 45
-      end
-      item
-        Caption = #22823#25991#23383#12539#23567#25991#23383#12398#21306#21029
-        Width = 45
-      end>
-    HideSelection = False
-    ReadOnly = True
-    RowSelect = True
+    BevelOuter = bvNone
+    BorderWidth = 5
     TabOrder = 0
-    ViewStyle = vsReport
-    OnChange = lvwPairsChange
+    object lvwPairs: TListView
+      Left = 5
+      Top = 5
+      Width = 367
+      Height = 124
+      Align = alTop
+      Columns = <
+        item
+          Caption = #32622#25563#21069
+          Width = 125
+        end
+        item
+          Caption = #32622#25563#24460
+          Width = 125
+        end
+        item
+          Caption = #27491#35215#34920#29694
+          Width = 45
+        end
+        item
+          Caption = #22823#25991#23383#12539#23567#25991#23383#12398#21306#21029
+          Width = 45
+        end>
+      HideSelection = False
+      ReadOnly = True
+      RowSelect = True
+      TabOrder = 0
+      ViewStyle = vsReport
+      OnChange = lvwPairsChange
+    end
+    object btnAdd: TButton
+      Left = 77
+      Top = 136
+      Width = 67
+      Height = 25
+      Hint = #32622#25563#12527#12540#12489#12398#12506#12450#12434#36861#21152
+      Caption = #36861#21152'(&I)'
+      TabOrder = 1
+      OnClick = btnAddClick
+    end
+    object btnDelete: TButton
+      Left = 149
+      Top = 136
+      Width = 67
+      Height = 25
+      Hint = #32622#25563#12527#12540#12489#12398#12506#12450#12434#21066#38500
+      Caption = #21066#38500'(&D)'
+      TabOrder = 2
+      OnClick = btnDeleteClick
+    end
+    object btnMoveUp: TButton
+      Left = 229
+      Top = 136
+      Width = 67
+      Height = 25
+      Hint = #19978#12395#31227#21205
+      Caption = #19978#12408'(&U)'
+      TabOrder = 3
+      OnClick = btnMoveUpClick
+    end
+    object btnMoveDown: TButton
+      Left = 301
+      Top = 136
+      Width = 67
+      Height = 25
+      Hint = #19979#12395#31227#21205
+      Caption = #19979#12408'(&W)'
+      TabOrder = 4
+      OnClick = btnMoveDownClick
+    end
+    inline StrReplaceFrame: TfrmStrReplaceFrame
+      Left = 12
+      Top = 168
+      Width = 354
+      Height = 100
+      Enabled = False
+      TabOrder = 5
+    end
   end
-  object btnAdd: TButton
-    Left = 72
-    Top = 136
-    Width = 67
-    Height = 25
-    Hint = #32622#25563#12527#12540#12489#12398#12506#12450#12434#36861#21152
-    Caption = #36861#21152'(&I)'
+  object pnlPresetProperties: TPanel
+    Left = 0
+    Top = 273
+    Width = 377
+    Height = 79
+    Align = alTop
+    BevelOuter = bvNone
+    BorderWidth = 5
     TabOrder = 1
-    OnClick = btnAddClick
+    Visible = False
+    object gbxPresetProperties: TGroupBox
+      Left = 5
+      Top = 5
+      Width = 367
+      Height = 69
+      Align = alClient
+      Caption = #12503#12522#12475#12483#12488#12398#35373#23450
+      TabOrder = 0
+      object lblTitle: TLabel
+        Left = 16
+        Top = 24
+        Width = 56
+        Height = 12
+        Caption = #12479#12452#12488#12523'(&T):'
+        FocusControl = edtTitle
+      end
+      object lblShortCut: TLabel
+        Left = 16
+        Top = 48
+        Width = 83
+        Height = 12
+        Caption = #12471#12519#12540#12488#12459#12483#12488'(&S):'
+        FocusControl = cbxShortCut
+      end
+      object cbxShortCut: TComboBox
+        Left = 112
+        Top = 40
+        Width = 145
+        Height = 20
+        Hint = #12461#12540#12508#12540#12489#12471#12519#12540#12488#12459#12483#12488#12398#35373#23450
+        ItemHeight = 12
+        TabOrder = 0
+      end
+      object edtTitle: TEdit
+        Left = 112
+        Top = 16
+        Width = 185
+        Height = 20
+        Hint = #12513#12491#12517#12540#12395#34920#31034#12373#12428#12427#12503#12522#12475#12483#12488#12398#12479#12452#12488#12523#12434#35373#23450
+        TabOrder = 1
+      end
+    end
   end
-  object btnDelete: TButton
-    Left = 144
-    Top = 136
-    Width = 67
-    Height = 25
-    Hint = #32622#25563#12527#12540#12489#12398#12506#12450#12434#21066#38500
-    Caption = #21066#38500'(&D)'
+  object pnlOkCancelButtons: TPanel
+    Left = 0
+    Top = 352
+    Width = 377
+    Height = 39
+    Align = alTop
+    BevelOuter = bvNone
     TabOrder = 2
-    OnClick = btnDeleteClick
-  end
-  object btnMoveUp: TButton
-    Left = 224
-    Top = 136
-    Width = 67
-    Height = 25
-    Hint = #19978#12395#31227#21205
-    Caption = #19978#12408'(&U)'
-    TabOrder = 3
-    OnClick = btnMoveUpClick
-  end
-  object btnMoveDown: TButton
-    Left = 296
-    Top = 136
-    Width = 67
-    Height = 25
-    Hint = #19979#12395#31227#21205
-    Caption = #19979#12408'(&W)'
-    TabOrder = 4
-    OnClick = btnMoveDownClick
-  end
-  inline StrReplaceFrame: TfrmStrReplaceFrame
-    Left = 7
-    Top = 168
-    Width = 354
-    Height = 100
-    Enabled = False
-    TabOrder = 5
-  end
-  object btnOk: TButton
-    Left = 280
-    Top = 280
-    Width = 83
-    Height = 25
-    Hint = #22793#26356#20869#23481#12434#30906#23450#12375#12390#12480#12452#12450#12525#12464#12434#38281#12376#12427
-    Caption = '&OK'
-    Default = True
-    TabOrder = 6
-    OnClick = btnOkClick
-  end
-  object btnCancel: TButton
-    Left = 200
-    Top = 280
-    Width = 75
-    Height = 25
-    Hint = #22793#26356#20869#23481#12434#12461#12515#12531#12475#12523#12375#12390#12480#12452#12450#12525#12464#12434#38281#12376#12427
-    Cancel = True
-    Caption = #12461#12515#12531#12475#12523
-    TabOrder = 7
-    OnClick = btnCancelClick
+    DesignSize = (
+      377
+      39)
+    object btnOk: TButton
+      Left = 285
+      Top = 6
+      Width = 83
+      Height = 25
+      Hint = #22793#26356#20869#23481#12434#30906#23450#12375#12390#12480#12452#12450#12525#12464#12434#38281#12376#12427
+      Anchors = [akRight, akBottom]
+      Caption = '&OK'
+      Default = True
+      TabOrder = 0
+      OnClick = btnOkClick
+    end
+    object btnCancel: TButton
+      Left = 205
+      Top = 6
+      Width = 75
+      Height = 25
+      Hint = #22793#26356#20869#23481#12434#12461#12515#12531#12475#12523#12375#12390#12480#12452#12450#12525#12464#12434#38281#12376#12427
+      Anchors = [akRight, akBottom]
+      Cancel = True
+      Caption = #12461#12515#12531#12475#12523
+      TabOrder = 1
+      OnClick = btnCancelClick
+    end
   end
 end
index ae2761f..77fbd29 100644 (file)
@@ -4,18 +4,27 @@ interface
 
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
-  Dialogs, ComCtrls, StrReplaceFrame, StdCtrls, StrReplace;
+  Dialogs, ComCtrls, StrReplaceFrame, StdCtrls, StrReplace, ExtCtrls,
+  Menus, BottleDef;
 
 type
   TfrmReplacePresetEditor = class(TForm)
+    pnlPairsEditor: TPanel;
     lvwPairs: TListView;
     btnAdd: TButton;
     btnDelete: TButton;
     btnMoveUp: TButton;
     btnMoveDown: TButton;
     StrReplaceFrame: TfrmStrReplaceFrame;
+    pnlPresetProperties: TPanel;
+    pnlOkCancelButtons: TPanel;
     btnOk: TButton;
     btnCancel: TButton;
+    gbxPresetProperties: TGroupBox;
+    cbxShortCut: TComboBox;
+    edtTitle: TEdit;
+    lblTitle: TLabel;
+    lblShortCut: TLabel;
     procedure btnAddClick(Sender: TObject);
     procedure btnDeleteClick(Sender: TObject);
     procedure btnMoveUpClick(Sender: TObject);
@@ -24,9 +33,16 @@ type
       Change: TItemChange);
     procedure btnOkClick(Sender: TObject);
     procedure btnCancelClick(Sender: TObject);
+    procedure FormCreate(Sender: TObject);
   private
     FPairs: TReplacePairCollection;
     procedure SetPairs(const Value: TReplacePairCollection);
+    function GetAskForTitle: Boolean;
+    function GetShortCut: TShortCut;
+    function GetTitle: string;
+    procedure SetAskForTitle(const Value: Boolean);
+    procedure SetShortCut(const Value: TShortCut);
+    procedure SetTitle(const Value: string);
   protected
     procedure MoveItem(const Delta: Integer);
     procedure UpdateControls;
@@ -37,7 +53,10 @@ type
     constructor Create(AOwner: TCOmponent); override;
     destructor Destroy; override;
     property Pairs: TReplacePairCollection read FPairs write SetPairs;
-    function Execute: boolean;
+    property Title: string read GetTitle write SetTitle;
+    property ShortCut: TShortCut read GetShortCut write SetShortCut;
+    property AskForTitle: Boolean read GetAskForTitle write SetAskForTitle;
+    function Execute: Boolean;
   end;
 
 implementation
@@ -174,7 +193,7 @@ begin
   end;
 end;
 
-function TfrmReplacePresetEditor.Execute: boolean;
+function TfrmReplacePresetEditor.Execute: Boolean;
 begin
   UpdateControls;
   StrReplaceFrame.OnContentUpdate := FrameUpdate; 
@@ -245,4 +264,39 @@ begin
   end;
 end;
 
+function TfrmReplacePresetEditor.GetAskForTitle: Boolean;
+begin
+  Result := pnlPresetProperties.Visible;
+end;
+
+function TfrmReplacePresetEditor.GetShortCut: TShortCut;
+begin
+  Result := TextToShortCut(cbxShortCut.Text);
+end;
+
+function TfrmReplacePresetEditor.GetTitle: string;
+begin
+  Result := edtTitle.Text;
+end;
+
+procedure TfrmReplacePresetEditor.SetAskForTitle(const Value: Boolean);
+begin
+  pnlPresetProperties.Visible := Value;
+end;
+
+procedure TfrmReplacePresetEditor.SetShortCut(const Value: TShortCut);
+begin
+  cbxShortCut.Text := ShortCutToText(Value);
+end;
+
+procedure TfrmReplacePresetEditor.SetTitle(const Value: string);
+begin
+  edtTitle.Text := Value;
+end;
+
+procedure TfrmReplacePresetEditor.FormCreate(Sender: TObject);
+begin
+  BuildShortCutList(cbxShortCut.Items);
+end;
+
 end.