/// ------------------------------------------------------------------------------------ protected bool OnGroupBySortedField(object args) { if (!m_activeView) { return(false); } if (WordListGrid.IsGroupedByField) { WordListGrid.GroupByField = null; } else if (WordListGrid.SortOptions.SortFields != null && WordListGrid.SortOptions.SortFields.Count > 0) { WordListGrid.GroupByField = WordListGrid.SortOptions.SortFields[0].Field; if (Properties.Settings.Default.CollapseWordListsOnGrouping) { WordListGrid.ToggleGroupExpansion(false); } } if (!WordListGrid.CurrentCell.Displayed && WordListGrid.CurrentCell != null) { WordListGrid.ScrollRowToMiddleOfGrid(WordListGrid.CurrentCell.RowIndex); } FindInfo.ResetStartSearchCell(true); FindInfo.CanFindAgain = true; return(true); }
/// ------------------------------------------------------------------------------------ protected bool OnViewUndocked(object args) { if (args == this) { WordListGrid.SetStatusBarText(); } return(false); }
/// ------------------------------------------------------------------------------------ protected bool OnCollapseAllGroups(object args) { if (!m_activeView) { return(false); } WordListGrid.ToggleGroupExpansion(false); return(true); }
/// ------------------------------------------------------------------------------------ protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); RawRecViewOn = Properties.Settings.Default.DataCorpusVwRecordPaneVisible; OnViewDocked(this); m_initialDock = true; Application.DoEvents(); WordListGrid.Focus(); }
/// ------------------------------------------------------------------------------------ protected bool OnUpdateGroupByFieldParent(object args) { var itemProps = args as TMItemProperties; if (!m_activeView || itemProps == null || itemProps.Name.StartsWith("tbb", StringComparison.Ordinal)) { return(false); } WordListGrid.BuildGroupByMenu(itemProps.Name, App.TMAdapter); return(true); }
/// ------------------------------------------------------------------------------------ protected bool OnDropDownGroupByFieldParent(object args) { var itemProps = args as ToolBarPopupInfo; if (itemProps == null || !m_activeView) { return(false); } WordListGrid.BuildGroupByMenu(itemProps.Name, m_tmAdapter); return(true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the record view after a sort has taken place since the grid's RowEnter /// event doesn't seem to take care of it. /// </summary> /// ------------------------------------------------------------------------------------ protected bool OnWordListGridSorted(object args) { PaWordListGrid grid = args as PaWordListGrid; if (grid != WordListGrid) { return(false); } _recView.UpdateRecord(WordListGrid.GetRecord(WordListGrid.CurrentCellAddress.Y)); return(true); }
/// ------------------------------------------------------------------------------------ public void SetViewActive(bool makeActive, bool isDocked) { m_activeView = makeActive; if (makeActive) { FindInfo.Grid = WordListGrid; if (isDocked && WordListGrid != null) { WordListGrid.SetStatusBarText(); WordListGrid.Focus(); } } }
/// ------------------------------------------------------------------------------------ protected override bool OnDataSourcesModified(object args) { base.OnDataSourcesModified(args); int savCurrRowIndex = 0; int savCurrColIndex = 0; int savFirstRowIndex = 0; SortOptions savSortOptions = null; if (WordListGrid != null) { // Save the index of the row that's current and the index of the first visible row. savCurrRowIndex = (WordListGrid.CurrentRow != null ? WordListGrid.CurrentRow.Index : 0); savCurrColIndex = (WordListGrid.CurrentCell != null ? WordListGrid.CurrentCell.ColumnIndex : 0); savFirstRowIndex = WordListGrid.FirstDisplayedScrollingRowIndex; // Save the current sort options savSortOptions = WordListGrid.SortOptions; } // Update the fonts in case a custom field's name // has changed (since each field has it's own font). _recView.UpdateFonts(); // Update the record in case we're pointing to a new record or it's data changed. _recView.UpdateRecord(null); // Rebuild the contents of the window. LoadWindow(); // Restore the current row to what it was before rebuilding. // Then make sure the row is visible. if (WordListGrid != null) { WordListGrid.PostDataSourceModifiedRestore( savCurrRowIndex, savCurrColIndex, savFirstRowIndex, savSortOptions); } return(false); }
/// ------------------------------------------------------------------------------------ protected bool OnViewDocked(object args) { if (args == this) { try { // These are in a try/catch because sometimes they might throw an exception // in rare cases. The exception has to do with a condition in the underlying // .Net framework that I haven't been able to make sense of. Anyway, if an // exception is thrown, no big deal, the splitter distances will just be set // to their default values. splitOuter.SplitterDistance = (int)(splitOuter.Height * Properties.Settings.Default.DataCorpusVwSplitRatio); } catch { } // Don't need to load the tool bar or menus if this is the first time // the view was docked since that all gets done during construction. if (m_initialDock) { m_initialDock = false; } else { // The toolbar has to be recreated each time the view is removed from it's // (undocked) form and docked back into the main form. The reason has to // do with tooltips. They seem to form an attachment, somehow, with the // form that owns the controls the tooltip is extending. When that form // gets pulled out from under the tooltips, sometimes the program will crash. LoadToolbar(); } if (WordListGrid != null) { WordListGrid.SetStatusBarText(); } } return(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a wordEntry list grid with the specified cache and adds it to the form. /// </summary> /// ------------------------------------------------------------------------------------ public void Initialize(WordListCache cache) { m_cache = cache; if (WordListGrid != null) { WordListGrid.Cache = m_cache; } else { WordListGrid = new PaWordListGrid(cache, GetType(), false); WordListGrid.BorderStyle = BorderStyle.None; WordListGrid.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; WordListGrid.TMAdapter = m_tmAdapter; // Even thought the grid is docked, setting it's size here prevents the user // from seeing that split second during which time the grid goes from it's // small, default size to its docked size. WordListGrid.Size = new Size(splitOuter.Panel1.Width, splitOuter.Panel1.Height); WordListGrid.Name = Name + "Grid"; WordListGrid.LoadSettings(); WordListGrid.RowEnter += m_grid_RowEnter; WordListGrid.Visible = false; pnlGrid.Controls.Add(WordListGrid); WordListGrid.Visible = true; WordListGrid.TabIndex = 0; WordListGrid.Focus(); WordListGrid.SortOptions = Project.DataCorpusVwSortOptions; WordListGrid.IsCurrentPlaybackGrid = true; WordListGrid.UseWaitCursor = false; WordListGrid.Cursor = Cursors.Default; } // This will enforce an update of the record pane. _recView.UpdateRecord(WordListGrid.GetRecord(), true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called when sort options change. /// </summary> /// ------------------------------------------------------------------------------------ private void HandlePhoneticSortOptionsChanged(SortOptions sortOptions) { WordListGrid.SortOptions = sortOptions; _recView.UpdateRecord(WordListGrid.GetRecord()); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Update the record view when the user changed the order or visibility of fields. /// </summary> /// ------------------------------------------------------------------------------------ protected bool OnRecordViewOptionsChanged(object args) { _recView.UpdateRecord(WordListGrid.GetRecord(), true); return(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the record pane with the raw record query for the current row. /// </summary> /// ------------------------------------------------------------------------------------ void m_grid_RowEnter(object sender, DataGridViewCellEventArgs e) { _recView.UpdateRecord(WordListGrid.GetRecord(e.RowIndex)); }
/// ------------------------------------------------------------------------------------ private void HandlePlaybackSpeedAdjusterPlayClick(object sender, EventArgs e) { m_tmAdapter.HideBarItemsPopup("tbbAdjustPlaybackSpeedParent"); m_tmAdapter.HideBarItemsPopup("tbbPlayback"); WordListGrid.OnPlayback(null); }
/// ------------------------------------------------------------------------------------ public void SaveSettings() { WordListGrid.SaveSettings(); Properties.Settings.Default.DataCorpusVwSplitRatio = splitOuter.SplitterDistance / (float)splitOuter.Height; Properties.Settings.Default.DataCorpusVwRecordPaneVisible = RawRecViewOn; }