Exemplo n.º 1
0
        //public override string UsageEventName
        //{
        //    get { return "editdiagram"; }
        //}

        //private void toolStripButton1_Click_1(object sender, EventArgs e)
        //{
        //    if (btnStyleProps.Checked)
        //    {
        //        if (m_propsForm == null)
        //        {
        //            m_propsForm = new PropertiesToolForm();
        //            m_propsForm.SelectedObject = m_diagram.Style;
        //            m_propsForm.FormClosing += new FormClosingEventHandler(m_propsForm_FormClosing);
        //            m_propsForm.OnChanged += new EventHandler(m_propsForm_OnChanged);
        //        }
        //        m_propsForm.Show();
        //    }
        //    else
        //    {
        //        if (m_propsForm != null) m_propsForm.Hide();
        //    }
        //}

        //void m_propsForm_OnChanged(object sender, EventArgs e)
        //{
        //    drawPanel.Invalidate();
        //}

        //void m_propsForm_FormClosing(object sender, FormClosingEventArgs e)
        //{
        //    m_propsForm.Hide();
        //    e.Cancel = true;
        //    //btnStyleProps.Checked = false;
        //}

        private void cbxStyle_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!m_created)
            {
                return;
            }
            SetStyle(CreateSelectedStyle());
            Usage.AddSub("change_diagram_style", XmlTool.GetRegisterType(m_diagram.Style));
        }
Exemplo n.º 2
0
        public DiagramEditFrame(IVirtualFile file, IDatabaseSource conn)
        {
            InitializeComponent();
            OnlineHelpManager.RegisterHelpButton(btnOnlineHelp, "diagrams");

            if (!LicenseTool.FeatureAllowed(DiagramsFeature.Test))
            {
                throw new MissingFeatureError(DiagramsFeature._Name);
            }
            btnAddToFavorites.Enabled = file is DiskFile;
            m_file = file;
            //cbxStyle.Items.Add(Texts.Get("s_custom"));
            m_diagram = Diagram.Load(m_file);

            int index = 0;

            foreach (var style in DiagramStyleAddonType.Instance.CommonSpace.GetFilteredAddons(RegisterItemUsage.DirectUse))
            {
                if (style.Name == XmlTool.GetRegisterType(m_diagram.Style))
                {
                    index = cbxStyle.Items.Count;
                }
                cbxStyle.Items.Add(style);
            }
            cbxStyle.SelectedIndex = index;

            m_conn            = conn;
            m_diagram.Dialect = m_conn.Dialect;
            if (m_conn != null)
            {
                m_conn.Connection.Owner = this;
                m_conn.Connection.BeginOpen(Async.CreateInvokeCallback(m_invoker, OpenedConnection));
            }

            //btnDev.Visible = VersionInfo.IsDevVersion;

            //if (m_diagram.Tables.Count == 0)
            //{
            //    btnEditTables.Checked = true;
            //    btnEditTables_Click(this, EventArgs.Empty);
            //}
            labDragAndDrop.Visible        = m_diagram.Tables.Count == 0;
            cbxZoom.Text                  = "100 %";
            propertyFrame1.SelectedObject = m_diagram.Style;
            //cbxZoom.SelectedIndex = cbxZoom.Items.IndexOf("100 %");
            ShowCurrentEntityStyle();
            m_diagram.Style.Changed += Style_Changed;
            m_created = true;
        }