Ejemplo n.º 1
0
        private void btnEaves_Click(object sender, EventArgs e)
        {
            //RGBchannel oef = (RGBchannel)seqSource.Members.Find("Strip 1 Pixel 150 [U2.448-450]", MemberType.RGBchannel, false);
            RGBchannel se = (RGBchannel)seqSource.Members.Find("Eave Pixel 001 / S1.170 / U2.508-510", MemberType.RGBchannel, false);
            RGBchannel me = (RGBchannel)seqMaster.Members.Find("Eave Pixel 001 / S1.170 / U2.508-510", MemberType.RGBchannel, false);

            int masIdx = me.Index;
            int srcIdx = se.Index;             // = oef.Index;



            for (int l = 0; l < 600; l++)
            {
                int mSI = seqMaster.RGBchannels[masIdx].SavedIndex;
                int sSI = seqSource.RGBchannels[srcIdx].SavedIndex;
                MapMembers(mSI, sSI, true, true);
                masIdx++;
                srcIdx++;
            }


            se = (RGBchannel)seqSource.Members.Find("Eave Pixel 172 / S2.002 / U3.004-006", MemberType.RGBchannel, false);
            RGBchannel mf = (RGBchannel)seqMaster.Members.Find("Fence Pixel 01-01 [U11.496-498]", MemberType.RGBchannel, false);

            srcIdx = se.Index;             // + 171;
            masIdx = mf.Index;
            for (int l = 0; l < 336; l++)
            {
                int mSI = seqMaster.RGBchannels[masIdx].SavedIndex;
                int sSI = seqSource.RGBchannels[srcIdx].SavedIndex;
                MapMembers(mSI, sSI, true, true);
                masIdx++;
                srcIdx++;
            }
        }
Ejemplo n.º 2
0
        }         // End Browse-Open

        void FixFile(string theFile)
        {
            seq       = new Sequence4(theFile);
            rgbChans1 = null;
            rgbChans2 = null;
            Array.Resize(ref rgbChans1, 301);
            Array.Resize(ref rgbChans2, 301);

            int ix = 0;

            // Select Everything
            for (int i = 0; i < seq.Tracks.Count; i++)
            {
                seq.Tracks[i].Selected = true;
            }
            for (int i = 0; i < seq.TimingGrids.Count; i++)
            {
                seq.TimingGrids[i].Selected = true;
            }
            for (int i = 0; i < seq.Channels.Count; i++)
            {
                seq.Channels[i].Selected = true;
            }
            for (int i = 0; i < seq.RGBchannels.Count; i++)
            {
                RGBchannel rgb = seq.RGBchannels[i];
                rgb.Selected = true;
                if (rgb.Name.Substring(0, 11).CompareTo("Tree Pixel ") == 0)
                {
                    int pxNo = int.Parse(rgb.Name.Substring(11, 3));
                    if (rgbChans1[pxNo] == null)
                    {
                        rgbChans1[pxNo] = rgb;
                    }
                    else
                    {
                        rgbChans2[pxNo]         = rgb;
                        rgb.Selected            = false;
                        rgb.redChannel.Selected = false;
                        rgb.grnChannel.Selected = false;
                        rgb.bluChannel.Selected = false;
                    }
                }
            }
            for (int i = 0; i < seq.ChannelGroups.Count; i++)
            {
                ChannelGroup cg = seq.ChannelGroups[i];
                cg.Selected = true;
                if (cg.Name.Length > 20)
                {
                    if (cg.Name.Substring(0, 18).CompareTo("Tree Pixels Column") == 0)
                    {
                        FixGroup(cg);
                    }
                }
            }
        }         // End FixFile
Ejemplo n.º 3
0
        private void MergeRGBchildren(RGBchannel sourceRGB, RGBchannel destRGB)
        {
            Channel destCh = MergeChannel(sourceRGB.redChannel, seqNew.Members);

            destRGB.redChannel = destCh;
            destCh             = MergeChannel(sourceRGB.grnChannel, seqNew.Members);
            destRGB.grnChannel = destCh;
            destCh             = MergeChannel(sourceRGB.bluChannel, seqNew.Members);
            destRGB.bluChannel = destCh;
        }
Ejemplo n.º 4
0
        private static TreeNodeAdv AddRGBchannel(Sequence4 seq, TreeNodeAdvCollection baseNodes, int RGBsi, List <TreeNodeAdv>[] siNodes, bool selectedOnly, bool includeRGBchildren)
        {
            TreeNodeAdv rgbNode = null;

            if (siNodes[RGBsi] != null)
            {
                RGBchannel theRGB   = (RGBchannel)seq.Members.bySavedIndex[RGBsi];
                string     nodeText = theRGB.Name;
                rgbNode = new TreeNodeAdv(nodeText);
                baseNodes.Add(rgbNode);
                //IMember nodeTag = theRGB;
                nodeIndex++;
                rgbNode.Tag = theRGB;
                rgbNode.LeftImageIndices = icodxRGBchannel;
                rgbNode.Checked          = theRGB.Selected;

                if (includeRGBchildren)
                {
                    // * * R E D   S U B  C H A N N E L * *
                    TreeNodeAdv colorNode = null;
                    int         ci        = theRGB.redChannel.SavedIndex;
                    nodeText  = theRGB.redChannel.Name;
                    colorNode = new TreeNodeAdv(nodeText);
                    nodeIndex++;
                    colorNode.Tag = theRGB.redChannel;
                    colorNode.LeftImageIndices = icodxRedChannel;
                    colorNode.Checked          = theRGB.redChannel.Selected;
                    siNodes[ci].Add(colorNode);
                    rgbNode.Nodes.Add(colorNode);

                    // * * G R E E N   S U B  C H A N N E L * *
                    ci        = theRGB.grnChannel.SavedIndex;
                    nodeText  = theRGB.grnChannel.Name;
                    colorNode = new TreeNodeAdv(nodeText);
                    nodeIndex++;
                    colorNode.Tag = theRGB.grnChannel;
                    colorNode.LeftImageIndices = icodxGrnChannel;
                    colorNode.Checked          = theRGB.grnChannel.Selected;
                    siNodes[ci].Add(colorNode);
                    rgbNode.Nodes.Add(colorNode);

                    // * * B L U E   S U B  C H A N N E L * *
                    ci        = theRGB.bluChannel.SavedIndex;
                    nodeText  = theRGB.bluChannel.Name;
                    colorNode = new TreeNodeAdv(nodeText);
                    nodeIndex++;
                    colorNode.Tag = theRGB.bluChannel;
                    colorNode.LeftImageIndices = icodxBluChannel;
                    colorNode.Checked          = theRGB.bluChannel.Selected;
                    siNodes[ci].Add(colorNode);
                    rgbNode.Nodes.Add(colorNode);
                }                 // end includeRGBchildren
            }
            return(rgbNode);
        }
Ejemplo n.º 5
0
		} // end void AddBatch();

		public ChannelGroup AddTreeRow(int row)
		{
			int pixID = batchStart;
			int groupMember = 1;
			int uch = 1;
			if (chIncr < 0) uch = batchCount * 3 - 2;
			int trkNum = Int16.Parse(txtTrack.Text) - 1;
			string theName = "";
			string pxName = "";
			string chName = "";
			string grName = "";
			int sxNo = 1;
			string sxName = "1S";
			int subNo = 1;

			grName = sectionName + "s Row " + (row+1).ToString("00");
			grName += " [U" + universeNum.ToString() + ".";
			if (optFenceReverse.Checked)
			{
				grName += (chanNum + 2).ToString("000") + "-" + (chanNum - pixelsPerRow * 3).ToString("000") + "]";
			}
			else
			{
				grName += chanNum.ToString("000") + "-" + (chanNum + pixelsPerRow * 3 + 2).ToString("000") + "]";
			}
			ChannelGroup thisGroup = seq.CreateChannelGroup(grName);

			for (int col = 7; col >= 0; col--)
			{
				for (int pix = 2; pix >= 0; pix--)
				{
					if (pixelNum < 301)
					{
						string pixName = "Tree Pixel " + pixelNum.ToString("000");
						pixName += " {R" + (row + 1).ToString("00");
						pixName += "C" + (col + 1).ToString("0");
						pixName += "P" + (pix + 1).ToString("0");
						pixName += FaceID(col);

						RGBchannel theRGBch = MakeRGBch(pixName, row, col, pix);
						thisGroup.AddItem(theRGBch);

						pixelNum ++;
						subNo++;
					} // End less than 301 pixels
				} // End pixels per column loop
			} // end columns per row loop

			return thisGroup;

		} // end void AddBatch();
