//--------------------------------------------------------------------------- #include #include #include #pragma hdrstop #include "Palette.h" #include "ColorChart.h" #include "ColorLibrary_f.h" #include "CommonPrint.h" #include "FullView.h" #include "MainImage.h" #include "PalFileManager.h" #if defined(TEXTILE) || defined(KNIT) #include "PenManager.h" #elif defined (WEAVE) #include "ColorChange_F.h" #endif #ifndef ACADEMY #include "UserColor_F.h" #endif //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "DIB256s" #pragma link "KShape" #pragma link "PGauge" #pragma link "Selector" #pragma link "TPSpin" #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define IDS_FCAPTION StringTable[0] #define IDS_COLORGUIDE StringTable[1] #define IDS_PRINTCOLOR StringTable[2] #define IDS_USERCOLOR StringTable[3] #define IDS_SEARCH StringTable[4] #define IDS_FINDER StringTable[5] #define IDS_CODE StringTable[6] #define IDS_LOCATE StringTable[7] #define IDS_SUBDIR StringTable[8] #define IDS_CNONE StringTable[9] #define IDS_CFIND StringTable[10] #define IDS_DISPLAY StringTable[11] #define IDS_SIZE StringTable[12] #define IDS_SMALL StringTable[13] #define IDS_LARGE StringTable[14] #define IDS_STARTPAGE StringTable[15] #define IDS_NUMBERPAGE StringTable[16] #define IDS_START StringTable[17] #define IDS_TOLIBRARY StringTable[18] #define IDS_CMY StringTable[19] #define IDS_HLS StringTable[20] #define IDS_LIBRARY StringTable[21] #define IDS_CHART StringTable[22] #define IDS_PROTECTION StringTable[23] #define IDS_COLORUNDO StringTable[24] #define IDS_COLORSEARCH StringTable[25] #define IDS_TOPANTONE StringTable[26] //k3dogs 20001211 #define CHeight 158 //--------------------------------------------------------------------------- TPaletteForm *PaletteForm; //--------------------------------------------------------------------------- __fastcall TPaletteForm::TPaletteForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::FormClose(TObject *Sender, TCloseAction &Action) { Visible = False; if (FOnUpdateMenu) FOnUpdateMenu(Sender); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::FormCreate(TObject *Sender) { //==================================================================== StringTable.Create(DirectoryBin, Language, "Palette"); SetFont(); Caption = IDS_FCAPTION; sbColorGuide->Caption = IDS_COLORGUIDE; sbPrinterColor->Caption = IDS_PRINTCOLOR; sbUserColor->Caption = IDS_USERCOLOR; TabSheetLibrarySearch->Caption = IDS_SEARCH; TabSheetLibraryFinder->Caption = IDS_FINDER; TabSheetLibraryPrint->Caption = IDS_COMMON_PRINT; LabelCode->Caption = IDS_CODE; LocateSearch->Caption = IDS_LOCATE; CheckBoxSearch->Caption = IDS_SUBDIR; LabelLibrarySearch->Caption = IDS_CNONE; ButtonLibrarySearchOK->Caption = IDS_COMMON_BUTTONOK; CheckBoxLibrary->Caption = IDS_DISPLAY; Label8->Caption = IDS_CODE; LocateFinder->Caption = IDS_LOCATE; CheckBoxFinder->Caption = IDS_SUBDIR; Label4->Caption = IDS_SIZE; Label5->Caption = IDS_STARTPAGE; Label6->Caption = IDS_NUMBERPAGE; Label7->Caption = IDS_LOCATE; ButtonLibraryPrintStart->Caption = IDS_START; ButtonCMYToLibrary->Caption = IDS_TOLIBRARY; ButtonHLSToLibrary->Caption = IDS_TOLIBRARY; ButtonCMYToPantone->Caption = IDS_TOPANTONE; //k3dogs 20001211 ButtonHLSToPantone->Caption = IDS_TOPANTONE; //Pantone Code ButtonProtect->Caption = IDS_COMMON_BUTTONOK; sbCMY->Hint = IDS_CMY; sbHLS->Hint = IDS_HLS; sbLibrary->Hint = IDS_LIBRARY; sbFile->Hint = IDS_COMMON_FILE; sbChart->Hint = IDS_CHART; sbProtect->Hint = IDS_PROTECTION; sbUndo->Hint = IDS_COLORUNDO; SpeedButtonProtectNew->Hint = IDS_COMMON_NEW; SpeedButtonProtectAll->Hint = IDS_COMMON_ALL; SpeedButtonProtectOne->Hint = IDS_COMMON_BLOCKCOLOR; SpeedButtonProtectDelete->Hint = IDS_COMMON_INSERTCOLOR; SpeedButtonProtectBefore->Hint = IDS_COMMON_BEFORECOLOR; Label10->Caption = IDS_CODE; Label9->Caption = IDS_CNONE; Button1->Caption = IDS_COMMON_BUTTONOK; // sbSearch->Caption = IDS_COLORSEARCH; // sbSearch->Hint = IDS_COLORSEARCH; EditLocateSearch->Text = DirectoryColor; //==================================================================== ClientWidth = 248; ClientHeight = CHeight - SpeedButtonExit->Height; ColorBackup = new TList; Item = 0; isChoice = isSave = false; ButtonLibrarySearchOK->Enabled = false; Button1->Enabled = false; PageControlLibrary->BringToFront(); #ifdef ACADEMY sbTPStandard->Enabled = false; sbTPTextile->Enabled = false; sbUserColor->Enabled = false; sbProtect->Enabled = false; ButtonCMYToLibrary->Enabled = false; ButtonHLSToLibrary->Enabled = false; ButtonLibraryPrintStart->Enabled = false; #endif undosw = false; //lhskys undosw Ãʱâ tocode = true; //k3dogs bColorCh = true; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::FormDestroy(TObject *Sender) { DestroyPantone(); DeleteColorBackup(); delete ColorBackup; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if ( Key == 13 && PanelProtect->Enabled && PanelProtect->Visible ) ButtonProtectClick(this); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::BGColorClick(TObject *Sender) { DIB256Palette->ChoiceIndex = 1; if (FOnChoiceColor) FOnChoiceColor(1); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::BGColorMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { DIB256Palette->CursorIndex = 1; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteChoiceIndexChange( TObject *Sender) { if ((Item==1) || (Item==2))SaveColorBackup(); switch (Item) { case 1: SetCMY(); break; case 2: SetHLS(); break; case 3: if (ItemLibrary==0) { ColorLibraryForm->StringGrid->Row = DIB256Palette->ChoiceIndex; ColorLibraryForm->View(); } if (PageControlLibrary->ActivePage==TabSheetLibraryFinder) Finder(DIB256Palette->ChoiceIndex); break; case 5: ColorChartForm->SetColor(DIB256Palette->ChoiceIndex); break; #if defined(TEXTILE) || defined(KNIT) case 6: ColorSelectorProtect->AddColor(DIB256Palette->ChoiceIndex); break; #endif } if (DIB256Palette->ChoiceIndex>BackgroundIndex) { FGColor->Brush->Color = DIB256Palette->FGColor; } else { FGColor->Brush->Color = DIB256Palette->BGColor; } FGColor->Text = DIB256Palette->ChoiceIndex-1; FGColor->Text1 = DIB256Palette->UseColor-1; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteColorChange(TObject *Sender) { BGColor->Brush->Color = DIB256Palette->BGColor; if (DIB256Palette->ChoiceIndex>BackgroundIndex) { FGColor->Brush->Color = DIB256Palette->FGColor; } else { FGColor->Brush->Color = DIB256Palette->BGColor; } FGColor->Text = DIB256Palette->ChoiceIndex-1; FGColor->Text1 = DIB256Palette->UseColor-1; if (FOnColorChange) FOnColorChange(Sender); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteCursorIndexChange( TObject *Sender) { CursorColor->Brush->Color = DIB256Palette->CursorColor; #if defined(TEXTILE) if (MainImageForm->iMainImage->Bitmap->BitsPerPixel==8) { CursorColor->Text = DIB256Palette->CursorIndex-1; } #elif defined(WEAVE) || defined(PILE) CursorColor->Text = DIB256Palette->CursorIndex-1; #elif defined(KNIT) if (DesignMode != D_MARK) CursorColor->Text = DIB256Palette->CursorIndex-1; #endif if (FOnCursorIndexChange) FOnCursorIndexChange(Sender); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteDragDrop(TObject *Sender, TObject *Source, int X, int Y) { #ifndef ACADEMY if(Source!=UserColorLibForm->StringGrid)return; UserColorLibForm->isDrag=false; lpUserColorData ucd; AnsiString fn = UserColorLibForm->Caption; int u = DIB256Palette->MouseCoord(X, Y); int k,l=0; for(int i = UserColorLibForm->StringGrid->Selection.Top; i <= UserColorLibForm->StringGrid->Selection.Bottom; i++) for(int j = UserColorLibForm->StringGrid->Selection.Left; j <= UserColorLibForm->StringGrid->Selection.Right; j++){ k=i*5+j; if (!((UserColorLibForm->store->Count>0) && (k < UserColorLibForm->store->Count)))return; if(u+l>251)return; PaletteForm->SaveColorBackup(); ucd = (lpUserColorData) UserColorLibForm->store->Items[k]; PaletteForm->DIB256Palette->SetUserColor(u+l, ucd->Kind, ucd->Page, ucd->Number, ucd->RGB.rgbRed, ucd->RGB.rgbGreen, ucd->RGB.rgbBlue, fn.c_str(), ucd->Name); #if defined(WEAVE) if (ColorChangeForm) ::RepaintColorChange(); else ::RepaintYarnColor(); #elif defined(PILE) ::RepaintYarnColor(); #elif defined(KNIT) ::KnitRepaintColor(); #else ::RepaintColor(); #endif l++; } #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteDragOver(TObject *Sender, TObject *Source, int X, int Y, TDragState State, bool &Accept) { #ifndef ACADEMY if (Source == UserColorLibForm->StringGrid) Accept = true; else Accept = false; #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { int k = DIB256Palette->MouseCoord(X, Y); if (MainImageForm && Button == mbRight) { if (MainImageForm->iMainImage->Bitmap->BitsPerPixel != 8) { MainImageForm->Palette->UseColor = k; DIB256Palette->Palette->UseColor = k; FGColor->Text1 = k-1; } } if (FOnChoiceColor) FOnChoiceColor(k); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteUseColorChange(TObject *Sender) { FGColor->Text1 = DIB256Palette->UseColor-1; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbCMYClick(TObject *Sender) { bool sw; if (Item==1) sw = false; else sw = true; ExitItem(); isChoice = isSave = false; //k3dogs if (sw) { isChoice = true; ShapeCMY->Brush->Color = clRed; ClientHeight = CHeight+PanelCMY->Height; PanelCMY->Left = 0; PanelCMY->Top = CHeight+1; PanelCMY->Enabled = true; PanelCMY->Visible = true; Item = 1; SetCMY(); } Show(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbHLSClick(TObject *Sender) { bool sw; if (Item==2) sw = false; else sw = true; ExitItem(); isChoice = isSave = false; //k3dogs if (sw) { isChoice = true; ShapeHLS->Brush->Color = clRed; ClientHeight = CHeight+PanelHLS->Height; PanelHLS->Left = 0; PanelHLS->Top = CHeight+1; PanelHLS->Enabled = true; PanelHLS->Visible = true; Item = 2; SetHLS(); } Show(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbLibraryClick(TObject *Sender) { bool sw; if (Item==3) sw = false; else sw = true; ExitItem(); if (sw) { ShapeLibrary->Brush->Color = clRed; ClientHeight = CHeight+PanelLibrary->Height; PanelLibrary->Left = 0; PanelLibrary->Top = CHeight+1; PanelLibrary->Enabled = true; PanelLibrary->Visible = true; PageControlLibrary->Enabled = true; //lhskys óÀ½ µé¾î°¥¶§ ColorGuide°¡ down µÇ¾î Àִ°ÍÀ» ¸ÂÃã... Item = 3; #ifndef ACADEMY if (sbColorGuide->Down) ItemLibrary = 0; else if (sbPrinterColor->Down) ItemLibrary = 1; else if (sbTPStandard->Down) ItemLibrary = 2; else if (sbTPTextile->Down) ItemLibrary = 3; else if (sbUserColor->Down) ItemLibrary = 4; #else if (sbColorGuide->Down) ItemLibrary = 0; else if (sbPrinterColor->Down) ItemLibrary = 1; #endif if ((ItemLibrary) && (ItemLibrary != 4)) { PageControlLibrary->ActivePage = TabSheetLibrarySearch; EditLibrarySearch->SetFocus(); } ComboBoxSize->ItemIndex = 0; #ifndef ACADEMY if (CheckBoxLibrary->Checked) { if (ItemLibrary != 4) { ColorLibraryForm->Visible = true; UserColorLibForm->Visible = false; #if defined(KNIT) #ifndef dogtest ColorLibraryForm->InitForm(&MainImageForm->iMainImage->ArrayBitmap[0]); #endif #else ColorLibraryForm->InitForm(MainImageForm->iMainImage->Bitmap); #endif } else { ColorLibraryForm->Visible = false; UserColorLibForm->Visible = true; UserColorLibForm->Show(); } } #else if (CheckBoxLibrary->Checked) { ColorLibraryForm->Visible = true; #if defined(KNIT) ColorLibraryForm->InitForm(&MainImageForm->iMainImage->ArrayBitmap[0]); #else ColorLibraryForm->InitForm(MainImageForm->iMainImage->Bitmap); #endif } #endif } Show(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbFileClick(TObject *Sender) { AnsiString dir = GetCurrentDir(); ExitItem(); TPFMForm *Form = new TPFMForm(this); Form->ShowModal(); delete Form; SetCurrentDir(dir); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbChartClick(TObject *Sender) { bool sw; if (Item==5) sw = false; else sw = true; ExitItem(); if (sw) { ShapeChart->Brush->Color = clRed; Item = 5; ColorChartForm->Visible = true; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbProtectClick(TObject *Sender) { bool sw; int i; #if defined(TEXTILE) if (Item==6) sw = false; else sw = true; ExitItem(); if (sw) { ShapeProtect->Brush->Color = clRed; ClientHeight = CHeight+PanelProtect->Height; PanelProtect->Left = 0; PanelProtect->Top = CHeight+1; PanelProtect->Enabled = true; PanelProtect->Visible = true; ButtonProtect->SetFocus(); //lhskys ¿£ÅÍ·Î ½ÇÇàÇϱâ À§Çؼ­ focus¸¦ ÁØ´Ù Item = 6; MainImageForm->bDrawPen = false; ColorSelectorProtect->SetPalette(MainImageForm->Palette); for (i=1; i<=251; i++) { if (MainImageForm->Palette->ColorData[i]->Protect==1) { ColorSelectorProtect->AddColor(i); } } } Show(); # elif defined(KNIT) if (DesignMode == D_YARN) { if (Item==6) sw = false; else sw = true; ExitItem(); if (sw) { ShapeProtect->Brush->Color = clRed; ClientHeight = CHeight+PanelProtect->Height; PanelProtect->Left = 0; PanelProtect->Top = CHeight+1; PanelProtect->Enabled = true; PanelProtect->Visible = true; Item = 6; MainImageForm->bDrawPen = false; ColorSelectorProtect->SetPalette(MainImageForm->Palette); for (i=1; i<=251; i++) { if (MainImageForm->Palette->ColorData[i]->Protect==1) { ColorSelectorProtect->AddColor(i); } } } Show(); } #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonExitClick(TObject *Sender) { ExitItem(); ClientHeight = CHeight - SpeedButtonExit->Height; isChoice = isSave = false; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbColorGuideClick(TObject *Sender) { DestroyPantone(); ItemLibrary = 0; PageControlLibrary->ActivePage = TabSheetLibrarySearch; EditLibrarySearch->Text = ""; EditLibrarySearch->EditMask = ""; EditLibrarySearch->Enabled = false; LabelLibrarySearch->Caption = IDS_CNONE; ShapeLibrarySearch->Brush->Color = clWhite; EditLocateSearch->Enabled = false; spLocateSearch->Enabled = false; EditLocateFinder->Enabled = false; spLocateFinder->Enabled = false; EditLocatePrint->Enabled = false; spLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; PageControlLibrary->Enabled = false; #ifndef ACADEMY UserColorLibForm->Visible = false; #endif if (CheckBoxLibrary->Checked) ColorLibraryForm->Visible = true; ColorLibraryForm->ChangeItem(ItemLibrary, MainImageForm->iMainImage->Bitmap); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbTPStandardClick(TObject *Sender) { #ifndef ACADEMY DestroyPantone(); ItemLibrary = 2; BlockNumber = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; EditLocateSearch->Enabled = false; spLocateSearch->Enabled = false; EditLocateFinder->Enabled = false; spLocateFinder->Enabled = false; EditLocatePrint->Enabled = false; spLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; EditLibrarySearch->Enabled = true; EditLibrarySearch->Text = ""; EditLibrarySearch->EditMask = ""; UserColorLibForm->Visible = false; if (CheckBoxLibrary->Checked) ColorLibraryForm->Visible = true; ColorLibraryForm->ChangeItem(ItemLibrary); EditLibrarySearch->SetFocus(); #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbPrinterColorClick(TObject *Sender) { DestroyPantone(); ItemLibrary = 1; hh = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; EditLocateSearch->Enabled = false; spLocateSearch->Enabled = false; EditLocateFinder->Enabled = false; spLocateFinder->Enabled = false; EditLocatePrint->Enabled = false; spLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; EditLibrarySearch->Enabled = true; EditLibrarySearch->Text = ""; EditLibrarySearch->EditMask = "99\-99:99;1"; #ifndef ACADEMY UserColorLibForm->Visible = false; #endif if (CheckBoxLibrary->Checked) ColorLibraryForm->Visible = true; ColorLibraryForm->ChangeItem(ItemLibrary); EditLibrarySearch->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbTPTextileClick(TObject *Sender) { #ifndef ACADEMY DestroyPantone(); ItemLibrary = 3; BlockNumber = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; EditLocateSearch->Enabled = false; spLocateSearch->Enabled = false; EditLocateFinder->Enabled = false; spLocateFinder->Enabled = false; EditLocatePrint->Enabled = false; spLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; EditLibrarySearch->Enabled = true; EditLibrarySearch->Text = ""; EditLibrarySearch->EditMask = "99\-9999;1"; UserColorLibForm->Visible = false; if (CheckBoxLibrary->Checked) ColorLibraryForm->Visible = true; ColorLibraryForm->ChangeItem(ItemLibrary); EditLibrarySearch->SetFocus(); #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbUserColorClick(TObject *Sender) { #ifndef ACADEMY DestroyPantone(); ItemLibrary = 4; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; EditLocateSearch->Enabled = true; spLocateSearch->Enabled = true; EditLocateFinder->Enabled = true; spLocateFinder->Enabled = true; EditLocatePrint->Enabled = true; spLocatePrint->Enabled = true; CheckBoxSearch->Enabled = true; CheckBoxFinder->Enabled = true; EditLibrarySearch->Enabled = true; EditLibrarySearch->Text = ""; EditLibrarySearch->EditMask = ""; LabelLibrarySearch->Caption = IDS_CNONE; ShapeLibrarySearch->Brush->Color = clWhite; ColorLibraryForm->Visible = false; if (CheckBoxLibrary->Checked) { UserColorLibForm->Visible = true; UserColorLibForm->Show(); } #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbSearchClick(TObject *Sender) { CreatePantone(); edSearch->Text = ""; Label9->Caption = IDS_CNONE; Shape1->Brush->Color = clWhite; ColorSearchItem = -1; if (CheckBoxLibrary->Checked) { CheckBoxLibrary->Checked = false; CheckBoxLibraryClick(Sender); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::edSearchChange(TObject *Sender) { int n; unsigned short p; PPantone1000Data p1; PPantoneTextileData pt; unsigned char r, g, b; #ifndef ACADEMY ColorSearchItem = -1; Pantone1000->SearchCode(edSearch->Text, BlockNumber, DataNumber); if (BlockNumber>=0) { n = BlockNumber-2; if (n<0) n = 0; else if (n>Pantone1000->Block->Count-5) n = Pantone1000->Block->Count-5; ColorLibraryForm->ScrollBarPantone->Position = n; p1 = Pantone1000->Search(BlockNumber, DataNumber, p); Label9->Caption = IDS_CFIND; Button1->Enabled = true; Button1->SetFocus(); //lhskys Shape1->Brush->Color = RGB2TColor(p1->Color.red, p1->Color.green, p1->Color.blue); ColorSearchItem = 0; } else { PantoneTextile->SearchCode(edSearch->Text, BlockNumber, DataNumber); if (BlockNumber>=0) { n = BlockNumber-2; if (n<0) n = 0; else if (n>PantoneTextile->Block->Count-5) n = PantoneTextile->Block->Count-5; ColorLibraryForm->ScrollBarPantone->Position = n; pt = PantoneTextile->Search(BlockNumber, DataNumber, p); Label9->Caption = IDS_CFIND; Button1->Enabled = true; Button1->SetFocus(); //lhskys Shape1->Brush->Color = RGB2TColor(pt->Color.red, pt->Color.green, pt->Color.blue); ColorSearchItem = 1; } else { Label9->Caption = IDS_CNONE; Button1->Enabled = false; Shape1->Brush->Color = clWhite; ColorSearchItem = -1; } } ColorLibraryForm->View(); #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::edSearchClick(TObject *Sender) { edSearch->SelectAll(); edSearch->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::Button1Click(TObject *Sender) { Byte r, g, b; Word p; int k; PPantone1000Data p1; PPantoneTextileData pt; #ifndef ACADEMY SaveColorBackup(); k = DIB256Palette->ChoiceIndex; if (ColorSearchItem < 0) return; if (ColorSearchItem == 0) { p1 = Pantone1000->Search(BlockNumber, DataNumber, p); DIB256Palette->SetPantone1000(k, p, p1->Number, p1->Color.red, p1->Color.green, p1->Color.blue); } else if (ColorSearchItem == 1) { pt = PantoneTextile->Search(BlockNumber, DataNumber, p); DIB256Palette->SetPantoneTextile(k, p, pt->Number, pt->Color.red, pt->Color.green, pt->Color.blue); } RepaintImage(); ColorLibraryForm->View(); #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::CheckBoxLibraryClick(TObject *Sender) { #ifndef ACADEMY if (CheckBoxLibrary->Checked) { if (ItemLibrary != 4) { ColorLibraryForm->Visible = true; UserColorLibForm->Visible = false; #if defined(KNIT) #ifndef dogtest ColorLibraryForm->InitForm(&MainImageForm->iMainImage->ArrayBitmap[0]); #endif #else ColorLibraryForm->InitForm(MainImageForm->iMainImage->Bitmap); #endif } else { ColorLibraryForm->Visible = false; UserColorLibForm->Visible = true; UserColorLibForm->Show(); } } else { if (ItemLibrary != 4) ColorLibraryForm->ExitForm(); ColorLibraryForm->Visible = false; UserColorLibForm->Visible = false; } #else if (CheckBoxLibrary->Checked) { ColorLibraryForm->Visible = true; #if defined(KNIT) ColorLibraryForm->InitForm(&MainImageForm->iMainImage->ArrayBitmap[0]); #else ColorLibraryForm->InitForm(MainImageForm->iMainImage->Bitmap); #endif } else { ColorLibraryForm->ExitForm(); ColorLibraryForm->Visible = false; } #endif if ((ItemLibrary) && (ItemLibrary != 4) && (PageControlLibrary->ActivePage==TabSheetLibrarySearch)) EditLibrarySearch->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PageControlLibraryChange(TObject *Sender) { unsigned short p; if (PageControlLibrary->ActivePage==TabSheetLibraryFinder) { Finder(DIB256Palette->ChoiceIndex); } else if (PageControlLibrary->ActivePage==TabSheetLibraryPrint) { switch (ItemLibrary) { case 1: ComboBoxSize->Enabled = false; EditStart->Enabled = true; EditNumber->Enabled = true; if(CheckBoxLibrary->Checked) EditStart->Text = ColorLibraryForm->StartPage+1; else EditStart->Text = "1"; EditNumber->Text = "1"; break; #ifndef ACADEMY case 2: ComboBoxSize->Enabled = true; EditStart->Enabled = true; EditNumber->Enabled = true; if(CheckBoxLibrary->Checked) StandardColor->Search(ColorLibraryForm->ScrollBarPantone->Position, 0, p); else StandardColor->Search(0, 0, p); EditStart->Text = p; EditNumber->Text = "1"; break; case 3: ComboBoxSize->Enabled = true; EditStart->Enabled = true; EditNumber->Enabled = true; if(CheckBoxLibrary->Checked) TextileColor->Search(ColorLibraryForm->ScrollBarPantone->Position, 0, p); else TextileColor->Search(0, 0, p); EditStart->Text = p; EditNumber->Text = "1"; break; case 4: ComboBoxSize->Enabled = false; EditStart->Enabled = false; EditNumber->Enabled = false; break; #endif } } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLibrarySearchChange(TObject *Sender) { int n; unsigned short p; PStandardColorData p1; PTextileColorData pt; unsigned char r, g, b; #ifndef ACADEMY lpUserColorData ucd; #endif switch (ItemLibrary) { case 1: if (PrinterColor->SearchPrinterColor(EditLibrarySearch->Text, hh, ll, ss)) { if (hh>=0) { ColorLibraryForm->PrinterColorPageChange(hh-1); ColorLibraryForm->StringGrid->Row = ss; ColorLibraryForm->StringGrid->Col = ll; LabelLibrarySearch->Caption = IDS_CFIND; ButtonLibrarySearchOK->Enabled = true; PrinterColor->SetCode(hh-1, ll-1, ss-1); HLS2RGB(PrinterColor->Hue, PrinterColor->Lig, PrinterColor->Sat, r, g, b); ShapeLibrarySearch->Brush->Color = (TColor)((b<<16)|(g<<8)|r); } } else { LabelLibrarySearch->Caption = IDS_CNONE; ButtonLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; #ifndef ACADEMY case 2: StandardColor->SearchCode(EditLibrarySearch->Text, BlockNumber, DataNumber); if (BlockNumber>=0) { n = BlockNumber-2; if (n<0) n = 0; else if (n>StandardColor->Block->Count-5) n = StandardColor->Block->Count-5; ColorLibraryForm->ScrollBarPantone->Position = n; p1 = StandardColor->Search(BlockNumber, DataNumber, p); LabelLibrarySearch->Caption = IDS_CFIND; ButtonLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = RGB2TColor(p1->Color.red, p1->Color.green, p1->Color.blue); } else { LabelLibrarySearch->Caption = IDS_CNONE; ButtonLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; case 3: TextileColor->SearchCode(EditLibrarySearch->Text, BlockNumber, DataNumber); if (BlockNumber>=0) { n = BlockNumber-2; if (n<0) n = 0; else if (n>TextileColor->Block->Count-5) n = TextileColor->Block->Count-5; ColorLibraryForm->ScrollBarPantone->Position = n; pt = TextileColor->Search(BlockNumber, DataNumber, p); LabelLibrarySearch->Caption = IDS_CFIND; ButtonLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = RGB2TColor(pt->Color.red, pt->Color.green, pt->Color.blue); } else { LabelLibrarySearch->Caption = IDS_CNONE; ButtonLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; case 4: if (UserColorLibForm->SearchUserColor(EditLibrarySearch->Text, EditLocateSearch->Text, CheckBoxSearch->Checked)) { ucd = new TUserColorData; UserColorLibForm->SearchCode(ucd); LabelLibrarySearch->Caption = IDS_CFIND; ButtonLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = (TColor)RGBToTColor(ucd->RGB); delete ucd; } else { LabelLibrarySearch->Caption = IDS_CNONE; ButtonLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; #endif } ColorLibraryForm->View(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLibrarySearchClick(TObject *Sender) { EditLibrarySearch->SelectAll(); EditLibrarySearch->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLibrarySearchKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { if (Key == VK_RETURN) { if (LabelLibrarySearch->Caption == IDS_CNONE) { //=================== 2001.7.20 lhskys °Ë»ö½Ã Äڵ忡 °ø¹éÀÌ ÀÖÀ» °æ¿ì error ¼öÁ¤ //ShowMessage(IDS_MESSAGE_COLORBOOK); //LabelLibrarySearch->Caption = ""; LabelLibrarySearch->Caption = ""; EditLibrarySearch->Clear(); ShowMessage(IDS_MESSAGE_COLORBOOK); //================================= } else if((sbTPStandard->Down)||(sbPrinterColor->Down)||(sbTPTextile->Down)||(sbUserColor->Down)) //lhskys Ä®¶óºÏ¿¡¼­ if (ButtonLibrarySearchOK->Enabled==true)ButtonLibrarySearchOKClick(this); //¿£ÅÍ ½ÇÇà 4°¡Áö°æ¿ì } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLocateSearchChange(TObject *Sender) { TEdit * s = (TEdit *) Sender; EditLocateSearch->Text = s->Text; EditLocateFinder->Text = s->Text; EditLocatePrint->Text = s->Text; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLocateSearchClick(TObject *Sender) { TEdit *s = (TEdit *) Sender; s->SetFocus(); s->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::spLocateSearchClick(TObject *Sender) { if (OpenDialog->Execute()) { EditLocateFinder->Text = OpenDialog->FileName; EditLocateSearch->Text = OpenDialog->FileName; EditLocatePrint->Text = OpenDialog->FileName; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::CheckBoxSearchClick(TObject *Sender) { TCheckBox * s = (TCheckBox *) Sender; if (s->Checked) { CheckBoxSearch->Checked = true; CheckBoxFinder->Checked = true; } else { CheckBoxSearch->Checked = false; CheckBoxFinder->Checked = false; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ButtonLibrarySearchOKClick(TObject *Sender) { Byte r, g, b; Word p; int k; PStandardColorData p1; PTextileColorData pt; #ifndef ACADEMY lpUserColorData ucd; #endif SaveColorBackup(); k = DIB256Palette->ChoiceIndex; switch (ItemLibrary) { case 1: PrinterColor->SetCode(hh-1, ll-1, ss-1); HLS2RGB(PrinterColor->Hue, PrinterColor->Lig, PrinterColor->Sat, r, g, b); DIB256Palette->SetPrinterColor(k, PrinterColor->Page, PrinterColor->Number, r, g, b); break; #ifndef ACADEMY case 2: p1 = StandardColor->Search(BlockNumber, DataNumber, p); DIB256Palette->SetTPStandardColor(k, p, p1->Number, p1->Color.red, p1->Color.green, p1->Color.blue); break; case 3: pt = TextileColor->Search(BlockNumber, DataNumber, p); DIB256Palette->SetTPTextileColor(k, p, pt->Number, pt->Color.red, pt->Color.green, pt->Color.blue); break; case 4: ucd = new TUserColorData; UserColorLibForm->SearchCode(ucd); DIB256Palette->SetUserColor(DIB256Palette->ChoiceIndex, ucd->Kind, ucd->Page, ucd->Number, ucd->RGB.rgbRed, ucd->RGB.rgbGreen, ucd->RGB.rgbBlue, EditLocateSearch->Text.c_str(), ucd->Name); DIB256Palette->Repaint(); delete ucd; break; #endif } RepaintImage(); ColorLibraryForm->View(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLocateFinderChange(TObject *Sender) { TEdit * s = (TEdit *) Sender; EditLocateSearch->Text = s->Text; EditLocateFinder->Text = s->Text; EditLocatePrint->Text = s->Text; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLocateFinderClick(TObject *Sender) { TEdit *s = (TEdit *) Sender; s->SetFocus(); s->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::spLocateFinderClick(TObject *Sender) { if (OpenDialog->Execute()) { EditLocateFinder->Text = OpenDialog->FileName; EditLocateSearch->Text = OpenDialog->FileName; EditLocatePrint->Text = OpenDialog->FileName; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::CheckBoxFinderClick(TObject *Sender) { TCheckBox * s = (TCheckBox *) Sender; if (s->Checked) { CheckBoxSearch->Checked = true; CheckBoxFinder->Checked = true; } else { CheckBoxSearch->Checked = false; CheckBoxFinder->Checked = false; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditStartClick(TObject *Sender) { EditStart->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditNumberClick(TObject *Sender) { EditNumber->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::EditLocatePrintClick(TObject *Sender) { TEdit *s = (TEdit *) Sender; s->SetFocus(); s->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::spLocatePrintClick(TObject *Sender) { if (OpenDialog->Execute()) { EditLocateFinder->Text = OpenDialog->FileName; EditLocateSearch->Text = OpenDialog->FileName; EditLocatePrint->Text = OpenDialog->FileName; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ButtonLibraryPrintStartClick(TObject *Sender) { #ifndef ACADEMY TCommonPrintForm *Form = NULL; TCursor cursor; if ((Form = new TCommonPrintForm((TComponent *)NULL))==NULL) return; if (Form->ShowModal() == mrOk) { cursor = Screen->Cursor; Screen->Cursor = crHourGlass; switch (ItemLibrary) { case 1: PrintPrinterColor(EditStart->Text, EditNumber->Text, Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; case 2: PrintTPStandardColor(ComboBoxSize->ItemIndex, EditStart->Text, EditNumber->Text, Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; case 3: PrintTPTextileColor(ComboBoxSize->ItemIndex, EditStart->Text, EditNumber->Text, Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; case 4: UserColorLibForm->PrintUserColor(Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; } Screen->Cursor = cursor; } delete Form; #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeCyanMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BoolC = true; PGaugeCyan->Progress = 255*(140-Y)/140; PSEditCyan->Value = PGaugeCyan->Progress; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeCyanMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (BoolC) { PGaugeCyan->Progress = 255*(140-Y)/140; PSEditCyan->Value = PGaugeCyan->Progress; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeCyanMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (BoolC) { PGaugeCyan->Progress = 255*(140-Y)/140; PSEditCyan->Value = PGaugeCyan->Progress; } BoolC = false; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeMagentaMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BoolM = true; PGaugeMagenta->Progress = 255*(140-Y)/140; PSEditMagenta->Value = PGaugeMagenta->Progress; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeMagentaMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (BoolM) { PGaugeMagenta->Progress = 255*(140-Y)/140; PSEditMagenta->Value = PGaugeMagenta->Progress; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeMagentaMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (BoolM) { PGaugeMagenta->Progress = 255*(140-Y)/140; PSEditMagenta->Value = PGaugeMagenta->Progress; } BoolM = false; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeYellowMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BoolY = true; PGaugeYellow->Progress = 255*(140-Y)/140; PSEditYellow->Value = PGaugeYellow->Progress; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeYellowMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (BoolY) { PGaugeYellow->Progress = 255*(140-Y)/140; PSEditYellow->Value = PGaugeYellow->Progress; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeYellowMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (BoolY) { PGaugeYellow->Progress = 255*(140-Y)/140; PSEditYellow->Value = PGaugeYellow->Progress; } BoolY = false; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSEditCyanChange(TObject *Sender) { if (PSEditCyan->Text.Length() > 0) { if (isChoice && isSave==false && undosw == false) { SaveColorBackup(); isSave = true; } tocode = true; //k3dogs if (PSEditCyan->Value>255) PSEditCyan->Value = 255; if (PSEditCyan->Value<0) PSEditCyan->Value = 0; PGaugeCyan->Progress = PSEditCyan->Value; CMYCyanChange(); if (bColorCh) DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); CursorColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); FGColor->Brush->Color = CursorColor->Brush->Color; Timer300->Enabled = false; RepaintImage(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSEditCyanClick(TObject *Sender) { TPSpinEdit* psEdit = (TPSpinEdit*) Sender; psEdit->SetFocus(); psEdit->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSEditMagentaChange(TObject *Sender) { if (PSEditMagenta->Text.Length() > 0) { if (isChoice && isSave==false && undosw == false) { SaveColorBackup(); isSave = true; } tocode = true; //k3dogs if (PSEditMagenta->Value>255) PSEditMagenta->Value = 255; if (PSEditMagenta->Value<0) PSEditMagenta->Value = 0; PGaugeMagenta->Progress = PSEditMagenta->Value; CMYMagentaChange(); if (bColorCh) DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); CursorColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); FGColor->Brush->Color = CursorColor->Brush->Color; Timer300->Enabled = false; RepaintImage(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSEditMagentaClick(TObject *Sender) { TPSpinEdit* psEdit = (TPSpinEdit*) Sender; psEdit->SetFocus(); psEdit->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSEditYellowChange(TObject *Sender) { if (PSEditYellow->Text.Length() > 0) { if (isChoice && isSave==false && undosw == false) { SaveColorBackup(); isSave = true; } tocode = true; //k3dogs if (PSEditYellow->Value>255) PSEditYellow->Value = 255; if (PSEditYellow->Value<0) PSEditYellow->Value = 0; PGaugeYellow->Progress = PSEditYellow->Value; CMYYellowChange(); if (bColorCh) DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); CursorColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); FGColor->Brush->Color = CursorColor->Brush->Color; Timer300->Enabled = false; RepaintImage(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSEditYellowClick(TObject *Sender) { TPSpinEdit* psEdit = (TPSpinEdit*) Sender; psEdit->SetFocus(); psEdit->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ShapeCMYOriginColorMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Button == mbLeft) { PGaugeCyan->Progress = FcmyC; PGaugeMagenta->Progress = FcmyM; PGaugeYellow->Progress = FcmyY; PSEditCyan->Value = FcmyC; PSEditMagenta->Value = FcmyM; PSEditYellow->Value = FcmyY; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ButtonCMYToLibraryClick(TObject *Sender) { Show(); if (tocode) {SaveColorBackup(); tocode = false;} //k3dogs RGBQUAD rgb = SearchLibrary(Frgb); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ButtonCMYToPantoneClick(TObject *Sender) { Show(); if (tocode) {SaveColorBackup(); tocode = false;} //k3dogs RGBQUAD rgb = SearchLibrary(Frgb, true); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ImgCircleMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { double r = sqrt((X-70)*(X-70)+(Y-70)*(Y-70)); if ((r>=56)&&(r<=70)) { Img1Chk = true; Img2Chk = false; Change_HS(X, Y); Change_RingPoint(); Change_ShapeHLS(); } else if (r<56) { Img1Chk = false; Img2Chk = true; Change_LS(X, Y); ChangeL_TPoint(); ChangeS_TPoint(); Change_ShapeHLS(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ImgCircleMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (Img1Chk) { Change_HS(X, Y); Change_RingPoint(); Change_ShapeHLS(); } else if (Img2Chk) { Change_LS(X, Y); ChangeL_TPoint(); ChangeS_TPoint(); Change_ShapeHLS(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ImgCircleMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Img1Chk) { Change_RingPoint(); Img1Chk = false; Change_ShapeHLS(); } else if (Img2Chk) { ChangeL_TPoint(); ChangeS_TPoint(); Img2Chk = false; Change_ShapeHLS(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSHlsHChange(TObject *Sender) { if (PSHlsH->Text.Length() > 0) { if (isChoice && isSave==false && undosw == false) { SaveColorBackup(); isSave = true;; } tocode = true; //k3dogs if (PSHlsH->Value>359) PSHlsH->Value = 359; if (PSHlsH->Value<0) PSHlsH->Value = 0; Change_RingPoint(); Change_ShapeHLS(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSHlsHClick(TObject *Sender) { TPSpinEdit* psEdit = (TPSpinEdit*) Sender; psEdit->SetFocus(); psEdit->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSHlsLChange(TObject *Sender) { if (PSHlsL->Text.Length() > 0) { if (isChoice && isSave==false && undosw == false) { SaveColorBackup(); isSave = true;; } tocode = true; //k3dogs if (PSHlsL->Value>100) PSHlsL->Value = 100; if (PSHlsL->Value<0) PSHlsL->Value = 0; ChangeL_TPoint(); Change_ShapeHLS(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSHlsLClick(TObject *Sender) { TPSpinEdit* psEdit = (TPSpinEdit*) Sender; psEdit->SetFocus(); psEdit->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSHlsSChange(TObject *Sender) { if (PSHlsS->Text.Length() > 0) { if (isChoice && isSave==false && undosw == false) { SaveColorBackup(); isSave = true;; } tocode = true; //k3dogs if (PSHlsS->Value>100) PSHlsS->Value = 100; if (PSHlsS->Value<0) PSHlsS->Value = 0; ChangeS_TPoint(); Change_ShapeHLS(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PSHlsSClick(TObject *Sender) { TPSpinEdit* psEdit = (TPSpinEdit*) Sender; psEdit->SetFocus(); psEdit->SelectAll(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ShapeHLSOriginColorMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Button == mbLeft) { PSHlsH->Value = Hue1; PSHlsL->Value = Lig1; PSHlsS->Value = Sat1; Change_ShapeHLS(); } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ButtonHLSToLibraryClick(TObject *Sender) { RGBQUAD rgb; Show(); if (tocode) {SaveColorBackup(); tocode = false;} //k3dogs rgb = SearchLibrary(HLS2RGBQUAD((double) PSHlsH->Value, (double) PSHlsL->Value/100, (double) PSHlsS->Value/100)); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); HS = true; LS = true; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ButtonHLSToPantoneClick(TObject *Sender) { RGBQUAD rgb; Show(); if (tocode) {SaveColorBackup(); tocode = false;} //k3dogs rgb = SearchLibrary(HLS2RGBQUAD((double) PSHlsH->Value, (double) PSHlsL->Value/100, (double) PSHlsS->Value/100), true); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); HS = true; LS = true; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonProtectNewClick(TObject *Sender) { ColorSelectorProtect->Initial(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonProtectAllClick(TObject *Sender) { #if defined(TEXTILE) || defined(KNIT) TCursor cursor = Screen->Cursor; Screen->Cursor = crHourGlass; #ifndef dogtest MainImageForm->SearchWholeColor(ColorSelectorProtect->ChoiceColor); #endif ColorSelectorProtect->Invalid(); Screen->Cursor = cursor; #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonProtectOneClick(TObject *Sender) { if (SpeedButtonProtectOne->Down) SpeedButtonProtectOne->Hint = IDS_COMMON_ONECOLOR; else SpeedButtonProtectOne->Hint = IDS_COMMON_BLOCKCOLOR; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonProtectDeleteClick( TObject *Sender) { if (SpeedButtonProtectDelete->Down) SpeedButtonProtectDelete->Hint = IDS_COMMON_DELETECOLOR; else SpeedButtonProtectDelete->Hint = IDS_COMMON_INSERTCOLOR; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonProtectBeforeClick( TObject *Sender) { ColorSelectorProtect->LoadFromFile(DirectoryItem + "\\Main.ini", "ProtectColor"); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ButtonProtectClick(TObject *Sender) { #if defined(TEXTILE) || defined(KNIT) int i; for (i=0; i<256; i++) DIB256Palette->Palette->ColorData[i]->Protect = 0; for (i=0; iCount; i++) { DIB256Palette->Palette->ColorData[ColorSelectorProtect->Code[i]]->Protect = 1; } #ifndef dogtest MainImageForm->Protect = ColorSelectorProtect->Count>0; #endif SpeedButtonExitClick(Sender); #endif } //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Private Function //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void __fastcall TPaletteForm::ExitItem() { ClientHeight = CHeight - SpeedButtonExit->Height; switch (Item) { case 1: ShapeCMY->Brush->Color = clWhite; PanelCMY->Enabled = false; PanelCMY->Visible = false; sbCMY->Down = false; break; case 2: ShapeHLS->Brush->Color = clWhite; PanelHLS->Enabled = false; PanelHLS->Visible = false; sbHLS->Down = false; break; case 3: ShapeLibrary->Brush->Color = clWhite; ColorLibraryForm->ExitForm(); ColorLibraryForm->Visible = false; #ifndef ACADEMY UserColorLibForm->Visible = false; #endif PanelLibrary->Enabled = false; PanelLibrary->Visible = false; sbLibrary->Down = false; break; case 4: ShapeFile->Brush->Color = clWhite; sbFile->Down = false; break; case 5: ShapeChart->Brush->Color = clWhite; ColorChartForm->Visible = false; break; #if defined(TEXTILE) || defined(KNIT) case 6: ColorSelectorProtect->SaveToFile(DirectoryItem + "\\Main.ini", "ProtectColor"); ColorSelectorProtect->Initial(); ShapeProtect->Brush->Color = clWhite; #ifndef dogtest if (step>0) MainImageForm->DrawRectangleLocate(Temp); #endif step = 0; IsDraw = false;MainImageForm->iMainImage->OnPaintLocate = NULL;/////////////////by jeegeo MainImageForm->bDrawPen = true; PanelProtect->Enabled = false; PanelProtect->Visible = false; sbProtect->Down = false; break; #endif } Item = 0; isChoice = false; } //-------------------------------------------------------------------------- int __fastcall TPaletteForm::CompareColor(RGBQUAD rgb1, RGBQUAD rgb2) { return abs(rgb1.rgbRed-rgb2.rgbRed)+abs(rgb1.rgbGreen-rgb2.rgbGreen)+abs(rgb1.rgbBlue-rgb2.rgbBlue); } //-------------------------------------------------------------------------- RGBQUAD __fastcall TPaletteForm::SearchLibrary(RGBQUAD src, bool pantone)//k3dogs 20001211 Pantone Color·Î ÄÚµåÈ­ Çϱâ À§ÇØ { if (pantone == false) { /////////////////////////// RGBQUAD dst; //To TP Color Word p; PStandardColorData p1; PTextileColorData pt; int e, error; error = -1; #ifndef ACADEMY if (StandardColor->SearchRGB(src.rgbRed, src.rgbGreen, src.rgbBlue, BlockNumber, DataNumber)) { dst = StandardColor->ToRGB(BlockNumber, DataNumber); e = CompareColor(src, dst); error = e; p1 = StandardColor->Search(BlockNumber, DataNumber, p); DIB256Palette->SetTPStandardColor(DIB256Palette->ChoiceIndex, p, p1->Number, dst.rgbRed, dst.rgbGreen, dst.rgbBlue); } if (TextileColor->SearchRGB(src.rgbRed, src.rgbGreen, src.rgbBlue, BlockNumber, DataNumber)) { dst = TextileColor->ToRGB(BlockNumber, DataNumber); e = CompareColor(src, dst); if ((error==-1) || (eSearch(BlockNumber, DataNumber, p); DIB256Palette->SetTPTextileColor(DIB256Palette->ChoiceIndex, p, pt->Number, dst.rgbRed, dst.rgbGreen, dst.rgbBlue); } } #endif if (error==-1) { DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, src.rgbRed, src.rgbGreen, src.rgbBlue); return src; } else { return dst; } } if (pantone == true) { /////////////////////////////////////////////k3dogs 20001211 RGBQUAD dst; // To Pantone Color Code Word p; PPantone1000Data p1; PPantoneTextileData pt; int e, error; error = -1; #ifndef ACADEMY if (Pantone1000->SearchRGB(src.rgbRed, src.rgbGreen, src.rgbBlue, BlockNumber, DataNumber)) { dst = Pantone1000->ToRGB(BlockNumber, DataNumber); e = CompareColor(src, dst); error = e; p1 = Pantone1000->Search(BlockNumber, DataNumber, p); DIB256Palette->SetPantone1000(DIB256Palette->ChoiceIndex, p, p1->Number, dst.rgbRed, dst.rgbGreen, dst.rgbBlue); } if (PantoneTextile->SearchRGB(src.rgbRed, src.rgbGreen, src.rgbBlue, BlockNumber, DataNumber)) { dst = PantoneTextile->ToRGB(BlockNumber, DataNumber); e = CompareColor(src, dst); if ((error==-1) || (eSearch(BlockNumber, DataNumber, p); DIB256Palette->SetPantoneTextile(DIB256Palette->ChoiceIndex, p, pt->Number, dst.rgbRed, dst.rgbGreen, dst.rgbBlue); } } #endif if (error==-1) { DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, src.rgbRed, src.rgbGreen, src.rgbBlue); return src; } else { return dst; } } } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::SetCMY() { bColorCh = false; FcmyC = 255-DIB256Palette->ForegroundRgb.rgbRed; FcmyM = 255-DIB256Palette->ForegroundRgb.rgbGreen; FcmyY = 255-DIB256Palette->ForegroundRgb.rgbBlue; Frgb = DIB256Palette->ForegroundRgb; PGaugeCyan->Progress = FcmyC; // FcmyCSet = FcmyC; //¿øº»Ä÷¯ º¹¿øÀ» À§ÇØ ÀúÀå PGaugeMagenta->Progress = FcmyM; // FcmyMSet = FcmyM; PGaugeYellow->Progress = FcmyY; // FcmyYSet = FcmyY; PSEditCyan->Value = FcmyC; PSEditMagenta->Value = FcmyM; PSEditYellow->Value = FcmyY; //===================================== To view Original Color in CMY Color Change - k3dogs Frgb.rgbRed = 255-PSEditCyan->Value; Frgb.rgbGreen = 255-PSEditMagenta->Value; Frgb.rgbBlue = 255-PSEditYellow->Value; ShapeCMYOriginColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); //==================================================== CMYCyanChange(); CMYMagentaChange(); CMYYellowChange(); bColorCh = true; } //------------------------------------------------------------------------- void __fastcall TPaletteForm::CMYCyanChange() { if (PSEditCyan->Value>255) PSEditCyan->Value = 255; PGaugeCyan->Progress = PSEditCyan->Value; Frgb.rgbRed = 255-PSEditCyan->Value; ShapeCMYColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::CMYMagentaChange() { if (PSEditMagenta->Value>255) PSEditMagenta->Value = 255; PGaugeMagenta->Progress = PSEditMagenta->Value; Frgb.rgbGreen = 255-PSEditMagenta->Value; ShapeCMYColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::CMYYellowChange() { if (PSEditYellow->Value>255) PSEditYellow->Value = 255; PGaugeYellow->Progress = PSEditYellow->Value; Frgb.rgbBlue = 255-PSEditYellow->Value; ShapeCMYColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::SetHLS() { TRect RectImg1; double h, l, s; bColorCh = false; RectImg1 = Rect(0, 0, ImgCircle->Width, ImgCircle->Height); ImgCircle->Canvas->Brush->Color = clBtnFace; ImgCircle->Canvas->FillRect(RectImg1); ImgCircle->Picture->Bitmap->PixelFormat = pf24bit; ImgCircle->Picture->Bitmap->Width = 140; ImgCircle->Picture->Bitmap->Height = 140; ImgCircle->Canvas->Pen->Mode = pmXor; ImgCircle->Canvas->Pen->Color = clWhite; TColor2HLS(RGB2TColor(DIB256Palette->ForegroundRgb.rgbRed, DIB256Palette->ForegroundRgb.rgbGreen, DIB256Palette->ForegroundRgb.rgbBlue), h, l, s); if ((l!=0)&&(s!=0)) { Hue = h + 0.5; Lig = l*100 + 0.5; Sat = s*100 + 0.5; } else if (s==0) { Sat = 0; Lig = l*100 + 0.5; } if (l==0) Lig = 0; Draw_Circle(); Draw_RingPoint(Hue); HS = true; Draw_TriAngle(Hue); Draw_TPoint(Sat, Lig); LS = true; PSHlsH->Value = Hue; PSHlsL->Value = Lig; PSHlsS->Value = Sat; //=================================to view Original Color in HLS Color Change - k3dogs h = (double) PSHlsH->Value; l = (double) PSHlsL->Value/100; s = (double) PSHlsS->Value/100; ShapeHLSOriginColor->Brush->Color = HLS2TColor(h, l, s); Hue1 = Hue; Lig1 = Lig; Sat1 = Sat; //============================================================================== Change_ShapeHLS(); bColorCh = true; } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Draw_Circle() { double h, l, s; Byte r, g, b; int x, y, xx, sol, lim; Byte *sh; l = 0.5; s = 1; for (y=-70; y<70; y++) { sh = (Byte*) ImgCircle->Picture->Bitmap->ScanLine[y+70]; sol = sqrt(4900-y*y); for (x=-sol; x<=sol; x++) { lim = sqrt(x*x+y*y); if (lim<56) continue; xx = 3*(70+x); if (y<0) h = (180*atan2(-y, x)/M_PI); else h =180+(180*atan2(y, -x)/M_PI); HLS2RGB(h, l, s, r, g, b); *(sh+xx) = b; *(sh+xx+1) = g; *(sh+xx+2) = r; } } } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Draw_TriAngle(int Angle) { double x, y, sol; int xx; double h, l, s; Byte r, g, b; Byte *sl1, *sl2; h = Angle; for (y=0; y<=48; y++) { sl1 = (Byte*) ImgCircle->Picture->Bitmap->ScanLine[70+y]; sl2 = (Byte*) ImgCircle->Picture->Bitmap->ScanLine[70-y]; sol =(7*(72-y)/4)-42; for (x=0; x<=sol; x++) { xx = 3*(x+42); if (sol==0) s = 0; else s = x/sol; l = (48-y)/96; HLS2RGB(h, l, s, r, g, b); *(sl1+xx) = b; *(sl1+xx+1) = g; *(sl1+xx+2) = r; l =(48+y)/96; HLS2RGB(h, l, s, r, g, b); *(sl2+xx) = b; *(sl2+xx+1) = g; *(sl2+xx+2) = r; } } } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Draw_RingPoint(int Angle) { double h; h = M_PI*Angle/180; ImgCircle->Canvas->Ellipse(67+(cos(h)*63), 67-(sin(h)*63), 73+(cos(h)*63), 73-(sin(h)*63)); ImgCircle->Update(); } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Draw_TPoint(int S, int L) { int Y1, sol, Y, X; Y = 118-(L*96/100); // Y's range 118 - 22 Y1 = abs(Y-70); // Y1's range 0 - 48 sol =(7*(72-Y1)/4)-42; X = (sol*S/100)+42; ImgCircle->Canvas->Ellipse(X-3, Y-3, X+3, Y+3); ImgCircle->Update(); } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Change_HS(int X, int Y) { int H; X = X-70; Y = Y-70; if (Y<0) H = (180*atan2(-Y, X)/M_PI); else H = 180+(180*atan2(Y, -X)/M_PI); PSHlsH->Value = H; } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Change_RingPoint() { if (HS) Draw_RingPoint(Hue); if (LS) Draw_TPoint(Sat, Lig); Hue = PSHlsH->Value; Draw_TriAngle(Hue); HS = true; Draw_RingPoint(Hue); Draw_TPoint(Sat, Lig); LS = true; } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Change_LS(int X, int Y) { int lim, S; X = X-42; // X's range 0 - 84 Y = Y-22; // Y's range 0 - 96 PSHlsL->Value = 100*(96-Y)/96; Y = abs(Y-48); lim = (48-Y)*7/4; if (lim==0) S = 0; else S = 100*X/lim; PSHlsS->Value = S; } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::ChangeL_TPoint() { if (LS) Draw_TPoint(Sat, Lig); Lig = PSHlsL->Value; Draw_TPoint(Sat, Lig); LS = true; } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::ChangeS_TPoint() { if (LS) Draw_TPoint(Sat, Lig); Sat = PSHlsS->Value; Draw_TPoint(Sat, Lig); LS = true; } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Change_ShapeHLS() { double h, l, s; RGBQUAD c; h = (double) PSHlsH->Value; l = (double) PSHlsL->Value/100; s = (double) PSHlsS->Value/100; ShapeHLSColor->Brush->Color = HLS2TColor(h, l, s); c = HLS2RGBQUAD((double)PSHlsH->Value, (double)PSHlsL->Value/100, (double)PSHlsS->Value/100); if (bColorCh) DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, c.rgbRed, c.rgbGreen, c.rgbBlue); CursorColor->Brush->Color = RGB2TColor(c.rgbRed, c.rgbGreen, c.rgbBlue); FGColor->Brush->Color = CursorColor->Brush->Color; Timer300->Enabled = false; RepaintImage(); } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::Finder(int Index) { RGBQUAD rgb; int n; Word p; PStandardColorData p1; PTextileColorData pt; #ifndef ACADEMY lpUserColorData ucd; #endif AnsiString ColorName, Code; unsigned char r, g, b; int h, l, s; rgb = DIB256Palette->Palette->ColorData[Index]->RGB; switch (ItemLibrary) { case 1: if (PrinterColor->SearchRGB(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue, h, l, s)) { PrinterColor->SetCode(h, l, s); HLS2RGB(PrinterColor->Hue, PrinterColor->Lig, PrinterColor->Sat, r, g, b); ColorLibraryForm->PrinterColorPageChange(h); ColorLibraryForm->StringGrid->Col = l+1; ColorLibraryForm->StringGrid->Row = s+1; LabelLibraryFinder->Caption = Format(" %d-%d-%d", OPENARRAY (TVarRec, (255-r, 255-g, 255-b))); ShapeLibraryFinder->Brush->Color = RGB2TColor(r, g, b); } else { LabelLibraryFinder->Caption = IDS_CNONE; ShapeLibraryFinder->Brush->Color = clWhite; } break; #ifndef ACADEMY case 2: if (StandardColor->SearchRGB(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue, BlockNumber, DataNumber)) { n = BlockNumber-2; if (n<0) n = 0; else if (n>StandardColor->Block->Count-5) n = StandardColor->Block->Count-5; ColorLibraryForm->ScrollBarPantone->Position = n; p1 = StandardColor->Search(BlockNumber, DataNumber, p); ColorName = StandardColor->Code(p1); LabelLibraryFinder->Caption = ColorName; ShapeLibraryFinder->Brush->Color = RGB2TColor(p1->Color.red, p1->Color.green, p1->Color.blue); } else { LabelLibraryFinder->Caption = IDS_CNONE; ShapeLibraryFinder->Brush->Color = clWhite; } break; case 3: if (TextileColor->SearchRGB(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue, BlockNumber, DataNumber)) { n = BlockNumber-2; if (n<0) n = 0; else if (n>TextileColor->Block->Count-5) n = TextileColor->Block->Count-5; ColorLibraryForm->ScrollBarPantone->Position = n; pt = TextileColor->Search(BlockNumber, DataNumber, p); ColorName = TextileColor->Code(pt); LabelLibraryFinder->Caption = ColorName; ShapeLibraryFinder->Brush->Color = RGB2TColor(pt->Color.red, pt->Color.green, pt->Color.blue); } else { LabelLibraryFinder->Caption = IDS_CNONE; ShapeLibraryFinder->Brush->Color = clWhite; } break; case 4: ucd = new TUserColorData; if(UserColorLibForm->SearchRGB(rgb, EditLocateFinder->Text, ucd, CheckBoxFinder->Checked)){ if (ucd->Kind == 0x10) { if (ucd->Page) { Code = PrinterColor->PN2Code(ucd->Page, ucd->Number); Code = Format("(PrinterColor) %s", OPENARRAY(TVarRec, (Code.c_str()))); } else { Code = Format("(Normal) %d - %d - %d", OPENARRAY( TVarRec, (255 - ucd->RGB.rgbRed, 255 - ucd->RGB.rgbGreen, 255 - ucd->RGB.rgbBlue))); } } else if (ucd->Kind == 0x13) { Code = StandardColor->PN2Code(ucd->Page, ucd->Number); Code = Format("(TP Standard) %s", OPENARRAY(TVarRec, (Code.c_str()))); } else if (ucd->Kind == 0x14) { Code = TextileColor->PN2Code(ucd->Page, ucd->Number); Code = Format("(TP Textile) %s", OPENARRAY(TVarRec, (Code.c_str()))); } ColorName = Format("[%s] %s", OPENARRAY (TVarRec, (ucd->Name, Code.c_str()))); LabelLibraryFinder->Caption = ColorName; ShapeLibraryFinder->Brush->Color = (TColor)RGBToTColor(ucd->RGB); } else { LabelLibraryFinder->Caption = IDS_CNONE; ShapeLibraryFinder->Brush->Color = clWhite; } delete ucd; break; #endif } ColorLibraryForm->View(); } //-------------------------------------------------------------------------- void __fastcall TPaletteForm::PrintPrinterColor(AnsiString Start, AnsiString Number, int nPage, bool bFast) { int Page, num; short Sheet, k; Page = StrToInt(Start)-1; //0-35, 36, 37-72 num = StrToInt(Number); if (Page<0) Page = 0; for (Sheet=0; Sheet36) { if (k>72) break; PBitmap(k, 0, 3, nPage, bFast); } else { PBitmap(k, 0, 4, nPage, bFast); } } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PrintTPStandardColor(int Size, AnsiString Start, AnsiString Number, int nPage, bool bFast) { int num, Page, sheet, P; num = StrToInt(Number); Page = StandardColor->SearchPage(StrToInt(Start)); Page = Page - (Page % 5); if (Size == 0) if (Page>StandardColor->Block->Count-20) Page = StandardColor->Block->Count-20; else if (Page>StandardColor->Block->Count-5) Page = StandardColor->Block->Count-5; for (sheet=0; sheet=StandardColor->Block->Count) break; PBitmap(P, Size, 0, nPage, bFast); } else { P = Page+5*sheet; if (P>=StandardColor->Block->Count) break; PBitmap(P, Size, 0, nPage, bFast); } } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PrintTPTextileColor(int Size, AnsiString Start, AnsiString Number, int nPage, bool bFast) { int num, Page, sheet, P; num = StrToInt(Number); Page = TextileColor->SearchPage(StrToInt(Start)); Page = Page - (Page % 5); if (Size == 0) if (Page>TextileColor->Block->Count-20) Page = TextileColor->Block->Count-20; else if (Page>TextileColor->Block->Count-5) Page = TextileColor->Block->Count-5; for (sheet=0; sheet=TextileColor->Block->Count) break; PBitmap(P, Size, 1, nPage, bFast); } else { P = Page+5*sheet; if (P>=TextileColor->Block->Count) break; PBitmap(P, Size, 1, nPage, bFast); } } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::PBitmap(int Page, int Size, int i, int nPage, bool bFast) { TTexpiaBitmap *Bitmap = NULL; AnsiString title; int w, h, tab; TCanvas *Canvas = NULL; if ((Bitmap = new TTexpiaBitmap)==NULL) goto fail; w = GetDeviceCaps(Printer()->Handle, HORZRES)*160/ GetDeviceCaps(Printer()->Handle, LOGPIXELSX); h = GetDeviceCaps(Printer()->Handle, VERTRES)*160/ GetDeviceCaps(Printer()->Handle, LOGPIXELSY); if (!Bitmap->Create(w, h, 24)) goto fail; Bitmap->FillRect(Rect(0, 0, Bitmap->Width, Bitmap->Height), clWhite); if ((Canvas = Bitmap->CreateCanvas()) == NULL) goto fail; Canvas->Font->Size = 15; Canvas->Font->Color = clBlue; if (i==0) { title = "<< TP STANDARD COLOR LIBRARY >>"; tab = (w-Canvas->TextWidth(title))/2; Canvas->TextOut(tab, 15, title); P1000Bitmap(Bitmap, Canvas, Page, Size, w, h); } else if (i==1) { title = "<< TP TEXTILE COLOR LIBRARY >>"; tab = (w-Canvas->TextWidth(title))/2; Canvas->TextOut(tab, 15, title); PTextileBitmap(Bitmap, Canvas, Page, Size, w, h); } else { title = "<< PRINTER COLOR GUIDE >>"; tab = (w-Canvas->TextWidth(title))/2; Canvas->TextOut(tab, 15, title); if (i==2) PColorBitmap1(Bitmap, Canvas, Page, Size, w, h); else if (i==3) PColorBitmap2(Bitmap, Canvas, Page, w, h); else PColorBitmap3(Bitmap, Canvas, Page, w, h); } Bitmap->DeleteCanvas(Canvas); if (!Print(Bitmap, nPage, bFast)) goto fail; delete Bitmap; return; fail: if (Canvas) Bitmap->DeleteCanvas(Canvas); if (Bitmap) delete Bitmap; EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- bool __fastcall TPaletteForm::PColorBitmap1(TTexpiaBitmap *bm, TCanvas *Canvas, int P, int Next, int w, int h) { TRect BitRect, StrRect; // 36x15 Bitmap int i, j, num, tab; Byte r, g, b, ws, hs; AnsiString cmy, Pg; w = w-30; h = h-100; ws = w /18; hs = h /15; num = 0; if (Next==1) num = 18; for (j=0; j<15; j++) { Canvas->Font->Size = 10; Canvas->Font->Color = clRed; Canvas->TextOut(0, 65+((hs-30)/2)+hs*j, AnsiString(j+1)); //¼öÁ÷ÅØ½ºÆ® } for (i=0; i<18; i++) { Canvas->Font->Size = 10; Canvas->Font->Color = clRed; tab = ((ws-5)-Canvas->TextWidth(AnsiString(num+i+1)))/2; // Adjust Center Canvas->TextOut(20+tab+ws*i, 55, AnsiString(num+i+1)); for (j=0; j<15; j++) { PrinterColor->SetCode(P, num+i, j); BitRect = Rect(20+ws*i, 70+hs*j, ws+15+ws*i, hs+40+hs*j); StrRect = Rect(20+ws*i, hs+40+hs*j, ws+15+ws*i, hs+70+hs*j); HLS2RGB(PrinterColor->Hue, PrinterColor->Lig, PrinterColor->Sat, r, g, b); PrintColorChip24(bm, BitRect, r, g, b); Canvas->Brush->Color = clWhite; cmy = Format("%d-%d-%d", OPENARRAY (TVarRec, (255-r, 255-g, 255-b))); tab = ((ws-5)-Canvas->TextWidth(cmy))/2; // Adjust Center if (tab<0) tab = 0; Canvas->Font->Size = 8; Canvas->Font->Color = clBlack; Canvas->TextRect(StrRect, 20+tab+ws*i, hs+50+hs*j, cmy); } } Canvas->Font->Size = 12; Canvas->Font->Color = clBlue; Pg = Format("Page %d", OPENARRAY (TVarRec, (P+1))); tab = (w+30-Canvas->TextWidth(Pg))/2; Canvas->TextOut(tab, h+80, Pg); return true; fail: return false; } //--------------------------------------------------------------------------- bool __fastcall TPaletteForm::PColorBitmap2(TTexpiaBitmap *bm, TCanvas *Canvas, int P, int w, int h) //12x15 { TRect BitRect, StrRect; //12x15 Bitmap int i, j, num, tab; Byte r, g, b, ws, hs; AnsiString cmy, pg; w = w-50; h = h-100; ws = w / 12; hs = h / 15; num = 0; for (j=0; j<15; j++) { Canvas->Font->Size = 10; Canvas->Font->Color = clRed; Canvas->TextOut(0, 65+((hs-30)/2)+hs*j, AnsiString(j+1)); //¼öÁ÷ÅØ½ºÆ® } for (i=0; i<12; i++) { tab = (ws-10-Canvas->TextWidth(AnsiString(num+i+1)))/2; // Adjust Center Canvas->Font->Color = clRed; Canvas->TextOut(20+tab+ws*i, 55, AnsiString(num+i+1)); for (j=0; j<15; j++) { PrinterColor->SetCode(P, num+i, j); BitRect = Rect(20+ws*i, 70+hs*j, ws+10+ws*i, hs+40+hs*j); StrRect = Rect(20+ws*i, hs+40+hs*j, ws+10+ws*i, hs+70+hs*j); HLS2RGB(PrinterColor->Hue, PrinterColor->Lig, PrinterColor->Sat, r, g, b); PrintColorChip24(bm, BitRect, r, g, b); Canvas->Brush->Color = clWhite; cmy = Format("%d - %d - %d", OPENARRAY (TVarRec, (255-r, 255-g, 255-b))); tab = (ws-10-Canvas->TextWidth(cmy))/2; // Adjust Center if (tab<0) tab = 0; Canvas->Font->Color = clBlack; Canvas->TextRect(StrRect, 20+tab+ws*i, hs+50+hs*j, cmy); } } Canvas->Font->Size = 12; Canvas->Font->Color = clBlue; pg = Format("Page %d", OPENARRAY (TVarRec, (P+1))); tab = (w+50-Canvas->TextWidth(pg)) / 2; Canvas->TextOut(tab, h+80, pg); return true; fail: return false; } //--------------------------------------------------------------------------- bool __fastcall TPaletteForm::PColorBitmap3(TTexpiaBitmap *bm, TCanvas *Canvas, int P, int w, int h) //36x7 { TRect BitRect, StrRect; //36x7 Bitmap int i, j, num, y, tab; Byte r, g, b, k, ws, hs; AnsiString cmy, pg; w = w-30; h = (h-140) / 2; ws = w /18; hs = h / 7; for (k=0; k<2; k++) { if (k==0) { y = 0; num = 0; } else { y = h+30; num = 18; } for (j=0; j<7; j++) { Canvas->Font->Size = 10; Canvas->Font->Color = clRed; Canvas->TextOut(0, 65+((hs-30)/2)+y+hs*j, AnsiString(j+1)); //¼öÁ÷ÅØ½ºÆ® } for (i=0; i<18; i++) { Canvas->Font->Size = 10; Canvas->Font->Color = clRed; tab = (ws-5-Canvas->TextWidth(AnsiString(num+i+1))) / 2; // Adjust Center Canvas->TextOut(20+tab+ws*i, 55+y, AnsiString(num+i+1)); for (j=0; j<7; j++) { PrinterColor->SetCode(P, num+i, j); BitRect = Rect(20+ws*i, 70+y+hs*j, ws+15+ws*i, hs+40+y+hs*j); StrRect = Rect(20+ws*i, hs+40+y+hs*j, ws+15+ws*i, hs+70+y+hs*j); HLS2RGB(PrinterColor->Hue, PrinterColor->Lig, PrinterColor->Sat, r, g, b); PrintColorChip24(bm, BitRect, r, g, b); Canvas->Brush->Color = clWhite; cmy = Format("%d-%d-%d", OPENARRAY (TVarRec, (255-r, 255-g, 255-b))); tab = (ws-5-Canvas->TextWidth(cmy)) / 2; // Adjust Center if (tab<0) tab = 0; Canvas->Font->Size = 8; Canvas->Font->Color = clBlack; Canvas->TextRect(StrRect, 20+tab+ws*i, hs+50+y+hs*j, cmy); } } Canvas->Font->Size = 12; Canvas->Font->Color = clBlue; pg = Format("Page %d", OPENARRAY (TVarRec, (P+1))); tab = (w+30-Canvas->TextWidth(pg)) / 2; Canvas->TextOut(tab, h*2+120, pg); } return true; fail: return false; } //--------------------------------------------------------------------------- bool __fastcall TPaletteForm::P1000Bitmap(TTexpiaBitmap *bm, TCanvas *Canvas, int Page, int Size, int w, int h) { PStandardColorBlock bp; PStandardColorData dp; TRect BitRect, StrRect; int lim, i, j, k, m, t, tab; double p; AnsiString Name; short ws, hs; w = w-48; if (Size==0) { h = h-150; ws = w /10; hs = h / 14; lim = 19; } else { h = h-70; ws = w / 5; hs = h / 7; lim = 4; } for (i=0; i<=lim; i++) { if (Page+i >= StandardColor->Block->Count) break; bp = (PStandardColorBlock) StandardColor->Block->Items[Page+i]; Canvas->Font->Size = 10; Canvas->Font->Color = clRed; p = bp->Page % 10; if (Size==0) { //Small Size Page Format if (i<10) { k = 50; m = i; } else { k = 100+hs*7; m = i-10; } Canvas->TextOut(((ws-15)/2)+ws*m, k, Format("< %d >", OPENARRAY (TVarRec, (bp->Page)))); } else { //Large Size Page Format Canvas->TextOut(((ws-20)/2)+ws*i, 45, Format("< %d >", OPENARRAY (TVarRec, (bp->Page)))); } for (j=0; j<7; j++) { if (jData->Count) { dp = (PStandardColorData) bp->Data->Items[j]; if (Size==0) { BitRect = Rect(24+ws*m, 15+k+hs*j, ws+9+ws*m, hs-15+k+hs*j); StrRect = Rect(24+ws*m, hs-15+k+hs*j, ws+9+ws*m, hs+15+k+hs*j); t = ws-15; } else { BitRect = Rect(24+ws*i, 70+hs*j, ws+4+ws*i, hs+40+hs*j); StrRect = Rect(24+ws*i, hs+40+hs*j, ws+4+ws*i, hs+70+hs*j); t = ws-20; } PrintColorChip24(bm, BitRect, dp->Color.red, dp->Color.green, dp->Color.blue); Canvas->Brush->Color = clWhite; Name = StandardColor->Code(dp); tab = Canvas->TextWidth(Name); // Adjust Center tab = (t-tab) / 2; if (tab<0) tab = 0; Canvas->Font->Color = clBlack; if (Size==0) Canvas->TextRect(StrRect, 24+tab+ws*m, hs-5+k+hs*j, Name); else Canvas->TextRect(StrRect, 24+tab+ws*i, hs+50+hs*j, Name); } } } return true; fail: return false; } //--------------------------------------------------------------------------- bool __fastcall TPaletteForm::PTextileBitmap(TTexpiaBitmap *bm, TCanvas *Canvas, int Page, int Size, int w, int h) { PTextileColorBlock bp; PTextileColorData dp; TRect BitRect, StrRect; int lim, i, j, k, m, t, tab; AnsiString Name; short ws, hs; w = w-48; if (Size==0) { h = h-150; ws = w/10; hs = h/14; lim = 19; } else { h = h-70; ws = w / 5; hs = h / 7; lim = 4; } for (i=0; i<=lim; i++) { if (Page+i >= TextileColor->Block->Count) break; bp = (PTextileColorBlock) TextileColor->Block->Items[Page+i]; Canvas->Font->Size = 10; Canvas->Font->Color = clRed; if (Size==0) { if (i<10) { k = 50; m = i; } else { k = 100+hs*7; m = i-10; } Canvas->TextOut(((ws-15)/2)+ws*m, k, Format("< %d >", OPENARRAY (TVarRec, (bp->Page)))); } else { Canvas->TextOut(((ws-20)/2)+ws*i, 45, Format("< %d >", OPENARRAY (TVarRec, (bp->Page)))); } for (j=0; j<7; j++) { if (jData->Count) { dp = (PTextileColorData) bp->Data->Items[j]; if (Size==0) { BitRect = Rect(24+ws*m, 15+k+hs*j, ws+9+ws*m, hs-15+k+hs*j); StrRect = Rect(24+ws*m, hs-15+k+hs*j, ws+9+ws*m, hs+15+k+hs*j); t = ws-15; } else { BitRect = Rect(24+ws*i, 70+hs*j, ws+4+ws*i, hs+40+hs*j); StrRect = Rect(24+ws*i, hs+40+hs*j, ws+4+ws*i, hs+70+hs*j); t = ws-20; } PrintColorChip24(bm, BitRect, dp->Color.red, dp->Color.green, dp->Color.blue); Canvas->Font->Color = clBlack; Canvas->Brush->Color = clWhite; Name = TextileColor->Code(dp); tab = (t-Canvas->TextWidth(Name)) / 2; if (tab<0) tab = 0; if (Size==0) Canvas->TextRect(StrRect, 24+tab+ws*m, hs-5+k+hs*j, Name); else Canvas->TextRect(StrRect, 24+tab+ws*i, hs+50+hs*j, Name); } } } return true; fail: return false; } //--------------------------------------------------------------------------- bool __fastcall TPaletteForm::Print(TTexpiaBitmap *Bitmap, int nPage, bool bFast) { switch (ItemLibrary) { case 1: return SendToPrinter(Bitmap, 160, "Printer Color Library" + EditStart->Text, nPage, bFast); case 2: return SendToPrinter(Bitmap, 160, "TP Standard Color Library" + EditStart->Text, nPage, bFast); case 3: return SendToPrinter(Bitmap, 160, "TP Textile Color Library" + EditStart->Text, nPage, bFast); } return false; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::RepaintImage() { RGBQUAD rgb[256]; #if defined(TEXTILE) if (MainImageForm->iMainImage->Bitmap->BitsPerPixel == 8) { DIB256Palette->Palette->ToRGBQUAD(rgb, 256); #if defined(CARPET) ::RepaintImage(); PenManagerForm->SetColor(MainImageForm->Palette); #else MainImageForm->iMainImage->ChangeRGBColors(rgb); ::RepaintImage(); PenManagerForm->SetColor(MainImageForm->Palette); if (MainImageForm->AutoRepeat) MainImageForm->RedrawingRepeat(false, false, false); #endif } #if defined(CARPET) MainImageForm->ReDrawCarpetMenu(); #endif #elif defined(KNIT) if (DesignMode == D_KNIT) { MainImageForm->ChangeColor(DIB256Palette->ChoiceIndex); if (FOnKChangeColor) FOnKChangeColor(); } else { DIB256Palette->Palette->ToRGBQUAD(rgb, 256); MainImageForm->iMainImage->YarnBitmap->PutColors(0, 256, rgb); // MainImageForm->iMainImage->Bitmap->PutColors(0, 256, rgb); MainImageForm->ChangeColor(DIB256Palette->ChoiceIndex); PenManagerForm->SetColor(MainImageForm->Palette); } ::RepaintImage(); #elif defined(WEAVE) Timer300->Enabled = true; //qe #elif defined(PILE) MainImageForm->ChangeColor(DIB256Palette->ChoiceIndex); #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::CreatePantone() //k3dogs 20001211 { //Main¿¡¼­ ÃʱâÈ­ SearchPanel->BringToFront(); PanelLibrary->Height = 270; ClientHeight = CHeight+PanelLibrary->Height; edSearch->SelectAll(); edSearch->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DestroyPantone() { SearchPanel->SendToBack(); PanelLibrary->Height = 309; ClientHeight = CHeight+PanelLibrary->Height; } //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // Public Function //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- void __fastcall TPaletteForm::InitForm(TPalette *Palette) { if (Visible) { FcmyC = 0; FcmyM = 0; FcmyY = 0; DIB256Palette->SetPalette(Palette); HS = false; LS = false; Img1Chk = false; Img2Chk = false; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SetFont() { SetSmallFont(Font); SetSmallFont(LabelLibraryFinder->Font); SetSmallFont(PGaugeCyan->Font); SetSmallFont(PGaugeMagenta->Font); SetSmallFont(PGaugeYellow->Font); } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::SaveColorBackup() { if (undosw == true) return; PColorBackup cb = new TColorBackup; cb->Index = DIB256Palette->ChoiceIndex; cb->ColorMap = new TColorData; cb->ColorMap->Copy(DIB256Palette->Palette->ColorData[DIB256Palette->ChoiceIndex]); ColorBackup->Add(cb); sbUndo->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::DeleteColorBackup() { PColorBackup cb; while (ColorBackup->Count>0) { cb = (PColorBackup) ColorBackup->Last(); ColorBackup->Remove(cb); delete cb->ColorMap; delete cb; } } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::iMainImageMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { #if defined(TEXTILE) || defined(KNIT) TRect r; Byte *scan; if (Item==6) { if (Button==mbMiddle || (Shift.Contains(ssShift) && Button==mbLeft)) { if (SpeedButtonProtectOne->Down) { if (SpeedButtonProtectDelete->Down) { ColorSelectorProtect->DeleteColor(MainImageForm->iMainImage->Bitmap->GetPixelColor(X, Y)); } else { ColorSelectorProtect->AddColor(MainImageForm->iMainImage->Bitmap->GetPixelColor(X, Y)); } } else { if (step>0) { Temp.right = X; Temp.bottom = Y; #ifndef dogtest MainImageForm->DrawRectangleLocate(Temp); #endif if (Temp.left>Temp.right) { r.Left = Temp.right; r.Right = Temp.left; } else { r.Left = Temp.left; r.Right = Temp.right; } if (Temp.top>Temp.bottom) { r.Top = Temp.bottom; r.Bottom = Temp.top; } else { r.Top = Temp.top; r.Bottom = Temp.bottom; } if (!MainImageForm->iMainImage->Bitmap->StartScanLine()) goto fail; if (SpeedButtonProtectDelete->Down) { for (Y=r.Top; YiMainImage->Bitmap->GetScanLine(Y); for (X=r.Left; XDeleteColor(*(scan+X)); } } } else { for (Y=r.Top; YiMainImage->Bitmap->GetScanLine(Y); for (X=r.Left; XAddColor(*(scan+X)); } } } MainImageForm->iMainImage->Bitmap->StopScanLine(); step = 0; IsDraw = false; MainImageForm->iMainImage->OnPaintLocate = NULL;/////////////////by jeegeo } else { Temp.left = X; Temp.top = Y; Temp.bottom = Temp.top; Temp.right = Temp.left; #ifndef dogtest MainImageForm->DrawRectangleLocate(Temp); #endif IsDraw = true; step = 11; } } } } return; fail: MainImageForm->iMainImage->Bitmap->StopScanLine(); EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::iMainImageMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { #if defined(TEXTILE) || defined(KNIT) if (Item==6) { if (SpeedButtonProtectOne->Down==false) { if (step>0) { #ifndef dogtest if (IsDraw) MainImageForm->DrawRectangleLocate(Temp); #endif Temp.right = X; Temp.bottom = Y; #ifndef dogtest MainImageForm->DrawRectangleLocate(Temp); #endif IsDraw = true; } } } #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::iMainImagePaint() { IsDraw = false; MainImageForm->iMainImage->OnPaintLocate = NULL;/////////////////by jeegeo } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::UpdateForm(int i) { if (Item != 3 && Item != 4) ExitItem(); #ifdef ACADEMY sbProtect->Enabled = false; #else sbProtect->Enabled = i==8; #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::KnitChangeColor() { #if defined(KNIT) if (DesignMode == D_KNIT) { if (FOnKChangeColor) FOnKChangeColor(); } #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbCMYMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { #ifndef N_SCREENCAM AnsiString screencam, cam, camdir; TRegistry *Registry; SHELLEXECUTEINFO screeninfo; if (Button == mbRight && Shift.Contains(ssShift)) { Registry = new TRegistry; if (!Registry) return; Registry->RootKey = HKEY_CURRENT_USER; Registry->OpenKey("SOFTWARE\\Youngwoo\\TexPro\\7.3\\Directory",TRUE); screencam = Registry->ReadString("screencam"); delete Registry; memset(&screeninfo,0,sizeof(screeninfo)); screeninfo.cbSize = sizeof(screeninfo); screeninfo.lpVerb = "open"; screeninfo.lpDirectory = screencam.c_str(); screeninfo.lpFile = "scplayer.exe"; switch(dynamic_cast(Sender)->Tag) { case 0 : cam = screencam + "\\textile\\cmy.scm"; break; case 1 : cam = screencam + "\\textile\\HLS.scm"; break; case 2 : cam = screencam + "\\textile\\color_library.scm"; break; case 3 : cam = screencam + "\\textile\\color_file.scm"; break; case 4 : cam = screencam + "\\textile\\color_chart.scm"; break; case 5 : cam = screencam + "\\textile\\color_selection.scm"; break; case 6 : cam = screencam + "\\textile\\color_undo.scm"; break; } camdir = "\"" + cam + "\""; screeninfo.lpParameters = camdir.c_str(); screeninfo.fMask = SEE_MASK_NOCLOSEPROCESS; screeninfo.nShow = SW_SHOWDEFAULT; if(!ShellExecuteEx(&screeninfo)) { ShowMessage("can't play screencam movie."); return; } } #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::sbUndoClick(TObject *Sender) { PColorBackup cb; undosw = true; //undosw undosw ½ÃÀÛ if (ColorBackup->Count>0) { cb = (PColorBackup) ColorBackup->Last(); DIB256Palette->Copy(cb->Index, cb->ColorMap); DIB256Palette->ChoiceIndex = cb->Index; // Insert 99/5/6.. ColorBackup->Remove(cb); if(PanelCMY->Visible)ShapeCMYColor->Brush->Color = ShapeCMYOriginColor->Brush->Color; //lhskys Ä®¶óȯ¿ø½Ã ¿øº»»ö°ú else if(PanelHLS->Visible)ShapeHLSColor->Brush->Color = ShapeHLSOriginColor->Brush->Color; //lhskys µ¿ÀÏÇÏ°Ô ÇØÁØ´Ù. delete cb->ColorMap; delete cb; if (ColorBackup->Count==0) {sbUndo->Enabled = false; isSave = false;} //k3dogs RepaintImage(); #if defined(KNIT) if (DesignMode != D_KNIT) ::KnitRepaintColor(); #endif DIB256Palette->Repaint(); } switch (Item) { case 1: SetCMY(); break; case 2: SetHLS(); break; } undosw = false; //undosw undosw Á¾·á } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::Timer300Timer(TObject *Sender) { #if defined(WEAVE) Timer300->Enabled = false; if (ColorChangeForm) ColorChangeForm->ChangeColor(DIB256Palette->ChoiceIndex); else MainImageForm->ChangeColor(DIB256Palette->ChoiceIndex); #endif } //--------------------------------------------------------------------------- void __fastcall TPaletteForm::UpdateCMYHLS() { switch (Item) { case 1: SetCMY(); break; case 2: SetHLS(); break; } } //---------------------------------------------------------------------------