Exemple #1
0
        // Fresh constructor
        public EmoteSetVariableNode() : base(EmoteSetVariableNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecute      = new ExecutionConnectorViewModel();
            inputValue      = new ConnectorViewModel("Value", typeof(NodeDataNumeric));
            inputFrameCount = new ConnectorViewModel("FrameCount", typeof(NodeDataNumeric));
            inputEasing     = new ConnectorViewModel("Easing", typeof(NodeDataNumeric));

            this.InputExecutionConnectors.Add(conExecute);
            this.InputConnectors.Add(inputValue);
            this.InputConnectors.Add(inputFrameCount);
            this.InputConnectors.Add(inputEasing);

            // State Values
            value      = 0f;
            frameCount = 0.1f;
            easing     = 0.9f;
            varName    = string.Empty;

            // Create Dialog
            dlgEdit = new PropertyDialog();

            // Get Character Context
            charContext = CharacterContext.GetCharacterContext();
        }
Exemple #2
0
        /// <summary>
        ///     Handles the add track clicked event.
        /// </summary>
        private void HandleAddTrackClickedEvent()
        {
            //check preconditions
            if (Core.Model.Instance.Compilation == null) //no compilation
            {
                //nothing to add
                MessageBox.Show("There is no compilation to add tracks to. Create or load a compilation first.");
                return;
            }

            Track        newTrack     = new Track();
            DisplayTrack displayTrack = new DisplayTrack(newTrack);

            PropertyDialog propDialog = new PropertyDialog(displayTrack, "Enter track details");

            if (propDialog.ShowDialog() == DialogResult.OK)
            {
                //create initial cue
                newTrack.Cues.Add(
                    new Cue {
                    Description = "Intro (autogenerated)",
                    Shortcut    = "1",
                    Time        = 0
                });
                Core.Model.Instance.Compilation.Tracks.Add(newTrack);
                Core.Model.Instance.Compilation.IsDirty = true;
            }
            return;
        }
Exemple #3
0
        public void MouseDown(CommandProperty cp)
        {
            if (null != cp.Invoke)
            {
                cp.Invoke();
            }

            var form = Activator.CreateInstance(FormType);

            FormType.GetProperty(FormProperty).SetValue(form, cp.Data, null);

            var dlg = new PropertyDialog
            {
                DataContext = form,
                Title       = cp.LinkText,
                MinHeight   = 500
            };

            if (dlg.ShowDialog().Value)
            {
                if (null != cp.InvokeData)
                {
                    cp.InvokeData(form);
                }
            }
        }
Exemple #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addRootFromTypeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var settings = new NewRootSettings();

            using (HSDTypeDialog t = new HSDTypeDialog())
            {
                if (t.ShowDialog() == DialogResult.OK)
                {
                    using (PropertyDialog d = new PropertyDialog("New Root", settings))
                    {
                        if (d.ShowDialog() == DialogResult.OK)
                        {
                            var root = new HSDRootNode();

                            root.Name = settings.Symbol;
                            root.Data = (HSDAccessor)Activator.CreateInstance(t.HSDAccessorType);

                            RawHSDFile.Roots.Add(root);

                            RefreshTree();
                        }
                    }
                }
            }
        }
Exemple #5
0
        protected override bool GetOptions()
        {
            ExportOptions.Quality = Options.Current.GetValue("Export.Jpeg.Quality", 80);

            var dialog = new PropertyDialog(ExportOptions);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Options.Current.SetValue("Export.Jpeg.Quality", ExportOptions.Quality);
            }
            else
            {
                return(false);
            }

            return(base.GetOptions());

            /*JpegOptionsDialog dialog = new JpegOptionsDialog();
             * dialog.ImageQuality = ST.GetInt(_Options.Current.Customizations["export_jpeg_quality"], 85);
             * if (dialog.ShowDialog() == DialogResult.OK)
             * {
             *  Quality = dialog.ImageQuality;
             *  _Options.Current.Customizations["export_jpeg_quality"] = Quality.ToString();
             *  return base.GetOptions();
             * }
             * else
             * {
             *  return false;
             * }*/
        }
