//--------------------------------------------------------------------------- #include #pragma hdrstop #include "MetaData_F.h" #include "Simulation_F.h" #include "GuideBar.h" #include "Main_F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzEdit" #pragma link "RzPanel" #pragma link "RzButton" #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define IDS_META_DATA StringTable[0] #define IDS_MACHINE_NAME StringTable[1] #define IDS_TIME StringTable[2] #define IDS_RPM StringTable[3] #define IDS_M_WIDTH StringTable[4] #define IDS_M_GAUGE StringTable[5] #define IDS_M_CPC StringTable[6] #define IDS_TEST StringTable[7] #define IDS_TEST_WEIGHT StringTable[8] #define IDS_CUT_YARD StringTable[9] #define IDS_HOURS StringTable[10] #define IDS_EFFICIENCY StringTable[11] #define IDS_COUNT_OF_W StringTable[12] #define IDS_S_WIDTH StringTable[13] #define IDS_S_GAUGE StringTable[14] #define IDS_S_CPC StringTable[15] #define IDS_NAME StringTable[16] #define IDS_CODE StringTable[17] #define IDS_DETAIL StringTable[18] #define IDS_RESPONSIBLE_PART StringTable[19] #define IDS_LOGOIMAGE StringTable[20] #define IDS_FIND StringTable[21] //--------------------------------------------------------------------------- TMetaDataForm *MetaDataForm; //--------------------------------------------------------------------------- __fastcall TMetaDataForm::TMetaDataForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::FormShow(TObject *Sender) { SetDisabledText(); } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::SetDisabledText(){ AnsiString s1=ExtractFileName(Main->maindata.FileName); s1=s1.SubString(1,s1.Length()-4); s1=s1.UpperCase(); edName->Text=s1;//edName->Text=Main->maindata.ProductName; edMWidth->Text=MyFloatToStr(Main->maindata.width,2); edMCPC->Text=MyFloatToStr(Main->maindata.cpc,2); edMGauge->Text=IntToStr((int)Main->maindata.gauge); edSWidth->Text=MyFloatToStr(SimulationForm->sd.width,2); edSCPC->Text=MyFloatToStr(SimulationForm->sd.cpc,2); edSGauge->Text= MyFloatToStr(SimulationForm->sd.gauge,2); } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::SetMetaData(){ SetDisabledText(); Main->maindata.ProductCode=edCode->Text; md.machineName=edMachineName->Text; md.Time=edTime->Text; md.ResponsiblePart=edResponsible->Text; md.rpm=StrToInt(edRPM->Text); md.cpc=Main->maindata.cpc; md.hours=StrToFloat(edHours->Text); md.efficiency=StrToInt(edEfficiency->Text); md.count_of_w=StrToInt(edCountOfW->Text); md.yield_per_day= md.rpm*60.0/md.cpc/91.44*md.hours* (md.efficiency/100.0)*md.count_of_w+0.5; md.testw=StrToFloat(edTestWidth->Text); md.testh=StrToFloat(edTestHeight->Text); md.testweight=StrToFloat(edTestWeight->Text); md.cutyard=StrToInt(edCutYard->Text); while(md.Detail->Count){ AnsiString *s=(AnsiString *)md.Detail->Last(); delete s; md.Detail->Remove(s); } Main->maindata.ProductDetail="";//È­ÀÏ ¼³¸í if(mmDetail->Lines->Count){ Main->maindata.ProductDetail=mmDetail->Lines->Strings[0]; } /*for(int i=0;iLines->Count;i++){ md.Detail->Add(new AnsiString(mmDetail->Lines->Strings[i])); }*/ //2007.01.10. diekun ÁٳѱèÀ§Ä¡°¡ Á¦´ë·Î ³Ñ¾î°¥ ¼ö ÀÖµµ·Ï Åëä·Î º¹»çÇÏ°Ô º¯°æ MetaDataForm->mmDetail->SelectAll(); md.Detail->Add(new AnsiString(MetaDataForm->mmDetail->SelText)); MetaDataForm->mmDetail->SelLength = 0; } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::ShowMetaData(){ SetDisabledText(); edCode->Text=Main->maindata.ProductCode; edMachineName->Text=md.machineName; edTime->Text=md.Time; edResponsible->Text=md.ResponsiblePart; edRPM->Text=IntToStr(md.rpm); //edMCPC->Text=MyFloatToStr(md.cpc,2);//SetDisabledText¿¡¼­ ÇØÁÜ edHours->Text=MyFloatToStr(md.hours,2); edEfficiency->Text=IntToStr(md.efficiency); edCountOfW->Text=IntToStr(md.count_of_w); edTestWidth->Text=MyFloatToStr(md.testw,2); edTestHeight->Text=MyFloatToStr(md.testh,2); edTestWeight->Text=MyFloatToStr(md.testweight,3); edCutYard->Text=IntToStr(md.cutyard); mmDetail->Lines->Clear(); for(int i=0;iCount;i++){ AnsiString *s=(AnsiString *)md.Detail->Items[i]; mmDetail->Lines->Add(*s); } //·Î°í À̹ÌÁö¸¦ ÆûÀÇ À̹ÌÁö¿¡ ±×·ÁÁÖ±â 2006.12.08. diekun imgLogoImage->Picture->Assign(md.bmpLogo); //imgLogoImage->Stretch = true; } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::edTestWidthKeyPress(TObject *Sender, char &Key) { if(Key==VK_RETURN){ edTestHeight->SetFocus(); } } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::FormCreate(TObject *Sender) { StringTable.Create(BaseDir, Language, "MetaData"); Caption=IDS_META_DATA; lbMachineName->Caption=IDS_MACHINE_NAME; lbResponsible->Caption=IDS_RESPONSIBLE_PART; lbTime->Caption=IDS_TIME; lbRPM->Caption=IDS_RPM; lbMWidth->Caption=IDS_M_WIDTH; lbMGauge->Caption=IDS_M_GAUGE; lbMCPC->Caption=IDS_M_CPC; lbTest->Caption=IDS_TEST; lbTestWeight->Caption=IDS_TEST_WEIGHT; lbCutYard->Caption=IDS_CUT_YARD; lbHours->Caption=IDS_HOURS; lbEfficiency->Caption=IDS_EFFICIENCY; lbCountOfW->Caption=IDS_COUNT_OF_W; lbSWidth->Caption=IDS_S_WIDTH; lbSGauge->Caption=IDS_S_GAUGE; lbSCPC->Caption=IDS_S_CPC; lbName->Caption=IDS_NAME; lbCode->Caption=IDS_CODE; //gbDetail->Caption=IDS_DETAIL; lbDetail->Caption=IDS_DETAIL; lbLogoImage->Caption = IDS_LOGOIMAGE; btnLogoImage->Caption = IDS_FIND; SetFont(); SetMetaData(); } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::SetFont(){ SetSmallFont(Font); SetSmallFont(lbName->Font); SetSmallFont(lbCode->Font); SetSmallFont(lbResponsible->Font); SetSmallFont(lbTime->Font); SetSmallFont(lbMachineName->Font); SetSmallFont(lbHours->Font); SetSmallFont(lbEfficiency->Font); SetSmallFont(lbRPM->Font); SetSmallFont(lbCountOfW->Font); SetSmallFont(lbMWidth->Font); SetSmallFont(lbSWidth->Font); SetSmallFont(lbMGauge->Font); SetSmallFont(lbSGauge->Font); SetSmallFont(lbMCPC->Font); SetSmallFont(lbSCPC->Font); SetSmallFont(lbTestWeight->Font); SetSmallFont(lbLogoImage->Font); SetSmallFont(lbTest->Font); SetSmallFont(lbCutYard->Font); SetSmallFont(lbDetail->Font); SetSmallFont(lbEfficiency2->Font); SetSmallFont(lbTestWeight2->Font); SetSmallFont(lbTest2->Font); } //--------------------------------------------------------------------------- void __fastcall TMetaDataForm::btnLogoImageClick(TObject *Sender) { //dlgLogoImage->InitialDir; if( !dlgLogoImage->Execute() ) return; AnsiString FileName = dlgLogoImage->FileName; try{ imgLogoImage->Picture->LoadFromFile(FileName); }catch(...){ } if(imgLogoImage->Picture->Height>200){ md.bmpLogo->Height = 200; md.bmpLogo->Width = imgLogoImage->Picture->Width * 200 / imgLogoImage->Picture->Height; Graphics::TBitmap* tempLogo = new Graphics::TBitmap; tempLogo->Assign(imgLogoImage->Picture->Graphic ); HDC dcDst = md.bmpLogo->Canvas->Handle; HDC dcSrc = tempLogo->Canvas->Handle; int oldMod = SetStretchBltMode(dcDst,HALFTONE); StretchBlt(dcDst, 0,0,md.bmpLogo->Width,md.bmpLogo->Height, dcSrc, 0,0,tempLogo->Width,tempLogo->Height, SRCCOPY); oldMod = SetStretchBltMode(dcDst,oldMod); delete tempLogo; }else{ md.bmpLogo->Assign(imgLogoImage->Picture->Graphic); } } //---------------------------------------------------------------------------