//--------------------------------------------------------------------------- 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; }
//--------------------------------------------------------------------------- void __fastcall TSynchronizeProgressForm::Start() { FStarted = true; FStartTime = Now(); UpdateTimer->Enabled = true; StartTimeLabel->Caption = FStartTime.TimeString(); Caption = FormatFormCaption(this, LoadStr(FCompareOnly ? SYNCHRONIZE_PROGRESS_COMPARE : SYNCHRONIZE_PROGRESS_SYNCHRONIZE2)); if (!IsApplicationMinimized()) { // Do not showing the progress when the application is minimized, // otherwise the form popups up unminimized. // Quick and dirty hack: with this form, we do not support showing it // once the application restores, // otherwise we would have to synchronize it somehow with the TProgressForm, // not to show it over the TProgressForm ShowAsModal(this, FShowAsModalStorage); } }