Example #1
0
        private void BuildVerticalGroup()
        {
            int start_x        = this.m_TextBoxVerSample.Left;
            int start_y        = this.m_TextBoxVerSample.Top;
            int width_GroupOld = m_GroupBoxVer.Width;
            int width_GroupVer = start_x;
            int width_con      = this.m_TextBoxVerSample.Width;
            int space_x        = 70;

            for (int i = 0; i < m_ColorNumAndColumnNum; i++)
            {
                int   hg    = i / m_ColorNum;
                Label label = this.m_LabelVerHeadIndex[i];
                ControlClone.LabelClone(label, this.m_LabelVerSample);

                label.Location = new Point(start_x + space_x * i, this.m_LabelVerSample.Top);
                label.Width    = width_con;
                int colorID = CoreInterface.GetLayoutColorID(i % m_ColorNum);
                if (m_HorColumnNum != 1)
                {
                    label.Text = hg.ToString() + " (" + NewLayoutFun.GetColorName(colorID) + ")";
                }
                else
                {
                    label.Text = " (" + NewLayoutFun.GetColorName(colorID) + ")";
                }
                label.Visible = true;
                m_GroupBoxVer.Controls.Add(this.m_LabelVerHeadIndex[i]);

                NumericUpDown textBox = this.m_TextBoxVer[i];
                ControlClone.NumericUpDownClone(textBox, this.m_TextBoxVerSample);

                textBox.Location = new Point(start_x + space_x * i, this.m_TextBoxVerSample.Top);
                textBox.Width    = width_con;
                textBox.Value    = 0;
                textBox.Visible  = true;
                m_GroupBoxVer.Controls.Add(this.m_TextBoxVer[i]);

                width_GroupVer += space_x;
            }

            if (width_GroupOld < width_GroupVer)
            {
                m_GroupBoxVer.Width = width_GroupVer;
            }

            m_GroupBoxVer.ResumeLayout(false);
        }
Example #2
0
        public void OnPrinterSettingChange(SPrinterSetting ss)
        {
            int colorNum = CoreInterface.GetLayoutColorNum();

            cbxColorName.Items.Clear();
            for (int i = 0; i < colorNum; i++)
            {
                int    colorID = CoreInterface.GetLayoutColorID(i);
                string cmode   = NewLayoutFun.GetColorName(colorID);
                cbxColorName.Items.Add(cmode);
            }

            if (cbxColorName.Items.Count > 0)
            {
                cbxColorName.SelectedIndex = 0;
            }

            if (File.Exists(filePath))
            {
                listBox1.Items.Clear();
                //this.checkBoxClose.Checked = true;
                StreamReader sr   = new StreamReader(filePath, Encoding.Default);
                string       info = "";
                while (!sr.EndOfStream)
                {
                    info = sr.ReadLine();

                    //check
                    if (info.Trim() == "")
                    {
                        continue;
                    }

                    string[] temp = info.Split(new char[] { ',' });
                    if (temp.Length != 5)
                    {
                        continue;
                    }

                    listBox1.Items.Add(info);
                }
                sr.Close();
            }
        }
Example #3
0
        public void Save()
        {
            CoreInterface.ClearList();

            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                string   info     = listBox1.GetItemText(listBox1.Items[i]);
                string[] strArray = info.Split(new char[] { ',' });
                if (strArray.Length < 5)
                {
                    return;
                }

                DynamicData dynamicdata = new DynamicData();
                dynamicdata.curcolorindex      = (byte)NewLayoutFun.GetColorID(strArray[0]); //getColorIdx(strArray[0]);
                dynamicdata.curgroupindex      = (byte)ConvertStringtoDecimal(strArray[1]);
                dynamicdata.curinterleaveindex = (byte)ConvertStringtoDecimal(strArray[2]);
                dynamicdata.row  = (int)ConvertStringtoDecimal(strArray[3]);
                dynamicdata.line = (int)ConvertStringtoDecimal(strArray[4]);

                CoreInterface.AddDynamicListData(dynamicdata);
            }

            FileStream   fs = new FileStream(filePath, FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);

            //开始写入
            for (int i = 0; i < listBox1.Items.Count; i++)
            {
                sw.WriteLine(listBox1.GetItemText(listBox1.Items[i]));
            }
            //清空缓冲区
            sw.Flush();
            //关闭流
            sw.Close();
            fs.Close();
        }