Ejemplo n.º 6
0
		} // end void AddBatch();

		public ChannelGroup AddAirColumn(int c)
		{
			int pixID = batchStart;
			int groupMember = 1;
			int uch = 1;
			if (chIncr < 0) uch = batchCount * 3 - 2;
			int trkNum = Int16.Parse(txtTrack.Text) - 1;
			string theName = "";
			string pxName = "";
			string chName = "";
			string grName = "";

			grName = sectionName + " Column " + (c).ToString("0");
			grName += " [U" + universeNum.ToString() + ".";
			if (optFenceReverse.Checked)
			{
				grName += (chanNum - pixelsPerSect * 3 + 3).ToString("000") + "-" + (chanNum + 2).ToString("000") + "]";
			}
			else
			{
				grName += chanNum.ToString("000") + "-" + (chanNum + airRows * 3 + 2).ToString("000") + "]";
			}
			ChannelGroup thisGroup = seq.CreateChannelGroup(grName);

			for (int r = 0; r < airRows; r++)
			{
				pxName = sectionName + " " + (c).ToString("0");
				pxName += "," + (r).ToString("0");
				pxName += " #" + pixelNum.ToString("00");

				RGBchannel theRGBch = ShiprgbCh(pxName, c, r);
				thisGroup.AddItem(theRGBch);

			}

			return thisGroup;

		} // end void AddBatch();
Ejemplo n.º 7
0
		private void NextPixel()
		{
			// Create new RGB Channel
			RGBchannel rgbCh = seq.CreateRGBchannel(pixelName);

			string chName = MakeChannelName("R");
			Channel chan = seq.CreateChannel(chName);
			chan.color = utils.LORCOLOR_RED;
			chan.rgbChild = RGBchild.Red;
			rgbCh.redChannel = chan;
			chan.rgbParent = rgbCh;
			chan.output.deviceType = DeviceType.DMX;
			chan.output.universe = univ;
			chan.output.channel = chNum;
			IncrementDMXchannel(1);

			chName = MakeChannelName("G");
			chan = seq.CreateChannel(chName);
			chan.color = utils.LORCOLOR_GRN;
			chan.rgbChild = RGBchild.Green;
			rgbCh.grnChannel = chan;
			chan.rgbParent = rgbCh;
			chan.output.deviceType = DeviceType.DMX;
			chan.output.universe = univ;
			chan.output.channel = chNum;
			IncrementDMXchannel(1);

			chName = MakeChannelName("B");
			chan = seq.CreateChannel(chName);
			chan.color = utils.LORCOLOR_BLU;
			chan.rgbChild = RGBchild.Blue;
			rgbCh.bluChannel = chan;
			chan.rgbParent = rgbCh;
			chan.output.deviceType = DeviceType.DMX;
			chan.output.universe = univ;
			chan.output.channel = chNum;
			if (direction == 1)
			{
				IncrementDMXchannel(1);
			}
			else
			{
				IncrementDMXchannel(-5);
			}


			colGroups[col - 1].AddItem(rgbCh);
			rowGroups[row - 1].AddItem(rgbCh);

			lstPixelNames.Items.Add(pixelName);
			lstPixelNames.SelectedIndex = lstPixelNames.Items.Count - 1;


			// Update display for the NEXT pixel
			pixel++;
			px++;
			txtPixel.Text = pixel.ToString("000");
			txtPx.Text = px.ToString();
			txtUniv.Text = univ.ToString();
			txtCh.Text = chNum.ToString("000");
			pixelName = MakePixelName();
			lblPixelName.Text = pixelName;
			HighlightCol3(col);


			if (pixel == 301)
			{
				btnSave.Enabled = true;
				btnNextCol.Enabled = false;
				btnNextPixel.Enabled = false;
				SystemSounds.Asterisk.Play();
			}
			else
			{
				SystemSounds.Beep.Play();
			}


		}
Ejemplo n.º 8
0
        private void MergeMembers(Membership destMembers, Membership sourceMembers)
        {
            bool found = true;

            // May be called recursively
            //foreach (IMember sourceMember in sourceMembers) // foreach and enumerable not working, fix!
            for (int smi = 0; smi < sourceMembers.Count; smi++)
            {
                IMember sourceMember = sourceMembers[smi];
                if (sourceMember.MemberType == MemberType.Channel)
                {
                    Channel sourceCh = (Channel)sourceMember;
                    Channel destCh   = MergeChannel(sourceCh, destMembers);
                }

                if (sourceMember.MemberType == MemberType.RGBchannel)
                {
                    found = true;                     // reset to default
                    Channel    destCh    = null;      // placeholder
                    RGBchannel sourceRGB = (RGBchannel)sourceMember;
                    RGBchannel destRGB   = (RGBchannel)destMembers.Find(sourceRGB.Name, MemberType.RGBchannel, false);
                    if (destRGB == null)
                    {
                        found   = false;
                        destRGB = seqNew.CreateRGBchannel(sourceRGB.Name);
                        destMembers.Add(destRGB);

                        MergeRGBchildren(sourceRGB, destRGB);
                    }
                    else
                    {
                        if (duplicateNameAction == ACTIONuseSecond)
                        {
                            MergeRGBchildren(sourceRGB, destRGB);
                        }
                        if (duplicateNameAction == ACTIONkeepBoth)
                        {
                            destRGB = seqNew.CreateRGBchannel(sourceRGB.Name);
                            destMembers.Add(destRGB);

                            MergeRGBchildren(sourceRGB, destRGB);
                        }
                        if (duplicateNameAction == ACTIONaddNumber)
                        {
                            destRGB = seqNew.CreateRGBchannel(sourceRGB.Name + " (2)");
                            destMembers.Add(destRGB);

                            MergeRGBchildren(sourceRGB, destRGB);
                        }
                    }
                }

                if (sourceMember.MemberType == MemberType.ChannelGroup)
                {
                    ChannelGroup sourceGroup = (ChannelGroup)sourceMember;
                    ChannelGroup destGroup   = (ChannelGroup)destMembers.Find(sourceGroup.Name, MemberType.ChannelGroup, true);



                    // Should only happen once
                    if (destGroup.SavedIndex == 31)
                    {
                        System.Diagnostics.Debugger.Break();
                    }



                    //Recurse
                    MergeMembers(destGroup.Members, sourceGroup.Members);
                }
            }             // end loop thru 2nd Sequence's Track Items
        }
