Ignore:
Timestamp:
09/07/07 15:40:51 (17 years ago)
Author:
smasson
Message:

bugfix when using double precision calendar

Location:
trunk/SRC/ToBeReviewed/WIDGET
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildreadcmd.pro

    r262 r279  
    111111    date2 = date2jul(date2) - fakecal 
    112112  ENDIF 
    113   sdate1 = strtrim(date1, 1) & sdate2 = strtrim(date2, 1) 
     113  IF size(date1, /type) EQ 5 THEN sdate1 = string(date1, format='(f15.6)')+'d' $ 
     114  ELSE sdate1 = string(date1, format='(i10)')+'L' 
     115  IF size(date2, /type) EQ 5 THEN sdate2 = string(date2, format='(f15.6)')+'d' $ 
     116  ELSE sdate2 = string(date2, format='(i10)')+'L' 
    114117;--------------- 
    115118; find boxzoom 
  • trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_calendar.pro

    r271 r279  
    6868; 
    6969@cm_4cal 
    70  
    7170; get back the calendar and its related informations 
    7271  winfo_id = widget_info(id, find_by_uname = 'infocal') 
    7372  widget_control, winfo_id, get_uvalue = infowid 
    7473  key_caltype = infowid.caltype 
    75  
    7674; high freqeuncy calendar 
    7775  IF keyword_set(infowid.fakecal) THEN BEGIN 
     
    8482    ENDIF 
    8583  ENDIF ELSE BEGIN 
    86 ; 
    87     value = long(value[0]) 
    88 ; make sure the value correspond 
    89     value = jul2date(date2jul(value)) 
    90 ; define year month day 
    91     year = value/10000l 
    92     month = (value MOD 10000L)/100L 
    93     day = value MOD 100L 
     84    jdval = date2jul(value) 
    9485; check that the date exists in the calendar 
    95   if (where(abs(infowid.calendar - julday(month, day, year)) LT 1./86400.))[0] EQ - 1 then return 
     86    if (where(abs(infowid.calendar - jdval) LT 1.d/86400.d))[0] EQ - 1 then return 
    9687; update the value of infocal 
    9788    infowid.date = value 
     
    181172  if wid_id NE 0 then BEGIN 
    182173    widget_control, wid_id, get_value = wid_value 
    183     date = long(wid_value.combobox_gettext) 
     174    widget_control, wid_id, get_uvalue = wid_uvalue 
     175    date = double(wid_value.combobox_gettext) + wid_uvalue.hms[wid_value.combobox_index] 
    184176  ENDIF ELSE date = oldate MOD 100L 
    185177;-------------month--------------- 
     
    224216; @uses 
    225217; 
    226 ; @restrictions 
     218; @restrictions< 
    227219; 
    228220; @examples 
     
    242234  winfo_id = widget_info(event.handler, find_by_uname = 'infocal') 
    243235  widget_control, winfo_id, get_uvalue = infowid 
    244   caldat, infowid.calendar, monthcal, daycal, yearcal 
     236  caldat, infowid.calendar, monthcal, daycal, yearcal, hourcal, mincal, seccal 
    245237; ... and the current date 
    246238  IF n_elements(date0) EQ 0 then date0 = get_cal_value(event.handler) 
    247   year0 = date0/10000L 
    248   month0 = (date0 MOD 10000L)/100L 
    249   day0 = date0 MOD 100L 
     239  jdate0 = date2jul(date0, month = month0, day = day0, year = year0) 
    250240; index of days/months/years according to date0 
    251241  case casename of 
     
    254244      index = where(monthcal EQ month0 AND yearcal EQ year0) 
    255245      current = daycal[index] 
     246      hms = hourcal[index] / 24.0d0 + mincal[index]/1440.0d0 + seccal[index] / 86400.0d0 
    256247    END 
    257248    'month':BEGIN 
     
    271262  ENDCASE 
    272263; we update the uvalue of the widget 
    273   widget_control, wid_id, set_uvalue = {name:casename} 
     264  IF casename EQ 'day' THEN widget_control, wid_id, set_uvalue = {name:casename, hms:hms} 
    274265; for event.out = 0, we store the previous position of the combobox to use 
    275266; it as the default position. 
     
    334325; $Id$ 
    335326;- 
    336 PRO move, event, casename 
     327PRO cw_cal_move, event, casename 
    337328; 
    338329  compile_opt strictarr, strictarrsubs 
     
    354345         widget_control, id, set_value = {combobox_select:selected} 
    355346; we call move for the next combobox 
    356       ENDIF ELSE move, event, possiblecase[whichcase+1] 
     347      ENDIF ELSE cw_cal_move, event, possiblecase[whichcase+1] 
    357348; it is possible to move from +/- 1 
    358349   ENDIF ELSE widget_control, id, set_value = {combobox_select:wvalue.combobox_index+event.out} 
     
    410401        selected = (widvalue.combobox_number-1)*(event.out EQ -1) 
    411402        widget_control, event.id, set_value = {combobox_select:selected} 
    412       ENDIF ELSE move, event, possiblecase[whichcase+1] 
     403      ENDIF ELSE cw_cal_move, event, possiblecase[whichcase+1] 
    413404    ENDIF 
    414405; if we changed month(year), we need to update the day (and month) list 
     
    484475  if keyword_set(caltype) then key_caltype = caltype 
    485476; months days years found in the calendar 
    486   caldat, calendar, monthcal, daycal, yearcal, hourcal, mincal, scdcal 
     477  caldat, calendar, monthcal, daycal, yearcal, hourcal, mincal, seccal 
     478  hmscal = hourcal / 24.0d0 + mincal/1440.0d0 + seccal / 86400.0d0 
    487479; starting date 
    488480  if n_elements(jdate0) EQ 0 then jdate0 = calendar[0] 
     
    523515      currentday = daycal[dayindex] 
    524516      currentday = strtrim(currentday, 1) 
    525       cmbbid = cw_combobox_pm(base, UVALUE = {name:'day'}, UNAME = 'day', value = currentday) 
     517      hms = hmscal[dayindex] 
     518      cmbbid = cw_combobox_pm(base, UVALUE = {name:'day', hms:hms}, UNAME = 'day', value = currentday) 
    526519      widget_control, cmbbid, set_value = {combobox_select:(where(long(currentday) EQ day0))[0]} 
    527520    endif 
Note: See TracChangeset for help on using the changeset viewer.