Example #1
0
        public static DialogResult Show(
            QueryColumn qc)
        {
            ParsedStructureCriteria pssc;
            string tok;

            if (Instance == null)
            {
                Instance = new CriteriaStructureFormatDialog();
            }
            CriteriaStructureFormatDialog cfd = Instance;

            if (!ParsedStructureCriteria.TryParse(qc, out pssc) ||
                (pssc.SearchType != StructureSearchType.Substructure && pssc.SearchType != StructureSearchType.SmallWorld &&
                 pssc.SearchType != StructureSearchType.Related))
            {
                XtraMessageBox.Show("Only structure columns with criteria can have formatting defined");
                return(DialogResult.Cancel);
            }

            // Setup

            new JupyterGuiConverter().ConvertFormOrUserControl(Instance);

            if (pssc.SearchType == StructureSearchType.SmallWorld)
            {
                cfd.HilightStructures.Checked = pssc.SmallWorldParameters.Highlight;
                cfd.AlignStructures.Checked   = pssc.SmallWorldParameters.Align;
            }

            else             // Other structure match hilighting (i.e. SS)
            {
                cfd.HilightStructures.Checked = pssc.Highlight;
                cfd.AlignStructures.Checked   = pssc.Align;
            }

            // Show form & get new values

            DialogResult dr = cfd.ShowDialog(SessionManager.ActiveForm);

            if (dr == DialogResult.Cancel)
            {
                return(dr);
            }

            if (pssc.SearchType == StructureSearchType.SmallWorld)
            {
                pssc.SmallWorldParameters.Highlight = cfd.HilightStructures.Checked;
                pssc.SmallWorldParameters.Align     = cfd.AlignStructures.Checked;
            }

            else             // Other structure match hilighting (i.e. SS)
            {
                pssc.Highlight = cfd.HilightStructures.Checked;
                pssc.Align     = cfd.AlignStructures.Checked;
            }

            pssc.ConvertToQueryColumnCriteria(qc);
            return(dr);
        }
Example #2
0
/// <summary>
/// Show formatting dialog appropriate for data type
/// </summary>
/// <param name="qc"></param>
/// <returns></returns>

        public static DialogResult Show(
            QueryColumn qc)
        {
            ColumnFormatEnum displayFormat;
            int        decimals;
            MetaColumn mc = qc.MetaColumn;

            if (mc.IsNumeric && !mc.IsKey)
            {
                return(NumberFormatDialog.Show(qc));
            }

            else if (mc.DataType == MetaColumnType.Date)
            {
                return(DateFormatDialog.Show(qc));
            }

            else if (mc.DataType == MetaColumnType.Structure)
            {
                return(CriteriaStructureFormatDialog.Show(qc));
            }

            else if (mc.DataType == MetaColumnType.String)
            {
                return(TextFormatDialog.Show(qc));
            }

            else
            {
                XtraMessageBox.Show("Only numeric, date/time and chemical structure fields can be formatted");
                return(DialogResult.Cancel);
            }
        }