Exemple #6
0
        public XInputControllerAnalogNode() : base(XInputControllerAnalogNodeFactory.TYPESTRING)
        {
            // Prepare Execution Connection
            conExecuted = new ExecutionConnectorViewModel();
            conExecute  = new ExecutionConnectorViewModel();

            this.InputExecutionConnectors.Add(conExecuted);
            this.OutputExecutionConnectors.Add(conExecute);

            // Prepare Connections
            conLeftThumbX   = new ConnectorViewModel("LeftThumbX", typeof(NodeDataNumeric));
            conLeftThumbY   = new ConnectorViewModel("LeftThumbY", typeof(NodeDataNumeric));
            conLeftTrigger  = new ConnectorViewModel("LeftTrigger", typeof(NodeDataNumeric));
            conRightThumbX  = new ConnectorViewModel("RightThumbX", typeof(NodeDataNumeric));
            conRightThumbY  = new ConnectorViewModel("RightThumbY", typeof(NodeDataNumeric));
            conRightTrigger = new ConnectorViewModel("RightTrigger", typeof(NodeDataNumeric));
            //conButtons = new ConnectorViewModel("Buttons", typeof(NodeDataXInputButtons));

            this.OutputConnectors.Add(conLeftThumbX);
            this.OutputConnectors.Add(conLeftThumbY);
            this.OutputConnectors.Add(conLeftTrigger);
            this.OutputConnectors.Add(conRightThumbX);
            this.OutputConnectors.Add(conRightThumbY);
            this.OutputConnectors.Add(conRightTrigger);
            //this.OutputConnectors.Add(conButtons);

            // State Values
            currentUser = UserIndex.One;
            controller  = new SharpDX.XInput.Controller(currentUser);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #7
0
        public void MouseDown(CommandProperty cp)
        {
            if (null != cp.Invoke)
            {
                cp.Invoke();
            }

            var list = cp.Data as IList;

            if (null == list)
            {
                return;
            }

            var form = Activator.CreateInstance(ItemType);


            var dlg = new PropertyDialog
            {
                DataContext = form,
                Title       = cp.LinkText,
                MinHeight   = 500
            };

            if (dlg.ShowDialog().Value)
            {
                if (null != cp.InvokeData)
                {
                    cp.InvokeData(form);
                }

                list.Add(form);
            }
        }
Exemple #8
0
        public static void ExportFile(HSD_JOBJ rootJOBJ, Dictionary <int, string> boneLabels = null)
        {
            StringBuilder sup = new StringBuilder();

            AssimpContext importer = new AssimpContext();
            var           length   = importer.GetSupportedExportFormats().Length;
            var           index    = 0;

            foreach (var v in importer.GetSupportedExportFormats())
            {
                sup.Append($"{v.Description} (*.{v.FileExtension})|*.{v.FileExtension};");
                index++;
                if (index != length)
                {
                    sup.Append("|");
                }
            }

            var f = Tools.FileIO.SaveFile(sup.ToString());

            if (f != null)
            {
                var settings = new ModelExportSettings();
                using (PropertyDialog d = new PropertyDialog("Model Import Options", settings))
                {
                    if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        ExportFile(f, rootJOBJ, settings, boneLabels);
                    }
                }
            }
        }
Exemple #9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="toReplace"></param>
        public static void ReplaceModelFromFile(HSD_JOBJ toReplace)
        {
            var f = Tools.FileIO.OpenFile(IOManager.GetModelImportFileFilter());

            if (f != null)
            {
                var settings = new ModelImportSettings();
                using (PropertyDialog d = new PropertyDialog("Model Import Options", settings))
                {
                    if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        ImportSettings ioSettings = new ImportSettings()
                        {
                            FlipUVs          = settings.FlipUVs,
                            FlipWindingOrder = !settings.FlipFaces,
                            SmoothNormals    = settings.SmoothNormals,
                            Triangulate      = true,
                            //WeightLimit = true,
                        };

                        ModelImporter imp = new ModelImporter(f, settings, ioSettings);

                        using (ProgressBarDisplay pb = new ProgressBarDisplay(imp))
                        {
                            pb.DoWork();
                            pb.ShowDialog();
                        }

                        var newroot = imp.NewModel;

                        toReplace._s.SetFromStruct(newroot._s);
                    }
                }
            }
        }
