Exemplo n.º 1
0
        public FormCubeLayerVisualiser( Control.ControlCollection parentControl, Point location, guiOptions p_GuiOptions, MainForm mainForm )
        {
            int i = 0;
            this.location = location;
            this.GuiOptions = p_GuiOptions;
            this.dataPanel = new System.Windows.Forms.Panel();
            this.dataPanel.Location = location;
            this.dataPanel.Name = "panel1";
            this.dataPanel.Size = new System.Drawing.Size(320, 320);
            parentControl.Add(dataPanel);
            layerData = new PictureBox[100];
            this.parentForm = mainForm;

            for (i = 0; i < 100; i++)
            {
                this.layerData[i] = new PictureBox();
                this.layerData[i].Image = global::FadeCube.Properties.Resources.led_0;
                this.layerData[i].Location = new Point((i % 10) * 32, (i / 10) * 32);
                this.layerData[i].Name = "layerData" + i.ToString();
                this.layerData[i].Size = new System.Drawing.Size(32, 32);
                this.layerData[i].TabIndex = 0;
                this.layerData[i].TabStop = false;
                this.layerData[i].SendToBack();
                this.layerData[i].Click += new System.EventHandler(layerData_Click);
                dataPanel.Controls.Add(layerData[i]);
            }
        }
Exemplo n.º 2
0
 public static void fillLayerInAnimation(CubeAnimationData animation, int framenumber, guiOptions options)
 {
     for (int i = 0; i < 100; i++)
     {
         switch (options.selectedOrientation)
         {
             case 0:
                 animation.Frames[framenumber].FrameData[((i / 10) * 100) + (options.selectedLayer * 10) + (i % 10)] = (byte)options.selectedBrightness;
                 break;
             case 1:
                 animation.Frames[framenumber].FrameData[((i / 10) * 100) + (i % 10) * 10 + options.selectedLayer] = (byte)options.selectedBrightness;
                 break;
             case 2:
                 animation.Frames[framenumber].FrameData[(100 * options.selectedLayer) + i] = (byte)options.selectedBrightness;
                 break;
         }
     }
 }
 public AnimationOptionsForm( guiOptions GuiOptions, CubeAnimationGlobalOptions animationOptions)
 {
     this.GuiOptions = GuiOptions;
     this.animationOptions = animationOptions;
     InitializeComponent();
 }
Exemplo n.º 4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            GuiOptions = guiOptionsHandler.loadOptions();

            if ((GuiOptions.animationPath is string) && (GuiOptions.animationPath != ""))
            {
                if (!loadAnimation(GuiOptions.animationPath))
                {
                    newAnimation();
                }
            }
            else
            {
                newAnimation();
            }
            refreshFrameListDS();
            layerVisulaiser = new FormCubeLayerVisualiser(layerDataGroupBox.Controls, layerDataLocation, GuiOptions, this);

            //ugly part, at startup, the layerVisualiser object does not exists, so event can not assigned in designer
            //but is assigned here, thing has to be made as well here (update textboxes, etc)
            frameList.SelectedIndexChanged += new EventHandler(frameList_SelectedIndexChanged);
            layerVisulaiser.actualFrameData = Animation.Frames[0].FrameData;
            frameNameTextBox.Text = Animation.Frames[frameList.SelectedIndex].FrameName;

            refreshFrameListDS();

            btnMoveUp.Enabled = false;
            switch (GuiOptions.selectedBrightness)
            {
                case 0: brightnessRadio0.Checked = true;
                    break;
                case 1: brightnessRadio1.Checked = true;
                    break;
                case 2: brightnessRadio2.Checked = true;
                    break;
                case 3: brightnessRadio3.Checked = true;
                    break;
            }
            switch (GuiOptions.selectedOrientation)
            {
                case 0: orientationRadioX.Checked = true;
                    break;
                case 1: orientationRadioY.Checked = true;
                    break;
                case 2: orientationRadioZ.Checked = true;
                    break;
            }
            layerSelectorTrackBar.Value = GuiOptions.selectedLayer;
        }
Exemplo n.º 5
0
 public AnimationWithGuiOptions(CubeAnimationData AnimationData, guiOptions GuiOptions)
 {
     this.AnimationData = AnimationData;
     this.GuiOptions = GuiOptions;
 }
Exemplo n.º 6
0
        public static void saveOptions(guiOptions options)
        {
            guiOptionsFile optionsFile = new guiOptionsFile();
            optionsFile.useEP1 = options.useEP1;
            optionsFile.useEP2 = options.useEP2;
            optionsFile.selectedBrightness = options.selectedBrightness;
            optionsFile.selectedLayer = options.selectedLayer;
            optionsFile.selectedOrientation = options.selectedOrientation;
            optionsFile.animationPath = options.animationPath;
            try
            {
                optionsFile.ip1 = options.endPoint1.Address.ToString();
                optionsFile.port1 = options.endPoint1.Port;
            }
            catch { }
            try
            {
               optionsFile.ip2 = options.endPoint2.Address.ToString();
               optionsFile.port2 = options.endPoint2.Port;
            }
            catch { }

            StreamWriter sw = File.CreateText(Application.StartupPath + "/fadecube_config.xml");
            XmlSerializer serializer = new XmlSerializer(typeof(guiOptionsFile));
            serializer.Serialize(sw, optionsFile);
            sw.Close();
        }
Exemplo n.º 7
0
 public static guiOptions loadOptions()
 {
     guiOptions options = new guiOptions();
     guiOptionsFile optionsFile;
     try
     {
         IPAddress ipa;
         StreamReader sr = File.OpenText(Application.StartupPath + "/fadecube_config.xml");
         XmlSerializer serializer = new XmlSerializer(typeof(guiOptionsFile));
         optionsFile = (guiOptionsFile)serializer.Deserialize(sr);
         sr.Close();
         options.useEP1 = optionsFile.useEP1;
         options.useEP2 = optionsFile.useEP2;
         options.selectedBrightness = optionsFile.selectedBrightness;
         options.selectedLayer = optionsFile.selectedLayer;
         options.selectedOrientation = optionsFile.selectedOrientation;
         options.animationPath = optionsFile.animationPath;
         try
         {
             ipa = IPAddress.Parse(optionsFile.ip1);
             options.endPoint1 = new IPEndPoint(ipa, optionsFile.port1);
         }
         catch
         { }
         try
         {
             ipa = IPAddress.Parse(optionsFile.ip2);
             options.endPoint2 = new IPEndPoint(ipa, optionsFile.port2);
         }
         catch
         { }
     }
     catch (FileNotFoundException)
     {
     }
     return options;
 }
Exemplo n.º 8
0
 public ConnectionsForm( guiOptions options )
 {
     this.GuiOptions = options;
     InitializeComponent();
 }