Example #1
0
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren(Layout);
            CaptionLabel.Dock        = DockStyle.Top;
            richBox                  = new RichTextExtended();
            richBox.ContextMenuStrip = Layout.GetLayoutTextEditContextStrip();
            richBox.Enter           += HandleRichBoxEnter;
            richBox.Parent           = ParentNotePanel;
            richBox.Dock             = DockStyle.Fill;
            richBox.BringToFront();
            richBox.Rtf = this.Data1;
            richBox.SelectionChanged += HandleRichTextSelectionChanged;
            richBox.TextChanged      += HandleTextChanged;
            richBox.ReadOnly          = this.ReadOnly;
            richBox.HideSelection     = false;         // must be able to see focus form other controls
            captionLabel.MouseDown   += HandleMouseDownOnCaptionLabel;
            //CaptionLabel.MouseHover += HandleCaptionMouseHover;
            MarkupCombo             = new ToolStripComboBox();
            MarkupCombo.ToolTipText = Loc.Instance.GetString("AddIns allow text notes to format text. A global option controls the default markup to use on notes but this may be overridden here.");
            //	LayoutDetails.Instance.BuildMarkupComboBox (MarkupCombo);

            BuildDropDownList();

            properties.DropDownItems.Add(new ToolStripSeparator());

            ToolStripButton fullScreen = new ToolStripButton();

            fullScreen.Text   = Loc.GetStr("Fullscreen");
            fullScreen.Click += HandleFullScreenClick;
            properties.DropDown.Items.Add(fullScreen);

            properties.DropDownItems.Add(MarkupCombo);
            MarkupCombo.SelectedIndexChanged += HandleSelectedIndexChanged;
            MarkupCombo.DropDownStyle         = ComboBoxStyle.DropDownList;
            MarkupCombo.DropDown             += HandleDropDown;
            loadingcombo = true;
            // just show default if we have not overridden this
            if (Markuplanguage == defaultmarkup)
            {
                MarkupCombo.Text = defaultmarkup;
            }
            else
            if (SelectedMarkup != null)
            {
                for (int i = 0; i < MarkupCombo.Items.Count; i++)
                {
                    if (MarkupCombo.Items [i].GetType() == SelectedMarkup.GetType())
                    {
                        MarkupCombo.SelectedIndex = i;
                        break;
                    }
                }
                richBox.MarkupOverride = (iMarkupLanguage)MarkupCombo.SelectedItem;
            }


            extraItemsToShow = new ToolStripComboBox();
            extraItemsToShow.Items.AddRange(Enum.GetNames(typeof(ExtraItemsToShow)));
            extraItemsToShow.DropDownStyle = ComboBoxStyle.DropDownList;
            properties.DropDownItems.Add(extraItemsToShow);

            extraItemsToShow.SelectedIndex         = (int)extraItemsToShow_value;
            extraItemsToShow.ToolTipText           = Loc.Instance.GetString("Reselect this to refresh after editing text.");
            extraItemsToShow.SelectedIndexChanged += (object sender, EventArgs e) => {
                extraItemsToShow_value = (ExtraItemsToShow)extraItemsToShow.SelectedIndex;
                SetSaveRequired(true);
                UpdateExtraView();
            };

            // we use markup tag to indicate whether the data on the markup combo has changed to avoid slowness in save
            MarkupCombo.Tag = false;
            loadingcombo    = false;

            tabView         = new TabNavigation(richBox);
            tabView.Visible = false;
            tabView.Parent  = ParentNotePanel;
            tabView.Dock    = DockStyle.Top;
            //tabView.SendToBack();
            tabView.BringToFront();

            if (null == bookMarkView)
            {
                bookMarkView = new NoteNavigation(this);
            }
            bookMarkView.Visible = false;
            AddBookmarkView();

            UpdateExtraView();
            richBox.BringToFront();
            //CaptionLabel.BringToFront();
        }
        protected override void DoBuildChildren(LayoutPanelBase Layout)
        {
            base.DoBuildChildren (Layout);
            CaptionLabel.Dock = DockStyle.Top;
            richBox = new RichTextExtended ();
            richBox.ContextMenuStrip = Layout.GetLayoutTextEditContextStrip ();
            richBox.Enter += HandleRichBoxEnter;
            richBox.Parent = ParentNotePanel;
            richBox.Dock = DockStyle.Fill;
            richBox.BringToFront ();
            richBox.Rtf = this.Data1;
            richBox.SelectionChanged += HandleRichTextSelectionChanged;
            richBox.TextChanged += HandleTextChanged;
            richBox.ReadOnly = this.ReadOnly;
            richBox.HideSelection = false; // must be able to see focus form other controls
            captionLabel.MouseDown += HandleMouseDownOnCaptionLabel;
            //CaptionLabel.MouseHover += HandleCaptionMouseHover;
            MarkupCombo = new ToolStripComboBox ();
            MarkupCombo.ToolTipText = Loc.Instance.GetString ("AddIns allow text notes to format text. A global option controls the default markup to use on notes but this may be overridden here.");
            //	LayoutDetails.Instance.BuildMarkupComboBox (MarkupCombo);

            BuildDropDownList ();

            properties.DropDownItems.Add (new ToolStripSeparator());

            ToolStripButton fullScreen = new ToolStripButton();
            fullScreen.Text = Loc.GetStr("Fullscreen");
            fullScreen.Click+= HandleFullScreenClick;
            properties.DropDown.Items.Add (fullScreen);

            properties.DropDownItems.Add (MarkupCombo);
            MarkupCombo.SelectedIndexChanged += HandleSelectedIndexChanged;
            MarkupCombo.DropDownStyle = ComboBoxStyle.DropDownList;
            MarkupCombo.DropDown += HandleDropDown;
            loadingcombo = true;
            // just show default if we have not overridden this
            if (Markuplanguage == defaultmarkup) {
                MarkupCombo.Text = defaultmarkup;
            } else
            if (SelectedMarkup != null) {
                for (int i = 0; i < MarkupCombo.Items.Count; i++) {
                    if (MarkupCombo.Items [i].GetType () == SelectedMarkup.GetType ()) {
                        MarkupCombo.SelectedIndex = i;
                        break;
                    }
                }
                richBox.MarkupOverride = (iMarkupLanguage)MarkupCombo.SelectedItem;
            }

            extraItemsToShow = new ToolStripComboBox ();
            extraItemsToShow.Items.AddRange (Enum.GetNames (typeof(ExtraItemsToShow)));
            extraItemsToShow.DropDownStyle = ComboBoxStyle.DropDownList;
            properties.DropDownItems.Add (extraItemsToShow);

            extraItemsToShow.SelectedIndex = (int)extraItemsToShow_value;
            extraItemsToShow.ToolTipText = Loc.Instance.GetString ("Reselect this to refresh after editing text.");
            extraItemsToShow.SelectedIndexChanged += (object sender, EventArgs e) => {
                extraItemsToShow_value = (ExtraItemsToShow)extraItemsToShow.SelectedIndex;
                SetSaveRequired (true);
                UpdateExtraView ();
            };

            // we use markup tag to indicate whether the data on the markup combo has changed to avoid slowness in save
            MarkupCombo.Tag = false;
            loadingcombo = false;

            tabView = new TabNavigation (richBox);
            tabView.Visible = false;
            tabView.Parent = ParentNotePanel;
            tabView.Dock = DockStyle.Top;
            //tabView.SendToBack();
            tabView.BringToFront ();

            if (null == bookMarkView) {
                bookMarkView = new NoteNavigation (this);
            }
            bookMarkView.Visible = false;
            AddBookmarkView ();

            UpdateExtraView();
            richBox.BringToFront();
            //CaptionLabel.BringToFront();
        }