예제 #1
0
/// <summary>
/// Setup for edit
/// </summary>
/// <param name="inList"></param>
/// <param name="rootTable"></param>
/// <returns></returns>

        bool Setup(
            CidList inList,
            MetaTable rootTable)
        {
            string formattedCid, label, txt;

            RootTable = rootTable;

            InListName = inList.UserObject.Name;
            ListName   = InListName;

            CidList  = inList.Clone();        // make copy of list to edit
            CidCount = InitialCount = CidList.Count;
            if (CidCount > 32000)             // too big to edit?
            {
                txt =
                    "The list contains " + CidList.Count.ToString() + " compound numbers which\n" +
                    "exceeds the maximum of 32,000 that can be directly edited.\n" +
                    " Do you want to clear the list and start a new list?";

                DialogResult dr = MessageBoxMx.Show(txt, "List Too Large to Edit", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);

                if (dr != DialogResult.Yes)
                {
                    return(false);
                }

                CidList            = new CidList();
                CidList.UserObject =                         // set name properly
                                     UserObjectUtil.ParseInternalUserObjectName(InListName, UserObjectType.CnList);
            }

            Text = "Edit List - [" + CidList.UserObject.Name + "]";

            Before = FormatList();             // convert & save initial list

            if (rootTable != null)
            {
                label = rootTable.KeyMetaColumn.Label;
            }
            else
            {
                label = "Compound Id";
            }

            ListLabel.Text = " " + label + " - (Enter one number per line) ";
            RNLabel.Text   = label + ":";

            MolCtl.ClearMolecule();             // clear any structure
            CidCtl.Text = HeavyAtoms.Text = Weight.Text = Formula.Text = "";

            CidListCtl.Text = Before;             // put text in editor

            DisplayStatusMsg("");

            if (SS.I.AllowGroupingBySalts)
            {
                SaltsMenu.Enabled = true;
            }
            else
            {
                SaltsMenu.Enabled = false;
            }

            return(true);
        }