Пример #1
0
//---------------------------------------------------------------------------
void __fastcall TSynchronizeDialog::UpdateControls()
{
  EnableControl(StartButton, !LocalDirectoryEdit->Text.IsEmpty() &&
    !RemoteDirectoryEdit->Text.IsEmpty());
  TButton * OldButton = FSynchronizing ? StartButton : StopButton;
  TButton * NewButton = FSynchronizing ? StopButton : StartButton;
  if (!NewButton->Visible || OldButton->Visible)
  {
    NewButton->Visible = true;
    if (OldButton->Focused())
    {
      NewButton->SetFocus();
    }
    OldButton->Default = false;
    NewButton->Default = true;
    OldButton->Visible = false;
    // some of the above steps hides accelerators when start button is pressed with mouse
    ResetSystemSettings(this);
  }
  Caption = FormatFormCaption(this, LoadStr(FSynchronizing ? SYNCHRONIZE_SYCHRONIZING : SYNCHRONIZE_TITLE));
  EnableControl(TransferSettingsButton, !FSynchronizing);
  CancelButton->Visible = !FSynchronizing || FLAGSET(FOptions, soNoMinimize);
  EnableControl(CancelButton, !FSynchronizing);
  EnableControl(DirectoriesGroup, !FSynchronizing);
  EnableControl(OptionsGroup, !FSynchronizing);
  EnableControl(CopyParamGroup, !FSynchronizing);
  MinimizeButton->Visible = FSynchronizing && FLAGCLEAR(FOptions, soNoMinimize);
  EnableControl(SynchronizeSelectedOnlyCheck,
    OptionsGroup->Enabled && FLAGSET(FOptions, soAllowSelectedOnly));

  UnicodeString InfoStr = CopyParams.GetInfoStr(L"; ", ActualCopyParamAttrs());
  CopyParamLabel->Caption = InfoStr;
  CopyParamLabel->Hint = InfoStr;
  CopyParamLabel->ShowHint =
    (CopyParamLabel->Canvas->TextWidth(InfoStr) > (CopyParamLabel->Width * 3 / 2));

  TransferSettingsButton->Style =
    FLAGCLEAR(Options, soDoNotUsePresets) ?
      TCustomButton::bsSplitButton : TCustomButton::bsPushButton;

  if (LogPanel->Visible != FSynchronizing)
  {
    if (FSynchronizing)
    {
      LogPanel->Visible = true;
      ClientHeight = ClientHeight + LogPanel->Height;
    }
    else
    {
      ClientHeight = ClientHeight - LogPanel->Height;
      LogPanel->Visible = false;
    }
  }

  // When minimizing to tray globally, no point showing special "minimize to tray" command
  MinimizeButton->Style =
    !WinConfiguration->MinimizeToTray ? TCustomButton::bsSplitButton : TCustomButton::bsPushButton;
}
Пример #2
0
//---------------------------------------------------------------------------
void __fastcall TSynchronizeDialog::CopyParamListPopup(TRect R, int AdditionalOptions)
{
  // We pass in FCopyParams, although it may not be the exact copy param
  // that will be used (because of PreserveTime). The reason is to
  // display checkbox next to user-selected preset
  ::CopyParamListPopup(
    R, FPresetsMenu, FCopyParams, FPreset, CopyParamClick,
    cplCustomize | AdditionalOptions, ActualCopyParamAttrs());
}
Пример #3
0
//---------------------------------------------------------------------------
void __fastcall TSynchronizeDialog::CopyParamGroupClick(TObject * /*Sender*/)
{
  // PreserveTime is forced for some settings, but avoid hard-setting it until
  // user really confirms it on cutom dialog
  TCopyParamType ACopyParams = CopyParams;
  if (DoCopyParamCustomDialog(ACopyParams, ActualCopyParamAttrs()))
  {
    FCopyParams = ACopyParams;
    UpdateControls();
  }
}
Пример #4
0
//---------------------------------------------------------------------------
void __fastcall TFullSynchronizeDialog::CopyParamClick(TObject * Sender)
{
    assert(FLAGCLEAR(FOptions, fsoDoNotUsePresets));
    // PreserveTime is forced for some settings, but avoid hard-setting it until
    // user really confirms it on custom dialog
    TCopyParamType ACopyParams = CopyParams;
    if (CopyParamListPopupClick(Sender, ACopyParams, FPreset,
                                ActualCopyParamAttrs()))
    {
        FCopyParams = ACopyParams;
        UpdateControls();
    }
}
Пример #5
0
//---------------------------------------------------------------------------
void __fastcall TFullSynchronizeDialog::UpdateControls()
{
    EnableControl(SynchronizeTimestampsButton, FLAGCLEAR(Options, fsoDisableTimestamp));
    if (SynchronizeTimestampsButton->Checked)
    {
        SynchronizeExistingOnlyCheck->Checked = true;
        SynchronizeDeleteCheck->Checked = false;
        SynchronizeByTimeCheck->Checked = true;
    }
    if (SynchronizeBothButton->Checked)
    {
        SynchronizeByTimeCheck->Checked = true;
        SynchronizeBySizeCheck->Checked = false;
        if (MirrorFilesButton->Checked)
        {
            SynchronizeFilesButton->Checked = true;
        }
    }
    EnableControl(MirrorFilesButton, !SynchronizeBothButton->Checked);
    EnableControl(SynchronizeDeleteCheck, !SynchronizeBothButton->Checked &&
                  !SynchronizeTimestampsButton->Checked);
    EnableControl(SynchronizeExistingOnlyCheck, !SynchronizeTimestampsButton->Checked);
    EnableControl(SynchronizeByTimeCheck, !SynchronizeBothButton->Checked &&
                  !SynchronizeTimestampsButton->Checked);
    EnableControl(SynchronizeBySizeCheck, !SynchronizeBothButton->Checked);
    EnableControl(SynchronizeSelectedOnlyCheck, FLAGSET(FOptions, fsoAllowSelectedOnly));

    EnableControl(OkButton, !LocalDirectoryEdit->Text.IsEmpty() &&
                  !RemoteDirectoryEdit->Text.IsEmpty());

    UnicodeString InfoStr = FCopyParams.GetInfoStr(L"; ", ActualCopyParamAttrs());
    CopyParamLabel->Caption = InfoStr;
    CopyParamLabel->Hint = InfoStr;
    CopyParamLabel->ShowHint =
        (CopyParamLabel->Canvas->TextWidth(InfoStr) > (CopyParamLabel->Width * 3 / 2));
    SynchronizeBySizeCheck->Caption = SynchronizeTimestampsButton->Checked ?
                                      LoadStr(SYNCHRONIZE_SAME_SIZE) : UnicodeString(FSynchronizeBySizeCaption);

    TransferSettingsButton->Style =
        FLAGCLEAR(Options, fsoDoNotUsePresets) ?
        TCustomButton::bsSplitButton : TCustomButton::bsPushButton;
}