Ejemplo n.º 1
0
        public DialogPin(Pin pin)
        {
            this.DataContext = this;
            this.pin         = pin;
            this.InitializeComponent();
            switch (this.pin.PinType)
            {
            case PinType.None:
                this.type.Text = Properties.Resources.PinTypeNameNone;
                break;

            case PinType.Input:
                this.type.Text = Properties.Resources.PinTypeNameInput;
                break;

            case PinType.Output:
                this.type.Text = Properties.Resources.PinTypeNameOutput;
                break;

            default:
                Tracer.Fail("Unknown pin type");
                break;
            }
            this.name.Text             = this.pin.Name;
            this.notation.Text         = this.pin.JamNotation;
            this.note.Text             = this.pin.Note;
            this.side.ItemsSource      = PinDescriptor.PinSideRange;
            this.side.SelectedItem     = PinDescriptor.PinSideDescriptor(this.pin.PinSide);
            this.inverted.IsChecked    = this.pin.Inverted;
            this.bitWidth.ItemsSource  = PinDescriptor.BitWidthRange;
            this.bitWidth.SelectedItem = this.pin.BitWidth;
        }
Ejemplo n.º 2
0
 public PinDescriptor(CircuitProject circuitProject, PinType pinType) : base(
         circuitProject.PinSet.Create(circuitProject.ProjectSet.Project.LogicalCircuit, pinType, 1)
         )
 {
     this.BitWidth     = 1;
     this.PinSide      = PinDescriptor.PinSideDescriptor((pinType == PinType.Input) ? LogicCircuit.PinSide.Left : LogicCircuit.PinSide.Right);
     this.Circuit.Note = Properties.Resources.ToolTipDescriptorPin;
 }
Ejemplo n.º 3
0
 public SensorDescriptor(CircuitProject circuitProject) : base(circuitProject.SensorSet.Create(LogicCircuit.SensorType.Random, 1, LogicCircuit.PinSide.Right, string.Empty))
 {
     this.sensorType   = SensorDescriptor.sensorTypes.First(t => t.Value == this.Circuit.SensorType);
     this.BitWidth     = this.Circuit.BitWidth;
     this.pinSide      = PinDescriptor.PinSideDescriptor(this.Circuit.PinSide);
     this.Notation     = string.Empty;
     this.Circuit.Note = Properties.Resources.ToolTipDescriptorSensor;
 }
Ejemplo n.º 4
0
        public DialogSensor(Sensor sensor)
        {
            this.sensor = sensor;

            this.SensorTypes = SensorDescriptor.SensorTypes;
            SensorType type = this.sensor.SensorType;

            this.IsLoop = (type != SensorType.Series);
            if (type == SensorType.Loop)
            {
                type = SensorType.Series;
            }
            this.SelectedSensorType = this.SensorTypes.First(t => t.Value == type);

            this.SeriesData = (type == SensorType.Series) ? this.sensor.Data : Sensor.DefaultSeriesData;

            int min = Sensor.DefaultRandomMinInterval;
            int max = Sensor.DefaultRandomMaxInterval;

            if (type == SensorType.Random)
            {
                SensorPoint point;
                if (Sensor.TryParsePoint(this.sensor.Data, 32, out point))
                {
                    min = point.Tick;
                    max = point.Value;
                }
            }
            this.RandomMin = min.ToString(Properties.Resources.Culture);
            this.RandomMax = max.ToString(Properties.Resources.Culture);

            if (type == SensorType.Manual)
            {
                string text = this.sensor.Data;
                int    value;
                if (string.IsNullOrEmpty(text) || !int.TryParse(text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out value))
                {
                    value = 0;
                }
                this.ManualInitialValue = Constant.Normalize(value, this.sensor.BitWidth).ToString("X", CultureInfo.InvariantCulture);
            }
            else
            {
                this.ManualInitialValue = "0";
            }

            this.DataContext = this;
            this.InitializeComponent();

            this.bitWidth.ItemsSource  = PinDescriptor.BitWidthRange;
            this.bitWidth.SelectedItem = this.sensor.BitWidth;
            this.side.ItemsSource      = PinDescriptor.PinSideRange;
            this.side.SelectedItem     = PinDescriptor.PinSideDescriptor(this.sensor.PinSide);
            this.notation.Text         = this.sensor.Notation;
            this.note.Text             = this.sensor.Note;
        }
Ejemplo n.º 5
0
        public DialogButton(CircuitButton button)
        {
            this.button      = button;
            this.DataContext = this;
            this.InitializeComponent();

            this.name.Text          = this.button.Notation;
            this.isToggle.IsChecked = this.button.IsToggle;
            this.side.SelectedItem  = PinDescriptor.PinSideDescriptor(this.button.PinSide);
            this.note.Text          = this.button.Note;
        }