Example #4
0
        public void OnPrinterPropertyChange(SPrinterProperty sp)
        {
            spp = sp;

            bool bsupportwhite   = (sp.nWhiteInkNum & 0x0F) > 0;
            bool bsupportVarnish = (sp.nWhiteInkNum >> 4) > 0;

            this.spotColorMaskSetting1.Visible = bsupportwhite;
            this.spotColorMaskSetting2.Visible = bsupportVarnish;

            label1.Visible = cbo_MultipleInk.Visible = bsupportwhite;
            label2.Visible = cbo_MultipleVavishInk.Visible = bsupportVarnish;

            this.grouperGrey.Visible = NewLayoutFun.IsSupportGray;
            if (!bsupportwhite && bsupportVarnish)
            {
                this.spotColorMaskSetting2.Location = this.spotColorMaskSetting1.Location;
                label2.Location = label1.Location;
                cbo_MultipleVavishInk.Location = cbo_MultipleInk.Location;
            }

            if (!bsupportwhite && !bsupportVarnish)
            {
                this.grouperGrey.Location = this.spotColorMaskSetting1.Location;
            }
            else if (bsupportwhite && !bsupportVarnish)
            {
                this.grouperGrey.Location = this.spotColorMaskSetting2.Location;
            }

            this.spotColorMaskSetting1.OnPrinterPropertyChange(sp);
            this.spotColorMaskSetting2.OnPrinterPropertyChange(sp);
            this.spotColorMaskSetting1.Title = ResString.GetResString("EnumLayerType_White");
            this.spotColorMaskSetting2.Title = ResString.GetResString("EnumLayerType_Varnish");

            checkBox14plTo42pl.Visible            = false; //SPrinterProperty.IsSurpportVolumeConvert(sp.ePrinterHead);
            checkBoxEnableSingleLayerMode.Visible = false;

            colorNum = CoreInterface.GetLayoutColorNum();
            LabelGreyList.Clear();
            NumericUpDownGreyList.Clear();

            if (colorNum > 0)
            {
                labelBaseGrey.Text = NewLayoutFun.GetColorName(CoreInterface.GetLayoutColorID(0));
                LabelGreyList.Add(labelBaseGrey);
                NumericUpDownGreyList.Add(m_numAllpercentBaseGrey);
                LineHeight = 25;

                for (int i = 1; i < colorNum; i++)
                {
                    Label labelGrey = new Label();
                    ControlClone.LabelClone(labelGrey, this.labelBaseGrey);

                    labelGrey.Location = new Point(labelBaseGrey.Location.X, labelBaseGrey.Location.Y + LineHeight);
                    labelGrey.Text     = NewLayoutFun.GetColorName(CoreInterface.GetLayoutColorID(i));
                    labelGrey.Width    = labelBaseGrey.Width;
                    labelGrey.Visible  = true;
                    LabelGreyList.Add(labelGrey);
                    grouperGrey.Controls.Add(labelGrey);

                    NumericUpDown numericUpDownGrey = new NumericUpDown();
                    ControlClone.NumericUpDownClone(numericUpDownGrey, m_numAllpercentBaseGrey);

                    numericUpDownGrey.Location = new Point(m_numAllpercentBaseGrey.Location.X, m_numAllpercentBaseGrey.Location.Y + LineHeight);
                    numericUpDownGrey.Value    = 0;
                    numericUpDownGrey.Visible  = true;
                    numericUpDownGrey.Width    = m_numAllpercentBaseGrey.Width;
                    NumericUpDownGreyList.Add(numericUpDownGrey);
                    grouperGrey.Controls.Add(numericUpDownGrey);

                    LineHeight += 25;
                }
            }

            this.isDirty = false;
        }
