[2] | 1 | ;+ |
---|
| 2 | ; |
---|
[238] | 3 | ; @file_comments |
---|
[325] | 4 | ; Kind of UNDO: |
---|
| 5 | ; Allows to redo all the chain of drawing since the opening of the last window |
---|
| 6 | ; without reexecute the last order |
---|
[2] | 7 | ; |
---|
[325] | 8 | ; Example: I do a drawing with 10 plot over it, if I make a |
---|
| 9 | ; mistake, I execute this program and I can redo the only plot missed. |
---|
| 10 | ; |
---|
[238] | 11 | ; @categories |
---|
[150] | 12 | ; utilities |
---|
[2] | 13 | ; |
---|
[238] | 14 | ; @restrictions |
---|
| 15 | ; compatible with \@<pro>ps</pro> |
---|
[237] | 16 | ; \@<pro>vzoom</pro> text_box... |
---|
[2] | 17 | ; |
---|
[238] | 18 | ; @history |
---|
[157] | 19 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[2] | 20 | ; |
---|
[238] | 21 | ; @version |
---|
[150] | 22 | ; $Id$ |
---|
[2] | 23 | ; |
---|
[238] | 24 | ; @todo |
---|
[150] | 25 | ; seb |
---|
[2] | 26 | ; |
---|
| 27 | ;- |
---|
[325] | 28 | ; Close the journal! |
---|
| 29 | journal |
---|
[237] | 30 | ; |
---|
[133] | 31 | ; we recuperate the journal as a vector of string: |
---|
[11] | 32 | vectjournal = getfile(myuniquetmpdir+'idlsave.pro') |
---|
[133] | 33 | ; we cut the last line which is oups |
---|
[2] | 34 | vectjournal = vectjournal[0:n_elements(vectjournal)-2 ] |
---|
| 35 | ;------------------------------------------------------------ |
---|
[133] | 36 | ; we correct it if there is the need... |
---|
[2] | 37 | ;------------------------------------------------------------ |
---|
| 38 | for i = 0, n_elements(vectjournal)-1 do $ |
---|
| 39 | if strpos(vectjournal[i],'text_box' ) EQ -1 then $ |
---|
| 40 | vectjournal[i] = strtrim(strcompress(vectjournal[i]), 2) |
---|
[133] | 41 | ;2 line are identical ?? |
---|
[2] | 42 | for i = 0, n_elements(vectjournal)-2 do $ |
---|
| 43 | if vectjournal[i] EQ vectjournal[i+1] then vectjournal[i] = ' ' |
---|
| 44 | |
---|
| 45 | for i = 0, n_elements(vectjournal)-1 do BEGIN & $ |
---|
| 46 | if strpos(vectjournal[i],'oups' ) NE -1 $ |
---|
| 47 | OR strpos(vectjournal[i],'Syntax error' ) NE -1 $ |
---|
| 48 | OR strpos(vectjournal[i],'Illegal character' ) NE -1 $ |
---|
| 49 | then BEGIN vectjournal[i] = ' ' & vectjournal[i-1] = ' ' & endif & $ |
---|
| 50 | if strpos(strtrim(vectjournal[i], 1),'retall' ) EQ 0 $ |
---|
| 51 | OR strpos(vectjournal[i],'@oups' ) NE -1 $ |
---|
| 52 | OR strpos(vectjournal[i],'@ps' ) NE -1 $ |
---|
| 53 | OR strpos(vectjournal[i],'@vzoom' ) NE -1 $ |
---|
| 54 | OR strpos(vectjournal[i],'help' ) NE -1 $ |
---|
| 55 | OR strpos(vectjournal[i],'print' ) NE -1 $ |
---|
| 56 | then vectjournal[i] = ' ' & $ |
---|
| 57 | if strpos(vectjournal[i],'text_box' ) NE -1 then $ |
---|
| 58 | vectjournal[i] = vectjournal[i]+strmid(vectjournal[i+1], 1) & endfor |
---|
| 59 | ; |
---|
[297] | 60 | ; we erase the last line to reexecute all the program but the last order. |
---|
[2] | 61 | ; |
---|
| 62 | IF strpos(vectjournal[n_elements(vectjournal)-1],';,pos=[' ) NE -1 then $ |
---|
| 63 | vectjournal[n_elements(vectjournal)-2] = '' $ |
---|
[238] | 64 | ELSE vectjournal[n_elements(vectjournal)-1] = '' |
---|
[133] | 65 | ; we rewrite idlsave.pro |
---|
[229] | 66 | putfile, myuniquetmpdir+'idlsave.pro', vectjournal |
---|
| 67 | ; update the list of .pro and .sav in !PATH |
---|
| 68 | path_cache, /rebuild |
---|
| 69 | ; apply idlsave |
---|
[238] | 70 | @idlsave |
---|
| 71 | ; the journal has just been reopened, and we put elements of vectjournal in it. |
---|
[2] | 72 | for i = 0, n_elements(vectjournal)-1 DO $ |
---|
[11] | 73 | journal, vectjournal[i] |
---|