Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        public FFmpegDownloadDlg()
        {
            Logger.WriteEvent("FFmpegDownloadDlg constructor");
            InitializeComponent();
            InitializeDownloadLinkLabel();

            if (Settings.Default.FFmpegDownloadDlg == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.FFmpegDownloadDlg = FormSettings.Create(this);
            }

            _buttonCancel.MouseMove += delegate
            {
                // Not sure why both of these are necessary, but it seems to be the case.
                _buttonCancel.UseWaitCursor = false;
                _buttonCancel.Cursor        = Cursors.Default;
            };

            _labelOverview.Font                = FontHelper.MakeFont(Program.DialogFont, FontStyle.Bold);
            _labelStatus.Font                  = _labelOverview.Font;
            _linkManualDownload.Font           = Program.DialogFont;
            _labelDownloadAndInstall.Font      = Program.DialogFont;
            _labelCopyFromAnotherComputer.Font = Program.DialogFont;
            _labelInstallFromZipFile.Font      = Program.DialogFont;

            _labelCopyFromAnotherComputer.Text = string.Format(_labelCopyFromAnotherComputer.Text, FFmpegDownloadHelper.FFmpegForSayMoreFolder);
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        public WelcomeDialog(WelcomeDialogViewModel viewModel)
        {
            Logger.WriteEvent("WelcomeDialog constructor");

            InitializeComponent();

            Font = SystemFonts.MessageBoxFont;             //use the default OS UI font

            Model = viewModel;

            if (Settings.Default.WelcomeDialog == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.WelcomeDialog = FormSettings.Create(this);
            }

            tsOptions.Renderer       = new SIL.Windows.Forms.NoToolStripBorderRenderer();
            tsOptions.BackColorBegin = Color.White;
            tsOptions.BackColorEnd   = Color.White;
            DialogResult             = DialogResult.Cancel;

            LoadMRUButtons();

            LocalizeItemDlg.StringsLocalized += LocalizationInitiated;
            LocalizationInitiated();
        }
Exemplo n.º 3
0
        private void Shell_Load(object sender, EventArgs e)
        {
            //Handle window sizing/location. Normally, we just Maximize the window.
            //The exceptions to this are if we are in a DEBUG build or the settings have a MaximizeWindow=='False", which at this time
            //must be done by hand (no user UI is provided).
            try
            {
                SuspendLayout();

                if (Settings.Default.WindowSizeAndLocation == null)
                {
                    StartPosition = FormStartPosition.WindowsDefaultLocation;
                    WindowState   = FormWindowState.Maximized;
                    Settings.Default.WindowSizeAndLocation = FormSettings.Create(this);
                    Settings.Default.Save();
                }

                // This feature is not yet a normal part of Bloom, since we think just maximizing is more rice-farmer-friendly.
                // However, we added the ability to remember this stuff at the request of the person making videos, who needs
                // Bloom to open in the same place / size each time.
                if (Settings.Default.MaximizeWindow == false)
                {
                    Settings.Default.WindowSizeAndLocation.InitializeForm(this);
                }
                else
                {
                    // BL-1036: save and restore un-maximized settings
                    var savedBounds = Settings.Default.RestoreBounds;
                    if ((savedBounds.Width > 200) && (savedBounds.Height > 200) && (IsOnScreen(savedBounds)))
                    {
                        StartPosition = FormStartPosition.Manual;
                        WindowState   = FormWindowState.Normal;
                        Bounds        = savedBounds;
                    }
                    else
                    {
                        StartPosition = FormStartPosition.CenterScreen;
                    }

                    WindowState = FormWindowState.Maximized;

                    UpdatePerformanceMeasurementStatus();
                }
            }
            catch (Exception error)
            {
                Debug.Fail(error.Message);

// ReSharper disable HeuristicUnreachableCode
                //Not worth bothering the user. Just reset the values to something reasonable.
                StartPosition = FormStartPosition.WindowsDefaultLocation;
                WindowState   = FormWindowState.Maximized;
// ReSharper restore HeuristicUnreachableCode
            }
            finally
            {
                ResumeLayout();
            }
        }
Exemplo n.º 4
0
        public AssignCharacterDlg(AssignCharacterViewModel viewModel)
        {
            InitializeComponent();

            m_viewModel = viewModel;

            if (Settings.Default.AssignCharacterDialogFormSettings == null)
            {
                Settings.Default.AssignCharacterDialogFormSettings = FormSettings.Create(this);
            }

            m_txtCharacterFilter.CorrectHeight();
            m_txtDeliveryFilter.CorrectHeight();
            if (Settings.Default.AssignCharactersShowGridView)
            {
                m_toolStripButtonGridView.Checked = true;
            }

            var books = new BookSet();

            foreach (var bookId in m_viewModel.IncludedBooks)
            {
                books.Add(bookId);
            }
            m_scriptureReference.VerseControl.BooksPresentSet = books;
            m_scriptureReference.VerseControl.ShowEmptyBooks  = false;

            m_scriptureReference.VerseControl.AllowVerseSegments = false;
            m_scriptureReference.VerseControl.Versification      = m_viewModel.Versification;
            m_scriptureReference.VerseControl.VerseRefChanged   += m_scriptureReference_VerseRefChanged;
            m_scriptureReference.VerseControl.Disposed          += (sender, args) =>
                                                                   m_scriptureReference.VerseControl.VerseRefChanged -= m_scriptureReference_VerseRefChanged;

            m_blocksViewer.Initialize(m_viewModel,
                                      AssignCharacterViewModel.Character.GetCharacterIdForUi,
                                      block => block.Delivery);
            m_viewModel.CurrentBlockChanged += LoadBlock;

            UpdateProgressBarForMode();

            HandleStringsLocalized();
            LocalizeItemDlg.StringsLocalized += HandleStringsLocalized;

            m_listBoxCharacters.DisplayMember = "LocalizedDisplay";
            m_originalDefaultFontForLists     = m_listBoxCharacters.Font;
            SetFontsFromViewModel();

            m_viewModel.AssignedBlocksIncremented += m_viewModel_AssignedBlocksIncremented;
            m_viewModel.UiFontSizeChanged         += (sender, args) => SetFontsFromViewModel();

            m_blocksViewer.VisibleChanged += LoadBlock;
            m_blocksViewer.Disposed       += (sender, args) => m_blocksViewer.VisibleChanged -= LoadBlock;

            SetFilterControlsFromMode();

            m_viewModel.CurrentBookSaved += UpdateSavedText;
        }
Exemplo n.º 5
0
        /// ------------------------------------------------------------------------------------
        public NewSessionsFromFilesDlg(NewSessionsFromFileDlgViewModel viewModel)
        {
            Logger.WriteEvent("NewSessionsFromFilesDlg constructor");

            InitializeComponent();

            var selectedCol = new DataGridViewCheckBoxColumn();

            selectedCol.AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells;
            selectedCol.DataPropertyName = "Selected";
            selectedCol.HeaderText       = string.Empty;
            selectedCol.Name             = "selectedCol";
            selectedCol.Resizable        = DataGridViewTriState.False;
            selectedCol.SortMode         = DataGridViewColumnSortMode.Automatic;
            _gridFiles.Grid.Columns.Insert(0, selectedCol);
            _chkBoxColHdrHandler = new CheckBoxColumnHeaderHandler(selectedCol);

            _gridFiles.InitializeGrid("NewSessionsFromFilesDlg");
            _gridFiles.AfterComponentSelectionChanged = HandleComponentFileSelected;

            Controls.Add(_panelProgress);

            _labelIncomingFiles.Font = Program.DialogFont;
            _labelInstructions.Font  = Program.DialogFont;
            _linkFindFiles.Font      = Program.DialogFont;
            _labelSourceFolder.Font  = new Font(Program.DialogFont, FontStyle.Bold);
            _panelProgress.Visible   = false;

            if (Settings.Default.NewSessionsFromFilesDlg == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.NewSessionsFromFilesDlg = FormSettings.Create(this);
            }

            _folderMissingMsgCtrl = new NewSessionsFromFilesDlgFolderNotFoundMsg();
            _gridFiles.Controls.Add(_folderMissingMsgCtrl);
            _folderMissingMsgCtrl.BringToFront();

            _mediaPlayerPanel.BorderStyle = BorderStyle.None;

            _mediaPlayerViewModel = new MediaPlayerViewModel();

            _mediaPlayerViewModel.SetVolume(Settings.Default.MediaPlayerVolume);
            _mediaPlayer      = new MediaPlayer(_mediaPlayerViewModel);
            _mediaPlayer.Dock = DockStyle.Fill;
            _mediaPlayerPanel.Controls.Add(_mediaPlayer);

            DialogResult                     = DialogResult.Cancel;
            _viewModel                       = viewModel;
            _viewModel.FilesChanged         += UpdateDisplay;
            _viewModel.FileLoadingStarted   += InitializeProgressIndicatorForFileLoading;
            _viewModel.FilesLoaded          += UpdateFileLoadingProgress;
            _viewModel.FileLoadingCompleted += FileLoadingProgressComplete;
            _viewModel.Initialize(this);
        }
Exemplo n.º 6
0
        /// ------------------------------------------------------------------------------------
        public MediaFileMoreInfoDlg(string mediaFileInfo) : this()
        {
            if (Settings.Default.MediaFileMoreInfoDlg == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.MediaFileMoreInfoDlg = FormSettings.Create(this);
            }

            _mediaFilePath = mediaFileInfo;
            LoadBrowserControl();
        }
Exemplo n.º 7
0
        /// ------------------------------------------------------------------------------------
        public ProjectWindow(string projectPath, IEnumerable <ISayMoreView> views,
                             IEnumerable <ICommand> commands, UILanguageDlg.Factory uiLanguageDialogFactory) : this()
        {
            if (Settings.Default.ProjectWindow == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.ProjectWindow = FormSettings.Create(this);
            }

            var asm    = Assembly.GetExecutingAssembly();
            var stream = asm.GetManifestResourceStream("SayMore.SayMore.ico");

            if (stream != null)
            {
                Icon = new Icon(stream);
            }

            _projectPath             = projectPath;
            _commands                = commands;
            _uiLanguageDialogFactory = uiLanguageDialogFactory;

            _viewTabGroup.Visible = false;

            foreach (var vw in views)
            {
                vw.AddTabToTabGroup(_viewTabGroup);

                if (vw.MainMenuItem != null)
                {
                    vw.MainMenuItem.Enabled = false;
                    _mainMenuStrip.Items.Insert(_mainMenuStrip.Items.IndexOf(_mainMenuHelp), vw.MainMenuItem);
                }

                //------------------------------------------------------------------------------------
                // 19 FEB 2014, Phil Hopper: Disable the hidden tabs because Alt+Key is activating
                // buttons that are not on the active (visible) tab.  Use vw.ViewActivated() and
                // vw.ViewDeactivated() to enable and disable tabs at the appropriate time.
                //------------------------------------------------------------------------------------
                ((UserControl)vw).Enabled = false;
            }

            SetWindowText();
            LocalizeItemDlg.StringsLocalized += SetWindowText;

            foreach (var tab in _viewTabGroup.Tabs.Where(tab => tab.View is ProjectScreen))
            {
                _viewTabGroup.SetActiveView(tab);
            }

            Application.DoEvents();
            _viewTabGroup.Visible = true;
        }
        /// ------------------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            if (Settings.Default.MPlayerDebuggingOutputWindow == null)
            {
                Settings.Default.MPlayerDebuggingOutputWindow = FormSettings.Create(this);
            }
            else
            {
                Settings.Default.MPlayerDebuggingOutputWindow.InitializeForm(this);
            }

            base.OnLoad(e);
        }