Example #5
0
        public void OnPrinterPropertyChange(SPrinterProperty sp)
        {
            m_rsPrinterPropery = sp;
#if true
            uint uiHtype = 0;
            CoreInterface.GetUIHeadType(ref uiHtype);
            m_bKonic512            = (uiHtype & 0x01) != 0;
            m_bXaar382             = (uiHtype & 0x02) != 0;
            m_bSpectra             = (uiHtype & 0x04) != 0;
            m_bPolaris             = (uiHtype & 0x08) != 0;
            m_bPolaris_V5_8        = (uiHtype & 0x10) != 0;;
            m_bExcept              = (uiHtype & 0x20) != 0;
            m_bPolaris_V7_16       = (uiHtype & 0x40) != 0;
            m_bKonic1024i_Gray     = (uiHtype & 0x80) != 0;
            m_bSpectra_SG1024_Gray = (uiHtype & 0x100) != 0;
            m_bXaar501             = (uiHtype & 0x200) != 0;//pan dan Xaar501?
#else
            m_bSpectra  = SPrinterProperty.IsSpectra(sp.ePrinterHead);
            m_bKonic512 = SPrinterProperty.IsKonica512(sp.ePrinterHead);
            m_bXaar382  = (sp.ePrinterHead == PrinterHeadEnum.Xaar_Proton382_35pl || sp.ePrinterHead == PrinterHeadEnum.Xaar_Proton382_60pl);
            m_bPolaris  = SPrinterProperty.IsPolaris(sp.ePrinterHead);
            //			m_bPolaris_V5_8 = SPrinterProperty.IsPolaris(sp.ePrinterHead);
            SBoardInfo sBoardInfo = new SBoardInfo();
            if (CoreInterface.GetBoardInfo(0, ref sBoardInfo) != 0)
            {
                m_bExcept = (sBoardInfo.m_nBoardManufatureID == 0xB || sBoardInfo.m_nBoardManufatureID == 0x8b);
            }
#endif

            m_bVerArrangement        = ((sp.bSupportBit1 & 2) != 0);
            m_bMirrorArrangement     = m_rsPrinterPropery.IsMirrorArrangement();
            m_b1head2color           = (m_rsPrinterPropery.nOneHeadDivider == 2);
            m_Konic512_1head2color   = m_b1head2color && m_bKonic512;
            m_bPolaris_V7_16_Emerald = m_bPolaris_V7_16 &&
                                       (sp.ePrinterHead == PrinterHeadEnum.Spectra_Emerald_10pl ||
                                        sp.ePrinterHead == PrinterHeadEnum.Spectra_Emerald_30pl);
            m_bPolaris_V7_16_Polaris = m_bPolaris_V7_16 &&
                                       (sp.ePrinterHead == PrinterHeadEnum.Spectra_PolarisColor4_15pl ||
                                        sp.ePrinterHead == PrinterHeadEnum.Spectra_PolarisColor4_35pl ||
                                        sp.ePrinterHead == PrinterHeadEnum.Spectra_PolarisColor4_80pl ||
                                        sp.ePrinterHead == PrinterHeadEnum.Spectra_Polaris_15pl ||
                                        sp.ePrinterHead == PrinterHeadEnum.Spectra_Polaris_35pl ||
                                        sp.ePrinterHead == PrinterHeadEnum.Spectra_Polaris_80pl);
            m_bPolaris_V5_8_Emerald = m_bPolaris_V5_8 &&
                                      (sp.ePrinterHead == PrinterHeadEnum.Spectra_Emerald_10pl ||
                                       sp.ePrinterHead == PrinterHeadEnum.Spectra_Emerald_30pl);
            m_bRicoHead = sp.ePrinterHead == PrinterHeadEnum.RICOH_GEN4_7pl ||
                          sp.ePrinterHead == PrinterHeadEnum.RICOH_GEN4L_15pl ||
                          sp.ePrinterHead == PrinterHeadEnum.RICOH_GEN4P_7pl;
            m_bKyocera    = SPrinterProperty.IsKyocera(sp.ePrinterHead);
            m_bKonic1800i = SPrinterProperty.IsKonic1800i(sp.ePrinterHead);
            m_bKonicM600  = sp.ePrinterHead == PrinterHeadEnum.Konica_M600SH_2C;
            m_bGma990     = sp.ePrinterHead == PrinterHeadEnum.Fujifilm_GMA9905300_5pl || sp.ePrinterHead == PrinterHeadEnum.Fujifilm_GMA3305300_5pl;

            m_HeadNum = NewLayoutFun.GetHeadNum();

            if (m_bKonic1024i_Gray)
            {
                m_TempNum = m_HeadNum / 2;
            }
            else if (m_bSpectra_SG1024_Gray)
            {
                if (!CoreInterface.IsSG1024_AS_8_HEAD())
                {
                    if (m_b1head2color)
                    {
                        m_TempNum /= 2;
                    }
                }
            }

            m_StartHeadIndex = 0;

            //int imax = Math.Max(m_HeadNum, m_TempNum);
            m_pMap = new byte[m_HeadNum];
            for (int i = 0; i < m_HeadNum; i++)
            {
                m_pMap[i] = (byte)i;
            }

            if (GetRealTimeInfo2())
            {
                InitHeadTextList();
                InitChart();
                InitCheckedListBox();
            }
        }
