//--------------------------------------------------------------------------- #include #include #pragma hdrstop #include "MainMenu.h" #include "Clear.h" #include "ColorChange_F.h" #include "Combo_F.h" #include "ComboForm.h" #include "Draw_F.h" #include "Fill_F.h" #include "Fullview.h" #include "Grouping_F.h" #include "Main.h" #include "MainImage.h" #include "MoveCopy_F.h" #include "PenManager.h" #include "ProtectCard.h" #include "Repeat_F.h" #include "Repro_F.h" #include "Scratch_F.h" #include "Stitch_F.h" #include "Style_F.h" #include "Text_F.h" #include "Undo_F.h" #include "Window.h" #include "Carpet_F.h" #include "jacquard.h" #include "Menu3D_F.h" #include "PatternRepeat.h" #include "Separate_F.h" #include "Smooth_F.h" #include "SpreadFill.h" #include "Stipple.h" #include "Stripe_F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" //--------------------------------------------------------------------------- #define IDS_FCAPTION StringTable[0] #define IDS_MOVECOPY StringTable[1] #define IDS_COLORCHANGE StringTable[2] #define IDS_CLEAR StringTable[3] #define IDS_GROUPING StringTable[4] #define IDS_REPROPORTION StringTable[5] #define IDS_FILL StringTable[6] #define IDS_SPREADFILL StringTable[7] #define IDS_STIPPLE StringTable[8] #define IDS_STYLE StringTable[9] #define IDS_PATTERNREPEAT StringTable[10] #define IDS_3DMAPPING StringTable[11] #define IDS_STRIPE StringTable[12] #define IDS_COLORSEPARATE StringTable[13] #define IDS_STITCH StringTable[14] #define IDS_TEXT StringTable[15] #define IDS_COLORCOMBO StringTable[16] #define IDS_SMOOTH StringTable[17] #define IDS_SCRATCH StringTable[18] #define IDS_JACQUARD StringTable[19] #define IDS_PRINTER StringTable[20] #define IDS_SCANNER StringTable[21] #define IDS_CARPET StringTable[22] //--------------------------------------------------------------------------- TMainMenuForm *MainMenuForm; //--------------------------------------------------------------------------- __fastcall TMainMenuForm::TMainMenuForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::FormClose(TObject *Sender, TCloseAction &Action) { ExitForm(1); Visible = false; if (FOnUpdateMenu) FOnUpdateMenu(Sender); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::FormCreate(TObject *Sender) { ClientWidth = 248; ClientHeight = sbExit->Top; PosY = Height; FWidth = ClientWidth; FHeight = ClientHeight; //================================================= StringTable.Create(DirectoryBin+"\\Carpet", Language, "MainMenu"); Caption = IDS_FCAPTION; sbWindow->Hint = IDS_COMMON_WINDOW; sbMoveCopy->Hint = IDS_MOVECOPY; sbColorChange->Hint = IDS_COLORCHANGE; sbClear->Hint = IDS_CLEAR; sbGrouping->Hint = IDS_GROUPING; sbRepeat->Hint = IDS_COMMON_REPEAT; sbDraw->Hint = IDS_COMMON_DRAW; sbRepro->Hint = IDS_REPROPORTION; sbFill->Hint = IDS_FILL; sbSpreadFill->Hint = IDS_SPREADFILL; sbStipple->Hint = IDS_STIPPLE; sbStyle->Hint = IDS_STYLE; sbPatternRepeat->Hint = IDS_PATTERNREPEAT; sb3D->Hint = IDS_3DMAPPING; sbStripe->Hint = IDS_STRIPE; sbSeparate->Hint = IDS_COLORSEPARATE; sbStitch->Hint = IDS_STITCH; sbText->Hint = IDS_TEXT; sbCombo->Hint = IDS_COLORCOMBO; sbSmooth->Hint = IDS_SMOOTH; sbScratch->Hint = IDS_SCRATCH; sbJacquard->Hint = IDS_JACQUARD; sbFile->Hint = IDS_COMMON_FILE; sbPrint->Hint = IDS_PRINTER; sbScan->Hint = IDS_SCANNER; sbUndo->Hint = IDS_COMMON_UNDO; sbCarpet->Hint = IDS_CARPET; Window1->Caption = IDS_COMMON_WINDOW; MoveCopy1->Caption = IDS_MOVECOPY; ColorChange1->Caption = IDS_COLORCHANGE; Clear1->Caption = IDS_CLEAR; Grouping1->Caption = IDS_GROUPING; repeat1->Caption = IDS_COMMON_REPEAT; Draw1->Caption = IDS_COMMON_DRAW; Reproportion1->Caption = IDS_REPROPORTION; Fill1->Caption = IDS_FILL; SpreadFill1->Caption = IDS_SPREADFILL; Stipple1->Caption = IDS_STIPPLE; Style1->Caption = IDS_STYLE; PatternRepeat1->Caption = IDS_PATTERNREPEAT; N3D1->Caption = IDS_3DMAPPING; Stripe1->Caption = IDS_STRIPE; ColorSeparate1->Caption = IDS_COLORSEPARATE; Stitch1->Caption = IDS_STITCH; Text1->Caption = IDS_TEXT; ColorCombo1->Caption = IDS_COLORCOMBO; Smooth1->Caption = IDS_SMOOTH; Scratch1->Caption = IDS_SCRATCH; Jacquard1->Caption = IDS_JACQUARD; // Shadow1->Caption = IDS_SHADOW; // After1->Caption = IDS_TREATMENT; File1->Caption = IDS_COMMON_FILE; Printing1->Caption = IDS_PRINTER; Scanning1->Caption = IDS_SCANNER; Undo1->Caption = IDS_COMMON_UNDO; //================================================= } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbWindowClick(TObject *Sender) { InitWindowForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbMoveCopyClick(TObject *Sender) { InitMoveCopyForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbColorChangeClick(TObject *Sender) { InitColorChangeForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbClearClick(TObject *Sender) { InitClearForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbGroupingClick(TObject *Sender) { InitGroupingForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbRepeatClick(TObject *Sender) { InitRepeatForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbDrawClick(TObject *Sender) { InitDrawForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbReproClick(TObject *Sender) { InitReproForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbFillClick(TObject *Sender) { InitFillForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbSpreadFillClick(TObject *Sender) { InitSpreadFillForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbStippleClick(TObject *Sender) { InitStippleForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbStyleClick(TObject *Sender) { InitStyleForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbPatternRepeatClick(TObject *Sender) { InitPatternRepeatForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbStripeClick(TObject *Sender) { InitStripeForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbSeparateClick(TObject *Sender) { InitSeparateForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbStitchClick(TObject *Sender) { InitStitchForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbTextClick(TObject *Sender) { InitTextForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbComboClick(TObject *Sender) { InitComboForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbSmoothClick(TObject *Sender) { InitSmoothForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbScratchClick(TObject *Sender) { InitScratchForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbJacquardClick(TObject *Sender) { InitJacquardForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbFileClick(TObject *Sender) { MainForm->FManagerItemClick(Sender); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbPrintClick(TObject *Sender) { MainForm->FPrintingItemClick(Sender); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbScanClick(TObject *Sender) { MainForm->FScanningItemClick(Sender); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbUndoClick(TObject *Sender) { InitUndoForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sb3DClick(TObject *Sender) { Init3DForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbCarpetClick(TObject *Sender) { InitCarpetForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::sbExitClick(TObject *Sender) { ExitForm(); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::PopupMenu1Popup(TObject *Sender) { TMenuItem *NewItem = NULL; GetCursorPos(&ptScreen); UpdatePopup(); if(MainImageForm->iMainImage->Bitmap->BitsPerPixel == 8) { if (Item == T_STYLE) { if (StyleForm->PopupInsert()) { NewItem = new TMenuItem(NULL); if (NewItem) { NewItem->Caption = "-"; PopupMenu1->Items->Insert(0, NewItem); } NewItem = new TMenuItem(NULL); if (NewItem) { NewItem->Caption = "StyleImage Delete"; NewItem->OnClick = StyleForm->PopupClick; PopupMenu1->Items->Insert(0, NewItem); } } } } else { if (MainImageForm->WorkArea->Mask){ NewItem = new TMenuItem(NULL); if (NewItem) { NewItem->Caption = "-"; PopupMenu1->Items->Insert(0, NewItem); } NewItem = new TMenuItem(NULL); if (NewItem) { NewItem->Caption = "Capture Overwrite"; NewItem->OnClick = MainForm->COverwriteItemClick; PopupMenu1->Items->Insert(0, NewItem); } } } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::UpdatePopup() { TMenuItem *NewItem = NULL; for (int i = 0; i < 2; i++) { NewItem = (TMenuItem *) PopupMenu1->Items->Items[0]; if (NewItem) { if (NewItem->Caption == "Capture Overwrite") { PopupMenu1->Items->Remove(NewItem); delete NewItem; } else if (NewItem->Caption == "StyleImage Delete") { PopupMenu1->Items->Remove(NewItem); delete NewItem; } else if (NewItem->Caption == "-") { PopupMenu1->Items->Remove(NewItem); delete NewItem; } } } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::ZoomClick(TObject *Sender) { if (Sender==Zoom1161) { MainImageForm->ZoomChange(1, 16, &ptScreen); } else if (Sender==Zoom181) { MainImageForm->ZoomChange(1, 8, &ptScreen); } else if (Sender==Zoom141) { MainImageForm->ZoomChange(1, 4, &ptScreen); } else if (Sender==Zoom121) { MainImageForm->ZoomChange(1, 2, &ptScreen); } else if (Sender==Zoom11) { MainImageForm->ZoomChange(1, 1, &ptScreen); } else if (Sender==Zoom21) { MainImageForm->ZoomChange(2, 1, &ptScreen); } else if (Sender==Zoom41) { MainImageForm->ZoomChange(4, 1, &ptScreen); } else if (Sender==Zoom81) { MainImageForm->ZoomChange(8, 1, &ptScreen); } else if (Sender==Zoom161) { MainImageForm->ZoomChange(16, 1, &ptScreen); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::ViewLight() { switch (Item) { case T_WIN: shWindow->Brush->Color = clRed; shWindow->Pen->Color = clRed; break; case T_MOVECOPY: shMoveCopy->Brush->Color = clRed; shMoveCopy->Pen->Color = clRed; break; case T_COLOR: shColorChange->Brush->Color = clRed; shColorChange->Pen->Color = clRed; break; case T_CLEAR: shClear->Brush->Color = clRed; shClear->Pen->Color = clRed; break; case T_GROUP: shGrouping->Brush->Color = clRed; shGrouping->Pen->Color = clRed; break; case T_REPEAT: shRepeat->Brush->Color = clRed; shRepeat->Pen->Color = clRed; break; case T_DRAW: shDraw->Brush->Color = clRed; shDraw->Pen->Color = clRed; break; case T_REPRO: shRepro->Brush->Color = clRed; shRepro->Pen->Color = clRed; break; case T_FILL: shFill->Brush->Color = clRed; shFill->Pen->Color = clRed; break; case T_SPREAD: shSpreadFill->Brush->Color = clRed; shSpreadFill->Pen->Color = clRed; break; case T_STIPPLE: shStipple->Brush->Color = clRed; shStipple->Pen->Color = clRed; break; case T_STYLE: shStyle->Brush->Color = clRed; shStyle->Pen->Color = clRed; break; case T_PATTERN: shPattern->Brush->Color = clRed; shPattern->Pen->Color = clRed; break; case T_STRIPE: shStripe->Brush->Color = clBlue; shStripe->Pen->Color = clBlue; break; case T_STITCH: shStitch->Brush->Color = clBlue; shStitch->Pen->Color = clBlue; break; case T_TEXT: shText->Brush->Color = clBlue; shText->Pen->Color = clBlue; break; case T_COMBO: shCombo->Brush->Color = clBlue; shCombo->Pen->Color = clBlue; break; case T_SMOOTH: shSmooth->Brush->Color = clBlue; shSmooth->Pen->Color = clBlue; break; case T_SEPARATE: shSeparate->Brush->Color = clBlue; shSeparate->Pen->Color = clBlue; break; case T_SCRATCH: shScratch->Brush->Color = clBlue; shScratch->Pen->Color = clBlue; break; case T_JAQ: shJacquard->Brush->Color = clBlue; shJacquard->Pen->Color = clBlue; break; case T_UNDO: shUndo->Brush->Color = clBlue; shUndo->Pen->Color = clBlue; break; case T_3D: sh3D->Brush->Color = clRed; sh3D->Pen->Color = clRed; break; case T_CARPET: shCarpet->Brush->Color = clRed; shCarpet->Pen->Color = clRed; break; } } //--------------------------------------------------------------------------- void TMainMenuForm::TPMExitFunction(TMessage &msg) { ExitForm(1); } //-------------------------------------------------------------------------- void __fastcall TMainMenuForm::UpdateItem() { if (MainImageForm==NULL) return; if (MainImageForm->iMainImage==NULL) return; if (MainImageForm->iMainImage->Bitmap->BitsPerPixel==8) { sbMoveCopy->Enabled = false; MoveCopy1->Enabled = false; sbColorChange->Enabled = true; ColorChange1->Enabled = true; sbGrouping->Enabled = true; Grouping1->Enabled = true; sbRepeat->Enabled = false; repeat1->Enabled = false; sbRepro->Enabled = false; Reproportion1->Enabled = false; sbFill->Enabled = true; Fill1->Enabled = true; sbSpreadFill->Enabled = true; SpreadFill1->Enabled = true; sbStipple->Enabled = true; Stipple1->Enabled = true; sbStyle->Enabled = true; Style1->Enabled = true; sbPatternRepeat->Enabled = false; PatternRepeat1->Enabled = false; sbStripe->Enabled = true; Stripe1->Enabled = true; sbCombo->Enabled = true; ColorCombo1->Enabled = true; sbSmooth->Enabled = true; Smooth1->Enabled = true; sbSeparate->Enabled = true; ColorSeparate1->Enabled = true; sbScratch->Enabled = true; Scratch1->Enabled = true; sbJacquard->Enabled = true; Jacquard1->Enabled = true; sb3D->Enabled = false; N3D1->Enabled = false; sbCarpet->Enabled = true; if (MainImageForm->WorkArea) { if (MainImageForm->WorkArea->Mask) { sbMoveCopy->Enabled = true; MoveCopy1->Enabled = true; sbRepeat->Enabled = true; repeat1->Enabled = true; sbRepro->Enabled = true; Reproportion1->Enabled = true; sbPatternRepeat->Enabled = true; PatternRepeat1->Enabled = true; } } sbScan->Enabled = MainForm->FScanningItem->Enabled; Scanning1->Enabled = MainForm->FScanningItem->Enabled; } else if (MainImageForm->iMainImage->Bitmap->BitsPerPixel==24) { sbMoveCopy->Enabled = false; MoveCopy1->Enabled = false; sbColorChange->Enabled = false; ColorChange1->Enabled = false; sbGrouping->Enabled = false; Grouping1->Enabled = false; sbRepeat->Enabled = false; repeat1->Enabled = false; sbRepro->Enabled = false; Reproportion1->Enabled = false; sbFill->Enabled = true; Fill1->Enabled = true; sbSpreadFill->Enabled = true; SpreadFill1->Enabled = true; sbStipple->Enabled = false; Stipple1->Enabled = false; sbStyle->Enabled = false; Style1->Enabled = false; sbPatternRepeat->Enabled = false; PatternRepeat1->Enabled = false; sbStripe->Enabled = true; Stripe1->Enabled = true; sbCombo->Enabled = false; ColorCombo1->Enabled = false; sbSmooth->Enabled = false; Smooth1->Enabled = false; sbSeparate->Enabled = false; ColorSeparate1->Enabled = false; sbScratch->Enabled = true; Scratch1->Enabled = true; sbJacquard->Enabled = false; Jacquard1->Enabled = false; sb3D->Enabled = true; N3D1->Enabled = false; sbCarpet->Enabled = false; sbScan->Enabled = MainForm->FScanningItem->Enabled; Scanning1->Enabled = MainForm->FScanningItem->Enabled; if (MainImageForm->WorkArea) { if (MainImageForm->WorkArea->Mask) { sbMoveCopy->Enabled = true; MoveCopy1->Enabled = true; sbRepeat->Enabled = true; repeat1->Enabled = true; sbRepro->Enabled = true; Reproportion1->Enabled = true; sbPatternRepeat->Enabled = true; PatternRepeat1->Enabled = true; sbColorChange->Enabled = true; ColorChange1->Enabled = true; } } } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitWindowForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_WIN) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_WIN; ViewLight(); WindowForm = new TWindowForm(this); WindowForm->Parent = this; WindowForm->BorderStyle = bsNone; WindowForm->Left = 0; WindowForm->Top = ClientHeight+20; WindowForm->Visible = true; WindowForm->InitForm(); } else sbWindow->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitMoveCopyForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_MOVECOPY) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_MOVECOPY; ViewLight(); MoveCopyForm = new TMoveCopyForm(this); MoveCopyForm->Parent = this; MoveCopyForm->BorderStyle = bsNone; MoveCopyForm->Left = 0; MoveCopyForm->Top = ClientHeight+20; MoveCopyForm->Visible = true; MoveCopyForm->InitForm(); } else sbMoveCopy->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitColorChangeForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_COLOR) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_COLOR; ViewLight(); ColorChangeForm = new TColorChangeForm(this); ColorChangeForm->Parent = this; ColorChangeForm->BorderStyle = bsNone; ColorChangeForm->Left = 0; ColorChangeForm->Top = ClientHeight+20; ColorChangeForm->Visible = true; ColorChangeForm->InitForm(); } else sbColorChange->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitClearForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_CLEAR) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_CLEAR; ViewLight(); ClearForm = new TClearForm(this); ClearForm->Parent = this; ClearForm->BorderStyle = bsNone; ClearForm->Left = 0; ClearForm->Top = ClientHeight+20; ClearForm->Visible = true; ClearForm->InitForm(); } else sbClear->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitGroupingForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_GROUP) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_GROUP; ViewLight(); GroupingForm = new TGroupingForm(this); GroupingForm->Parent = this; GroupingForm->BorderStyle = bsNone; GroupingForm->Left = 0; GroupingForm->Top = ClientHeight+20; GroupingForm->Visible = true; GroupingForm->InitForm(); } else sbGrouping->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitRepeatForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_REPEAT) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_REPEAT; ViewLight(); RepeatForm = new TRepeatForm(this); RepeatForm->Parent = this; RepeatForm->BorderStyle = bsNone; RepeatForm->Left = 0; RepeatForm->Top = ClientHeight+20; RepeatForm->Visible = true; RepeatForm->InitForm(); } else sbRepeat->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitDrawForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_DRAW) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_DRAW; ViewLight(); DrawForm = new TDrawForm(this); DrawForm->Parent = this; DrawForm->BorderStyle = bsNone; DrawForm->Left = 0; DrawForm->Top = ClientHeight+20; DrawForm->Visible = true; DrawForm->InitForm(); } else sbDraw->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitReproForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_REPRO) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_REPRO; ViewLight(); ReproForm = new TReproForm(this); ReproForm->Parent = this; ReproForm->BorderStyle = bsNone; ReproForm->Left = 0; ReproForm->Top = ClientHeight+20; ReproForm->Visible = true; ReproForm->InitForm(); } else sbRepro->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitFillForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_FILL) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_FILL; ViewLight(); FillForm = new TFillForm(this); FillForm->Parent = this; FillForm->BorderStyle = bsNone; FillForm->Left = 0; FillForm->Top = ClientHeight+20; FillForm->Visible = true; FillForm->InitForm(); } else sbFill->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitSpreadFillForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_SPREAD) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_SPREAD; ViewLight(); SpreadFillForm = new TSpreadFillForm(this); SpreadFillForm->Parent = this; SpreadFillForm->BorderStyle = bsNone; SpreadFillForm->Left = 0; SpreadFillForm->Top = ClientHeight+20; SpreadFillForm->Visible = true; SpreadFillForm->InitForm(); } else sbSpreadFill->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitStippleForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_STIPPLE) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_STIPPLE; ViewLight(); StippleForm = new TStippleForm(this); StippleForm->Parent = this; StippleForm->BorderStyle = bsNone; StippleForm->Left = 0; StippleForm->Top = ClientHeight+20; StippleForm->Visible = true; StippleForm->InitForm(); } else sbStipple->Down = false; } else { ExitForm(); } } //---------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitStyleForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_STYLE) sw = false; else sw = true; if (sw) { if (ExitForm()) { Item = T_STYLE; StyleForm = new TStyleForm(this); StyleForm->Parent = MainForm; StyleForm->InitForm(); } else sbStyle->Down = false; } else { ExitForm(); } } //---------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitPatternRepeatForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_PATTERN) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_PATTERN; ViewLight(); PatternRepeatForm = new TPatternRepeatForm(this); PatternRepeatForm->Parent = this; PatternRepeatForm->BorderStyle = bsNone; PatternRepeatForm->Left = 0; PatternRepeatForm->Top = ClientHeight+20; PatternRepeatForm->Visible = true; PatternRepeatForm->InitForm(); } else sbPatternRepeat->Down = false; } else { ExitForm(); } } //---------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitStripeForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_STRIPE) sw = false; else sw = true; if (sw) { if (ExitForm()) { Item = T_STRIPE; StripeForm = new TStripeForm(this); StripeForm->Parent = MainForm; StripeForm->InitForm(); } else sbStripe->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitSeparateForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_SEPARATE) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_SEPARATE; ViewLight(); SeparateForm = new TSeparateForm(this); SeparateForm->Parent = this; SeparateForm->BorderStyle = bsNone; SeparateForm->Left = 0; SeparateForm->Top = ClientHeight + 20; SeparateForm->Visible = true; SeparateForm->InitForm(); } else sbSeparate->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitStitchForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_STITCH) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_STITCH; ViewLight(); StitchForm = new TStitchForm(this); StitchForm->Parent = this; StitchForm->BorderStyle = bsNone; StitchForm->Left = 0; StitchForm->Top = ClientHeight+20; StitchForm->Visible = true; StitchForm->InitForm(); } else sbStitch->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitTextForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_TEXT) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible; Item = T_TEXT; ViewLight(); TextForm = new TTextForm(this); TextForm->Parent = this; TextForm->BorderStyle = bsNone; TextForm->Left = 0; TextForm->Top = ClientHeight+20; TextForm->Visible = true; TextForm->InitForm(); } else sbText->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitComboForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_COMBO) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_COMBO; ViewLight(); ComboMenu = new TComboMenu(this); ComboMenu->Parent = this; ComboMenu->BorderStyle = bsNone; ComboMenu->Left = 0; ComboMenu->Top = ClientHeight+20; ComboMenu->Visible = true; ComboMenu->InitForm(); } else sbCombo->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitSmoothForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_SMOOTH) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_SMOOTH; ViewLight(); SmoothForm = new TSmoothForm(this); SmoothForm->Parent = this; SmoothForm->BorderStyle = bsNone; SmoothForm->Left = 0; SmoothForm->Top = ClientHeight + 20; SmoothForm->Visible = true; SmoothForm->InitForm(); } else sbSmooth->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitScratchForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_SCRATCH) sw = false; else sw = true; if (sw) { if (ExitForm() && Item!=T_SCRATCH) { Visible = true; Item = T_SCRATCH; ViewLight(); ScratchForm = new TScratchForm(this); ScratchForm->Parent = this; ScratchForm->BorderStyle = bsNone; ScratchForm->Left = 0; ScratchForm->Top = ClientHeight + 20; ScratchForm->Visible = true; ScratchForm->InitForm(); } else sbScratch->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitJacquardForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_JAQ) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_JAQ; ViewLight(); JacquardForm = new TJacquardForm(this); JacquardForm->Parent = this; JacquardForm->BorderStyle = bsNone; JacquardForm->Left = 0; JacquardForm->Top = ClientHeight+20; JacquardForm->Visible = true; JacquardForm->InitForm(); } else sbJacquard->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitUndoForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_UNDO) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_UNDO; ViewLight(); UndoForm = new TUndoForm(this); UndoForm->Parent = this; UndoForm->BorderStyle = bsNone; UndoForm->Left = 0; UndoForm->Top = ClientHeight+20; UndoForm->Visible = true; UndoForm->InitForm(); } else sbUndo->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::Init3DForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Read(); #endif #endif if (Item==T_3D) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_3D; ViewLight(); Menu3DForm = new TMenu3DForm(this); Menu3DForm->Parent = this; Menu3DForm->BorderStyle = bsNone; Menu3DForm->Left = 0; Menu3DForm->Top = ClientHeight+20; Menu3DForm->Visible = true; Menu3DForm->InitForm(); PenManagerForm->InitType(PT_NORMAL); } else sb3D->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::InitCarpetForm() { bool sw; #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif if (Item==T_CARPET) sw = false; else sw = true; if (sw) { if (ExitForm()) { Visible = true; Item = T_CARPET; ViewLight(); CarpetForm = new TCarpetForm(this); CarpetForm->Parent = this; CarpetForm->BorderStyle = bsNone; CarpetForm->Left = 0; CarpetForm->Top = ClientHeight+20; CarpetForm->Visible = true; CarpetForm->InitForm(); } else sbUndo->Down = false; } else { ExitForm(); } } //--------------------------------------------------------------------------- TPException __fastcall TMainMenuForm::LoadFrom3DFile(HANDLE fh, TEXPIAFILEHEADER &tpfh, TTexpiaBitmap *pBitmap) { if (Item != T_3D) { sb3D->Down = true; Init3DForm(); } else { ClientHeight = FHeight; Menu3DForm->RemoveData(); MainImageForm->Data3D->Remove(); Menu3DForm->InitForm(); } return Menu3DForm->LoadFrom3DFile(fh, tpfh, pBitmap); } //--------------------------------------------------------------------------- TPException __fastcall TMainMenuForm::SaveTo3DFile(HANDLE fh, TEXPIAFILEHEADER &tpfh, TTexpiaBitmap *tag, TTexpiaBitmap *pBitmap) { return Menu3DForm->SaveTo3DFile(fh, tpfh, tag, pBitmap); } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::ExitForm(int i) { AnsiString msg, fn, ext; char *s; TGraphicFileFormat gff; int Btn; TMainImageForm *mif; bool success = true; if (Item!=T_NONE) { Show(); switch (Item) { case T_WIN: WindowForm->ExitForm(); delete WindowForm; WindowForm = NULL; sbWindow->Down = false; break; case T_MOVECOPY: MoveCopyForm->ExitForm(); delete MoveCopyForm; MoveCopyForm = NULL; sbMoveCopy->Down = false; break; case T_COLOR: ColorChangeForm->ExitForm(); delete ColorChangeForm; ColorChangeForm = NULL; sbColorChange->Down = false; break; case T_CLEAR: delete ClearForm; ClearForm = NULL; sbClear->Down = false; break; case T_GROUP: GroupingForm->ExitForm(); delete GroupingForm; GroupingForm = NULL; sbGrouping->Down = false; break; case T_REPEAT: RepeatForm->ExitForm(); delete RepeatForm; RepeatForm = NULL; sbRepeat->Down = false; break; case T_DRAW: DrawForm->ExitForm(); delete DrawForm; DrawForm = NULL; sbDraw->Down = false; break; case T_REPRO: ReproForm->ExitForm(); delete ReproForm; ReproForm = NULL; sbRepro->Down = false; break; case T_FILL: FillForm->ExitForm(); delete FillForm; FillForm = NULL; sbFill->Down = false; break; case T_STYLE: StyleForm->ExitForm(); delete StyleForm; StyleForm = NULL; sbStyle->Down = false; break; case T_STITCH: StitchForm->ExitForm(); delete StitchForm; StitchForm = NULL; sbStitch->Down = false; break; case T_TEXT: TextForm->ExitForm(); delete TextForm; TextForm = NULL; sbText->Down = false; break; case T_COMBO: ComboMenu->ExitForm(); delete ComboMenu; ComboMenu = NULL; sbCombo->Down = false; break; case T_SCRATCH: ScratchForm->ExitForm(); delete ScratchForm; ScratchForm = NULL; sbScratch->Down = false; break; case T_UNDO: delete UndoForm; UndoForm = NULL; sbUndo->Down = false; break; case T_STIPPLE: StippleForm->ExitForm(); delete StippleForm; StippleForm = NULL; sbStipple->Down = false; break; case T_SPREAD: SpreadFillForm->ExitForm(); delete SpreadFillForm; SpreadFillForm = NULL; sbSpreadFill->Down = false; break; case T_PATTERN: PatternRepeatForm->ExitForm(); delete PatternRepeatForm; PatternRepeatForm = NULL; sbPatternRepeat->Down = false; break; case T_STRIPE: StripeForm->ExitForm(); delete StripeForm; StripeForm = NULL; sbStripe->Down = false; break; case T_SEPARATE: SeparateForm->ExitForm(); delete SeparateForm; SeparateForm = NULL; sbSeparate->Down = false; break; case T_SMOOTH: delete SmoothForm; SmoothForm = NULL; sbSmooth->Down = false; break; case T_JAQ: JacquardForm->ExitForm(); delete JacquardForm; JacquardForm = NULL; sbJacquard->Down = false; break; case T_CARPET: CarpetForm->ExitForm(); delete CarpetForm; CarpetForm = NULL; sbCarpet->Down = false; break; case T_3D: Menu3DForm->ExitForm(MainImageForm); delete Menu3DForm; Menu3DForm = NULL; sb3D->Down = false; break; case T_MERGE: MainImageForm->ExitMerge(); break; } shWindow->Brush->Color = clBlack; shWindow->Pen->Color = clBlack; shMoveCopy->Brush->Color = clBlack; shMoveCopy->Pen->Color = clBlack; shColorChange->Brush->Color = clBlack; shColorChange->Pen->Color = clBlack; shClear->Brush->Color = clBlack; shClear->Pen->Color = clBlack; shGrouping->Brush->Color = clBlack; shGrouping->Pen->Color = clBlack; shRepeat->Brush->Color = clBlack; shRepeat->Pen->Color = clBlack; shDraw->Brush->Color = clBlack; shDraw->Pen->Color = clBlack; shRepro->Brush->Color = clBlack; shRepro->Pen->Color = clBlack; shFill->Brush->Color = clBlack; shFill->Pen->Color = clBlack; shSpreadFill->Brush->Color = clBlack; shSpreadFill->Pen->Color = clBlack; shStipple->Brush->Color = clBlack; shStipple->Pen->Color = clBlack; shStyle->Brush->Color = clBlack; shStyle->Pen->Color = clBlack; shPattern->Brush->Color = clBlack; shPattern->Pen->Color = clBlack; shStripe->Brush->Color = clBlack; shStripe->Pen->Color = clBlack; shStitch->Brush->Color = clBlack; shStitch->Pen->Color = clBlack; shText->Brush->Color = clBlack; shText->Pen->Color = clBlack; shCombo->Brush->Color = clBlack; shCombo->Pen->Color = clBlack; shSmooth->Brush->Color = clBlack; shSmooth->Pen->Color = clBlack; shSeparate->Brush->Color = clBlack; shSeparate->Pen->Color = clBlack; shScratch->Brush->Color = clBlack; shScratch->Pen->Color = clBlack; shJacquard->Brush->Color = clBlack; shJacquard->Pen->Color = clBlack; shUndo->Brush->Color = clBlack; shUndo->Pen->Color = clBlack; sh3D->Brush->Color = clBlack; sh3D->Pen->Color = clBlack; shCarpet->Brush->Color = clBlack; shCarpet->Pen->Color = clBlack; ClientWidth = FWidth; ClientHeight = FHeight; Item = T_NONE; MainImageForm->PenChange(); } if (MainImageForm) { FullViewForm->InitForm(MainImageForm->iMainImage); } UpdateItem(); return success; } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::iMainImageMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { TRect r; int ZoomIn, ZoomOut; int PenSize; TMainImageForm *mif = (TMainImageForm *)Sender; if (Button==mbMiddle || (Shift.Contains(ssShift) && Button==mbLeft)) { COLORREF color = mif->iMainImage->Bitmap->GetPixelColor(X, Y); if (mif->iMainImage->Bitmap->BitsPerPixel == 8) { switch (Item) { case T_COLOR: break; default: if (color<252) PaletteForm->DIB256Palette->ChoiceIndex = color; break; } } else { PaletteForm->DIB256Palette->SetNormal(PaletteForm->DIB256Palette->ChoiceIndex, GetRValue(color), GetGValue(color), GetBValue(color)); PaletteForm->DIB256Palette->Repaint(); } } ZoomIn = mif->iMainImage->ZoomIn; ZoomOut = mif->iMainImage->ZoomOut; PenSize = PenManagerForm->Pen->Thick; switch (Item) { case T_NONE: return true; case T_WIN: if (Button == mbLeft || Button == mbMiddle) { WindowForm->iMainImageMouseDown(Button, Shift, X, Y); } UpdateItem(); break; case T_MOVECOPY: if (Button == mbLeft) { MoveCopyForm->MoveCopyMouseDown(X, Y); } break; case T_COLOR: ColorChangeForm->ColorChangeMouseDown(Button, Shift, X, Y); if (ColorChangeForm->IsPen()) { mif->UndoSave(UK_PATTERN, Rect(0, 0, mif->iMainImage->Bitmap->Width, mif->iMainImage->Bitmap->Height)); Lsx = X; Lsy = Y; Lex = Lsx; Ley = Lsy; mif->line_pen(Lsx, Lsy, Lex, Ley, PaletteForm->DIB256Palette->ChoiceIndex); mif->BtnClick = true; } break; case T_GROUP: GroupingForm->iMainImageMouseDown(Button, Shift, X, Y); break; case T_REPEAT: if (Button == mbLeft) { RepeatForm->RepeatMouseDown(X, Y); mif->iMainImage->Cursor = crPen; } break; case T_DRAW: if (Button == mbLeft) DrawForm->DrawMouseDown(Button, Shift, X, Y); break; case T_STITCH: StitchForm->StitchMouseDown(Button, Shift, X, Y); break; case T_REPRO: if (Button == mbLeft) { ReproForm->ReproMouseDown(X, Y); } break; case T_FILL: FillForm->FillMouseDown(Button, Shift, X, Y); break; case T_TEXT: TextForm->iMainImageMouseDown(Button, Shift, X, Y); break; case T_UNDO: if (UndoForm->UndoPen->Checked) { mif->BtnClick = true; Lsx = X; Lsy = Y; Lex = Lsx; Ley = Lsy; mif->line_pen(Lsx, Lsy, Lex, Ley, PaletteForm->DIB256Palette->ChoiceIndex); } break; case T_STYLE: StyleForm->iMainImageMouseDown(Button, X, Y); break; case T_STIPPLE: StippleForm->iMainImageMouseDown(mif->iMainImage, Button, Shift, X, Y); break; case T_SPREAD: SpreadFillForm->iMainImageMouseDown(mif->iMainImage, Button, Shift, X, Y); break; case T_SEPARATE: SeparateForm->iMainImageMouseDown(mif->iMainImage, Button, Shift, X, Y); break; case T_SMOOTH: if (Button==mbLeft) { SmoothForm->SmoothMouseDown(X, Y); } break; case T_JAQ: JacquardForm->iMainImageMouseDown(mif->iMainImage, Button, Shift, X, Y); break; case T_PATTERN: if (Button==mbLeft) { if (PatternRepeatForm->Item != T_IMGSPRAY) { if (PatternRepeatForm->Item == T_REGULAR) { if (PatternRepeatForm->SetStartPoint(X, Y)) { return false; } } if (mif->bDrawPen) { if (FullViewForm->iMainImageMouseDown(mif->iMainImage, X, Y)) { r.Left = mif->iMainImage->PositionX-PenSize; if (r.Left<0) r.Left = 0; r.Top = mif->iMainImage->PositionY-PenSize; if (r.Top<0) r.Top = 0; r.Right = r.Left+mif->iMainImage->Width*ZoomOut/ZoomIn+PenSize; if (r.Right>mif->iMainImage->Bitmap->Width) r.Right = mif->iMainImage->Bitmap->Width; r.Bottom = r.Top+mif->iMainImage->Height*ZoomOut/ZoomIn+PenSize; if (r.Bottom>mif->iMainImage->Bitmap->Height) r.Bottom = mif->iMainImage->Bitmap->Height; PenManagerForm->SpecialMouseDown(Button, Shift, X, Y); mif->BtnClick = true; } } } else { PatternRepeatForm->ImageSprayMouseDown(X, Y); mif->BtnClick = true; } } break; case T_3D: if (PenManagerForm->sbMask->Down) return true; else Menu3DForm->iMainImageMouseDown(Button, Shift, X, Y); break; case T_CARPET: CarpetForm->iMainImageMouseDown(Button, Shift, X, Y); break; } return false; } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::iMainImageMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { TMainImageForm *mif = (TMainImageForm *)Sender; switch (Item) { case T_NONE: return true; case T_WIN: mif->iMainImage->Cursor = crCross; WindowForm->iMainImageMouseMove(Shift, X, Y); break; case T_MOVECOPY: mif->iMainImage->Cursor = crHandPoint; MoveCopyForm->MoveCopyMouseMove(X, Y); break; case T_COLOR: ColorChangeForm->ColorChangeMouseMove(Shift, X, Y); if (ColorChangeForm->IsPen()) { mif->iMainImage->Cursor = crPen; if (mif->BtnClick) { Lex = X; Ley = Y; mif->line_pen(Lsx, Lsy, Lex, Ley, PaletteForm->DIB256Palette->ChoiceIndex); Lsx = Lex; Lsy = Ley; } } else { mif->iMainImage->Cursor = crCross; } break; case T_CLEAR: mif->iMainImage->Cursor = crCross; break; case T_GROUP: mif->iMainImage->Cursor = crCross; GroupingForm->iMainImageMouseMove(Shift, X, Y); break; case T_TEXT: mif->iMainImage->Cursor = crCross; TextForm->iMainImageMouseMove(Shift, X, Y); break; case T_REPEAT: mif->iMainImage->Cursor = crHandPoint; RepeatForm->RepeatMouseMove(X, Y); break; case T_DRAW: DrawForm->DrawMouseMove(Shift, X, Y); break; case T_STITCH: mif->iMainImage->Cursor = crHandPoint; StitchForm->StitchMouseMove(X, Y); break; case T_REPRO: mif->iMainImage->Cursor = crHandPoint; ReproForm->ReproMouseMove(X, Y); break; case T_FILL: mif->iMainImage->Cursor = crHandPoint; FillForm->FillMouseMove(X, Y); break; case T_UNDO: if (UndoForm->UndoPen->Checked) { if (mif->BtnClick) { Lex = X; Ley = Y; mif->line_pen(Lsx, Lsy, Lex, Ley, PaletteForm->DIB256Palette->ChoiceIndex); Lsx = Lex; Lsy = Ley; } mif->iMainImage->Cursor = crPen; } else { mif->iMainImage->Cursor = crCross; } break; case T_MERGE: mif->iMainImage->Cursor = crHandPoint; mif->iSelectImageSize(); mif->IsMerge(mif->iSelectImagePosition(Point(X-mif->Center.x, Y-mif->Center.y))); break; case T_STYLE: mif->iMainImage->Cursor = crHandPoint; StyleForm->iMainImageMouseMove(Point(X-mif->Center.x, Y-mif->Center.y)); break; case T_STIPPLE: mif->iMainImage->Cursor = crCross; StippleForm->iMainImageMouseMove(mif->iMainImage, Shift, X, Y); break; case T_SPREAD: mif->iMainImage->Cursor = crCross; SpreadFillForm->iMainImageMouseMove(mif->iMainImage, Shift, X, Y); break; case T_STRIPE: mif->iMainImage->Cursor = crCross; StripeForm->iMainImageMouseMove(mif->iMainImage, X, Y); break; case T_SEPARATE: SeparateForm->iMainImageMouseMove(mif->iMainImage, Shift, X, Y); break; case T_SMOOTH: mif->iMainImage->Cursor = crCross; break; case T_JAQ: mif->iMainImage->Cursor = crCross; JacquardForm->iMainImageMouseMove(mif->iMainImage, X, Y); break; case T_PATTERN: if (PatternRepeatForm->Item != T_IMGSPRAY) { if (mif->bDrawPen) { if (FullViewForm->iMainImageMouseMove(mif->iMainImage, X, Y)) { if (PenManagerForm->acolor == 1) { PenManagerForm->SpecialMouseMove(Shift, X, Y); mif->iMainImage->Cursor = crCross; } else { if (mif->BtnClick) PenManagerForm->SpecialMouseMove(Shift, X, Y); if (PatternRepeatForm->sbSelectPos->Down) mif->iMainImage->Cursor = crCross; else mif->iMainImage->Cursor = crPen; } } else mif->iMainImage->Cursor = crCross; } } else PatternRepeatForm->ImageSprayMouseMove(X, Y, mif->BtnClick); break; case T_3D: if (PenManagerForm->sbMask->Down) return true; else { mif->iMainImage->Cursor = crCross; Menu3DForm->iMainImageMouseMove(Shift, X, Y); } break; case T_CARPET: mif->iMainImage->Cursor = crCross; break; } return false; } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::iMainImageMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { TMainImageForm *mif = (TMainImageForm *)Sender; switch (Item) { case T_NONE: return true; case T_WIN: WindowForm->iMainImageMouseUp(Shift, X, Y); break; case T_DRAW: if (Button == mbLeft) { DrawForm->DrawMouseUp(X, Y); } break; case T_COLOR: if (ColorChangeForm->IsPen()) mif->BtnClick = false; break; case T_UNDO: if (UndoForm->UndoPen->Checked) mif->BtnClick = false; break; case T_PATTERN: PenManagerForm->SpecialMouseUp(Button, Shift, X, Y); PatternRepeatForm->ImageSprayMouseUp(X, Y); mif->BtnClick = false; break; case T_3D: if (PenManagerForm->sbMask->Down) return true; break; } return false; } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::iMainImageMouseLeave() { if (Item == T_PATTERN) PatternRepeatForm->ImageSprayMouseLeave(); } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::iMainImagePaint(TObject *Sender) { switch (Item) { case T_NONE: return true; case T_WIN: WindowForm->iMainImagePaint(); break; case T_COLOR: ColorChangeForm->ColorChangePaint(); break; case T_GROUP: GroupingForm->iMainImagePaint(); break; case T_FILL: FillForm->FillPaint(); break; case T_TEXT: TextForm->iMainImagePaint(); break; case T_3D: Menu3DForm->iMainImagePaint(); break; case T_STIPPLE: StippleForm->iMainImagePaint(); break; case T_SPREAD: SpreadFillForm->iMainImagePaint(); break; case T_SEPARATE: SeparateForm->iMainImagePaint(); break; } return false; } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::iSelectImageMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { TCursor cursor; TMainImageForm *mif = (TMainImageForm *)Sender; switch (Item) { // case T_NONE: return true; case T_MERGE: cursor = Screen->Cursor; Screen->Cursor = crHourGlass; if (MainImageForm->WorkArea) MainImageForm->WorkArea->PushUndo(); mif->IsMerge(mif->iSelectImagePosition(mif->iSelectImageConvert(X, Y))); if (mif->OpenItem(mif->iSelectImage)) { PaletteForm->DIB256Palette->ChoiceIndex = 2; ExitForm(1); } else { ExitForm(1); Undo->Read(); } ::RepaintColor(); Screen->Cursor = cursor; break; case T_STYLE: StyleForm->iSelectImageMouseDown(X, Y); break; case T_MOVECOPY: if (Button == mbLeft) { MoveCopyForm->MoveCopyImageMouseDown(X, Y); if (MoveCopyForm->MCState == TMC_COPY) return false; } break; case T_REPEAT: if (Button == mbLeft) { RepeatForm->RepeatMouseDown(X, Y); } break; case T_REPRO: if (Button == mbLeft) { ReproForm->ReproImageMouseDown(X, Y); } break; case T_FILL: FillForm->FillImageMouseDown(Button, Shift, X, Y); break; case T_STRIPE: StripeForm->iSelectImageMouseDown(mif->iSelectImage, X, Y); break; case T_JAQ: JacquardForm->iSelectImageMouseDown(mif->iSelectImage, X, Y); break; } return true; } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::iSelectImageMouseMove(TObject *Sender, TShiftState Shift, int X, int Y) { TMainImageForm *mif = (TMainImageForm *)Sender; switch (Item) { case T_NONE: return true; case T_MERGE: mif->iSelectImage->Cursor = crHandPoint; mif->IsMerge(mif->iSelectImagePosition(mif->iSelectImageConvert(X, Y))); break; case T_STYLE: mif->iSelectImage->Cursor = crHandPoint; StyleForm->iSelectImageMouseMove(X, Y); break; case T_MOVECOPY: mif->iSelectImage->Cursor = crHandPoint; MoveCopyForm->MoveCopyImageMouseMove(X, Y); break; case T_REPEAT: X = mif->iMainImage->CanvasToBitmapX(mif->iSelectImage->Left+X); Y = mif->iMainImage->CanvasToBitmapY(mif->iSelectImage->Top+Y); mif->iSelectImage->Cursor = crHandPoint; RepeatForm->RepeatMouseMove(X, Y); break; case T_REPRO: X = mif->iMainImage->CanvasToBitmapX(mif->iSelectImage->Left+X); Y = mif->iMainImage->CanvasToBitmapY(mif->iSelectImage->Top+Y); mif->iSelectImage->Cursor = crHandPoint; ReproForm->ReproImageMouseMove(X, Y); break; case T_FILL: mif->iSelectImage->Cursor = crCross; FillForm->FillImageMouseMove(X, Y); break; case T_STRIPE: StripeForm->iSelectImageMouseMove(mif->iSelectImage, X, Y); break; case T_JAQ: JacquardForm->iSelectImageMouseMove(mif->iSelectImage, X, Y); break; } return false; } //--------------------------------------------------------------------------- bool __fastcall TMainMenuForm::iMainImageChange(TObject *Sender) { TMainImageForm *mif = (TMainImageForm *)Sender; switch (Item) { case T_NONE: return true; case T_WIN: WindowForm->iMainImageChange(); break; case T_MOVECOPY: MoveCopyForm->iMainImageChange(); break; case T_FILL: FillForm->iMainImageChange(); break; case T_REPEAT: RepeatForm->iMainImageChange(); break; case T_REPRO: ReproForm->iMainImageChange(); break; case T_DRAW: DrawForm->iMainImageChange(); break; case T_STITCH: StitchForm->iMainImageChange(); break; case T_3D: Menu3DForm->iMainImageChange(); break; case T_STRIPE: case T_MERGE: mif->iSelectImage->Width = 0; mif->iSelectImage->Height = 0; break; } return false; } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::iMainImageKeyDown(int Key) { MainImageForm->iMainImageKeyDown(Key); if (Item == T_DRAW) { DrawForm->iMainImageKeyDown(Key); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::iMainImageKeyUp(int Key) { if (Item == T_DRAW) { DrawForm->iMainImageKeyUp(Key); } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::SuperChange(TObject *Sender) { switch (Item) { case T_MOVECOPY: MoveCopyForm->SetMoveCopyImage(true); break; // case T_REPRO: ReproForm->SetReproImage(); break; case T_REPEAT: RepeatForm->SetRepeatImage(); break; } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::ChoiceColor(int Index) { switch (MainMenuForm->Item) { case T_NONE: PenManagerForm->SelectColor(Index); break; case T_COLOR: ColorChangeForm->FGChange(Index); break; case T_FILL: FillForm->SelectColor(Index); break; case T_DRAW: DrawForm->FGChange(Index); break; case T_COMBO: ComboMenu->FGChange(Index); break; case T_STIPPLE: StippleForm->FGChange(Index); break; case T_SEPARATE: SeparateForm->SepSelectorColor(Index); break; case T_SPREAD: SpreadFillForm->FGChange(Index); break; case T_JAQ: JacquardForm->FGChange(Index); break; case T_STRIPE: StripeForm->FGChange(Index); break; } PenManagerForm->PenShapeChange(Index); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::ColorChange(TObject *Sender) { if (MainMenuForm->Item==T_COMBO) if (ComboMenu->SubForm) ComboMenu->SubForm->ComboColorChange(this); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::CursorIndexChange(TObject *Sender) { if (MainMenuForm->Item==T_COLOR) ColorChangeForm->CCChange(PaletteForm->DIB256Palette->CursorIndex); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::UnitChange() { if (Item==T_STRIPE) StripeForm->ChangeUnit(MainImageForm->CurrentUnit); else if (Item == T_PATTERN) PatternRepeatForm->ChangeUnit(MainImageForm->CurrentUnit); else if (Item == T_REPRO) ReproForm->ChangeUnit(MainImageForm->CurrentUnit); } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::Timer200ms() { switch (MainMenuForm->Item) { case T_TEXT: TextForm->DrawCursor(); break; } } //--------------------------------------------------------------------------- void __fastcall TMainMenuForm::Show_FabricSize() { // v7.1À» ÄÄÆÄÀÏÇϱâ À§ÇØ Àá½Ã ¸·¾Æ³ð. if (Menu3DForm) { // to fit size and point by kjs if (Menu3DForm->sbMFabric->Down) Menu3DForm->Show_FabricSize(); } } //---------------------------------------------------------------------------