PRO qImage_cw_ctable, state, img_box=img_box, tool_state=tool_state ;+ ; NAME: ; qImage_cw_ctable ; PURPOSE: ; Change color table used in draw widget ; CATEGORY: ; Compound widget qImage_cw ; CALLING SEQUENCE: ; qImage_cw_ctable, state ; INPUTS: ; state scalar, structure ; contains IDs for all qView widgets ; OUTPUTS: ; INCLUDE: @compile_opt.pro ; On error, return to caller ; PROCEDURE: ; MODIFICATION HISTORY: ; MAY-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- IF widget_info(state.wid_draw_wrap, /valid_id) THEN BEGIN wold = !d.window ; Remember the old window number widget_control, state.wid_draw, get_value=wnew ; Get the window number of the draw widget IF wold NE wnew THEN wset, wnew ; Switch to draw widget true_color = !d.n_colors GT 256 have_state = IsType(tool_state,/defined) IF NOT have_state THEN widget_control, state.wid_tool, get_uvalue=tool_state, /no_copy loadct, tool_state.send.ctable, /silent CASE IsType(img_box,/defined) OF 0: img_box = *tool_state.img_box 1: *tool_state.img_box = img_box ENDCASE IF NOT have_state THEN widget_control, state.wid_tool, set_uvalue=tool_state, /no_copy IF true_color THEN BEGIN tvlct, /get, r, g, b img_box = [[[r[img_box]]],[[g[img_box]]],[[b[img_box]]]] ;loadct, 0, /silent ENDIF tv, img_box, true=3*true_color IF wold NE wnew THEN wset, wold ; Restore the old window number ENDIF RETURN & END