// --------------------------------------------------------------------------- #include #include #include #pragma hdrstop #include "Palette.h" #include "Define.h" #include "ColorChart.h" #include "ColorLibrary_f.h" #include "CommonPrint.h" #include "FullView.h" #include "MainMenu.h" // ¸Þ´º ´ÝÀ»¶ó°í Ãß°¡.. by celberus #include "MainImage.h" #include "PalFileManager.h" #include "Kasuri_sub.h" //by bomchun °¡½º¸® ¼­ºê¸Þ´º ¹Ì¸®º¸±â¿¡ ¸®ÆäÀÎÆ® ºÎºÐ Ãß°¡¸¦ À§ÇØ (2006.11.07) #include "Menu3D_F.h"//by bomchun ¿øÄ÷¯ ÆÐÅÏ »ý¼ºÀ» À§Çؼ­ #if defined(TEXSTYLIST) #include "PenManager.h" #include "UserColor_F.h" #endif #include "NewColorWay_F.h" // added by maxleo21c for new color way (05.01.31) #include "DTPColorLibrary_F.h" //080320 #include "LogData.h" #include "Text_F.h" #include "PatternLibrary.h" // 2005 Vector Upgrade =-= [ Begin ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // Vector Color º¯°æ - Color/Fill - by monkman (2005.03.03) #include "VecDraw.h" #include "Vector_F.h" // =-=-=-=-=-=-=-=-=-=-=-= [ End ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // --------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "DIB256s" #pragma link "KShape" #pragma link "PGauge" #pragma link "Selector" #pragma link "PHLS" #pragma link "RzEdit" #pragma link "RzSpnEdt" #pragma link "RzShellDialogs" #pragma link "RzButton" #pragma link "RzTabs" #pragma link "RzBckgnd" #pragma link "RzCmboBx" #pragma link "RzRadChk" #pragma link "RzPanel" #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 IDS_REARRANGE StringTable[27] #define IDS_RGB StringTable[28] #define IDS_MSG_KEEPCOLOR StringTable[29] #define CHeight 130 //156 // --------------------------------------------------------------------------- TPaletteForm *PaletteForm; // --------------------------------------------------------------------------- __fastcall TPaletteForm::TPaletteForm(TComponent* Owner) : TForm(Owner) { // ==================================================================== StringTable.Create(DirectoryBin, Language, "Palette"); SetFont(); Caption = IDS_FCAPTION; // rzbtColorGuide->Caption = IDS_COLORGUIDE; // rzbtPrinterColor->Caption = IDS_PRINTCOLOR; // rzbtUserColor->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; rzbtLibrarySearchOK->Caption = IDS_COMMON_BUTTONOK; sbDisplayLibrary->Hint = 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; rzbtLibraryPrintStart->Caption = IDS_START; rzbtToLibrary->Caption = IDS_TOLIBRARY; rzbtToPantone->Caption = IDS_TOPANTONE; // k3dogs 20001211 // sbProtect->Caption = IDS_COMMON_BUTTONOK; sbCMYHLS->Hint = IDS_CMY + "/" + IDS_HLS + "/" + IDS_RGB; // sbHLS->Hint = IDS_HLS; sbLibrary->Hint = IDS_LIBRARY; sbFile->Hint = IDS_COMMON_FILE; sbChart->Hint = IDS_CHART; sbProtect->Hint = IDS_PROTECTION; sbRearrange->Hint = IDS_REARRANGE; sbUndo->Hint = IDS_COLORUNDO; sbColorGuide->Hint = IDS_COLORGUIDE; 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; // rzbtOk->Caption = IDS_COMMON_BUTTONOK; // rzbtSearch->Caption = IDS_COLORSEARCH; // rzbtSearch->Hint = IDS_COLORSEARCH; rzedLocateSearch->Text = DirectoryColor; menuitemCMY->Caption = IDS_CMY; menuitemHLS->Caption = IDS_HLS; menuitemRGB->Caption = IDS_RGB; // ==================================================================== DIB256Palette->DoubleBuffered = true; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::FormClose(TObject *Sender, TCloseAction &Action) { Visible = False; if (FOnUpdateMenu) FOnUpdateMenu(Sender); if (MainMenuForm->Item == T_STYLECOMBO) MainMenuForm->StyleComboUpdateMenu(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::FormCreate(TObject *Sender) { Width = 210; // ClientWidth = 248; ClientHeight = CHeight - SpeedButtonExit->Height; ColorBackup = new TList; Item = PAL_NONE; isChoice = isSave = false; rzbtLibrarySearchOK->Enabled = false; // rzbtOk->Enabled = false; PageControlLibrary->BringToFront(); undosw = false; // lhskys undosw Ãʱâ tocode = true; // k3dogs bColorCh = true; StyleUseColor = true; isSelectedColorChanged = false; // by celberus for changed color repaint /* FcmyC = 0; FcmyM = 0; FcmyY = 0; */ searchedColorData = new TColorData; // °Ë»öµÈ »ö Á¤º¸¸¦ ÀúÀåÇϱâ À§ÇØ Ãß°¡ by smallpotato 20080310 // OnChoiceColor = ChoiceColorChange; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::FormDestroy(TObject *Sender) { DestroyPantone(); DeleteColorBackup(); delete ColorBackup; if (searchedColorData) { delete searchedColorData; // by smallpotato 20080310 searchedColorData = NULL; } if (DTPColorLibraryForm != NULL) { delete DTPColorLibraryForm; DTPColorLibraryForm = NULL; } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::iMainImageKeyDown(WORD &Key, TShiftState Shift) { if (Key == VK_RETURN && PanelProtect->Enabled && PanelProtect->Visible) rzbtProtectClick(this); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::BGColorClick(TObject *Sender) { DIB256Palette->ChoiceIndex = 1; if (FOnChoiceColor) FOnChoiceColor(1); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::BGColorDblClick(TObject *Sender) { BEGIN_LOG(""); // 2005 Vector Upgrade =-= [ Begin ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // Vector Color º¯°æ - Color/Fill - by monkman (2005.03.03) if (MainMenuForm->Item == T_VECTOR && VectorForm) { if (VectorForm->V_Item == M_O_COLOR) { // ¾Æ´Ï¶ó¸é Color Change // Merge»óŶó¸é MergeµÇ´Â Object¸¦ Áö¿ì±â À§Çؼ­... maxleo21c (04.12.22) if (VecDraw->NVector->bMergeMode) VecDraw->ExitMerge(); if (!(VecDraw->NVector->bSelected)) { END_LOG; return; } VecDraw->ChangeObjectColor(false); } else if (VectorForm->V_Item == M_O_FILL) { // PatternPanel VisibleÀÌ trueÀ̸é Fill Change // Merge»óŶó¸é MergeµÇ´Â Object¸¦ Áö¿ì±â À§Çؼ­... maxleo21c (04.12.22) if (VecDraw->NVector->bMergeMode) VecDraw->ExitMerge(); if (!(VecDraw->NVector->bSelected)) { END_LOG; return; } VecDraw->ChangeObjectColor(true); } } // =-=-=-=-=-=-=-=-=-=-=-= [ End ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // else if (MainMenuForm->Item == T_COMBO) { // added by maxleo21c (05.04.22) // if (NewColorWayForm) // NewColorWayForm->ChageColorByPaletteBblClick(); // } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::BGColorMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { DIB256Palette->CursorIndex = 1; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteChoiceIndexChange(TObject *Sender) { BEGIN_LOG(""); if ((Item == PAL_CMY) || (Item == PAL_HLS) || Item == PAL_RGB) SaveColorBackup(); switch(Item) { case PAL_CMY: SetCMY(); break; case PAL_HLS: SetHLS(); break; case PAL_RGB: SetRGB(); break; case PAL_LIBRARY: if (ItemLibrary == 0) { ColorLibraryForm->StringGrid->Row = DIB256Palette->ChoiceIndex; ColorLibraryForm->View(); } if (PageControlLibrary->ActivePage == TabSheetLibraryFinder) Finder(DIB256Palette->ChoiceIndex); break; case PAL_CHART: ColorChartForm->SetColor(DIB256Palette->ChoiceIndex); break; #if defined(TEXSTYLIST) case PAL_PROTECT: 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; // Text ±â´ÉÀ» ½ÇÇà ÁßÀÎ °æ¿ì ÆÈ·¹Æ® »ö ¼±Åà ÈÄ ¹Ù·Î text ÀÔ·ÂÀ» ÇÒ ¼ö ÀÖµµ·Ï ó¸® if (Item == PAL_NONE) { if (MainMenuForm->Item == T_TEXT) { if (TextForm->Edit->Enabled == true) TextForm->Edit->SetFocus(); } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteColorChange(TObject *Sender) { BEGIN_LOG(""); 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; isSelectedColorChanged = true; // by celberus if (FOnColorChange) FOnColorChange(Sender); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteCursorIndexChange(TObject *Sender) { // MainImageForm Á¦°Å½Ã¿¡ ¸Þ¸ð¸® Á¢±Ù ¿À·ù¹ß»ýÇØ¼­ Ãß°¡ if (MainImageForm == NULL) return; BEGIN_LOG(""); #if defined(TEXSTYLIST) if (MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8) { CursorColor->Brush->Color = DIB256Palette->CursorColor; } #else CursorColor->Brush->Color = DIB256Palette->CursorColor; #endif #if defined(TEXSTYLIST) if (MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8) { CursorColor->Text = DIB256Palette->CursorIndex - 1; } #endif if (FOnCursorIndexChange) FOnCursorIndexChange(Sender); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteDragDrop(TObject *Sender, TObject *Source, int X, int Y) { BEGIN_LOG(""); if (Source != UserColorLibForm->StringGrid) { END_LOG; return; } UserColorLibForm->isDrag = false; TColorData *ucd; // ColorDataÀÇ FileName´Â char typeÀ¸·Î »ç¿ë String 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; //size°¡ 5=>7·Î º¯°æµÇ¾ú±â ¶§¹®¿¡... by maxleo21c (07.04.05) k = i * 7 + j; if (!((UserColorLibForm->store->Count > 0) && (k < UserColorLibForm->store->Count))) { END_LOG; return; } if (u + l > 251) { END_LOG; return; } PaletteForm->SaveColorBackup(); ucd = (TColorData *)UserColorLibForm->store->Items[k]; PaletteForm->DIB256Palette->SetUserColor(u + l, ucd); //if (ucd->Kind == 0x6 || ucd->Kind == 0x16) { // 080418 pantone color by david // if ((ucd->Kind & 0x0FFF) == 0x0006) { // PaletteForm->DIB256Palette->SetUserColor(u + l, ucd->Kind, ucd->Page, ucd->Number, // ucd->RGB.rgbRed, ucd->RGB.rgbGreen, ucd->RGB.rgbBlue, fn.c_str(), ucd->ColorName, // ucd->PantoneColor, ucd->PantoneFileName); // } // else { // PaletteForm->DIB256Palette->SetUserColor(u + l, ucd->Kind, ucd->Page, ucd->Number, // ucd->RGB.rgbRed, ucd->RGB.rgbGreen, ucd->RGB.rgbBlue, fn.c_str(), ucd->ColorName); // } ::RepaintColor(); l++; } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteDragOver(TObject *Sender, TObject *Source, int X, int Y, TDragState State, bool &Accept) { if (Source == UserColorLibForm->StringGrid) Accept = true; else Accept = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BEGIN_LOG(""); RGBQUAD rgb; int k = DIB256Palette->MouseCoord(X, Y); if (MainImageForm && Button == mbRight) { if (MainImageForm->iMainImage->uBitmap->BitsPerPixel != 8) { MainImageForm->Palette->UseColor = k; DIB256Palette->Palette->UseColor = k; FGColor->Text1 = k - 1; } } if (Button == mbLeft && FOnChoiceColor) FOnChoiceColor(k); StyleUseColor = false; if (MainMenuForm->Item == T_VECTOR && MainMenuForm->UseEditFunction) // For TextBox by maxleo21c (04.10.22) MainMenuForm->TextColorChangeInEdit(); else if (MainMenuForm->Item == T_COMBO && Button == mbLeft) // added by maxleo21c (05.04.22) dynamic_cast(Sender)->BeginDrag(true); if (KasuriSubForm) KasuriSubForm->GetImage(); // by bomchun °¡½º¸® ¼­ºê¿¡ ¹Ì¸®º¸±â ¸®ÆäÀÎÆ®Ãß°¡(2006.11.07) if (MainMenuForm->Item == T_3D && Menu3DForm && Menu3DForm->Fabric3DForm && Menu3DForm->Fabric3DForm->sbOneColorPattern->Down) { // Menu3DForm->Fabric3DForm-> rgb = MainImageForm->Palette->ColorData[k]->RGB; Menu3DForm->Fabric3DForm->MakeOneColorPattern(rgb); } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteUseColorChange(TObject *Sender) { FGColor->Text1 = DIB256Palette->UseColor - 1; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbHLSClick(TObject *Sender) { BEGIN_LOG(""); bool sw; if (Item == PAL_HLS) sw = false; else sw = true; ExitItem(); isChoice = isSave = false; // k3dogs if (sw) { isChoice = true; // ShapeHLS->Brush->Color = clRed; // ShapeHLS->Pen->Color = clRed; ClientHeight = CHeight + PanelHLS->Height; // PanelHLS->Left = 0; // PanelHLS->Top = CHeight + 1; PanelHLS->Enabled = true; PanelHLS->Visible = true; Item = PAL_HLS; SetHLS(); } Show(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonExitClick(TObject *Sender) { BEGIN_LOG(""); ViewCloseBtn(1); ExitItem(); ClientHeight = CHeight - SpeedButtonExit->Height; isChoice = isSave = false; // if (MainImageForm) // added by maxleo21c (05.05.12) // MainImageForm->tempRadioButton->SetFocus(); // ´ÜÃàŰ Æ÷Ä¿½º ¸Ô°Ô Çϱâ À§Çؼ­ END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbDisplayLibraryClick(TObject *Sender) { BEGIN_LOG(""); if (sbDisplayLibrary->Down) { ColorLibraryForm->Visible = false; UserColorLibForm->Visible = false; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; // 080320 // 5: DTP Color, 6: PANTONE COLOR if (ItemLibrary == 5 || ItemLibrary == 6) { if (DTPColorLibraryForm) { DTPColorLibraryForm->Visible = true; DTPColorLibraryForm->BringToFront(); DTPColorLibraryForm->Show(); } } else if (ItemLibrary != 4) { ColorLibraryForm->Visible = true; ColorLibraryForm->InitForm(MainImageForm->iMainImage->uBitmap); } else { UserColorLibForm->Visible = true; UserColorLibForm->Show(); } } else { if (ItemLibrary == 5 || ItemLibrary == 6) { // if (DTPColorLibraryForm) DTPColorLibraryForm->ExitForm(); } else if (ItemLibrary != 4) ColorLibraryForm->ExitForm(); ColorLibraryForm->Visible = false; UserColorLibForm->Visible = false; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; // 080320 } // if ((ItemLibrary) && (ItemLibrary != 4) && // (PageControlLibrary->ActivePage==TabSheetLibrarySearch)) // rzedLibrarySearch->SetFocus(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PageControlLibraryChange(TObject *Sender) { BEGIN_LOG(""); unsigned short p; if (PageControlLibrary->ActivePage == TabSheetLibraryFinder) { Finder(DIB256Palette->ChoiceIndex); } else if (PageControlLibrary->ActivePage == TabSheetLibraryPrint) { switch(ItemLibrary) { case 1: ComboBoxSize->Enabled = false; rzedStart->Enabled = true; rzedNumber->Enabled = true; if (sbDisplayLibrary->Down) rzedStart->Text = ColorLibraryForm->StartPage + 1; else rzedStart->Text = "1"; rzedNumber->Text = "1"; break; case 2: ComboBoxSize->Enabled = true; rzedStart->Enabled = true; rzedNumber->Enabled = true; if (ComboBoxSize->Items->Count == 3) { ComboBoxSize->Items->Clear(); ComboBoxSize->Items->Add("Small"); ComboBoxSize->Items->Add("Large"); } if (sbDisplayLibrary->Down) StandardColor->Search(ColorLibraryForm->ScrollBarPantone->Position, 0, p); else StandardColor->Search(0, 0, p); rzedStart->Text = p; rzedNumber->Text = "1"; break; case 3: ComboBoxSize->Enabled = true; rzedStart->Enabled = true; rzedNumber->Enabled = true; if (ComboBoxSize->Items->Count == 3) { ComboBoxSize->Items->Clear(); ComboBoxSize->Items->Add("Small"); ComboBoxSize->Items->Add("Large"); } if (sbDisplayLibrary->Down) TextileColor->Search(ColorLibraryForm->ScrollBarPantone->Position, 0, p); else TextileColor->Search(0, 0, p); rzedStart->Text = p; rzedNumber->Text = "1"; break; case 4: ComboBoxSize->Enabled = true; // modified by maxleo21c (05.02.26) rzedStart->Enabled = false; rzedNumber->Enabled = false; ComboBoxSize->Items->Clear(); ComboBoxSize->Items->Add("Small"); ComboBoxSize->Items->Add("Medium"); ComboBoxSize->Items->Add("Large"); break; case 5: case 6: // pantone color 080407 ComboBoxSize->Enabled = true; rzedStart->Enabled = true; rzedNumber->Enabled = true; if (ComboBoxSize->Items->Count == 3) { ComboBoxSize->Items->Clear(); ComboBoxSize->Items->Add("Small"); ComboBoxSize->Items->Add("Large"); } break; } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLibrarySearchChange(TObject *Sender) { int n; unsigned short p; PStandardColorData p1; PTextileColorData pt; byte r, g, b; TColorData *ucd; String value = rzedLibrarySearch->Text; if (value.IsEmpty()) return; BEGIN_LOG(""); switch(ItemLibrary) { case 1: if (PrinterColor->SearchPrinterColor(value, hh, ll, ss)) { if (hh >= 0) { ColorLibraryForm->PrinterColorPageChange(hh - 1); ColorLibraryForm->StringGrid->Row = ss; ColorLibraryForm->StringGrid->Col = ll; LabelLibrarySearch->Caption = IDS_CFIND; rzbtLibrarySearchOK->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; rzbtLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; case 2: StandardColor->SearchCode(value, 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; rzbtLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = RGB2TColor(p1->Color.red, p1->Color.green, p1->Color.blue); } else { LabelLibrarySearch->Caption = IDS_CNONE; rzbtLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; case 3: TextileColor->SearchCode(value, 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; rzbtLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = RGB2TColor(pt->Color.red, pt->Color.green, pt->Color.blue); } else { LabelLibrarySearch->Caption = IDS_CNONE; rzbtLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; case 4: if (UserColorLibForm->SearchUserColor(value, rzedLocateSearch->Text, CheckBoxSearch->Checked)) { ucd = new TColorData; UserColorLibForm->SearchCode(ucd); LabelLibrarySearch->Caption = IDS_CFIND; rzbtLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = (TColor)RGBToTColor(ucd->RGB); delete ucd; } else { LabelLibrarySearch->Caption = IDS_CNONE; rzbtLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; case 5: // DTP, Pantone 080320 case 6: if (DTPColorLibraryForm && DTPColorLibraryForm->IsColorCodeExist(value, searchedColorData)) { LabelLibrarySearch->Caption = IDS_CFIND; rzbtLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = (TColor)RGBToTColor(searchedColorData->RGB); } else { LabelLibrarySearch->Caption = IDS_CNONE; rzbtLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } break; } ColorLibraryForm->View(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLibrarySearchClick(TObject *Sender) { rzedLibrarySearch->SetFocus(); rzedLibrarySearch->SelectAll(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLibrarySearchKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { BEGIN_LOG(String(Key)); bool is_color_exist; TColor result_color; if (Key == VK_RETURN) { if (LabelLibrarySearch->Caption == IDS_CNONE) { // =================== 2001.7.20 lhskys °Ë»ö½Ã Äڵ忡 °ø¹éÀÌ ÀÖÀ» °æ¿ì error ¼öÁ¤ // ShowMessage(IDS_MESSAGE_COLORBOOK); // LabelLibrarySearch->Caption = ""; LabelLibrarySearch->Caption = ""; rzedLibrarySearch->Clear(); ShowMessage(IDS_MESSAGE_COLORBOOK); // ================================= } // rzbtUserColor´Â rzbtUserColorLibrary·Î ±³Ã¼µÊ - by monkman (2006.11.23) // else if((rzbtTPStandard->Down)||(rzbtPrinterColor->Down)||(rzbtTPTextile->Down)||(rzbtPantoneColor->Down)) //lhskys Ä®¶óºÏ¿¡¼­ else { if (rzbtLibrarySearchOK->Enabled == true) rzbtLibrarySearchOKClick(this); // ¿£ÅÍ ½ÇÇà 4°¡Áö°æ¿ì } /* else if((rzbtTPStandard->Down)||(rzbtPrinterColor->Down)||(rzbtTPTextile->Down)||(rzbtUserColor->Down)) //lhskys Ä®¶óºÏ¿¡¼­ if (rzbtLibrarySearchOK->Enabled==true)rzbtLibrarySearchOKClick(this); //¿£ÅÍ ½ÇÇà 4°¡Áö°æ¿ì */ } else if (ItemLibrary == 5 || ItemLibrary == 6) // DTP color library °Ë»ö °ü·Ã ¼öÁ¤ by smallpotato(2008.02.28) { if (!DTPColorLibraryForm) { END_LOG; return; } if (Key == VK_PRIOR) is_color_exist = DTPColorLibraryForm->IsColorCodeExist(rzedLibrarySearch->Text, searchedColorData, true, true); else if (Key == VK_NEXT) is_color_exist = DTPColorLibraryForm->IsColorCodeExist(rzedLibrarySearch->Text, searchedColorData, true, false); result_color = (TColor)RGBToTColor(searchedColorData->RGB); if (is_color_exist) { LabelLibrarySearch->Caption = IDS_CFIND; rzbtLibrarySearchOK->Enabled = true; ShapeLibrarySearch->Brush->Color = result_color; } else { LabelLibrarySearch->Caption = IDS_CNONE; rzbtLibrarySearchOK->Enabled = false; ShapeLibrarySearch->Brush->Color = clWhite; } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLocateSearchChange(TObject *Sender) { TRzEdit * s = (TRzEdit*)Sender; rzedLocateSearch->Text = s->Text; rzedLocateFinder->Text = s->Text; // rzedLocatePrint->Text = s->Text; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLocateSearchClick(TObject *Sender) { TRzEdit *s = (TRzEdit*)Sender; s->SetFocus(); s->SelectAll(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzbitbtnLocateSearchClick(TObject *Sender) { // OpenDialog->InitialDir = DirectoryColor; /* OpenDialog->InitialDir = String(DirectoryColor); if (OpenDialog->Execute()) { rzedLocateFinder->Text = OpenDialog->FileName; rzedLocateSearch->Text = OpenDialog->FileName; rzedLocatePrint->Text = OpenDialog->FileName; } */ if (DirectoryExists(rzedLocateSearch->Text)) SelectedFolderDialog->SelectedPathName = rzedLocateSearch->Text; else SelectedFolderDialog->SelectedPathName = DirectoryColor; if (SelectedFolderDialog->Execute()) { rzedLocateFinder->Text = SelectedFolderDialog->SelectedPathName; rzedLocateSearch->Text = SelectedFolderDialog->SelectedPathName; } } // --------------------------------------------------------------------------- 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::rzbtLibrarySearchOKClick(TObject *Sender) { BEGIN_LOG(""); Byte r, g, b; Word p; int k; PStandardColorData p1; PTextileColorData pt; TColorData *ucd; 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; 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 TColorData; UserColorLibForm->SearchCode(ucd); // ColorDataÀÇ FileName´Â char typeÀ¸·Î »ç¿ë String fileName = rzedLocateSearch->Text; DIB256Palette->SetUserColor(DIB256Palette->ChoiceIndex, ucd); // //if (ucd->Kind == 0x6 || ucd->Kind == 0x16) { // 080418 pantone color by david // // DIB256Palette->SetUserColor(DIB256Palette->ChoiceIndex, ucd->Kind, // // ucd->Page, ucd->Number, ucd->RGB.rgbRed, ucd->RGB.rgbGreen, // // ucd->RGB.rgbBlue, rzedLocateSearch->Text.c_str(), ucd->Name, ucd->PantoneColor, ucd->PantoneFileName); // if ((ucd->Kind & 0x0FFF) == 0x0006) { // DIB256Palette->SetUserColor(DIB256Palette->ChoiceIndex, ucd->Kind, ucd->Page, ucd->Number, // ucd->RGB.rgbRed, ucd->RGB.rgbGreen, ucd->RGB.rgbBlue, fileName.c_str(), // ucd->ColorName, ucd->PantoneColor, ucd->PantoneFileName); // } // else { // // DIB256Palette->SetUserColor(DIB256Palette->ChoiceIndex, ucd->Kind, // // ucd->Page, ucd->Number, ucd->RGB.rgbRed, ucd->RGB.rgbGreen, // // ucd->RGB.rgbBlue, rzedLocateSearch->Text.c_str(), ucd->Name); // // DIB256Palette->SetUserColor(DIB256Palette->ChoiceIndex, ucd->Kind, ucd->Page, ucd->Number, // ucd->RGB.rgbRed, ucd->RGB.rgbGreen, ucd->RGB.rgbBlue, fileName.c_str(), // ucd->ColorName); // } DIB256Palette->Repaint(); delete ucd; break; } case 5: // DTPCOLOR: // DTP color library °Ë»ö °ü·ÃÀ¸·Î Ãß°¡ by smallpotato (2008.03.10) case 6: // PANTONECOLOR: PaletteForm->DIB256Palette->SetPantoneColor2(k, searchedColorData); break; } RepaintImage(); ColorLibraryForm->View(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLocateFinderChange(TObject *Sender) { TRzEdit * s = (TRzEdit*)Sender; rzedLocateSearch->Text = s->Text; rzedLocateFinder->Text = s->Text; // rzedLocatePrint->Text = s->Text; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLocateFinderClick(TObject *Sender) { TRzEdit *s = (TRzEdit*)Sender; s->SetFocus(); s->SelectAll(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzbitbtnLocateFinderClick(TObject *Sender) { /* if (OpenDialog->Execute()) { rzedLocateFinder->Text = OpenDialog->FileName; rzedLocateSearch->Text = OpenDialog->FileName; rzedLocatePrint->Text = OpenDialog->FileName; } */ if (DirectoryExists(rzedLocateFinder->Text)) SelectedFolderDialog->SelectedPathName = rzedLocateFinder->Text; else SelectedFolderDialog->SelectedPathName = DirectoryColor; if (SelectedFolderDialog->Execute()) { rzedLocateFinder->Text = SelectedFolderDialog->SelectedPathName; rzedLocateSearch->Text = SelectedFolderDialog->SelectedPathName; } } // --------------------------------------------------------------------------- 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::rzedStartClick(TObject *Sender) { rzedStart->SetFocus(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedNumberClick(TObject *Sender) { rzedNumber->SetFocus(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzedLocatePrintClick(TObject *Sender) { TRzEdit *s = (TRzEdit*)Sender; s->SetFocus(); s->SelectAll(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzbitbtnLocatePrintClick(TObject *Sender) { BEGIN_LOG(""); switch(ItemLibrary) { case 1: case 2: case 3: case 4: if (OpenDialog->Execute()) { rzedLocateFinder->Text = OpenDialog->FileName; rzedLocateSearch->Text = OpenDialog->FileName; rzedLocatePrint->Text = OpenDialog->FileName; } break; case 5: case 6: if (SaveDialog->Execute() == true) { #ifdef TRIAL ShowMessage(IDS_TRIAL_NOT_SUPPORTED); #else rzedLocateFinder->Text = SaveDialog->FileName; rzedLocateSearch->Text = SaveDialog->FileName; rzedLocatePrint->Text = SaveDialog->FileName; DTPColorLibraryForm->PrintDTPColor(ComboBoxSize->ItemIndex, rzedStart->Text, rzedNumber->Text, 1, 2); #endif } break; } /* if (OpenDialog->Execute()) { rzedLocateFinder->Text = OpenDialog->FileName; rzedLocateSearch->Text = OpenDialog->FileName; rzedLocatePrint->Text = OpenDialog->FileName; } */ END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzbtLibraryPrintStartClick(TObject *Sender) { BEGIN_LOG(""); TCommonPrintForm *Form = NULL; TCursor cursor; if ((Form = new TCommonPrintForm((TComponent*)NULL)) == NULL) { END_LOG; return; } if (Form->ShowModal() == mrOk) { #ifndef TRIAL cursor = Screen->Cursor; Screen->Cursor = crHourGlass; switch(ItemLibrary) { case 1: PrintPrinterColor(rzedStart->Text, rzedNumber->Text, Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; case 2: PrintTPStandardColor(ComboBoxSize->ItemIndex, rzedStart->Text, rzedNumber->Text, Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; case 3: PrintTPTextileColor(ComboBoxSize->ItemIndex, rzedStart->Text, rzedNumber->Text, Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; case 4: UserColorLibForm->PrintUserColor(ComboBoxSize->ItemIndex, Form->PageEdit->Value, Form->cbMethod->ItemIndex); // modified by maxleo21c (05.02.26) break; case 5: // DTPCOLOR: 080320 case 6: // PANTONECOLOR: if (DTPColorLibraryForm) DTPColorLibraryForm->PrintDTPColor(ComboBoxSize->ItemIndex, rzedStart->Text, rzedNumber->Text, Form->PageEdit->Value, Form->cbMethod->ItemIndex); break; } Screen->Cursor = cursor; #else ShowMessage(IDS_TRIAL_NOT_SUPPORTED); #endif } delete Form; END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeCyanMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BoolC = true; tocode = true; PGaugeCyan->Progress = 255 * (PGaugeCyan->Height - Y) / PGaugeCyan->Height; ChangeCMY(255 - PGaugeCyan->Progress, Frgb.rgbGreen, Frgb.rgbBlue); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeCyanMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (BoolC) { PGaugeCyan->Progress = 255 * (PGaugeCyan->Height - Y) / PGaugeCyan->Height; ChangeCMY(255 - PGaugeCyan->Progress, Frgb.rgbGreen, Frgb.rgbBlue); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeCyanMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (BoolC) { PGaugeCyan->Progress = 255 * (PGaugeCyan->Height - Y) / PGaugeCyan->Height; ChangeCMY(255 - PGaugeCyan->Progress, Frgb.rgbGreen, Frgb.rgbBlue); } BoolC = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeMagentaMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BoolM = true; tocode = true; PGaugeMagenta->Progress = 255 * (PGaugeMagenta->Height - Y) / PGaugeMagenta->Height; ChangeCMY(Frgb.rgbRed, 255 - PGaugeMagenta->Progress, Frgb.rgbBlue); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeMagentaMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (BoolM) { PGaugeMagenta->Progress = 255 * (PGaugeMagenta->Height - Y) / PGaugeMagenta->Height; ChangeCMY(Frgb.rgbRed, 255 - PGaugeMagenta->Progress, Frgb.rgbBlue); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeMagentaMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (BoolM) { PGaugeMagenta->Progress = 255 * (PGaugeMagenta->Height - Y) / PGaugeMagenta->Height; ChangeCMY(Frgb.rgbRed, 255 - PGaugeMagenta->Progress, Frgb.rgbBlue); } BoolM = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeYellowMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BoolY = true; tocode = true; PGaugeYellow->Progress = 255 * (PGaugeYellow->Height - Y) / PGaugeYellow->Height; ChangeCMY(Frgb.rgbRed, Frgb.rgbGreen, 255 - PGaugeYellow->Progress); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeYellowMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (BoolY) { PGaugeYellow->Progress = 255 * (PGaugeYellow->Height - Y) / PGaugeYellow->Height; ChangeCMY(Frgb.rgbRed, Frgb.rgbGreen, 255 - PGaugeYellow->Progress); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeYellowMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (BoolY) { PGaugeYellow->Progress = 255 * (PGaugeYellow->Height - Y) / PGaugeYellow->Height; ChangeCMY(Frgb.rgbRed, Frgb.rgbGreen, 255 - PGaugeYellow->Progress); } BoolY = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzSpinEditAChange(TObject *Sender) { BEGIN_LOG(""); if (Item == PAL_CMY) { if (rzSpinEditA->Value > 255) rzSpinEditA->Value = 255; if (rzSpinEditA->Value < 0) rzSpinEditA->Value = 0; tocode = true; if (bColorCh == true) ChangeCMY(255 - rzSpinEditA->Value, Frgb.rgbGreen, Frgb.rgbBlue); } else if (Item == PAL_HLS) { tocode = true; if (rzSpinEditA->Value > 359) rzSpinEditA->Value = 359; if (rzSpinEditA->Value < 0) rzSpinEditA->Value = 0; if (bColorCh == true) ChangeHLS(rzSpinEditA->Value, Lig, Sat); } else if (Item == PAL_RGB) { tocode = true; if (rzSpinEditA->Value > 359) rzSpinEditA->Value = 359; if (rzSpinEditA->Value < 0) rzSpinEditA->Value = 0; if (bColorCh == true && rzSpinEditA->Value != Hue) { RGBQUAD c = HLS2RGBQUAD((double)rzSpinEditA->Value, (double)Lig / 100, (double)Sat / 100); ChangeRGB(c.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzSpinEditBChange(TObject *Sender) { BEGIN_LOG(""); if (Item == PAL_CMY) { if (rzSpinEditB->Value > 255) rzSpinEditB->Value = 255; if (rzSpinEditB->Value < 0) rzSpinEditB->Value = 0; tocode = true; if (bColorCh == true) ChangeCMY(Frgb.rgbRed, 255 - rzSpinEditB->Value, Frgb.rgbBlue); } else if (Item == PAL_HLS) { tocode = true; if (rzSpinEditB->Value > 100) rzSpinEditB->Value = 100; if (rzSpinEditB->Value < 0) rzSpinEditB->Value = 0; if (bColorCh == true) ChangeHLS(Hue, rzSpinEditB->Value, Sat); } else if (Item == PAL_RGB) { tocode = true; if (rzSpinEditB->Value > 100) rzSpinEditB->Value = 100; if (rzSpinEditB->Value < 0) rzSpinEditB->Value = 0; if (bColorCh == true && rzSpinEditB->Value != Lig) { RGBQUAD c = HLS2RGBQUAD((double)Hue, (double)rzSpinEditB->Value / 100, (double)Sat / 100); ChangeRGB(Frgb.rgbRed, c.rgbGreen, Frgb.rgbBlue); } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzSpinEditCChange(TObject *Sender) { BEGIN_LOG(""); if (Item == PAL_CMY) { if (rzSpinEditC->Value > 255) rzSpinEditC->Value = 255; if (rzSpinEditC->Value < 0) rzSpinEditC->Value = 0; tocode = true; if (bColorCh == true) ChangeCMY(Frgb.rgbRed, Frgb.rgbGreen, 255 - rzSpinEditC->Value); } else if (Item == PAL_HLS) { tocode = true; if (rzSpinEditC->Value > 100) rzSpinEditC->Value = 100; if (rzSpinEditC->Value < 0) rzSpinEditC->Value = 0; if (bColorCh == true) ChangeHLS(Hue, Lig, rzSpinEditC->Value); } else if (Item == PAL_RGB) { tocode = true; if (rzSpinEditC->Value > 100) rzSpinEditC->Value = 100; if (rzSpinEditC->Value < 0) rzSpinEditC->Value = 0; if (bColorCh == true && rzSpinEditC->Value != Sat) { RGBQUAD c = HLS2RGBQUAD((double)Hue, (double)Lig / 100, (double)rzSpinEditC->Value / 100); ChangeRGB(Frgb.rgbRed, c.rgbGreen, c.rgbBlue); } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PHLSHueChange(TObject *Sender) { if (bColorCh == true) ChangeHLS(PHLS->Hue, PHLS->Lig, PHLS->Sat); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PHLSLigChange(TObject *Sender) { if (bColorCh == true) ChangeHLS(PHLS->Hue, PHLS->Lig, PHLS->Sat); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PHLSSatChange(TObject *Sender) { if (bColorCh == true) ChangeHLS(PHLS->Hue, PHLS->Lig, PHLS->Sat); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonProtectNewClick(TObject *Sender) { ColorSelectorProtect->Initial(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SpeedButtonProtectAllClick(TObject *Sender) { #if defined(TEXSTYLIST) BEGIN_LOG(""); TCursor cursor = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->SearchWholeColor(ColorSelectorProtect->ChoiceColor); ColorSelectorProtect->Invalid(); Screen->Cursor = cursor; END_LOG; #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) { BEGIN_LOG(""); ColorSelectorProtect->LoadFromFile(AppDataItem + "\\Main.ini", "ProtectColor"); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzbtProtectClick(TObject *Sender) { #if defined(TEXSTYLIST) BEGIN_LOG(""); int i; for (i = 0; i < 256; i++) DIB256Palette->Palette->ColorData[i]->Protect = 0; for (i = 0; i < ColorSelectorProtect->Count; i++) { DIB256Palette->Palette->ColorData[ColorSelectorProtect->Code[i]]->Protect = 1; } MainImageForm->Protect = ColorSelectorProtect->Count > 0; MainImageForm->ApplyPalette(); SpeedButtonExitClick(Sender); END_LOG; #endif } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // Private Function // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ExitItem() { BEGIN_LOG(""); ClientHeight = CHeight - SpeedButtonExit->Height; switch(Item) { case PAL_CMY: // ShapeCMY->Brush->Color = clWhite; // ShapeCMY->Pen->Color = clBtnShadow; // PanelCMY->Enabled = false; PanelCMY->Visible = false; sbCMYHLS->Down = false; SaveColorModeIniFile(); break; case PAL_HLS: // ShapeHLS->Brush->Color = clWhite; // ShapeHLS->Pen->Color = clBtnShadow; // PanelHLS->Enabled = false; PanelHLS->Visible = false; sbCMYHLS->Down = false; SaveColorModeIniFile(); break; case PAL_RGB: PanelRGB->Visible = false; sbCMYHLS->Down = false; SaveColorModeIniFile(); break; case PAL_LIBRARY: // ShapeLibrary->Brush->Color = clWhite; // ShapeLibrary->Pen->Color = clBtnShadow; ColorLibraryForm->ExitForm(); ColorLibraryForm->Visible = false; UserColorLibForm->Visible = false; DTPColorLibraryForm->Visible = false; // 080401 PanelLibrary->Enabled = false; PanelLibrary->Visible = false; sbLibrary->Down = false; if (sbColorGuide->Down) sbColorGuide->Down = false; break; case PAL_FILE: // ShapeFile->Brush->Color = clWhite; // ShapeFile->Pen->Color = clBtnShadow; sbFile->Down = false; break; case PAL_CHART: // ShapeChart->Brush->Color = clWhite; // ShapeChart->Pen->Color = clBtnShadow; ColorChartForm->Visible = false; sbChart->Down = false; break; #if defined(TEXSTYLIST) case PAL_PROTECT: ColorSelectorProtect->SaveToFile(AppDataItem + "\\Main.ini", "ProtectColor"); ColorSelectorProtect->Initial(); // ShapeProtect->Brush->Color = clWhite; // ShapeProtect->Pen->Color = clBtnShadow; if (step > 0 && MainImageForm) MainImageForm->DrawRectangleLocate(Temp); step = 0; IsDraw = false; if (MainImageForm) { MainImageForm->iMainImage->OnPaintLocate = NULL; /////////////////by jeegeo MainImageForm->bDrawPen = true; } PanelProtect->Enabled = false; PanelProtect->Visible = false; sbProtect->Down = false; RepaintImage(); break; #endif } Item = PAL_NONE; isChoice = false; END_LOG; } // -------------------------------------------------------------------------- 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·Î ÄÚµåÈ­ Çϱâ À§ÇØ { BEGIN_LOG(""); RGBQUAD notFound = { 0, 0, 0, 0 }; if (pantone == false) { /////////////////////////// RGBQUAD dst; // To TP Color Word p; PStandardColorData p1; PTextileColorData pt; int e, error; error = -1; 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) || (e < error)) { error = e; pt = TextileColor->Search(BlockNumber, DataNumber, p); DIB256Palette->SetTPTextileColor(DIB256Palette->ChoiceIndex, p, pt->Number, dst.rgbRed, dst.rgbGreen, dst.rgbBlue); } } if (error == -1) { DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, src.rgbRed, src.rgbGreen, src.rgbBlue); END_LOG; return src; } else { END_LOG; return dst; } } if (pantone == true) { /////////////////////////////////////////////k3dogs 20001211 RGBQUAD dst; // To Pantone Color Code // Pantone Color°¡ Ãß°¡µÇ¾î ±âÁ¸ ÄÚµå ÁÖ¼® ó¸®. »õ·Î °³¹ßµÈ °ÍÀ¸·Î ±³Ã¼ by david 080828 TColor result_color; String ColorName; TColorData *colorData = new TColorData(); if (DTPColorLibraryForm) DTPColorLibraryForm->FindNearestColor(src, result_color, ColorName, colorData); DIB256Palette->SetPantoneColor2(DIB256Palette->ChoiceIndex, colorData); dst = colorData->RGB; delete colorData; END_LOG; return dst; } END_LOG; return notFound; } // -------------------------------------------------------------------------- void __fastcall TPaletteForm::SetCMY() { BEGIN_LOG(""); FcmyC = 255 - DIB256Palette->ForegroundRgb.rgbRed; FcmyM = 255 - DIB256Palette->ForegroundRgb.rgbGreen; FcmyY = 255 - DIB256Palette->ForegroundRgb.rgbBlue; ChangeCMY(255 - FcmyC, 255 - FcmyM, 255 - FcmyY); ShapeOriginColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); END_LOG; } // ------------------------------------------------------------------------- void __fastcall TPaletteForm::SetHLS() { BEGIN_LOG(""); double h, l, s; int tHue = 0, tLig = 0, tSat = 0; TColor2HLS(RGB2TColor(DIB256Palette->ForegroundRgb.rgbRed, DIB256Palette->ForegroundRgb.rgbGreen, DIB256Palette->ForegroundRgb.rgbBlue), h, l, s); if ((l != 0) && (s != 0)) { tHue = h + 0.5; tLig = l * 100 + 0.5; tSat = s * 100 + 0.5; } else if (s == 0) { tSat = 0; tLig = l * 100 + 0.5; } if (l == 0) tLig = 0; ChangeHLS(tHue, tLig, tSat); Hue1 = Hue; Lig1 = Lig; Sat1 = Sat; h = (double)Hue; l = (double)Lig / 100; s = (double)Sat / 100; ShapeOriginColor->Brush->Color = HLS2TColor(h, l, s); END_LOG; } // -------------------------------------------------------------------------- void __fastcall TPaletteForm::SetRGB() { BEGIN_LOG(""); FrgbR = DIB256Palette->ForegroundRgb.rgbRed; FrgbG = DIB256Palette->ForegroundRgb.rgbGreen; FrgbB = DIB256Palette->ForegroundRgb.rgbBlue; ChangeRGB(FrgbR, FrgbG, FrgbB); ShapeOriginColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); END_LOG; } // -------------------------------------------------------------------------- void __fastcall TPaletteForm::Finder(int Index) { BEGIN_LOG(""); RGBQUAD rgb; int n; Word p; PStandardColorData p1; PTextileColorData pt; TColorData *ucd; String ColorName, Code; byte 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; 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 TColorData; if (UserColorLibForm->SearchRGB(rgb, rzedLocateFinder->Text, ucd, CheckBoxFinder->Checked)) { //if (ucd->Kind == 0x10) { if ((ucd->Kind & 0x0FFF) == 0x0000){ 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) { else if ((ucd->Kind & 0x0FFF) == 0x0003){ Code = StandardColor->PN2Code(ucd->Page, ucd->Number); Code = Format("(TP Standard) %s", OPENARRAY(TVarRec, (Code.c_str()))); } //else if (ucd->Kind == 0x14) { else if ((ucd->Kind & 0x0FFF) == 0x0004){ Code = TextileColor->PN2Code(ucd->Page, ucd->Number); Code = Format("(TP Textile) %s", OPENARRAY(TVarRec, (Code.c_str()))); } //ColorName = Format("[%s] %s", OPENARRAY(TVarRec, (ucd->ColorName, Code.c_str()))); if (ucd->ColorName != NULL && StrLen(ucd->ColorName) > 0) { ColorName = Format("[%s] %s", OPENARRAY(TVarRec, (ucd->ColorName, Code.c_str()))); } else if ((ucd->Kind & 0x0FFF) == 0x0006) { ColorName = (char *)ucd->additionalColorData->GetData(TAG_PANTONE_COLOR); } else ColorName = ""; LabelLibraryFinder->Caption = ColorName; ShapeLibraryFinder->Brush->Color = (TColor)RGBToTColor(ucd->RGB); } else { LabelLibraryFinder->Caption = IDS_CNONE; ShapeLibraryFinder->Brush->Color = clWhite; } delete ucd; break; case 5: // DTPCOLOR: case 6: // PANTONECOLOR: TColor result_color; if (DTPColorLibraryForm) DTPColorLibraryForm->FindNearestColor(rgb, result_color, ColorName); LabelLibraryFinder->Caption = ColorName; ShapeLibraryFinder->Brush->Color = result_color; break; } ColorLibraryForm->View(); END_LOG; } // -------------------------------------------------------------------------- void __fastcall TPaletteForm::PrintPrinterColor(String Start, String Number, int nPage, bool bFast) { BEGIN_LOG(""); 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; Sheet < num; Sheet++) { // ¿¬¼ÓÃâ·Â k = Page + Sheet; if (k < 36) { PBitmap(k, 0, 2, nPage, bFast); // 2: 36x15 3: 12x15 4: 36x7 PBitmap(k, 1, 2, nPage, bFast); } else if (k > 36) { if (k > 72) break; PBitmap(k, 0, 3, nPage, bFast); } else { PBitmap(k, 0, 4, nPage, bFast); } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PrintTPStandardColor(int Size, String Start, String Number, int nPage, bool bFast) { BEGIN_LOG(""); 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 < num; sheet++) { if (Size == 0) { P = Page + 20 * sheet; if (P >= 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); } } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PrintTPTextileColor(int Size, String Start, String Number, int nPage, bool bFast) { BEGIN_LOG(""); 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 < num; sheet++) { if (Size == 0) { P = Page + 20 * sheet; if (P >= 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); } } END_LOG; } // --------------------------------------------------------------------------- ///printÇÒ library¸¦ ½ÇÁ¦·Î Canvas¿¡ ±×¸®°í Canvas¸¦ Ãâ·ÂÇϵµ·Ï ÇÔ¼ö¸¦ È£ÃâÇÏ´Â ÇÔ¼ö /** PrintPrinterColor(), PrintTPStandardColor(), PrintTPTextileColor(), UserColorLibForm->PrintUserColor() ¿¡¼­ È£ÃâµÇ¾îÁø´Ù. ¾Ë¸ÂÀº CanvasÅ©±â¸¦ ±¸Çϰí BitmapÀ» ¸¸µé°í Bitmap¿¡¼­ Canvas¸¦ ¸¸µç´Ù. Canvas¿¡ Á¦¸ñÀ» ¾²°í ¹Ù·Î P1000Bitmap(), PTextileBitmap(), PColorBitmap1() ¸¦ È£ÃâÇÏ¿© color chip°ú color code¸¦ Àû´Â´Ù. PrintForm¿¡¼­ ¼±ÅÃÇÑ ¿É¼Ç¿¡ µû¶ó Print·Î ¹Ù·Î Ãâ·ÂÇϰųª TTexpiaBitmap->SaveToFile·Î ÆÄÀÏÀúÀåÇÑ´Ù. */ void __fastcall TPaletteForm::PBitmap(int Page, int Size, int i, int nPage, bool bFast, int Method) // Method:0,1 ÇÁ¸°Æ®, 2: ÀúÀå modified smallpotato (2007.01.26) { BEGIN_LOG(""); TTexpiaBitmap *Bitmap = NULL; String title; int w, h, tab; TCanvas *Canvas = NULL; TPException ec = EC_NONE; if ((Bitmap = new TTexpiaBitmap) == NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); 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)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } Bitmap->FillRect(Rect(0, 0, Bitmap->Width, Bitmap->Height), clWhite); if ((Canvas = Bitmap->CreateCanvas()) == NULL) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); 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 (Method == 0 || Method == 1) { // ±×³É ÇÁ¸°Æ® 080324 if (!Print(Bitmap, nPage, bFast)) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } } else if (Method == 2) { // ÆÄÀÏ¿¡ ÀúÀå Char ordinal[255]; _stprintf(ordinal, L"%d_%d", Page + 1, Size); switch(SaveDialog->FilterIndex) { case 1: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".bmp"), FILE_BMP, 0); break; case 2: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".jpg"), FILE_JFIF, 2); break; case 3: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".pct"), FILE_PCT, 0); break; case 4: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".pcx"), FILE_PCX, 0); break; case 5: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".png"), FILE_PNG, 0); break; case 6: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".psd"), FILE_PSD, 0); break; case 7: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".ras"), FILE_RAS, 0); break; case 8: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".tga"), FILE_TGA, 0); break; case 9: Bitmap->SaveToFile((rzedLocatePrint->Text) + String(ordinal) + String(".tif"), FILE_TIF, 0); break; // case 10: Bitmap->SaveToLabTifFile((rzedLocatePrint->Text)+ordinal+".tif"); break; } } delete Bitmap; END_LOG; return; fail: if (Canvas) Bitmap->DeleteCanvas(Canvas); if (Bitmap) delete Bitmap; EXCEPTION_MESSAGE_OK(ec); END_LOG; } // --------------------------------------------------------------------------- bool __fastcall TPaletteForm::PColorBitmap1(TTexpiaBitmap *bm, TCanvas *Canvas, int P, int Next, int w, int h) { BEGIN_LOG(""); TRect BitRect, StrRect; // 36x15 Bitmap int i, j, num, tab; Byte r, g, b, ws, hs; String 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, String(j + 1)); // ¼öÁ÷ÅØ½ºÆ® } for (i = 0; i < 18; i++) { Canvas->Font->Size = 10; Canvas->Font->Color = clRed; tab = ((ws - 5) - Canvas->TextWidth(String(num + i + 1))) / 2; // Adjust Center Canvas->TextOut(20 + tab + ws * i, 55, String(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); PrintColorChip24TP(bm, BitRect, r, g, b); // convert by celberus 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); END_LOG; return true; fail: END_LOG; return false; } // --------------------------------------------------------------------------- bool __fastcall TPaletteForm::PColorBitmap2(TTexpiaBitmap *bm, TCanvas *Canvas, int P, int w, int h) // 12x15 { BEGIN_LOG(""); TRect BitRect, StrRect; // 12x15 Bitmap int i, j, num, tab; Byte r, g, b, ws, hs; String 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, String(j + 1)); // ¼öÁ÷ÅØ½ºÆ® } for (i = 0; i < 12; i++) { tab = (ws - 10 - Canvas->TextWidth(String(num + i + 1))) / 2; // Adjust Center Canvas->Font->Color = clRed; Canvas->TextOut(20 + tab + ws * i, 55, String(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); PrintColorChip24TP(bm, BitRect, r, g, b); // convert by celberus 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); END_LOG; return true; fail: END_LOG; return false; } // --------------------------------------------------------------------------- bool __fastcall TPaletteForm::PColorBitmap3(TTexpiaBitmap *bm, TCanvas *Canvas, int P, int w, int h) // 36x7 { BEGIN_LOG(""); TRect BitRect, StrRect; // 36x7 Bitmap int i, j, num, y, tab; Byte r, g, b, k, ws, hs; String 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, String(j + 1)); // ¼öÁ÷ÅØ½ºÆ® } for (i = 0; i < 18; i++) { Canvas->Font->Size = 10; Canvas->Font->Color = clRed; tab = (ws - 5 - Canvas->TextWidth(String(num + i + 1))) / 2; // Adjust Center Canvas->TextOut(20 + tab + ws * i, 55 + y, String(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); PrintColorChip24TP(bm, BitRect, r, g, b); // convert by celberus 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); } END_LOG; return true; fail: END_LOG; return false; } // --------------------------------------------------------------------------- bool __fastcall TPaletteForm::P1000Bitmap(TTexpiaBitmap *bm, TCanvas *Canvas, int Page, int Size, int w, int h) { BEGIN_LOG(""); PStandardColorBlock bp; PStandardColorData dp; TRect BitRect, StrRect; int lim, i, j, k, m, t, tab; String 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; 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 (j < bp->Data->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; } PrintColorChip24TP(bm, BitRect, dp->Color.red, dp->Color.green, dp->Color.blue); // convert by celberus 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); } } } END_LOG; return true; fail: END_LOG; return false; } // --------------------------------------------------------------------------- bool __fastcall TPaletteForm::PTextileBitmap(TTexpiaBitmap *bm, TCanvas *Canvas, int Page, int Size, int w, int h) { BEGIN_LOG(""); PTextileColorBlock bp; PTextileColorData dp; TRect BitRect, StrRect; int lim, i, j, k, m, t, tab; String 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 (j < bp->Data->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; } PrintColorChip24TP(bm, BitRect, dp->Color.red, dp->Color.green, dp->Color.blue); // convert by celberus 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); } } } END_LOG; return true; fail: END_LOG; return false; } // --------------------------------------------------------------------------- bool __fastcall TPaletteForm::Print(TTexpiaBitmap *Bitmap, int nPage, bool bFast) { switch(ItemLibrary) { case 1: return SendToPrinterTP(Bitmap, 160, "Printer Color Library" + rzedStart->Text, nPage, bFast); // convet by celberus case 2: return SendToPrinterTP(Bitmap, 160, "TP Standard Color Library" + rzedStart->Text, nPage, bFast); // convet by celberus case 3: return SendToPrinterTP(Bitmap, 160, "TP Textile Color Library" + rzedStart->Text, nPage, bFast); // convet by celberus } return false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::RepaintImage() { BEGIN_LOG(""); if (MainImageForm && MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8) { if (NewColorWayForm) { // added by maxleo21c (05.04.29) - if¹®¸¸ Ãß°¡ else ÀÌÈÄ´Â ±âÁ¸ RGBQUAD rgb[256]; DIB256Palette->Palette->ToRGBQUAD(rgb, 256); NewColorWayForm->PLayerImage->ColorChange(DIB256Palette->ChoiceIndex, rgb); // NewColorWayForm->RepaintImage(); } else if (isSelectedColorChanged) { MainImageForm->OnColorChange(DIB256Palette->ChoiceIndex); } ::RepaintImage(); PenManagerForm->SetColor(MainImageForm->Palette); if (MainImageForm->AutoRepeat && (MainImageForm->LayerCNT == MainImageForm->ARLayerCnt)) MainImageForm->RedrawingRepeat(false, false, false); isSelectedColorChanged = false; // by celberus } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::CreatePantone() // k3dogs 20001211 { // Main¿¡¼­ ÃʱâÈ­ SearchPanel->BringToFront(); // PanelLibrary->Height = 270; ClientHeight = CHeight + PanelLibrary->Height; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DestroyPantone() { SearchPanel->SendToBack(); // PanelLibrary->Height = 309; ClientHeight = CHeight + PanelLibrary->Height; } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // Public Function // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- void __fastcall TPaletteForm::InitForm(TPalette *Palette) { if (Visible) { if (Palette == NULL) ExitItem(); // ¸ÞÀÎ À̹ÌÁö ´ÝÀ» ¶§ ÆÈ·¹Æ® ¸Þ´º °°ÀÌ ´ÝÈ÷µµ·Ï.. by celberus DIB256Palette->SetPalette(Palette); if (MainImageForm && MainImageForm->iMainImage->uBitmap->BitsPerPixel == 24) { DIB256Palette->CursorIndex = 1; } DIB256Palette->CursorIndex = 1; HS = false; LS = false; Img1Chk = false; Img2Chk = false; } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ExitForm() { BEGIN_LOG(""); // °­Á¦·Î ÆÈ·¹Æ®ÆûÀ» ´Ý¾Æ¾ßÇÒ ¶§ - by monkman (2009.09.14) ClientHeight = CHeight - SpeedButtonExit->Height; ColorSelectorProtect->SaveToFile(AppDataItem + "\\Main.ini", "ProtectColor"); ColorSelectorProtect->Initial(); step = 0; IsDraw = false; if (ColorLibraryForm) ColorLibraryForm->Visible = false; if (UserColorLibForm) UserColorLibForm->Visible = false; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; if (ColorChartForm) ColorChartForm->Visible = false; PanelProtect->Enabled = false; PanelProtect->Visible = false; sbProtect->Down = false; Item = PAL_NONE; isChoice = false; END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SetFont() { SetSmallFont(Font); SetSmallFont(LabelLibraryFinder->Font); SetSmallFont(PGaugeCyan->Font); SetSmallFont(PGaugeMagenta->Font); SetSmallFont(PGaugeYellow->Font); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SaveColorBackup(int index) { BEGIN_LOG(""); if (undosw == true) { END_LOG; return; } if (!NewColorWayForm) // added by maxleo21c (05.04.29) - if¹®¸¸ Ãß°¡ MainImageForm->UndoSave(UK_COLOR, Rect(0, 0, 0, 0)); // by linuxjun Undo_Method PColorBackup cb = new TColorBackup; cb->ColorMap = new TColorData; if (NewColorWayForm && index) { cb->Index = index; cb->ColorMap->Copy(DIB256Palette->Palette->ColorData[index]); } else { cb->Index = DIB256Palette->ChoiceIndex; cb->ColorMap->Copy(DIB256Palette->Palette->ColorData[DIB256Palette->ChoiceIndex]); } ColorBackup->Add(cb); sbUndo->Enabled = true; END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DeleteColorBackup() { BEGIN_LOG(""); PColorBackup cb; while (ColorBackup->Count > 0) { cb = (PColorBackup)ColorBackup->Last(); ColorBackup->Remove(cb); delete cb->ColorMap; delete cb; } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::iMainImageMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { BEGIN_LOG(""); #if defined(TEXSTYLIST) TRect r; Byte *scan; TPException ec = EC_NONE; if (MainImageForm->iMainImage->Reflection && MainImageForm->reflection){ POINT reflectionPos; reflectionPos = MainImageForm->reflection->FindOriginalPos(X, Y); if (reflectionPos.x < MainImageForm->reflection->BitmapRange.left || reflectionPos.y < MainImageForm->reflection->BitmapRange.top || reflectionPos.x > MainImageForm->reflection->BitmapRange.right || reflectionPos.y > MainImageForm->reflection->BitmapRange.bottom){ END_LOG; return; } } if (Item == PAL_PROTECT) { if (Button == mbMiddle || (Shift.Contains(ssShift) && Button == mbLeft)) { POINT pt; if (MainImageForm->iMainImage->Reflection && MainImageForm->reflection){ pt = MainImageForm->reflection->FindOriginalPos(X, Y); } else { pt.x = X; pt.y = Y; } if (SpeedButtonProtectOne->Down) { if (SpeedButtonProtectDelete->Down) { ColorSelectorProtect->DeleteColor( MainImageForm->iMainImage->uBitmap->GetPixelColor(pt.x, pt.y)); } else { ColorSelectorProtect->AddColor( MainImageForm->iMainImage->uBitmap->GetPixelColor(pt.x, pt.y)); } } else { if (step > 0) { Temp.right = X; Temp.bottom = Y; MainImageForm->DrawRectangleLocate(Temp); 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->uBitmap->StartScanLine()) { ec = EC_MEMORY_LACK; SAVE_EXCEPTION(ec); goto fail; } RECT rt = r; if (MainImageForm->iMainImage->Reflection && MainImageForm->reflection){ POINT pts = MainImageForm->reflection->FindOriginalPos(r.Left, r.Top); POINT pte = MainImageForm->reflection->FindOriginalPos(r.Right, r.Bottom); rt.left = min(pts.x, pte.x); rt.top = min(pts.y, pte.y); rt.right = max(pts.x, pte.x); rt.bottom = max(pts.y, pte.y); } if (SpeedButtonProtectDelete->Down) { for (Y = rt.top; Y < rt.bottom; Y++) { scan = (Byte*)MainImageForm->iMainImage->uBitmap->GetScanLine(Y); for (X = rt.left; X < rt.right; X++) { ColorSelectorProtect->DeleteColor(*(scan + X)); } } } else { for (Y = rt.top; Y < rt.bottom; Y++) { scan = (Byte*)MainImageForm->iMainImage->uBitmap->GetScanLine(Y); for (X = rt.left; X < rt.right; X++) { ColorSelectorProtect->AddColor(*(scan + X)); } } } MainImageForm->iMainImage->uBitmap->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; MainImageForm->DrawRectangleLocate(Temp); IsDraw = true; step = 11; } } } } if (DIB256Palette->ChoiceIndex > MainImageForm->Palette->UseColor) { MainImageForm->Palette->UseColor = DIB256Palette->ChoiceIndex; DIB256Palette->UseColor = DIB256Palette->ChoiceIndex; } END_LOG; return; fail: MainImageForm->iMainImage->uBitmap->StopScanLine(); EXCEPTION_MESSAGE_OK(ec); END_LOG; #endif } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::iMainImageMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { #if defined(TEXSTYLIST) if (Item == PAL_PROTECT) { if (SpeedButtonProtectOne->Down == false) { if (step > 0) { if (IsDraw) MainImageForm->DrawRectangleLocate(Temp); Temp.right = X; Temp.bottom = Y; MainImageForm->DrawRectangleLocate(Temp); IsDraw = true; } } } #endif } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::iMainImagePaint() { IsDraw = false; MainImageForm->iMainImage->OnPaintLocate = NULL; /////////////////by jeegeo } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::UpdateForm(int i) { if (Item != PAL_LIBRARY && Item != PAL_FILE) ExitItem(); sbProtect->Enabled = i == 8; sbRearrange->Enabled = i == 8; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::KnitChangeColor() { // } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbCMYHLS_MouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { #ifndef N_SCREENCAM BEGIN_LOG(""); String screencam, cam, camdir; TRegistry *Registry; SHELLEXECUTEINFO screeninfo; if (Button == mbRight && Shift.Contains(ssShift)) { Registry = new TRegistry; if (!Registry) { END_LOG; return; } Registry->RootKey = HKEY_LOCAL_MACHINE; Registry->OpenKey(RegFilename + "\\Directory", TRUE); // yw screencam = Registry->ReadString("screencam"); delete Registry; memset(&screeninfo, 0, sizeof(screeninfo)); screeninfo.cbSize = sizeof(screeninfo); screeninfo.lpVerb = L"open"; screeninfo.lpDirectory = screencam.c_str(); screeninfo.lpFile = L"scplayer.exe"; switch(dynamic_cast(Sender)->Tag) { case 0: cam = screencam + "\\TexStylist\\cmy.scm"; break; case 1: cam = screencam + "\\TexStylist\\HLS.scm"; break; case 2: cam = screencam + "\\TexStylist\\color_library.scm"; break; case 3: cam = screencam + "\\TexStylist\\color_file.scm"; break; case 4: cam = screencam + "\\TexStylist\\color_chart.scm"; break; case 5: cam = screencam + "\\TexStylist\\color_selection.scm"; break; case 6: cam = screencam + "\\TexStylist\\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."); END_LOG; return; } } END_LOG; #endif } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::Timer300Timer(TObject *Sender) { // } // --------------------------------------------------------------------------- // void __fastcall TPaletteForm::UpdateCMYHLS() // { // switch (Item) { // case PAL_CMY: SetCMY(); break; // case PAL_HLS: SetHLS(); break; // } // } ////--------------------------------------------------------------------------- void __fastcall TPaletteForm::FormActivateCOLOR() { DIB256Palette->ChoiceIndex = 2; DIB256Palette->UseColor = 2; // ÇöÀç Ȱ¼ºÈ­µÈ ĵ¹ö½ºÀÇ ÆÈ·¹Æ®»öÀ¸·Î º¯°æ - by monkman (2010.01.08) PenManagerForm->PenShapeChange(2); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::DIB256PaletteDblClick(TObject *Sender) { BEGIN_LOG(""); // MainImageForm Á¦°Å½Ã¿¡ ¸Þ¸ð¸® Á¢±Ù ¿À·ù¹ß»ýÇØ¼­ Ãß°¡ if (MainImageForm == NULL) { END_LOG; return; } if (MainMenuForm->Item == T_STYLECOMBO) { PatternLibrary->AddPatternColor(); } if (DIB256Palette->ColorCount <= DIB256Palette->CursorIndex) { DIB256Palette->SetNormal(DIB256Palette->ColorCount, 0, 0, 0); if (FOnChoiceColor) FOnChoiceColor(DIB256Palette->CursorIndex); if (MainImageForm) // MainImageFormÀ» ´Ý¾ÒÀ»¶§ ¿¡·¯°¡ ¹ß»ýÇÑ´Ù. MainImageForm->Palette->UseColor = DIB256Palette->CursorIndex; DIB256Palette->Palette->UseColor = DIB256Palette->CursorIndex; } // 2005 Vector Upgrade =-= [ Begin ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // Vector Color º¯°æ - Color/Fill - by monkman (2005.03.03) if (MainMenuForm->Item == T_VECTOR && VectorForm) { if (VectorForm->V_Item == M_O_COLOR) { // ¾Æ´Ï¶ó¸é Color Change // Merge»óŶó¸é MergeµÇ´Â Object¸¦ Áö¿ì±â À§Çؼ­... maxleo21c (04.12.22) if (VecDraw->NVector->bMergeMode) VecDraw->ExitMerge(); if (!(VecDraw->NVector->bSelected)) { END_LOG; return; } VecDraw->ChangeObjectColor(false); } else if (VectorForm->V_Item == M_O_FILL) { // PatternPanel VisibleÀÌ trueÀ̸é Fill Change // Merge»óŶó¸é MergeµÇ´Â Object¸¦ Áö¿ì±â À§Çؼ­... maxleo21c (04.12.22) if (VecDraw->NVector->bMergeMode) VecDraw->ExitMerge(); if (!(VecDraw->NVector->bSelected)) { END_LOG; return; } VecDraw->ChangeObjectColor(true); } } // =-=-=-=-=-=-=-=-=-=-=-= [ End ] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- // else if (MainMenuForm->Item == T_COMBO) { // added by maxleo21c (05.04.22) // if (NewColorWayForm) // NewColorWayForm->ChageColorByPaletteBblClick(); // } END_LOG; } // --------------------------------------------------------------------------- // 080320 // 080320 void __fastcall TPaletteForm::rzbtDTPColorClick(TObject *Sender) { BEGIN_LOG(""); // 5: DTP Color, 6: PANTONE COLOR if (ItemLibrary != 5) { if (DTPColorLibraryForm != NULL) delete DTPColorLibraryForm; DTPColorLibraryForm = NULL; DTPColorLibraryForm = new TDTPColorLibraryForm(MainForm); DTPColorLibraryForm->Parent = MainForm; DTPColorLibraryForm->Visible = sbDisplayLibrary->Down; } DestroyPantone(); ItemLibrary = 5; // DTPCOLOR; BlockNumber = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; rzedLocateSearch->Enabled = false; rzbitbtnLocateSearch->Enabled = false; rzedLocateFinder->Enabled = false; rzbitbtnLocateFinder->Enabled = false; rzedLocatePrint->Enabled = true; rzbitbtnLocatePrint->Enabled = true; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; rzedLibrarySearch->Enabled = true; rzedLibrarySearch->Text = ""; rzedLibrarySearch->EditMask = ""; // UserColorLibFormÀ» ´ÝÁö ¾Ê´ÂÇÑ °è¼Ó »ç¿ë°¡´É - by monkman (2006.11.23) UserColorLibForm->Visible = false; ColorLibraryForm->Visible = false; // rzedLibrarySearch->SetFocus(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzcomboboxLibraryChange(TObject *Sender) { TRzComboBox *combobox = (TRzComboBox*)Sender; int index = combobox->ItemIndex; ChangeLibrary(index); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ChangeLibrary(int index) { // ItemLibrary // 0: Color Guide, 1: Printer Color, 2: TP Standard Color, // 3: TP Textile Color, 4: User Color, 5: DTP Color, 6: PANTONE COLOR switch(index) { case 0: SelectPantoneColor(); break; case 1: SelectPrinterColor(); break; case 2: SelectTPStandardColor(); break; case 3: SelectTPTextileColor(); break; case 4: SelectUserColor(); break; } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectColorGuide() { BEGIN_LOG(""); DestroyPantone(); ItemLibrary = 0; PageControlLibrary->ActivePage = TabSheetLibrarySearch; rzedLibrarySearch->Text = ""; rzedLibrarySearch->EditMask = ""; rzedLibrarySearch->Enabled = false; LabelLibrarySearch->Caption = IDS_CNONE; ShapeLibrarySearch->Brush->Color = clWhite; rzedLocateSearch->Enabled = false; rzbitbtnLocateSearch->Enabled = false; rzedLocateFinder->Enabled = false; rzbitbtnLocateFinder->Enabled = false; rzedLocatePrint->Enabled = false; rzbitbtnLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; PageControlLibrary->Enabled = false; UserColorLibForm->Visible = false; ColorLibraryForm->Visible = true; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; // 080320 ColorLibraryForm->ChangeItem(ItemLibrary, MainImageForm->iMainImage->uBitmap); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectPrinterColor() { BEGIN_LOG(""); DestroyPantone(); ItemLibrary = 1; hh = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; rzedLocateSearch->Enabled = false; rzbitbtnLocateSearch->Enabled = false; rzedLocateFinder->Enabled = false; rzbitbtnLocateFinder->Enabled = false; rzedLocatePrint->Enabled = false; rzbitbtnLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; rzedLibrarySearch->Enabled = true; rzedLibrarySearch->Text = ""; // EditMask¸¦ »ç¿ëÇÒ ¶§ 00\-00:00;1 °ú °°ÀÌ 0À¸·Î ÃʱâÈ­¸¦ ÇßÀ» °æ¿ì¿¡ // ÀÔ·ÂµÈ Text°¡ Á¤È®ÇÏÁö ¾ÊÀ» °æ¿ì "Invalid input value. Use escape key to abandon changes" ¿Í °°Àº ¸Þ¼¼Áö°¡ // ¹ß»ýÇÑ´Ù. BorlandÀÇ Consts_SMaskEditErr ExceptionÀÌ ¹ß»ýÇϱ⠶§¹®ÀÌ´Ù. ÀÌ¿Í °°Àº ¹®Á¦¸¦ ÇØ°áÇÏ´Â ¹æ¹ýÀº // ÃʱâÈ­¸¦ 9·Î ÇÏ¸é µÈ´Ù. ÇöÀç ExceptionÀÌ ¹ß»ýÇÏÁö ¾Ê´Â °ÍÀ» È®ÀÎ ÇÔ. by david 091009 rzedLibrarySearch->EditMask = "99\-99:99;1"; UserColorLibForm->Visible = false; if (sbDisplayLibrary->Down) ColorLibraryForm->Visible = true; else ColorLibraryForm->Visible = false; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; // 080320 ColorLibraryForm->ChangeItem(ItemLibrary); // TabSheetLibrarySearch->SetFocus(); // µÎ¹ø ¿¬¼Ó A/S »ç¿ëÇϸé Focus°¡ »ç¶óÁø´Ù À̸¦ ¹æÁö Çϱâ À§ÇØ by tmddn85 // if (MainImageForm) // added by maxleo21c (05.05.12) // MainImageForm->tempRadioButton->SetFocus(); // ´ÜÃàŰ Æ÷Ä¿½º ¸Ô°Ô Çϱâ À§Çؼ­ // rzedLibrarySearch->SetFocus(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectTPStandardColor() { BEGIN_LOG(""); DestroyPantone(); ItemLibrary = 2; BlockNumber = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; rzedLocateSearch->Enabled = false; rzbitbtnLocateSearch->Enabled = false; rzedLocateFinder->Enabled = false; rzbitbtnLocateFinder->Enabled = false; rzedLocatePrint->Enabled = false; rzbitbtnLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; rzedLibrarySearch->Enabled = true; rzedLibrarySearch->Text = ""; rzedLibrarySearch->EditMask = ""; UserColorLibForm->Visible = false; if (sbDisplayLibrary->Down) ColorLibraryForm->Visible = true; else ColorLibraryForm->Visible = false; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; // 080320 ColorLibraryForm->ChangeItem(ItemLibrary); // TabSheetLibrarySearch->SetFocus(); // µÎ¹ø ¿¬¼Ó A/S »ç¿ëÇϸé Focus°¡ »ç¶óÁø´Ù À̸¦ ¹æÁö Çϱâ À§ÇØ by tmddn85 // if (MainImageForm) // added by maxleo21c (05.05.12) // MainImageForm->tempRadioButton->SetFocus(); // ´ÜÃàŰ Æ÷Ä¿½º ¸Ô°Ô Çϱâ À§Çؼ­ END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectTPTextileColor() { BEGIN_LOG(""); DestroyPantone(); ItemLibrary = 3; BlockNumber = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; rzedLocateSearch->Enabled = false; rzbitbtnLocateSearch->Enabled = false; rzedLocateFinder->Enabled = false; rzbitbtnLocateFinder->Enabled = false; rzedLocatePrint->Enabled = false; rzbitbtnLocatePrint->Enabled = false; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; rzedLibrarySearch->Enabled = true; rzedLibrarySearch->Text = ""; rzedLibrarySearch->EditMask = "99\-9999;1"; UserColorLibForm->Visible = false; if (sbDisplayLibrary->Down) ColorLibraryForm->Visible = true; else ColorLibraryForm->Visible = false; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; // 080320 ColorLibraryForm->ChangeItem(ItemLibrary); // TabSheetLibrarySearch->SetFocus(); // µÎ¹ø ¿¬¼Ó A/S »ç¿ëÇϸé Focus°¡ »ç¶óÁø´Ù À̸¦ ¹æÁö Çϱâ À§ÇØ by tmddn85 // if (MainImageForm) // added by maxleo21c (05.05.12) // MainImageForm->tempRadioButton->SetFocus(); // ´ÜÃàŰ Æ÷Ä¿½º ¸Ô°Ô Çϱâ À§Çؼ­ // rzedLibrarySearch->SetFocus(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectUserColor() { BEGIN_LOG(""); DestroyPantone(); ItemLibrary = 4; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; rzedLocateSearch->Enabled = true; rzbitbtnLocateSearch->Enabled = true; rzedLocateFinder->Enabled = true; rzbitbtnLocateFinder->Enabled = true; rzedLocatePrint->Enabled = true; rzbitbtnLocatePrint->Enabled = true; CheckBoxSearch->Enabled = true; CheckBoxFinder->Enabled = true; rzedLibrarySearch->Enabled = true; rzedLibrarySearch->Text = ""; rzedLibrarySearch->EditMask = ""; LabelLibrarySearch->Caption = IDS_CNONE; ShapeLibrarySearch->Brush->Color = clWhite; ColorLibraryForm->Visible = false; if (DTPColorLibraryForm) DTPColorLibraryForm->Visible = false; // 080320 if (sbDisplayLibrary->Down) { UserColorLibForm->Visible = true; UserColorLibForm->Show(); } else { UserColorLibForm->Visible = false; } // TabSheetLibrarySearch->SetFocus(); // µÎ¹ø ¿¬¼Ó A/S »ç¿ëÇϸé Focus°¡ »ç¶óÁø´Ù À̸¦ ¹æÁö Çϱâ À§ÇØ by tmddn85 // if (MainImageForm) // added by maxleo21c (05.05.12) // MainImageForm->tempRadioButton->SetFocus(); // ´ÜÃàŰ Æ÷Ä¿½º ¸Ô°Ô Çϱâ À§Çؼ­ END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectPantoneColor() { BEGIN_LOG(""); // 5: DTP Color, 6: PANTONE COLOR if (ItemLibrary != 6) { /* if(DTPColorLibraryForm != NULL) delete DTPColorLibraryForm; DTPColorLibraryForm = NULL; DTPColorLibraryForm = new TDTPColorLibraryForm(MainForm); DTPColorLibraryForm->Parent = MainForm; DTPColorLibraryForm->Visible = CheckBoxLibrary->Checked; */ if (DTPColorLibraryForm == NULL) { DTPColorLibraryForm = NULL; DTPColorLibraryForm = new TDTPColorLibraryForm(MainForm); DTPColorLibraryForm->Parent = MainForm; } DTPColorLibraryForm->LibraryNameComboBxCloseUp(this); DTPColorLibraryForm->Visible = sbDisplayLibrary->Down; if (DTPColorLibraryForm->Visible) { DTPColorLibraryForm->BringToFront(); DTPColorLibraryForm->Show(); } } DestroyPantone(); ItemLibrary = 6; // PANTONECOLOR; BlockNumber = -1; PageControlLibrary->ActivePage = TabSheetLibrarySearch; PageControlLibrary->Enabled = true; rzedLocateSearch->Enabled = false; rzbitbtnLocateSearch->Enabled = false; rzedLocateFinder->Enabled = false; rzbitbtnLocateFinder->Enabled = false; rzedLocatePrint->Enabled = true; rzbitbtnLocatePrint->Enabled = true; CheckBoxSearch->Enabled = false; CheckBoxFinder->Enabled = false; rzedLibrarySearch->Enabled = true; rzedLibrarySearch->Text = ""; // rzedLibrarySearch->EditMask = ""; // UserColorLibFormÀ» ´ÝÁö ¾Ê´ÂÇÑ °è¼Ó »ç¿ë°¡´É - by monkman (2006.11.23) UserColorLibForm->Visible = false; ColorLibraryForm->Visible = false; // rzedLibrarySearch->SetFocus(); // TabSheetLibrarySearch->SetFocus(); // µÎ¹ø ¿¬¼Ó A/S »ç¿ëÇϸé Focus°¡ »ç¶óÁø´Ù À̸¦ ¹æÁö Çϱâ À§ÇØ by tmddn85 // if (MainImageForm) // added by maxleo21c (05.05.12) // MainImageForm->tempRadioButton->SetFocus(); // ´ÜÃàŰ Æ÷Ä¿½º ¸Ô°Ô Çϱâ À§Çؼ­ END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ColorGuideDownChange(bool down) { if (down) { SelectColorGuide(); } else { ChangeLibrary(rzcomboboxLibrary->ItemIndex); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbColorGuideClick(TObject *Sender) { TSpeedButton *bt = (TSpeedButton*)Sender; ColorGuideDownChange(bt->Down); /* if (bt->Down){ SelectColorGuide(); } else { ChangeLibrary(rzcomboboxLibrary->ItemIndex); } */ } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectCMY() { PanelCMY->Visible = true; PanelHLS->Visible = false; PanelRGB->Visible = false; menuitemCMY->Checked = true; menuitemHLS->Checked = false; menuitemRGB->Checked = false; rzmenubtCMYHLS->Caption = menuitemCMY->Caption; // rzpnlEditCmyHls->Top = 130; // rzpnlEditRgb->Top = 160; rzpnlEditCmyHls->Visible = true; rzpnlEditRgb->Visible = false; lbCHA->Caption = "C"; lbCHB->Caption = "M"; lbCHC->Caption = "Y"; Item = PAL_CMY; SetCMY(); Show(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectHLS() { PanelCMY->Visible = false; PanelHLS->Visible = true; PanelRGB->Visible = false; menuitemCMY->Checked = false; menuitemHLS->Checked = true; menuitemRGB->Checked = false; rzmenubtCMYHLS->Caption = menuitemHLS->Caption; // rzpnlEditCmyHls->Top = 130; // rzpnlEditRgb->Top = 160; rzpnlEditCmyHls->Visible = true; rzpnlEditRgb->Visible = false; lbCHA->Caption = "H"; lbCHB->Caption = "L"; lbCHC->Caption = "S"; Item = PAL_HLS; SetHLS(); Show(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SelectRGB() { PanelCMY->Visible = false; PanelHLS->Visible = false; PanelRGB->Visible = true; menuitemCMY->Checked = false; menuitemHLS->Checked = false; menuitemRGB->Checked = true; rzmenubtCMYHLS->Caption = menuitemRGB->Caption; // rzpnlEditCmyHls->Top = 160; // rzpnlEditRgb->Top = 130; rzpnlEditCmyHls->Visible = false; rzpnlEditRgb->Visible = true; lbCHA->Caption = "H"; lbCHB->Caption = "L"; lbCHC->Caption = "S"; Item = PAL_RGB; SetRGB(); Show(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::menuitemHLSClick(TObject *Sender) { SelectHLS(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::menuitemCMYClick(TObject *Sender) { SelectCMY(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::menuitemRGBClick(TObject *Sender) { SelectRGB(); } // --------------------------------------------------------------------------- String __fastcall TPaletteForm::SelectColorCode(int index) { // DIB256Palette->ChoiceIndex String str = "", temp = ""; TColorData *ColorMap = NULL; ColorMap = DIB256Palette->Palette->ColorData[index]; if ((ColorMap->Kind & 0x400F) >= 0x4000){ switch(ColorMap->Kind & 0x000F){ case 0: if (ColorMap->Page > 0) { temp = PrinterColor->PN2Code(ColorMap->Page, ColorMap->Number); str = Format("%s - %s:(%s)", OPENARRAY(TVarRec, (ColorMap->FileName, ColorMap->ColorName, temp.c_str()))); } else { str = Format("%s - %s ", OPENARRAY(TVarRec, (ColorMap->FileName, ColorMap->ColorName))); } break; case 1: /////////////////////////////////////////k3dogs temp = Pantone1000->PN2Code(ColorMap->Page, ColorMap->Number); str = Format("%s - %s:(%s)", OPENARRAY(TVarRec, (ColorMap->FileName, ColorMap->ColorName, temp.c_str()))); break; case 2: temp = PantoneTextile->PN2Code(ColorMap->Page, ColorMap->Number); str = Format("%s - %s:(%s)", OPENARRAY(TVarRec, (ColorMap->FileName, ColorMap->ColorName, temp.c_str()))); break; /////////////////////////////////////////k3dogs case 3: temp = StandardColor->PN2Code(ColorMap->Page, ColorMap->Number); str = Format("%s - %s:(%s)", OPENARRAY(TVarRec, (ColorMap->FileName, ColorMap->ColorName, temp.c_str()))); break; case 4: temp = TextileColor->PN2Code(ColorMap->Page, ColorMap->Number); str = Format("%s - %s:(%s)", OPENARRAY(TVarRec, (ColorMap->FileName, ColorMap->ColorName, temp.c_str()))); break; case 6: // 080321 Pantone color //temp = ColorMap->PantoneColor; temp = (char *)ColorMap->additionalColorData->GetData(TAG_PANTONE_COLOR); str = Format("%s - %s:(%s)", OPENARRAY(TVarRec, (ColorMap->FileName, ColorMap->ColorName, temp.c_str()))); break; } } else { switch(ColorMap->Kind & 0x0FFF) { case 0: if (ColorMap->Page > 0) str = PrinterColor->PN2Code(ColorMap->Page, ColorMap->Number); break; case 1: ////////////////////////////////k3dogs 20001211 str = Pantone1000->PN2Code(ColorMap->Page, ColorMap->Number); // Palette¿¡¼­ break; // Pantone Color Code¸¦ case 2: // ã±â À§ÇØ str = PantoneTextile->PN2Code(ColorMap->Page, ColorMap->Number); // break; case 3: str = StandardColor->PN2Code(ColorMap->Page, ColorMap->Number); break; case 4: str = TextileColor->PN2Code(ColorMap->Page, ColorMap->Number); break; case 5: str = PantoneTextile->PN2Code(ColorMap->Page, ColorMap->Number); // 20050518 by lhskys pantone Color break; case 6: str = (char *)ColorMap->additionalColorData->GetData(TAG_PANTONE_COLOR); //str = ColorMap->PantoneColor; // 080408 Pantone color break; } } return str; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbCMYHLSClick(TObject *Sender) { BEGIN_LOG(""); bool sw; if (Item == PAL_CMY || Item == PAL_HLS || Item == PAL_RGB) sw = false; else sw = true; ExitItem(); isChoice = isSave = false; // k3dogs if (sw) { isChoice = true; ClientHeight = CHeight + pnCMYHLS->Height; // PanelCMY->Height; pnCMYHLS->Left = 0; pnCMYHLS->Top = CHeight + 1; // pnCMYHLS->Enabled = true; pnCMYHLS->Visible = true; TIniFile *IniFile = NULL; IniFile = new TIniFile(AppDataItem + "\\Palette.ini"); if (IniFile) { Item = IniFile->ReadInteger("Palette", "ColorMode", PAL_CMY); delete IniFile; IniFile = NULL; } if (Item == PAL_HLS){ SelectHLS(); } else if (Item == PAL_RGB){ SelectRGB(); } else { SelectCMY(); } ShowColorCode(DIB256Palette->ChoiceIndex); } Show(); ViewCloseBtn(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbLibraryClick(TObject *Sender) { BEGIN_LOG(""); bool sw; if (Item == PAL_LIBRARY) sw = false; else sw = true; ExitItem(); if (sw) { // ShapeLibrary->Brush->Color = clRed; // ShapeLibrary->Pen->Color = clRed; ClientHeight = CHeight + PanelLibrary->Height; PanelLibrary->Left = 0; PanelLibrary->Top = CHeight + 1; PanelLibrary->Enabled = true; PanelLibrary->BringToFront(); PanelLibrary->Visible = true; PageControlLibrary->Enabled = true; // lhskys óÀ½ µé¾î°¥¶§ ColorGuide°¡ down µÇ¾î Àִ°ÍÀ» ¸ÂÃã... Item = PAL_LIBRARY; if (rzcomboboxLibrary->ItemIndex < 0) rzcomboboxLibrary->ItemIndex = 0; ChangeLibrary(rzcomboboxLibrary->ItemIndex); if ((ItemLibrary) && (ItemLibrary != 4)) { PageControlLibrary->ActivePage = TabSheetLibrarySearch; // rzedLibrarySearch->SetFocus(); } ComboBoxSize->ItemIndex = 0; if (sbDisplayLibrary->Down) { // 5: DTP Color, 6: PANTONE COLOR if (ItemLibrary == 5 || ItemLibrary == 6) { if (DTPColorLibraryForm) { DTPColorLibraryForm->Visible = true; DTPColorLibraryForm->BringToFront(); DTPColorLibraryForm->Show(); } } else if (ItemLibrary != 4) { ColorLibraryForm->Visible = true; UserColorLibForm->Visible = false; ColorLibraryForm->InitForm(MainImageForm->iMainImage->uBitmap); } else { ColorLibraryForm->Visible = false; UserColorLibForm->Visible = true; UserColorLibForm->Show(); } } } Show(); ViewCloseBtn(); END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbFileClick(TObject *Sender) { BEGIN_LOG(""); String dir = GetCurrentDir(); ExitItem(); TPFMForm *Form = new TPFMForm(this); Form->ShowModal(); delete Form; SetCurrentDir(dir); sbFile->Down = false; END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbChartClick(TObject *Sender) { BEGIN_LOG(""); bool sw; if (Item == PAL_CHART) sw = false; else sw = true; ExitItem(); if (sw) { // ShapeChart->Brush->Color = clRed; // ShapeChart->Pen->Color = clRed; Item = PAL_CHART; ColorChartForm->Visible = true; } END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbProtectClick(TObject *Sender) { BEGIN_LOG(""); bool sw; int i; #if defined(TEXSTYLIST) if (Item == PAL_PROTECT) sw = false; else sw = true; ExitItem(); MainMenuForm->ExitForm(1); // ¿©·¯»ö ¼±Åà ¹®Á¦ ¶§¹®¿¡ ¾î¿ ¼ö ¾øÀÌ.. by celberus if (sw) { // ShapeProtect->Brush->Color = clRed; // ShapeProtect->Pen->Color = clRed; ClientHeight = CHeight + PanelProtect->Height; PanelProtect->Left = 0; PanelProtect->Top = CHeight + 1; PanelProtect->BringToFront(); PanelProtect->Enabled = true; PanelProtect->Visible = true; rzbtProtect->SetFocus(); // lhskys ¿£ÅÍ·Î ½ÇÇàÇϱâ À§Çؼ­ focus¸¦ ÁØ´Ù Item = PAL_PROTECT; MainImageForm->bDrawPen = false; ColorSelectorProtect->SetPalette(MainImageForm->Palette); for (i = 1; i <= 251; i++) { if (MainImageForm->Palette->ColorData[i]->Protect == 1) { ColorSelectorProtect->AddColor(i); } } } Show(); ViewCloseBtn(); #endif END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbRearrangeClick(TObject *Sender) { if (MainImageForm && MainImageForm->iMainImage->uBitmap->BitsPerPixel == 8) { // shin 061205 int *Code = NULL, *CodeColor = NULL; if (MainImageForm->iMainImage->LayerMask) { Code = new int[256]; CodeColor = new int[256]; } else { Code = new int[256]; } ::RunRearrange(true, Code, CodeColor); // RunRearrange(false, Code, CodeColor); ::RepaintColor(); // shin 061017 // Message : »ç¿ëµÈ »ö¸¸ ÆÈ·¹Æ®¿¡ ³²°ÜµÎ½Ã°Ú½À´Ï±î? if (mrYes == MessageDlg(IDS_MSG_KEEPCOLOR, mtConfirmation, TMsgDlgButtons()<LeaveUseColorOnly(); RepaintImage(); } // if (Application->MessageBox(IDS_MSG_KEEPCOLOR.c_str(), L"Question", // MB_ICONQUESTION | MB_OKCANCEL) == IDOK) { // DIB256Palette->LeaveUseColorOnly(); // RepaintImage(); // } // if (FOnPaletteChange) FOnPaletteChange(Code, CodeColor); //shin 070221 if (Code) delete[]Code; if (CodeColor) delete[]CodeColor; } sbRearrange->Down = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::sbUndoClick(TObject *Sender) { BEGIN_LOG(""); 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) ShapeColor->Brush->Color = ShapeOriginColor->Brush->Color; // lhskys Ä®¶óȯ¿ø½Ã ¿øº»»ö°ú else if (PanelHLS->Visible) ShapeColor->Brush->Color = ShapeOriginColor->Brush->Color; // lhskys µ¿ÀÏÇÏ°Ô ÇØÁØ´Ù. delete cb->ColorMap; delete cb; if (ColorBackup->Count == 0) { sbUndo->Enabled = false; isSave = false; } // k3dogs RepaintImage(); DIB256Palette->Repaint(); } switch(Item) { case PAL_CMY: SetCMY(); break; case PAL_HLS: SetHLS(); break; case PAL_RGB: SetRGB(); break; } undosw = false; // undosw undosw Á¾·á END_LOG; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ChoiceColorChange(int Index) { if (sbCMYHLS->Down) { ShowColorCode(Index); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ShowColorCode(int index) { String colorname = SelectColorCode(index); if (colorname.IsEmpty()) lbColorName->Caption = ""; else lbColorName->Caption = colorname; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ViewCloseBtn(int kind) { Graphics::TBitmap *bitmap = new Graphics::TBitmap; imglistBtnUpDown->GetBitmap(kind, bitmap); SpeedButtonExit->Glyph->Assign(bitmap); delete bitmap; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzbtToLibraryClick(TObject *Sender) { RGBQUAD rgb; Show(); if (tocode) { SaveColorBackup(); tocode = false; } if (Item == PAL_CMY || Item == PAL_RGB) { rgb = SearchLibrary(Frgb); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); } else if (Item == PAL_HLS) { rgb = SearchLibrary(HLS2RGBQUAD((double)rzSpinEditA->Value, (double)rzSpinEditB->Value / 100, (double)rzSpinEditC->Value / 100)); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); HS = true; LS = true; } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzbtToPantoneClick(TObject *Sender) { RGBQUAD rgb; Show(); if (tocode) { SaveColorBackup(); tocode = false; } if (Item == PAL_CMY || Item == PAL_RGB) { rgb = SearchLibrary(Frgb, true); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); } else if (Item == PAL_HLS) { rgb = SearchLibrary(HLS2RGBQUAD((double)rzSpinEditA->Value, (double)rzSpinEditB->Value / 100, (double)rzSpinEditC->Value / 100), true); CursorColor->Brush->Color = RGB2TColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue); isSave = false; RepaintImage(); HS = true; LS = true; } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ShapeOriginColorMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (Button == mbLeft) { if (Item == PAL_CMY) { ChangeCMY(255 - FcmyC, 255 - FcmyM, 255 - FcmyY); } else if (Item == PAL_HLS) { ChangeHLS(Hue1, Lig1, Sat1); } else if (Item == PAL_RGB) { ChangeRGB(FrgbR, FrgbG, FrgbB); } } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeRedMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { IsGaugeDown = true; tocode = true; PGaugeRed->Progress = 255 * (PGaugeRed->Height - Y) / PGaugeRed->Height; ChangeRGB(PGaugeRed->Progress, Frgb.rgbGreen, Frgb.rgbBlue); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeRedMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (IsGaugeDown) { PGaugeRed->Progress = 255 * (PGaugeRed->Height - Y) / PGaugeRed->Height; ChangeRGB(PGaugeRed->Progress, Frgb.rgbGreen, Frgb.rgbBlue); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeRedMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (IsGaugeDown) { PGaugeRed->Progress = 255 * (PGaugeRed->Height - Y) / PGaugeRed->Height; ChangeRGB(PGaugeRed->Progress, Frgb.rgbGreen, Frgb.rgbBlue); } IsGaugeDown = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeGreenMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { IsGaugeDown = true; tocode = true; PGaugeGreen->Progress = 255 * (PGaugeGreen->Height - Y) / PGaugeGreen->Height; ChangeRGB(Frgb.rgbRed, PGaugeGreen->Progress, Frgb.rgbBlue); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeGreenMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (IsGaugeDown) { PGaugeGreen->Progress = 255 * (PGaugeGreen->Height - Y) / PGaugeGreen->Height; ChangeRGB(Frgb.rgbRed, PGaugeGreen->Progress, Frgb.rgbBlue); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeGreenMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (IsGaugeDown) { PGaugeGreen->Progress = 255 * (PGaugeGreen->Height - Y) / PGaugeGreen->Height; ChangeRGB(Frgb.rgbRed, PGaugeGreen->Progress, Frgb.rgbBlue); } IsGaugeDown = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeBlueMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { IsGaugeDown = true; tocode = true; PGaugeBlue->Progress = 255 * (PGaugeBlue->Height - Y) / PGaugeBlue->Height; ChangeRGB(Frgb.rgbRed, Frgb.rgbGreen, PGaugeBlue->Progress); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeBlueMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { if (IsGaugeDown) { PGaugeBlue->Progress = 255 * (PGaugeBlue->Height - Y) / PGaugeBlue->Height; ChangeRGB(Frgb.rgbRed, Frgb.rgbGreen, PGaugeBlue->Progress); } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::PGaugeBlueMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { if (IsGaugeDown) { PGaugeBlue->Progress = 255 * (PGaugeBlue->Height - Y) / PGaugeBlue->Height; ChangeRGB(Frgb.rgbRed, Frgb.rgbGreen, PGaugeBlue->Progress); } IsGaugeDown = false; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzSpinEditRedChange(TObject *Sender) { if (bColorCh == true) { if (Item == PAL_CMY) { tocode = true; ChangeCMY(rzSpinEditRed->Value, Frgb.rgbGreen, Frgb.rgbBlue); } else if (Item == PAL_HLS) { tocode = true; if (rzSpinEditRed->Value != Frgb.rgbRed) { double h = 0, l = 0, s = 0; Frgb.rgbRed = rzSpinEditRed->Value; RGB2HLS(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue, h, l, s); ChangeHLS(h, l * 100, s * 100); } } else if (Item == PAL_RGB) { tocode = true; ChangeRGB(rzSpinEditRed->Value, Frgb.rgbGreen, Frgb.rgbBlue); } } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzSpinEditGreenChange(TObject *Sender) { if (bColorCh == true) { if (Item == PAL_CMY) { tocode = true; ChangeCMY(Frgb.rgbRed, rzSpinEditGreen->Value, Frgb.rgbBlue); } else if (Item == PAL_HLS) { tocode = true; if (rzSpinEditGreen->Value != Frgb.rgbGreen) { double h = 0, l = 0, s = 0; Frgb.rgbGreen = rzSpinEditGreen->Value; RGB2HLS(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue, h, l, s); ChangeHLS(h, l * 100, s * 100); } } else if (Item == PAL_RGB) { tocode = true; ChangeRGB(Frgb.rgbRed, rzSpinEditGreen->Value, Frgb.rgbBlue); } } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzSpinEditBlueChange(TObject *Sender) { if (bColorCh == true) { if (Item == PAL_CMY) { tocode = true; ChangeCMY(Frgb.rgbRed, Frgb.rgbGreen, rzSpinEditBlue->Value); } else if (Item == PAL_HLS) { tocode = true; if (rzSpinEditBlue->Value != Frgb.rgbBlue) { double h = 0, l = 0, s = 0; Frgb.rgbBlue = rzSpinEditBlue->Value; RGB2HLS(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue, h, l, s); ChangeHLS(h, l * 100, s * 100); } } else if (Item == PAL_RGB) { tocode = true; ChangeRGB(Frgb.rgbRed, Frgb.rgbGreen, rzSpinEditBlue->Value); } } } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::rzSpinEditClick(TObject *Sender) { TRzSpinEdit* psEdit = (TRzSpinEdit*)Sender; psEdit->SelectAll(); psEdit->SetFocus(); } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ChangeCMY(int r, int g, int b) { bColorCh = false; bool isChanged = false; if (r != Frgb.rgbRed){ isChanged = true; Frgb.rgbRed = r; } if (rzSpinEditA->Value != 255 - r) rzSpinEditA->Value = 255 - r; if (rzSpinEditRed->Value != r) rzSpinEditRed->Value = r; if (PGaugeCyan->Progress != 255 - r) PGaugeCyan->Progress = 255 - r; if (g != Frgb.rgbGreen){ isChanged = true; Frgb.rgbGreen = g; } if (rzSpinEditB->Value != 255 - g) rzSpinEditB->Value = 255 - g; if (rzSpinEditGreen->Value != g) rzSpinEditGreen->Value = g; if (PGaugeMagenta->Progress != 255 - g) PGaugeMagenta->Progress = 255 - g; if (b != Frgb.rgbBlue){ isChanged = true; Frgb.rgbBlue = b; } if (rzSpinEditC->Value != 255 - b) rzSpinEditC->Value = 255 - b; if (rzSpinEditBlue->Value != b) rzSpinEditBlue->Value = b; if (PGaugeYellow->Progress != 255 - b) PGaugeYellow->Progress = 255 - b; if (isChoice && isSave == false && undosw == false) { SaveColorBackup(); isSave = true; } if (isChanged) 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; ShapeColor->Brush->Color = CursorColor->Brush->Color; Timer300->Enabled = false; RepaintImage(); if (PenManagerForm && PenManagerForm->Type == PT_AIR) { PenManagerForm->ShowColorBar(); } bColorCh = true; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ChangeHLS(int h, int l, int s)//, bool brgb) { bColorCh = false; bool isChanged = false; if (h != Hue){ Hue = h; isChanged = true; } if (rzSpinEditA->Value != h) rzSpinEditA->Value = h; if (PHLS->Hue != h) PHLS->Hue = h; if (l != Lig){ Lig = l; isChanged = true; } if (rzSpinEditB->Value != l) rzSpinEditB->Value = l; if (PHLS->Lig != l) PHLS->Lig = l; if (s != Sat){ Sat = s; isChanged = true; } if (rzSpinEditC->Value != s) rzSpinEditC->Value = s; if (PHLS->Sat != s) PHLS->Sat = s; // if (!brgb) { RGBQUAD c = HLS2RGBQUAD((double)Hue, (double)Lig / 100, (double)Sat / 100); Frgb.rgbRed = c.rgbRed; Frgb.rgbGreen = c.rgbGreen; Frgb.rgbBlue = c.rgbBlue; // } if (rzSpinEditRed->Value != Frgb.rgbRed) rzSpinEditRed->Value = Frgb.rgbRed; if (rzSpinEditGreen->Value != Frgb.rgbGreen) rzSpinEditGreen->Value = Frgb.rgbGreen; if (rzSpinEditBlue->Value != Frgb.rgbBlue) rzSpinEditBlue->Value = Frgb.rgbBlue; if (isChoice && isSave == false && undosw == false) { SaveColorBackup(); isSave = true; } if (isChanged) DIB256Palette->SetNormal(DIB256Palette->ChoiceIndex, Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); CursorColor->Brush->Color = RGB2TColor(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue); ShapeColor->Brush->Color = CursorColor->Brush->Color; FGColor->Brush->Color = CursorColor->Brush->Color; Timer300->Enabled = false; RepaintImage(); if (PenManagerForm && PenManagerForm->Type == PT_AIR) { PenManagerForm->ShowColorBar(); } bColorCh = true; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::ChangeRGB(int r, int g, int b) { bColorCh = false; bool isChanged = false; if (r != Frgb.rgbRed) { Frgb.rgbRed = r; isChanged = true; } if (rzSpinEditRed->Value != r) rzSpinEditRed->Value = r; if (PGaugeRed->Progress != r) PGaugeRed->Progress = r; if (g != Frgb.rgbGreen) { Frgb.rgbGreen = g; isChanged = true; } if (rzSpinEditGreen->Value != g) rzSpinEditGreen->Value = g; if (PGaugeGreen->Progress != g) PGaugeGreen->Progress = g; if (b != Frgb.rgbBlue) { Frgb.rgbBlue = b; isChanged = true; } if (rzSpinEditBlue->Value != b) rzSpinEditBlue->Value = b; if (PGaugeBlue->Progress != b) PGaugeBlue->Progress = b; double h = 0, l = 0, s = 0; RGB2HLS(Frgb.rgbRed, Frgb.rgbGreen, Frgb.rgbBlue, h, l, s); Hue = h; Lig = l * 100; Sat = s * 100; if (rzSpinEditA->Value != Hue) rzSpinEditA->Value = Hue; if (rzSpinEditB->Value != Lig) rzSpinEditB->Value = Lig; if (rzSpinEditC->Value != Sat) rzSpinEditC->Value = Sat; if (isChoice && isSave == false && undosw == false) { SaveColorBackup(); isSave = true; } if (isChanged) 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; ShapeColor->Brush->Color = CursorColor->Brush->Color; Timer300->Enabled = false; RepaintImage(); if (PenManagerForm && PenManagerForm->Type == PT_AIR) { PenManagerForm->ShowColorBar(); } bColorCh = true; } // --------------------------------------------------------------------------- void __fastcall TPaletteForm::SaveColorModeIniFile() { TIniFile *IniFile = NULL; IniFile = new TIniFile(AppDataItem + "\\Palette.ini"); if (IniFile) { IniFile->WriteInteger("Palette", "ColorMode", Item); delete IniFile; IniFile = NULL; } } // ---------------------------------------------------------------------------