Exemplo n.º 9
0
        /// ------------------------------------------------------------------------------------
        public SegmenterDlgBase(SegmenterDlgBaseViewModel viewModel) : this()
        {
            _viewModel = viewModel;
            _viewModel.UpdateDisplayProvider = UpdateDisplay;
            _viewModel.OralAnnotationWaveAreaRefreshAction = () => _waveControl.InvalidateBottomReservedArea();

            if (!_moreReliableDesignMode && FormSettings == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                FormSettings  = FormSettings.Create(this);
            }

            _labelTimeDisplay.Text = MediaPlayerViewModel.GetTimeDisplay(0f,
                                                                         (float)_viewModel.OrigWaveStream.TotalTime.TotalSeconds);
        }
Exemplo n.º 10
0
Arquivo: App.cs Projeto: h3tch/ProtoFX
        /// <summary>
        /// On form closing, save all source files, delete
        /// all OpenGL objects and save form state.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void App_FormClosing(object sender, FormClosingEventArgs e)
        {
            // check if there are any files with changes
            foreach (TabPage tab in tabSource.TabPages)
            {
                if (!CloseTab(tab))
                {
                    e.Cancel = true;
                }
            }

            // delete OpenGL objects
            glControl.ClearScene();

            // SAVE CURRENT WINDOW STATE

            // save to file
            XmlSerializer.Save(FormSettings.Create(this), Properties.Resources.WINDOW_SETTINGS_FILE);
        }
