// --------------------------------------------------------------------------- // // ----------- void bToolGeomWithJoin::open(int* flags){ _use_nea=false; _use_dir=false; _use_ang=false; _use_end=false; _k_nea=0; _k_dir=0; _k_ang=0; _k_end=0; bStdToolGeom::open(flags); init_join(); _lsi=0; }
int main(){ int message_set = 0; char* input = NULL; input = (char*)malloc(sizeof(char)*100); int msq_id, run = 1; struct msqid_ds msqid_ds, *buf; buf = &msqid_ds; generate_my_msqid(); get_server_msqid(); init_join(CLIENT_MSQID); check_init_server_response_and_parse(); while (run == 1){ if (strlen(input) > 0){ printf("Please enter direction to move: "); } fgets(input, MAX_STRING, stdin); if (strlen(input) > 1){ message_set = send_directional_message(input, CLIENT_MSQID); if (message_set == 1){ parse_server_reply(); } } } message_control(msq_id, IPC_RMID, buf); }
// --------------------------------------------------------------------------- // // ----------- bool bToolGeomWithJoin::edit_event(EventRef evt, WindowRef wd){ //_bTrace_("bToolGeomWithJoin::edit_event",true); bool b=true; HICommand cmd; ControlRef c; ControlID cid; char val[32]; cid.signature=kToolGeomWithJoinSign; if(GetEventClass(evt)==kEventClassCommand){ GetEventParameter(evt,kEventParamDirectObject,typeHICommand,NULL,sizeof(HICommand),NULL,&cmd); switch(cmd.commandID){ case kHICommandOK: cid.id=kToolGeomWithJoinKeyNeaID; if(GetControlByID(wd,&cid,&c)==noErr){ GetTextControlValue(c,val,sizeof(val)); } else{ val[0]=0; } _k_nea=val[0]; cid.id=kToolGeomWithJoinKeyDirID; if(GetControlByID(wd,&cid,&c)==noErr){ GetTextControlValue(c,val,sizeof(val)); } else{ val[0]=0; } _k_dir=val[0]; cid.id=kToolGeomWithJoinKeyAngID; if(GetControlByID(wd,&cid,&c)==noErr){ GetTextControlValue(c,val,sizeof(val)); } else{ val[0]=0; } _k_ang=val[0]; cid.id=kToolGeomWithJoinKeyEndID; if(GetControlByID(wd,&cid,&c)==noErr){ GetTextControlValue(c,val,sizeof(val)); } else{ val[0]=0; } _k_end=val[0]; init_join(); cid.id=kToolGeomWithJoinTypesID; GetControlByID(wd,&cid,&c); DataBrowserClose(c); { bToolGeomWithJoin* tool; for(long i=1;i<=_gwjs.count();i++){ _gwjs.get(i,&tool); tool->putKeys(_k_nea,_k_dir,_k_ang,_k_end); } } break; case kHICommandCancel: cid.id=kToolGeomWithJoinTypesID; GetControlByID(wd,&cid,&c); DataBrowserClose(c); break; case kToolGeomWithJoinUseNeaCmd: cid.id=kToolGeomWithJoinUseNeaID; GetControlByID(wd,&cid,&c); _use_nea=GetControl32BitValue(c); break; case kToolGeomWithJoinUseDirCmd: cid.id=kToolGeomWithJoinUseDirID; GetControlByID(wd,&cid,&c); _use_dir=GetControl32BitValue(c); break; case kToolGeomWithJoinUseAngCmd: cid.id=kToolGeomWithJoinUseAngID; GetControlByID(wd,&cid,&c); _use_ang=GetControl32BitValue(c); break; case kToolGeomWithJoinUseEndCmd: cid.id=kToolGeomWithJoinUseEndID; GetControlByID(wd,&cid,&c); _use_end=GetControl32BitValue(c); break; case kToolGeomWithJoinTypesCmd: break; default: b=false; break; } } return(b); }