浏览代码

Separator control on extension options dialog

Source commit: 52b84e95fee981f2417c719e03f164c6a707e40b
Martin Prikryl 9 年之前
父节点
当前提交
bbdb33ccb8

+ 13 - 0
source/forms/Custom.cpp

@@ -301,6 +301,19 @@ void __fastcall TCustomDialog::AddText(TStaticText * Label)
   AddWinControl(Label);
 }
 //---------------------------------------------------------------------------
+void __fastcall TCustomDialog::AddSeparator()
+{
+  TBevel * Bevel = new TBevel(this);
+  Bevel->Parent = this;
+
+  Bevel->Left = FIndent;
+  Bevel->Top = FPos;
+  Bevel->Height = 2;
+  Bevel->Width = GetMaxControlWidth(Bevel);
+
+  AdjustHeight(Bevel);
+}
+//---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 class TSaveSessionDialog : public TCustomDialog
 {

+ 1 - 0
source/forms/Custom.h

@@ -50,6 +50,7 @@ public:
   void __fastcall AddWinControl(TWinControl * Control);
   void __fastcall AddText(TLabel * Label);
   void __fastcall AddText(TStaticText * Label);
+  void __fastcall AddSeparator();
 
   void __fastcall ScaleButtonControl(TButtonControl * Control);
 

+ 4 - 0
source/forms/Preferences.cpp

@@ -2733,6 +2733,10 @@ __fastcall TCustomCommandOptionsDialog::TCustomCommandOptionsDialog(
       AddText(Label);
       Control = Label;
     }
+    else if (Option.Kind == TCustomCommandType::okSeparator)
+    {
+      AddSeparator();
+    }
     else if (Option.Kind == TCustomCommandType::okTextBox)
     {
       Control = CreateHistoryComboBox(Option, Value);

+ 22 - 6
source/windows/WinConfiguration.cpp

@@ -2949,9 +2949,7 @@ bool __fastcall TCustomCommandType::ParseOption(const UnicodeString & Value, TOp
   UnicodeString KindName;
   bool Result =
     CutToken(Buf, Option.Id) &&
-    CutToken(Buf, KindName) &&
-    CutToken(Buf, Option.Caption);
-    (CutToken(Buf, Option.Default) || !Option.IsControl);
+    CutToken(Buf, KindName);
 
   if (Result)
   {
@@ -2966,6 +2964,11 @@ bool __fastcall TCustomCommandType::ParseOption(const UnicodeString & Value, TOp
       Option.Kind = okLink;
       Result = !Option.IsControl;
     }
+    else if (KindName == L"separator")
+    {
+      Option.Kind = okSeparator;
+      Result = !Option.IsControl;
+    }
     else if (KindName == L"textbox")
     {
       Option.Kind = okTextBox;
@@ -2996,10 +2999,22 @@ bool __fastcall TCustomCommandType::ParseOption(const UnicodeString & Value, TOp
       Option.Kind = okUnknown;
     }
 
-    UnicodeString Param;
-    while (CutToken(Buf, Param))
+    if ((Option.Kind != okUnknown) &&
+        (Option.Kind != okSeparator))
     {
-      Option.Params.push_back(Param);
+      Result = CutToken(Buf, Option.Caption);
+
+      if (Result && Option.IsControl)
+      {
+        if (CutToken(Buf, Option.Default))
+        {
+          UnicodeString Param;
+          while (CutToken(Buf, Param))
+          {
+            Option.Params.push_back(Param);
+          }
+        }
+      }
     }
   }
 
@@ -3066,6 +3081,7 @@ UnicodeString __fastcall TCustomCommandType::GetOptionCommand(const TOption & Op
 
     case okLabel:
     case okLink:
+    case okSeparator:
     default:
       DebugFail();
   }

+ 1 - 1
source/windows/WinConfiguration.h

@@ -711,7 +711,7 @@ public:
   __fastcall TCustomCommandType();
   __fastcall TCustomCommandType(const TCustomCommandType & Other);
 
-  enum TOptionKind { okUnknown, okLabel, okLink, okTextBox, okFile, okDropDownList, okComboBox, okCheckBox };
+  enum TOptionKind { okUnknown, okLabel, okLink, okSeparator, okTextBox, okFile, okDropDownList, okComboBox, okCheckBox };
 
   class TOption
   {