Exemplo n.º 11
0
        public OpenProjectDlg(Project currentProject)
        {
            InitializeComponent();

            if (Settings.Default.OpenProjectDlgFormSettings == null)
            {
                Settings.Default.OpenProjectDlgFormSettings = FormSettings.Create(this);
            }

            if (currentProject != null)
            {
                m_listExistingProjects.SelectedProject = currentProject.ProjectFilePath;
                SelectedProject = currentProject.ProjectFilePath;
                m_listExistingProjects.AddReadOnlyProject(currentProject);
            }
            else
            {
                m_btnOk.Enabled = false;
            }
        }
Exemplo n.º 12
0
        /// ------------------------------------------------------------------------------------
        public SessionRecorderDlg()
        {
            Logger.WriteEvent("SessionRecorderDlg constructor");

            InitializeComponent();

            _recordedLengthLabelFormat = _labelRecLength.Text;
            _labelRecLength.Text       = string.Format(_recordedLengthLabelFormat, "00.0");

            _moreReliableDesignMode = (DesignMode || GetService(typeof(IDesignerHost)) != null) ||
                                      (LicenseManager.UsageMode == LicenseUsageMode.Designtime);

            if (_moreReliableDesignMode)
            {
                return;
            }

            DoubleBuffered = true;

            _labelRecLength.Font       = Program.DialogFont;
            _labelRecordingFormat.Font = Program.DialogFont;
            toolStrip1.Renderer        = new NoToolStripBorderRenderer();

            _buttonOK.Click += delegate
            {
                DialogResult = DialogResult.OK;
                Close();
            };

            _buttonCancel.Click += delegate
            {
                DialogResult = DialogResult.Abort;
                Close();
            };

            if (Settings.Default.SessionRecorderDlg == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.SessionRecorderDlg = FormSettings.Create(this);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// To enable remembering and restoring form size and position, add an entry in Settings.Settings for
        /// the form. The name of the entry should be the name of the form followed by "FormSettings" and the
        /// type should be "SIL.Windows.Forms.PortableSettingsProvider.FormSettings"
        /// </summary>
        private void RestoreFormSettings()
        {
            // attempt to restore form size and position
            m_formSettingsName = SettingExists(Name + "FormSettings");
            if (string.IsNullOrEmpty(m_formSettingsName) && Name.EndsWith("Dlg"))
            {
                m_formSettingsName = SettingExists(Name.Substring(0, Name.Length - 3) + "DialogFormSettings");
            }
            if (string.IsNullOrEmpty(m_formSettingsName))
            {
                return;
            }

            if (Settings.Default[m_formSettingsName] == null)
            {
                Settings.Default[m_formSettingsName] = FormSettings.Create(this);
                Settings.Default.Save();
            }
            else
            {
                ((FormSettings)Settings.Default[m_formSettingsName]).InitializeForm(this);
            }
        }
Exemplo n.º 14
0
        /// ------------------------------------------------------------------------------------
        public ConvertMediaDlg(ConvertMediaDlgViewModel viewModel) : this()
        {
            Logger.WriteEvent("ConvertMediaDlg constructor. file = {0}", viewModel.InputFile);
            _viewModel = viewModel;

            _showOutput = Settings.Default.ShowFFmpegDetailsWhenConvertingMedia;

            if (Settings.Default.ConvertMediaDlg == null)
            {
                StartPosition = FormStartPosition.CenterScreen;
                Settings.Default.ConvertMediaDlg = FormSettings.Create(this);
            }

            InitializeFonts();
            _labelFileToConvertValue.Text = Path.GetFileName(_viewModel.InputFile);
            if (_viewModel.MediaInfo == null)
            {
                _labelStatus.Text = LocalizationManager.GetString("DialogBoxes.ConvertMediaDlg.InvalidMediaFile",
                                                                  "File does not appear to be a valid media file.");
                _labelStatus.ForeColor = Color.Red;
            }
            else
            {
                _labelOutputFileValue.Text = _viewModel.GetNewOutputFileName(true);
                _comboAvailableConversions.Items.AddRange(_viewModel.AvailableConversions);
                _comboAvailableConversions.SelectedItem              = _viewModel.SelectedConversion;
                _comboAvailableConversions.SelectionChangeCommitted += delegate
                {
                    _viewModel.SelectedConversion = _comboAvailableConversions.SelectedItem as FFmpegConversionInfo;
                    _labelOutputFileValue.Text    = _viewModel.GetNewOutputFileName(true);
                    UpdateDisplay();
                };

                _buttonBeginConversion.Click += HandleBeginConversionClick;
                _buttonCancel.Click          += delegate { _viewModel.Cancel(); };

                _buttonCancel.MouseMove += delegate
                {
                    // Not sure why both of these are necessary, but it seems to be the case.
                    _buttonCancel.UseWaitCursor = false;
                    _buttonCancel.Cursor        = Cursors.Default;
                };
            }

            _buttonDownload.Click += delegate
            {
                using (var dlg = new FFmpegDownloadDlg())
                    dlg.ShowDialog(this);
                _viewModel.SetConversionStateBasedOnPresenceOfFfmpegForSayMore();
                UpdateDisplay();
            };

            _buttonShowOutput.Click += delegate
            {
                _showOutput = true;
                UpdateDisplay();
            };

            _buttonHideOutput.Click += delegate
            {
                _showOutput = false;
                UpdateDisplay();
            };

            _labelDownloadNeeded.Tag          = _labelDownloadNeeded.Text;
            LocalizeItemDlg.StringsLocalized += HandleStringsLocalized;

            Program.SuspendBackgroundProcesses();
        }