Inheritance: System.Windows.Forms.Form
Example #1
0
        private void smartCopyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SmartCopyForm form = null;
            if (selectedEntity is ReportModel)
            {
                form = new SmartCopyForm("Smart copy of " + ((ReportModel)selectedEntity).Name, selectedEntity, _report);
                form.ShowDialog();
            }
            else if (selectedEntity is ReportView)
            {
                form = new SmartCopyForm("Smart copy of " + ((ReportView)selectedEntity).Name, selectedEntity, _report);
                form.ShowDialog();
            }
            else if (selectedEntity is ReportTask)
            {
                form = new SmartCopyForm("Smart copy of " + ((ReportTask)selectedEntity).Name, selectedEntity, _report);
                form.ShowDialog();
            }
            else if (selectedEntity is ReportOutput)
            {
                form = new SmartCopyForm("Smart copy of " + ((ReportOutput)selectedEntity).Name, selectedEntity, _report);
                form.ShowDialog();
            }
            else if (selectedEntity is TasksFolder)
            {
                form = new SmartCopyForm("Smart copy of Tasks Script", selectedEntity, _report);
                form.ShowDialog();
            }

            if (form != null && form.IsReportModified)
            {
                CannotRenderAnymore();
                SetModified();
                init();
                var lastEntity = selectedEntity;
                mainTreeView.Sort();
                if (lastEntity != null) selectNode(lastEntity);
            }
        }
Example #2
0
        void highlightRestriction(bool isDragging)
        {
            //!! behaviour scintillina -> we have to convert the positions for UTF char...  :-(, waiting for a Scintillina expert !
            int startPos = convertToRealPosition(restrictionsTextBox.Caret.Position, restrictionsTextBox.RawText);
           //Debug.WriteLine("calc={0} caret={1} selstart={2} indentpos={3} linestart={4}", startPos, restrictionsTextBox.Caret.Position, restrictionsTextBox.Selection.Start, restrictionsTextBox.Lines.Current.IndentPosition, restrictionsTextBox.Lines.Current.StartPosition);
            int endPos = 0;
            var restriction = getRestriction(ref startPos, ref endPos, restrictionsTextBox.Text);
            if (!isDragging)
            {
                if (restriction != null)
                {
                    ModelPanel.SetMetaColumn(restriction);
                    restriction.InitEditor();
                }

                bool collapseCategories = (ModelPanel.RestrictionGrid.SelectedObject == null);
                ModelPanel.RestrictionGrid.SelectedObject = restriction;
                //Collapse Advanced categories
                if (collapseCategories && !collapseRestrictionCategoriesDone)
                {
                    collapseRestrictionCategoriesDone = true;
                    ModelPanel.CollapseCategories(ModelPanel.RestrictionGrid);
                }
            }
            if (restriction != null)
            {
                restrictionsTextBox.Selection.Start = convertToScintillaPosition(startPos, restrictionsTextBox.Text);
                restrictionsTextBox.Selection.End = convertToScintillaPosition(endPos, restrictionsTextBox.Text) + 1;
                restrictionsTextBox.Focus();

                MenuItem item = new MenuItem("Smart copy...");
                item.Click += new EventHandler(delegate(object sender2, EventArgs e2)
                {
                    SmartCopyForm form = new SmartCopyForm("Smart copy of " + restriction.DisplayNameEl, restriction, restriction.Model.Report);
                     form.ShowDialog();
                     if (form.IsReportModified)
                     {
                         ModelPanel.MainForm.IsModified = true;
                         ModelPanel.MainForm.CannotRenderAnymore();
                         ModelToRestrictionText();
                     }
                });

                restrictionsTextBox.ContextMenu = new System.Windows.Forms.ContextMenu();
                restrictionsTextBox.ContextMenu.MenuItems.Add(item);


            }
            else restrictionsTextBox.ContextMenu = null;
        }
Example #3
0
        void btn_MouseDown(object sender, MouseEventArgs e)
        {
            Button button = (Button)sender;

            //set property grid
            ElementGrid.PropertyValueChanged -= Grid_PropertyValueChanged;
            ReportElement element = null;
            if (button.Tag != null) element = button.Tag as ReportElement;
            if (element != null)
            {
                element.InitEditor();
                bool collapseCategories = (ElementGrid.SelectedObject == null);

                ElementGrid.SelectedObject = button.Tag;

                //Collapse Advanced categories
                if (collapseCategories && !collapseElementCategoriesDone)
                {
                    CollapseCategories(ElementGrid);
                    collapseElementCategoriesDone = true;
                }
            }

            ElementGrid.PropertyValueChanged += Grid_PropertyValueChanged;

            if (e != null)
            {
                DragDropEffects dde1 = DoDragDrop(sender, DragDropEffects.Move);
            }

            if (button.Parent != null)
            {
                SelectedButton = button;
                redrawButtons();
            }

            //select meta element in TreeView
            if (element != null) SetMetaColumn(elementTreeView.Nodes, element);

            if (e != null && e.Button == MouseButtons.Right)
            {
                ContextMenuStrip menu = new ContextMenuStrip();
                ToolStripMenuItem item = new ToolStripMenuItem("Remove");
                item.Click += new EventHandler(delegate(object sender2, EventArgs e2)
                {
                    removeElementFromPanel(button, false);
                });
                menu.Items.Add(item);

                item = new ToolStripMenuItem("Remove all elements");
                item.Click += new EventHandler(delegate(object sender2, EventArgs e2)
                {
                    removeElementFromPanel(button, true);
                });
                menu.Items.Add(item);

                item = new ToolStripMenuItem("Copy");
                item.Click += new EventHandler(delegate(object sender2, EventArgs e2)
                {
                    copyElementFromPanel(button);
                });
                menu.Items.Add(item);

                item = new ToolStripMenuItem("Prompt at run-time");
                item.Click += new EventHandler(delegate(object sender2, EventArgs e2)
                {
                    if (element.MetaColumn.IsAggregate == true) aggregateRestrictionsPanel.AddRestriction(element.MetaColumn, true);
                    else restrictionsPanel.AddRestriction(element.MetaColumn, true);
                });
                menu.Items.Add(item);

                menu.Items.Add(new ToolStripSeparator());
                item = new ToolStripMenuItem("Smart copy...");
                item.Click += new EventHandler(delegate(object sender2, EventArgs e2)
                {
                    SmartCopyForm form = new SmartCopyForm("Smart copy of " + element.DisplayNameEl, element, Model.Report);
                    form.ShowDialog();
                    if (form.IsReportModified)
                    {
                        MainForm.IsModified = true;
                        MainForm.CannotRenderAnymore();
                        ElementsToPanels();
                    }

                });
                menu.Items.Add(item);
                //Display context menu
                menu.Show(button, e.Location);
            }
        }