#include "alg.h" #include "mylib.h" #include "mnemo.h" #include "alg_cfg.h" #include "demohelp.h" #ifdef __DOS32__ #include #endif extern "C" short ScreenMode; extern "C" void SetVideoMode (short Mode); extern "C" void setlinestyle (word_s linestyle,word_s thickness); extern "C" void ch_color(int x,int y, int color); extern "C" void CDECL fgtext(word_s c,word_s x,word_s y,char *fmt, ...); extern "C" void DelShrift(); extern "C" int LoadShrift(char *name); extern "C" void loadpcxlib(char *flpcl); extern "C" void unloadpcxlib(); extern "C" word_s pcxDisplayLib(char *flpcx,word x_video,word y_video, word xv); char *color[]= {"Black", "Blue", "Green", "Cyan", "Red", "Magenta", "Brown", "L Gray", "Gray", "L Blue", "L Green", "L Cyan", "L Red", "L Magenta", "Yellow", "White" }; TMshDialog::TMshDialog( ) : TDialog( TRect( 0, 0, 65, 22 ),""), TWindowInit( TMshDialog::initFrame ) { char str[256],*str1; int i; getcwd(PathDir,sizeof(PathDir)); sprintf(str,Text_msg[32],PathDir); title=newStr(str); options |= ofCentered; CollorColect = new TCompCollect(10,10); for(i=0;i<16;i++)CollorColect->insert(color[i]); TipDinColect = new TCompCollect(10,10); TipDinColect->insert((char *)"Отключен"); TipDinColect->insert((char *)"% заполнения"); TipDinColect->insert((char *)"Полож. клапана"); TipDinColect->insert((char *)"Стандартный"); TipDinColect->insert((char *)"Диаграмма по X"); TipDinColect->insert((char *)"Диаграмма по Y"); TipDinColect->insert((char *)"Текст в дин."); TipDinColect->insert((char *)"Знач. параметра"); TipDinColect->insert((char *)"Двиг. мешалка"); TipDinColect->insert((char *)"Прогр. бар X"); TipDinColect->insert((char *)"Прогр. бар Y"); TView *Monosel = new TView(TRect(2,2,12,18)); Monosel->options |= ofFramed; insert(Monosel); Monosel = new TView(TRect(14,2,55,9)); Monosel->options |= ofFramed; insert(Monosel); Monosel = new TView(TRect(14,10,63,18)); Monosel->options |= ofFramed; insert(Monosel); myApp->LoadMsh(PathDir,&DomColect); ScrollBar1 = new TScrollBar( TRect( 11, 2, 12, 18) ); insert(ScrollBar1); MyTListBox1 = new TMyTListBox(TRect( 2, 2, 11, 18), 1, ScrollBar1,NULL); insert(MyTListBox1); MyTListBox1->helpCtx=hcMnem; MyTListBox1->newList(DomColect); TMyLabel *Label = new TMyLabel(TRect(2, 1, 12, 2),"~M~немосхемы",MyTListBox1,1); insert(Label); ScrollBar3 = new TScrollBar( TRect( 25, 2, 26, 9) ); insert(ScrollBar3); MyTListBox3 = new TMyTListBox(TRect( 14,2, 25, 9), 1, ScrollBar3,NULL); MyTListBox3->helpCtx=hcMax; insert(MyTListBox3); Label = new TMyLabel(TRect(16, 1, 24, 2), "~C~татика",MyTListBox3,1); insert(Label); ScrollBar2 = new TScrollBar( TRect( 25, 10, 26, 18) ); insert(ScrollBar2); MyTListBox2 = new TMyTListBox(TRect( 14,10, 25, 18), 1, ScrollBar2,NULL); MyTListBox2->helpCtx=hcDin; insert(MyTListBox2); Label = new TMyLabel(TRect(16, 9, 24, 10), "~D~инамика",MyTListBox2,1); insert(Label); Edit_x = new TEdit( TRect(38, 2, 41, 3),4,EnterNumber); insert(Edit_x); Edit_x1 = new TEdit( TRect(42, 2, 45, 3),4,EnterNumber); insert(Edit_x1); Label_x = new TMyLabel(TRect(28, 2, 38, 3), "x =",Edit_x,0); insert(Label_x); Edit_y = new TEdit( TRect(38, 3, 41, 4),4,EnterNumber); insert(Edit_y); Edit_y1 = new TEdit( TRect(42, 3, 45, 4),4,EnterNumber); insert(Edit_y1); Label_y = new TMyLabel(TRect(28, 3, 38, 4), "y =",Edit_y,0); insert(Label_y); Edit_PCX = new TEdit( TRect(38, 4, 50, 5),13,SelectInput); insert(Edit_PCX); Label_PCX = new TMyLabel(TRect(28, 4, 38, 5), "Рисунок:",Edit_PCX,0); insert(Label_PCX); Edit_txt = new TEdit( TRect(38, 4, 52, 5),15,NULL); insert(Edit_txt); Label_txt = new TMyLabel(TRect(28, 4, 38, 5), "Текст:",Edit_txt,0); insert(Label_txt); Edit_color = new TEdit( TRect(38, 4, 48, 5),11,NoEdit); insert(Edit_color); Label_color = new TMyLabel(TRect(28, 4, 38, 5), "Цвет фона:",Edit_color,0); insert(Label_color); Collor_Cb = new TComboBox(TRect(48, 4, 49, 5), Edit_color,CollorColect,SelectFormuls); insert(Collor_Cb); Tipdin_Ed = new TEdit( TRect(47, 10, 62, 11),16,NoEdit); insert(Tipdin_Ed); Tipdin_Lb = new TMyLabel(TRect(28, 10, 47, 11), "~T~ип динамики:",Tipdin_Ed,0); insert(Tipdin_Lb); Tipdin_Cb = new TComboBox(TRect(62, 10, 63, 11), Tipdin_Ed,TipDinColect,SelectFormuls); insert(Tipdin_Cb); CheckBoxes1 = new TMyCheckBoxes( TRect( 28, 11, 47, 12),new TSItem( "~Ш~ифр (x y)",0),NULL); CheckBoxes1->press(0); insert(CheckBoxes1); CheckBoxes2 = new TMyCheckBoxes( TRect( 28, 12, 47, 13),new TSItem( "~З~начение (x y)",0),NULL); CheckBoxes2->press(0); insert(CheckBoxes2); CheckBoxes3 = new TMyCheckBoxes( TRect( 28, 13, 47, 14),new TSItem( "~У~правл. (x y)",0),NULL); CheckBoxes3->press(0); insert(CheckBoxes3); CheckBoxes4 = new TMyCheckBoxes( TRect( 28, 14, 47, 15),new TSItem( "~О~краш. (x y)",0),NULL); CheckBoxes4->press(0); insert(CheckBoxes4); Ed_krd_srX = new TEdit( TRect(47, 11, 51, 12),5,EnterNumber); insert(Ed_krd_srX); Ed_krd_srY = new TEdit( TRect(52, 11, 56, 12),5,EnterNumber); insert(Ed_krd_srY); Ed_krd_znX = new TEdit( TRect(47, 12, 51, 13),5,EnterNumber); insert(Ed_krd_znX); Ed_krd_znY = new TEdit( TRect(52, 12, 56, 13),5,EnterNumber); insert(Ed_krd_znY); Ed_krd_curX = new TEdit( TRect(47, 13, 51, 14),5,EnterNumber); insert(Ed_krd_curX); Ed_krd_curY = new TEdit( TRect(52, 13, 56, 14),5,EnterNumber); insert(Ed_krd_curY); Ed_krd_Xmin = new TEdit( TRect(47, 14, 51, 15),4,EnterNumber); insert(Ed_krd_Xmin); Lb_krd_Xmin = new TMyLabel(TRect(28,14,47,15),"Min. границы (x y):",Ed_krd_Xmin,1); insert(Lb_krd_Xmin); Ed_krd_Ymin = new TEdit( TRect(52, 14, 56, 15),4,EnterNumber); insert(Ed_krd_Ymin); Ed_krd_Xmax = new TEdit( TRect(47, 15, 51, 16),4,EnterNumber); insert(Ed_krd_Xmax); Lb_krd_Xmax = new TMyLabel(TRect(28,15,47,16),"Max. границы (x y):",Ed_krd_Xmax,1); insert(Lb_krd_Xmax); Ed_krd_Ymax = new TEdit( TRect(52, 15, 56, 16),4,EnterNumber); insert(Ed_krd_Ymax); Edit_col_C = new TEdit( TRect(47, 16, 57, 17),11,NoEdit); insert(Edit_col_C); Label_col_C = new TMyLabel(TRect(28, 16, 47, 17), "Цвет кисти:",Edit_col_C,0); insert(Label_col_C); Collor_Cb_C = new TComboBox(TRect(57, 16, 58, 17), Edit_col_C,CollorColect,SelectFormuls); insert(Collor_Cb_C); Edit_col_O = new TEdit( TRect(47, 17, 57, 18),11,NoEdit); insert(Edit_col_O); Label_col_O = new TMyLabel(TRect(28, 17, 47, 18), "Цвет фона:",Edit_col_O,0); insert(Label_col_O); Collor_Cb_O = new TComboBox(TRect(57, 17, 58, 18), Edit_col_O,CollorColect,SelectFormuls); insert(Collor_Cb_O); // Edit11 = new TEdit( TRect(47, 16, 51, 17),4,NULL); insert(Edit11); // Label = new TMyLabel(TRect(28,16,47,17),"Тип динамики:",Edit11,0); insert(Label); // Edit12 = new TEdit( TRect(47, 17, 51, 18),4,NULL); insert(Edit12); TButton *Button = new TButton( TRect( 40,19, 50, 21),Text_msg[115], cmOK, bfDefault ); insert(Button); Button = new TButton( TRect( 52,19, 62, 21),Text_msg[114], cmCancel, bfNormal ); insert(Button); OldIndChek1=0; OldIndChek2=0; OldIndChek3=0; if(DomColect->getCount()) { MyTListBox2->newList((TCompCollect *)((domineed *)(DomColect->at(0)))->din,0); MyTListBox3->newList((TCompCollect *)((domineed *)(DomColect->at(0)))->stat,0); } ViewMnemDin(); ViewMnemSt(); Modifs=Modif=False; MyTListBox1->select(); } TMshDialog::~TMshDialog() { delete TipDinColect; delete CollorColect; myApp->FreeMsh(DomColect); } void TMshDialog::handleEvent ( TEvent& event ) { char str[256],str1[10],*str2,*str3; int control,i,k1; domineed *p_domineed; TCompCollect *AlgCol,*TempColect; dinamika *p_din; statikaed *stat; if( event.what == evCommand && event.message.command == cmClose) { if(Modif || Modifs) { control = messageBox(Text_msg[26],mfWarning | mfOKCancel); if(control==cmOK) { if(Modif) SaveChengeMn(); myApp->SaveMnHdd(PathDir,DomColect); } } } TDialog::handleEvent(event); #ifdef __DOS32__ if( event.what == evBroadcast && event.message.command == cmGetBuf) Modif=True; #endif if( event.what == evBroadcast && event.message.command == cmScrollBarChanged) //List ListBox { if(MyTListBox1->state & sfFocused) // ListBox1 { #ifdef __DOS32__ if(getShiftState() & (kbLeftShift|kbRightShift)) { str2=(char *)MyTListBox1->list()->at(OldIndChek1); str3=(char *)MyTListBox1->list()->at(MyTListBox1->focused); MyTListBox1->list()->atRemove(OldIndChek1); MyTListBox1->list()->atInsert(OldIndChek1,str3); MyTListBox1->list()->atRemove(MyTListBox1->focused); MyTListBox1->list()->atInsert(MyTListBox1->focused,str2); MyTListBox1->drawView(); Modifs=True; } #endif MyTListBox2->newList((TCompCollect *)((domineed *)(DomColect->at(MyTListBox1->focused)))->din,0); MyTListBox3->newList((TCompCollect *)((domineed *)(DomColect->at(MyTListBox1->focused)))->stat,0); ViewMnemDin(); ViewMnemSt(); OldIndChek1=MyTListBox1->focused; } if(MyTListBox2->state & sfFocused) // ListBox2 { #ifdef __DOS32__ if(getShiftState() & (kbLeftShift|kbRightShift)) { str2=(char *)MyTListBox2->list()->at(OldIndChek2); str3=(char *)MyTListBox2->list()->at(MyTListBox2->focused); MyTListBox2->list()->atRemove(OldIndChek2); MyTListBox2->list()->atInsert(OldIndChek2,str3); MyTListBox2->list()->atRemove(MyTListBox2->focused); MyTListBox2->list()->atInsert(MyTListBox2->focused,str2); MyTListBox2->drawView(); Modifs=True; } #endif ViewMnemDin(); OldIndChek2=MyTListBox2->focused; } if(MyTListBox3->state & sfFocused) // ListBox3 { #ifdef __DOS32__ if(getShiftState() & (kbLeftShift|kbRightShift)) { str2=(char *)MyTListBox3->list()->at(OldIndChek3); str3=(char *)MyTListBox3->list()->at(MyTListBox3->focused); MyTListBox3->list()->atRemove(OldIndChek3); MyTListBox3->list()->atInsert(OldIndChek3,str3); MyTListBox3->list()->atRemove(MyTListBox3->focused); MyTListBox3->list()->atInsert(MyTListBox3->focused,str2); MyTListBox3->drawView(); Modifs=True; } #endif ViewMnemSt(); OldIndChek3=MyTListBox3->focused; } clearEvent(event); } if( event.what == evBroadcast && event.message.command == cmClustChange) if(CheckBoxes1->state & sfFocused || CheckBoxes2->state & sfFocused || CheckBoxes3->state & sfFocused || CheckBoxes4->state & sfFocused) {SaveChengeMn(); ViewMnemDin(); } if( event.what == evCommand ) switch( event.message.command ) { #ifdef __DOS32__ case cmRes1: ViewMnem(MyTListBox1->focused,0); break; case cmRes2: if(!MyTListBox2->list()->getCount()) break; TempColect = new TCompCollect(10,10); p_din = (dinamika *)MyTListBox2->list()->at(MyTListBox2->focused); i=0; if(p_din->PR_SIFR&&Ed_krd_srX->getState( sfVisible )) { TempColect->insert("Шифр"); str[i++]=1; } if(p_din->PR_ZN&&Ed_krd_znX->getState( sfVisible )) { TempColect->insert("Значение"); str[i++]=2; } if(p_din->PR_UP&&Ed_krd_curX->getState( sfVisible )) { TempColect->insert("Курсор"); str[i++]=3; } if(p_din->PR_OK&&p_din->FOR_DIN==8&&Ed_krd_Xmin->getState( sfVisible )) { TempColect->insert("Залив"); str[i++]=4; } if(p_din->FOR_DIN==1){TempColect->insert("% Заполн."); str[i++]=5; } if(p_din->FOR_DIN==4 || p_din->FOR_DIN==5) {TempColect->insert("Гистограма"); str[i++]=6; } if(p_din->FOR_DIN==9 || p_din->FOR_DIN==10) {TempColect->insert("Прогр. бар"); str[i++]=7; } if(i) { i=myApp->OperList(this,MyTListBox2,TempColect,0,12); if(i != -1) ViewMnem(MyTListBox1->focused,str[i]); Modif=True; } delete(TempColect); break; #endif case cmOK: SaveChengeMn(); Modifs=True; Modif=False; clearEvent(event); break; case cmCancel: ViewMnemDin(); ViewMnemSt(); Modif=False; clearEvent(event); break; case cmSave1: control = messageBox(mfWarning | mfOKCancel,Text_msg[37]); if(control!=cmOK) break; SaveChengeMn(); myApp->SaveMnHdd(PathDir,DomColect); Modif=Modifs=False; break; case cmReLoad: control = messageBox(mfWarning | mfOKCancel,Text_msg[38]); if(control!=cmOK) break; MyTListBox1->select(); //Без этого по непонятной причине вылетает если активен другой myApp->FreeMsh(DomColect); myApp->LoadMsh(PathDir,&DomColect); MyTListBox1->newList(DomColect,0); MyTListBox2->newList((TCompCollect *)((domineed *)(DomColect->at(OldIndChek1)))->din,0); MyTListBox3->newList((TCompCollect *)((domineed *)(DomColect->at(OldIndChek1)))->stat,0); MyTListBox1->focusItem(OldIndChek1=0); ViewMnemSt(); ViewMnemDin(); Modif=Modifs=False; break; case cmInsert: case cmAdd: case cmRename: if(MyTListBox1->state & sfFocused) // ListBox1 { str[0]=0; if(event.message.command==cmRename) strncpy(str,((domineed *)DomColect->at(MyTListBox1->focused))->IMJ,8); control = inputBox("Ввод имени", "Мнемосхема:",str, 9); if(control==cmOK) { for(i=0;igetCount();i++) { if(!strncmp(str,((domineed *)DomColect->at(i))->IMJ,8)){ i= -1; break;} } if(i== -1){ DispFixErr(0,Text_msg[15],str); break; } if(event.message.command==cmInsert || event.message.command==cmRename) k1 = MyTListBox1->focused; if(event.message.command==cmAdd) k1 = DomColect->getCount(); if(event.message.command==cmRename) { //Корекция в Signal strncpy(str1,((domineed *)DomColect->at(MyTListBox1->focused))->IMJ,8); myApp->ChekSignal(PathDir,str1,1,str); //***************** } else { p_domineed= new domineed; DomColect->atInsert(k1,p_domineed); AlgCol = new TCompCollect(10,10); ((domineed *)DomColect->at(k1))->din=AlgCol; AlgCol = new TCompCollect(10,10); ((domineed *)DomColect->at(k1))->stat=AlgCol; } strncpy(((domineed *)DomColect->at(k1))->IMJ,str,8); MyTListBox1->setRange( MyTListBox1->list()->getCount() ); MyTListBox1->drawView(); MyTListBox2->newList((TCompCollect *)((domineed *)(DomColect->at(MyTListBox1->focused)))->din,0); MyTListBox3->newList((TCompCollect *)((domineed *)(DomColect->at(MyTListBox1->focused)))->stat,0); ViewMnemSt(); ViewMnemDin(); Modifs=True; } } if(MyTListBox2->state & sfFocused) // ListBox1 { AlgCol=(TCompCollect *)((domineed *)DomColect->at(MyTListBox1->focused))->din; if(MyTListBox2->list()->getCount()) str2=((dinamika *)AlgCol->at(MyTListBox2->focused))->IMJ; else str2=Text_msg[49]; control = myApp->execView( myApp->SelDialog = new TSelDialog(PathDir,6,str2)); if(control==cmOK) { if(event.message.command==cmInsert || event.message.command==cmRename) k1 = MyTListBox2->focused; if(event.message.command==cmAdd) k1 = AlgCol->getCount(); if(event.message.command==cmRename); else { p_din= new dinamika; memset(p_din,0,sizeof(dinamika)); AlgCol->atInsert(k1,p_din); } strcpy(((dinamika *)AlgCol->at(k1))->IMJ,(char *)myApp->SelDialog->Colect2->at(myApp->SelDialog->ListBox2->focused)); ((dinamika *)AlgCol->at(k1))->P_E=myApp->SelDialog->tip; MyTListBox2->setRange( MyTListBox2->list()->getCount() ); MyTListBox2->drawView(); ViewMnemDin(); Modifs=True; } destroy(myApp->SelDialog); } if(MyTListBox3->state & sfFocused) // ListBox1 { AlgCol=(TCompCollect *)((domineed *)DomColect->at(MyTListBox1->focused))->stat; TempColect = new TCompCollect(10,10); TempColect->insert((char *)"Draw text"); TempColect->insert((char *)"View PCX"); TempColect->insert((char *)"FON"); i=myApp->OperList(this,MyTListBox3,TempColect,1,6); if(i != -1) { if(event.message.command==cmInsert || event.message.command==cmRename) k1 = MyTListBox3->focused; if(event.message.command==cmAdd) k1 = AlgCol->getCount(); if(event.message.command==cmRename); else { stat= new statikaed; memset(stat,0,sizeof(statikaed)); AlgCol->atInsert(k1,stat); } strcpy(((statikaed *)AlgCol->at(k1))->NameStat,(char *)TempColect->at(i)); if(i==0)((statikaed *)AlgCol->at(k1))->TIP=03; if(i==1)((statikaed *)AlgCol->at(k1))->TIP=13; if(i==2)((statikaed *)AlgCol->at(k1))->TIP=31; MyTListBox3->setRange( MyTListBox3->list()->getCount() ); MyTListBox3->drawView(); ViewMnemSt(); Modifs=True; } delete(TempColect); } break; case cmDelete: if(MyTListBox1->state & sfFocused) // ListBox1 if(DomColect->getCount()) { for(k1=0,i=0;igetCount();i++) if(DomColect->GetOptItem(i)) k1++; if(k1) control = messageBox(mfWarning | mfOKCancel,Text_msg[46],k1); else { control = messageBox(mfWarning | mfOKCancel,Text_msg[29],(char *)DomColect->at(MyTListBox1->focused)); if(control==cmOK) DomColect->SetOptItem(MyTListBox1->focused,1); } if(control==cmOK) { for(i=0;igetCount();i++) if(DomColect->GetOptItem(i)) { //Корекция в Signal strncpy(str1,((domineed *)DomColect->at(i))->IMJ,8); myApp->ChekSignal(PathDir,str1,1,NULL); //**************** DeleteMn(i); i--; } MyTListBox1->setRange( MyTListBox1->list()->getCount() ); MyTListBox1->drawView(); MyTListBox2->newList((TCompCollect *)((domineed *)(DomColect->at(MyTListBox1->focused)))->din,0); MyTListBox3->newList((TCompCollect *)((domineed *)(DomColect->at(MyTListBox1->focused)))->stat,0); ViewMnemSt(); ViewMnemDin(); Modifs=True; } } if(MyTListBox2->state & sfFocused) // ListBox1 { AlgCol=(TCompCollect *)((domineed *)DomColect->at(MyTListBox1->focused))->din; if(AlgCol->getCount()) { for(k1=0,i=0;igetCount();i++) if(AlgCol->GetOptItem(i)) k1++; if(k1) control = messageBox(mfWarning | mfOKCancel,Text_msg[46],k1); else { control = messageBox(mfWarning | mfOKCancel,Text_msg[29],(char *)AlgCol->at(MyTListBox2->focused)); if(control==cmOK) AlgCol->SetOptItem(MyTListBox2->focused,1); } if(control==cmOK) { for(i=0;igetCount();i++) if(AlgCol->GetOptItem(i)) {MyTListBox2->list()->atFree(i); i--;} MyTListBox2->setRange( MyTListBox2->list()->getCount() ); MyTListBox2->drawView(); ViewMnemDin(); Modifs=True; } } } if(MyTListBox3->state & sfFocused) // ListBox1 { AlgCol=(TCompCollect *)((domineed *)DomColect->at(MyTListBox1->focused))->stat; if(AlgCol->getCount()) { for(k1=0,i=0;igetCount();i++) if(AlgCol->GetOptItem(i)) k1++; if(k1) control = messageBox(mfWarning | mfOKCancel,Text_msg[46],k1); else { control = messageBox(mfWarning | mfOKCancel,Text_msg[29],(char *)AlgCol->at(MyTListBox3->focused)); if(control==cmOK) AlgCol->SetOptItem(MyTListBox2->focused,1); } if(control==cmOK) { for(i=0;igetCount();i++) if(AlgCol->GetOptItem(i)) {MyTListBox3->list()->atFree(i); i--;} MyTListBox3->setRange( MyTListBox3->list()->getCount() ); MyTListBox3->drawView(); ViewMnemSt(); Modifs=True; } } } break; default: ; } } void TMshDialog::ViewMnemSt() { statikaed *stat; char str[20]; word opt=0; TView *temp; temp=current; Edit_x->setState(sfVisible,False); Label_x->setState(sfVisible,False); Edit_x1->setState(sfVisible,False); Edit_y->setState(sfVisible,False); Label_y->setState(sfVisible,False); Edit_y1->setState(sfVisible,False); Edit_PCX->setState(sfVisible,False); Label_PCX->setState(sfVisible,False); Edit_txt->setState(sfVisible,False); Label_txt->setState(sfVisible,False); Edit_color->setState(sfVisible,False); Label_color->setState(sfVisible,False); Collor_Cb->setState(sfVisible,False); if(!MyTListBox1->list()->getCount()) return; if(!MyTListBox3->list()->getCount()) { temp->select(); return;} stat = (statikaed *)MyTListBox3->list()->at(MyTListBox3->focused); Edit_x->setState(sfVisible,True); Label_x->setState(sfVisible,True); Edit_y->setState(sfVisible,True); Label_y->setState(sfVisible,True); if(stat->TIP==03) //Текст { Edit_txt->setState(sfVisible,True); Label_txt->setState(sfVisible,True); Edit_txt->setData((char *)&stat->s4); sprintf(str,"%d",stat->s2); Edit_x->setData(str); sprintf(str,"%d",stat->s3); Edit_y->setData(str); } if(stat->TIP==13) //PCX { Edit_PCX->setState(sfVisible,True); Label_PCX->setState(sfVisible,True); Edit_PCX->setData((char *)&stat->s4); sprintf(str,"%d",stat->s2); Edit_x->setData(str); sprintf(str,"%d",stat->s3); Edit_y->setData(str); } if(stat->TIP==31) //Фон { Edit_color->setState(sfVisible,True); Label_color->setState(sfVisible,True); Collor_Cb->setState(sfVisible,True); Edit_x1->setState(sfVisible,True); Edit_y1->setState(sfVisible,True); Collor_Cb->posit=stat->s2; Edit_color->setData((char *)CollorColect->at(Collor_Cb->posit)); sprintf(str,"%d",stat->s3); Edit_x->setData(str); sprintf(str,"%d",stat->s4); Edit_y->setData(str); sprintf(str,"%d",stat->s5); Edit_x1->setData(str); sprintf(str,"%d",stat->s6); Edit_y1->setData(str); } temp->select(); } void TMshDialog::ViewMnemDin() { dinamika *din; char str[20]; word opt=0; TView *temp; temp=current; Tipdin_Ed->setState(sfVisible,False); Tipdin_Lb->setState(sfVisible,False); Tipdin_Cb->setState(sfVisible,False); CheckBoxes1->setState(sfVisible,False); CheckBoxes2->setState(sfVisible,False); CheckBoxes3->setState(sfVisible,False); CheckBoxes4->setState(sfVisible,False); Ed_krd_srX->setState(sfVisible,False); Ed_krd_srY->setState(sfVisible,False); Ed_krd_znX->setState(sfVisible,False); Ed_krd_znY->setState(sfVisible,False); Ed_krd_curX->setState(sfVisible,False); Ed_krd_curY->setState(sfVisible,False); Ed_krd_Xmin->setState(sfVisible,False); Ed_krd_Ymin->setState(sfVisible,False); Lb_krd_Xmin->setState(sfVisible,False); Ed_krd_Xmax->setState(sfVisible,False); Ed_krd_Ymax->setState(sfVisible,False); Lb_krd_Xmax->setState(sfVisible,False); Edit_col_C->setState(sfVisible,False); Edit_col_O->setState(sfVisible,False); Label_col_C->setState(sfVisible,False); Label_col_O->setState(sfVisible,False); Collor_Cb_C->setState(sfVisible,False); Collor_Cb_O->setState(sfVisible,False); if(!MyTListBox1->list()->getCount()) return; if(!MyTListBox2->list()->getCount()) {temp->select(); return;} din = (dinamika *)MyTListBox2->list()->at(MyTListBox2->focused); Tipdin_Ed->setState(sfVisible,True); Tipdin_Lb->setState(sfVisible,True); Tipdin_Cb->setState(sfVisible,True); Tipdin_Cb->posit=din->FOR_DIN; Tipdin_Ed->setData((char *)TipDinColect->at(Tipdin_Cb->posit)); if(!din->P_E&&(din->FOR_DIN==3||din->FOR_DIN==1||din->FOR_DIN==4||din->FOR_DIN==5 ||din->FOR_DIN==9||din->FOR_DIN==10)) { if(din->PR_SIFR) { opt=1; Ed_krd_srX->setState(sfVisible,True); Ed_krd_srY->setState(sfVisible,True); sprintf(str,"%d",din->X_SIFR); Ed_krd_srX->setData(str); sprintf(str,"%d",din->Y_SIFR); Ed_krd_srY->setData(str); } else opt=0; CheckBoxes1->setData(&opt); CheckBoxes1->setState(sfVisible,True); if(din->PR_ZN) { opt=1; Ed_krd_znX->setState(sfVisible,True); Ed_krd_znY->setState(sfVisible,True); sprintf(str,"%d",din->X_ZN); Ed_krd_znX->setData(str); sprintf(str,"%d",din->Y_ZN); Ed_krd_znY->setData(str); } else opt=0; CheckBoxes2->setData(&opt); CheckBoxes2->setState(sfVisible,True); if(din->PR_UP) { opt=1; Ed_krd_curX->setState(sfVisible,True); Ed_krd_curY->setState(sfVisible,True); sprintf(str,"%d",din->X_KUR); Ed_krd_curX->setData(str); sprintf(str,"%d",din->Y_KUR); Ed_krd_curY->setData(str); } else opt=0; CheckBoxes3->setData(&opt); CheckBoxes3->setState(sfVisible,True); if(din->FOR_DIN==1) { Lb_krd_Xmin->setState(sfVisible,True); Lb_krd_Xmax->setState(sfVisible,True); Ed_krd_Xmin->setState(sfVisible,True); Ed_krd_Ymin->setState(sfVisible,True); Ed_krd_Xmax->setState(sfVisible,True); Ed_krd_Ymax->setState(sfVisible,True); Edit_col_C->setState(sfVisible,True); Edit_col_O->setState(sfVisible,True); Label_col_C->setState(sfVisible,True); Label_col_O->setState(sfVisible,True); Collor_Cb_C->setState(sfVisible,True); Collor_Cb_O->setState(sfVisible,True); Collor_Cb_C->posit=din->C_ZAP; Collor_Cb_O->posit=din->O_ZAP; Edit_col_C->setData((char *)CollorColect->at(Collor_Cb_C->posit)); Edit_col_O->setData((char *)CollorColect->at(Collor_Cb_O->posit)); sprintf(str,"%d",din->X_MIN); Ed_krd_Xmin->setData(str); sprintf(str,"%d",din->Y_MIN); Ed_krd_Ymin->setData(str); sprintf(str,"%d",din->X_MAX); Ed_krd_Xmax->setData(str); sprintf(str,"%d",din->Y_MAX); Ed_krd_Ymax->setData(str); } if( din->FOR_DIN==4 || din->FOR_DIN==5) { Lb_krd_Xmin->setState(sfVisible,True); Lb_krd_Xmax->setState(sfVisible,True); Ed_krd_Xmin->setState(sfVisible,True); Ed_krd_Ymin->setState(sfVisible,True); Ed_krd_Xmax->setState(sfVisible,True); Ed_krd_Ymax->setState(sfVisible,True); sprintf(str,"%d",din->X_MIN); Ed_krd_Xmin->setData(str); sprintf(str,"%d",din->Y_MIN); Ed_krd_Ymin->setData(str); sprintf(str,"%d",din->X_MAX); Ed_krd_Xmax->setData(str); sprintf(str,"%d",din->Y_MAX); Ed_krd_Ymax->setData(str); } if( din->FOR_DIN==9 || din->FOR_DIN==10) { Lb_krd_Xmin->setState(sfVisible,True); Lb_krd_Xmax->setState(sfVisible,True); Ed_krd_Xmin->setState(sfVisible,True); Ed_krd_Ymin->setState(sfVisible,True); Ed_krd_Xmax->setState(sfVisible,True); Ed_krd_Ymax->setState(sfVisible,True); Edit_col_C->setState(sfVisible,True); Edit_col_O->setState(sfVisible,True); Label_col_C->setState(sfVisible,True); Label_col_O->setState(sfVisible,True); Collor_Cb_C->setState(sfVisible,True); Collor_Cb_O->setState(sfVisible,True); Collor_Cb_C->posit=din->C_ZAP; Collor_Cb_O->posit=din->O_ZAP; Edit_col_C->setData((char *)CollorColect->at(Collor_Cb_C->posit)); Edit_col_O->setData((char *)CollorColect->at(Collor_Cb_O->posit)); sprintf(str,"%d",din->X_MIN); Ed_krd_Xmin->setData(str); sprintf(str,"%d",din->Y_MIN); Ed_krd_Ymin->setData(str); sprintf(str,"%d",din->X_MAX); Ed_krd_Xmax->setData(str); sprintf(str,"%d",din->Y_MAX); Ed_krd_Ymax->setData(str); } // if(din->PR_OK) opt|=0x08;else opt&=0xF7; } if(din->P_E&&din->FOR_DIN==8) { if(din->PR_SIFR) { opt=1; Ed_krd_srX->setState(sfVisible,True); Ed_krd_srY->setState(sfVisible,True); sprintf(str,"%d",din->X_SIFR); Ed_krd_srX->setData(str); sprintf(str,"%d",din->Y_SIFR); Ed_krd_srY->setData(str); } else opt=0; CheckBoxes1->setData(&opt); CheckBoxes1->setState(sfVisible,True); if(din->PR_ZN) { opt=1; Ed_krd_znX->setState(sfVisible,True); Ed_krd_znY->setState(sfVisible,True); sprintf(str,"%d",din->X_ZN); Ed_krd_znX->setData(str); sprintf(str,"%d",din->Y_ZN); Ed_krd_znY->setData(str); } else opt=0; CheckBoxes2->setData(&opt); CheckBoxes2->setState(sfVisible,True); if(din->PR_UP) { opt=1; Ed_krd_curX->setState(sfVisible,True); Ed_krd_curY->setState(sfVisible,True); sprintf(str,"%d",din->X_KUR); Ed_krd_curX->setData(str); sprintf(str,"%d",din->Y_KUR); Ed_krd_curY->setData(str); } else opt=0; CheckBoxes3->setData(&opt); CheckBoxes3->setState(sfVisible,True); if(din->FOR_DIN==8) { if(din->PR_OK) { opt=1; Ed_krd_Xmin->setState(sfVisible,True); Ed_krd_Ymin->setState(sfVisible,True); sprintf(str,"%d",din->X_MIN); Ed_krd_Xmin->setData(str); sprintf(str,"%d",din->Y_MIN); Ed_krd_Ymin->setData(str); } else opt=0; CheckBoxes4->setData(&opt); CheckBoxes4->setState(sfVisible,True); } } temp->select(); // sprintf(str,"%d",din->FOR_DIN); Edit11->setData(str); // sprintf(str,"%d",din->FOR_RAS); Edit12->setData(str); } #ifdef __DOS32__ int TMshDialog::ViewMnem(int mn,char opt) { int upr,x,y,i,ii,iii,ret,next=0,act,corn=0,tmp,st_mouse; float tmp1; statikaed *stat; dinamika *din; TCompCollect *AlgCol; char str[256],*str1; union REGS r; MouseEventType MEvent; r.w.ax = 0; int386(0x33,&r,&r); if(r.w.ax==0xFFFF) st_mouse=1; else st_mouse=0; act=MyTListBox2->focused; sprintf(str,Text_msg[109],PathDir,NameFont); if(LoadShrift(str)== -1) return(-1); // r.w.ax = 2; int386(0x33,&r,&r); // TMouse::hide(); sprintf(str,Text_msg[109],PathDir,NamePCXLib); loadpcxlib(str); _setvideomode(0x10); rev1: upr=0; AlgCol=(TCompCollect *)((domineed *)(DomColect->at(mn)))->stat; _setcolor(0); _rectangle (_GFILLINTERIOR,0,0,639,349); for(i=0;igetCount();i++) { stat=(statikaed *)AlgCol->at(i); if(stat->TIP==03) fgtext(15,stat->s2+1,stat->s3-2,(char *)&stat->s4); if(stat->TIP==13) if(pcxDisplayLib((char *)&stat->s4,stat->s2,stat->s3,640)== -1) { DispFixErr(1,"Рисунок %s",(char *)&stat->s4); goto end1; } if(stat->TIP==31) { _setcolor(stat->s2); _rectangle (_GFILLINTERIOR,stat->s3,stat->s4,stat->s5,stat->s6); _setcolor(15); _rectangle (_GBORDER,stat->s3,stat->s4,stat->s5,stat->s6); } } AlgCol=(TCompCollect *)((domineed *)(DomColect->at(mn)))->din; for(i=0;igetCount();i++) { if(i==act&&opt) continue; din=(dinamika *)AlgCol->at(i); if((din->P_E==ANALOG&&din->PR_SIFR)||(din->P_E==DIGIT&&din->PR_SIFR&&din->PR_UP)) upr++; if(din->P_E==ANALOG) { if(din->PR_SIFR) fgtext(2,din->X_SIFR+1,din->Y_SIFR-2,"%.9s",din->IMJ); if(din->PR_ZN) fgtext(2,din->X_ZN+1,din->Y_ZN-2,"9999.99"); if(din->PR_UP) { tmp=_getpixel(din->X_KUR,din->Y_KUR); if(tmp!=0&&tmp!=15) ch_color(din->X_KUR,din->Y_KUR,15); else { _setcolor(15); _rectangle(_GFILLINTERIOR,din->X_KUR-4,din->Y_KUR-4,din->X_KUR+4,din->Y_KUR+4); _setcolor(3); _rectangle(_GBORDER,din->X_KUR-4,din->Y_KUR-4,din->X_KUR+4,din->Y_KUR+4); } if(din->PR_SIFR) { if(upr<9) fgtext(15,din->X_SIFR-10,din->Y_SIFR-2,"%1d",upr); else if(upr<17) fgtext(7,din->X_SIFR-10,din->Y_SIFR-2,"%1d",upr-8); fgtext(15,din->X_SIFR-10,din->Y_SIFR+9,"A"); } } if(din->FOR_DIN==1) { ch_color((din->X_MIN+din->X_MAX)>>1,(din->Y_MAX+din->Y_MIN)>>1,din->C_ZAP); if(!opt) { _setviewport(din->X_MIN,din->Y_MIN,din->X_MAX,din->Y_MAX-((din->Y_MAX-din->Y_MIN)>>1)); ch_color((din->X_MAX-din->X_MIN)>>1,1,din->O_ZAP); _setviewport(0,0,639,349); } } if(din->FOR_DIN==4&&din->X_MAX>din->X_MIN&&din->Y_MAX>din->Y_MIN) { if(din->X_MAX-din->X_MIN<4) {y=0; tmp=1;} else if(din->X_MAX-din->X_MIN<8) {y=2; tmp=1;} else if(din->X_MAX-din->X_MIN<20){y=4; tmp=1;} else if(din->X_MAX-din->X_MIN<60){y=10; tmp=1;} else {y=10; tmp=2;} x=(din->X_MAX-din->X_MIN)/y; din->X_MAX=din->X_MIN+x*y; _setcolor(15); _moveto(din->X_MIN,din->Y_MAX);_lineto(din->X_MAX,din->Y_MAX); if(din->Y_MAX-din->Y_MIN>5) {_moveto(din->X_MIN,din->Y_MAX-1);_lineto(din->X_MAX,din->Y_MAX-1);} tmp1=(din->X_MAX-din->X_MIN)/y; for(ii=0; iiX_MIN+ii*tmp1,din->Y_MAX);_lineto(din->X_MIN+ii*tmp1, din->Y_MAX-2*(din->Y_MAX-din->Y_MIN)/3);} else if(ii==y/2) {_moveto(din->X_MIN+ii*tmp1,din->Y_MAX);_lineto(din->X_MIN+ii*tmp1, din->Y_MAX-(din->Y_MAX-din->Y_MIN)/2);} else {_moveto(din->X_MIN+ii*tmp1,din->Y_MAX);_lineto(din->X_MIN+ii*tmp1, din->Y_MAX-(din->Y_MAX-din->Y_MIN)/3);} } for(ii=0; ii<(din->Y_MAX-din->Y_MIN)/3;ii++) { _setcolor(0); _moveto(din->X_MAX,din->Y_MIN+ii);_lineto(din->X_MIN+((din->X_MAX-din->X_MIN)/2),din->Y_MIN+ii); _setcolor(2); _moveto(din->X_MIN,din->Y_MIN+ii);_lineto(din->X_MIN+((din->X_MAX-din->X_MIN)/2),din->Y_MIN+ii); } } if(din->FOR_DIN==5&&din->X_MAX>din->X_MIN&&din->Y_MAX>din->Y_MIN) { if(din->Y_MAX-din->Y_MIN<4) {y=0; tmp=1;} else if(din->Y_MAX-din->Y_MIN<8) {y=2; tmp=1;} else if(din->Y_MAX-din->Y_MIN<20){y=4; tmp=1;} else if(din->Y_MAX-din->Y_MIN<60){y=10; tmp=1;} else {y=10; tmp=2;} x=(din->Y_MAX-din->Y_MIN)/y; din->Y_MAX=din->Y_MIN+x*y; _setcolor(15); _moveto(din->X_MIN,din->Y_MIN);_lineto(din->X_MIN,din->Y_MAX); if(din->X_MAX-din->X_MIN>5) {_moveto(din->X_MIN+1,din->Y_MIN);_lineto(din->X_MIN+1,din->Y_MAX);} tmp1=(din->Y_MAX-din->Y_MIN)/y; for(ii=0; iiX_MIN,din->Y_MIN+ii*tmp1);_lineto(din->X_MIN+2*(din->X_MAX-din->X_MIN)/3,din->Y_MIN+ii*tmp1);} else if(ii==y/2) {_moveto(din->X_MIN,din->Y_MIN+ii*tmp1);_lineto(din->X_MIN+(din->X_MAX-din->X_MIN)/2,din->Y_MIN+ii*tmp1);} else {_moveto(din->X_MIN,din->Y_MIN+ii*tmp1);_lineto(din->X_MIN+(din->X_MAX-din->X_MIN)/3,din->Y_MIN+ii*tmp1);} } for(ii=0; ii<(din->X_MAX-din->X_MIN)/3;ii++) { _setcolor(0); _moveto(din->X_MAX-ii,din->Y_MIN);_lineto(din->X_MAX-ii,din->Y_MIN+((din->Y_MAX-din->Y_MIN)/2)); _setcolor(2); _moveto(din->X_MAX-ii,din->Y_MAX);_lineto(din->X_MAX-ii,din->Y_MIN+((din->Y_MAX-din->Y_MIN)/2)); } } if((din->FOR_DIN==9||din->FOR_DIN==10)&&din->X_MAX>din->X_MIN&&din->Y_MAX>din->Y_MIN) { _setcolor(15); _rectangle (_GBORDER,din->X_MIN,din->Y_MIN,din->X_MAX,din->Y_MAX); if(din->FOR_DIN==9) { _setcolor(din->C_ZAP); _rectangle(_GFILLINTERIOR,din->X_MIN+1,din->Y_MIN+1,din->X_MAX-(din->X_MAX-din->X_MIN)/2,din->Y_MAX-1); _setcolor(din->O_ZAP); _rectangle(_GFILLINTERIOR,din->X_MIN+(din->X_MAX-din->X_MIN)/2,din->Y_MIN+1,din->X_MAX-1,din->Y_MAX-1); } if(din->FOR_DIN==10) { _setcolor(din->O_ZAP); _rectangle(_GFILLINTERIOR,din->X_MIN+1,din->Y_MIN+1,din->X_MAX-1,din->Y_MAX-(din->Y_MAX-din->Y_MIN)/2); _setcolor(din->C_ZAP); _rectangle(_GFILLINTERIOR,din->X_MIN+1,din->Y_MIN+(din->Y_MAX-din->Y_MIN)/2,din->X_MAX-1,din->Y_MAX-1); } } } if(din->P_E==DIGIT) { if(din->PR_SIFR) { if(din->PR_UP) { if(upr<9) fgtext(15,din->X_SIFR,din->Y_SIFR-2,"%1d",upr); else if(upr<17) fgtext(7,din->X_SIFR,din->Y_SIFR-2,"%1d",upr-8); } else fgtext(2,din->X_SIFR+1,din->Y_SIFR-2,"%.9s",din->IMJ); } if(din->PR_ZN) fgtext(2,din->X_ZN+1,din->Y_ZN-2,"ВКЛ"); if(din->PR_UP) { tmp=_getpixel(din->X_KUR,din->Y_KUR); if(tmp!=0&&tmp!=15) ch_color(din->X_KUR,din->Y_KUR,15); else { _setcolor(15); _rectangle(_GFILLINTERIOR,din->X_KUR-4,din->Y_KUR-4,din->X_KUR+4,din->Y_KUR+4); _setcolor(3); _rectangle(_GBORDER,din->X_KUR-4,din->Y_KUR-4,din->X_KUR+4,din->Y_KUR+4); } } if(din->PR_OK) ch_color(din->X_MIN, din->Y_MIN,10); } } if(opt) { din = (dinamika *)MyTListBox2->list()->at(MyTListBox2->focused); if(opt==1) str1="Укажите позицию шифра параметра %s"; if(opt==2) str1="Укажите позицию значения параметра %s"; if(opt==3) str1="Укажите позицию курсора параметра %s"; if(opt==4 || opt==5) str1="Укажите позицию залива параметра %s"; if(opt==6||opt==7) if(!corn) str1="Укажите левый верхний угол %s"; else str1="Укажите прывый нижний угол %s"; fgtext(15,0,340,str1,din->IMJ); } if(st_mouse) { r.w.ax = 1; int386(0x33,&r,&r); } // TMouse::show(); for(;;) { if(kbhit()) { x=y=0; ii=getch(); iii=getShiftState(); if(ii==0x4D) { x= 1; y= 0; if(iii&(kbLeftShift|kbRightShift))x= 5; } if(ii==0x4B) { x=-1; y= 0; if(iii&(kbLeftShift|kbRightShift))x=-5; } if(ii==0x50) { x= 0; y= 1; if(iii&(kbLeftShift|kbRightShift))y= 5; } if(ii==0x48) { x= 0; y=-1; if(iii&(kbLeftShift|kbRightShift))y=-5; } if(x|y) { getEvent(MEvent); MEvent.where.x+=x;MEvent.where.y+=y; setCurPos(MEvent.where.x,MEvent.where.y); } if(ii==0x1b) {ret= 0; break;} if(ii==0x0d) {ret= 1; break;} if(ii==0x20) {next= 1; break;} } getEvent(MEvent); if(MEvent.buttons&0x01) {ret= 1; break;} if(MEvent.buttons&0x02) {next= 1; break;} } end1: r.w.ax = 2; int386(0x33,&r,&r); // TMouse::hide(); if(ret==1 && opt) { if(opt==1) {din->X_SIFR=MEvent.where.x; din->Y_SIFR=MEvent.where.y; act=-1; goto rev1;} if(opt==2) {din->X_ZN =MEvent.where.x; din->Y_ZN =MEvent.where.y; act=-1; goto rev1;} if(opt==3) {din->X_KUR =MEvent.where.x; din->Y_KUR =MEvent.where.y; act=-1; goto rev1;} if(opt==4) {din->X_MIN =MEvent.where.x; din->Y_MIN =MEvent.where.y; act=-1; goto rev1;} if(opt==5) {ChekBound(MEvent.where.x,MEvent.where.y,&din->X_MIN,&din->Y_MIN,&din->X_MAX,&din->Y_MAX); act=-1; goto rev1;} if(opt==6||opt==7) { if(next) {if(!corn) corn=1; else corn=0; next=0; goto rev1;} else if(!corn) {din->X_MIN =MEvent.where.x; din->Y_MIN =MEvent.where.y; goto rev1; } else {din->X_MAX =MEvent.where.x; din->Y_MAX =MEvent.where.y; act=-1; goto rev1; } } } unloadpcxlib(); DelShrift(); // _setvideomode(_DEFAULTMODE); // myApp->setScreenMode(0xA4); SetVideoMode(ScreenMode); // TMouse::show(); myApp->deskTop->drawView(); myApp->menuBar->drawView(); myApp->statusLine->drawView(); ViewMnemDin(); // if(ret==1) DispFixErr(0,"x= %d; y= %d",MEvent.where.x,MEvent.where.y); return(ret); } #endif void TMshDialog::SaveChengeMn() { dinamika *din; statikaed *stat; word opt=0; if(MyTListBox3->list()->getCount()) { stat = (statikaed *)MyTListBox3->list()->at(MyTListBox3->focused); if(stat->TIP==03) //Текст { strcpy((char *)&stat->s4, Edit_txt->data); stat->s2=atoi(Edit_x->data); stat->s3=atoi(Edit_y->data); } if(stat->TIP==13) //PCX { strcpy((char *)&stat->s4, Edit_PCX->data); stat->s2=atoi(Edit_x->data); stat->s3=atoi(Edit_y->data); } if(stat->TIP==31) //Фон { stat->s2=Collor_Cb->posit; stat->s3=atoi(Edit_x->data); stat->s4=atoi(Edit_y->data); stat->s5=atoi(Edit_x1->data); stat->s6=atoi(Edit_y1->data); } } if(MyTListBox2->list()->getCount()) { din = (dinamika *)MyTListBox2->list()->at(MyTListBox2->focused); din->FOR_DIN=Tipdin_Cb->posit; if(CheckBoxes1->mark(0)) { din->PR_SIFR=1; din->X_SIFR =atoi(Ed_krd_srX->data); din->Y_SIFR =atoi(Ed_krd_srY->data); } else din->PR_SIFR=0; if(CheckBoxes2->mark(0)) { din->PR_ZN=1; din->X_ZN =atoi(Ed_krd_znX->data); din->Y_ZN =atoi(Ed_krd_znY->data); } else din->PR_ZN=0; if(CheckBoxes3->mark(0)) { din->PR_UP=1; din->X_KUR =atoi(Ed_krd_curX->data); din->Y_KUR =atoi(Ed_krd_curY->data); } else din->PR_UP=0; if(CheckBoxes4->mark(0)) { din->PR_OK=1; din->X_MIN =atoi(Ed_krd_Xmin->data); din->Y_MIN =atoi(Ed_krd_Ymin->data); } else din->PR_OK=0; din->X_MIN =atoi(Ed_krd_Xmin->data); din->Y_MIN =atoi(Ed_krd_Ymin->data); din->X_MAX =atoi(Ed_krd_Xmax->data); din->Y_MAX =atoi(Ed_krd_Ymax->data); din->C_ZAP =Collor_Cb_C->posit; din->O_ZAP =Collor_Cb_O->posit; // else din->PR_UP=0; // if(opt&0x08)din->PR_OK=1; else din->PR_OK=0; // din->FOR_DIN =atoi(Edit11->data); // din->FOR_RAS =atoi(Edit12->data); } } int TMshDialog::SelectInput(void* source,TEvent& event) { TEdit *Edit = (TEdit *)source; TMshDialog *Dialog = (TMshDialog *)Edit->owner; char str[256]; TCompCollect *TempColect; int k; if(event.what == evKeyboard) switch(event.keyDown.keyCode) { case 0x3920: TempColect = new TCompCollect(10,10); sprintf(str,Text_msg[109],Dialog->PathDir,NamePCXLib); myApp->LoadLib(NULL,str, NULL, TempColect); k=myApp->OperList(Dialog,Edit,TempColect,1,6); if(k != -1) { Edit->setData((char *)TempColect->at(k)); Dialog->Modif=True; } myApp->FreeColect(TempColect); break; case kbUp: Dialog->selectNext(True); Edit->clearEvent(event); break; case kbDown: Dialog->selectNext(False); Edit->clearEvent(event); break; } return(1); } int TMshDialog::EnterNumber(void* source,TEvent& event) { char code,str[15]; int numb; TEdit *Edit = (TEdit *)source; TMshDialog *Dialog = (TMshDialog *)Edit->owner; if(event.what == evKeyboard) { switch(event.keyDown.keyCode) { case kbEnter: numb=atoi(Edit->data); sprintf(str,"%d",numb); Edit->setData(str); //Dialog->Modif=True; Dialog->selectNext(False); break; case kbDown: Dialog->selectNext(False); Edit->clearEvent(event); break; case kbUp: Dialog->selectNext(True); Edit->clearEvent(event); break; } code=event.keyDown.charScan.charCode; if( !((code>='0'&&code<='9') || code<' ')) Edit->clearEvent(event); } return(0); } int TMshDialog::SelectFormuls(void* source,TEvent& event) { dinamika *din; TComboBox *ComboBox = (TComboBox *)source; TMshDialog *Dialog = (TMshDialog *)ComboBox->owner; din = (dinamika *)Dialog->MyTListBox2->list()->at(Dialog->MyTListBox2->focused); // din->FOR_DIN=ComboBox->posit; Dialog->SaveChengeMn(); Dialog->ViewMnemDin(); Dialog->Modif=True; Dialog->Tipdin_Ed->select(); return(0); } void TMshDialog::DeleteMn(int item) { ((TCompCollect *)((domineed *)DomColect->at(item))->stat)->freeAll(); delete ((domineed *)DomColect->at(item))->stat; ((TCompCollect *)((domineed *)DomColect->at(item))->din)->freeAll(); delete ((domineed *)DomColect->at(item))->din; MyTListBox1->list()->atFree(item); } #ifdef __DOS32__ void TMshDialog::getEvent( MouseEventType& me ) { union REGS r; r.w.ax = 3; int386(0x33,&r,&r); me.buttons = r.h.bl; me.where.x = r.w.cx; me.where.y = r.w.dx; me.doubleClick = False; } void TMshDialog::setCurPos(int x,int y) { union REGS r; r.w.ax = 4; r.w.cx = x; r.w.dx = y; int386(0x33,&r,&r); // move pointer to (0,0) } void TMshDialog::ChekBound(word_s x,word_s y,word_s *X_MIN,word_s *Y_MIN,word_s *X_MAX,word_s *Y_MAX) { int y1, y2, x2, x1; int color; // текущий цвет int l=1; // "1" - вправо от оси, "-1" - влево от оси int k=0; // "0" - вертекальная ось, "1" - горизонтальная int i=0; // счетчик *X_MIN= *Y_MIN=5000; *X_MAX= *Y_MAX=0; color=_getpixel(x,y); x1=x; y1=y; mi2:; do {x1=x1-1; x2=x1;y2=y1; if(k==1) {x2=y1; y2=x1;}; } while(_getpixel(x2,y2)==color); mi3: ++x1; mi1: y1=y+(i*l); x2=x1;y2=y1; if(k==1) {y1=x+(i*l); x2=y1; y2=x1;}; ++i; if(_getpixel(x2,y2)==color) { *X_MIN=min(*X_MIN,x2); *Y_MIN=min(*Y_MIN,y2); *X_MAX=max(*X_MAX,x2); *Y_MAX=max(*Y_MAX,y2); goto mi1; } if(i==1) {if(k==1) {(*Y_MAX)++; return;} k=1; i=0; l=1; x1=y; y1=x; goto mi2; }; if(l==-1) {l=1;i=0;goto mi3;} l=-1; i=0; goto mi1; } #endif //======================================================================================= void TMyApp::LoadMsh(char *Path, TCompCollect **DomColect) { int amount,fh,i,ii; domine *p_dom; domineed *p_domineed; dinamika *p_din,*p_din1; statika *p_st; statikaed *p_st1; TCompCollect *AlgCol; char str[256]; //Domine *DomColect = new TCompCollect(10,10); sprintf(str,Text_msg[109],Path,DomineMs); if((fh=open(str,O_BIN|O_RDONLY))>0) { lseek(fh,0,SEEK_SET); amount = filelength_(fh)/sizeof(domine); p_dom = new domine[amount]; ::read(fh,p_dom,filelength_(fh)); for(i=0;i < amount;i++) { p_domineed= new domineed; strncpy(p_domineed->IMJ,(p_dom+i)->IMJ,8); (*DomColect)->insert(p_domineed); } close(fh); } else return; //Dinamika sprintf(str,Text_msg[109],Path,DinamikaMs); if((fh=open(str,O_BIN|O_RDONLY))>0) { lseek(fh,0,SEEK_SET); amount = filelength_(fh)/sizeof(dinamika); p_din= new dinamika[amount]; ::read(fh,p_din,filelength_(fh)); for(i=0;i < (*DomColect)->getCount();i++) { ((domineed *)(*DomColect)->at(i))->din= AlgCol = new TCompCollect(10,10); if((p_dom+i)->N_D==-1 || (p_dom+i)->K_D==-1) continue; for(ii=(p_dom+i)->N_D;ii <= (p_dom+i)->K_D;ii++) { p_din1= new dinamika; memcpy(p_din1,(p_din+ii),sizeof(dinamika)); AlgCol->insert(p_din1); } } delete p_din; close(fh); } //Statika sprintf(str,Text_msg[109],Path,StatikaMs); if((fh=open(str,O_BIN|O_RDONLY))>0) { lseek(fh,0,SEEK_SET); amount = filelength_(fh)/sizeof(statika); p_st= new statika[amount]; ::read(fh,p_st,filelength_(fh)); for(i=0;i < (*DomColect)->getCount();i++) { ((domineed *)(*DomColect)->at(i))->stat=AlgCol = new TCompCollect(10,10); if((p_dom+i)->N_S==-1 || (p_dom+i)->K_S==-1) continue; for(ii=(p_dom+i)->N_S;ii <= (p_dom+i)->K_S;ii++) { p_st1= new statikaed; memcpy((char *)p_st1+12,p_st+ii,sizeof(statika)); switch(p_st1->TIP) { case 03: strcpy(p_st1->NameStat,"Draw text"); break; case 13: strcpy(p_st1->NameStat,"View PCX"); break; case 31: strcpy(p_st1->NameStat,"FON"); break; default: strcpy(p_st1->NameStat,"No valid"); } AlgCol->insert(p_st1); } } delete p_st; close(fh); } delete p_dom; } void TMyApp::FreeMsh(TCompCollect *Colect) { int i; if(Colect == NULL) return; for(i=0;i < Colect->getCount();i++) { ((TCompCollect *)((domineed *)Colect->at(i))->stat)->freeAll(); delete ((domineed *)Colect->at(i))->stat; ((TCompCollect *)((domineed *)Colect->at(i))->din)->freeAll(); delete ((domineed *)Colect->at(i))->din; } Colect->freeAll(); delete Colect; } void TMyApp::SaveMnHdd(char *Path,TCompCollect *Colect) { int fh1,fh2,fh3,n_din=0,n_st=0,i,ii; char str[250]; domine p_dom; TCompCollect *StCol,*DinCol; sprintf(str,Text_msg[109],Path,DomineMs); fh1=open(str,O_BIN|O_RDWR|O_CREAT|O_TRUNC,S_IWRITE); if(fh1 <= 0) {DispFixErr(1,Text_msg[12],str); return;} sprintf(str,Text_msg[109],Path,StatikaMs); fh2=open(str,O_BIN|O_RDWR|O_CREAT|O_TRUNC,S_IWRITE); if(fh2 <= 0) {DispFixErr(1,Text_msg[12],str); return;} sprintf(str,Text_msg[109],Path,DinamikaMs); fh3=open(str,O_BIN|O_RDWR|O_CREAT|O_TRUNC,S_IWRITE); if(fh3 <= 0) {DispFixErr(1,Text_msg[12],str); return;} memset(&p_dom,0,sizeof(domine)); for(i=0;igetCount();i++) { StCol=(TCompCollect *)((domineed *)(Colect->at(i)))->stat; DinCol=(TCompCollect *)((domineed *)(Colect->at(i)))->din; strcpy(p_dom.IMJ,((domineed *)Colect->at(i))->IMJ); if(StCol->getCount()) { p_dom.N_S=n_st; p_dom.K_S=(n_st+=StCol->getCount())-1;} else {p_dom.N_S= -1; p_dom.K_S= -1;} if(DinCol->getCount()){ p_dom.N_D=n_din;p_dom.K_D=(n_din+=DinCol->getCount())-1;} else {p_dom.N_D= -1; p_dom.K_D= -1;} p_dom.N_O=p_dom.K_O= -1; ::write(fh1,&p_dom,sizeof(domine)); for(ii=0;iigetCount();ii++) ::write(fh2,(char *)(StCol->at(ii))+ sizeof(((statikaed *)StCol->at(ii))->NameStat),sizeof(statika)); for(ii=0;iigetCount();ii++) ::write(fh3,DinCol->at(ii),sizeof(dinamika)); } close(fh1); close(fh2); close(fh3); }