Exemple #10
0
        /// <summary>
        ///     Handles the add cue clicked event.
        /// </summary>
        private void HandleAddCueClickedEvent()
        {
            //check preconditions
            if (
                (Core.Model.Instance.Compilation == null) || //no compilation
                (Core.Model.Instance.SelectedTrack == null)  //no selected track.
                )
            {
                //nothing to add
                MessageBox.Show(
                    "There is no track to add cues to. Create or load a compilation and create select a track first.");
                return;
            }

            Cue newCue = new Cue();
            //DisplayCue displayCue = new DisplayCue(String.Empty, newCue);

            PropertyDialog propDialog = new PropertyDialog(newCue, "Enter cue details");

            if (propDialog.ShowDialog() == DialogResult.OK)
            {
                //add cue
                Core.Model.Instance.SelectedTrack.Cues.Add(newCue);
                Core.Model.Instance.Compilation.IsDirty = true;
            }
            return;
        }
Exemple #11
0
        public ScaledRadialNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut) : base(ScaledRadialNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOutX  = new ConnectorViewModel("X", typeof(NodeDataNumeric), dataOut[0]);
            conOutY  = new ConnectorViewModel("Y", typeof(NodeDataNumeric), dataOut[1]);
            conInX   = new ConnectorViewModel("X", typeof(NodeDataNumeric), dataIn[0]);
            conInY   = new ConnectorViewModel("Y", typeof(NodeDataNumeric), dataIn[1]);
            conInMin = new ConnectorViewModel("Min", typeof(NodeDataNumeric), dataIn[2]);
            conInMax = new ConnectorViewModel("Max", typeof(NodeDataNumeric), dataIn[3]);

            this.OutputConnectors.Add(conOutX);
            this.OutputConnectors.Add(conOutY);
            this.InputConnectors.Add(conInX);
            this.InputConnectors.Add(conInY);
            this.InputConnectors.Add(conInMin);
            this.InputConnectors.Add(conInMax);

            // Set Name
            Name = (string)data["name"];

            // State Values
            Min = (int)data["min"];
            Max = (int)data["max"];

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
        public virtual void EditProperties()
        {
            StatusMessage = String.Empty;
            ErrorMessage  = String.Empty;

            try
            {
                StartProgressBar
                (
                    "Edit Properties...",
                    null,
                    _actionIconImages["Properties"],
                    true,
                    33
                );

                //Note:pass model, not settings, or changes will not trigger buliness logic in model properties
                PropertyDialog pv = new PropertyDialog(ModelController <TModel> .Model /*SettingsController<TSettings>.Settings*/, ModelController <TModel> .Model.Refresh);
                pv.Owner = System.Windows.Forms.Application.OpenForms[0];//App.Current.MainWindow;
                pv.ShowDialog();

                StopProgressBar("Edit Properties closed.");
            }
            catch (Exception ex)
            {
                Log.Write(ex, MethodBase.GetCurrentMethod(), EventLogEntryType.Error);

                StopProgressBar(null, String.Format("{0}", ex.Message));
            }
        }
Exemple #13
0
        protected override bool GetOptions()
        {
            ExportOptions.TransparentBackground = Options.Current.GetValue("Export.PNG.TransparentBackground", true);

            var dialog = new PropertyDialog(ExportOptions);

            dialog.Text = Lang._("Options");
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Options.Current.SetValue("Export.PNG.TransparentBackground", ExportOptions.TransparentBackground);
            }
            else
            {
                return(false);
            }

            return(base.GetOptions());

            //var dialog = new PngOptionsDialog();
            //dialog.TransparentBackground = ST.GetBoolDefault(_Options.Current.Customizations["export_png_transparent_background"]);
            //if (dialog.ShowDialog() == DialogResult.OK)
            //{
            //    _TransparentBackground = dialog.TransparentBackground;
            //    _Options.Current.Customizations["export_png_transparent_background"] = TransparentBackground.ToString();
            //    return base.GetOptions();
            //}
            //else
            //{
            //    return false;
            //}
        }
