public InterlinearTextsRecordEditView(InfoPane info) : base(new StTextDataTree()) { (m_dataEntryForm as StTextDataTree).InfoPane = info; }
protected void ShowMainView() { m_fInShowMainView = true; try { m_tabCtrl.SelectedIndex = (int) InterlinearTab; // set the persisted tab setting. RefreshPaneBar(); // JohnT: don't want to switch mode just because concordance selects no text. // if (m_hvoStText == 0) // IsPersistedForAnInterlinearTabPage = false; bool fDidParse = m_fSkipNextParse; if ((InterlinearTab != TabPageSelection.RawText && InterlinearTab != TabPageSelection.Info) && m_hvoStText != 0 && !m_fSkipNextParse) { if (!ParseText(out fDidParse)) { // Didn't get anything...switch to raw (probably empty text). m_tabCtrl.SelectedIndex = ktpsRawText; } // currently we assume that if we had something to parse, then the rootbox // is invalid and needs to be resync'd. In the future, we'll want to // base this decision more exactly on whether the text has actually been // updated since the last time we set the root. // We need to do this even if we're not switching to that pane now, because // when we later do, we may not need to reparse, but it could still be remembering. if (m_idcPane != null) m_idcPane.InvalidateRootBox(); if (m_taggingViewPane != null) m_taggingViewPane.InvalidateRootBox(); if (m_printViewPane != null) m_printViewPane.InvalidateRootBox(); } if (IsPersistedForAnInterlinearTabPage && InterlinearTabPageIsSelected()) { #if DEBUG //TimeRecorder.Begin("switch to interlin view"); #endif this.SuspendLayout(); #if DEBUG //TimeRecorder.Begin("MakeInterlinPane"); #endif MakeInterlinPane(); #if DEBUG //TimeRecorder.End("MakeInterlinPane"); //TimeRecorder.Begin("ParseTextM"); //TimeRecorder.End("ParseTextM"); //TimeRecorder.Begin("Add and front"); #endif // Pass the interlinear document to which ever tab wants to use it. // (Controls.Add() may seem a little weird, but // .NET does automatically remove the control from a previous parent) if (m_tabCtrl.SelectedIndex == ktpsGloss) m_tpGloss.Controls.Add(m_panelInterlin); else if (m_tabCtrl.SelectedIndex == ktpsAnalyze) m_tpInterlinear.Controls.Add(m_panelInterlin); // The only current difference in functionality between the interliear tabs // (Gloss and Analyze) is the interlinear lines configured for the document. // So pass that (context sensitive) property to the interlinear doc control. m_idcPane.ConfigPropName = this.ConfigPropName; m_panelInterlin.BringToFront(); #if DEBUG //TimeRecorder.End("Add and front"); //TimeRecorder.Begin("ResumeLayout"); #endif this.ResumeLayout(); #if DEBUG //TimeRecorder.End("ResumeLayout"); //TimeRecorder.Begin("SetRoot"); #endif // Somewhat obsolete comment? (JohnT 1 Jan 2008: it says to do the SetRoot AFTER // making visible, but we don't. // This causes a reconstruct if the root box has been constructed, forcing it to // reload everything to be consistent with the results of the reparse. At the // time of writing, we can't use Reconstruct for this, because it fails if the // root box has not yet been constructed. A fix for this has already been made // in another branch, I believe. We need to do this AFTER the pane has been // made visible, so that a DoUpdates call can really draw it, in order to get // data loaded during SetRoot. // This ensures that its root has been constructed and it's in a valid state // for things like setting an annotation and making the focus box and scrolling // to show it. Also that all layout that happens in the process happens at the // correct width (and height...this helps us position the focus box sensibly). if (m_idcPane.Width != m_tabCtrl.SelectedTab.Width) m_idcPane.Width = m_tabCtrl.SelectedTab.Width; if (m_idcPane.Height != m_tabCtrl.SelectedTab.Height) m_idcPane.Height = m_tabCtrl.SelectedTab.Height; // SetupLineChoices is resets the interlin doc control to display using line choices // appropriate to the tab (Gloss or Analyze). SetupLineChoices(); m_idcPane.SetRoot(m_hvoStText); SelectAnnotation(); UpdateContextHistory(); m_idcPane.Visible = true; ShowAddWordsToLexiconDlg(); return; #if DEBUG //TimeRecorder.End("SetRoot"); //TimeRecorder.Begin("Paint"); #endif //m_idcPane.Update(); #if DEBUG //TimeRecorder.End("Paint"); //TimeRecorder.End("switch to interlin view"); //TimeRecorder.Report(); #endif } else if (m_tabCtrl.SelectedIndex == ktpsTagging) { this.SuspendLayout(); if (m_taggingViewPane == null) { MakeTaggingPane(); } SetPaneSizeAndRoot(m_taggingViewPane); } else if (m_tabCtrl.SelectedIndex == ktpsPrint) { this.SuspendLayout(); if (m_printViewPane == null) { MakePrintViewPane(); } SetPaneSizeAndRoot(m_printViewPane); } else if (m_tabCtrl.SelectedIndex == ktpsRawText) { if (m_rtPane == null) { MakeRawTextPane(); } if (!this.m_tpRawText.Controls.Contains(m_rtPane)) { this.SuspendLayout(); this.m_tpRawText.Controls.Add(m_rtPane); this.ResumeLayout(); } m_rtPane.Focus(); // Creating the selection must be done after setting the focus on the raw text // pane. Otherwise, the writing system combobox in the toolbar is not updated // (and neither is the keyboard). See the later comments in LT-6692. if (m_rtPane.RootBox != null && m_rtPane.RootBox.Selection == null && m_hvoStText != 0) m_rtPane.RootBox.MakeSimpleSel(true, false, false, true); } else if (InterlinearTabPageIsSelected()) { // for some reason, the property table doesn't have our selected index // so go back to RawText tab page. m_tabCtrl.SelectedIndex = ktpsRawText; return; } else if (m_tabCtrl.SelectedIndex == ktpsCChart) { if (m_constChartPane == null) { m_constChartPane = (UserControl) DynamicLoader.CreateObject("Discourse.dll", "SIL.FieldWorks.Discourse.ConstituentChart", new object[] {Cache}); (m_constChartPane as IxCoreColleague).Init(m_mediator, m_configurationParameters); m_constChartPane.Dock = DockStyle.Fill; m_tpCChart.Controls.Add(m_constChartPane); if (m_styleSheet != null) SetStyleSheetForConstChart(); } if (m_hvoStText == 0) m_constChartPane.Enabled = false; else { // LT-7733 Warning dialog for Text Chart XCore.XMessageBoxExManager.Trigger("TextChartNewFeature"); m_constChartPane.Enabled = true; } SetConstChartRoot(m_hvoStText); m_constChartPane.Focus(); } else if (m_tabCtrl.SelectedIndex == ktpsInfo) { if (m_infoPane == null) { m_infoPane = new InfoPane(Cache, m_mediator, Clerk); m_infoPane.Dock = DockStyle.Fill; m_tpInfo.Controls.Add(m_infoPane); } m_infoPane.Enabled = (m_hvoStText != 0); if (m_infoPane.Enabled) { m_infoPane.BackColor = System.Drawing.SystemColors.Control; m_infoPane.Focus(); } else { m_infoPane.BackColor = System.Drawing.Color.White; } } SelectAnnotation(); UpdateContextHistory(); } finally { m_fInShowMainView = false; } }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) return; if( disposing ) { SuspendLayout(); // don't want do trigger OnLayout() when removing controls! DestroyTitleContentsPane(); if (m_tabCtrl != null) m_tabCtrl.SelectedIndexChanged -= new System.EventHandler( m_tabCtrl_SelectedIndexChanged); DisposeInterlinDocPanes(); DisposeIfParentNull(m_panelInterlin); DisposeIfParentNull(m_rtPane); DisposeIfParentNull(m_infoPane); if(components != null) { components.Dispose(); } // LT-5702 // The Find / Replace dlg can currently only exist in this view, so // remove it when the view changes. This will have to be expanded // when the dlg can search and operate on more than one view in Flex // as it does in TE. if (FwApp.App != null) FwApp.App.RemoveFindReplaceDialog(); } m_tcPane = null; m_infoPane = null; m_rtPane = null; m_constChartPane = null; ClearInterlinDocPaneVariables(); m_panelInterlin = null; m_panelTagging = null; m_panelPrintView = null; m_bookmark = null; base.Dispose( disposing ); }