;+ ;================================================================= ; ; Filename CPMOVIE.PRO - includes CPMOVIE_DO, CPMOVIE_EV, CPMOVIE ; ;================================================================= ; ; ; NAME: ; CPMOVIE_DO ; ; PURPOSE: ; Use XINTERANIMATE to create the movie. ; ; CATEGORY: ; CP display ; ; CALLING SEQUENCE: ; CPMOVIE_DO, GROUP_LEADER=GROUP ; ; CALLED BY: ; CPMOVIE_EV, CPSUNCEN, CPDISPLAY ; ; CALLS TO: ; CPMOVIE_EV (via XMANAGER) ; ; INPUTS: ; GROUP : The widget ID of the parent widget. ; also, values in commons ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none explicit, only through commons ; ; OPTIONAL OUTPUTS: ; none ; ; COMMON BLOCKS: ; CPMOV_DIR for widget ID of save buttons ; CPDISPFILES to pass current frame filename ; CPKEYWORDS for current options conditions ; CPLASTPASS for access to scans memory ; CPMOVIDISPLAY for movie filenames, etc. ; CPMOVIETIME for saving a moving ; CPWIDGBASES for the widget IDs of parents and informational ; ; SIDE EFFECTS: ; If SAVEME is set then a file is created. ; ; RESTRICTIONS: ; none ; ; PROCEDURE: ; Display movie frames either from a saved movie or a just selected ; list of data files. A movie file may be saved. And a bunch of ; testing is done with the selected files to determine what is valid. ; In general, this routine is a royal pain. ; ; MODIFICATION HISTORY: ; 1991 - Elaine Einfalt (HSTX) ; oct 1993 - e. einfalt - replaced CPINTERANIMATE with XINTERANIMATE ; ;- @cpdisplay.pro ; to get CPDIFF for first time restores pro cpmovie_do, group_leader=group @cpdispfiles.common @cpkeywords.common @cplastpass.common @cpmovidisplay.common @cpmovietime.common @cpmov_dir.common @cpwidgbases.common widget_control, movbase, sensitive=0 ; no user input until ready again widget_control, base, sensitive=0 ; no user input until ready again colo=-1 ; movies are never hardcopied imsiz = 448 ; all image are displayed at 448 x 448 ; 4/93 if norm_diff eq 0 then xsiz = imsiz + 152 else xsiz = imsiz + (152*2) if strpos(movifile, 'MO_VIE', 0) ge 0 then begin ; READ saved movie ; ; Read in a saved movie to a file. ; openr, unit, strmid(movifile,6, 99), /get_lun, error=error if error ne 0 then begin widget_control, news, set_value='Error opening: '+movifile, /append widget_control, movbase, sensitive=1 ; user input again widget_control, base, sensitive=1 ; user input again return endif on_ioerror, SKIPIT ; ; Each frame is one index, just continue assigning ; until all frames are restored then close file. ; Each associated index has 2 headers (possible difference image) ; of length IMSIZ and an image ; 0:223 is C/P housekeeping, ; 224 # of frames in movie, ; 225 is XPOS for TV ; 226 is YPOS for TV ; information needed by CPSUNCEN.PRO once the movie is restored ; 227 = donorth ; 228 = dodisk ; 229 = doradii ; 230 = doradial ; 231 = colo ; 232 = ruletimes ; 233 = rulecondition ; 234 = norm_diff ; normal/difference image ; 235 = housekp*100 ; percent space left for info ; 236 = x_siz*100 ; percent image X size ; 237 = y_siz*100 ; percent image Y size ;4/93 ; 238:447 zeroes ; 238 holds the number of R/Thetas saved with movie ; 239:349 rsun values: 1st byte for the whole part of Rsun ; then 3 bytes for each of 3 more digits in fractional part. ; only up to 10 Rsuns are stored, there is room for more ; 350:460 theta values use 1st byte for 100s, 2nd byte for 10s, ; 3rd for ones place, then 1 byte for a fractional degree ; only up to 10 thetas are stored, there is room for more ; 261:447 zeroes ; ; 448:671 if difference image then is sub. image housekeeping info ; if normal image then zeroes ; 672:895 zeroes ; 896:* is the image ; w = assoc(unit, bytarr(imsiz, imsiz+2)) ; 2 headers plus image frames = w(0) indexmax = frames(224,0) ; the number of frames in the saved movie xpos = frames(225,0)/100. & ypos = frames(226,0)/100. if frames(234,0) eq 0 then xsiz = imsiz + 152 else xsiz = imsiz + (152*2) ;10/93 cpinteranimate, set= [xsiz, imsiz, indexmax+1], /showload XINTERANIMATE, set= [xsiz, imsiz, indexmax+1], /showload erase ; ; Save current R/theta incase movie changes the values ; savcprsun = cprsun savcptheta = cptheta for index = 0, indexmax do begin ; ; Loop through all the saved movie frames. ; frames = w(index) ; get next image erase if total(frames) ne 0 then begin ; not a blank movie frame ; for ntime = 0, norm_diff do $ ; write housekeeping (twice if diff.) for ntime = 0, frames(234,0) do $ ; write housekeeping (twice if diff.) cphouse, hk=frames(*,ntime), ntime=ntime, colo=colo tv, frames(*,2:*), xpos, ypos, /normal ; 1st two are headers if ruletimes ne 4 then begin ; ; Don't use current menu options or R and theta from memory. ; Use those value saved at the time the movie was saved. ; ; Assign the R/theta values from movie. ; cprsun = -1 cptheta = -1 for R_T = 0, frames(238,0)*4, 4 do begin ; ; Get the r and theta from this indexes header. ; cprsun = [cprsun, frames(239+r_t,0) + $ frames(239+r_t+1,0)/10. + $ frames(239+r_t+1,0)/100. + $ frames(239+r_t+2,0)/1000.] cptheta = [cptheta, frames(350+r_t,0)*100. + $ frames(350+r_t+1,0)*10. + $ frames(350+r_t+2,0) + $ frames(350+r_t+3,0)/10.] endfor ; add a terminator cprsun = [cprsun, 0] cptheta = [cptheta, 0] passnorth = frames(227,0) ; draw north status passdisk = frames(228,0) ; draw disk status passradii = frames(229,0) ; draw radii lines status passradial = frames(230,0) ; draw radial lines status passrulecon = frames(233,0) ; draw rules condition endif else begin ; ; Use the current settings for saved movie, even if saved with ; different parameters ; passnorth = donorth ; draw north status passdisk = dodisk ; draw disk status passradii = doradii ; draw radii lines status passradial = doradial ; draw radial lines status passrulecon = rulecondition ; draw rules condition endelse cpdata = frames(*,2:*) data = cpdata ; ; Scale cpdata to color table ; if frames(234,0) eq 0 then data = (!p.color-3)/255. * data $ else cpdiff, data=data, posfac=posfac, negfac=negfac ; ; Draw lines and stuff ; ; cpsuncen, data=frames(*,2:*), imsiz=imsiz, hk=frames(*,0), $ cpsuncen, data=data, imsiz=imsiz, hk=frames(*,0), $ donorth=passnorth, dodisk=passdisk, doradii=passradii, $ doradial=passradial, colo=-1, ruletimes=4, $ rulecondition=passrulecon, housekp=frames(235,0)/100., $ sin_mov=1, norm_diff=frames(234,0), $ x_siz=frames(236,0)/100., y_siz=frames(237,0)/100. ; normalize endif ;10/93 cpinteranimate, frame=index, window=!d.window XINTERANIMATE, frame=index, window=!d.window endfor cprsun = savcprsun & savcprsun = 0 cptheta = savcptheta & savcptheta = 0 ;10/93 cpinteranimate, 50, group=group ; run whole movie XINTERANIMATE, 50, group=group ; run whole movie free_lun,unit ; if n_elements(save_cur_norm_diff) ne 0 then norm_diff = save_cur_norm_diff SKIPIT: w=0b on_ioerror, null endif else begin ; create movie from scratch for j = 0, norm_diff do begin ; loop once if normal, twice for difference if norm_diff eq 0 then worklist = movifile $ ; normal image else if j eq 0 then worklist = movidiff1 $ ; difference base else worklist = movidiff2 ; difference sub delim = where( (byte(worklist) eq 35), obs) ; where are '#' delimeters obs = obs-1 ; only an estimate of true # of files ; because wildcard may be present if obs eq 0 then begin ; no files entered widget_control, news, set_value=worklist, /append widget_control, movbase, sensitive=1 return endif reduce = 0 ; invalid file counter frame = 0 ; frame counter, includes "*" n_files=strarr(obs)+'*' & cursiz=obs ; starting size value, may change ; with wildcards or failures for i = 0, obs-1 do begin ; for each user input fname = strmid(worklist, delim(i)+1, delim(i+1)-delim(i)-1) ; get an input find = findfile(fname, count=cnt) ; get file(s) wildone = strpos(fname, '*') > strpos(fname, '%') > strpos(fname, '?') if wildone lt 0 then begin ; no wildcard in filename if cnt ne 0 then n_files(frame) = fname $ ; file exists else widget_control, news, set_value='No file '+fname, /append frame=frame+1 ; increment whether good or not endif else begin ; wildcard in this input (only happens if norm_diff=0, not differences) ; so need to make more room in array if cnt eq 0 then begin ; no files found widget_control, news, set_value='No wildcard files '+fname, /append frame = frame + 1 ; need a place holder if a diff., ; later the corressponding diff ; will be thrown away too. endif cnt = cnt - 1 ; already holding one place in array ; for the first file of the wild ones if cnt ge 1 then begin ; more than 1 file, so original estimate for N_FILE increases cursiz = cursiz+cnt & tmp = n_files ; save originals n_files = strarr(cursiz) + '*' ; new array, bigger size n_files(0) = tmp ; reassign originals endif for k = 0,cnt do begin ; for each file with wildcard designation n_files(frame) = find(k) widget_control, news, set_value='Wildcard file '+find(k), /append frame = frame + 1 endfor endelse endfor ; N_FILES holds files user wants to movie, "*" in place of files that failed if norm_diff eq 0 then normfile = n_files $ ; normal image else if j eq 0 then diff1 = n_files else diff2 = n_files ; difference endfor ; now get rid of "*" entries, if "*" occurs with difference images kill both if norm_diff eq 0 then begin ; normal image goodfil = where(normfile ne '*',nfiles) ; where are good files if nfiles le 1 then begin ; 1 or fewer valid data files widget_control, news, $ set_value='Must have at least two files to movie', /append widget_control, movbase, sensitive=1 return endif normfile = normfile(goodfil) ; only the good files diff1 = strarr(nfiles) & diff2 = strarr(nfiles) ; dummy arrays endif else begin ; difference image ndif1 = size(diff1) & ndif1 = ndif1(1) ; size of array ndif2 = size(diff2) & ndif2 = ndif2(1) ; size of array limit = min([ndif1, ndif2]) ; min of arrays tmp1 = strarr(limit) & tmp2 = strarr(limit) nfiles = 0 ; good file counter for i = 0, limit-1 do $ if diff1(i) ne '*' and diff2(i) ne '*' then begin ; both are good tmp1(nfiles) = diff1(i) & tmp2(nfiles) = diff2(i) ; assign good nfiles = nfiles + 1 endif if nfiles le 1 then begin ; 1 or fewer valid data files widget_control, news, $ set_value='Must have at least two pairs of files to movie', /append widget_control, movbase, sensitive=1 return endif diff1 = tmp1(0:nfiles-1) & diff2 = tmp2(0:nfiles-1) ; only good normfile = strarr(nfiles) ; dummy array endelse if saveme then begin ; while showing the movie WRITE to a file getname = widget_base(title='Name the C/P movie', /column, space=20, $ xpad=30, ypad=30) lab = widget_label(getname, value='Enter a movie name with ' + $ 'extension ".MOV" and hit RETURN') lab = widget_label(getname, value='To cancel click in text box and '+$ 'RETURN without entering a value') getit = widget_text(getname, /editable, /scroll, uvalue='SAVNAME') widget_control, getname, /realize xmanager, 'skipcpmovie_do', getname, event_handler='cpmovie_ev', $ group_leader=group, /modal widget_control, movbase, sensitive=0 ; xmanager unmodals these widget_control, base, sensitive=0 ; but no user input yet openw, unit, savename, imsiz, /get_lun, error=error ; open move save file if error eq 0 then w = assoc(unit, bytarr(imsiz,imsiz+2)) $ ; add 2 headers else begin ; could not open file for some reason saveme=0 widget_control, mode(0), /set_button widget_control, mode(1), set_button=0 widget_control, news, set_value='Not saving this movie' endelse endif if norm_diff eq 0 then xsiz = imsiz + 152 else xsiz = imsiz + (152*2) ;10/93 cpinteranimate, set= [xsiz, imsiz, nfiles], /showload XINTERANIMATE, set= [xsiz, imsiz, nfiles], /showload cwin = !d.window for i = 0,nfiles-1 do begin filename=normfile(i) & diffname1=diff1(i) & diffname2=diff2(i) cpdisplay, norm_diff=norm_diff, donorth=donorth, $ dodisk=dodisk, doradii=doradii, doradial=doradial, $ ruletimes=ruletimes, rulecondition=rulecondition, $ posfac=posfac, negfac=negfac, sin_mov=sin_mov, $ processed=processed, saveme=saveme, wmovie=w, $ nfiles=nfiles, ok=ok if n_elements(ok) ne 0 then begin ; it returned without adding a frame if not(ok) then begin ; so fill in with a blank erase ;10/93 cpinteranimate, frame=processed, window=!d.window ; load blank XINTERANIMATE, frame=processed, window=!d.window ; load blank processed = processed + 1 ; returned before could increment if saveme then w(processed)=bytarr(imsiz,imsiz+2) mes = 'Proccessed blank frame ' + strtrim(processed,2) + ': ' if norm_diff eq 0 then mes = 'Bad ' + filename $ else mes = 'Bad ' + diffname1 + ' sub ' + diffname2 widget_control, news, set_value= mes, /append endif endif endfor ;10/93 cpinteranimate, 50, group=group XINTERANIMATE, 50, group=group if saveme then begin free_lun,unit & w=0b widget_control, news, set_value='Saved movie file ' + savename,/append endif processed = 0 ; reset processed frames counter endelse ; end of create movie from scratch widget_control, movbase, sensitive=1 ; input allowed again widget_control, base, sensitive=1 ; input allowed again end ;========================================================================== ;+ ; ; NAME: ; CPMOVIE_EV ; ; PURPOSE: ; The event handler for movie menu widget ; ; CATEGORY: ; CP display ; ; CALLING SEQUENCE: ; CPMOVIE_EV, EV ; ; CALLED BY: ; CPMOVIE (via XMANAGER), CPMOVIE_DO ; ; CALLS TO: ; XLOADCT, XPALETTE ; ; INPUT: ; EV: the event structure, variable depending on type of item selected ; also, values in commons ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none explicit, only through commons ; ; OPTIONAL OUTPUTS: ; none ; ; COMMON BLOCKS: ; COLORS to change R_CURR, G_CURR, B_CURR to desired table ; CPCOLORS to load CP color tables ; CPMOV_DIR for widget ID for filename list(s) ; CPKEYWORDS for current options conditions ; CPMOVIDISPLAY for movie filenames, etc. ; CPMOVIETIME for saving a moving ; CPWIDGBASES for the widget IDs of parents and informational widgets ; ; SIDE EFFECTS: ; Changes may be may to the current color table. ; ; RESTRICTIONS: ; none ; ; PROCEDURE: ; Process the events from the movie menu widget. Continue recieving ; events until "Ready" is clicked, thus sending control to CPMOVIE_DO. ; Or until "Cancel" is click, returning control to the main options menu. ; ; MODIFICATION HISTORY: ; 1991 - Elaine Einfalt (HSTX) ; ;- pro cpmovie_ev, ev @cpcolors.common @cpkeywords.common @cpmov_dir.common @cpmovidisplay.common @cpmovietime.common @cpwidgbases.common common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr widget_control, ev.id, get_uvalue=input if n_elements(input) eq 0 then input = '' type = strmid(tag_names(ev, /structure_name),7,1000) case type of 'BUTTON' : case input of 'MOVKILL' : begin widget_control, ev.top, /destroy ; kill current widget widget_control, base, sensitive=1 ; because Xmanager un-modals it movfram=0 & framdiff1=0 & framdiff2=0 ; reset frame count end 'RESTABLEM': if ev.select ne 0 then begin colreset=1 ; in future use appropriate color if not(norm_diff) then begin ; norm image is shown r_curr=norm_r & g_curr=norm_g & b_curr=norm_b endif else begin ; diff image is shown r_curr=diff_r & g_curr=diff_g & b_curr=diff_b endelse tvlct, r_curr, g_curr, b_curr ; load this table endif 'RESTABBWM': if ev.select ne 0 then begin colreset=0 ; use this colors r_curr=norm_r & g_curr=norm_g & b_curr=norm_b tvlct, r_curr, g_curr, b_curr ; load this table endif 'RESTABDFM': if ev.select ne 0 then begin colreset=0 ; use this colors r_curr=diff_r & g_curr=diff_g & b_curr=diff_b tvlct, r_curr, g_curr, b_curr ; load this table endif 'IDLXLDCTM': if ev.select ne 0 then begin colreset=0 ; don't use CP standard colors xloadct endif 'IDLPALETM': if ev.select ne 0 then begin colreset=0 ; don't use CP standard colors xpalette endif 'RUNMOVI' : begin if already then begin ; don't save a movie that is already on disk widget_control, mode(0), /set_button widget_control, mode(1), set_button=0 saveme = 0 endif cpmovie_do, group_leader=ev.top movifile = 'No_file_entered #' ; clear for next movie movidiff1 = 'No_file_entered #' movidiff2 = 'No_file_entered #' already = 0 & saveme=0 & savename='' widget_control, mode(0), /set_button widget_control, mode(1), set_button=0 movfram=0 & framdiff1=0 & framdiff2=0 ; initial movie frame count end 'NORMMODE' : if ev.select eq 0 then begin ; turning off normmode saveme=1 ; so must want save widget_control, mode(1), /set_button endif else saveme=0 ; not saving a movie 'SAVEMODE' : if ev.select eq 0 then begin ; turning off savemode saveme=0 ; so must want norm widget_control, mode(0), /set_button endif else saveme=1 ; saving a movie else : widget_control, news, set_value='Invalid BUTTON value in '+$ 'CPMOVIE: ' + input, /append endcase 'TEXT' : begin ; manual input by the user widget_control, ev.id, get_value=value, set_value='' wild = strpos(value(0),'*') > strpos(value(0),'%') $ > strpos(value(0),'?') ; any wildcards if wild ge 0 and norm_diff eq 1 then begin ; yes wildcard, yes difference widget_control, news, set_value='Invalid to difference with wildcard '+$ value(0), /append return endif case input of 'MOVFILE' : begin ; normal images are to be movied if strpos(strupcase(value(0)), '.MOV') ge 0 then begin movifile = 'MO_VIE' ; movies are exclusive movfram=0 & already=1 widget_control, news, set_value='Resetting frames due to ' + $ 'presense of already created movie', /append endif else already = 0 movifile = movifile + value(0) ; add to filename string if not(already) then movifile = movifile + '#' movfram = movfram + 1 ; user input frame count sframe = 'Entered (frame ' + strtrim(movfram,2) + ') : ' + value(0) end 'MOVNAM1' : begin ; the base difference images to be movied if strpos(strupcase(value(0)), 'MOV') ge 0 then begin widget_control, news, set_value='Invalid to select already ' +$ 'created movies in difference mode', /append return endif movidiff1 = movidiff1 + value(0) + '#' ; add to filename string framdiff1 = framdiff1 + 1 ; user input frame count sframe = 'Base entered (frame ' + strtrim(framdiff1,2) + ') : ' + $ value(0) end 'MOVNAM2' : begin ; the subtraction image to be movied if strpos(strupcase(value(0)), 'MOV') ge 0 then begin widget_control, news, set_value='Invalid to select already ' +$ 'created movies in difference mode', /append return endif movidiff2 = movidiff2 + value(0) + '#' framdiff2 = framdiff2 + 1 ; user input frame count sframe = 'Subtraction entered (frame ' + strtrim(framdiff2,2) + $ ') : '+value(0) end 'SAVNAME' : begin ; when saving a movie to enter filename savename = strupcase(strtrim(value(0),2)) if (savename eq '') or $ (strpos(savename, '.MOV') lt 0 ) then saveme=0 if saveme then sframe = 'Movie save name is '+ savename $ else begin sframe = 'Not saving this movie' widget_control, mode(0), /set_button widget_control, mode(1), set_button=0 endelse widget_control, getname, /destroy end else : sframe = 'Invalid TEXT value in CPMOVIE: ' + input endcase widget_control, news, set_value=sframe, /append ; message output to widget end 'LIST' : begin ; user input from the list of files value=input(ev.index) & myvalue = strmid(value,0,7) value = strmid(value,7,strlen(value)) case myvalue of 'ALREADY' : begin ; picked an already created movie movfram=0 if not(saveme) then begin ; user is just showing it movifile = 'MO_VIE' + value already = 1 mess = 'Selected an existing movie ' + value endif else begin mess = 'Invalid to save an already created ' + $ 'movie as a frame' movifile = 'No_file_entered #' endelse end ; Getting the list of files in selected subdirectory ; 'DIRLIST': subdirectory list when normal image ; 'DIR1LIS': subdirectory list for base image when differencing ; 'DIR2LIS': subdirectory list for substraction when differencing 'DIRLIST' : begin if strpos(value, 'MO_VIE') ge 0 then begin tagname = 'ALREADY' ; get all file in movie subdir. s0 = findfile(value + '*.*', count=count1) ; all .MOV files in current dir s1 = findfile('*.MOV', count=count2) case 1 of ; combine result of both dir count1 ne 0 and count2 ne 0 : list = [s0, s1] ; both count1 eq 0 and count2 eq 0 : list = 'No data files on ' + dataplace count1 eq 0 : list = s1 ; count2 only else : list = s0 ; count1 endcase endif else begin list = findfile(value + '*.*') ; get files in subdir. tagname = 'MOVILIS' endelse ;e list = findfile(value + '*.*') ; get files in subdir. if list(0) ne '' then begin ; show this subdir. files ;e if strpos(value, 'MO_VIE') ge 0 then tagname = 'ALREADY' $ ;e else tagname = 'MOVILIS' widget_control, movall2, sensitive=1, $ set_value=list, set_uvalue=tagname+list mess = 'Files: ' + value + '*.* and current directory *.mov' endif else begin widget_control, movall2, sensitive=0, $ set_value=' No files in subdirectory' movifile = 'no_file_entered #' mess = 'No files ' + value + '*.*' endelse end 'DIR1LIS' : begin if strpos(value, 'MO_VIE') ge 0 then begin widget_control, news, set_value='Invalid to select already ' +$ 'created movies in difference mode', /append return endif list = findfile(value + '*.*') ; get files in subdir if list(0) ne '' then begin ; show this subdir. files widget_control, movall2, sensitive=1, $ set_value=list, set_uvalue='FRSTMOV'+list mess = 'Files: ' + value + '*.*' endif else begin widget_control, movall2, sensitive=0, $ set_value=' No files in subdirectory' movidiff1 = 'no_file_entered #' mess = 'No files ' + value + '*.*' endelse end 'DIR2LIS' : begin if strpos(value, 'MO_VIE') ge 0 then begin widget_control, news, set_value='Invalid to select already ' +$ 'created movies in difference mode', /append return endif list = findfile(value + '*.*') ; get files in subdir if list(0) ne '' then begin ; show this subdir. files widget_control, movall4, sensitive=1, $ set_value=list, set_uvalue='SECNMOV'+list mess = 'Files: ' + value + '*.*' endif else begin widget_control, movall4, sensitive=0, $ set_value=' No files in subdirectory' movidiff2 = 'no_file_entered #' mess = 'No files ' + value + '*.*' endelse end ; Getting the individual filenames that will be the movie frames ; 'MOVILIS' : when normal image ; 'FRSTMOV' : base image when differencing ; 'SECNMOV' : substraction when differencing 'MOVILIS' : begin if strpos(movifile, 'MO_VIE') ge 0 then begin ; movie are exclusive movifile = 'No_file_entered #' ; so reset movfram=0 widget_control, news, set_value='Resetting frames due to ' + $ 'presense of already created movie', /append endif else already = 0 movifile = movifile + value + '#' movfram = movfram + 1 ; user input frame count mess ='Selected (frame ' + strtrim(movfram,2) + ') : ' + value(0) end 'FRSTMOV' : begin if strpos(movifile, 'MO_VIE') ge 0 then begin ; user is trying to movifile = 'No_file_entered #' ; mix, so reset movfram=0 widget_control, news, set_value='Resetting frames due to ' + $ 'presense of already created movie', /append endif else already = 0 movidiff1 = movidiff1 + value + '#' framdiff1 = framdiff1 + 1 ; user input frame count mess = 'Base selected (frame ' + strtrim(framdiff1,2) + ') : ' + $ value(0) end 'SECNMOV' : begin if strpos(movifile, 'MO_VIE') ge 0 then begin ; user is trying to movifile = 'No_file_entered #' ; mix, so reset movfram=0 widget_control, news, set_value='Resetting frames due to ' + $ 'presense of already created movie', /append endif else already = 0 movidiff2 = movidiff2 + value + '#' framdiff2 = framdiff2 + 1 ; user input frame count mess = 'Subtraction selected (frame ' + $ strtrim(framdiff2,2) + ') : ' + value(0) end else : mess = 'Invalid type of LIST in CPMOVIE: '+ myvalue endcase widget_control, news, set_value=mess, /append ; message output to widget end endcase end ;=========================================================================== ;+ ; ; NAME: ; CPMOVIE ; ; PURPOSE: ; Create the movie menu widget ; ; CATEGORY: ; CP display ; ; CALLING SEQUENCE: ; CPMOVIE, GROUP_LEADER=GROUP ; ; CALLED BY: ; CP.PRO ; ; CALLS TO: ; ACKNOWLEDGE, XPDMENU, XMENU, CPMOVIE_EV (via XMANAGER) ; ; INPUTS: ; GROUP : The widget ID of the parent widget. ; also, values in commons ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none explicit, only through commons ; ; OPTIONAL OUTPUTS: ; none ; ; COMMON BLOCKS: ; CPMOV_DIR for widget ID of save buttons ; CPLOGIC_ENVRON for location of data ; CPMOVIDISPLAY for movie filenames, etc. ; CPKEYWORDS for current options conditions ; CPWIDGBASES for the widget IDs of parents and informational ; ; SIDE EFFECTS: ; none ; ; RESTRICTIONS: ; none ; ; PROCEDURE: ; Create the movie menu widget and populate the list widgets ; with subdirectories of CP data. ; ; MODIFICATION HISTORY: ; 1991 - Elaine Einfalt (HSTX) ; ;- pro cpmovie, group_leader=group @cpkeywords.common @cplogic_envron.common @cpmov_dir.common @cpmovidisplay.common @cpwidgbases.common ; Because want to be able to change option there is no /modal ; but still only want one at a time if xregistered('cpone') then begin ; currently have cpone mess = (['Cancel the active ', $ '"Display one image"', $ 'Only one widget of this', $ 'class allow at one time.']) acknowledge, message=mess return endif else if xregistered('cpmovie') then begin ; currently have cpmovie mess = (['You already have an active ', $ '"Create a movie" ']) acknowledge, message=mess return endif movifile = 'No_file_entered #' ; initial with non-null movidiff1 = 'No_file_entered #' movidiff2 = 'No_file_entered #' already = 0 & saveme=0 movfram=0 & framdiff1=0 & framdiff2=0 ; initial movie frame count ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; IDL handles findfile differently for VMS and ULTRIX ; We want the subdirectories (usually one per day) that contain the data ; The user will select desired day, and later select specific observation. ; Add some stuff (you know...stuff) to make life easier later ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; case !version.os of ; get subdirectories and prepare path name 'vms' : begin ; will need to contruct subdirectory name dirlist = findfile(dataplace + '*.dir') ; must be specific dirend = strpos(dirlist(0), ']') ; end of parent ; directory name dirlist = strmid(dirlist, 0, dirend) + '.' + $ strmid(dirlist, dirend+1, 6) +']' end 'ultrix' : begin dirlist = findfile(dataplace) ; can't be specific dirlist = dataplace + dirlist + '/' ; because unix findfile ; doesn't return full ; name in the array end 'IRIX' : begin dirlist = findfile(dataplace) ; can't be specific dirlist = dataplace + dirlist + '/' ; because unix findfile ; doesn't return full ; name in the array end else : dirlist = '' endcase ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Make widget which allows user to pick image using scroll or editable text ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mainbase_m = widget_base(title='Create a C/P movie', space=10,$ /column, xpad=20, ypad=20) movbase = widget_base(mainbase_m, /column) if not(norm_diff) then $ movdirec = widget_label(movbase, value='Select movie frames or already ' + $ 'created movie and click RUN') $ else movdirec = widget_label(movbase, value='Select movie frames and ' + $ 'click RUN') ; ; the program controls (RUN, COLOR, SAVE and CANCEL) ; mcontrl = widget_base(movbase, /row, space=20) mready = widget_button(mcontrl, value='Run movie', uvalue='RUNMOVI') xpdmenu, ['"Adjust color palette" {', $ '"Use appropriate C/P color table" RESTABLEM', $ '"Use C/P black/white color table" RESTABBWM', $ '"Use C/P difference color table" RESTABDFM', $ '"Use IDL Palette to create table (xpalette)" IDLPALETM', $ '"Use User''s Library color tables (xloadct)" IDLXLDCTM', '}']$ , mcontrl xmenu, ['Normal mode', 'Save mode'], mcontrl, /column, /exclusive, /frame,$ buttons=mode, uvalue=['NORMMODE', 'SAVEMODE'] mcanit = widget_button(mcontrl, value='Cancel', uvalue='MOVKILL') ; ; Displays the subdirectories then displays the files in selected subdirectory ; one column if normal image two if a difference ; if not(norm_diff) then getwidg = movbase $ ; one image else begin ; difference needed two images scroll = widget_base(movbase, /frame, /row, space=10 ) getwidg = scroll endelse if dirlist(0) ne '' then begin ; there are files there ; widgets to deal with normal one images or the base image of differences first = widget_base(getwidg, /column, /frame, space=10, xsize=425) if not(norm_diff) $ then inst='Click on desired subdirectory then on desired file.' $ else inst='Click on desired base subdirectory then on desired file.' lab = widget_label(first, value=inst) subd = widget_base(first, /column, /frame, space=10) ; if not(norm_diff) then inst='Click on desired subdirectory' $ ; else inst='Click on desired base subdirectory' ; lab = widget_label(subd, value=inst) if not(norm_diff) then pref='DIRLIST' + dirlist $ else pref='DIR1LIS' + dirlist movall = widget_list(subd, ysize=4, value=dirlist, uvalue=pref) snames = widget_base(first, /frame, /column, space=10) ; lab = widget_label(snames, value='Click on desired filename') if not(norm_diff) then load='MOVILISno_filename' $ else load='FRSTMOVno_filename' movall2 = widget_list(snames, ysize=10, uvalue=load, $ value='Select subdirectory first') widget_control, movall2, sensitive=0 ; no files until subdirectory movman = widget_base(first, /column, /frame, space=10) if not(norm_diff) then mess='You may enter data filename or ' + $ 'wildcard designation' $ else mess='You may enter base filename' lab = widget_label(movman, value=mess) if not(norm_diff) then lnam='MOVFILE' $ else lnam='MOVNAM1' mfiledes1 = widget_text(movman, /editable, uvalue=lnam, /scroll) if norm_diff then begin ; include the subtraction image info, not present for normal images secon = widget_base(getwidg, /column, /frame, space=10, xsize=425) lab = widget_label(secon, value='Click on subtraction '+$ 'image subdirectory then on desired file.') subd2 = widget_base(secon, /column, /frame, space=10) ; lab = widget_label(subd2, value='Click on subtraction '+$ ; 'image subdirectory then file name') movall3 = widget_list(subd2, ysize=4, value=dirlist, $ uvalue='DIR2LIS'+dirlist) snames2 = widget_base(secon, /frame, /column, space=10) ; lab = widget_label(snames2, value ='Click on desired filename') movall4 = widget_list(snames2, ysize=10, uvalue='SECNMOVno_filename', $ value='Select subdirectory first') widget_control, movall4, sensitive=0 ; no files until subdir movman = widget_base(secon, /column, /frame, space=10) movman2 = widget_label(movman, value='You may enter ' + $ 'subtraction filename') mfiledes2 = widget_text(movman, /editable, /scroll, $ uvalue='MOVNAM2') endif endif else $ ; there were no subdirectories mjunk = widget_label(getwidg, value='No ' + dataplace + 'subdirectories') ; the program commentary movinform = widget_base(mainbase_m, /frame, /column) ; movdesc = widget_label(movinform, value='Informational comments') news = widget_text(movinform, /scroll, ysize=5) widget_control, movbase, /realize widget_control, mode(0), /set_button widget_control, group, sensitive=1 ; give user back main option control widget_control, news, set_value='Program comments will be displayed here.' xmanager, 'cpmovie', mainbase_m, event_handler='cpmovie_ev', $ group_leader=group return end