/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void ButtonMouseMove(object sender, MouseEventArgs e) { Point pt = new Point(e.X, e.Y); // if the mouse didn't move to another point, then ignore this message. // ignore this mouse move message. if (m_saveMousePos == pt) { return; } m_saveMousePos = pt; ScrDropDownButton button = (ScrDropDownButton)sender; // Make sure the button the mouse is over will look shaded, now that the // mouse is over it. if (!button.ShadeWhenMouseOver) { button.ShadeWhenMouseOver = true; } // If the button the mouse is over is not the current then make sure the formerly // current button looks normal. if (button.Index != m_currButton && m_currButton > -1) { CurrentButton.State = ButtonState.Normal; } // Now, make the button the mouse is over the current button. m_currButton = button.Index; }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="button"></param> /// ------------------------------------------------------------------------------------ private void InternalVerseSelected(ScrDropDownButton button) { m_currButton = (button == null ? 0 : button.Index); if (VerseSelected != null) { VerseSelected(m_scRef.Book, m_scRef.Chapter, CurrentButton.BCVValue); } OnKeyDown(new KeyEventArgs(Keys.Return)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { List <int> chapterList; // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new ScrReference(button.BCVValue, 1, 1, m_versification); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) { BookSelected(m_scRef.Book); } if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } if (ScrPassageControl.MulScrBooks is DBMultilingScrBooks) { // Get the number of chapters from cache. chapterList = LoadChapterListFromCache(); } else { // Get the number of chapters based on the versification scheme. chapterList = new List <int>(); for (int i = 1; i <= m_scRef.LastChapter; i++) { chapterList.Add(i); } } // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) { InternalChapterSelected(chapterList[0]); } else { // Show the list of chapters. m_nowShowing = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InitializeButtons() { for (int i = 0; i < m_buttons.Length; i++) { m_buttons[i] = new ScrDropDownButton(); m_buttons[i].CanToggle = true; m_buttons[i].Visible = true; m_buttons[i].Index = i; m_buttons[i].Selected += new ScrDropDownButton.SelectedHandler(ButtonSelected); m_buttons[i].MouseHover += new EventHandler(ButtonHover); m_buttons[i].MouseMove += new MouseEventHandler(ButtonMouseMove); m_buttons[i].MouseEnter += new EventHandler(ButtonEnter); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Processes the selection of a button. /// </summary> /// <param name="button">The button the user selected.</param> /// ------------------------------------------------------------------------------------ protected void ButtonSelected(ScrDropDownButton button) { if (m_nowShowing == ListTypes.Books) { InternalBookSelected(button); } else if (m_nowShowing == ListTypes.Chapters) { InternalChapterSelected(button.BCVValue); } else { InternalVerseSelected(button); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determines whether or not a book's title is clipped. If it is, a tool-tip is /// activated so the user can see the entire book name. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void ButtonHover(object sender, EventArgs e) { ScrDropDownButton button = (ScrDropDownButton)sender; // If we're not currently showing the list of books or if the text isn't clipped // don't activate the tooltip. if (m_nowShowing != ListTypes.Books || !button.TextIsClipped) { tipBook.Active = false; } else { tipBook.SetToolTip(button, button.Text); tipBook.Active = true; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new BCVRef(button.BCVValue, 1, 1); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) { BookSelected(m_scRef.Book); } if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } List <int> chapterList = CurrentChapterList; // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) { InternalChapterSelected(chapterList[0]); } else { // Show the list of chapters. CurrentListType = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="button"></param> /// ------------------------------------------------------------------------------------ private void InternalVerseSelected(ScrDropDownButton button) { m_currButton = (button == null ? 0 : button.Index); if (VerseSelected != null) VerseSelected(m_scRef.Book, m_scRef.Chapter, CurrentButton.BCVValue); OnKeyDown(new KeyEventArgs(Keys.Return)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new ScrReference(button.BCVValue, 1, 1, m_versification); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) BookSelected(m_scRef.Book); if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } List<int> chapterList = CurrentChapterList; // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) InternalChapterSelected(chapterList[0]); else { // Show the list of chapters. CurrentListType = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Processes the selection of a button. /// </summary> /// <param name="button">The button the user selected.</param> /// ------------------------------------------------------------------------------------ protected void ButtonSelected(ScrDropDownButton button) { if (m_nowShowing == ListTypes.Books) InternalBookSelected(button); else if (m_nowShowing == ListTypes.Chapters) InternalChapterSelected(button.BCVValue); else InternalVerseSelected(button); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void InternalBookSelected(ScrDropDownButton button) { List<int> chapterList; // If the user picked a different book, then set the chapter and verse to 1 and // reparse the reference object to track with the user's selection. if (m_scRef.Book != button.BCVValue) { m_scRef = new ScrReference(button.BCVValue, 1, 1, m_versification); ScrPassageControl.Reference = m_scRef.AsString; } if (BookSelected != null) BookSelected(m_scRef.Book); if (m_fBooksOnly) { OnKeyDown(new KeyEventArgs(Keys.Return)); return; } if (ScrPassageControl.MulScrBooks is DBMultilingScrBooks) { // Get the number of chapters from cache. chapterList = LoadChapterListFromCache(); } else { // Get the number of chapters based on the versification scheme. chapterList = new List<int>(); for (int i = 1; i <= m_scRef.LastChapter; i++) chapterList.Add(i); } // If there is only one chapter then there's no sense showing the chapter list so // go right to the verse list. This will be the case when the user picks a book // like Jude. if (chapterList.Count == 1) InternalChapterSelected(chapterList[0]); else { // Show the list of chapters. m_nowShowing = ListTypes.Chapters; LoadCVButtons(chapterList, m_scRef.Chapter); } }