Ejemplo n.º 1
0
 private void SaveRequested(IPluginChildWindow sender)
 {
     if (changedCheckBox.Checked)
     {
         PutScripture();
     }
 }
Ejemplo n.º 2
0
        private void SaveRequested(IPluginChildWindow sender)
        {
            if (m_writeLock == null)
            {
                m_writeLock = m_project.RequestWriteLock(this, ReleaseRequested, savedDataId);
            }
            if (m_writeLock == null)
            {
                MessageBox.Show("Cannot get write lock; aborting loading data");
                m_savedText      = "";
                m_currentText    = "";
                textBox.Text     = "";
                textBox.ReadOnly = true;
                return;
            }

            m_currentText = textBox.Text;
            ProjectTextData data = new ProjectTextData
            {
                Lines = m_currentText.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)
            };

            try
            {
                m_project.PutPluginData(m_writeLock, this, savedDataId, writer => m_Serializer.Serialize(writer, data));
            }
            catch (Exception e)
            {
                MessageBox.Show($"Unable to save data:\n{e.Message}");
            }
            m_savedText = m_currentText;
        }
Ejemplo n.º 3
0
 private void Parent_SaveRequested(IPluginChildWindow sender)
 {
     if (lastSavedValue != EditText)
     {
         SaveText();
     }
 }
Ejemplo n.º 4
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            m_parent = parent;
            if (parent.CurrentState == null)
            {
                m_project  = null;
                m_verseRef = null;
            }
            else
            {
                m_project  = parent.CurrentState.Project;
                m_verseRef = parent.CurrentState.VerseRef;
            }

            parent.SetTitle(PluginG.pluginName);
            parent.WindowClosing   += WindowClosing;
            parent.ProjectChanged  += ProjectChanged;
            parent.VerseRefChanged += VerseRefChanged;
            if (m_project != null)
            {
                m_project.ProjectDataChanged += ProjectDataChanged;
            }

            m_UpdateThread = new Thread(UpdateTimeWorker);
            m_UpdateThread.Start();
        }
Ejemplo n.º 5
0
        private void ProjectChanged(IPluginChildWindow sender, IProject newProject)
        {
            // Save the old project first:
            PromptSaveAndUnlock();

            // Then remember the new project
            SetProject(newProject);
        }
Ejemplo n.º 6
0
 public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
 {
     m_project = parent.CurrentState.Project;
     parent.SetTitle(PluginF.pluginName);
     parent.SaveRequested  += SaveRequested;
     parent.WindowClosing  += WindowClosing;
     parent.ProjectChanged += ProjectChanged;
 }
Ejemplo n.º 7
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginJ.pluginName);
            SetProject(parent.CurrentState.Project);

            host.ActiveWindowSelectionChanged += ActiveWindowSelectionChanged;
            parent.ProjectChanged             += ProjectChanged;
        }
Ejemplo n.º 8
0
        private void ProjectChanged(IPluginChildWindow sender, IProject newProject)
        {
            // Save the old project first:
            PromptSaveAndDispose(sender);

            // Then load the new project
            m_project = newProject;
            LoadSavedText();
        }
Ejemplo n.º 9
0
 private void Parent_VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     Debug.Assert(oldReference.Equals(m_reference));
     m_reference = newReference;
     if (oldReference.BookNum != newReference.BookNum || oldReference.ChapterNum != newReference.ChapterNum)
     {
         UpdateWordleAsync();
     }
 }
Ejemplo n.º 10
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginE.pluginName);
            m_Project   = parent.CurrentState.Project;
            m_Reference = parent.CurrentState.VerseRef;

            parent.ProjectChanged  += ProjectChanged;
            parent.VerseRefChanged += VerseRefChanged;
        }
Ejemplo n.º 11
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.Icon = Resources.icon;
            parent.SetTitle(ProjectTextEditorPlugin.pluginName, false);
            UpdateProject(parent.CurrentState.Project);

            parent.SaveRequested   += Parent_SaveRequested;
            parent.WindowClosing   += Parent_WindowClosing;
            parent.ProjectChanged  += Parent_ProjectChanged;
            parent.MegaMenuShowing += Parent_MegaMenuShowing;
        }
Ejemplo n.º 12
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            m_host = host;
            parent.SetTitle(ChapterWordCloudPlugin.pluginName);

            parent.VerseRefChanged += Parent_VerseRefChanged;
            parent.ProjectChanged  += Parent_ProjectChanged;

            SetProject(parent.CurrentState.Project);
            m_reference    = parent.CurrentState.VerseRef;
            m_selectedText = state;
            selectedTextToolStripMenuItem.Checked = state != null;
        }
Ejemplo n.º 13
0
 private void ReferenceChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     if ((m_Reference.BookNum != newReference.BookNum) ||
         (m_Reference.ChapterNum != newReference.ChapterNum))
     {
         PromptSaveAndUnlock();
         m_Reference      = newReference;
         chapterText.Text = "Click 'Get Chapter'";
         chapterText.BringToFront();
         bookName.Text           = m_Reference.BookCode;
         chapterNumber.Text      = m_Reference.ChapterNum.ToString();
         changedCheckBox.Checked = false;
     }
 }