Exemple #14
0
 private async void LibraryProperties_Click(object sender, RoutedEventArgs e)
 {
     if (LibraryGrid.SelectedItem is LibraryFolder Library)
     {
         PropertyDialog Dialog = new PropertyDialog(Library.Folder);
         _ = await Dialog.ShowAsync().ConfigureAwait(true);
     }
 }
 private async void PropertyButton_Click(object sender, RoutedEventArgs e)
 {
     if (ListViewControl.SelectedItem is RecycleStorageItem Item)
     {
         PropertyDialog Dialog = new PropertyDialog(Item);
         await Dialog.ShowAsync().ConfigureAwait(false);
     }
 }
Exemple #16
0
 private async void Attribute_Click(object sender, RoutedEventArgs e)
 {
     if (SearchResultList.SelectedItem is FileSystemStorageItem Item)
     {
         PropertyDialog Dialog = new PropertyDialog(Item);
         _ = await Dialog.ShowAsync().ConfigureAwait(true);
     }
 }
Exemple #17
0
        private void EditObject_Click(object sender, RoutedEventArgs e)
        {
            var dlg = new PropertyDialog {
                DataContext = DataContext
            };

            dlg.ShowDialog();
        }
Exemple #18
0
 private async void LibraryProperties_Click(object sender, RoutedEventArgs e)
 {
     if (LibraryGrid.SelectedItem is LibraryFolder Library)
     {
         PropertyDialog Dialog = new PropertyDialog(FileSystemStorageItemBase.Open(Library.Folder.Path, ItemFilters.Folder));
         _ = await Dialog.ShowAsync().ConfigureAwait(true);
     }
 }
        public FighterDataContextMenu() : base()
        {
            MenuItem addFromFile = new MenuItem("Add Article Folder");

            addFromFile.Click += (sender, args) =>
            {
                if (MainForm.SelectedDataNode.Accessor is SBM_FighterData root)
                {
                    if (root.Articles == null)
                    {
                        root.Articles = new SBM_ArticlePointer();
                    }
                }
            };
            MenuItems.Add(addFromFile);

#if DEBUG
            MenuItem renameAnimSymbol = new MenuItem("Rename Anim Symbol");
            renameAnimSymbol.Click += (sender, args) =>
            {
                var rn = new RenameProperty();

                using (PropertyDialog d = new PropertyDialog("Rename Symbol", rn))
                {
                    bool inlcudeVictoryAnim = MessageBox.Show("Include Victory Anim Symbols?", "Victory Symbols", MessageBoxButtons.YesNoCancel) == DialogResult.Yes;

                    if (d.ShowDialog() == DialogResult.OK)
                    {
                        if (MainForm.SelectedDataNode.Accessor is SBM_FighterData root)
                        {
                            var sa = root.FighterCommandTable.Commands;
                            foreach (var s in sa)
                            {
                                if (s.SymbolName != null)
                                {
                                    s.SymbolName.Value = s.SymbolName.Value.Replace(rn.OldName, rn.NewName);
                                }
                            }

                            if (inlcudeVictoryAnim)
                            {
                                var vc = root.WinCommandTable.Commands;

                                foreach (var s in vc)
                                {
                                    if (s.SymbolName != null)
                                    {
                                        s.SymbolName.Value = s.SymbolName.Value.Replace(rn.OldName, rn.NewName);
                                    }
                                }
                            }
                        }
                    }
                }
            };
            MenuItems.Add(renameAnimSymbol);
#endif
        }