Ejemplo n.º 9
0
        private int ExchangeColors(RGBchannel rgbCh)
        {
            int    errState    = 0;
            Effect redEffect   = new Effect();
            Effect grnEffect   = new Effect();
            Effect bluEffect   = new Effect();
            int    redEffIdx   = 0;
            int    grnEffIdx   = 0;
            int    bluEffIdx   = 0;
            Color  curColor    = Color.Black;
            int    curLorColor = 0;

            //bool steady = false;

            redEffect.EffectType       = EffectType.Intensity;
            redEffect.startCentisecond = 0;
            redEffect.Intensity        = 0;
            redEffect.parent           = rgbCh.redChannel;

            grnEffect.EffectType       = EffectType.Intensity;
            grnEffect.startCentisecond = 0;
            grnEffect.Intensity        = 0;
            grnEffect.parent           = rgbCh.redChannel;

            bluEffect.EffectType       = EffectType.Intensity;
            bluEffect.startCentisecond = 0;
            bluEffect.Intensity        = 0;
            bluEffect.parent           = rgbCh.redChannel;

            // Loop thru entire song, by centiseconds
            for (int cs = 0; cs <= seq.Centiseconds; cs++)
            {
                bool colorChanged = false;
                bool steady       = true;
                // Do any of the three colors change type or intensity at the current moment (centisecond)
                if (rgbCh.redChannel.effects[redEffIdx].startCentisecond == cs)
                {
                    redEffect = rgbCh.redChannel.effects[redEffIdx];
                    redEffIdx++;
                    colorChanged = true;
                }
                if (rgbCh.grnChannel.effects[grnEffIdx].startCentisecond == cs)
                {
                    grnEffect = rgbCh.grnChannel.effects[grnEffIdx];
                    grnEffIdx++;
                    colorChanged = true;
                }
                if (rgbCh.bluChannel.effects[bluEffIdx].startCentisecond == cs)
                {
                    bluEffect = rgbCh.bluChannel.effects[bluEffIdx];
                    bluEffIdx++;
                    colorChanged = true;
                }
                // If something changed
                if (colorChanged)
                {
                    curLorColor = utils.Color_RGBtoLOR(redEffect.Intensity, grnEffect.Intensity, bluEffect.Intensity);
                    steady      = redEffect.Steady && grnEffect.Steady && bluEffect.Steady;
                }

                // Are we within the time window to be checked?
                if ((cs >= startCentisecond) && (cs <= endCentisecond))
                {
                    // Was there a change?  Is it to a steady color?
                    if (colorChanged && steady)
                    {
                        // Loop thru colors in the search-replace list
                        for (int clrIdx = 0; clrIdx < colorsSearch.Length; clrIdx++)
                        {
                            // Color Match?
                            if (curLorColor == colorsSearch[clrIdx])
                            {
                                // At least one color just changed, but the other 2 may (or may not) have changed earlier
                                // Check for that, and split the effect if necessary
                                if (redEffect.startCentisecond < cs)
                                {
                                    Effect ef = redEffect.Clone();
                                    redEffect.endCentisecond = cs - 1;
                                    ef.startCentisecond      = cs;
                                    redEffect = ef;
                                    rgbCh.grnChannel.effects.Add(ef);
                                }
                                if (grnEffect.startCentisecond != cs)
                                {
                                    Effect ef = grnEffect.Clone();
                                    grnEffect.endCentisecond = cs - 1;
                                    ef.startCentisecond      = cs;
                                    grnEffect = ef;
                                    rgbCh.grnChannel.effects.Add(ef);
                                }
                                if (bluEffect.startCentisecond != cs)
                                {
                                    Effect ef = bluEffect.Clone();
                                    bluEffect.endCentisecond = cs - 1;
                                    ef.startCentisecond      = cs;
                                    bluEffect = ef;
                                    rgbCh.grnChannel.effects.Add(ef);
                                }

                                // Likewise, effects may extend beyond the cut-off time
                                // Check for that too, and split the effect if needed
                                if (endCentisecond < seq.Centiseconds)
                                {
                                    if (redEffect.endCentisecond > endCentisecond)
                                    {
                                        Effect ef = redEffect.Clone();
                                        redEffect.endCentisecond = endCentisecond;
                                        ef.startCentisecond      = endCentisecond + 1;
                                        rgbCh.redChannel.effects.Add(ef);
                                    }
                                    if (grnEffect.endCentisecond > endCentisecond)
                                    {
                                        Effect ef = grnEffect.Clone();
                                        grnEffect.endCentisecond = endCentisecond;
                                        ef.startCentisecond      = endCentisecond + 1;
                                        rgbCh.grnChannel.effects.Add(ef);
                                    }
                                    if (bluEffect.endCentisecond > endCentisecond)
                                    {
                                        Effect ef = bluEffect.Clone();
                                        bluEffect.endCentisecond = endCentisecond;
                                        ef.startCentisecond      = endCentisecond + 1;
                                        rgbCh.bluChannel.effects.Add(ef);
                                    }
                                }

                                // Apply the new color
                                int r = colorsReplace[clrIdx] & 0xff;
                                redEffect.Intensity = r;
                                int g = colorsReplace[clrIdx] & 0xff00 >> 8;
                                grnEffect.Intensity = g;
                                int b = colorsReplace[clrIdx] & 0xff0000 >> 16;


                                // Break out of loop
                                clrIdx = colorsSearch.Length;
                            } // End color matches one in the list
                        }     // End for loop thru colors in search-replace list
                    }         // End color has changed and is steady
                }             // End in the time range
            }                 // End centisecond loop

            return(errState);
        }         // End ExchangeColors
Ejemplo n.º 10
0
        public static Bitmap RenderEffects(RGBchannel rgb, int startCentiseconds, int endCentiseconds, int width, int height, bool useRamps)
        {
            // Create a temporary working bitmap
            Bitmap bmp = new Bitmap(width, height);
            // get the graphics handle from it
            Graphics gr = Graphics.FromImage(bmp);

            // Paint the entire 'background' black
            //gr.FillRectangle(Brushes.Black, 0, 0, width - 1, height - 1);

            int[] rLevels = null;
            Array.Resize(ref rLevels, width);
            int[] gLevels = null;
            Array.Resize(ref gLevels, width);
            int[] bLevels = null;
            Array.Resize(ref bLevels, width);
            int thirdHt = height / 3;

            if (rgb.redChannel.effects.Count > 0)
            {
                rLevels = PlotLevels(rgb.redChannel, startCentiseconds, endCentiseconds, width);
            }
            if (rgb.grnChannel.effects.Count > 0)
            {
                gLevels = PlotLevels(rgb.grnChannel, startCentiseconds, endCentiseconds, width);
            }
            if (rgb.bluChannel.effects.Count > 0)
            {
                bLevels = PlotLevels(rgb.bluChannel, startCentiseconds, endCentiseconds, width);
            }

            for (int x = 0; x < width; x++)
            {
                //Debug.Write(levels[x].ToString() + " ");
                //bool shimmer = ((levels[x] & utils.ADDshimmer) > 0);
                //bool twinkle = ((levels[x] & utils.ADDtwinkle) > 0);
                //levels[x] &= 0x0FF;
                if (useRamps)
                {
                    // * * R E D * *
                    Pen   p       = new Pen(Color.Red, 1);
                    Brush br      = new SolidBrush(Color.Red);
                    bool  shimmer = ((rLevels[x] & utils.ADDshimmer) > 0);
                    bool  twinkle = ((rLevels[x] & utils.ADDtwinkle) > 0);
                    rLevels[x] &= 0x0FF;
                    int ll      = rLevels[x] * thirdHt;
                    int lineLen = ll / 100 + 1;
                    if (shimmer)
                    {
                        for (int n = 0; n < lineLen; n++)
                        {
                            int m = (n + x) % 6;
                            if (m < 2)
                            {
                                gr.FillRectangle(br, x, height - n, 1, 1);
                            }
                        }
                    }
                    else if (twinkle)
                    {
                        for (int n = 0; n < lineLen; n++)
                        {
                            int m = (n + x) % 6;
                            if (m < 1)
                            {
                                gr.FillRectangle(br, x, height - n, 1, 1);
                            }
                            m = (x - n + 25000) % 6;
                            if (m < 1)
                            {
                                gr.FillRectangle(br, x, height - n, 1, 1);
                            }
                        }
                    }
                    else
                    {
                        gr.DrawLine(p, x, height - 1, x, height - lineLen);
                    }
                    // END RED

                    // * * G R E E N * *
                    p           = new Pen(Color.Green, 1);
                    br          = new SolidBrush(Color.Green);
                    shimmer     = ((rLevels[x] & utils.ADDshimmer) > 0);
                    twinkle     = ((rLevels[x] & utils.ADDtwinkle) > 0);
                    rLevels[x] &= 0x0FF;
                    ll          = rLevels[x] * thirdHt;
                    lineLen     = ll / 100 + 1;
                    if (shimmer)
                    {
                        for (int n = 0; n < lineLen; n++)
                        {
                            int m = (n + x) % 6;
                            if (m < 2)
                            {
                                gr.FillRectangle(br, x, thirdHt + height - n, 1, 1);
                            }
                        }
                    }
                    else if (twinkle)
                    {
                        for (int n = 0; n < lineLen; n++)
                        {
                            int m = (n + x) % 6;
                            if (m < 1)
                            {
                                gr.FillRectangle(br, x, thirdHt + height - n, 1, 1);
                            }
                            m = (x - n + 25000) % 6;
                            if (m < 1)
                            {
                                gr.FillRectangle(br, x, thirdHt + height - n, 1, 1);
                            }
                        }
                    }
                    else
                    {
                        gr.DrawLine(p, x, height - 1, x, thirdHt + height - lineLen);
                    }
                    // END GREEN

                    // * * B L U E * *
                    p           = new Pen(Color.Red, 1);
                    br          = new SolidBrush(Color.Red);
                    shimmer     = ((rLevels[x] & utils.ADDshimmer) > 0);
                    twinkle     = ((rLevels[x] & utils.ADDtwinkle) > 0);
                    rLevels[x] &= 0x0FF;
                    ll          = rLevels[x] * thirdHt;
                    lineLen     = ll / 100 + 1;
                    if (shimmer)
                    {
                        for (int n = 0; n < lineLen; n++)
                        {
                            int m = (n + x) % 6;
                            if (m < 2)
                            {
                                gr.FillRectangle(br, x, thirdHt + thirdHt + height - n, 1, 1);
                            }
                        }
                    }
                    else if (twinkle)
                    {
                        for (int n = 0; n < lineLen; n++)
                        {
                            int m = (n + x) % 6;
                            if (m < 1)
                            {
                                gr.FillRectangle(br, x, thirdHt + thirdHt + height - n, 1, 1);
                            }
                            m = (x - n + 25000) % 6;
                            if (m < 1)
                            {
                                gr.FillRectangle(br, x, height - n, 1, 1);
                            }
                        }
                    }
                    else
                    {
                        gr.DrawLine(p, x, height - 1, x, thirdHt + thirdHt + height - lineLen);
                    }
                    // END BLUE
                }
                else                 // use fades instead of ramps
                {
                    rLevels[x] = (int)((float)rLevels[x] * 2.55F);
                    gLevels[x] = (int)((float)gLevels[x] * 2.55F);
                    bLevels[x] = (int)((float)bLevels[x] * 2.55F);

                    Color c = Color.FromArgb(rLevels[x], gLevels[x], bLevels[x]);
                    Pen   p = new Pen(c, 1);
                    gr.DrawLine(p, x, 0, x, height - 1);
                }
            }             // end For
            return(bmp);
        }
Ejemplo n.º 11
0
		} // end btnMake_Click()

		public void AddStrip()
		{
			int pixID = stripStart;
			int nextSI = seq.Members.HighestSavedIndex;
			int groupMember = 1;
			int uch = 1;
			if (chIncr < 0) uch = stripCount * 3 - 2;
			int trkNum = Int16.Parse(txtTrack.Text) - 1;
			string chName;
			Channel redChannel = new Channel("(R)");  // Just placeholders
			Channel grnChannel = new Channel("(G)");
			Channel bluChannel = new Channel("(B)");
			//RGBchannel RGB_Channel = new RGBchannel("RGB");
			//ChannelGroup pixelGroup = new ChannelGroup();
			int chx;
			//groupCount = 0;
			int stripKeywdel = stripStart;
			int RGBFirstDMXchannel = 1;
			int RGBLastDMXchannel = -1;
			//int pixNumFirst = pixelNum;
			//int pixNumLast = pixNumFirst + groupSize - 1;
			//int stripNumFirst = stripStart;
			//int stripNumLast = 1;
			//int dmxChFirst = 1;
			//int dmxChLast = -1;


			/////////////////////////////////
			// MAKE A GROUP FOR THE STRIP //
			///////////////////////////////
			int dmxCount = stripCount * 3;
			if (reversed)
			{
				//Reverse
				int bb = stripEnd * 3 - 2;
				//chName = stripName + " Keywdels " + stripStart.ToString("000") + "-" + stripEnd.ToString("000") + " (U" + universeNum.ToString() + "." + bb.ToString("000") + "-" + dmxCount.ToString("000") + ")";
				int sst = pixelNum;
				int est = pixelNum + Math.Max(stripStart, stripEnd);
				chName = stripName + " Keywdels " + sst.ToString("000") + "-" + est.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripStart.ToString("000") + "-" + stripEnd.ToString("000");
				chName += " / U" + universeNum.ToString() + "." + bb.ToString("000") + "-" + dmxCount.ToString("000") + ")";
			}
			else
			{
				// Forward
				//chName = stripName + " Keywdels " + stripStart.ToString("000") + "-" + stripCount.ToString("000") + " (U" + universeNum.ToString() + "." + stripStart.ToString("000") + "-" + dmxCount.ToString("000") + ")";
				chName = stripName + " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripStart.ToString("000") + "-" + stripEnd.ToString("000");
				chName += " / U" + universeNum.ToString() + "." + stripStart.ToString("000") + "-" + dmxCount.ToString("000") + ")";
			}
			ChannelGroup stripGroup = seq.CreateChannelGroup(chName);

			///////////////////////////////////////////////////////////
			// MAKE AN INITIAL CHANNEL GROUP FOR THE PIXEL GROUPING //
			/////////////////////////////////////////////////////////
			if (eaveNaming)
			{
				string gn = " Group ";
				if (groupNumber < 18)
				{
					//gn += (18 - groupNumber).ToString("00") + "L";
					gn += (groupNumber).ToString("00") + "L";
				}
				else
				{
					//gn += (groupNumber - 17).ToString("00") + "R";
					gn += (35 - groupNumber).ToString("00") + "R";
				}
				if (groupCount > 0)
				{
					gn += "b";
				}
				chName = stripName + gn;

			}
			else
			{
				//chName = stripName + " Keywdels " + stripNumFirst.ToString("000") + "-" + stripKeywdel.ToString("000");
				chName = stripName;
				//chName = " Keywdels " + (pixelNum - groupSize).ToString("000") + "-" + pixelNum.ToString("000") + " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripKeywdel.ToString("000") + " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000");
			}
			/*
			if (reversed)
			{
				stripNumFirst = stripStart;
				stripNumLast = stripStart - groupSize + 1;
				dmxChFirst = dmxCount - groupSize * 3 + 1;
				dmxChLast = dmxCount;
			}
			else
			{
				stripNumFirst = stripStart;
				stripNumLast = stripStart + groupSize - 1;
				dmxChFirst = 1;
				dmxChLast = groupSize * 3 - 1;
			}
			*/
			chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
			chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripNumLast.ToString("000");
			chName += " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000") + ")";
			ChannelGroup pixelGroup = seq.CreateChannelGroup(chName);
			stripGroup.AddItem(pixelGroup);


//			int gc = 
			pixNumFirst = (groupCount + 1) * groupSize + 1;
			pixNumLast = (groupCount + 2) * groupSize;
			stripNumFirst += (groupSize * chIncr);
			stripNumLast += (groupSize * chIncr) + 1;
			dmxChFirst += (groupSize * 3 * chIncr);
			dmxChLast += (groupSize * 3 * chIncr);
			
			if (stripNum == 2 )
			{
				pixNumFirst = 181;
				pixNumLast = 200;
				stripNumFirst = 11;
				stripNumLast = 30;
				dmxChFirst = 31;
				dmxChLast = 90;
			}
			if (stripNum == 3)
			{
				pixNumFirst = 361;
				pixNumLast = 380;
				stripNumFirst = 150;
				stripNumLast = 131;
				dmxChFirst = 391;
				dmxChLast = 450;
			}
			if (stripNum == 4)
			{
				pixNumFirst = 521;
				pixNumLast = 540;
				stripNumFirst = 11;
				stripNumLast = 30;
				dmxChFirst = 31;
				dmxChLast = 90;
			}



			string prfx = "";
			if (eaveNaming)
			{
				prfx = "Eave ";
			}

			//////////////////////
			// MAKE THE STRIP! //
			////////////////////
			while ((stripKeywdel > 0) && (stripKeywdel <= stripCount))
			{
				if (chOrder == 1) // RGB Order
				{
					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(R) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (R) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					redChannel = seq.CreateChannel(chName);
					redChannel.output.circuit = uch;
					RGBFirstDMXchannel = uch;
					uch++;

					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(G) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (G) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					grnChannel = seq.CreateChannel(chName);
					grnChannel.output.circuit = uch;
					uch++;

					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (B) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					bluChannel = seq.CreateChannel(chName);
					bluChannel.output.circuit = uch;
					RGBLastDMXchannel = uch;
					uch++;
				}

				if (chOrder == 2) // GRB Order
				{
					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(G) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (G) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					grnChannel = seq.CreateChannel(chName);
					grnChannel.output.circuit = uch;
					RGBFirstDMXchannel = uch;
					uch++;

					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(R) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (R) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					redChannel = seq.CreateChannel(chName);
					redChannel.output.circuit = uch;
					uch++;

					//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + "(B) (U" + universeNum.ToString() + "." + uch.ToString("000") + ")";
					chName = prfx + "Keywdel " + pixelNum.ToString("000");
					chName += " (B) / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
					chName += " / U" + universeNum.ToString() + "." + uch.ToString("000");
					bluChannel = seq.CreateChannel(chName);
					bluChannel.output.circuit = uch;
					RGBLastDMXchannel = uch;
					uch++;
				}
				redChannel.output.deviceType = DeviceType.DMX;
				redChannel.output.network = universeNum;
				redChannel.color = utils.LORCOLOR_RED;
				grnChannel.output.deviceType = DeviceType.DMX;
				grnChannel.output.network = universeNum;
				grnChannel.color = utils.LORCOLOR_GRN;
				bluChannel.output.deviceType = DeviceType.DMX;
				bluChannel.output.network = universeNum;
				bluChannel.color = utils.LORCOLOR_BLU;


				//dmxChLast = uch - 1;
				chx = uch - 2;
				//chName = stripName + " Keywdel " + stripKeywdel.ToString("000") + " (U" + universeNum.ToString() + "." + RGBFirstDMXchannel.ToString("000") + "-" + RGBLastDMXchannel.ToString("000") + ")";
				chName = prfx + "Keywdel " + pixelNum.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripKeywdel.ToString("000");
				chName += " / U" + universeNum.ToString() + "." + RGBFirstDMXchannel.ToString("000") + "-" + RGBLastDMXchannel.ToString("000");
				RGBchannel RGB_Channel = seq.CreateRGBchannel(chName);
				RGB_Channel.redChannel = redChannel;
				RGB_Channel.grnChannel = grnChannel;
				RGB_Channel.bluChannel = bluChannel;
				pixelNum++;

				pixelGroup.AddItem(RGB_Channel);
				groupCount++;

				//////////////////////////////////
				// IS THE GROUP FULL?          //
				// iF SO, CREATE THE NEXT ONE //
				///////////////////////////////
				if (stripKeywdel < stripCount)
				{
					if (groupCount >= groupSize)
					{
						//stripNumLast = stripNumFirst + groupSize;
						//int uchStart = stripKeywdel * 3 - 2;
						if (chIncr < 0)
						{
							// Reverse
							//dmxChFirst = stripKeywdel * 3 - 2;
							//dmxChLast = stripNumFirst * 3;
						}
						else
						{
							// Forward
							// OK as-is
						}

						groupNumber++;
						//dmxChFirst = uch;
						//stripNumFirst = stripKeywdel + chIncr;
						if (eaveNaming)
						{
							string gn = " Group ";
							if (groupNumber < 18)
							{
								//gn += (18 - groupNumber).ToString("00") + "L";
								gn += (groupNumber).ToString("00") + "L";
							}
							else
							{
								//gn += (groupNumber - 17).ToString("00") + "R";
								gn += (35 - groupNumber).ToString("00") + "R";
							}
							chName = stripName + gn;
						}
						else
						{
							chName = stripName;
						}
						chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
						chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + stripNumLast.ToString("000");
						chName += " / U" + universeNum.ToString() + "." + dmxChFirst.ToString("000") + "-" + dmxChLast.ToString("000") + ")";
						pixelGroup = seq.CreateChannelGroup(chName);
						stripGroup.AddItem(pixelGroup);

						pixNumFirst = pixNumLast + 1;
						pixNumLast += groupSize;
						dmxChFirst += (groupSize * 3 * chIncr);
						dmxChLast += (groupSize * 3 * chIncr);
						stripNumFirst += (groupSize * chIncr);
						stripNumLast += (groupSize * chIncr);

						//pixelGroup = new ChannelGroup();
						groupCount = 0; // Reset

					}
				}
				else
				{
				}

				stripKeywdel += chIncr;
				if (chIncr < 0) uch -= 6;


				/////////////////////////////////
			} // end while pixel # in range //
				///////////////////////////////

			// Is there any leftover pixels?
			// (Happens when strip size is not evenly divisible by group size)
			if (groupCount > 0)
			{
				if (eaveNaming)
				{
					string gn = " Group ";
					if (groupNumber < 18)
					{
						//gn += (18 - groupNumber).ToString("00") + "aL";
						gn += (groupNumber).ToString("00") + "aL";
					}
					else
					{
						//gn += (groupNumber - 17).ToString("00") + "aR";
						gn += (35 - groupNumber).ToString("00") + "aR";
					}
					chName = stripName + gn;

				}
				else
				{
					chName = stripName;
				}
				pixNumFirst -= groupSize;
				pixNumLast = Math.Max(stripStart, stripEnd);
				stripNumFirst -= (groupSize * chIncr);
				stripNumLast = 1; //TODO Fix!
				dmxChFirst -= (groupSize * 3 * chIncr);
				dmxChLast = 1;
				chName += " Keywdels " + pixNumFirst.ToString("000") + "-" + pixNumLast.ToString("000");
				chName += " / S" + stripNum.ToString() + "." + stripNumFirst.ToString("000") + "-" + (stripKeywdel + 1).ToString("000");
				chName += " / U" + universeNum.ToString() + ".001" + "-" + dmxChLast.ToString("000") + ")";

				pixelGroup.ChangeName(chName);
				stripGroup.AddItem(pixelGroup);
				//dmxChFirst = uch;
				//stripNumFirst = stripKeywdel + chIncr;

			}
			if (groupCount >= groupSize)
			{
				groupNumber++;
				groupCount = 0;
			}

			// Add the Strip to the Track
			seq.Tracks[trkNum].AddItem(stripGroup);

		} // end void AddStrip();
Ejemplo n.º 12
0
		private RGBchannel ShiprgbCh(string theName, int col, int row)
		{
			string pxName = theName;
			string chName = theName;
			pxName += " [U" + universeNum.ToString() + ".";
			//if (optReverse1.Checked)
			//{
			//	pxName += (chanNum + 2).ToString() + "-" + chanNum.ToString() + "]";
			//}
			//else
			//{
			pxName += chanNum.ToString("000") + "-" + (chanNum + 2).ToString("000") + "]";
			//}
			RGBchannel theRGBch = seq.CreateRGBchannel(pxName);

			if (chOrder == 1) // RGB Order
			{
				chName += " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (R)";
				Channel redChannel = seq.CreateChannel(chName);
				redChannel.output.deviceType = DeviceType.DMX;
				redChannel.output.network = universeNum;
				redChannel.color = utils.LORCOLOR_RED;
				redChannel.Centiseconds = seq.Centiseconds;
				redChannel.output.circuit = chanNum;
				theRGBch.redChannel = redChannel;
				chanNum++;

				chName += " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (G)";
				Channel grnChannel = seq.CreateChannel(chName);
				grnChannel.output.deviceType = DeviceType.DMX;
				grnChannel.output.network = universeNum;
				grnChannel.color = utils.LORCOLOR_GRN;
				grnChannel.Centiseconds = seq.Centiseconds;
				grnChannel.output.circuit = chanNum;
				theRGBch.grnChannel = grnChannel;
				chanNum++;

				chName += " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (R)";
				Channel bluChannel = seq.CreateChannel(chName);
				bluChannel.output.deviceType = DeviceType.DMX;
				bluChannel.output.network = universeNum;
				bluChannel.color = utils.LORCOLOR_BLU;
				bluChannel.Centiseconds = seq.Centiseconds;
				bluChannel.output.circuit = chanNum;
				theRGBch.bluChannel = bluChannel;
				chanNum++;
			}

			if (chOrder == 2) // GRB Order
			{
				chName += " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (G)";
				Channel grnChannel = seq.CreateChannel(chName);
				grnChannel.output.deviceType = DeviceType.DMX;
				grnChannel.output.network = universeNum;
				grnChannel.color = utils.LORCOLOR_GRN;
				grnChannel.Centiseconds = seq.Centiseconds;
				grnChannel.output.circuit = chanNum;
				theRGBch.grnChannel = grnChannel;
				chanNum++;

				chName += " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (R)";
				Channel redChannel = seq.CreateChannel(chName);
				redChannel.output.deviceType = DeviceType.DMX;
				redChannel.output.network = universeNum;
				redChannel.color = utils.LORCOLOR_RED;
				redChannel.Centiseconds = seq.Centiseconds;
				redChannel.output.circuit = chanNum;
				theRGBch.redChannel = redChannel;
				chanNum++;

				chName += " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (R)";
				Channel bluChannel = seq.CreateChannel(chName);
				bluChannel.output.deviceType = DeviceType.DMX;
				bluChannel.output.network = universeNum;
				bluChannel.color = utils.LORCOLOR_BLU;
				bluChannel.Centiseconds = seq.Centiseconds;
				bluChannel.output.circuit = chanNum;
				theRGBch.bluChannel = bluChannel;
				chanNum++;
			}

			chanMatrix[col, row] = theRGBch;

			pixelNum++;


			return theRGBch;
		}
Ejemplo n.º 13
0
		} // end void AddBatch();

		private RGBchannel MakeRGBch(string baseName, int row, int col, int pix)
		{
			string pxName = baseName;
			string chName = baseName;
			pxName = baseName + " [U" + universeNum.ToString() + ".";
			//if (optReverse1.Checked)
			//{
			//	pxName += (chanNum + 2).ToString() + "-" + chanNum.ToString() + "]";
			//}
			//else
			//{
				pxName += chanNum.ToString("000") + "-" + (chanNum + 2).ToString("000") + "]";
			//}
			RGBchannel theRGBch = seq.CreateRGBchannel(pxName);

			if (chOrder == 1) // RGB Order
			{
				chName = baseName + " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (R)";
				Channel redChannel = seq.CreateChannel(chName);
				redChannel.output.deviceType = DeviceType.DMX;
				redChannel.output.network = universeNum;
				redChannel.color = utils.LORCOLOR_RED;
				redChannel.Centiseconds = seq.Centiseconds;
				redChannel.output.circuit = chanNum;
				theRGBch.redChannel = redChannel;
				chanNum++;

				chName = baseName + " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (G)";
				Channel grnChannel = seq.CreateChannel(chName);
				grnChannel.output.deviceType = DeviceType.DMX;
				grnChannel.output.network = universeNum;
				grnChannel.color = utils.LORCOLOR_GRN;
				grnChannel.Centiseconds = seq.Centiseconds;
				grnChannel.output.circuit = chanNum;
				theRGBch.grnChannel = grnChannel;
				chanNum++;

				chName = baseName + " [U" + universeNum.ToString() + "." + chanNum.ToString("000") + "] (B)";
				Channel bluChannel = seq.CreateChannel(chName);
				bluChannel.output.deviceType = DeviceType.DMX;
				bluChannel.output.network = universeNum;
				bluChannel.color = utils.LORCOLOR_BLU;
				bluChannel.Centiseconds = seq.Centiseconds;
				bluChannel.output.circuit = chanNum;
				theRGBch.bluChannel = bluChannel;
				chanNum++;
			}


			//chanMatrix[sect, pxl] = theRGBch;
			treeMatrix[row, col, pix] = theRGBch;

			if (direction < 0)
			{
				chanNum -= 6;
				if (chanNum < 1)
				{
					chanNum = MAX_CH_PER_UNIV - 2;
					universeNum--;
				}
			}
			else
			{
				if (chanNum > (MAX_CH_PER_UNIV))
				{
					chanNum = 1;
					universeNum++;
				}
			}
			//pixelNum += direction; // Handled above in calling routine


			return theRGBch;
		}
Ejemplo n.º 14
0
        private static TreeNodeAdv TreeAddTrack(Sequence4 seq, TreeNodeAdvCollection baseNodes, Track track, ref List <TreeNodeAdv>[] nodesBySI, bool selectedOnly,
                                                bool includeRGBchildren, int memberTypes)
        {
            List <TreeNodeAdv> nodeList;

            if (nodesBySI == null)
            {
                Array.Resize(ref nodesBySI, seq.Members.HighestSavedIndex);
            }

            string nodeText = "";
            bool   inclChan = false;

            if ((memberTypes & SeqEnums.MEMBER_Channel) > 0)
            {
                inclChan = true;
            }
            bool inclRGB = false;

            if ((memberTypes & SeqEnums.MEMBER_RGBchannel) > 0)
            {
                inclRGB = true;
            }

            // TEMPORARY, FOR DEBUGGING
            // int tcount = 0;
            int gcount = 0;
            int rcount = 0;
            int ccount = 0;
            int dcount = 0;

            //try
            //{
            //Track track = seq.Tracks[trackNumber];
            nodeText = track.Name;
            //TreeNodeAdv trackNode = baseNodes.Add(nodeText);
            TreeNodeAdv trackNode = new TreeNodeAdv(nodeText);

            baseNodes.Add(trackNode);
            List <TreeNodeAdv> qlist;

            //int inclCount = track.Members.DescendantCount(selectedOnly, inclChan, inclRGB, includeRGBchildren);
            //if (inclCount > 0)
            //{
            // Tracks don't normally have savedIndexes
            // But we will assign one for tracking and matching purposes
            //track.SavedIndex = seq.Members.HighestSavedIndex + t + 1;

            //if ((memberTypes & SeqEnums.MEMBER_Track) > 0)
            //{
            baseNodes = trackNode.Nodes;
            nodeIndex++;
            trackNode.Tag = track;

            trackNode.LeftImageIndices = ICONtrack;


            trackNode.Checked = track.Selected;
            if (track.Tag == null)
            {
                //nodeList = new List<TreeNodeAdv>();
                //track.Tag = nodeList;
            }
            else
            {
                //nodeList = (List<TreeNodeAdv>)track.Tag;
            }
            //nodeList.Add(trackNode);
            //}

            for (int ti = 0; ti < track.Members.Count; ti++)
            {
                //try
                //{
                IMember member = track.Members.Items[ti];
                int     si     = member.SavedIndex;
                if (member != null)
                {
                    if (member.MemberType == MemberType.ChannelGroup)
                    {
                        ChannelGroup memGrp    = (ChannelGroup)member;
                        int          inclCount = memGrp.Members.DescendantCount(selectedOnly, inclChan, inclRGB, includeRGBchildren);
                        if (inclCount > 0)
                        {
                            TreeNodeAdv groupNode = TreeAddGroup(seq, baseNodes, memGrp, ref nodesBySI, selectedOnly, includeRGBchildren, memberTypes);
                            //AddNode(nodesBySI[si], groupNode);
                            qlist = nodesBySI[si];
                            if (qlist == null)
                            {
                                qlist = new List <TreeNodeAdv>();
                            }
                            qlist.Add(groupNode);
                            gcount++;
                            //nodesBySI[si].Add(groupNode);
                        }
                    }
                    if (member.MemberType == MemberType.CosmicDevice)
                    {
                        CosmicDevice memDev    = (CosmicDevice)member;
                        int          inclCount = memDev.Members.DescendantCount(selectedOnly, inclChan, inclRGB, includeRGBchildren);
                        if (inclCount > 0)
                        {
                            TreeNodeAdv cosmicNode = TreeAddCosmic(seq, baseNodes, memDev, ref nodesBySI, selectedOnly, includeRGBchildren, memberTypes);
                            //AddNode(nodesBySI[si], groupNode);
                            qlist = nodesBySI[si];
                            if (qlist == null)
                            {
                                qlist = new List <TreeNodeAdv>();
                            }
                            qlist.Add(cosmicNode);
                            dcount++;
                            //nodesBySI[si].Add(groupNode);
                        }
                    }
                    if (member.MemberType == MemberType.RGBchannel)
                    {
                        RGBchannel  memRGB  = (RGBchannel)member;
                        TreeNodeAdv rgbNode = TreeAddRGBchannel(seq, baseNodes, memRGB, ref nodesBySI, selectedOnly, includeRGBchildren);
                        //AddNode(nodesBySI[si], rgbNode);
                        //nodesBySI[si].Add(rgbNode);
                        qlist = nodesBySI[si];
                        if (qlist == null)
                        {
                            qlist = new List <TreeNodeAdv>();
                        }
                        qlist.Add(rgbNode);
                        rcount++;
                    }
                    if (member.MemberType == MemberType.Channel)
                    {
                        Channel     memCh       = (Channel)member;
                        TreeNodeAdv channelNode = TreeAddChannel(seq, baseNodes, memCh, selectedOnly);
                        //AddNode(nodesBySI[si], channelNode);
                        //nodesBySI[si].Add(channelNode);
                        qlist = nodesBySI[si];
                        if (qlist == null)
                        {
                            qlist = new List <TreeNodeAdv>();
                        }
                        qlist.Add(channelNode);
                        ccount++;
                    }
                }                 // end not null
                //} // end try
                #region catch1

                /*
                 * catch (System.NullReferenceException ex)
                 *      {
                 *              StackTrace st = new StackTrace(ex, true);
                 *              StackFrame sf = st.GetFrame(st.FrameCount - 1);
                 *              string emsg = ex.ToString();
                 *              emsg += ERRproc + seq.filename + ERRtrk + t.ToString() + ERRitem + ti.ToString();
                 *              emsg += ERRline + sf.GetFileLineNumber();
                 #if DEBUG
                 *                      System.Diagnostics.Debugger.Break();
                 #endif
                 *              utils.WriteLogEntry(emsg, utils.LOG_Error, Application.ProductName);
                 *      }
                 *      catch (System.InvalidCastException ex)
                 *      {
                 *              StackTrace st = new StackTrace(ex, true);
                 *              StackFrame sf = st.GetFrame(st.FrameCount - 1);
                 *              string emsg = ex.ToString();
                 *              emsg += ERRproc + seq.filename + ERRtrk + t.ToString() + ERRitem + ti.ToString();
                 *              emsg += ERRline + sf.GetFileLineNumber();
                 #if DEBUG
                 *                      System.Diagnostics.Debugger.Break();
                 #endif
                 *              utils.WriteLogEntry(emsg, utils.LOG_Error, Application.ProductName);
                 *      }
                 *      catch (Exception ex)
                 *      {
                 *              StackTrace st = new StackTrace(ex, true);
                 *              StackFrame sf = st.GetFrame(st.FrameCount - 1);
                 *              string emsg = ex.ToString();
                 *              emsg += ERRproc + seq.filename + ERRtrk + t.ToString() + ERRitem + ti.ToString();
                 *              emsg += ERRline + sf.GetFileLineNumber();
                 #if DEBUG
                 *                      System.Diagnostics.Debugger.Break();
                 #endif
                 *              utils.WriteLogEntry(emsg, utils.LOG_Error, Application.ProductName);
                 *      }
                 */
                #endregion
            }             // end loop thru track items
            #region catch2

            /*
             *      } // end try
             *      catch (System.NullReferenceException ex)
             *      {
             *              StackTrace st = new StackTrace(ex, true);
             *              StackFrame sf = st.GetFrame(st.FrameCount - 1);
             *              string emsg = ex.ToString();
             *              emsg += ERRproc + seq.filename + ERRtrk + t.ToString();
             *              emsg += ERRline + sf.GetFileLineNumber();
             #if DEBUG
             *                      System.Diagnostics.Debugger.Break();
             #endif
             *              utils.WriteLogEntry(emsg, utils.LOG_Error, Application.ProductName);
             *      }
             *      catch (System.InvalidCastException ex)
             *      {
             *              StackTrace st = new StackTrace(ex, true);
             *              StackFrame sf = st.GetFrame(st.FrameCount - 1);
             *              string emsg = ex.ToString();
             *              emsg += ERRproc + seq.filename + ERRtrk + t.ToString();
             *              emsg += ERRline + sf.GetFileLineNumber();
             #if DEBUG
             *                      System.Diagnostics.Debugger.Break();
             #endif
             *              utils.WriteLogEntry(emsg, utils.LOG_Error, Application.ProductName);
             *      }
             *      catch (Exception ex)
             *      {
             *              StackTrace st = new StackTrace(ex, true);
             *              StackFrame sf = st.GetFrame(st.FrameCount - 1);
             *              string emsg = ex.ToString();
             *              emsg += ERRproc + seq.filename + ERRtrk + t.ToString();
             *              emsg += ERRline + sf.GetFileLineNumber();
             #if DEBUG
             *                      System.Diagnostics.Debugger.Break();
             #endif
             *              utils.WriteLogEntry(emsg, utils.LOG_Error, Application.ProductName);
             *      }
             */
            #endregion



            //	int x = 1; // Check ccount, rcount, gcount

            return(trackNode);
        }         // end fillOldChannels
Ejemplo n.º 15
0
        private static TreeNodeAdv TreeAddRGBchannel(Sequence4 seq, TreeNodeAdvCollection baseNodes, RGBchannel rgbChannel, ref List <TreeNodeAdv>[] nodesBySI, bool selectedOnly, bool includeRGBchildren)
        {
            TreeNodeAdv        channelNode = null;
            List <TreeNodeAdv> nodeList;
            int RGBsi = rgbChannel.SavedIndex;

            if (RGBsi >= nodesBySI.Length)
            {
                Array.Resize(ref nodesBySI, RGBsi + 1);
            }
            if (nodesBySI[RGBsi] != null)
            {
                IMember mbrR = seq.Members.bySavedIndex[RGBsi];
                if (mbrR.MemberType == MemberType.RGBchannel)
                {
                    //RGBchannel rgbChannel = (RGBchannel)mbrR;
                    string nodeText = rgbChannel.Name;
                    channelNode = new TreeNodeAdv(nodeText);
                    baseNodes.Add(channelNode);
                    //IMember nodeTag = rgbChannel;
                    nodeIndex++;
                    channelNode.Tag = rgbChannel;
                    channelNode.LeftImageIndices = ICONrgbChannel;
                    //channelNode.SelectedImageKey = ICONrgbChannel;
                    channelNode.Checked = rgbChannel.Selected;
                    if (rgbChannel.Tag == null)
                    {
                        nodeList       = new List <TreeNodeAdv>();
                        rgbChannel.Tag = nodeList;
                    }
                    else
                    {
                        nodeList = (List <TreeNodeAdv>)rgbChannel.Tag;
                    }
                    nodeList.Add(channelNode);

                    if (includeRGBchildren)
                    {
                        // * * R E D   S U B  C H A N N E L * *
                        TreeNodeAdv colorNode = null;
                        int         ci        = rgbChannel.redChannel.SavedIndex;
                        nodeText  = rgbChannel.redChannel.Name;
                        colorNode = new TreeNodeAdv(nodeText);
                        channelNode.Nodes.Add(colorNode);
                        //nodeTag = seq.Channels[ci];
                        nodeIndex++;
                        colorNode.Tag = rgbChannel.redChannel;
                        colorNode.LeftImageIndices = ICONredChannel;
                        //colorNode.SelectedImageKey = ICONredChannel;
                        colorNode.Checked = rgbChannel.redChannel.Selected;
                        nodesBySI[ci].Add(colorNode);
                        channelNode.Nodes.Add(colorNode);
                        if (rgbChannel.redChannel.Tag == null)
                        {
                            nodeList = new List <TreeNodeAdv>();
                            rgbChannel.redChannel.Tag = nodeList;
                        }
                        else
                        {
                            nodeList = (List <TreeNodeAdv>)rgbChannel.redChannel.Tag;
                        }
                        nodeList.Add(channelNode);

                        // * * G R E E N   S U B  C H A N N E L * *
                        ci        = rgbChannel.grnChannel.SavedIndex;
                        nodeText  = rgbChannel.grnChannel.Name;
                        colorNode = new TreeNodeAdv(nodeText);
                        channelNode.Nodes.Add(colorNode);
                        //nodeTag = seq.Channels[ci];
                        nodeIndex++;
                        colorNode.Tag = rgbChannel.grnChannel;
                        colorNode.LeftImageIndices = ICONgrnChannel;
                        //colorNode.SelectedImageKey = ICONgrnChannel;
                        colorNode.Checked = rgbChannel.grnChannel.Selected;
                        nodesBySI[ci].Add(colorNode);
                        channelNode.Nodes.Add(colorNode);
                        if (rgbChannel.grnChannel.Tag == null)
                        {
                            nodeList = new List <TreeNodeAdv>();
                            rgbChannel.grnChannel.Tag = nodeList;
                        }
                        else
                        {
                            nodeList = (List <TreeNodeAdv>)rgbChannel.grnChannel.Tag;
                        }
                        nodeList.Add(channelNode);

                        // * * B L U E   S U B  C H A N N E L * *
                        ci = rgbChannel.bluChannel.SavedIndex;
                        if (nodesBySI[ci] != null)
                        {
                            nodeText = rgbChannel.bluChannel.Name;
                        }
                        colorNode = new TreeNodeAdv(nodeText);
                        channelNode.Nodes.Add(colorNode);
                        //nodeTag = seq.Channels[ci];
                        nodeIndex++;
                        colorNode.Tag = seq.Channels[ci];
                        colorNode.LeftImageIndices = ICONbluChannel;
                        //colorNode.SelectedImageKey = ICONbluChannel;
                        colorNode.Checked = rgbChannel.bluChannel.Selected;
                        nodesBySI[ci].Add(colorNode);
                        channelNode.Nodes.Add(colorNode);
                        if (rgbChannel.bluChannel.Tag == null)
                        {
                            nodeList = new List <TreeNodeAdv>();
                            rgbChannel.bluChannel.Tag = nodeList;
                        }
                        else
                        {
                            nodeList = (List <TreeNodeAdv>)rgbChannel.bluChannel.Tag;
                        }
                        nodeList.Add(channelNode);
                    }                     // end includeRGBchildren
                }
                else
                {
                    string msg = "Attempt to add non-RGB member to RGB node!";
                    System.Diagnostics.Debugger.Break();
                }
            }
            return(channelNode);
        }
