; $Id: xspiro.pro,v 1.1 1993/04/02 19:57:52 idl Exp $ ; Copyright (c) 1991-1993, Research Systems, Inc. All rights reserved. ; Unauthorized reproduction prohibited. ;+ ; NAME: ; XSPIRO ; PURPOSE: ; A Widget front end to the SPIRO procedure to draw ; "Spirograph" (TM) patterns ; CATEGORY: ; demo, widgets ; CALLING SEQUENCE: ; XSPIRO ; OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; Uses a widget based interface to allow dynamic manipulation of ; "Spirograph" patterns. ; RESTRICTIONS: ; None. ; MODIFICATION HISTORY: ; 13, December, 1990, A.B. ; ;- ; The init and event procedures use the following uvalue codes ; to communicate intentions: ; ; 0 - Line style button group. LS # is in the event value (0-5) ; 1 - Done ; 2 - Reset ; 3 - Outer Ring ; 4 - Inner Ring ; 5 - Distance ; 6 - Color pro xspiro_event, ev COMMON xspiro_com, base, sr_w, rr_w, dist_w, draw_win, c_w, $ sr, rr, dist, color, linestyle, ls_base WIDGET_CONTROL, ev.id, get_uvalue=uval case (uval) of 0: linestyle = ev.value 1: begin WIDGET_CONTROL, /DESTROY, base goto, done end 2: begin sr = 23 rr = 17 dist = 11 color = !p.color linestyle = 0 WIDGET_CONTROL, sr_w, set_value=sr WIDGET_CONTROL, rr_w, set_value=rr WIDGET_CONTROL, dist_w, set_value=dist WIDGET_CONTROL, ls_base, set_button=0 WIDGET_CONTROL, ls_base, set_value=0 WIDGET_CONTROL, c_w, set_value=color end 3: sr = ev.value 4: rr = ev.value 5: dist = ev.value 6: begin color = ev.value WIDGET_CONTROL, c_w, set_value=color end endcase cur_win = !d.window wset, draw_win spiro, sr, rr, dist, color=color, linestyle=linestyle if (cur_win ne -1) then wset, cur_win done: end pro xspiro, GROUP = GROUP COMMON xspiro_com, base, sr_w, rr_w, dist_w, draw_win, c_w, $ sr, rr, dist, color, linestyle, ls_base if (XREGISTERED('XSPIRO')) then return ; Only one copy at a time lstyles = ['Solid', 'Dotted', 'Dashed', 'Dash Dot', $ 'Dash Dot Dot Dot', 'Long Dashes' ] sr = 23 rr = 17 dist = 11 linestyle = !p.linestyle base = widget_base(/column, title='XSpiro') draw_w = widget_draw(base, xsize=256, ysize=256, /frame) c_base = widget_base(base, /ROW) c_base_1 = widget_base(c_base, /COLUMN, space=50) done_w = widget_button(c_base_1,value='Done', uvalue=1) reset_w = widget_button(c_base_1,value='Reset', uvalue=2) ls_base = CW_BGROUP(c_base, lstyles, /column, /exclusive, set_value=0, $ UVALUE=0, /NO_RELEASE, label_top = "Line Style") c_base_3 = widget_base(base, /column, xsize= 256) sr_w = widget_slider(c_base_3, title='Stable Radius', value=sr, $ /DRAG, uvalue=3) rr_w = widget_slider(c_base_3, title='Rotating Radius', value = rr, $ /DRAG, uvalue=4) dist_w = widget_slider(c_base_3, title='Distance', value=dist, $ /DRAG, uvalue=5) c_w = widget_slider(c_base_3, title='Color Index', $ /DRAG, max = !d.table_size-1, uvalue=6) widget_control, /real, base widget_control, draw_w, get_value=draw_win color = !p.color widget_control, c_w, set_value = color cur_win = !d.window wset, draw_win spiro, sr, rr, dist, color=color, linestyle=linestyle if (cur_win ne -1) then wset, cur_win XMANAGER, 'XSPIRO', base, GROUP_LEADER = GROUP end