Ejemplo n.º 6
0
        public DialogSound(Sound sound)
        {
            this.sound       = sound;
            this.DataContext = this;
            this.InitializeComponent();

            this.side.ItemsSource  = PinDescriptor.PinSideRange;
            this.side.SelectedItem = PinDescriptor.PinSideDescriptor(this.sound.PinSide);
            this.notation.Text     = this.sound.Notation;
            this.note.Text         = this.sound.Note;
        }
 public DialogConstant(Constant constant)
 {
     this.DataContext = this;
     this.constant    = constant;
     this.InitializeComponent();
     this.value.Text            = constant.ConstantValue.ToString("X", CultureInfo.InvariantCulture);
     this.bitWidth.ItemsSource  = PinDescriptor.BitWidthRange;
     this.bitWidth.SelectedItem = this.constant.BitWidth;
     this.side.SelectedItem     = PinDescriptor.PinSideDescriptor(this.constant.PinSide);
     this.note.Text             = constant.Note;
 }
Ejemplo n.º 8
0
        public SplitterDescriptor(CircuitProject circuitProject) : base(circuitProject.SplitterSet.Create(3, 3, true))
        {
            this.PinCountRange  = PinDescriptor.NumberRange(2, BasePin.MaxBitWidth);
            this.BitWidthRange  = PinDescriptor.NumberRange(1, BasePin.MaxBitWidth / 2);
            this.DirectionRange = new DirectionDescriptor[] {
                new DirectionDescriptor(true, Properties.Resources.SplitterDirectionClockwise, 1),
                new DirectionDescriptor(false, Properties.Resources.SplitterDirectionCounterclockwise, -1)
            };

            this.PinCount     = 3;
            this.BitWidth     = 1;
            this.Direction    = this.DirectionRange.First();
            this.Circuit.Note = Properties.Resources.ToolTipDescriptorSplitter;
        }
        public DialogLedMatrix(LedMatrix ledMatrix)
        {
            this.LedMatrix  = ledMatrix;
            this.MatrixType = LedMatrixDescriptor.LedMatrixTypeDescriptor(this.LedMatrix.MatrixType);
            this.CellShape  = (int)this.LedMatrix.CellShape;
            this.Rows       = this.LedMatrix.Rows;
            this.Columns    = this.LedMatrix.Columns;
            this.ColorRange = PinDescriptor.NumberRange(LedMatrix.MinBitsPerLed, LedMatrix.MaxBitsPerLed);
            this.Colors     = ledMatrix.Colors;
            this.Note       = this.LedMatrix.Note;

            this.DataContext = this;
            this.InitializeComponent();
        }
 public DialogOptions(Mainframe mainframe)
 {
     this.mainframe            = mainframe;
     this.RecentFileRange      = PinDescriptor.NumberRange(1, 24);
     this.CurrentCulture       = App.CurrentCulture;
     this.AutoSaveIntervalList = PinDescriptor.NumberRange(1, 15);
     this.AutoSaveInterval     = Math.Max(1, Math.Min((this.mainframe.AutoSaveInterval != 0) ? this.mainframe.AutoSaveInterval / 60 : 5, 15));
     this.DataContext          = this;
     this.InitializeComponent();
     this.loadLastFile.IsChecked      = Settings.User.LoadLastFileOnStartup;
     this.autoSave.IsChecked          = this.mainframe.AutoSaveInterval != 0;
     this.showGrid.IsChecked          = this.mainframe.ShowGrid;
     this.gateShape.SelectedItem      = this.GateShapeList.First(d => d.Value == Settings.User.GateShape);
     this.maxRecentFiles.SelectedItem = Settings.User.MaxRecentFileCount;
 }
        public DialogButton(CircuitButton button)
        {
            this.button      = button;
            this.DataContext = this;
            this.InitializeComponent();

            this.name.Text               = this.button.Notation;
            this.isToggle.IsChecked      = this.button.IsToggle;
            this.side.SelectedItem       = PinDescriptor.PinSideDescriptor(this.button.PinSide);
            this.inverted.IsChecked      = this.button.Inverted;
            this.keyGesture.Key          = button.Key;
            this.keyGesture.ModifierKeys = button.ModifierKeys;
            this.keyGesture.Refresh();
            this.note.Text = this.button.Note;
        }
Ejemplo n.º 12
0
 public static int[] AddressBitRange()
 {
     return(PinDescriptor.NumberRange(1, Memory.MaxAddressBitWidth));
 }
Ejemplo n.º 13
0
 public static int[] NumberRange(int minBitWidth)
 {
     return(PinDescriptor.NumberRange(minBitWidth, BasePin.MaxBitWidth));
 }
Ejemplo n.º 14
0
 public SoundDescriptor(CircuitProject circuitProject) : base(circuitProject.SoundSet.Create(LogicCircuit.PinSide.Left, string.Empty))
 {
     this.pinSide  = PinDescriptor.PinSideDescriptor(this.Circuit.PinSide);
     this.Notation = string.Empty;
 }
Ejemplo n.º 15
0
 public ConstantDescriptor(CircuitProject circuitProject) : base(circuitProject.ConstantSet.Create(1, 0, LogicCircuit.PinSide.Right))
 {
     this.BitWidth = 1;
     this.Value    = "0";
     this.pinSide  = PinDescriptor.PinSideDescriptor(LogicCircuit.PinSide.Right);
 }
Ejemplo n.º 16
0
 public ButtonDescriptor(CircuitProject circuitProject) : base(circuitProject.CircuitButtonSet.Create(string.Empty, false, LogicCircuit.PinSide.Right))
 {
     this.Notation = string.Empty;
     this.pinSide  = PinDescriptor.PinSideDescriptor(LogicCircuit.PinSide.Right);
 }