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