Advertisement
milanmetal

GTKWave Patch Idea / Export CURR_MARKER_TIME

Nov 14th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.15 KB | None | 0 0
  1. /*
  2.  * This object is updated in this function, file: currenttime.c
  3.  * GLOBALS->anno_ctx->marker
  4.  *
  5.  * Export this value into Linux userspace, there are many ways to do this.
  6.  * Ideally, invoke export value mechanism inside of this function, so each time
  7.  * marker is updated, the system variable gets updated as well.
  8.  *
  9.  * Needed for another project which would benefit from this feature.
  10.  *
  11.  * reformat_time(GLOBALS->anno_ctx->time_string, val + GLOBALS->global_time_offset, GLOBALS->time_dimension);
  12.  *
  13. */
  14.  
  15. void update_markertime(TimeType val)
  16. {
  17. #if !defined _MSC_VER
  18. if(GLOBALS->anno_ctx)
  19.     {
  20.     if(val >= 0)
  21.         {
  22.         GLOBALS->anno_ctx->marker_set = 0;  /* avoid race on update */
  23.  
  24.         if(!GLOBALS->ae2_time_xlate)
  25.             {
  26.             GLOBALS->anno_ctx->marker = val / GLOBALS->time_scale;
  27.             }
  28.             else
  29.             {
  30.             int rvs_xlate = bsearch_aetinfo_timechain(val);
  31.             GLOBALS->anno_ctx->marker = ((TimeType)rvs_xlate) + GLOBALS->ae2_start_cyc;
  32.             }
  33.  
  34.         reformat_time(GLOBALS->anno_ctx->time_string, val + GLOBALS->global_time_offset, GLOBALS->time_dimension);
  35.  
  36.         GLOBALS->anno_ctx->marker_set = 1;
  37.         }
  38.         else
  39.         {
  40.         GLOBALS->anno_ctx->marker_set = 0;
  41.         }
  42.     }
  43. #endif
  44.  
  45. if(!GLOBALS->use_maxtime_display)
  46.     {
  47.     if(val>=0)
  48.         {
  49.         if(GLOBALS->tims.baseline>=0)
  50.             {
  51.             val-=GLOBALS->tims.baseline; /* do delta instead */
  52.             *GLOBALS->maxtext_currenttime_c_1='B';
  53.             if(val>=0)
  54.                 {
  55.                 *(GLOBALS->maxtext_currenttime_c_1+1)='+';
  56.                 if(GLOBALS->use_frequency_delta)
  57.                     {
  58.                     reformat_time_as_frequency(GLOBALS->maxtext_currenttime_c_1+2, val, GLOBALS->time_dimension);
  59.                     }
  60.                     else
  61.                     {
  62.                     reformat_time(GLOBALS->maxtext_currenttime_c_1+2, val, GLOBALS->time_dimension);
  63.                     }
  64.                 }
  65.                 else
  66.                 {
  67.                 if(GLOBALS->use_frequency_delta)
  68.                     {
  69.                     reformat_time_as_frequency(GLOBALS->maxtext_currenttime_c_1+1, val, GLOBALS->time_dimension);
  70.                     }
  71.                     else
  72.                     {
  73.                     reformat_time(GLOBALS->maxtext_currenttime_c_1+1, val, GLOBALS->time_dimension);
  74.                     }
  75.                 }
  76.             }
  77.         else if(GLOBALS->tims.lmbcache>=0)
  78.             {
  79.             val-=GLOBALS->tims.lmbcache; /* do delta instead */
  80.  
  81.             if(GLOBALS->use_frequency_delta)
  82.                 {
  83.                 reformat_time_as_frequency(GLOBALS->maxtext_currenttime_c_1, val, GLOBALS->time_dimension);
  84.                 }
  85.             else
  86.                 {
  87.                 if(val>=0)
  88.                     {
  89.                     *GLOBALS->maxtext_currenttime_c_1='+';
  90.                     reformat_time(GLOBALS->maxtext_currenttime_c_1+1, val, GLOBALS->time_dimension);
  91.                     }
  92.                     else
  93.                     {
  94.                     reformat_time(GLOBALS->maxtext_currenttime_c_1, val, GLOBALS->time_dimension);
  95.                     }
  96.                 }
  97.             }
  98.         else
  99.             {
  100.             reformat_time(GLOBALS->maxtext_currenttime_c_1, val + GLOBALS->global_time_offset, GLOBALS->time_dimension);
  101.             }
  102.         }
  103.         else
  104.         {
  105.         sprintf(GLOBALS->maxtext_currenttime_c_1, "--");
  106.         }
  107.  
  108.     gtk_label_set(GTK_LABEL(GLOBALS->maxtimewid_currenttime_c_1), GLOBALS->maxtext_currenttime_c_1);
  109.     }
  110.  
  111. if(GLOBALS->named_marker_lock_idx>-1)
  112.     {
  113.     if(GLOBALS->tims.marker >= 0)
  114.         {
  115.         int ent_idx = GLOBALS->named_marker_lock_idx;
  116.  
  117.         if(GLOBALS->named_markers[ent_idx] != GLOBALS->tims.marker)
  118.             {
  119.             GLOBALS->named_markers[ent_idx] = GLOBALS->tims.marker;
  120.             wavearea_configure_event(GLOBALS->wavearea, NULL);
  121.             }
  122.         }
  123.     }
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement