Exemple #1
0
        public unsafe byte GuiCurveRef(ref InfoObject obj, byte ID)
        {
            byte qyt = 0;

            byte[]          buffer    = new byte[4];
            ushort[]        numArray  = new ushort[4];
            ushort[]        numArray2 = new ushort[4];
            ushort[]        numArray3 = new ushort[4];
            ushort[]        numArray4 = new ushort[4];
            uint            address   = 0;
            InfoPicture     pic       = new InfoPicture();
            InfoCurveParam *curve_paramPtr;

            fixed(byte *px = &m_guiApp.CustomData[obj.AttributeStart])
            curve_paramPtr = (InfoCurveParam *)px;

            InfoCurveChannelParam *[] curve_channel_paramPtrArray = new InfoCurveChannelParam *[4];
            short x     = 0;
            short num11 = 0;

            if (curve_paramPtr->ChannelCount <= 4)
            {
                byte num3;
                for (num3 = 0; num3 < curve_paramPtr->ChannelCount; num3++)
                {
                    curve_channel_paramPtrArray[num3] = (InfoCurveChannelParam *)((((uint)curve_paramPtr) + sizeof(InfoCurveParam)) + (sizeof(InfoCurveChannelParam) * num3));
                }

                byte num2 = 0;
                num3 = 0;
                while (num3 < curve_paramPtr->ChannelCount)
                {
                    buffer[num3]    = 1;
                    numArray[num3]  = curve_channel_paramPtrArray[num3]->BufNext;
                    numArray3[num3] = curve_channel_paramPtrArray[num3]->DotLen;
                    numArray4[num3] = numArray3[num3];
                    if (numArray3[num3] > 0)
                    {
                        num2 = (byte)(num2 + 1);
                    }
                    num3 = (byte)(num3 + 1);
                }
                if (num2 == 0)
                {
                    CurveRefBack(ref obj, ID);
                }
                else
                {
                    if (curve_paramPtr->BackType == 0)
                    {
                        qyt     = 5;
                        pic     = m_runScreen.ReadInfoPicture(curve_paramPtr->PicID);
                        address = pic.DataStart + m_guiApp.App.PictureImageStart;
                        if (pic.IsPotrait == 1)
                        {
                            address += (uint)((((obj.Panel.Y + 1) * pic.W) - obj.Panel.X) * 2);
                        }
                        else
                        {
                            address += (uint)(((obj.Panel.Y * pic.W) + obj.Panel.X) * 2);
                        }
                    }
                    else if (curve_paramPtr->BackType == 2)
                    {
                        qyt     = 5;
                        pic     = m_runScreen.ReadInfoPicture(curve_paramPtr->PicID);
                        address = pic.DataStart + m_guiApp.App.PictureImageStart;
                    }
                    else
                    {
                        x     = (short)obj.Panel.X;
                        num11 = (short)(x + curve_paramPtr->GridX);
                    }
                    for (short i = (short)obj.Panel.X; i <= obj.Panel.EndX; i = (short)(i + qyt))
                    {
                        short endx = (short)((i + 5) - 1);
                        if (endx > obj.Panel.EndX)
                        {
                            endx = (short)obj.Panel.EndX;
                        }
                        if (curve_paramPtr->BackType == 0)
                        {
                            if (pic.IsPotrait == 1)
                            {
                                address -= (uint)(qyt * 2);
                            }

                            m_runScreen.LCD_AreaSet((ushort)i, obj.Panel.Y, (ushort)endx, obj.Panel.EndY);
                            m_runScreen.SendDataOffset(address, (ushort)(pic.W << 1), curve_paramPtr->Height, (byte)((endx - i) + 1));

                            if (pic.IsPotrait == 0)
                            {
                                address += (uint)(qyt * 2);
                            }
                        }
                        else if (curve_paramPtr->BackType == 2)
                        {
                            if (pic.IsPotrait == 1)
                            {
                                address -= (uint)(qyt * 2);
                            }

                            m_runScreen.LCD_AreaSet((ushort)i, obj.Panel.Y, (ushort)endx, obj.Panel.EndY);
                            m_runScreen.SendDataOffset(address, (ushort)(pic.W << 1), curve_paramPtr->Height, (byte)((endx - i) + 1));
                            if (pic.IsPotrait == 0)
                            {
                                address += (uint)(qyt * 2);
                            }
                        }
                        else
                        {
                            short endy;
                            short y;
                            if (curve_paramPtr->GridX > 0)
                            {
                                ushort num14;
                                ushort num15;
                                if (i == x)
                                {
                                    m_runScreen.LCD_AreaSet((ushort)i, obj.Panel.Y, (ushort)i, obj.Panel.EndY);
                                    m_runScreen.LCD_WR_POINT(curve_paramPtr->Height, curve_paramPtr->Griclr);
                                    num14 = (ushort)(i + 1);
                                }
                                else
                                {
                                    num14 = (ushort)i;
                                }

                                if ((num14 + 5) >= num11)
                                {
                                    num15 = (ushort)(num11 - 1);
                                    x     = num11;
                                    num11 = (short)(num11 + curve_paramPtr->GridX);
                                }
                                else
                                {
                                    num15 = (ushort)((num14 + 5) - 1);
                                }

                                qyt = (byte)((num15 - i) + 1);
                                if ((i + qyt) > obj.Panel.EndX)
                                {
                                    num15 = (ushort)endx;
                                    qyt   = (byte)((endx - i) + 1);
                                }
                                if (curve_paramPtr->GridY > 0)
                                {
                                    endy = (short)obj.Panel.EndY;
                                    while (endy > obj.Panel.Y)
                                    {
                                        y = (short)((endy - curve_paramPtr->GridY) + 1);
                                        if (y < obj.Panel.Y)
                                        {
                                            y = (short)obj.Panel.Y;
                                        }
                                        m_runScreen.LCD_AreaSet(num14, (ushort)y, num15, (ushort)endy);
                                        m_runScreen.LCD_WR_POINT((uint)(((num15 - num14) + 1) * (endy - y)), curve_paramPtr->BackColor);
                                        m_runScreen.LCD_WR_POINT((uint)((num15 - num14) + 1), curve_paramPtr->Griclr);
                                        endy = (short)(endy - curve_paramPtr->GridY);
                                    }
                                }
                                else
                                {
                                    address = (uint)(curve_paramPtr->Height * ((num15 - num14) + 1));
                                    m_runScreen.LCD_AreaSet(num14, obj.Panel.Y, num15, obj.Panel.EndY);
                                    m_runScreen.LCD_WR_POINT(address, curve_paramPtr->BackColor);
                                }
                            }
                            else if (curve_paramPtr->GridY > 0)
                            {
                                for (endy = (short)obj.Panel.EndY; endy > obj.Panel.Y; endy = (short)(endy - curve_paramPtr->GridY))
                                {
                                    y = (short)((endy - curve_paramPtr->GridY) + 1);
                                    if (y < obj.Panel.Y)
                                    {
                                        y = (short)obj.Panel.Y;
                                    }
                                    m_runScreen.LCD_AreaSet((ushort)i, (ushort)y, (ushort)endx, (ushort)endy);
                                    qyt = (byte)((endx - i) + 1);
                                    m_runScreen.LCD_WR_POINT((uint)(qyt * (endy - y)), curve_paramPtr->BackColor);
                                    m_runScreen.LCD_WR_POINT(qyt, curve_paramPtr->Griclr);
                                }
                            }
                            else
                            {
                                qyt     = (byte)((endx - i) + 1);
                                address = (uint)(curve_paramPtr->Height * ((endx - i) + 1));
                                m_runScreen.LCD_AreaSet((ushort)i, obj.Panel.Y, (ushort)endx, obj.Panel.EndY);
                                m_runScreen.LCD_WR_POINT(address, curve_paramPtr->BackColor);
                            }
                        }
                        num3 = 0;
                        while (num3 < curve_paramPtr->ChannelCount)
                        {
                            if (numArray4[num3] > 0)
                            {
                                for (num2 = 0; num2 < qyt; num2 = (byte)(num2 + 1))
                                {
                                    byte num6;
                                    if (numArray[num3] == curve_channel_paramPtrArray[num3]->Begin)
                                    {
                                        numArray[num3] = (ushort)curve_channel_paramPtrArray[num3]->End;
                                    }
                                    else
                                    {
                                        numArray[num3] = (ushort)(numArray[num3] - 1);
                                    }

                                    if (numArray[num3] == curve_channel_paramPtrArray[num3]->Begin)
                                    {
                                        numArray2[num3] = (ushort)curve_channel_paramPtrArray[num3]->End;
                                    }
                                    else
                                    {
                                        numArray2[num3] = (ushort)(numArray[num3] - 1);
                                    }

                                    byte num5 = m_guiApp.CustomData[numArray[num3]];
                                    byte num4 = m_guiApp.CustomData[numArray2[num3]];
                                    if (buffer[num3] > 0)
                                    {
                                        num4         = num5;
                                        buffer[num3] = 0;
                                    }

                                    if (numArray4[num3] == 1)
                                    {
                                        num4 = num5;
                                    }
                                    if (num5 > num4)
                                    {
                                        num6 = (byte)((num5 - num4) + 1);
                                        m_runScreen.LCD_AreaSet((ushort)(i + num2), (ushort)(obj.Panel.EndY - num5), (ushort)(i + num2), (ushort)(obj.Panel.EndY - num4));
                                        m_runScreen.LCD_WR_POINT(num6, curve_channel_paramPtrArray[num3]->Penclr);
                                    }
                                    else
                                    {
                                        num6 = (byte)((num4 - num5) + 1);
                                        m_runScreen.LCD_AreaSet((ushort)(i + num2), (ushort)(obj.Panel.EndY - num4), (ushort)(i + num2), (ushort)(obj.Panel.EndY - num5));
                                        m_runScreen.LCD_WR_POINT(num6, curve_channel_paramPtrArray[num3]->Penclr);
                                    }
                                    numArray4[num3] = (ushort)(numArray4[num3] - 1);
                                    if (numArray4[num3] == 0)
                                    {
                                        break;
                                    }
                                }
                            }
                            num3 = (byte)(num3 + 1);
                        }
                    }
                    for (num3 = 0; num3 < curve_paramPtr->ChannelCount; num3 = (byte)(num3 + 1))
                    {
                        if (curve_channel_paramPtrArray[num3]->DotLen == curve_paramPtr->Width)
                        {
                            curve_channel_paramPtrArray[num3]->BufFree = (ushort)((curve_paramPtr->BufLen - curve_paramPtr->Width) - (curve_channel_paramPtrArray[num3]->DotLen - numArray3[num3]));
                        }
                    }
                }
                curve_paramPtr->RefFlag = 0;
            }
            return(0);
        }
