示例#1
0
        public void Update()
        {
            if (binding != null)
            {
                internalValue[0] = binding.GetMin();
                internalValue[1] = binding.GetMax();
            }

            if (Manager.NativeManager.DragFloat2(Label + id, internalValue))
            {
                if (EnableUndo)
                {
                    binding.SetMin(internalValue[0]);
                    binding.SetMax(internalValue[1]);
                }
                else
                {
                    Console.WriteLine("Not implemented.");
                }
            }
        }
示例#2
0
        public override void Update()
        {
            if (binding == null)
            {
                return;
            }

            if (binding != null)
            {
                if (binding.DrawnAs == Data.DrawnAs.CenterAndAmplitude)
                {
                    internalValue[0] = binding.GetCenter();
                    internalValue[1] = binding.GetAmplitude();
                }
                else
                {
                    internalValue[0] = binding.GetMin();
                    internalValue[1] = binding.GetMax();
                }
            }

            var txt_r1 = string.Empty;
            var txt_r2 = string.Empty;

            if (binding.DrawnAs == Data.DrawnAs.CenterAndAmplitude)
            {
                txt_r1 = Resources.GetString("Mean");
                txt_r2 = Resources.GetString("Deviation");
            }
            else
            {
                txt_r1 = Resources.GetString("Max");
                txt_r2 = Resources.GetString("Min");
            }

            if (Manager.NativeManager.DragFloat2EfkEx(id, internalValue, 1, float.MinValue, float.MaxValue, txt_r1 + ":" + "%.3f", txt_r2 + ":" + "%.3f"))
            {
                if (EnableUndo)
                {
                    if (binding.DrawnAs == Data.DrawnAs.CenterAndAmplitude)
                    {
                        binding.SetCenter(internalValue[0], isActive);
                        binding.SetAmplitude(internalValue[1], isActive);
                    }
                    else
                    {
                        binding.SetMin(internalValue[0], isActive);
                        binding.SetMax(internalValue[1], isActive);
                    }
                }
                else
                {
                    throw new Exception("Not Implemented.");
                }
            }

            var isActive_Current = Manager.NativeManager.IsItemActive();

            if (isActive && !isActive_Current)
            {
                FixValue();
            }

            isActive = isActive_Current;

            if (Manager.NativeManager.BeginPopupContextItem(id_c))
            {
                var txt_r_r1 = Resources.GetString("Gauss");
                var txt_r_r2 = Resources.GetString("Range");

                if (Manager.NativeManager.RadioButton(txt_r_r1 + id_r1, binding.DrawnAs == Data.DrawnAs.CenterAndAmplitude))
                {
                    binding.DrawnAs = Data.DrawnAs.CenterAndAmplitude;
                }

                Manager.NativeManager.SameLine();

                if (Manager.NativeManager.RadioButton(txt_r_r2 + id_r2, binding.DrawnAs == Data.DrawnAs.MaxAndMin))
                {
                    binding.DrawnAs = Data.DrawnAs.MaxAndMin;
                }

                Manager.NativeManager.EndPopup();
            }
        }
示例#3
0
        public override void Update()
        {
            isPopupShown = false;
            if (binding == null)
            {
                return;
            }

            valueChangingProp.Enable(binding);

            if (binding.DrawnAs == Data.DrawnAs.CenterAndAmplitude)
            {
                internalValue[0] = binding.GetCenter();
                internalValue[1] = binding.GetAmplitude();
            }
            else
            {
                internalValue[0] = binding.GetMin();
                internalValue[1] = binding.GetMax();
            }


            var txt_r1 = string.Empty;
            var txt_r2 = string.Empty;

            var range_1_min = float.MinValue;
            var range_1_max = float.MaxValue;
            var range_2_min = float.MinValue;
            var range_2_max = float.MaxValue;

            if (binding.DrawnAs == Data.DrawnAs.CenterAndAmplitude)
            {
                txt_r1 = Resources.GetString("Mean");
                txt_r2 = Resources.GetString("Deviation");

                range_1_min = binding.ValueMin;
                range_1_max = binding.ValueMax;
            }
            else
            {
                txt_r1 = Resources.GetString("Min");
                txt_r2 = Resources.GetString("Max");

                range_1_min = binding.ValueMin;
                range_1_max = binding.ValueMax;
                range_2_min = binding.ValueMin;
                range_2_max = binding.ValueMax;
            }

            if (Manager.NativeManager.DragFloat2EfkEx(id, internalValue, binding.Step / 10.0f,
                                                      range_1_min, range_1_max,
                                                      range_2_min, range_2_max,
                                                      txt_r1 + ":" + Core.Option.GetFloatFormat(), txt_r2 + ":" + Core.Option.GetFloatFormat()))
            {
                if (EnableUndo)
                {
                    if (binding.DrawnAs == Data.DrawnAs.CenterAndAmplitude)
                    {
                        binding.SetCenter(internalValue[0], isActive);
                        binding.SetAmplitude(internalValue[1], isActive);
                    }
                    else
                    {
                        binding.SetMin(internalValue[0], isActive);
                        binding.SetMax(internalValue[1], isActive);
                    }
                }
                else
                {
                    throw new Exception("Not Implemented.");
                }
            }

            Popup();

            if (binding.IsDynamicEquationEnabled)
            {
                DynamicSelector.SelectMaxInComponent(id_d1, binding.DynamicEquationMax);

                Popup();
            }

            if (binding.IsDynamicEquationEnabled)
            {
                DynamicSelector.SelectMinInComponent(id_d2, binding.DynamicEquationMin);

                Popup();
            }

            var isActive_Current = Manager.NativeManager.IsItemActive();

            if (isActive && !isActive_Current)
            {
                FixValue();
            }

            isActive = isActive_Current;

            Popup();

            valueChangingProp.Disable();
        }