예제 #1
0
 private void RelatedStructureBrowser_Deactivate(object sender, EventArgs e)
 {
     Timer.Enabled     = false;
     RSM.Timer.Enabled = false;
     RelatedStructuresControl.PreserveRelatedCheckmarkPreferences();
     return;
 }
예제 #2
0
        /// <summary>
        /// HideQuickSearchPopup
        /// </summary>

        public void HideQuickSearchPopup()
        {
            Visible = false;             // hide the popup
            RelatedStructuresControl.PreserveRelatedCheckmarkPreferences();
            PreviousInput = "";          // avoid any additional QuickDisplays

            return;
        }
예제 #3
0
/// <summary>
/// Show related structures for supplied CID
/// </summary>
/// <param name="initialCid"></param>
/// <param name="queryType"></param>
/// <param name="excludeCurrentCompounds"></param>

        public void ShowInstance(
            string initialCid,
            string queryType,
            bool excludeCurrentCompounds)
        {
            try
            {
                InSetup = true;

                MetaTable mt     = CompoundId.GetRootMetaTableFromCid(initialCid);             // set title
                string    extCid = CompoundId.Format(initialCid, mt);
                string    txt    = extCid + " and Related Structures";
                if (mt != null)
                {
                    txt = mt.KeyMetaColumn.Label + " " + txt;
                }
                Text = txt;

                RelatedStructuresControl.MoleculeControl.ClearMolecule();
                RelatedStructuresControl.SetupCheckmarks();

                CompoundIdControl.Text = initialCid; // set cid to trigger start of search and UI update on next tick

                Left      = PopupPos;                // position
                Top       = PopupPos;
                PopupPos += 125;
                if (PopupPos > InitialPopupPos + (5 * 125))
                {
                    PopupPos = InitialPopupPos;
                }

                Show();                 // show (not modal)
                BringToFront();
                return;
            }

            catch (Exception ex) { ex = ex; }

            finally
            {
                InSetup = false;
            }
        }
예제 #4
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;
        }