Exemple #20
0
        protected void ShowPropertyDetails(Property property)
        {
            currentProperty = property;
            propertyDialog  = new PropertyDialog(property);

            var screenTitle = "Property Details";

            _bindingContext = new LocalizableBindingContext(this, propertyDialog, screenTitle);
            detailsScreen   = new DialogViewController(_bindingContext.Root, true);

            ActivateController(detailsScreen);
        }
        public XInputControllerDigitalNode(JObject data, Guid[] executeIn, Guid[] executeOut, Guid[] dataIn, Guid[] dataOut) : base(XInputControllerDigitalNodeFactory.TYPESTRING)
        {
            // Prepare Execution Connection
            conExecuted = new ExecutionConnectorViewModel(executeIn[0]);
            conExecute  = new ExecutionConnectorViewModel(executeOut[0]);

            this.InputExecutionConnectors.Add(conExecuted);
            this.OutputExecutionConnectors.Add(conExecute);

            // Prepare Connections
            conDPadUp        = new ConnectorViewModel("DPadUp", typeof(NodeDataBoolean), dataOut[0]);
            conDPadDown      = new ConnectorViewModel("DPadDown", typeof(NodeDataBoolean), dataOut[1]);
            conDPadLeft      = new ConnectorViewModel("DPadLeft", typeof(NodeDataBoolean), dataOut[2]);
            conDPadRight     = new ConnectorViewModel("DPadRight", typeof(NodeDataBoolean), dataOut[3]);
            conStart         = new ConnectorViewModel("Start", typeof(NodeDataBoolean), dataOut[4]);
            conBack          = new ConnectorViewModel("Back", typeof(NodeDataBoolean), dataOut[5]);
            conLeftThumb     = new ConnectorViewModel("LeftThumb", typeof(NodeDataBoolean), dataOut[6]);
            conRightThumb    = new ConnectorViewModel("RightThumb", typeof(NodeDataBoolean), dataOut[7]);
            conLeftShoulder  = new ConnectorViewModel("LeftShoulder", typeof(NodeDataBoolean), dataOut[8]);
            conRightShoulder = new ConnectorViewModel("RightShoulder", typeof(NodeDataBoolean), dataOut[9]);
            conA             = new ConnectorViewModel("A", typeof(NodeDataBoolean), dataOut[10]);
            conB             = new ConnectorViewModel("B", typeof(NodeDataBoolean), dataOut[11]);
            conX             = new ConnectorViewModel("X", typeof(NodeDataBoolean), dataOut[12]);
            conY             = new ConnectorViewModel("Y", typeof(NodeDataBoolean), dataOut[13]);

            this.OutputConnectors.Add(conDPadUp);
            this.OutputConnectors.Add(conDPadDown);
            this.OutputConnectors.Add(conDPadLeft);
            this.OutputConnectors.Add(conDPadRight);
            this.OutputConnectors.Add(conStart);
            this.OutputConnectors.Add(conBack);
            this.OutputConnectors.Add(conLeftThumb);
            this.OutputConnectors.Add(conRightThumb);
            this.OutputConnectors.Add(conLeftShoulder);
            this.OutputConnectors.Add(conRightShoulder);
            this.OutputConnectors.Add(conA);
            this.OutputConnectors.Add(conB);
            this.OutputConnectors.Add(conX);
            this.OutputConnectors.Add(conY);

            // Set Name
            Name = (string)data["name"];

            // State Values
            if (!Enum.TryParse <UserIndex>((string)data["currentUser"], out currentUser))
            {
                currentUser = UserIndex.One;
            }
            controller = new SharpDX.XInput.Controller(currentUser);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #22
0
        private void Settings_Click(object sender, RoutedEventArgs e)
        {
            var d = new PropertyDialog
            {
                Icon        = Icon,
                DataContext = vm.Settings,
                Title       = "Application preferences",
                Topmost     = this.Topmost
            };

            d.ShowDialog();
            this.vm.OnSettingsChanged();
        }
Exemple #23
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void optimizeAllToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (PropertyDialog d = new PropertyDialog("Animation Optimize Settings", _settings))
     {
         if (d.ShowDialog() == DialogResult.OK)
         {
             foreach (JointNode node in jointTree.Nodes)
             {
                 node.Optimize(_settings);
             }
         }
     }
 }
