//--------------------------------------------------------------------------- #include #pragma hdrstop #include "DesignViewer_F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "TPRuler2D" #pragma resource "*.dfm" TDesignView *DesignView; //--------------------------------------------------------------------------- __fastcall TDesignView::TDesignView(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TDesignView::ChartHScrollBarChange(TObject *Sender) { DrawChart(false,true);//when EL //ShowChart(); ChartRuler->StartX=(ChartHScrollBar->Max-ChartHScrollBar->Position); } //--------------------------------------------------------------------------- void __fastcall TDesignView::ChartVScrollBarChange(TObject *Sender) { DrawChart(false,true);//when EL //ShowChart(); ChartRuler->StartY=this->DistY/2 + (ChartVScrollBar->Max-ChartVScrollBar->Position); } //--------------------------------------------------------------------------- void __fastcall TDesignView::ChartRulerMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { int yoff=ChartVScrollBar->Position; int xoff=ChartHScrollBar->Position; Tex *tex = ((Tex *)Main->texlayer->TexList->Items[Main->LayerNum]); RECT r = Rect(0,0,chartTempL->Width, chartTempL_Height_ideal); POINT p1 = Chart->ScreenToClient(ChartRuler->ClientToScreen(Point(X,Y))); POINT p2 = Main->texlayer->FindCell2(r, p1.x+xoff, p1.y+yoff, DistX, DistY); if(p2.y != 0) return;//ÀåÁø¸¸: µðÀÚÀΠâ ȸ»öºÎºÐ ´­·¯µµ ½Ç Àüü°¡ ¿·À¸·Î À̵¿ ¾ÈµÇ°Ô tex->leftShift = p2.x; GuideBar_F->UpdateGuideBar(); UpdateEdit(); DrawChart(false); } //--------------------------------------------------------------------------- void __fastcall TDesignForm::DrawChart(bool reDrawChartBase, bool reDrawChartCurve){ if(!InitChart(reDrawChartBase)) return; if(!Main->texlayer)return; smallchartHeight = (Chart->Height < chartTempL->Height)? Chart->Height:chartTempL->Height;//used in TexLayer smallchart->Create(chartTempL->Width, smallchartHeight, 24); int yoff2=ChartVScrollBar->Max-ChartVScrollBar->Position; int xoff2=ChartHScrollBar->Max-ChartHScrollBar->Position; int trim_y = -yoff2%DistY; if (trim_y<0) trim_y += DistY; int r_top = chartTempL_Height_ideal - smallchart->Height - yoff2; if(r_top<0) r_top=0; RECT r = Rect(0, r_top, chartTempL->Width, chartTempL_Height_ideal); HDC dc=smallchart->CreateDC(); HDC dc3=chartTempL->CreateDC(); if (Chart->Height == chartTempL->Height) { BitBlt(dc,//¹Ø¹ÙÅÁÀ» ±×·ÁÁÜ 0, 0, smallchart->Width, smallchart->Height, dc3, 0,0, SRCCOPY); }else { BitBlt(dc,//¹Ø¹ÙÅÁÀ» ±×·ÁÁÜ 0, 0, smallchart->Width, smallchart->Height, dc3, 0, trim_y+chartTempL->Height - smallchart->Height - DistY, SRCCOPY); } Main->texlayer->Draw(dc, r, DistX, DistY, reDrawChartBase|reDrawChartCurve); int dx=0,dy=0,sx=0,sy=0; if(smallchart->Width>Chart->Width) { sx = smallchart->Width-Chart->Width-xoff2; dx = 0; } else { sx = 0; dx = Chart->Width-smallchart->Width; } if(smallchart->Height>Chart->Height) { sy = smallchart->Height-Chart->Height-yoff2; dy = 0; } else { sy = 0; dy = Chart->Height-smallchart->Height; } // ¹ÙÅÁÈ­¸é¿¡ Ãâ·Â BitBlt(Chart->Canvas->Handle, dx, dy, Chart->Width, Chart->Height, dc, sx, 0, SRCCOPY); Chart->Repaint(); smallchart->DeleteDC(dc); chartTempL->DeleteDC(dc3); if(GuideBar_F&&GuideBar_F->Visible) GuideBar_F->Repaint(); if(YarnCompositionData_F&&YarnCompositionData_F->Visible) YarnCompositionData_F->Repaint(); Main->UpdateBtn(); } //--------------------------------------------------------------------------- void __fastcall TDesignView::FormShow(TObject *Sender) { if(!chartTempL_in) return; chartTempL->Create(chartTempL_in->Width, chartTempL_in->Height, 24); if (!chartTempL->Copy(chartTempL_in, SRCCOPY)) return; texlayer = texlayer_in; this->DistX=DistX; this->DistY=DistY; int width = texlayer->complete_needle; if(Main->texlayer->default_complete_needle == true){ //ÀåÁø¸¸ : ÃÖ¼Ò°ø¹è¼ö¸¦ À§ÇØ int a[MAX_LAYER_COUNT] = {0,0,0,0,0,0,0}; TList *TexList = Main->texlayer->TexList; for(int j2=0;j2Count;j2++){ Tex *tex = ((Tex *)TexList->Items[j2]); for(int i2=0;i2Wales->Count;i2++) a[j2]+= ((WaleState *)(tex->Wales->Items[i2]))->cnt; } width = GetLCN(a[0],a[1],a[2],a[3],a[4],a[5],a[6]); } int maxrun=0; int minrun=0; for(int j2=0;j2texlayer->TexList->Count;j2++){ Tex *tex = ((Tex *)Main->texlayer->TexList->Items[j2]); for(int i2=0;i2Curve->Count;i2++) { KO *ko = (KO *)tex->Curve->Items[i2]; maxrun = max(ko->in,max(ko->via,max(ko->out,maxrun))); minrun = min(ko->in,min(ko->via,min(ko->out,minrun))); } } width+=(maxrun-minrun); RECT r=Rect(0,0,width*DistX,Main->texlayer->GetHeight()*DistY); if(r.right<128) wtimes=8; else if(r.right<512) wtimes=3; else if(r.right<800) wtimes=2; else wtimes=1; if(r.bottom<512) htimes=3; else htimes=2; DVResize(r, DistX, DistY); FormPaint(NULL); } //---------------------------------------------------------------------------