Example #6
0
        public void SendPrintData()
        {
            int hPrinterPort = 0;

            try
            {
                bool isFirstRIP = false;
                _bSendExited = _bReadExited = false;
                bool bFileHeader = true;
                while (_cachList.Count < 2048 && !_bReadExited) //缓存一定数量才开始打印16M
                {
                    Thread.Sleep(100);
                }

                while ((hPrinterPort = CoreInterface.Printer_Open()) == 0)
                {
                    Thread.Sleep(100);
                }

                SPrinterSetting ssNew      = this.m_IPrinterChange.GetAllParam().PrinterSetting;
                SJobSetting     sjobseting = new SJobSetting();
                if (UIFunctionOnOff.SupportPrintMode)
                {
                    //todo
                }
                if (UIFunctionOnOff.SupportMediaMode)
                {
                    //todo
                }
                LayoutSetting curLayoutSetting = new LayoutSetting();

                int layoutIdx = 0;
                if (CoreInterface.LayoutIndex >= 0)
                {
                    layoutIdx = CoreInterface.LayoutIndex;
                }

                if (NewLayoutFun.GetLayoutSetting(layoutIdx, ref curLayoutSetting))
                {
                    ssNew.layoutSetting = curLayoutSetting;
                }
                if (ssNew.sExtensionSetting.AutoRunAfterPrint)
                {
                    ssNew.sBaseSetting.fYAddDistance = ssNew.sExtensionSetting.fRunDistanceAfterPrint;
                    ssNew.sExtensionSetting.bEnableAnotherUvLight = ssNew.sExtensionSetting.fRunDistanceAfterPrint > 0;
                    CoreInterface.SetPrinterSetting(ref ssNew, false); //打印结束后继续扫描一段距离生效
                }
                //打印前设置JobSetting
                sjobseting.bReversePrint = ssNew.sBaseSetting.bReversePrint;
                CoreInterface.SetSJobSetting(ref sjobseting);



                LogWriter.WriteLog(new string[] { "[RIP]Printer open" }, true);
                int cbBytesRead = 0;
                isFirstRIP = true;
                while (true)
                {
                    if (_cachList.Count > 0)
                    {
                        MyStruct data = new MyStruct();
                        if (!_cachList.TryDequeue(out data))
                        {
                            continue;
                        }
                        byte[] chRequest = data.buf;
                        cbBytesRead = data.buflen;
#if ADD_HARDKEY
                        {
                            int    subsize   = 32;
                            byte[] lastValue = chRequest;
                            if (bFileHeader)
                            {
                                bFileHeader = false;
                                lastValue   = new byte[BUFSIZE + 8];


                                byte[] mjobhead = new byte[subsize];
                                byte[] retValue = new byte[subsize + Marshal.SizeOf(typeof(int))];
                                for (int j = 0; j < BYHXSoftLock.JOBHEADERSIZE / subsize; j++)
                                {
                                    Buffer.BlockCopy(chRequest, j * mjobhead.Length, mjobhead, 0, mjobhead.Length);
                                    BYHX_SL_RetValue ret = BYHXSoftLock.CheckValidDateWithData(mjobhead, ref retValue);
                                    Buffer.BlockCopy(retValue, 0, lastValue, j * retValue.Length, retValue.Length);
                                }

                                Buffer.BlockCopy(chRequest, BYHXSoftLock.JOBHEADERSIZE, lastValue,
                                                 BYHXSoftLock.JOBHEADERSIZE + 8, chRequest.Length - BYHXSoftLock.JOBHEADERSIZE);
                                int sendBytes = CoreInterface.Printer_Send(hPrinterPort, lastValue, cbBytesRead + 8);
                                Debug.Assert(sendBytes == cbBytesRead + 8);
                            }
                            else
                            {
                                CoreInterface.Printer_Send(hPrinterPort, chRequest, cbBytesRead);
                            }
                        }
#else
                        {
                            if (isFirstRIP)
                            {
                                string strLog            = "";
                                int    nVersion          = 0;
                                byte   bReversePrint     = 0;
                                byte   nPrintLayerNum    = 0;
                                int    printmodePerLayer = 0;
                                isFirstRIP = false;

                                if (cbBytesRead >= 84)
                                {
                                    for (int i = 0; i < 84; i++)
                                    {
                                        strLog += Convert.ToString(chRequest[i], 2) + ",";
                                    }

                                    LogWriter.WriteLog(new string[] { "[RIP]" + strLog }, true);


                                    nVersion = BitConverter.ToInt32(chRequest, 4);
                                    if (nVersion == 4)
                                    {
                                        bReversePrint = chRequest[55];
                                        //nPrintLayerNum = chRequest[56];
                                        //printmodePerLayer = BitConverter.ToInt32(chRequest, 57);

                                        //PrinterSettingHelper.SetPropertyWhiteInkLayer(
                                        //    ref m_IPrinterChange.GetAllParam().PrinterSetting, bReversePrint,
                                        //    nPrintLayerNum,
                                        //    (uint) printmodePerLayer);
                                        CoreInterface.SetPrinterSetting(ref m_IPrinterChange.GetAllParam()
                                                                        .PrinterSetting);
                                        //isSetWhiteFormPrt = true;

                                        sjobseting = new SJobSetting();
                                        sjobseting.bReversePrint = bReversePrint == 1;
                                        CoreInterface.SetSJobSetting(ref sjobseting);
                                    }
                                    else if (nVersion == 6)
                                    {
                                        bReversePrint = chRequest[71];

                                        sjobseting = new SJobSetting();
                                        sjobseting.bReversePrint = bReversePrint == 1;
                                        CoreInterface.SetSJobSetting(ref sjobseting);
                                    }
                                }
                            }

                            //#else
                            CoreInterface.Printer_Send(hPrinterPort, chRequest, cbBytesRead);
                        }
#endif
                    }

                    if (_cachList.Count == 0 && _bReadExited)
                    {
                        LogWriter.WriteLog(
                            new string[]
                        {
                            string.Format("[SendPrintData]  CachList.Count = {0};bReadExited={1}", _cachList.Count,
                                          _bReadExited)
                        }, true);
                        break;
                    }

                    if (_cachList.Count == 0)
                    {
                        LogWriter.WriteLog(
                            new string[]
                        {
                            string.Format("[SendPrintData]  CachList.Count = {0};waittime={1}", _cachList.Count, 10)
                        }, true);
                        Thread.Sleep(10);
                    }
                }

                CoreInterface.Printer_Close(hPrinterPort);
                _bSendExited = true;
                SExtensionSetting extensionSetting = ssNew.sExtensionSetting;
                if (extensionSetting.fRunDistanceAfterPrint > 0 && extensionSetting.BackBeforePrint)
                {
                    while (true)
                    {
                        JetStatusEnum status = CoreInterface.GetBoardStatus();
                        if (status == JetStatusEnum.Ready)
                        {
                            int speed             = ssNew.sMoveSetting.nYMoveSpeed;
                            MoveDirectionEnum dir = MoveDirectionEnum.Up;
                            int len = Convert.ToInt32(extensionSetting.fRunDistanceAfterPrint * m_IPrinterChange.GetAllParam().PrinterProperty.fPulsePerInchY);
                            CoreInterface.MoveCmd((int)dir, len, speed);
                            break;
                        }
                        Thread.Sleep(100);
                    }
                }
            }
            catch (Exception e)
            {
                LogWriter.WriteLog(
                    new string[]
                {
                    string.Format("[SendPrintData]  CachList.Count = {0};Exception={1}", _cachList.Count, e.Message)
                }, true);
                if (hPrinterPort != 0)
                {
                    CoreInterface.Printer_Close(hPrinterPort);
                    _bSendExited = true;
                }
            }
        }