source: trunk/WIDGET/AUTOUR_de_XXX/widgetdessine.pro @ 2

Last change on this file since 2 was 2, checked in by opalod, 22 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5; NAME:widgetdessine
6;
7; PURPOSE: c'est la procedure qui lance le dessin. Si on ne le lui
8; donne pas de commande, elle appelle construitcommande pour savoir
9; quoi tracer.
10;
11; CATEGORY:
12;
13; CALLING SEQUENCE:widgetdessine, base
14;
15; INPUTS:base: l''id du widget ou appliquer le dessin
16;
17; KEYWORD PARAMETERS:
18;       COMMANDE: un string du style: read_data('sst'...),....
19;
20; OUTPUTS:
21;
22; COMMON BLOCKS:common.pro
23;
24; SIDE EFFECTS:
25;
26; RESTRICTIONS:
27;
28; EXAMPLE:
29;
30; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
31;
32;-
33;------------------------------------------------------------
34;------------------------------------------------------------
35;------------------------------------------------------------
36
37PRO widgetdessine, base, COMMANDE = commande, FORPLTH = forplth, FORPLTZ = forpltz, FORPLTT = forpltt, _extra = ex
38@common
39; on recupere la uvalue de base
40   widget_control,base, get_uvalue = top_uvalue
41; on determine quelle procedure on va etre appeler pour faire le dessin
42   procedure = top_uvalue.name
43   if keyword_set(forplth) then procedure = 'plt'
44   if keyword_set(forpltz) then procedure = 'pltz'
45   if keyword_set(forpltt) then procedure = 'pltt'
46; print, '*****************'
47; help,  top_uvalue, /struct
48; help,  top_uvalue.exextra, /struct
49   if NOT keyword_set(commande) then $
50    commande = construitcommande(base, FORPLTH = forplt, FORPLTZ = forpltz, FORPLTT = forpltt, _extra = ex)
51   widget_control,base, get_uvalue = top_uvalue
52; print, '*****************'
53; help,  top_uvalue, /struct
54; print, '***..........****'
55;  help,  top_uvalue.exextra, /struct
56;  help,  top_uvalue.extra, /struct
57; print, '-*-*-*-*-*-*-*-*-*'
58; print, commande
59; help,mixstru(top_uvalue.exextra,top_uvalue.extra), /struct
60;
61; on recuperel''id de la fenetre graphique associee au widget d''id base
62   widget_control,widget_info(base,find_by_uname = 'graph'),get_value=win
63; on la selectionne (c''est a elle que sera passe toutes les commandes
64; concernant une fenetre)
65   wset, win
66   erase, 255                       ; on netoie la fenetre
67; on s''assure que si on travaille avec un ecran codant les couleurs
68; sur 24 bits la couleur de fond specifiee!p.background est bien
69; appliquee
70   if !d.n_colors gt 256 then begin
71      device, decomposed=1
72      !p.background='ffffff'x
73      plot,[0],[0]
74      device, decomposed=0
75   ENDIF
76;
77; on execute la commande pour faire le dessin
78;
79   IF chkstru(top_uvalue, 'grille') THEN anciennegrille = top_uvalue.grille $
80   ELSE anciennegrille = 'T'
81   rien = execute(procedure+', '+Commande)
82;   if NOT rien then stop
83
84;
85; on va accualiser ;a stuture contenue ds la uvalue de base
86;
87; on doit determiner le type de dessin et eventuellement la nouvelle boite.
88   case procedure OF
89      'plt':type = 'xy'
90      'pltt':BEGIN
91         case 1 of
92            strpos(commande, '''xt''') NE -1:type = 'xt'
93            strpos(commande, '''yt''') NE -1:type = 'yt'
94            ELSE:type = 'unknow !'
95         endcase
96      END
97      'pltz':BEGIN
98         lastboite = rstrpos(commande, 'boite=')
99         ouvrepos = strpos(commande, '[', lastboite+1)
100         boite = strmid(commande,ouvrepos+1,strpos(commande, ']', lastboite+1)-ouvrepos-1)
101         boite = str_sep(boite, ',') & boite = long(boite)
102         if boite[1]-boite[0] LE boite[3]-boite[2] then type = 'yz' ELSE type = 'xz'
103      END
104   ENDCASE
105;
106; print, '&&&&&&&&&&&&&&&&&&&&&&&&'
107; help,  top_uvalue, /struct
108; help,   mixstru({name:procedure, commande:commande, penv:!p, xenv:!x, yenv:!y, type:type}, top_uvalue), /struct
109;
110;
111;
112   widget_control, base, set_uvalue = mixstru({name:procedure, commande:commande, penv:!p, xenv:!x, yenv:!y, type:type, grille:vargrid}, top_uvalue)
113; on change d''axe vertical ?
114   if vargrid NE anciennegrille then begin
115      widget_control, widget_info(base,  find_by_uname = 'domain'), get_value = value
116      widget_control, widget_info(base,  find_by_uname = 'domain'), set_value = value
117   endif
118
119; help,  top_uvalue.extra, /struct
120
121   return
122end
Note: See TracBrowser for help on using the repository browser.