Changeset 63 for SH_SHM/trunk
- Timestamp:
- 10/30/2008 11:06:50 PM (14 years ago)
- Location:
- SH_SHM/trunk/source/motif
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
SH_SHM/trunk/source/motif/cbutil.c
r50 r63 3 3 * ======== 4 4 * 5 * $Revision: 35 $, $Date: 2008-07-04 11:21:14 +0200 (Fr, 04 Jul2008) $5 * $Revision: 48 $, $Date: 2008-10-14 18:19:33 +0200 (Di, 14 Okt 2008) $ 6 6 * 7 7 * utility routines for callbacks … … 339 339 340 340 void cu_set_read_time_file( Widget w[], int mode, char autoevt[], 341 TSyStatus *status )341 char detline[], TSyStatus *status ) 342 342 343 343 /* reads next/previous time from file … … 347 347 * int mode; input; search mode 348 348 * char autoevt[]; output; name of evt-file 349 * char detline[]; output; lth:cBcLineLth if not NULL returns detec. line 349 350 * TSyStatus *status; output; return status 350 351 */ … … 419 420 } /*endwhile*/ 420 421 422 /* prepare detection info line including line number */ 423 sprintf( detline, "%03d> ", curr_line ); 424 strncpy( detline+5, line, cBcLineLth-5 ); 421 425 sprintf( timestr, "%d", curr_line ); 426 427 /* put line number into dialog box */ 422 428 cu_set_string( w[k_widget_read_grsn_eventno_text], timestr ); 423 429 -
SH_SHM/trunk/source/motif/cbutil.h
r16 r63 362 362 363 363 void cu_set_read_time_file( Widget w[], int mode, char autoevt[], 364 STATUS *status );364 char detline[], STATUS *status ); 365 365 366 366 /* reads next/previous time from file … … 370 370 * int mode; input; search mode 371 371 * char autoevt[]; output; name of evt-file 372 * char detline[]; output; lth:cBcLineLth if not NULL returns detec. line 372 373 * STATUS *status; output; return status 373 374 */ -
SH_SHM/trunk/source/motif/mfexec.c
r62 r63 367 367 err_setcontext( " ## variable: V$LOC not found" ); 368 368 } /*endif*/ 369 return;370 369 } else if (*autoevt == '\0' || strcmp(autoevt,"None") == 0) { 371 370 /* same as above */ … … 376 375 err_setcontext( " ## variable: V$LOC not found" ); 377 376 } /*endif*/ 378 return; 379 } /*endif*/ 380 /* get location from evt file */ 381 mxh_read_location_from_evt( autoevt, &epilat, &epilon, &epifound ); 382 if (!epifound) { 383 /* no epicentre in evt file, behave like :AE */ 384 printf( "*SHM: cannot translate :LOC, no epicentre found -> :AE\n" ); 385 mxh_translate_button_name( ":AE", autoevt, addlist, status ); 386 return; 387 } /*endif*/ 388 if (GpGetInt(cGpI_debug_level) > 2) 389 printf( "SHM-dbg3: :LOC found epi %f,%f\n", epilat, epilon ); 390 epifound = FALSE; 391 locvarcnt = 1; 392 FOREVER { 393 /* read through all v$loc* variables and compare with curr. location */ 394 sprintf( varname, "v$loc%d", locvarcnt ); 395 GpReadParameter( varname, cBcLongStrLth, vstr, &ok ); 396 if (!ok) break; 397 if (GpGetInt(cGpI_debug_level) > 3) 398 printf( "SHM-dbg4: %s translated to %s\n", varname, vstr ); 399 if (sscanf(vstr,"%f,%f,%f,%f %s", 400 &vlat1,&vlon1,&vlat2,&vlon2,addlist) != 5) 401 continue; 402 if (vlat1 <= epilat && epilat <= vlat2 && vlon1 <= epilon 403 && epilon <= vlon2) { 404 epifound = TRUE; 405 break; 406 } /*endif*/ 407 locvarcnt++; 408 } /*endfor*/ 409 if (!epifound) { 410 GpReadParameter("v$loc", cBcLongStrLth, addlist, &ok ); 411 if (!ok) { 412 printf( "*SHM: no v$loc definition\n" ); 413 *status = MXE_CONFIG_SETUP; 414 err_setcontext( " ## variable: V$LOC not found" ); 377 } else { 378 /* get location from evt file */ 379 mxh_read_location_from_evt( autoevt, &epilat, &epilon, &epifound ); 380 if (!epifound) { 381 /* no epicentre in evt file, behave like :AE */ 382 printf( "*SHM: cannot translate :LOC, no epicentre found -> :AE\n" ); 383 mxh_translate_button_name( ":AE", autoevt, addlist, status ); 415 384 return; 416 385 } /*endif*/ 417 } /*endif*/ 418 /* if addlist is a variable, translate it */ 386 if (GpGetInt(cGpI_debug_level) > 2) 387 printf( "SHM-dbg3: :LOC found epi %f,%f\n", epilat, epilon ); 388 epifound = FALSE; 389 locvarcnt = 1; 390 FOREVER { 391 /* read through all v$loc* variables and compare with curr. location */ 392 sprintf( varname, "v$loc%d", locvarcnt ); 393 GpReadParameter( varname, cBcLongStrLth, vstr, &ok ); 394 if (!ok) break; 395 if (GpGetInt(cGpI_debug_level) > 3) 396 printf( "SHM-dbg4: %s translated to %s\n", varname, vstr ); 397 if (sscanf(vstr,"%f,%f,%f,%f %s", 398 &vlat1,&vlon1,&vlat2,&vlon2,addlist) != 5) 399 continue; 400 if (vlat1 <= epilat && epilat <= vlat2 && vlon1 <= epilon 401 && epilon <= vlon2) { 402 epifound = TRUE; 403 break; 404 } /*endif*/ 405 locvarcnt++; 406 } /*endfor*/ 407 if (!epifound) { 408 GpReadParameter("v$loc", cBcLongStrLth, addlist, &ok ); 409 if (!ok) { 410 printf( "*SHM: no v$loc definition\n" ); 411 *status = MXE_CONFIG_SETUP; 412 err_setcontext( " ## variable: V$LOC not found" ); 413 return; 414 } /*endif*/ 415 } /*endif*/ 416 } /*endif*/ 419 417 } else { 420 418 strcpy( addlist, code ); 421 419 } /*endif*/ 422 420 421 /* if addlist is a variable, translate it */ 423 422 if (addlist[0] == '$') { 424 423 vstr[0] = 'v'; -
SH_SHM/trunk/source/motif/motifgraph.c
r16 r63 73 73 #define TEXT_X_SORT 350 74 74 #define TEXT_Y_SORT 0 75 #define TEXT_X_DETEC 56 76 #define TEXT_Y_DETEC (-25) 75 77 #define TEXT_X_STATUS 400 76 78 #define TEXT_Y_STATUS 0 … … 365 367 mg_do_phase( w, MGC_WDW_MAIN, MGC_PHASE_REFRESH, 0, 0, NULL, NULL, NULL ); 366 368 mg_print_filter( w, mgv_filter ); 369 mg_print_detecinfo( w, "--redraw--" ); 367 370 368 371 XFlush( XtDisplay(w) ); … … 3438 3441 3439 3442 3440 3441 3443 void mg_print_sortinfo( Widget w, char sortinfo[] ) 3442 3444 … … 3472 3474 3473 3475 } /* end of mg_print_sortinfo */ 3476 3477 3478 3479 /*----------------------------------------------------------------------------*/ 3480 3481 3482 3483 void mg_print_detecinfo( Widget w, char detecinfo[] ) 3484 3485 /* prints detection line in window 3486 * 3487 * parameters of routine 3488 * Widget w; input; widget of DrawingArea 3489 * char detecinfo[]; input; detection info 3490 */ 3491 { 3492 /* local variables */ 3493 static int ypos=(-1); /* text y position */ 3494 static char oldstr[BC_LINELTH+1]; /* last name printed */ 3495 char str[BC_LINELTH+1]; /* scratch string */ 3496 int i; /* counter */ 3497 3498 /* executable code */ 3499 3500 if (ypos < 0) { 3501 int x, y, xw, xh, bw, dp; /* window parameters */ 3502 unsigned root_ret; 3503 /* not yet initialised */ 3504 XGetGeometry( XtDisplay(w), XtWindow(w), &root_ret, 3505 &x, &y, &xw, &xh, &bw, &dp ); 3506 ypos = xh + TEXT_Y_DETEC; 3507 } /*endif*/ 3508 3509 if (strcmp(detecinfo,"--redraw--") == 0 && *oldstr != '\0') { 3510 strcpy( str, oldstr ); 3511 pix_DrawString( XtDisplay(w), XtWindow(w), mgv_over_gc, 3512 TEXT_X_DETEC, mgv_wdwsetup.margin_t+ypos, 3513 str, (int)strlen(str) ); 3514 XFlush( XtDisplay(w) ); 3515 return; 3516 } /*endif*/ 3517 3518 if (strlen(detecinfo) > BC_LINELTH-10) { 3519 strcpy( str, "detec:?" ); 3520 } else { 3521 strcpy( str, detecinfo ); 3522 i = strlen( str ); 3523 if (i>0 && str[i-1] == '\n') 3524 str[i-1] = '\0'; 3525 } /*endif*/ 3526 3527 if (*oldstr != '\0') 3528 pix_DrawString( XtDisplay(w), XtWindow(w), mgv_clear_gc, 3529 TEXT_X_DETEC, mgv_wdwsetup.margin_t+ypos, 3530 oldstr, (int)strlen(oldstr) ); 3531 if (*str != '\0') 3532 pix_DrawString( XtDisplay(w), XtWindow(w), mgv_over_gc, 3533 TEXT_X_DETEC, mgv_wdwsetup.margin_t+ypos, 3534 str, (int)strlen(str) ); 3535 strcpy( oldstr, str ); 3536 XFlush( XtDisplay(w) ); 3537 3538 } /* end of mg_print_detecinfo */ 3474 3539 3475 3540 -
SH_SHM/trunk/source/motif/motifgraph.h
r16 r63 560 560 561 561 562 void mg_print_detecinfo( Widget w, char detecinfo[] ); 563 564 /* prints detection line in window 565 * 566 * parameters of routine 567 * Widget w; input; widget of DrawingArea 568 * char detecinfo[]; input; detection info 569 */ 570 571 572 /*----------------------------------------------------------------------------*/ 573 574 562 575 void mg_rubber_line( Widget w, int wdwno, int mode, int x, int y ); 563 576 -
SH_SHM/trunk/source/motif/shm.c
r57 r63 3 3 * ===== 4 4 * 5 * $Revision: 4 2 $, $Date: 2008-10-13 22:51:21 +0200 (Mo, 13Okt 2008) $5 * $Revision: 48 $, $Date: 2008-10-14 18:19:33 +0200 (Di, 14 Okt 2008) $ 6 6 * 7 7 * main module of shm … … 589 589 static char xmv_sortstr[cBcShortStrLth+1]; /* sort info */ 590 590 static char xmv_sortinfo[cBcShortStrLth+1]; /* sort display text */ 591 static char xmv_detecinfo[cBcLineLth+1]; /* detection line */ 591 592 static TSyBoolean xmv_xt_initialized=FALSE; /* Xt initialized */ 592 593 static int xmv_prevent_resize=0; /* prevents resize events if >0 */ … … 1765 1766 break; 1766 1767 case k_button_read_grsn_nexttime: 1767 cu_set_read_time_file( xmv_w, CUC_LIST_NEXT, autoevt, &status ); 1768 cu_set_read_time_file( xmv_w, CUC_LIST_NEXT, autoevt, xmv_detecinfo, 1769 &status ); 1770 mg_print_detecinfo( xmv_w[k_widget_draw], xmv_detecinfo ); 1768 1771 break; 1769 1772 case k_button_read_grsn_prevtime: 1770 cu_set_read_time_file( xmv_w, CUC_LIST_PREV, autoevt, &status ); 1773 cu_set_read_time_file( xmv_w, CUC_LIST_PREV, autoevt, xmv_detecinfo, 1774 &status ); 1775 mg_print_detecinfo( xmv_w[k_widget_draw], xmv_detecinfo ); 1771 1776 break; 1772 1777 case k_button_read_grsn_keep:
Note: See TracChangeset
for help on using the changeset viewer.