Ejemplo n.º 14
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginH.pluginName);

            m_Host      = host;
            m_Project   = parent.CurrentState.Project;
            m_Reference = parent.CurrentState.VerseRef;

            IReferenceListWindow refList = host.ReferenceList;

            refList.ListChanged         += ListChanged;
            refList.SelectedItemChanged += SelectedItemChanged;
            refList.ItemDoubleClicked   += ItemDoubleClicked;
        }
Ejemplo n.º 15
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginL.pluginName);
            parent.ProjectChanged  += ProjectChanged;
            parent.VerseRefChanged += VerseRefChanged;

            SetProject(parent.CurrentState.Project);
            m_verseRef = parent.CurrentState.VerseRef;

            RowStyle rowStyle = new RowStyle(SizeType.AutoSize);

            m_tableLayoutPanel.RowStyles.Add(rowStyle);

            AddHeaderRow();
        }
Ejemplo n.º 16
0
        public void ProjectChanged(IPluginChildWindow sender, IProject newProject)
        {
            if (m_project != null)
            {
                m_project.ProjectDataChanged -= ProjectDataChanged;
            }
            m_project = newProject;
            if (m_project != null)
            {
                m_project.ProjectDataChanged += ProjectDataChanged;
            }

            m_verseRef = sender.CurrentState.VerseRef;
            ShowProjectInfo();
        }
Ejemplo n.º 17
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginK.pluginName);

            m_host    = host;
            m_project = parent.CurrentState.Project;
            m_parent  = parent;

            m_whichListListBox.BeginUpdate();
            m_whichListListBox.Items.Add(ProjectList);
            m_whichListListBox.Items.Add(AllList);
            m_whichListListBox.Items.Add(MajorList);
            m_whichListListBox.SetSelected(0, true);
            m_whichListListBox.EndUpdate();
        }
Ejemplo n.º 18
0
        private void PromptSaveAndDispose(IPluginChildWindow sender)
        {
            if (textBox.Text != m_savedText)
            {
                var response = MessageBox.Show("Save changed data?", "Plugin F", MessageBoxButtons.YesNo);
                if (response == DialogResult.Yes)
                {
                    SaveRequested(sender);
                }
            }

            if (m_writeLock != null)
            {
                m_writeLock.Dispose();
                m_writeLock = null;
            }
        }
Ejemplo n.º 19
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginI.pluginName);

            SetProject(parent.CurrentState.Project);
            m_Reference        = parent.CurrentState.VerseRef;
            chapterText.Text   = "Click 'Get Chapter'";
            bookName.Text      = m_Reference.BookCode;
            chapterNumber.Text = m_Reference.ChapterNum.ToString();
            chapterText.Text   = "";
            chapterText.BringToFront();
            changedCheckBox.Checked = false;
            EnableRadioButtons();
            UsfmRadioButton.Checked       = true;
            UsfmTokensRadioButton.Checked = false;
            UsxRadioButton.Checked        = false;
            m_WriteLock            = null;
            lockedCheckBox.Checked = false;

            parent.VerseRefChanged += ReferenceChanged;
            parent.WindowClosing   += WindowClosing;
            parent.SaveRequested   += SaveRequested;
            parent.ProjectChanged  += ProjectChanged;
        }
Ejemplo n.º 20
0
 private void Parent_MegaMenuShowing(IPluginChildWindow sender)
 {
     undoToolStripMenuItem.Enabled = textChanged;
 }
Ejemplo n.º 21
0
 public void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     m_project  = sender.CurrentState.Project;
     m_verseRef = newReference;
     ShowProjectInfo();
 }
Ejemplo n.º 22
0
 private void Parent_ProjectChanged(IPluginChildWindow sender, IProject newProject)
 {
     UpdateProject(newProject);
 }
Ejemplo n.º 23
0
 public void WindowClosing(IPluginChildWindow sender, CancelEventArgs args)
 {
     s_exists = false;
 }
Ejemplo n.º 24
0
 private void Parent_WindowClosing(IPluginChildWindow sender, System.ComponentModel.CancelEventArgs args)
 {
     PromptAndSave(args);
 }
Ejemplo n.º 25
0
 private void WindowClosing(IPluginChildWindow sender, CancelEventArgs args)
 {
     PromptSaveAndDispose(sender);
 }
Ejemplo n.º 26
0
 private void WindowClosing(IPluginChildWindow sender, CancelEventArgs args)
 {
     PromptSaveAndUnlock();
 }
Ejemplo n.º 27
0
 private void ProjectChanged(IPluginChildWindow sender, IProject newProject)
 {
     SetProject(newProject);
 }
Ejemplo n.º 28
0
 public void ProjectChanged(IPluginChildWindow sender, IProject newProject)
 {
     m_Project   = newProject;
     m_Reference = sender.CurrentState.VerseRef;
     ShowScripture();
 }
Ejemplo n.º 29
0
 public void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     m_Reference = newReference;
     ShowScripture();
 }
Ejemplo n.º 30
0
 private void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     m_verseRef = newReference;
 }