Browse Source

Run time options for extensions

Source commit: 14b9a0316093abe8ac913fb51386a74e75a11092
Martin Prikryl 9 years ago
parent
commit
61c6cf354b

+ 171 - 158
source/forms/Custom.cpp

@@ -836,7 +836,8 @@ bool __fastcall DoRemoteMoveDialog(bool Multi, UnicodeString & Target, UnicodeSt
 class TCustomCommandOptionsDialog : public TCustomDialog
 {
 public:
-  __fastcall TCustomCommandOptionsDialog(const TCustomCommandType * Command, TStrings * CustomCommandOptions);
+  __fastcall TCustomCommandOptionsDialog(
+    const TCustomCommandType * Command, TStrings * CustomCommandOptions, unsigned int Flags);
 
   bool __fastcall Execute();
 
@@ -848,6 +849,7 @@ private:
   TStrings * FCustomCommandOptions;
   std::vector<TControl *> FControls;
   std::vector<std::vector<UnicodeString> > FValues;
+  unsigned int FFlags;
 
   UnicodeString __fastcall HistoryKey(const TCustomCommandType::TOption & Option);
   THistoryComboBox * __fastcall CreateHistoryComboBox(const TCustomCommandType::TOption & Option, const UnicodeString & Value);
@@ -861,138 +863,143 @@ private:
 };
 //---------------------------------------------------------------------------
 __fastcall TCustomCommandOptionsDialog::TCustomCommandOptionsDialog(
-    const TCustomCommandType * Command, TStrings * CustomCommandOptions) :
+    const TCustomCommandType * Command, TStrings * CustomCommandOptions, unsigned int Flags) :
   TCustomDialog(HELP_EXTENSION_OPTIONS)
 {
   FCommand = Command;
+  FFlags = Flags;
   FCustomCommandOptions = CustomCommandOptions;
   Caption = FMTLOAD(EXTENSION_OPTIONS_CAPTION, (StripEllipsis(StripHotkey(FCommand->Name))));
   Width = ScaleByTextHeight(this, 400);
 
-  for (int Index = 0; Index < FCommand->OptionsCount; Index++)
+  int ControlIndex = 0;
+  for (int OptionIndex = 0; OptionIndex < FCommand->OptionsCount; OptionIndex++)
   {
-    const TCustomCommandType::TOption & Option = FCommand->GetOption(Index);
+    const TCustomCommandType::TOption & Option = FCommand->GetOption(OptionIndex);
 
-    UnicodeString OptionKey = FCommand->GetOptionKey(Option);
-    UnicodeString Value;
-    if (FCustomCommandOptions->IndexOfName(OptionKey) >= 0)
+    if ((Option.Flags & FFlags) != 0)
     {
-      Value = FCustomCommandOptions->Values[OptionKey];
-    }
-    else
-    {
-      Value = Option.Default;
-    }
+      UnicodeString OptionKey = FCommand->GetOptionKey(Option);
+      UnicodeString Value;
+      if (FCustomCommandOptions->IndexOfName(OptionKey) >= 0)
+      {
+        Value = FCustomCommandOptions->Values[OptionKey];
+      }
+      else
+      {
+        Value = Option.Default;
+      }
 
-    TControl * Control = NULL;
-    std::vector<UnicodeString> Values;
-    if (Option.Kind == TCustomCommandType::okUnknown)
-    {
-      Control = NULL;
-    }
-    else if (Option.Kind == TCustomCommandType::okLabel)
-    {
-      TLabel * Label = CreateLabel(Option.Caption);
-      AddText(Label);
-      Control = Label;
-    }
-    else if (Option.Kind == TCustomCommandType::okLink)
-    {
-      TStaticText * Label = new TStaticText(this);
-      Label->Caption = Option.Caption;
-      if (IsHttpOrHttpsUrl(Label->Caption))
+      TControl * Control = NULL;
+      std::vector<UnicodeString> Values;
+      if (Option.Kind == TCustomCommandType::okUnknown)
       {
-        Label->Caption = SecureUrl(Label->Caption);
-        LinkLabel(Label);
-        Label->TabStop = true;
+        Control = NULL;
       }
-      else if (!Option.Default.IsEmpty() && IsHttpOrHttpsUrl(Option.Default))
+      else if (Option.Kind == TCustomCommandType::okLabel)
       {
-        Label->OnClick = LinkLabelClick;
-        LinkLabel(Label);
-        Label->TabStop = true;
+        TLabel * Label = CreateLabel(Option.Caption);
+        AddText(Label);
+        Control = Label;
       }
-      else
+      else if (Option.Kind == TCustomCommandType::okLink)
       {
-        // keep it plain text, as we have no URL
+        TStaticText * Label = new TStaticText(this);
+        Label->Caption = Option.Caption;
+        if (IsHttpOrHttpsUrl(Label->Caption))
+        {
+          Label->Caption = SecureUrl(Label->Caption);
+          LinkLabel(Label);
+          Label->TabStop = true;
+        }
+        else if (!Option.Default.IsEmpty() && IsHttpOrHttpsUrl(Option.Default))
+        {
+          Label->OnClick = LinkLabelClick;
+          LinkLabel(Label);
+          Label->TabStop = true;
+        }
+        else
+        {
+          // keep it plain text, as we have no URL
+        }
+        AddText(Label);
+        Control = Label;
       }
-      AddText(Label);
-      Control = Label;
-    }
-    else if (Option.Kind == TCustomCommandType::okGroup)
-    {
-      StartGroup(Option.Caption);
-    }
-    else if (Option.Kind == TCustomCommandType::okSeparator)
-    {
-      AddSeparator();
-    }
-    else if (Option.Kind == TCustomCommandType::okTextBox)
-    {
-      Control = CreateHistoryComboBox(Option, Value);
-    }
-    else if (Option.Kind == TCustomCommandType::okFile)
-    {
-      THistoryComboBox * ComboBox = CreateHistoryComboBox(Option, Value);
-      TButton * Button = new TButton(this);
-      Button->Parent = GetDefaultParent();
-      Button->Width = HelpButton->Width;
-      Button->Left = GetDefaultParent()->ClientWidth - Button->Width - HorizontalMargin;
-      ComboBox->Width = Button->Left - ComboBox->Left - ScaleByTextHeight(this, 6);
-      Button->Top = ComboBox->Top - ScaleByTextHeight(this, 2);
-      Button->Tag = Index;
-      Button->Caption = LoadStr(EXTENSION_OPTIONS_BROWSE);
-      Button->OnClick = BrowseButtonClick;
-      ScaleButtonControl(Button);
-      AddWinControl(Button);
-      Control = ComboBox;
-    }
-    else if (Option.Kind == TCustomCommandType::okDropDownList)
-    {
-      TComboBox * ComboBox = new TComboBox(this);
-      ComboBox->Style = csDropDownList;
-
-      AddOptionComboBox(ComboBox, Value, Option, Values);
+      else if (Option.Kind == TCustomCommandType::okGroup)
+      {
+        StartGroup(Option.Caption);
+      }
+      else if (Option.Kind == TCustomCommandType::okSeparator)
+      {
+        AddSeparator();
+      }
+      else if (Option.Kind == TCustomCommandType::okTextBox)
+      {
+        Control = CreateHistoryComboBox(Option, Value);
+      }
+      else if (Option.Kind == TCustomCommandType::okFile)
+      {
+        THistoryComboBox * ComboBox = CreateHistoryComboBox(Option, Value);
+        TButton * Button = new TButton(this);
+        Button->Parent = GetDefaultParent();
+        Button->Width = HelpButton->Width;
+        Button->Left = GetDefaultParent()->ClientWidth - Button->Width - HorizontalMargin;
+        ComboBox->Width = Button->Left - ComboBox->Left - ScaleByTextHeight(this, 6);
+        Button->Top = ComboBox->Top - ScaleByTextHeight(this, 2);
+        Button->Tag = ControlIndex;
+        Button->Caption = LoadStr(EXTENSION_OPTIONS_BROWSE);
+        Button->OnClick = BrowseButtonClick;
+        ScaleButtonControl(Button);
+        AddWinControl(Button);
+        Control = ComboBox;
+      }
+      else if (Option.Kind == TCustomCommandType::okDropDownList)
+      {
+        TComboBox * ComboBox = new TComboBox(this);
+        ComboBox->Style = csDropDownList;
 
-      Control = ComboBox;
-    }
-    else if (Option.Kind == TCustomCommandType::okComboBox)
-    {
-      TComboBox * ComboBox = new TComboBox(this);
-      ComboBox->Style = csDropDown;
+        AddOptionComboBox(ComboBox, Value, Option, Values);
 
-      AddOptionComboBox(ComboBox, Value, Option, Values);
-      if (ComboBox->ItemIndex < 0)
-      {
-        ComboBox->Text = Value;
+        Control = ComboBox;
       }
+      else if (Option.Kind == TCustomCommandType::okComboBox)
+      {
+        TComboBox * ComboBox = new TComboBox(this);
+        ComboBox->Style = csDropDown;
 
-      Control = ComboBox;
-    }
-    else if (Option.Kind == TCustomCommandType::okCheckBox)
-    {
-      TCheckBox * CheckBox = CreateAndAddCheckBox(Option.Caption);
+        AddOptionComboBox(ComboBox, Value, Option, Values);
+        if (ComboBox->ItemIndex < 0)
+        {
+          ComboBox->Text = Value;
+        }
 
-      CheckBox->Checked =
-        (Option.Params.size() >= 1) &&
-        (Value == Option.Params[0]);
+        Control = ComboBox;
+      }
+      else if (Option.Kind == TCustomCommandType::okCheckBox)
+      {
+        TCheckBox * CheckBox = CreateAndAddCheckBox(Option.Caption);
 
-      Control = CheckBox;
-    }
-    else
-    {
-      DebugFail();
-    }
+        CheckBox->Checked =
+          (Option.Params.size() >= 1) &&
+          (Value == Option.Params[0]);
 
-    if (Control != NULL)
-    {
-      Control->Tag = Index;
+        Control = CheckBox;
+      }
+      else
+      {
+        DebugFail();
+      }
+
+      if (Control != NULL)
+      {
+        Control->Tag = ControlIndex;
+      }
+      FControls.push_back(Control);
+      FValues.push_back(Values);
+      ControlIndex++;
+      DebugAssert(static_cast<int>(FControls.size()) == ControlIndex);
     }
-    FControls.push_back(Control);
-    FValues.push_back(Values);
   }
-
-  DebugAssert(FCommand->OptionsCount == static_cast<int>(FControls.size()));
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomCommandOptionsDialog::AddOptionComboBox(
@@ -1092,63 +1099,67 @@ bool __fastcall TCustomCommandOptionsDialog::Execute()
 
   if (Result)
   {
-    DebugAssert(FCommand->OptionsCount == static_cast<int>(FControls.size()));
-
-    for (int Index = 0; Index < FCommand->OptionsCount; Index++)
+    int ControlIndex = 0;
+    for (int OptionIndex = 0; OptionIndex < FCommand->OptionsCount; OptionIndex++)
     {
-      const TCustomCommandType::TOption & Option = FCommand->GetOption(Index);
-      if ((Option.Kind != TCustomCommandType::okUnknown) &&
-          Option.IsControl)
+      const TCustomCommandType::TOption & Option = FCommand->GetOption(OptionIndex);
+      if ((Option.Flags & FFlags) != 0)
       {
-        UnicodeString OptionKey = FCommand->GetOptionKey(Option);
+        if ((Option.Kind != TCustomCommandType::okUnknown) &&
+            Option.IsControl)
+        {
+          UnicodeString OptionKey = FCommand->GetOptionKey(Option);
 
-        TControl * Control = FControls[Index];
+          TControl * Control = FControls[ControlIndex];
 
-        UnicodeString Value;
-        if (Option.Kind == TCustomCommandType::okTextBox)
-        {
-          Value = SaveHistoryComboBoxValue(Control, Option);
-        }
-        else if (Option.Kind == TCustomCommandType::okFile)
-        {
-          Value = SaveHistoryComboBoxValue(Control, Option);
-        }
-        else if (Option.Kind == TCustomCommandType::okDropDownList)
-        {
-          Value = GetComboBoxValue(Control, Option.Default);
-        }
-        else if (Option.Kind == TCustomCommandType::okComboBox)
-        {
-          TComboBox * ComboBox = DebugNotNull(dynamic_cast<TComboBox *>(Control));
-          Value = GetComboBoxValue(Control, ComboBox->Text);
-        }
-        else if (Option.Kind == TCustomCommandType::okCheckBox)
-        {
-          TCheckBox * CheckBox = DebugNotNull(dynamic_cast<TCheckBox *>(Control));
-          int Index = (CheckBox->Checked ? 0 : 1);
-          Value = (Index < static_cast<int>(Option.Params.size())) ? Option.Params[Index] : UnicodeString();
-        }
-        else
-        {
-          DebugFail();
-        }
+          UnicodeString Value;
+          if (Option.Kind == TCustomCommandType::okTextBox)
+          {
+            Value = SaveHistoryComboBoxValue(Control, Option);
+          }
+          else if (Option.Kind == TCustomCommandType::okFile)
+          {
+            Value = SaveHistoryComboBoxValue(Control, Option);
+          }
+          else if (Option.Kind == TCustomCommandType::okDropDownList)
+          {
+            Value = GetComboBoxValue(Control, Option.Default);
+          }
+          else if (Option.Kind == TCustomCommandType::okComboBox)
+          {
+            TComboBox * ComboBox = DebugNotNull(dynamic_cast<TComboBox *>(Control));
+            Value = GetComboBoxValue(Control, ComboBox->Text);
+          }
+          else if (Option.Kind == TCustomCommandType::okCheckBox)
+          {
+            TCheckBox * CheckBox = DebugNotNull(dynamic_cast<TCheckBox *>(Control));
+            int Index = (CheckBox->Checked ? 0 : 1);
+            Value = (Index < static_cast<int>(Option.Params.size())) ? Option.Params[Index] : UnicodeString();
+          }
+          else
+          {
+            DebugFail();
+          }
 
-        // The default value setter deletes the "name" when the value is empty.
-        // It would cause us to fall back to the default value, but we want to remember the empty value.
-        if (Value.IsEmpty())
-        {
-          int Index = FCustomCommandOptions->IndexOfName(OptionKey);
-          if (Index < 0)
+          // The default value setter deletes the "name" when the value is empty.
+          // It would cause us to fall back to the default value, but we want to remember the empty value.
+          if (Value.IsEmpty())
           {
-            Index = FCustomCommandOptions->Add(L"");
+            int Index = FCustomCommandOptions->IndexOfName(OptionKey);
+            if (Index < 0)
+            {
+              Index = FCustomCommandOptions->Add(L"");
+            }
+            UnicodeString Line = OptionKey + FCustomCommandOptions->NameValueSeparator;
+            FCustomCommandOptions->Strings[Index] = Line;
+          }
+          else
+          {
+            FCustomCommandOptions->Values[OptionKey] = Value;
           }
-          UnicodeString Line = OptionKey + FCustomCommandOptions->NameValueSeparator;
-          FCustomCommandOptions->Strings[Index] = Line;
-        }
-        else
-        {
-          FCustomCommandOptions->Values[OptionKey] = Value;
         }
+
+        ControlIndex++;
       }
     }
   }
@@ -1203,8 +1214,10 @@ void __fastcall TCustomCommandOptionsDialog::DoHelp()
   }
 }
 //---------------------------------------------------------------------------
-bool __fastcall DoCustomCommandOptionsDialog(const TCustomCommandType * Command, TStrings * CustomCommandOptions)
+bool __fastcall DoCustomCommandOptionsDialog(
+  const TCustomCommandType * Command, TStrings * CustomCommandOptions, unsigned int Flags)
 {
-  std::unique_ptr<TCustomCommandOptionsDialog> Dialog(new TCustomCommandOptionsDialog(Command, CustomCommandOptions));
+  std::unique_ptr<TCustomCommandOptionsDialog> Dialog(
+    new TCustomCommandOptionsDialog(Command, CustomCommandOptions, Flags));
   return Dialog->Execute();
 }

+ 10 - 1
source/forms/CustomScpExplorer.cpp

@@ -1656,7 +1656,16 @@ void __fastcall TCustomScpExplorerForm::CustomCommand(TStrings * FileList,
   const TCustomCommandType & ACommand, TStrings * ALocalFileList)
 {
 
-  UnicodeString CommandCommand = ACommand.GetCommandWithExpandedOptions(WinConfiguration->CustomCommandOptions);
+  std::unique_ptr<TStrings> CustomCommandOptions(CloneStrings(WinConfiguration->CustomCommandOptions));
+  if (ACommand.AnyOptionWithFlag(TCustomCommandType::ofRun))
+  {
+    if (!DoCustomCommandOptionsDialog(&ACommand, CustomCommandOptions.get(), TCustomCommandType::ofRun))
+    {
+      Abort();
+    }
+  }
+
+  UnicodeString CommandCommand = ACommand.GetCommandWithExpandedOptions(CustomCommandOptions.get());
 
   if (FLAGCLEAR(ACommand.Params, ccLocal))
   {

+ 2 - 2
source/forms/Preferences.cpp

@@ -1109,7 +1109,7 @@ void __fastcall TPreferencesDialog::UpdateControls()
     bool ExtensionSelected = CommandSelected && (CommandList == FExtensionList);
     EnableControl(EditCommandButton, CustomCommandSelected);
     EditCommandButton->Visible = !ExtensionSelected;
-    EnableControl(ConfigureCommandButton, ExtensionSelected && (CommandList->Commands[CommandIndex]->OptionsCount > 0));
+    EnableControl(ConfigureCommandButton, ExtensionSelected && CommandList->Commands[CommandIndex]->AnyOptionWithFlag(TCustomCommandType::ofConfig));
     ConfigureCommandButton->Visible = ExtensionSelected;
     EnableControl(RemoveCommandButton, CommandSelected);
     EnableControl(UpCommandButton, CommandSelected && (CommandIndex > 0));
@@ -2657,7 +2657,7 @@ void __fastcall TPreferencesDialog::ConfigureCommand()
   int Index = CustomCommandsView->ItemIndex;
   const TCustomCommandType * Command = GetCommandList(Index)->Commands[GetCommandIndex(Index)];
 
-  DoCustomCommandOptionsDialog(Command, FCustomCommandOptions.get());
+  DoCustomCommandOptionsDialog(Command, FCustomCommandOptions.get(), TCustomCommandType::ofConfig);
   UpdateCustomCommandsView();
 }
 //---------------------------------------------------------------------------

+ 97 - 57
source/windows/WinConfiguration.cpp

@@ -2947,76 +2947,104 @@ bool __fastcall TCustomCommandType::ParseOption(const UnicodeString & Value, TOp
 {
   UnicodeString Buf = Value;
   UnicodeString KindName;
-  bool Result =
-    CutTokenEx(Buf, Option.Id) &&
-    CutTokenEx(Buf, KindName);
+  bool Result = CutTokenEx(Buf, Option.Id);
 
   if (Result)
   {
-    KindName = KindName.LowerCase();
-    if (KindName == L"label")
-    {
-      Option.Kind = okLabel;
-      Result = !Option.IsControl;
-    }
-    else if (KindName == L"link")
-    {
-      Option.Kind = okLink;
-      Result = !Option.IsControl;
-    }
-    else if (KindName == L"separator")
-    {
-      Option.Kind = okSeparator;
-      Result = !Option.IsControl;
-    }
-    else if (KindName == L"group")
-    {
-      Option.Kind = okGroup;
-      Result = !Option.IsControl;
-    }
-    else if (KindName == L"textbox")
-    {
-      Option.Kind = okTextBox;
-      Result = Option.IsControl;
-    }
-    else if (KindName == L"file")
-    {
-      Option.Kind = okFile;
-      Result = Option.IsControl;
-    }
-    else if (KindName == L"dropdownlist")
-    {
-      Option.Kind = okDropDownList;
-      Result = Option.IsControl;
-    }
-    else if (KindName == L"combobox")
-    {
-      Option.Kind = okComboBox;
-      Result = Option.IsControl;
-    }
-    else if (KindName == L"checkbox")
+    Option.Flags = 0;
+
+    UnicodeString FlagName;
+    while (CutTokenEx(Buf, FlagName) && (FlagName.SubString(1, 1) == L"-"))
     {
-      Option.Kind = okCheckBox;
-      Result = Option.IsControl;
+      FlagName = FlagName.LowerCase();
+      if (FlagName == L"-run")
+      {
+        Option.Flags |= ofRun;
+      }
+      else if (FlagName == L"-config")
+      {
+        Option.Flags |= ofConfig;
+      }
+      else
+      {
+        Result = false;
+      }
     }
-    else
+
+    if (Option.Flags == 0)
     {
-      Option.Kind = okUnknown;
+      Option.Flags = ofConfig;
     }
 
-    if ((Option.Kind != okUnknown) &&
-        (Option.Kind != okSeparator))
+    KindName = FlagName;
+
+    if (Result)
     {
-      Result = CutTokenEx(Buf, Option.Caption);
+      KindName = KindName.LowerCase();
+      if (KindName == L"label")
+      {
+        Option.Kind = okLabel;
+        Result = !Option.IsControl;
+      }
+      else if (KindName == L"link")
+      {
+        Option.Kind = okLink;
+        Result = !Option.IsControl;
+      }
+      else if (KindName == L"separator")
+      {
+        Option.Kind = okSeparator;
+        Result = !Option.IsControl;
+      }
+      else if (KindName == L"group")
+      {
+        Option.Kind = okGroup;
+        Result = !Option.IsControl;
+      }
+      else if (KindName == L"textbox")
+      {
+        Option.Kind = okTextBox;
+        Result = Option.IsControl;
+      }
+      else if (KindName == L"file")
+      {
+        Option.Kind = okFile;
+        Result = Option.IsControl;
+      }
+      else if (KindName == L"dropdownlist")
+      {
+        Option.Kind = okDropDownList;
+        Result = Option.IsControl;
+      }
+      else if (KindName == L"combobox")
+      {
+        Option.Kind = okComboBox;
+        Result = Option.IsControl;
+      }
+      else if (KindName == L"checkbox")
+      {
+        Option.Kind = okCheckBox;
+        Result = Option.IsControl;
+      }
+      else
+      {
+        Option.Kind = okUnknown;
+      }
 
-      if (Result && Option.IsControl)
+      if ((Option.Kind != okUnknown) &&
+          (Option.Kind != okSeparator))
       {
-        if (CutTokenEx(Buf, Option.Default))
+        Result = CutTokenEx(Buf, Option.Caption);
+
+        if (Result && Option.IsControl)
         {
-          UnicodeString Param;
-          while (CutTokenEx(Buf, Param))
+          if (CutTokenEx(Buf, Option.Default))
           {
-            Option.Params.push_back(Param);
+            UnicodeString Param;
+            while (CutTokenEx(Buf, Param))
+            {
+              Option.Params.push_back(Param);
+            }
           }
         }
       }
@@ -3041,6 +3069,17 @@ UnicodeString __fastcall TCustomCommandType::GetOptionKey(const TCustomCommandTy
   return Id + L"\\" + Option.Id;
 }
 //---------------------------------------------------------------------------
+bool __fastcall TCustomCommandType::AnyOptionWithFlag(unsigned int Flag) const
+{
+  bool Result = false;
+  for (int Index = 0; !Result && (Index < OptionsCount); Index++)
+  {
+    const TCustomCommandType::TOption & Option = GetOption(Index);
+    Result = FLAGSET(Option.Flags, Flag);
+  }
+  return Result;
+}
+//---------------------------------------------------------------------------
 UnicodeString __fastcall TCustomCommandType::GetCommandWithExpandedOptions(TStrings * CustomCommandOptions) const
 {
   UnicodeString Result = Command;
@@ -3105,6 +3144,7 @@ bool TCustomCommandType::TOption::operator==(const TCustomCommandType::TOption &
 {
   return
     (Id == Other.Id) &&
+    (Flags == Other.Flags) &&
     (Kind == Other.Kind) &&
     (Caption == Other.Caption) &&
     (Default == Other.Default) &&

+ 4 - 0
source/windows/WinConfiguration.h

@@ -1,3 +1,4 @@
+
 //---------------------------------------------------------------------------
 #ifndef WinConfigurationH
 #define WinConfigurationH
@@ -712,6 +713,7 @@ public:
   __fastcall TCustomCommandType(const TCustomCommandType & Other);
 
   enum TOptionKind { okUnknown, okLabel, okLink, okSeparator, okGroup, okTextBox, okFile, okDropDownList, okComboBox, okCheckBox };
+  enum TOptionFlag { ofRun = 0x01, ofConfig = 0x02 };
 
   class TOption
   {
@@ -719,6 +721,7 @@ public:
     __fastcall TOption() {}
 
     UnicodeString Id;
+    unsigned int Flags;
     TOptionKind Kind;
     UnicodeString Caption;
     UnicodeString Default;
@@ -751,6 +754,7 @@ public:
 
   __property int OptionsCount = { read = GetOptionsCount };
   const TOption & __fastcall GetOption(int Index) const;
+  bool __fastcall AnyOptionWithFlag(unsigned int Flag) const;
   UnicodeString __fastcall GetOptionKey(const TOption & Option) const;
   UnicodeString __fastcall GetCommandWithExpandedOptions(TStrings * CustomCommandOptions) const;
 

+ 2 - 1
source/windows/WinInterface.h

@@ -131,7 +131,8 @@ bool __fastcall DoSaveWorkspaceDialog(UnicodeString & WorkspaceName,
 class TShortCuts;
 bool __fastcall DoShortCutDialog(TShortCut & ShortCut,
   const TShortCuts & ShortCuts, UnicodeString HelpKeyword);
-bool __fastcall DoCustomCommandOptionsDialog(const TCustomCommandType * Command, TStrings * CustomCommandOptions);
+bool __fastcall DoCustomCommandOptionsDialog(
+  const TCustomCommandType * Command, TStrings * CustomCommandOptions, unsigned int Flags);
 
 // windows\UserInterface.cpp
 bool __fastcall DoMasterPasswordDialog();