Ejemplo n.º 16
0
        }         // end TreeAddGroup

        private static TreeNodeAdv TreeAddCosmic(Sequence4 seq, TreeNodeAdvCollection baseNodes, CosmicDevice device, ref List <TreeNodeAdv>[] nodesBySI, bool selectedOnly,
                                                 bool includeRGBchildren, int memberTypes)
        {
            int deviceSI = device.SavedIndex;

            if (deviceSI >= nodesBySI.Length)
            {
                Array.Resize(ref nodesBySI, deviceSI + 1);
            }

            TreeNodeAdv deviceNode = null;

            if (nodesBySI[deviceSI] != null)
            {
                //ChanInfo nodeTag = new ChanInfo();
                //nodeTag.MemberType = MemberType.ChannelGroup;
                //nodeTag.objIndex = groupIndex;
                //nodeTag.SavedIndex = theGroup.SavedIndex;
                //nodeTag.nodeIndex = nodeIndex;

                //ChannelGroup theGroup = seq.ChannelGroups[groupIndex];
                //CosmicDevice device = (CosmicDevice)seq.Members.bySavedIndex[deviceSI];

                //IMember groupID = theGroup;

                // Include groups in the TreeView?
                if ((memberTypes & SeqEnums.MEMBER_CosmicDevice) > 0)
                {
                    string nodeText = device.Name;
                    deviceNode = new TreeNodeAdv(nodeText);
                    baseNodes.Add(deviceNode);

                    nodeIndex++;
                    deviceNode.Tag = device;
                    deviceNode.LeftImageIndices = ICONcosmicDevice;
                    //deviceNode.SelectedImageKey = ICONcosmicDevice;
                    deviceNode.Checked = device.Selected;
                    baseNodes          = deviceNode.Nodes;
                    nodesBySI[deviceSI].Add(deviceNode);
                }
                //List<TreeNodeAdv> qlist;

                // const string ERRproc = " in TreeFillChannels-TreeAddGroup(";
                // const string ERRgrp = "), in Group #";
                // const string ERRitem = ", Items #";
                // const string ERRline = ", Line #";

                for (int gi = 0; gi < device.Members.Count; gi++)
                {
                    //try
                    //{
                    IMember member = device.Members.Items[gi];
                    int     si     = member.SavedIndex;
                    if (member.MemberType == MemberType.ChannelGroup)
                    {
                        ChannelGroup memGrp   = (ChannelGroup)member;
                        bool         inclChan = false;
                        if ((memberTypes & SeqEnums.MEMBER_Channel) > 0)
                        {
                            inclChan = true;
                        }
                        bool inclRGB = false;
                        if ((memberTypes & SeqEnums.MEMBER_RGBchannel) > 0)
                        {
                            inclRGB = true;
                        }
                        int inclCount = memGrp.Members.DescendantCount(selectedOnly, inclChan, inclRGB, includeRGBchildren);
                        if (inclCount > 0)
                        {
                            TreeNodeAdv subGroupNode = TreeAddGroup(seq, baseNodes, memGrp, ref nodesBySI, selectedOnly, includeRGBchildren, memberTypes);
                            //qlist = nodesBySI[si];
                            //qlist.Add(subGroupNode);
                        }
                        int cosCount = memGrp.Members.DescendantCount(selectedOnly, inclChan, inclRGB, includeRGBchildren);
                    }
                    if (member.MemberType == MemberType.CosmicDevice)
                    {
                        CosmicDevice memDev   = (CosmicDevice)member;
                        bool         inclChan = false;
                        if ((memberTypes & SeqEnums.MEMBER_Channel) > 0)
                        {
                            inclChan = true;
                        }
                        bool inclRGB = false;
                        if ((memberTypes & SeqEnums.MEMBER_RGBchannel) > 0)
                        {
                            inclRGB = true;
                        }
                        int inclCount = memDev.Members.DescendantCount(selectedOnly, inclChan, inclRGB, includeRGBchildren);
                        if (inclCount > 0)
                        {
                            TreeNodeAdv subGroupNode = TreeAddCosmic(seq, baseNodes, memDev, ref nodesBySI, selectedOnly, includeRGBchildren, memberTypes);
                            //qlist = nodesBySI[si];
                            //qlist.Add(subGroupNode);
                        }
                        int cosCount = memDev.Members.DescendantCount(selectedOnly, inclChan, inclRGB, includeRGBchildren);
                    }
                    if (member.MemberType == MemberType.Channel)
                    {
                        if ((memberTypes & SeqEnums.MEMBER_Channel) > 0)
                        {
                            Channel     chanMem     = (Channel)member;
                            TreeNodeAdv channelNode = TreeAddChannel(seq, baseNodes, chanMem, selectedOnly);
                            nodesBySI[si].Add(channelNode);
                        }
                    }
                    if (member.MemberType == MemberType.RGBchannel)
                    {
                        if ((memberTypes & SeqEnums.MEMBER_RGBchannel) > 0)
                        {
                            RGBchannel  memRGB         = (RGBchannel)member;
                            TreeNodeAdv rgbChannelNode = TreeAddRGBchannel(seq, baseNodes, memRGB, ref nodesBySI, selectedOnly, includeRGBchildren);
                            nodesBySI[si].Add(rgbChannelNode);
                        }
                    }
                    #region catch

                    /*
                     * } // end try
                     * catch (Exception ex)
                     * {
                     * StackTrace st = new StackTrace(ex, true);
                     * StackFrame sf = st.GetFrame(st.FrameCount - 1);
                     * string emsg = ex.ToString();
                     * emsg += ERRproc + seq.filename + ERRgrp + groupIndex.ToString() + ERRitem + gi.ToString();
                     * emsg += ERRline + sf.GetFileLineNumber();
                     #if DEBUG
                     * Debugger.Break();
                     #endif
                     * utils.WriteLogEntry(emsg, utils.LOG_Error, Application.ProductName);
                     * } // end catch
                     */
                    #endregion
                }                 // End loop thru items
            }
            return(deviceNode);
        }         // end AddGroup