//--------------------------------------------------------------------------- #include #pragma hdrstop #include "LibraryFile_F.h" #include "MainImage.h" #include "VecDraw.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzButton" #pragma link "RzEdit" #pragma link "RzLabel" #pragma link "RzPanel" #pragma link "RzRadChk" #pragma resource "*.dfm" TLibraryFileForm *LibraryFileForm; //--------------------------------------------------------------------------- __fastcall TLibraryFileForm::TLibraryFileForm(TComponent* Owner) : TForm(Owner) { rzbitbtnSave->Caption = IDS_COMMON_SAVEAS; rzbitbtnCancel->Caption = IDS_COMMON_BUTTONCANCEL; } //--------------------------------------------------------------------------- void __fastcall TLibraryFileForm::InitForm(LItem Item) { IsModify = false; strPath = LibraryForm->Directory; int width = 0, height = 0; if (MainImageForm->WorkArea && MainImageForm->WorkArea->Mask){ width = MainImageForm->WorkArea->Range.right - MainImageForm->WorkArea->Range.left; height = MainImageForm->WorkArea->Range.bottom - MainImageForm->WorkArea->Range.top; } else { width = MainImageForm->iMainImage->uBitmap->Width; height = MainImageForm->iMainImage->uBitmap->Height; } strSizeInfo = IntToStr(width) + L" x " + IntToStr(height); if (MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8){ strColorInfo = "256 Color"; } else { strColorInfo = "Full Color"; } IsBitmap = true; if (hasVector()){ rzrbVector->Enabled = true; } else rzrbVector->Enabled = false; View(); } //--------------------------------------------------------------------------- void __fastcall TLibraryFileForm::View() { rzlbPath->Caption = L"Path : " + strPath; rzlbSize->Caption = L"Size : " + strSizeInfo; rzlbColor->Caption = L"Color : " + strColorInfo; if (IsBitmap){ rzrbBitmap->Checked = true; } else { rzrbVector->Checked = true; } if (IsModify) { rzgbKind->Enabled = false; rzedFileName->Enabled = false; //rzbitbtnSave->Visible = false; } else { rzgbKind->Enabled = true; //rzbitbtnSave->Visible = true; } } //--------------------------------------------------------------------------- void __fastcall TLibraryFileForm::rzrbBitmapClick(TObject *Sender) { IsBitmap = true; } //--------------------------------------------------------------------------- void __fastcall TLibraryFileForm::rzrbVectorClick(TObject *Sender) { IsBitmap = false; } //--------------------------------------------------------------------------- bool __fastcall TLibraryFileForm::hasVector() { if ((VecDraw->NVector->DataList != NULL) && (VecDraw->NVector->DataList->Count > 0)){ if (MainImageForm->WorkArea && MainImageForm->WorkArea->Mask){ int count = 0; TRect Src = MainImageForm->WorkArea->Range; for (int i = 0; i < VecDraw->NVector->DataList->Count; i++) { TVecData *data = (TVecData*)VecDraw->NVector->DataList->Items[i]; if (!VecDraw->InRectMethod(Src, data, method, true)) continue; count++; } if (count > 0) return true; else return false; } else return true; } else return false; } //--------------------------------------------------------------------------- void __fastcall TLibraryFileForm::FormCloseQuery(TObject *Sender, bool &CanClose) { if (ModalResult == mrOk) { if (rzedFileName->Text.IsEmpty()){ ShowMessage(IDS_MESSAGE_INPUTFILE); CanClose = false; } } } //---------------------------------------------------------------------------