예제 #1
0
        /// <summary>
        /// Initialize with associated command line control
        /// </summary>
        /// <param name="commandLineControl"></param>

        public static QuickSearchPopup Initialize(
            MRUEdit commandLineControl,
            Form parentForm,
            ContentsTreeControl contentstree)
        {
            QuickSearchPopup qsp = null;

            AssertMx.IsNotNull(commandLineControl, "CommandLineControl");
            AssertMx.IsNotNull(parentForm, "ParentForm");

            foreach (Control c in parentForm.Controls)             // see if already exists
            {
                if (c is QuickSearchPopup)
                {
                    qsp = c as QuickSearchPopup;
                    break;
                }
            }

            bool newPopup = false;

            if (qsp == null)             // need to create new popup in parent form
            {
                qsp = new QuickSearchPopup();
                parentForm.Controls.Add(qsp);
                newPopup = true;
            }

            qsp.Initialize2(commandLineControl, parentForm, contentstree, newPopup);

            return(qsp);
        }
예제 #2
0
        private void CommandLineControl_Enter(object sender, EventArgs e) // Received focus
        {
            QuickSearchPopup =                                            // link to quicksearch control that processes keyboard input
                               QuickSearchPopup.Initialize(CommandLineControl, CommandLineControl.FindForm(), ContentsTreeCtl);

            QuickSearchPopup.StructurePopupEnabled = false;          // no structure popup here
            QuickSearchPopup.ConsiderShellFocus    = false;          // need to turn this off
        }
예제 #3
0
        void Initialize2(
            MRUEdit clc,
            Form parentForm,
            ContentsTreeControl contentsTree,
            bool newPopup)
        {
            QuickSearchPopup qsp = this;             // debug

            //if (newPopup) // just created?
            if (!Initialized)
            {
                Visible = false;
                //Width = 236; // set proper size
                //Height = 186;

                Point p  = clc.PointToScreen(new Point(0, clc.Bottom));
                Point p2 = parentForm.PointToClient(p);
                Left = p.X;                  // position below input control
                Top  = p.Y + clc.Height * 2;

                BringToFront();

                ContentsTree = contentsTree;

                RelatedStructuresControl rsp = RelatedStructuresControl;

                InitialStructurePanelWidth = StructurePanel.Width;                 //rsp.Width + 12; // initial StructurePanel width
                InitialStructurePanelWidthWithoutRelatedStructureOptions = rsp.MoleculeControl.Right + 10;

                //InitialStructurePanelWidth = 400; // debug

                InitialStructurePanelHeight = rsp.Top + rsp.MoleculeControl.Height + 15;                 // initial StructurePanel height to just below structure box
                StructurePanel.Dock         = DockStyle.Fill;

                OtherCidsList.Visible = false;

                MoleculeControl strBox     = RelatedStructuresControl.MoleculeControl; // make structure box wider to the left
                int             newBoxLeft = 4;
                int             dx         = strBox.Left - newBoxLeft;                 // amount to widen structure box
                int             w2         = strBox.Width + dx;
                int             h2         = strBox.Height;

                RSM = new RelatedStructureControlManager();
                RelatedStructuresControl.RSM = RSM;
                RSM.RSC = RelatedStructuresControl;
                RSM.HideUndefinedStructureList = true;                 // don't show structure panel until after search complete

                RelatedStructuresControl.RenderSearchResultsCompleteCallBack = RenderSearchResultsCompleteCallBack;

                RelatedStructuresControl.SetupCheckmarks();

                Initialized = true;
            }

            CommandLineControl  = clc;                 // associated command line comtrol
            clc.GotFocus       += CommandLine_GotFocus;
            clc.KeyDown        += CommandLine_KeyDown; // add command line events for us
            clc.KeyUp          += CommandLine_KeyUp;
            clc.PreviewKeyDown += CommandLine_PreviewKeyDown;

            if (!Timer.Enabled)
            {
                Timer.Enabled = true;
                PreviousInput = "";                 // need to clear to get redisplay of structure
            }

            return;
        }