Exemple #24
0
        public GetVariableNode() : base(GetVariableNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("Value", typeof(INodeData));

            this.OutputConnectors.Add(conOut);

            // State Values
            VarName = null;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #25
0
        //public override string Note { get { } }

        public XInputConstantsNode() : base(XInputConstantsNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conLeftThumbDeadZone  = new ConnectorViewModel("LeftThumbDeadZone", typeof(NodeDataNumeric));
            conRightThumbDeadZone = new ConnectorViewModel("RightThumbDeadZone", typeof(NodeDataNumeric));
            conTriggerThreshold   = new ConnectorViewModel("TriggerThreshold", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conLeftThumbDeadZone);
            this.OutputConnectors.Add(conRightThumbDeadZone);
            this.OutputConnectors.Add(conTriggerThreshold);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #26
0
        public MathNumericConstantNode() : base(MathNumericConstantNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut = new ConnectorViewModel("Value", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conOut);

            // State Values
            CastToType = CastType.Double;
            Value      = 0d;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #27
0
 /// <summary>
 ///     Handles the edit compilation clicked event.
 /// </summary>
 private void HandleEditCompilationClickedEvent()
 {
     if (Core.Model.Instance.Compilation != null) //there is any?
     {
         //create visual copy
         DisplayCompilation displayCompilation = new DisplayCompilation(Core.Model.Instance.Compilation);
         using (PropertyDialog propertyDialog = new PropertyDialog(displayCompilation, "Edit compilation")) {
             if (propertyDialog.ShowDialog() == DialogResult.OK)
             {
                 Core.Model.Instance.Compilation.Title   = displayCompilation.Title; //use the changed data
                 Core.Model.Instance.Compilation.IsDirty = true;
             }
         }
     }
 }
Exemple #28
0
 /// <summary>
 ///     Handles the ui settings clicked event.
 /// </summary>
 private void HandleUiSettingsClickedEvent()
 {
     Settings.Default.Save(); //save any previous changes, to be sure the most current settings are persisted.
     using (PropertyDialog dlg = new PropertyDialog(new DisplayableUiSettings(Settings.Default), "UI Settings")) {
         DialogResult result = dlg.ShowDialog();
         if (result.Equals(DialogResult.OK)) //confirmed?
         {
             Settings.Default.Save();        //save what was changed
         }
         else //not confirmed
         {
             Settings.Default.Reload(); //restore back
         }
     }
 }
Exemple #29
0
        //public override string Note { get { } }

        public MathSumNode() : base(MathSumNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conOut   = new ConnectorViewModel("Sum", typeof(NodeDataNumeric));
            conInput = new ConnectorViewModel("Multi-Input", typeof(NodeDataNumeric));

            this.OutputConnectors.Add(conOut);
            this.InputConnectors.Add(conInput);

            // State Values
            CastToType = CastType.Double;

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
Exemple #30
0
        public IntervalTriggerNode() : base(IntervalTriggerNodeFactory.TYPESTRING)
        {
            // Prepare Connections
            conExecute = new ExecutionConnectorViewModel();
            this.OutputExecutionConnectors.Add(conExecute);

            //diposeInterlock = new Semaphore(0, 1);

            // State Value
            this.period = 100;
            worker      = new Thread(DoWork);

            // Create Dialog
            dlgEdit = new PropertyDialog();
        }
		private void menuDataSets_Click(object sender, System.EventArgs e)
		{
			MDIChild mc = this.ActiveMdiChild as MDIChild;
			if (mc == null || mc.DrawCtl == null || mc.ReportDocument == null)
				return;

			MenuItem menu = sender as MenuItem;
			if (menu == null)
				return;
			mc.Editor.StartUndoGroup("DataSet Dialog");

			string dsname = menu.Text;

			// Find the dataset we need
            List<XmlNode> ds = new List<XmlNode>();
			DesignXmlDraw draw = mc.DrawCtl;
			XmlNode rNode = draw.GetReportNode();
			XmlNode dsNode = draw.GetCreateNamedChildNode(rNode, "DataSets");
			XmlNode dataset=null;
			
			// find the requested dataset: the menu text equals the name of the dataset
			int dsCount=0;		// count of the datasets
			string onlyOneDsname=null;
			foreach (XmlNode dNode in dsNode)
			{	
				if (dNode.Name != "DataSet")
					continue;
				XmlAttribute nAttr = dNode.Attributes["Name"];
				if (nAttr == null)	// shouldn't really happen
					continue;
				if (dsCount == 0)
					onlyOneDsname = nAttr.Value;		// we keep track of 1st name; 

				dsCount++;
				if (nAttr.Value == dsname)
					dataset = dNode;
			}

			bool bNew = false;
			if (dataset == null)	// This must be the new menu item
			{
				dataset = draw.CreateElement(dsNode, "DataSet", null);	// create empty node
				bNew = true;
			}
			ds.Add(dataset);

            using (PropertyDialog pd = new PropertyDialog(mc.DrawCtl, ds, PropertyTypeEnum.DataSets))
            {
                DialogResult dr = pd.ShowDialog();
                if (pd.Changed || dr == DialogResult.OK)
                {
                    if (dsCount == 1)
                    // if we used to just have one DataSet we may need to fix up DataRegions 
                    //	that were defaulting to that name
                    {
                        dsCount = 0;
                        bool bUseName = false;
                        foreach (XmlNode dNode in dsNode)
                        {
                            if (dNode.Name != "DataSet")
                                continue;
                            XmlAttribute nAttr = dNode.Attributes["Name"];
                            if (nAttr == null)	// shouldn't really happen
                                continue;

                            dsCount++;
                            if (onlyOneDsname == nAttr.Value)
                                bUseName = true;
                        }
                        if (bUseName && dsCount > 1)
                        {
                            foreach (XmlNode drNode in draw.ReportNames.ReportItems)
                            {
                                switch (drNode.Name)
                                {
                                    // If a DataRegion doesn't have a dataset name specified use previous one
                                    case "Table":
                                    case "List":
                                    case "Matrix":
                                    case "Chart":
                                        XmlNode aNode = draw.GetNamedChildNode(drNode, "DataSetName");
                                        if (aNode == null)
                                            draw.CreateElement(drNode, "DataSetName", onlyOneDsname);
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }
                    }
                    mc.Modified = true;
                }
                else if (bNew)	// if canceled and new DataSet get rid of temp node
                {
                    dsNode.RemoveChild(dataset);
                }
                if (pd.Delete)	// user must have hit a delete button for this to get set
                    dsNode.RemoveChild(dataset);

                if (!dsNode.HasChildNodes)		// If no dataset exists we remove DataSets
                    draw.RemoveElement(rNode, "DataSets");

                mc.Editor.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
            }
		}
        public override object EditValue(ITypeDescriptorContext context,
                                        IServiceProvider provider,
                                        object value)
        {

            if ((context == null) || (provider == null))
                return base.EditValue(context, provider, value);

            // Access the Property Browser's UI display service
            IWindowsFormsEditorService editorService =
                (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (editorService == null)
                return base.EditValue(context, provider, value);

            // Create an instance of the UI editor form
            IReportItem iri = context.Instance as IReportItem;
            if (iri == null)
                return base.EditValue(context, provider, value);
            PropertyReportItem pri = iri.GetPRI();

            PropertyTable pt = value as PropertyTable;
            if (pt == null)
                return base.EditValue(context, provider, value);

            //SingleCtlDialog scd = new SingleCtlDialog(pri.DesignCtl, pri.Draw, pri.Nodes, SingleCtlTypeEnum.BorderCtl, pb.Names);
            DesignCtl dc = pri.DesignCtl;
            DesignXmlDraw dp = dc.DrawCtl;
            if (dp.SelectedCount != 1)
                return base.EditValue(context, provider, value); 
            XmlNode riNode = dp.SelectedList[0];
            XmlNode table = dp.GetTableFromReportItem(riNode);
            if (table == null)
                return base.EditValue(context, provider, value);
            XmlNode tc = dp.GetTableColumn(riNode);
            XmlNode tr = dp.GetTableRow(riNode);

            List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
            ar.Add(table);
            dc.UndoObject.StartUndoGroup("Table Dialog");
            using (PropertyDialog pd = new PropertyDialog(dp, ar, PropertyTypeEnum.ReportItems, tc, tr))
            {
                // Display the UI editor dialog
                DialogResult dr = editorService.ShowDialog(pd);
                dc.UndoObject.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    dp.Invalidate();
                    return new PropertyTable(dp, dc, pt.Nodes);
                }

                return base.EditValue(context, provider, value);
            }
        }
		private void bGroups_Click(object sender, System.EventArgs e)
		{
			PropertyDialog pd = new PropertyDialog(_Draw, _ReportItems, PropertyTypeEnum.Grouping);
            try
            {
                DialogResult dr = pd.ShowDialog();
                if (pd.Changed || dr == DialogResult.OK)
                {
                    //_DrawPanel.Invalidate();   TODO need to force change somehow?????
                }
            }
            finally
            {
                pd.Dispose();
            }
		}
Exemple #34
0
        /// <summary>
        /// Event when Settings menu is clicked.
        /// </summary>
        /// <param name="sender">MenuItem</param>
        /// <param name="e">EventArgs</param>
        private void SettingsMenuClick(object sender, EventArgs e)
        {
            PropertyDialog dialog = new PropertyDialog(m_env.PluginManager.GetPropertySettings());
            using (dialog)
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                    return;

                dialog.ApplyChanges();
            }
        }
		private void DoPropertyDialog(PropertyTypeEnum type)
		{
			this.StartUndoGroup("Dialog");
			PropertyDialog pd = new PropertyDialog(_DrawPanel, _DrawPanel.SelectedList, type);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                this.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
            }
            finally
            {
                pd.Dispose();
            }
			SetFocus();
		}
		private void menuTableProperties_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			XmlNode riNode = _DrawPanel.SelectedList[0];
			XmlNode table = _DrawPanel.GetTableFromReportItem(riNode);
			if (table == null)
				return;
			XmlNode tc = _DrawPanel.GetTableColumn(riNode);
			XmlNode tr = _DrawPanel.GetTableRow(riNode);

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(table);
			_Undo.StartUndoGroup("Table Dialog");
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems, tc, tr);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                _Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
            }
            finally
            {
                pd.Dispose();
            }
		}
		private void menuTableInsertGroup_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			XmlNode cNode = _DrawPanel.SelectedList[0];
			_Undo.StartUndoGroup("Insert Table Group");
			XmlNode tblGroup = _DrawPanel.InsertTableGroup(cNode);
			if (tblGroup == null)
			{
				_Undo.EndUndoGroup(false);
				return;
			}

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(tblGroup);
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    _Undo.EndUndoGroup(true);
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
                else
                {
                    _DrawPanel.DeleteTableGroup(tblGroup);
                    _Undo.EndUndoGroup(false);
                }
            }
            finally
            {
                pd.Dispose();
            }
		}
		private void menuTableEditGroup_Click(object sender, EventArgs e)
		{
			if (_DrawPanel.SelectedCount != 1)
				return;
			MenuItem menu = sender as MenuItem;
			if (menu == null)
				return;
			string gname = menu.Text;
			XmlNode cNode = _DrawPanel.SelectedList[0];

			_Undo.StartUndoGroup("Dialog Table Group Edit");
			XmlNode tblGroup = _DrawPanel.GetTableGroup(cNode, gname);

			List<XmlNode> ar = new List<XmlNode>();		// need to put this is a list for dialog to handle
			ar.Add(tblGroup);
			PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.Grouping);
            try
            {
                DialogResult dr = pd.ShowDialog(this);
                _Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK);
                if (pd.Changed || dr == DialogResult.OK)
                {
                    ReportChanged(this, new EventArgs());
                    _DrawPanel.Invalidate();
                }
            }
            finally
            {
                pd.Dispose();
            }
		}