//--------------------------------------------------------------------- #include #include #include #pragma hdrstop #include "Main.h" #include "About.h" #include "CaptureEdit.h" #include "ColorChart.h" #include "ColorLibrary_f.h" #include "Define.h" #include "EnlargeCanvas.h" #include "Environment.h" #include "FileManager_F.h" #include "FullView.h" #include "History.h" #include "MainImage.h" #include "MainMenu.h" #include "NewCanvas.h" #include "Palette.h" #include "PenManager.h" #include "ProtectCard.h" #include "ResizeCanvas.h" #include "StatusProgress.h" #include "W:\TpwTest\CommonTextile\TPrint_F.h" // #include "TPrint_F.h" by jeegeo #include "Undo.h" #include "Grid_F.h" #ifndef ACADEMY #include "CaptureEdit.h" #include "UserColor_F.h" #include "Layer_F.h" #include "TexWork_F.h" #endif //--------------------------------------------------------------------- #pragma package(smart_init) #pragma link "ltimg_bc.lib" #pragma link "lttwn_bc.lib" #pragma resource "*.dfm" #pragma resource "Cursor.res" //--------------------------------------------------------------------------- #define IDS_TDCSP StringTable[0] #define IDS_TDCSA StringTable[1] #define IDS_FILE StringTable[2] #define IDS_F256COLOR StringTable[3] #define IDS_FFULLCOLOR StringTable[4] #define IDS_FFILEMANAGER StringTable[5] #define IDS_FREOPEN StringTable[6] #define IDS_FCLOSE StringTable[7] #define IDS_FCLOSEALL StringTable[8] #define IDS_FRESIZECANVAS StringTable[9] #define IDS_FENLARGECANVAS StringTable[10] #define IDS_FSCANNING StringTable[11] #define IDS_FSCANNERSETUP StringTable[12] #define IDS_FSMALLFONT StringTable[13] #define IDS_FLARGEFONT StringTable[14] #define IDS_FEXIT StringTable[15] #define IDS_EDIT StringTable[16] #define IDS_ECUT StringTable[17] #define IDS_ECOPY StringTable[18] #define IDS_EPASTE StringTable[19] #define IDS_CAPTURE StringTable[20] #define IDS_COVERWRITE StringTable[21] #define IDS_CINSERT StringTable[22] #define IDS_CEDIT StringTable[23] #define IDS_CDELETEALL StringTable[24] #define IDS_IMAGE StringTable[25] #define IDS_IINTENSITYDETECT StringTable[26] #define IDS_ISOLARIZE StringTable[27] #define IDS_IEFFECT StringTable[28] #define IDS_IEPOSTERIZE StringTable[29] #define IDS_IEMOSAIC StringTable[30] #define IDS_IEAVERAGE StringTable[31] #define IDS_IEMEDIAN StringTable[32] #define IDS_IESHARPEN StringTable[33] #define IDS_IEADDNOISE StringTable[34] #define IDS_IEEMBOSS StringTable[35] #define IDS_IEUNDERLAY StringTable[36] #define IDS_IEEDGEENHANCE StringTable[37] #define IDS_IEOILIFY StringTable[38] #define IDS_ISPATIALFILTER StringTable[39] #define IDS_ISGRADIENT StringTable[40] #define IDS_ISLAPLACIAN StringTable[41] #define IDS_ISSOBEL StringTable[42] #define IDS_ISPREWITT StringTable[43] #define IDS_ISSHIFTANDDIFFERENCE StringTable[44] #define IDS_ISLINESEGMENT StringTable[45] #define IDS_VIEW StringTable[46] #define IDS_VSPECIALPEN StringTable[47] #define IDS_VFULLVIEW StringTable[48] #define IDS_VPALETTE StringTable[49] #define IDS_VMAINMENU StringTable[50] #define IDS_VSTATUSBAR StringTable[51] #define IDS_WINDOW StringTable[52] #define IDS_WCASCADE StringTable[53] #define IDS_WTILE StringTable[54] #define IDS_WARRANGEICONS StringTable[55] #define IDS_WMINIMIZEALL StringTable[56] #define IDS_HELP StringTable[57] #define IDS_HABOUT StringTable[58] #define IDS_VLAYER StringTable[59] //--------------------------------------------------------------------------- TMainForm *MainForm; //--------------------------------------------------------------------------- // TMainForm //--------------------------------------------------------------------- __fastcall TMainForm::TMainForm(TComponent *Owner) : TForm(Owner) { bFirst = 0; if(GetSystemMetrics(SM_CXSCREEN)>=1280&&GetSystemMetrics(SM_CYSCREEN)>=1024){ HorzScrollBar->Tracking=false; HorzScrollBar->Visible=false; VertScrollBar->Tracking=false; VertScrollBar->Visible=false; } else { HorzScrollBar->Tracking=true; HorzScrollBar->Visible=true; VertScrollBar->Tracking=true; VertScrollBar->Visible=true; } } //--------------------------------------------------------------------- void __fastcall TMainForm::FormActivate(TObject *Sender) { TMainImageForm *Child = NULL; TPCanvasInfor p; TPException ec = EC_NONE; AnsiString FileName, DirName, FileExt; if (bFirst==1) { //======================================== if (ParamStr(1) != "") { DirName = ExtractFileDir(ParamStr(1)); FileName = ExtractFileName(ParamStr(1)); FileExt = ExtractFileExt(ParamStr(1)); if (FileExt.LowerCase() == ".tex") { OpenFile(DirName, DirName + "\\" + FileName, gffTEX, 8); #ifndef ACADEMY #ifndef N_3D } else if (FileExt.LowerCase() == ".t3d") { OpenFile(DirName, FileName, gffT3D, 24); #endif } else if (FileExt.LowerCase() == ".tfc") { OpenFile(DirName, DirName + "\\" + FileName, gffTFC, 24); #endif } } else { if ((Child = new TMainImageForm(Application))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } p.Orientation = coPortrait; p.DotsPerInch = 160; p.SetSize(cstA4); if ((ec = Child->InitForm(p, 8))!=EC_NONE) goto fail; } //======================================== bFirst = 2; ToolsRearrange(); } return; fail: if (Child) delete Child; EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormCreate(TObject *Sender) { int Items; TIniFile *IniFile; TPException ec = EC_NONE; Application->OnActivate = ApplicationActivate; Application->OnHint = ShowHint; Screen->OnActiveFormChange = UpdateMenuItems; Screen->Cursors[crPen] = LoadCursor(HInstance, "TEXPIAPEN"); LoadFromMainRegIniFile(); MessageStringTable.Create(DirectoryBin, Language, "Message"); if ((ProtectCard = new TProtectCard)==NULL) { ec = EC_INTERFACE_NONE; goto fail; } //ifdef lock_crypkey ---> protectcard is not needed...... #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC #ifdef ACADEMY if (!ProtectCard->Init()) { ec = EC_INTERFACE_NONE; goto fail; } #else Items = ProtectCard->Init(RegFilename); if (Items==0 || (Items&PCN_TEXTILE_3D)!=PCN_TEXTILE_3D) { ec = EC_INTERFACE_NONE; goto fail; } #endif if (!ProtectCard->CheckPassword()) { ec = EC_INTERFACE_NONE; goto fail; } #else Items = ProtectCard->Init(Password); #ifdef ACADEMY if (((Items>>14)&3)<3 || Items<1 || (Items&PCN_TEXTILE_3D)!=PCN_TEXTILE_3D) { ec = EC_INTERFACE_NONE; goto fail; } #else /* if ((((Items>>14)&3)==3) || Items<1 || (Items&PCN_TEXTILE_3D)!=PCN_TEXTILE_3D) { ec = EC_INTERFACE_NONE; goto fail; */ //========================================== by hjs TEXTILE check if ((((Items>>14)&3)==3) || Items<1 || (Items&PCN_TEXTILE)!=PCN_TEXTILE) { ec = EC_INTERFACE_NONE; goto fail; } #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC // if ((((Items>>14)&3)==3) || Items<1 || (Items&PCN_3D)!=PCN_3D) { // T3D_Item = false; // } else { // T3D_Item = true; // } T3D_Item = true; #endif #endif #ifdef LOCK_CRYPKEY T3D_Item = true; #endif #ifdef LOCK_IFC T3D_Item = true; #endif H_item = Items ; // 3D üũ¸¦ À§ÇØ ´Ù¸¥ °÷¿¡¼­ »ç¿ë µÊ //========================================== #endif #endif #endif // #ifndef LOCK_CRYPKEY CommonStringTable.Create(DirectoryBin, Language, "Common"); StringTable.Create(DirectoryItem, Language, "Main"); if ((SmallFont = new TFont)==NULL) { ec = EC_MEMORY_LACK; goto fail; } IniFile = new TIniFile(DirectoryItem + "\\Environment.ini"); if (IniFile) { LoadFont(IniFile, SmallFont, "Font"); bAutoSave = IniFile->ReadBool("AutoSave", "Check", false); if (bAutoSave) { AutosaveTimer->Interval = IniFile->ReadInteger("AutoSave", "Min", 5) * 60000; } delete IniFile; } else { SmallFont->Name = DefaultFontName; SmallFont->Size = 10; } if ((Tablet = new TTablet)==NULL) { ec = EC_MEMORY_LACK; goto fail; } Tablet->Init(Handle, RegFilename.c_str()); if ((PrinterColor = new TPrinterColor)==NULL) { ec = EC_MEMORY_LACK; goto fail; } #ifndef ACADEMY if ((StandardColor = new TStandardColor(DirectoryColor+"\\Standard.tpc"))==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((TextileColor = new TTextileColor(DirectoryColor+"\\Textile.tpc"))==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((Pantone1000 = new TPantone1000(DirectoryColor+"\\Thousand.ptc"))==NULL) { //k3dogs Palette¿¡¼­ ec = EC_MEMORY_LACK; goto fail; //Pantone Color Code¸¦ } //ã±â À§Çؼ­ if ((PantoneTextile = new TPantoneTextile(DirectoryColor+"\\Textile.ptc"))==NULL) { //20001211 ec = EC_MEMORY_LACK; goto fail; } #endif if ((MainMenuForm = new TMainMenuForm(this))==NULL) goto fail; MainMenuForm->Parent = this; MainMenuForm->Visible = true; MainMenuForm->OnUpdateMenu = UpdateMenuItems; if ((PenManagerForm = new TPenManagerForm(this))==NULL) goto fail; PenManagerForm->Parent = this; PenManagerForm->Visible = true; PenManagerForm->OnUpdateMenu = UpdateMenuItems; if ((FullViewForm = new TFullViewForm(this))==NULL) goto fail; FullViewForm->Parent = this; FullViewForm->Visible = true; FullViewForm->OnSuperChange = MainMenuForm->SuperChange; FullViewForm->OnUpdateMenu = UpdateMenuItems; if ((PaletteForm = new TPaletteForm(this))==NULL) goto fail; PaletteForm->Parent = this; PaletteForm->Visible = true; PaletteForm->OnChoiceColor = MainMenuForm->ChoiceColor; PaletteForm->OnColorChange = MainMenuForm->ColorChange; PaletteForm->OnCursorIndexChange = MainMenuForm->CursorIndexChange; PaletteForm->OnUpdateMenu = UpdateMenuItems; #ifndef ACADEMY if ((LayerForm = new TLayerForm(this))==NULL) goto fail; LayerForm->Parent = this; LayerForm->Visible = false; LayerForm->OnUpdateMenu = UpdateMenuItems; #endif ToolsRearrange(); if ((ColorChartForm = new TColorChartForm(this))==NULL) goto fail; ColorChartForm->Parent = this; if ((ColorLibraryForm = new TColorLibraryForm(this))==NULL) goto fail; ColorLibraryForm->Parent = this; ColorLibraryForm->OnColorChange = ::RepaintColor; #ifndef ACADEMY if ((UserColorLibForm = new TUserColorLibForm(this))==NULL) goto fail; UserColorLibForm->Parent = this; if ((CaptureData = new TList)==NULL) { ec = EC_MEMORY_LACK; goto fail; } #endif ClipboardFormat = RegisterClipboardFormat("Texpro"); if ((StatusProgress = new TStatusProgress(StatusBar, StatusBarHint))==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((FileHistory = new TFileHistory(DirectoryItem + "\\Main.ini", 8, FReopenItem, &OpenFile))==NULL) { ec = EC_MEMORY_LACK; goto fail; } if ((Undo = new TUndo)==NULL) { ec = EC_MEMORY_LACK; goto fail; } #ifdef ACADEMY Undo->Method = UM_SWAP; #else Undo->Method = UM_STACK; #endif bFirst = 1; CompressMethod = cmZLib; if (L_IsTwainAvailable(Application->Handle)) { FScanningItem->Enabled = true; FScannerSetupItem->Enabled = true; } else { FScanningItem->Enabled = false; FScannerSetupItem->Enabled = false; } srand(clock()); //======================================== SetSmallFont(StatusBar->Font); /* #ifdef ACADEMY Caption = IDS_TDCSA; #else Caption = IDS_TDCSP; #endif */ //=================================== source code befre lock_crypkey defined............. /* #ifdef JAPAN switch (Items >> 14) { case 1: Caption = "Yuka & Alpha - Design (Education)"; break; case 2: Caption = "Yuka & Alpha - Design (Demo)"; break; default: Caption = "Yuka & Alpha - Design (Professional)"; break; } #else #ifdef ACADEMY Caption = "Texpro Design CAD System - Textile (Academy)"; #else #ifdef LOCK_IFC Caption = "Texpro Design CAD System - Textile (Professional)"; #else switch (Items >> 14) { case 1: Caption = "Texpro Design CAD System - Textile (Education)"; break; case 2: Caption = "Texpro Design CAD System - Textile (Demo)"; break; default: Caption = "Texpro Design CAD System - Textile (Professional)"; break; } #endif #endif #endif */ #ifdef LOCK_CRYPKEY // japan, education, demo.... must be definde.... #ifdef JAPAN #ifdef EDUCATION Caption = "Yuka & Alpha - Design (Education)"; #endif #ifdef DEMO Caption = "Yuka & Alpha - Design (Demo)"; #endif #ifdef PROFESSIONAL Caption = "Yuka & Alpha - Design (Professional)"; #endif #else #ifdef ACADEMY Caption = "Texpro Design CAD System - Textile (Academy)"; #else #ifdef EDUCATION Caption = "Texpro Design CAD System - Textile (Education)"; #endif #ifdef DEMO Caption = "Texpro Design CAD System - Textile (Demo)"; #endif #ifdef PROFESSIONAL Caption = "Texpro Design CAD System - Textile (Professional)"; #endif #endif #endif #else // if lock_crypkey is not defined.... #ifdef JAPAN switch (Items >> 14) { case 1: Caption = "Yuka & Alpha - Design (Education)"; break; case 2: Caption = "Yuka & Alpha - Design (Demo)"; break; default: Caption = "Yuka & Alpha - Design (Professional)"; break; } #else #ifdef ACADEMY Caption = "Texpro Design CAD System - Textile (Academy)"; #else #ifdef LOCK_IFC Caption = "Texpro Design CAD System - Textile (Professional)"; #else switch (Items >> 14) { case 1: Caption = "Texpro Design CAD System - Textile (Education)"; break; case 2: Caption = "Texpro Design CAD System - Textile (Demo)"; break; default: Caption = "Texpro Design CAD System - Textile (Professional)"; break; } #endif #endif #endif #endif // end of define lock_crypkey.... //============================================================================== FileItem->Caption = IDS_FILE; FNewCanvas256Item->Caption = IDS_F256COLOR; FNewCanvasFullItem->Caption = IDS_FFULLCOLOR; FManagerItem->Caption = IDS_FFILEMANAGER; FReopenItem->Caption = IDS_FREOPEN; FCloseItem->Caption = IDS_FCLOSE; // FCloseAllItem->Caption = IDS_FCLOSEALL; FResizeCanvasItem->Caption = IDS_FRESIZECANVAS; FEnlargeCanvasItem->Caption = IDS_FENLARGECANVAS; FScannerSetupItem->Caption = IDS_FSCANNERSETUP; FScanningItem->Caption = IDS_FSCANNING; FPrinterSetupItem->Caption = IDS_COMMON_PRINTERSETUP; FPrintingItem->Caption = IDS_COMMON_PRINTING; FFontItem->Caption = IDS_COMMON_FONTSETUP; FEnvironmentItem->Caption = IDS_COMMON_ENVIRONMENTSETUP; // FExitItem->Caption = IDS_COMMON_EXIT; FExitItem->Caption = IDS_FEXIT; EditItem->Caption = IDS_EDIT; ECutItem->Caption = IDS_ECUT; ECopyItem->Caption = IDS_ECOPY; EPasteItem->Caption = IDS_EPASTE; CaptureItem->Caption = IDS_CAPTURE; COverwriteItem->Caption = IDS_COVERWRITE; CInsertItem->Caption = IDS_CINSERT; CDeleteAllItem->Caption = IDS_CDELETEALL; CEditItem->Caption = IDS_CEDIT; ImageItem->Caption = IDS_IMAGE; IIntensityDetectItem->Caption = IDS_IINTENSITYDETECT; ISolarizeItem->Caption = IDS_ISOLARIZE; ImageEffectsItem->Caption = IDS_IEFFECT; IEPosterizeItem->Caption = IDS_IEPOSTERIZE; IEMosaicItem->Caption = IDS_IEMOSAIC; IEAverageItem->Caption = IDS_IEAVERAGE; IEMedianItem->Caption = IDS_IEMEDIAN; IESharpenItem->Caption = IDS_IESHARPEN; IEAddNoiseItem->Caption = IDS_IEADDNOISE; IEEmbossItem->Caption = IDS_IEEMBOSS; IEUnderlayItem->Caption = IDS_IEUNDERLAY; IEEdgeEnhanceItem->Caption = IDS_IEEDGEENHANCE; IEOilifyItem->Caption = IDS_IEOILIFY; ImageSpatialFiltersItem->Caption = IDS_ISPATIALFILTER; ISGradientItem->Caption = IDS_ISGRADIENT; ISLaplacianItem->Caption = IDS_ISLAPLACIAN; ISSobelItem->Caption = IDS_ISSOBEL; ISPrewittItem->Caption = IDS_ISPREWITT; ISShiftandDifferenceItem->Caption = IDS_ISSHIFTANDDIFFERENCE; ISLineSegmentItem->Caption = IDS_ISLINESEGMENT; ViewItem->Caption = IDS_VIEW; VPenItem->Caption = IDS_VSPECIALPEN; VFullViewItem->Caption = IDS_VFULLVIEW; VPaletteItem->Caption = IDS_VPALETTE; VLayerItem->Caption = IDS_VLAYER; VMainMenuItem->Caption = IDS_VMAINMENU; VStatusBarItem->Caption = IDS_VSTATUSBAR; WindowItem->Caption = IDS_WINDOW; WCascadeItem->Caption = IDS_WCASCADE; WTileItem->Caption = IDS_WTILE; WArrangeItem->Caption = IDS_WARRANGEICONS; WMinimizeItem->Caption = IDS_WMINIMIZEALL; HelpItem->Caption = IDS_HELP; HAboutItem->Caption = IDS_HABOUT; //======================================== return; fail: ::doDestroy(Undo); ::doDestroy(FileHistory); ::doDestroy(StatusProgress); #ifndef ACADEMY ::doDestroy(CaptureData); ::doDestroy(UserColorLibForm); #endif ::doDestroy(ColorLibraryForm); ::doDestroy(ColorChartForm); #ifndef ACADEMY ::doDestroy(LayerForm); #endif ::doDestroy(PaletteForm); ::doDestroy(FullViewForm); ::doDestroy(PenManagerForm); ::doDestroy(MainMenuForm); #ifndef ACADEMY ::doDestroy(PantoneTextile); ::doDestroy(Pantone1000); // k3dogs 20001211 ::doDestroy(TextileColor); ::doDestroy(StandardColor); #endif ::doDestroy(PrinterColor); ::doDestroy(Tablet); ::doDestroy(SmallFont); ::doDestroy(ProtectCard); if (ec == EC_NONE) ec = EC_FORM_NOT_CREATE; EXCEPTION_MESSAGE_OK(ec); Application->Terminate(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormDestroy(TObject *Sender) { ::doDestroy(Undo); ::doDestroy(FileHistory); ::doDestroy(StatusProgress); #ifndef ACADEMY if (CaptureData) { CDeleteAllItemClick(NULL); delete CaptureData; CaptureData = NULL; } ::doDestroy(UserColorLibForm); #endif ::doDestroy(ColorLibraryForm); ::doDestroy(ColorChartForm); #ifndef ACADEMY ::doDestroy(LayerForm); #endif ::doDestroy(PaletteForm); ::doDestroy(FullViewForm); ::doDestroy(PenManagerForm); ::doDestroy(MainMenuForm); #ifndef ACADEMY ::doDestroy(PantoneTextile); ::doDestroy(Pantone1000); // k3dogs 20001211 ::doDestroy(TextileColor); ::doDestroy(StandardColor); #endif ::doDestroy(PrinterColor); ::doDestroy(Tablet); ::doDestroy(SmallFont); ::doDestroy(ProtectCard); Screen->OnActiveFormChange = NULL; } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormResize(TObject *Sender) { int w = StatusBar->Width-(160+80+100+100+200); StatusBar->Panels->Items[StatusBarHint]->Width = w<100 ? 100 : w; if (StatusProgress) StatusProgress->Resize(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormShow(TObject *Sender) { if (MDIChildCount>0) ToolsRearrange(); } //--------------------------------------------------------------------- void __fastcall TMainForm::FNewCanvas256ItemClick(TObject *Sender) { TCursor cur; TMainImageForm *Child = NULL; TNewCanvasForm *Form = NULL; TPException ec = EC_NONE; PenManagerForm->spread_sw[4] = 0; PenManagerForm->aspread = false; PenManagerForm->acolor = 0; MainMenuForm->ExitForm(1); #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC if (ProtectCard->CheckPassword()) { #else ProtectCard->Read(); #endif #endif if ((Form = new TNewCanvasForm(NULL))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } if (Form->ShowModal()==mrOk) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (MainImageForm) { if (MainImageForm->AutoRepeat) MainImageForm->ARViewExitForm(); } if ((Child = new TMainImageForm(Application))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } if ((ec = Child->InitForm(Form->CanvasInfor, 8))!=EC_NONE) goto fail; Screen->Cursor = cur; } delete Form; #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC } else { EXCEPTION_MESSAGE_OK(EC_INTERFACE_NONE); Application->Terminate(); } #endif #endif return; fail: if (Form) { if (Child) delete Child; Screen->Cursor = cur; delete Form; } EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FNewCanvasFullItemClick(TObject *Sender) { TCursor cur; TMainImageForm *Child = NULL; TNewCanvasForm *Form; TPException ec = EC_NONE; PenManagerForm->spread_sw[4] = 0; PenManagerForm->aspread = false; PenManagerForm->acolor = 0; MainMenuForm->ExitForm(1); #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC if (ProtectCard->CheckPassword()) { #else ProtectCard->Read(); #endif #endif Form = new TNewCanvasForm(NULL); if (Form->ShowModal()==mrOk) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (MainImageForm) { if (MainImageForm->AutoRepeat) MainImageForm->ARViewExitForm(); } if ((Child = new TMainImageForm(Application))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } if ((ec = Child->InitForm(Form->CanvasInfor, 24))!=EC_NONE) goto fail; Screen->Cursor = cur; } delete Form; #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC } else { EXCEPTION_MESSAGE_OK(EC_INTERFACE_NONE); Application->Terminate(); } #endif #endif return; fail: if (Child) delete Child; Screen->Cursor = cur; EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FResizeCanvasItemClick(TObject *Sender) { TCursor cur; TResizeCanvasForm *Form; MainMenuForm->ExitForm(1); #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC if (ProtectCard->CheckPassword()) { #endif #endif Form = new TResizeCanvasForm(this); Form->CanvasInfor = MainImageForm->CanvasInfor; if (Form->ShowModal()==mrOk) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->ResizeCanvas(Form->NewDPI, Form->NewSize.cx, Form->NewSize.cy); Screen->Cursor = cur; } delete Form; #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC } else { EXCEPTION_MESSAGE_OK(EC_INTERFACE_NONE); Application->Terminate(); } #endif #endif } //--------------------------------------------------------------------------- void __fastcall TMainForm::FEnlargeCanvasItemClick(TObject *Sender) { TCursor cur; TEnlargeCanvasForm *Form; MainMenuForm->ExitForm(1); #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC if (ProtectCard->CheckPassword()) { #endif #endif Form = new TEnlargeCanvasForm(this); Form->CanvasInfor = MainImageForm->CanvasInfor; if (Form->ShowModal()==mrOk) { cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->EnlargeCanvas(Form->NewSize.cx, Form->NewSize.cy); Screen->Cursor = cur; } delete Form; #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC } else { EXCEPTION_MESSAGE_OK(EC_INTERFACE_NONE); Application->Terminate(); } #endif #endif } //--------------------------------------------------------------------- void __fastcall TMainForm::FManagerItemClick(TObject *Sender) { TFileManagerForm *Form; MainMenuForm->ExitForm(1); #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC if (ProtectCard->CheckPassword()) { #else ProtectCard->Read(); #endif #endif if ((Form = new TFileManagerForm(this)) == NULL) goto fail; if (MainImageForm) { Form->Extension = MainImageForm->iMainImage->Bitmap->BitsPerPixel; } else { Form->Extension = 8; } Form->CompressCheckBox->Checked = (CompressMethod == cmNone) ? false: true; if(T3D_Item) { Form->FilterComboBox->Filter = #ifdef ACADEMY "Texpro Textile 256 Colors File (*.tex)|*.tex|" "Microsoft Windows Bitmap (*.bmp)|*.bmp|" "TIFF uncomp (*.tif)|*.tif"; #else "Texpro Textile 256 Colors File (*.tex)|*.tex|" "Texpro Textile Full Colors File (*.tfc)|*.tfc|" #ifndef N_3D "Texpro Textile 3D File (*.t3d)|*.t3d|" #endif "Texpro Weave File (*.wea)|*.wea|" "Texpro Weave File - V7.01 (*.wav)|*.wav|" "Texpro Knit File (*.knt)|*.knt|" "Microsoft Windows Bitmap (*.bmp)|*.bmp|" "JPEG (*.jpg)|*.jpg|" "Macintosh PICT (*.pct)|*.pct|" "PC Paintbrush File Format (*.pcx)|*.pcx|" "PNG (*.png)|*.png|PSD (*.psd)|*.psd|" "SUN Raster (*.ras)|*.ras|" "Targa Image File (*.tga)|*.tga|" "TIFF uncomp (*.tif)|*.tif|" "Encapsulated PostScript File (*.eps)|*.eps"; #endif } else { Form->FilterComboBox->Filter = #ifdef ACADEMY "Texpro Textile 256 Colors File (*.tex)|*.tex|" "Microsoft Windows Bitmap (*.bmp)|*.bmp|" "TIFF uncomp (*.tif)|*.tif"; #else "Texpro Textile 256 Colors File (*.tex)|*.tex|" "Texpro Textile Full Colors File (*.tfc)|*.tfc|" "Texpro Weave File (*.wea)|*.wea|" "Texpro Weave File - V7.01 (*.wav)|*.wav|" "Texpro Knit File (*.knt)|*.knt|" "Microsoft Windows Bitmap (*.bmp)|*.bmp|" "JPEG (*.jpg)|*.jpg|" "Macintosh PICT (*.pct)|*.pct|" "PC Paintbrush File Format (*.pcx)|*.pcx|" "PNG (*.png)|*.png|PSD (*.psd)|*.psd|" "SUN Raster (*.ras)|*.ras|" "Targa Image File (*.tga)|*.tga|" "TIFF uncomp (*.tif)|*.tif|" "Encapsulated PostScript File (*.eps)|*.eps"; #endif } //================================================================= Form->OnRead = FMOnRead; Form->OnFileName = FMOnFileName; if (MainImageForm) { Form->SpeedButtonSave->Enabled = true; Form->SpeedButtonSaveAs->Enabled = true; Form->OnSave = FMOnSave; Form->OnMerge = FMOnMerge; } else { Form->SpeedButtonSave->Enabled = false; Form->SpeedButtonSaveAs->Enabled = false; } Form->ShowModal(); delete Form; #ifndef LOCK_CRYPKEY #ifdef LOCK_IFC } else { EXCEPTION_MESSAGE_OK(EC_INTERFACE_NONE); Application->Terminate(); } #endif #endif return; fail: EXCEPTION_MESSAGE_OK(EC_FORM_NOT_CREATE); } //--------------------------------------------------------------------- void __fastcall TMainForm::FCloseItemClick(TObject *Sender) { if (ActiveMDIChild) ActiveMDIChild->Close(); } //--------------------------------------------------------------------------- /* void __fastcall TMainForm::FCloseAllItemClick(TObject *Sender) { MainMenuForm->ExitForm(1); for (int i=MDIChildCount-1; i>=0; i--) { MDIChildren[i]->Close(); } } */ //--------------------------------------------------------------------- void __fastcall TMainForm::FScanningItemClick(TObject *Sender) { RECT r; BITMAPHANDLE hBitmap; int nRet; RGBQUAD rgb[256]; HDC dcSrc = NULL, dcDst = NULL; Byte c[256]; int x, y, w, h, ec = EC_NONE, uuu; Byte *bp; TCursor OldCursor = Screen->Cursor; Screen->Cursor = crDefault; TPItemImage *ti = MainImageForm->iMainImage; memset(&hBitmap, 0, sizeof(BITMAPHANDLE)); if (L_InitBitmap(&hBitmap, 0, 0, 24)Handle, &hBitmap); if (nRet < SUCCESS) goto fail; if (!hBitmap.Flags.Allocated) goto fail; if (ti->Bitmap->BitsPerPixel==8) { if (L_ColorResBitmap(&hBitmap, &hBitmap, 8, CRF_OPTIMIZEDPALETTE, NULL, 250, NULL, NULL)WorkArea->Reset(true); r.left = 0; r.top = 0; r.right = ti->Bitmap->Width; r.bottom = ti->Bitmap->Height; ti->Bitmap->FillRect(r, PaletteForm->DIB256Palette->GetBGCOLORREF(8)); if (ti->LayerMask) ti->LayerMask->FillRect(r, PALETTEINDEX(255)); L_GetBitmapColors(&hBitmap, 0, 256, rgb); ti->Bitmap->PutColors(0, 256, rgb); if (hBitmap.Width>ti->Bitmap->Width) w = ti->Bitmap->Width; else w = hBitmap.Width; if (hBitmap.Height>ti->Bitmap->Height) h = ti->Bitmap->Height; else h = hBitmap.Height; if ((dcSrc = L_CreateLeadDC(&hBitmap))==NULL) { ec = EC_RESOURCE_LACK; goto fail; } if ((dcDst = ti->Bitmap->CreateDC())==NULL) { ec = EC_RESOURCE_LACK; goto fail; } BitBlt(dcDst, 0, 0, w, h, dcSrc, 0, 0, SRCCOPY); if (ti->LayerMask) ti->LayerMask->FillRect(Rect(0, 0, w, h), 0); ti->Bitmap->DeleteDC(dcDst); dcDst = NULL; L_DeleteLeadDC(dcSrc); dcSrc = NULL; r.right = w; r.bottom = h; memset(c, 0, 256); if (!ti->Bitmap->StartScanLine()) { ec = EC_MEMORY_LACK; goto fail; } for (y=0; yBitmap->GetScanLine(y); for (x=0; xBitmap->PutScanLine(y); } ti->Bitmap->StopScanLine(); for (x=0; x<250; x++) { MainImageForm->Palette->SetNormal(x+2, rgb[x].rgbRed, rgb[x].rgbGreen, rgb[x].rgbBlue); } MainImageForm->Palette->ToRGBQUAD(rgb, 256); ti->Bitmap->PutColors(0, 256, rgb); for (x=251; x>=1; x--) { if (c[x]==1) { MainImageForm->Palette->UseColor = x; break; } } } else { if (L_ColorResBitmap(&hBitmap, &hBitmap, 24, CRF_BYTEORDERBGR, NULL, 0, NULL, NULL)WorkArea->Reset(true); r.left = 0; r.top = 0; r.right = ti->Bitmap->Width; r.bottom = ti->Bitmap->Height; ti->Bitmap->FillRect(r, PaletteForm->DIB256Palette->GetBGCOLORREF(24)); if (ti->LayerMask) ti->LayerMask->FillRect(r, clWhite); if (hBitmap.Width>ti->Bitmap->Width) w = ti->Bitmap->Width; else w = hBitmap.Width; if (hBitmap.Height>ti->Bitmap->Height) h = ti->Bitmap->Height; else h = hBitmap.Height; if ((dcSrc = L_CreateLeadDC(&hBitmap))==NULL) { ec = EC_RESOURCE_LACK; goto fail; } if ((dcDst = ti->Bitmap->CreateDC())==NULL) { ec = EC_RESOURCE_LACK; goto fail; } BitBlt(dcDst, 0, 0, w, h, dcSrc, 0, 0, SRCCOPY); if (ti->LayerMask) ti->LayerMask->FillRect(Rect(0, 0, w, h), 0); ti->Bitmap->DeleteDC(dcDst); L_DeleteLeadDC(dcSrc); r.right = w; r.bottom = h; } MainImageForm->WorkArea->SetRectangle(r); MainImageForm->WorkAreaChange(); L_FreeBitmap(&hBitmap); RepaintColor(); Screen->Cursor = OldCursor; return; fail: ti->Bitmap->StopScanLine(); if (dcSrc) { if (dcDst) ti->Bitmap->DeleteDC(dcDst); L_DeleteLeadDC(dcSrc); } L_FreeBitmap(&hBitmap); Screen->Cursor = OldCursor; EXCEPTION_MESSAGE_OK(ec); /* RECT r; BITMAPHANDLE hBitmap; int nRet; RGBQUAD rgb[256]; HDC dcSrc = NULL, dcDst = NULL; Byte c[256]; int x, y, w, h; Byte *bp; TCursor OldCursor = Screen->Cursor; Screen->Cursor = crDefault; TTexpiaImage *ti = MainImageForm->iMainImage; memset(&hBitmap, 0, sizeof(BITMAPHANDLE)); try { if (L_InitBitmap(&hBitmap, 0, 0, 24)Handle, &hBitmap)Bitmap->BitsPerPixel==8) { if (L_ColorResBitmap(&hBitmap, &hBitmap, 8, CRF_OPTIMIZEDPALETTE, NULL, 250, NULL, NULL)WorkArea->Reset(true); r.left = 0; r.top = 0; r.right = ti->Bitmap->Width; r.bottom = ti->Bitmap->Height; ti->Bitmap->FillRect(r, PaletteForm->DIB256Palette->GetBGCOLORREF(8)); L_GetBitmapColors(&hBitmap, 0, 256, rgb); ti->Bitmap->PutColors(0, 256, rgb); if (hBitmap.Width>ti->Bitmap->Width) w = ti->Bitmap->Width; else w = hBitmap.Width; if (hBitmap.Height>ti->Bitmap->Height) h = ti->Bitmap->Height; else h = hBitmap.Height; if ((dcSrc = L_CreateLeadDC(&hBitmap))==NULL) throw EC_RESOURCE_LACK; if ((dcDst = ti->Bitmap->CreateDC())==NULL) throw EC_RESOURCE_LACK; BitBlt(dcDst, 0, 0, w, h, dcSrc, 0, 0, SRCCOPY); ti->Bitmap->DeleteDC(dcDst); dcDst = NULL; L_DeleteLeadDC(dcSrc); dcSrc = NULL; r.right = w; r.bottom = h; memset(c, 0, 256); if (!ti->Bitmap->StartScanLine()) throw EC_MEMORY_LACK; for (y=0; yBitmap->GetScanLine(y); for (x=0; xBitmap->PutScanLine(y); } ti->Bitmap->StopScanLine(); for (x=0; x<=249; x++) { MainImageForm->Palette->SetNormal(x+2, rgb[x].rgbRed, rgb[x].rgbGreen, rgb[x].rgbBlue); } MainImageForm->Palette->ToRGBQUAD(rgb, 256); ti->Bitmap->PutColors(0, 256, rgb); for (x=251; x>=1; x--) { if (c[x]==1) { MainImageForm->Palette->UseColor = x; break; } } MainImageForm->WorkArea->SetRectangle(r); MainImageForm->WorkAreaChange(); L_FreeBitmap(&hBitmap); } else { if (L_ColorResBitmap(&hBitmap, &hBitmap, 24, CRF_BYTEORDERBGR, NULL, 0, NULL, NULL)WorkArea->Reset(true); r.left = 0; r.top = 0; r.right = ti->Bitmap->Width; r.bottom = ti->Bitmap->Height; ti->Bitmap->FillRect(r, PaletteForm->DIB256Palette->GetBGCOLORREF(24)); if (hBitmap.Width>ti->Bitmap->Width) w = ti->Bitmap->Width; else w = hBitmap.Width; if (hBitmap.Height>ti->Bitmap->Height) h = ti->Bitmap->Height; else h = hBitmap.Height; if ((dcSrc = L_CreateLeadDC(&hBitmap))==NULL) throw EC_RESOURCE_LACK; if ((dcDst = ti->Bitmap->CreateDC())==NULL) throw EC_RESOURCE_LACK; BitBlt(dcDst, 0, 0, w, h, dcSrc, 0, 0, SRCCOPY); ti->Bitmap->DeleteDC(dcDst); L_DeleteLeadDC(dcSrc); r.right = w; r.bottom = h; MainImageForm->WorkArea->SetRectangle(r); MainImageForm->WorkAreaChange(); L_FreeBitmap(&hBitmap); } } catch (int ec) { ti->Bitmap->StopScanLine(); if (dcSrc) { if (dcDst) ti->Bitmap->DeleteDC(dcDst); L_DeleteLeadDC(dcSrc); } L_FreeBitmap(&hBitmap); EXCEPTION_MESSAGE_OK(ec); } RepaintColor(); Screen->Cursor = OldCursor; */ } //--------------------------------------------------------------------- void __fastcall TMainForm::FScannerSetupItemClick(TObject *Sender) { int nRet; nRet = L_TwainSelect(Application->Handle); if (nRetInitForm(); if (PrintForm->ShowModal()==mrOk) { if ((Pattern = new TTexpiaBitmap)==NULL) goto fail; DPI = MainImageForm->CanvasInfor.DotsPerInch; FitSize = PrintForm->cbFitSize->Checked; GridColor = FullViewForm->rGridColor; Grid = FullViewForm->rGrid; GridMark = FullViewForm->rGridMark; GridMarkColor = FullViewForm->rGridMarkColor; if (FitSize) { WW = GetDeviceCaps(Printer()->Handle, HORZRES)*MainImageForm->CanvasInfor.DotsPerInch/ GetDeviceCaps(Printer()->Handle, LOGPIXELSX); HH = GetDeviceCaps(Printer()->Handle, VERTRES)*MainImageForm->CanvasInfor.DotsPerInch/ GetDeviceCaps(Printer()->Handle, LOGPIXELSY); } switch (PrintForm->PrintHeader) { case phNo: r.cx = StrToInt(PrintForm->SpinEditRepeatX->Text); r.cy = StrToInt(PrintForm->SpinEditRepeatY->Text); if (!MainImageForm->ComboHeaderNoMethod(Pattern, r, StrToInt(PrintForm->EditRepeat->Text), PrintForm->ComboBoxRepeat->ItemIndex)) goto fail; if (PrintForm->GridCheck->Checked == true) // MainImageForm->PrintGrid(Pattern, r, GridColor, Grid, GridMark, GridMarkColor); //by k3dogs ±×¸®µå Ãâ·Â. if (FitSize) { rx = (double)WW / Pattern->Width; ry = (double)HH / Pattern->Height; if (rx < ry) { if (rx < 1.0) DPI = DPI / rx; } else { if (ry < 1.0) DPI = DPI / ry; } } else { DPI = DPI * 100 / StrToInt(PrintForm->EditZoom->Text); } break; case phYes: if (!MainImageForm->ComboHeaderYesMethod(Pattern)) goto fail; if (PrintForm->GridCheck->Checked == true) { // r.cx = 1; r.cy = 1; MainImageForm->PrintGrid(Pattern, r, GridColor, Grid, GridMark, GridMarkColor); //by k3dogs ±×¸®µå Ãâ·Â. } if (FitSize) { rx = (double)WW / Pattern->Width; ry = (double)HH / Pattern->Height; if (rx < ry) { if (rx < 1.0) DPI = DPI / rx; } else { if (ry < 1.0) DPI = DPI / ry; } } else { DPI = DPI * 100 / StrToInt(PrintForm->EditZoom->Text); } break; case phUsedColor: if (!MainImageForm->ComboHeaderUsedColorMethod(Pattern, false)) goto fail; break; case phMosaic: mx = PrintForm->MosaicXEdit->Value; my = PrintForm->MosaicYEdit->Value; if (!MainImageForm->ComboHeaderMosaicMethod(Pattern, mx, my)) goto fail; break; } if (!SendToPrinter(Pattern, DPI, "Textile - "+MainImageForm->FileName, PrintForm->SpinEditPage->Value, PrintForm->cbMethod->ItemIndex)) goto fail; delete Pattern; } delete PrintForm; return; fail: if (Pattern) delete Pattern; if (PrintForm) delete PrintForm; EXCEPTION_MESSAGE_OK(EC_MEMORY_LACK); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FPrinterSetupItemClick(TObject *Sender) { PrinterSetupDialog->Execute(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FFontItemClick(TObject *Sender) { MainMenuForm->ExitForm(1); FontDialog1->Font->Assign(SmallFont); if (FontDialog1->Execute()) { SmallFont->Assign(FontDialog1->Font); TIniFile *IniFile = new TIniFile(DirectoryItem + "\\Environment.ini"); if (IniFile) { SaveFont(IniFile, SmallFont, "Font"); delete IniFile; } ColorLibraryForm->SetFont(); ColorChartForm->SetFont(); PenManagerForm->SetFont(); FullViewForm->SetFont(); PaletteForm->SetFont(); AboutBox->SetFont(); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::FEnvironmentItemClick(TObject *Sender) { int unit; MainMenuForm->ExitForm(1); TEnvironmentForm *Form = new TEnvironmentForm(this); Form->ShowModal(); TIniFile *IniFile = new TIniFile(DirectoryItem+"\\Environment.ini"); if (IniFile) { unit = IniFile->ReadInteger("MainImage", "Unit", 0); if (MainImageForm) { if (unit == 0) { MainImageForm->CurrentUnit = uCm; MainImageForm->UnitChange(uCm); } else if (unit == 1) { MainImageForm->CurrentUnit = uInch; MainImageForm->UnitChange(uInch); } else { MainImageForm->CurrentUnit = uDot; MainImageForm->UnitChange(uDot); } } bAutoSave = IniFile->ReadBool("AutoSave", "Check", false); if (bAutoSave) { AutosaveTimer->Interval = IniFile->ReadInteger("AutoSave", "Min", 5) * 60000; } delete IniFile; } delete Form; if (MainImageForm) MainImageForm->ApplyEnvironment(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FExitItemClick(TObject *Sender) { Close(); } //--------------------------------------------------------------------- void __fastcall TMainForm::ECutItemClick(TObject *Sender) { MainImageForm->EditCut(); } //--------------------------------------------------------------------- void __fastcall TMainForm::ECopyItemClick(TObject *Sender) { MainImageForm->EditCopy(); } //--------------------------------------------------------------------- void __fastcall TMainForm::EPasteItemClick(TObject *Sender) { MainImageForm->EditPaste(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::CaptureItemClick(TObject *Sender) { if(MainMenuForm->Item == T_FILL) MainMenuForm->ExitForm(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::COverwriteItemClick(TObject *Sender) { #ifndef ACADEMY if (CaptureData->Count) { TCaptureData *cd = (TCaptureData *)CaptureData->First(); CaptureData->Remove(cd); delete cd; } CaptureData->Insert(0, MainImageForm->MakeCapture()); UpdateMenuItems(NULL); #endif } //--------------------------------------------------------------------------- void __fastcall TMainForm::CInsertItemClick(TObject *Sender) { #ifndef ACADEMY CaptureData->Insert(0, MainImageForm->MakeCapture()); UpdateMenuItems(NULL); #endif } //--------------------------------------------------------------------------- void __fastcall TMainForm::CEditItemClick(TObject *Sender) { #ifndef ACADEMY TCaptureEditForm *Form = new TCaptureEditForm(this); Form->InitForm(); Form->ShowModal(); delete Form; #endif } //--------------------------------------------------------------------------- void __fastcall TMainForm::CDeleteAllItemClick(TObject *Sender) { #ifndef ACADEMY TCaptureData *cd; while (CaptureData->Count) { cd = (TCaptureData *)CaptureData->First(); CaptureData->Remove(cd); delete cd; } UpdateMenuItems(NULL); #endif } //--------------------------------------------------------------------------- void __fastcall TMainForm::IIntensityDetectItemClick(TObject *Sender) { L_UINT uLow = 0, uHigh = 255; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetRange DlgGetRange = (TDlgGetRange)GetProcAddress(hLibrary, "L_DlgGetRange"); if (DlgGetRange(Handle, bh, &uLow, &uHigh, DLG_IMG_SHOWPREVIEW, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_IntensityDetectBitmap(bh, uLow, uHigh); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::ISolarizeItemClick(TObject *Sender) { L_INT nChange = 0; L_UINT32 uProcess = 0; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_SOLARIZE, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange>=0) { MainImageForm->UndoSave(UK_PATTERN); L_SolarizeBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEPosterizeItemClick(TObject *Sender) { L_INT nChange = 2; L_UINT32 uProcess = 0; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_POSTERIZE, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange) { MainImageForm->UndoSave(UK_PATTERN); L_PosterizeBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEMosaicItemClick(TObject *Sender) { L_INT nChange = 2; L_UINT32 uProcess; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_MOSAIC, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange) { MainImageForm->UndoSave(UK_PATTERN); L_MosaicBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEAverageItemClick(TObject *Sender) { L_INT nChange = 3; L_UINT32 uProcess; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_AVERAGE, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange) { MainImageForm->UndoSave(UK_PATTERN); L_AverageFilterBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- /**************************************************************************** void __fastcall TMainForm::IEAverageItemClick(TObject *Sender) { L_INT nChange = 3; L_UINT32 uProcess; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_AVERAGE, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange) { MainImageForm->UndoSave(UK_PATTERN); L_AverageFilterBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } } ****************************************************************************/ void __fastcall TMainForm::IEMedianItemClick(TObject *Sender) { L_INT nChange = 3; L_UINT32 uProcess; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_MEDIAN, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange) { MainImageForm->UndoSave(UK_PATTERN); L_MedianFilterBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::IESharpenItemClick(TObject *Sender) { L_INT nChange = 0; L_UINT32 uProcess; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_SHARPEN, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange) { MainImageForm->UndoSave(UK_PATTERN); L_SharpenBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEAddNoiseItemClick(TObject *Sender) { L_UINT uRange; L_UINT uChannel; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetNoise DlgGetNoise = (TDlgGetNoise)GetProcAddress(hLibrary, "L_DlgGetNoise"); if (DlgGetNoise(Handle, bh, &uRange, &uChannel, DLG_IMG_SHOWPREVIEW, NULL)==SUCCESS) { MainImageForm->UndoSave(UK_PATTERN); TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; L_AddBitmapNoise(bh, uRange, uChannel); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEEmbossItemClick(TObject *Sender) { L_UINT uDirectory, uDepth = 50; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetEmboss DlgGetEmboss = (TDlgGetEmboss)GetProcAddress(hLibrary, "L_DlgGetEmboss"); if (DlgGetEmboss(Handle, bh, &uDirectory, &uDepth, DLG_IMG_SHOWPREVIEW | DLG_IMG_EMBOSS, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_EmbossBitmap(bh, uDirectory, uDepth); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEUnderlayItemClick(TObject *Sender) { // } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEEdgeEnhanceItemClick(TObject *Sender) { BITMAPHANDLE WrkBitmap, *bh = MainImageForm->iMainImage->Bitmap->Handle; L_INT nRet; TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; nRet = L_CopyBitmap(&WrkBitmap, bh); if (nRet==SUCCESS) { nRet = L_SpatialFilterBitmap(&WrkBitmap, FLT_LAPLACE_1); if (nRet==SUCCESS) { MainImageForm->UndoSave(UK_PATTERN); nRet = L_CombineBitmap(bh, 0, 0, BITMAPWIDTH(bh), BITMAPHEIGHT(bh), &WrkBitmap, 0, 0, CB_OP_ADD); MainImageForm->iMainImage->Repaint(); } L_FreeBitmap(&WrkBitmap); } Screen->Cursor = cur; } //--------------------------------------------------------------------------- void __fastcall TMainForm::IEOilifyItemClick(TObject *Sender) { /* L_INT nChange = 3; L_UINT32 uProcess; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetChange DlgGetChange = (TDlgGetChange)GetProcAddress(hLibrary, "L_DlgGetChange"); if (DlgGetChange(Handle, bh, &nChange, &uProcess, DLG_IMG_SHOWPREVIEW | DLG_IMG_OILIFY, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; if (nChange) { MainImageForm->Undo->Save(UK_PATTERN); L_OilifyBitmap(bh, nChange); MainImageForm->iMainImage->Repaint(); } Screen->Cursor = cur; } FreeLibrary(hLibrary); } */ } //--------------------------------------------------------------------------- void __fastcall TMainForm::ISGradientItemClick(TObject *Sender) { LPSPATIALFLT pSpatialFlt; LPBINARYFLT pBinaryFlt; L_BOOL bSpatial; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetFilter DlgGetFilter = (TDlgGetFilter)GetProcAddress(hLibrary, "L_DlgGetFilter"); if (DlgGetFilter(Handle, bh, &pSpatialFlt, &pBinaryFlt, &bSpatial, DLG_IMG_SHOWPREVIEW | DLG_IMG_GRADIENT, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_SpatialFilterBitmap(bh, pSpatialFlt); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::ISLaplacianItemClick(TObject *Sender) { LPSPATIALFLT pSpatialFlt; LPBINARYFLT pBinaryFlt; L_BOOL bSpatial; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetFilter DlgGetFilter = (TDlgGetFilter)GetProcAddress(hLibrary, "L_DlgGetFilter"); if (DlgGetFilter(Handle, bh, &pSpatialFlt, &pBinaryFlt, &bSpatial, DLG_IMG_SHOWPREVIEW | DLG_IMG_LAPLACIAN, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_SpatialFilterBitmap(bh, pSpatialFlt); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::ISSobelItemClick(TObject *Sender) { LPSPATIALFLT pSpatialFlt; LPBINARYFLT pBinaryFlt; L_BOOL bSpatial; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetFilter DlgGetFilter = (TDlgGetFilter)GetProcAddress(hLibrary, "L_DlgGetFilter"); if (DlgGetFilter(Handle, bh, &pSpatialFlt, &pBinaryFlt, &bSpatial, DLG_IMG_SHOWPREVIEW | DLG_IMG_SOBEL, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_SpatialFilterBitmap(bh, pSpatialFlt); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::ISPrewittItemClick(TObject *Sender) { LPSPATIALFLT pSpatialFlt; LPBINARYFLT pBinaryFlt; L_BOOL bSpatial; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetFilter DlgGetFilter = (TDlgGetFilter)GetProcAddress(hLibrary, "L_DlgGetFilter"); if (DlgGetFilter(Handle, bh, &pSpatialFlt, &pBinaryFlt, &bSpatial, DLG_IMG_SHOWPREVIEW | DLG_IMG_PREWITT, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_SpatialFilterBitmap(bh, pSpatialFlt); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::ISShiftandDifferenceItemClick(TObject *Sender) { LPSPATIALFLT pSpatialFlt; LPBINARYFLT pBinaryFlt; L_BOOL bSpatial; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetFilter DlgGetFilter = (TDlgGetFilter)GetProcAddress(hLibrary, "L_DlgGetFilter"); if (DlgGetFilter(Handle, bh, &pSpatialFlt, &pBinaryFlt, &bSpatial, DLG_IMG_SHOWPREVIEW | DLG_IMG_SHIFTDIFF, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_SpatialFilterBitmap(bh, pSpatialFlt); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::ISLineSegmentItemClick(TObject *Sender) { LPSPATIALFLT pSpatialFlt; LPBINARYFLT pBinaryFlt; L_BOOL bSpatial; BITMAPHANDLE *bh = MainImageForm->iMainImage->Bitmap->Handle; HINSTANCE hLibrary = LoadLibrary("ltdlg10n.dll"); if (hLibrary) { TDlgGetFilter DlgGetFilter = (TDlgGetFilter)GetProcAddress(hLibrary, "L_DlgGetFilter"); if (DlgGetFilter(Handle, bh, &pSpatialFlt, &pBinaryFlt, &bSpatial, DLG_IMG_SHOWPREVIEW | DLG_IMG_LINESEG, NULL)==SUCCESS) { TCursor cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainImageForm->UndoSave(UK_PATTERN); L_SpatialFilterBitmap(bh, pSpatialFlt); MainImageForm->iMainImage->Repaint(); Screen->Cursor = cur; } FreeLibrary(hLibrary); } } //--------------------------------------------------------------------- void __fastcall TMainForm::VPenItemClick(TObject *Sender) { if (VPenItem->Checked) { VPenItem->Checked = false; PenManagerForm->Visible = false; } else { VPenItem->Checked = true; PenManagerForm->Visible = true; } UpdateMenuItems(Sender); } //--------------------------------------------------------------------- void __fastcall TMainForm::VFullViewItemClick(TObject *Sender) { if (VFullViewItem->Checked) { VFullViewItem->Checked = false; FullViewForm->Visible = false; } else { VFullViewItem->Checked = true; FullViewForm->Visible = true;; FullViewForm->InitForm(MainImageForm->iMainImage); } UpdateMenuItems(Sender); } //--------------------------------------------------------------------- void __fastcall TMainForm::VPaletteItemClick(TObject *Sender) { if (VPaletteItem->Checked) { VPaletteItem->Checked = false; PaletteForm->Visible = false; } else { VPaletteItem->Checked = true; PaletteForm->Visible = true; PaletteForm->InitForm(MainImageForm->Palette); } UpdateMenuItems(Sender); } //--------------------------------------------------------------------- void __fastcall TMainForm::VMainMenuItemClick(TObject *Sender) { MainMenuForm->ExitForm(1); if (VMainMenuItem->Checked) { VMainMenuItem->Checked = false; MainMenuForm->Visible = false; } else { VMainMenuItem->Checked = true; MainMenuForm->Visible = true; } UpdateMenuItems(Sender); } //--------------------------------------------------------------------- void __fastcall TMainForm::VLayerItemClick(TObject *Sender) { #ifndef ACADEMY if (VLayerItem->Checked) { VLayerItem->Checked = false; LayerForm->Visible = false; } else { VLayerItem->Checked = true; LayerForm->Show(); LayerForm->InitForm(); } UpdateMenuItems(Sender); #endif } //--------------------------------------------------------------------------- void __fastcall TMainForm::VStatusBarItemClick(TObject *Sender) { if (VStatusBarItem->Checked) { VStatusBarItem->Checked = false; StatusBar->Visible = false; } else { VStatusBarItem->Checked = true; StatusBar->Visible = true; } UpdateMenuItems(Sender); } //--------------------------------------------------------------------------- void __fastcall TMainForm::VToolsRearrangeItemClick(TObject *Sender) { ToolsRearrange(); } //--------------------------------------------------------------------- void __fastcall TMainForm::WCascadeItemClick(TObject *Sender) { int i; //---- Must be done backwards through the MDIChildren array ---- added by k3dogs(20001114) for (i=0; MDIChildCount-1 >= i; i++) if (MDIChildren[i]->WindowState == wsMinimized) MDIChildren[i]->WindowState = wsNormal; Cascade(); } //--------------------------------------------------------------------- void __fastcall TMainForm::WTileItemClick(TObject *Sender) { int i; //---- Must be done backwards through the MDIChildren array ---- for (i=0; MDIChildCount-1 >= i; i++) if (MDIChildren[i]->WindowState == wsMinimized) MDIChildren[i]->WindowState = wsNormal; Tile(); } //--------------------------------------------------------------------- void __fastcall TMainForm::WArrangeItemClick(TObject *Sender) { ArrangeIcons(); } //--------------------------------------------------------------------- void __fastcall TMainForm::WMinimizeItemClick(TObject *Sender) { int i; //---- Must be done backwards through the MDIChildren array ---- for (i=MDIChildCount-1; i >= 0; i--) MDIChildren[i]->WindowState = wsMinimized; } //--------------------------------------------------------------------------- void __fastcall TMainForm::HAboutItemClick(TObject *Sender) { AboutBox->ShowModal(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Timer50msTimer(TObject *Sender) { if (MainImageForm) MainImageForm->Timer50ms(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Timer200msTimer(TObject *Sender) { if (MainImageForm) MainImageForm->Timer200ms(); MainMenuForm->Timer200ms(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Timer1000msTimer(TObject *Sender) { TDateTime Date1; Date1 = Now(); String S; DateTimeToString(S,"yyyy-mm-dd ampm hh-nn-ss",Date1.CurrentDateTime()); StatusBar->Panels->Items[StatusBarDate]->Text = S; //StatusBar->Panels->Items[StatusBarDate]->Text = DateTimeToStr(Now()); if (MainImageForm) MainImageForm->Timer1000ms(); #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC if (ProtectCard->isHacking) Application->Terminate(); #endif #endif } //---------------------------------------------------------------------------- void __fastcall TMainForm::AutosaveTimerTimer(TObject *Sender) { if (MainImageForm && bAutoSave) { MainImageForm->TimerAutoSave(); } } //--------------------------------------------------------------------------- void __fastcall TMainForm::UpdateMenuItems(TObject *Sender) { if (bFirst==0) return; UpdateTools(Sender); FResizeCanvasItem->Enabled = MDIChildCount > 0; FEnlargeCanvasItem->Enabled = MDIChildCount > 0; FCloseItem->Enabled = MDIChildCount > 0; // FCloseAllItem->Enabled = MDIChildCount > 0; FPrintingItem->Enabled = MDIChildCount > 0; EditItem->Enabled = MDIChildCount > 0; CaptureItem->Enabled = false; ImageItem->Enabled = false; COverwriteItem->Enabled = false; CInsertItem->Enabled = false; if (MainImageForm) { if (MainImageForm->iMainImage) { if (MainImageForm->iMainImage->Bitmap->BitsPerPixel==24) { CaptureItem->Enabled = true; ImageItem->Enabled = true; } } if (MainImageForm->WorkArea) { if (MainImageForm->WorkArea->Mask) { COverwriteItem->Enabled = true; CInsertItem->Enabled = true; } } } #ifndef ACADEMY if (CaptureData) { CEditItem->Enabled = CaptureData->Count>0; CDeleteAllItem->Enabled = CaptureData->Count>0; } #else CEditItem->Enabled = false; #endif ViewItem->Enabled = MDIChildCount > 0; VPenItem->Checked = PenManagerForm->Visible; VFullViewItem->Checked = FullViewForm->Visible; VPaletteItem->Checked = PaletteForm->Visible; VMainMenuItem->Checked = MainMenuForm->Visible; #ifndef ACADEMY VLayerItem->Checked = LayerForm->Visible; VLayerItem->Enabled = MDIChildCount > 0; #endif VStatusBarItem->Checked = StatusBar->Visible; VToolsRearrangeItem->Enabled = MDIChildCount > 0; WCascadeItem->Enabled = MDIChildCount > 0; WTileItem->Enabled = MDIChildCount > 0; WArrangeItem->Enabled = MDIChildCount > 0; WMinimizeItem->Enabled = MDIChildCount > 0; #ifdef ACADEMY FNewCanvasFullItem->Enabled = false; FScannerSetupItem->Enabled = false; FScanningItem->Enabled = false; #else FNewCanvasFullItem->Enabled = true; FScannerSetupItem->Enabled = true; FScanningItem->Enabled = true; #endif Timer50ms->Enabled = MDIChildCount > 0; Timer200ms->Enabled = MDIChildCount > 0; Timer1000ms->Enabled = MDIChildCount > 0; PenManagerForm->Enabled = MDIChildCount > 0; FullViewForm->Enabled = MDIChildCount > 0; PaletteForm->Enabled = MDIChildCount > 0; MainMenuForm->Enabled = MDIChildCount > 0; #ifndef ACADEMY LayerForm->Enabled = MDIChildCount > 0; #endif } //--------------------------------------------------------------------- // Private Function //--------------------------------------------------------------------- void TMainForm::WTPacket(TMessage &msg) { WTPKT Result = Tablet->WTMPacket(msg); // StatusBar->Panels->Items[StatusBarHint]->Text = Format("%d x %d", // OPENARRAY(TVarRec, ((int)Tablet->MaxNPressure, (int)Tablet->prsNew))); if (Result&PK_CURSOR) PenManagerForm->Pen->Cursor = Tablet->curNew; } //--------------------------------------------------------------------- void __fastcall TMainForm::ApplicationActivate(TObject *Sender) { TMainImageForm *mif = (TMainImageForm *)ActiveMDIChild; if (Tablet) Tablet->Activate(); if (mif) mif->FormActivate(mif); } //--------------------------------------------------------------------- void __fastcall TMainForm::ShowHint(TObject *Sender) { Application->HintPause = 100; StatusBar->Panels->Items[StatusBarHint]->Text = Application->Hint; } //--------------------------------------------------------------------------- void __fastcall TMainForm::ToolsRearrange() { PenFormPos = Point(ClientWidth-PenManagerForm->Width-2, 2); FullViewFormPos = Point(ClientWidth-FullViewForm->Width-2, PenFormPos.y+PenManagerForm->Height+1); PaletteFormPos = Point(ClientWidth-PaletteForm->Width-2, FullViewFormPos.y+FullViewForm->Height+1); MainMenuFormPos = Point(ClientWidth-MainMenuForm->Width-2, PaletteFormPos.y+PaletteForm->Height+1); #ifndef ACADEMY LayerFormPos = Point(ClientWidth-LayerForm->Width-2, MainMenuFormPos.y+MainMenuForm->Height+1); #endif PenManagerForm->Left = PenFormPos.x; PenManagerForm->Top = PenFormPos.y; FullViewForm->Left = FullViewFormPos.x; FullViewForm->Top = FullViewFormPos.y; PaletteForm->Left = PaletteFormPos.x; PaletteForm->Top = PaletteFormPos.y; MainMenuForm->Left = MainMenuFormPos.x; MainMenuForm->Top = MainMenuFormPos.y; #ifndef ACADEMY LayerForm->Left = LayerFormPos.x; LayerForm->Top = LayerFormPos.y; #endif } //--------------------------------------------------------------------- TPException __fastcall TMainForm::FMOnRead(TFMReadParameter rp) { TCursor cur; TMainImageForm *Child = NULL; TPException ec = EC_NONE; cur = Screen->Cursor; Screen->Cursor = crHourGlass; MainMenuForm->ExitForm(1); if (MainImageForm) MainImageForm->iMainImage->Deactivate(); if ((Child = new TMainImageForm(Application))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } if ((ec = Child->InitFormFile(rp.DirName, rp.FileName, rp.ExtIndex, rp.bpp)) != EC_NONE) goto fail; Screen->Cursor = cur; return EC_NONE; fail: if (Child) delete Child; Screen->Cursor = cur; return ec; } //--------------------------------------------------------------------- bool __fastcall TMainForm::FMOnMerge(AnsiString FileName, TGraphicFileFormat ExtIndex) { #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif return MainImageForm->InitMerge(FileName, ExtIndex); } //--------------------------------------------------------------------- AnsiString __fastcall TMainForm::FMOnFileName(AnsiString FileName, TGraphicFileFormat ExtIndex) { char *s; AnsiString fn; s = AnsiStrScan(FileName.c_str(), '.'); if (s==NULL) { #ifdef ACADEMY switch (ExtIndex) { case gffTEX: fn = FileName+".tex"; break; case gffBMP: fn = FileName+".bmp"; break; case gffTIF: fn = FileName+".tif"; break; } #else switch (ExtIndex) { case gffTEX: fn = FileName+".tex"; break; case gffTFC: fn = FileName+".tfc"; break; #ifndef N_3D case gffT3D: if(T3D_Item) fn = FileName+".t3d"; break; #endif case gffWEA: fn = FileName+".wea"; break; case gffWAV: fn = FileName+".wav"; break; case gffKNT: fn = FileName+".knt"; break; case gffBMP: fn = FileName+".bmp"; break; case gffJPG: fn = FileName+".jpg"; break; case gffPCT: fn = FileName+".pct"; break; case gffPCX: fn = FileName+".pcx"; break; case gffPNG: fn = FileName+".png"; break; case gffPSD: fn = FileName+".psd"; break; case gffRAS: fn = FileName+".ras"; break; case gffTGA: fn = FileName+".tga"; break; case gffTIF: fn = FileName+".tif"; break; case gffEPS: fn = FileName+".eps"; break; } #endif return fn; } else { return FileName; } } //--------------------------------------------------------------------- TPException __fastcall TMainForm::FMOnSave(AnsiString DirName, AnsiString FileName, TGraphicFileFormat ExtIndex, TCompressMethod cm) { #ifndef LOCK_CRYPKEY #ifndef LOCK_IFC ProtectCard->Check(); #endif #endif return MainImageForm->SaveToFile(DirName, FileName, ExtIndex, cm); } //--------------------------------------------------------------------------- void __fastcall TMainForm::OpenFile(AnsiString DirName, AnsiString FileName, int Index, WORD bpp) { TCursor cur; TMainImageForm *Child = NULL; TPException ec = EC_NONE; MainMenuForm->ExitForm(1); cur = Screen->Cursor; Screen->Cursor = crHourGlass; if ((Child = new TMainImageForm(Application))==NULL) { ec = EC_FORM_NOT_CREATE; goto fail; } if ((ec = Child->InitFormFile(DirName, FileName, Index, bpp))!=EC_NONE) goto fail; Screen->Cursor = cur; return; fail: if (Child) delete Child; Screen->Cursor = cur; EXCEPTION_MESSAGE_OK(ec); } //--------------------------------------------------------------------- // Public Function //--------------------------------------------------------------------------- void __fastcall TMainForm::UpdateTools(TObject *Sender) { MainImageForm = (TMainImageForm *)ActiveMDIChild; //=============================================== for Auto Repeat by kjs if (MainImageForm) { // source code if (MainImageForm->AutoRepeat) MainMenuForm->AutoRepUpdateItem(); else MainMenuForm->UpdateItem(); // MainMenuForm->ARExitForm(false); RepaintColor(); } else { PaletteForm->InitForm(NULL); } //================================================ /* if (MainImageForm) { // source code MainMenuForm->UpdateItem(); RepaintColor(); // FullViewForm->InitForm(MainImageForm->iMainImage->Bitmap); // PenManagerForm->FormChange(MainImageForm->Palette); } */ } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormKeyUp(TObject *Sender, WORD &Key, TShiftState Shift) { MainMenuForm->iMainImageKeyUp(MainImageForm, Key); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormKeyPress(TObject *Sender, char &Key) { #ifndef ACADEMY bool NotWork = false; //qe TexWork°¡ ¿­·ÁÀÖÁö ¾Ê°Å³ª Minimized µÇ¾úÀ»¶§¸¸ A,S ´ÜÃàŰ ½ÇÇàµÇµµ·Ï if(TexWork){ if(TexWork->WindowState == wsMinimized){ NotWork = true; }else { NotWork = false; } }else { NotWork = true; } if((Key == 65 || Key == 97 || Key == 83 || Key == 115)&& NotWork) MainImageForm->iMainImageKeyDown(Key); //È®´ëÃà¼Ò ´ÜÃàŰ·Î #else if(Key == 65 || Key == 97 || Key == 83 || Key == 115) MainImageForm->iMainImageKeyDown(Key); //È®´ëÃà¼Ò ´ÜÃàŰ·Î #endif MainMenuForm->iMainImageKeyPress(MainImageForm, Key); //MainImageForm->sbVert->SetFocus(); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { MainMenuForm->iMainImageKeyDown(MainImageForm, Key); } //--------------------------------------------------------------------------- void __fastcall TMainForm::education(AnsiString str) { AnsiString screencam, cam, camdir; TRegistry *Registry; SHELLEXECUTEINFO screeninfo; Registry = new TRegistry; if (!Registry) return; Registry->RootKey = HKEY_CURRENT_USER; Registry->OpenKey("SOFTWARE\\Youngwoo\\TexPro\\7.2\\Directory",TRUE); screencam = Registry->ReadString("screencam"); delete Registry; memset(&screeninfo,0,sizeof(screeninfo)); screeninfo.cbSize = sizeof(screeninfo); screeninfo.lpVerb = "open"; screeninfo.lpDirectory = screencam.c_str(); screeninfo.lpFile = "scplayer.exe"; cam = screencam + "\\textile\\" + str; 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; } } void __fastcall TMainForm::educationknit(AnsiString str) { AnsiString screencam, cam, camdir; TRegistry *Registry; SHELLEXECUTEINFO screeninfo; Registry = new TRegistry; if (!Registry) return; Registry->RootKey = HKEY_CURRENT_USER; Registry->OpenKey("SOFTWARE\\Youngwoo\\TexPro\\7.2\\Directory",TRUE); screencam = Registry->ReadString("screencam"); delete Registry; memset(&screeninfo,0,sizeof(screeninfo)); screeninfo.cbSize = sizeof(screeninfo); screeninfo.lpVerb = "open"; screeninfo.lpDirectory = screencam.c_str(); screeninfo.lpFile = "scplayer.exe"; cam = screencam + "\\knit\\" + str; 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; } } void __fastcall TMainForm::educationweave(AnsiString str) { AnsiString screencam, cam, camdir; TRegistry *Registry; SHELLEXECUTEINFO screeninfo; Registry = new TRegistry; if (!Registry) return; Registry->RootKey = HKEY_CURRENT_USER; Registry->OpenKey("SOFTWARE\\Youngwoo\\TexPro\\7.2\\Directory",TRUE); screencam = Registry->ReadString("screencam"); delete Registry; memset(&screeninfo,0,sizeof(screeninfo)); screeninfo.cbSize = sizeof(screeninfo); screeninfo.lpVerb = "open"; screeninfo.lpDirectory = screencam.c_str(); screeninfo.lpFile = "scplayer.exe"; cam = screencam + "\\weave\\" + str; 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; } } void __fastcall TMainForm::N8Click(TObject *Sender) { AnsiString filename; filename = "start1.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::sub1Click(TObject *Sender) { AnsiString filename; filename = "pen1.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N10Click(TObject *Sender) { AnsiString filename; filename = "pen2.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N11Click(TObject *Sender) { AnsiString filename; filename = "pen3.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N12Click(TObject *Sender) { AnsiString filename; filename = "pen4.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N13Click(TObject *Sender) { AnsiString filename; filename = "pen5.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N14Click(TObject *Sender) { AnsiString filename; filename = "color_selection.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N16Click(TObject *Sender) { AnsiString filename; filename = "view1.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N17Click(TObject *Sender) { AnsiString filename; filename = "view2.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N19Click(TObject *Sender) { AnsiString filename; filename = "palette.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::CMY1Click(TObject *Sender) { AnsiString filename; filename = "cmy.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::HLS1Click(TObject *Sender) { AnsiString filename; filename = "HLS.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N20Click(TObject *Sender) { AnsiString filename; filename = "color_library.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N21Click(TObject *Sender) { AnsiString filename; filename = "color_file.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N22Click(TObject *Sender) { AnsiString filename; filename = "color_chart.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N23Click(TObject *Sender) { AnsiString filename; filename = "protection.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N24Click(TObject *Sender) { AnsiString filename; filename = "color_undo.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N26Click(TObject *Sender) { AnsiString filename; filename = "menu.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N27Click(TObject *Sender) { AnsiString filename; filename = "selection.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N28Click(TObject *Sender) { AnsiString filename; filename = "copy_move.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N29Click(TObject *Sender) { AnsiString filename; filename = "color_change.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N30Click(TObject *Sender) { AnsiString filename; filename = "clear.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N31Click(TObject *Sender) { AnsiString filename; filename = "color_group.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N32Click(TObject *Sender) { AnsiString filename; filename = "repeat.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N33Click(TObject *Sender) { AnsiString filename; filename = "drawing.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N34Click(TObject *Sender) { AnsiString filename; filename = "reproportion.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N35Click(TObject *Sender) { AnsiString filename; filename = "fill.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N36Click(TObject *Sender) { AnsiString filename; filename = "spread_fill.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N37Click(TObject *Sender) { AnsiString filename; filename = "stipple.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N38Click(TObject *Sender) { AnsiString filename; filename = "style.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N39Click(TObject *Sender) { AnsiString filename; filename = "pattern_repeat.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N40Click(TObject *Sender) { AnsiString filename; filename = "stripe.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N41Click(TObject *Sender) { AnsiString filename; filename = "color_separate.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N42Click(TObject *Sender) { AnsiString filename; filename = "stitch.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N43Click(TObject *Sender) { AnsiString filename; filename = "text.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N44Click(TObject *Sender) { AnsiString filename; filename = "color_combo.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N45Click(TObject *Sender) { AnsiString filename; filename = "smooth.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N46Click(TObject *Sender) { AnsiString filename; filename = "scratch.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N47Click(TObject *Sender) { AnsiString filename; filename = "jacquard.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N48Click(TObject *Sender) { AnsiString filename; filename = "file.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N49Click(TObject *Sender) { AnsiString filename; filename = "printer.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N50Click(TObject *Sender) { AnsiString filename; filename = "scanner.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N51Click(TObject *Sender) { AnsiString filename; filename = "undo.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N52Click(TObject *Sender) { AnsiString filename; filename = "shadow.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N53Click(TObject *Sender) { AnsiString filename; filename = "layer.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Top2Click(TObject *Sender) { AnsiString filename; filename = "TOP.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N77Click(TObject *Sender) { AnsiString filename; filename = "Tfile.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N78Click(TObject *Sender) { AnsiString filename; filename = "Tedit.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N79Click(TObject *Sender) { AnsiString filename; filename = "Tview.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N80Click(TObject *Sender) { AnsiString filename; filename = "Twindow.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N81Click(TObject *Sender) { AnsiString filename; filename = "Thelp.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N55Click(TObject *Sender) { AnsiString filename; filename = "yarn_making1.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N6Click(TObject *Sender) { AnsiString filename; filename = "all_textile1.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N82Click(TObject *Sender) { AnsiString filename; filename = "all_weave1.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::II1Click(TObject *Sender) { AnsiString filename; filename = "yarn_making2.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::III1Click(TObject *Sender) { AnsiString filename; filename = "yarn_making3.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N56Click(TObject *Sender) { AnsiString filename; filename = "yarn_scan.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N58Click(TObject *Sender) { AnsiString filename; filename = "setting.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N59Click(TObject *Sender) { AnsiString filename; filename = "sketch.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N60Click(TObject *Sender) { AnsiString filename; filename = "selection(weave).scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N61Click(TObject *Sender) { AnsiString filename; filename = "preview(weave).scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N62Click(TObject *Sender) { AnsiString filename; filename = "rotate(weave).scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N64Click(TObject *Sender) { AnsiString filename; filename = "yarn_table.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N65Click(TObject *Sender) { AnsiString filename; filename = "yarn_dye.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N66Click(TObject *Sender) { AnsiString filename; filename = "yarn_arrange.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N67Click(TObject *Sender) { AnsiString filename; filename = "texture_table.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N68Click(TObject *Sender) { AnsiString filename; filename = "texture_selection.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N69Click(TObject *Sender) { AnsiString filename; filename = "weaving.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N70Click(TObject *Sender) { AnsiString filename; filename = "printer(weave).scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N71Click(TObject *Sender) { AnsiString filename; filename = "yarn_brightness.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N72Click(TObject *Sender) { AnsiString filename; filename = "weaving_window_file(weave).scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N83Click(TObject *Sender) { AnsiString filename; filename = "all_knit.scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N73Click(TObject *Sender) { AnsiString filename; filename = "window(knit).scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N74Click(TObject *Sender) { AnsiString filename; filename = "copymove(knit).scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::knit2Click(TObject *Sender) { AnsiString filename; filename = "clear(knit).scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::knit3Click(TObject *Sender) { AnsiString filename; filename = "repeat(knit).scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::knit4Click(TObject *Sender) { AnsiString filename; filename = "drawing(knit).scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Markchartform1Click(TObject *Sender) { AnsiString filename; filename = "markchartform.scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Mark1Click(TObject *Sender) { AnsiString filename; filename = "mark_fill.scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N75Click(TObject *Sender) { AnsiString filename; filename = "resize_canvas.scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::knittingform1Click(TObject *Sender) { AnsiString filename; filename = "knitting.scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N76Click(TObject *Sender) { AnsiString filename; filename = "printer(knit).scm"; educationknit(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Textile21Click(TObject *Sender) { AnsiString filename; filename = "all_textile2.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Textile31Click(TObject *Sender) { AnsiString filename; filename = "all_textile3.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Textile41Click(TObject *Sender) { AnsiString filename; filename = "all_textile4.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Textile51Click(TObject *Sender) { AnsiString filename; filename = "all_textile5.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::Weave21Click(TObject *Sender) { AnsiString filename; filename = "all_weave2.scm"; educationweave(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::N84Click(TObject *Sender) { AnsiString filename; filename = "after_make.scm"; education(filename); } //--------------------------------------------------------------------------- void __fastcall TMainForm::FormCloseQuery(TObject *Sender, bool &CanClose) { if (TexWork){ if (TexWork->Modify ){ AnsiString msg; if(TexWork->OpenDialog1->FileName!= "")msg = TexWork->OpenDialog1->FileName; else msg = "Noname.fst"; int Btn = MessageDlg(IDS_MESSAGE_SAVECHANGE + " " + msg, mtWarning, TMsgDlgButtons()<tbSaveClick(this); } TexWork->Modify = false; } TexWork->FormCloseQuery(this,true); } } //---------------------------------------------------------------------------