Exemple #2
0
        private unsafe byte clearSliderCursor(ref InfoObject obj, InfoSliderParam *param, ushort *x0, ushort *x1, ushort *y0, ushort *y1)
        {
            ushort x       = 0;
            ushort y       = 0;
            ushort num3    = 0;
            ushort lastPos = 0;

            if (param->Mode > 0)
            {
                x    = x0[0];
                num3 = x1[0];
                if (y1[0] < param->LastPos)
                {
                    lastPos = param->LastPos;
                    y       = (ushort)((lastPos - param->CursorHeight) + 1);
                    if (y1[0] >= y)
                    {
                        y = (ushort)(y1[0] + 1);
                    }
                }
                else if (y1[0] > param->LastPos)
                {
                    lastPos = param->LastPos;
                    y       = (ushort)((lastPos - param->CursorHeight) + 1);
                    if (lastPos >= y0[0])
                    {
                        lastPos = (ushort)(y0[0] - 1);
                    }
                }
            }
            else
            {
                y       = y0[0];
                lastPos = y1[0];
                if (x0[0] < param->LastPos)
                {
                    x    = param->LastPos;
                    num3 = (ushort)((x + param->CursorWidth) - 1);
                    if (x1[0] >= x)
                    {
                        x = (ushort)(x1[0] + 1);
                    }
                }
                else if (x0[0] > param->LastPos)
                {
                    x    = param->LastPos;
                    num3 = (ushort)((x + param->CursorWidth) - 1);
                    if (num3 >= x0[0])
                    {
                        num3 = (ushort)(x0[0] - 1);
                    }
                }
            }
            switch (param->BackType)
            {
            case 0:
                m_guiApp.BrushInfo.pic = m_runScreen.ReadInfoPicture(param->BackPicId);
                break;

            case 1:
                m_guiApp.BrushInfo.BackColor = param->BackPicId;
                break;

            case 2:
                m_guiApp.BrushInfo.pic = m_runScreen.ReadInfoPicture(param->BackPicId);
                m_guiApp.BrushInfo.X   = obj.Panel.X;
                m_guiApp.BrushInfo.Y   = obj.Panel.Y;
                break;
            }
            m_guiApp.BrushInfo.sta = param->BackType;
            m_runScreen.ClearBackground(x, y, (ushort)((num3 - x) + 1), (ushort)((lastPos - y) + 1));
            return(1);
        }