Compile_opt idl2, hidden
pro handle_pagetitle_command, state, event, ind, format=format
if event.select then begin
state.pagesettings->GetProperty,title=title
title->GetProperty,value=value
case 1 of
~keyword_set(format): begin
tokenCommand= state.pagesettings->GetTokenCommand(ind)
value+=tokenCommand
end
else: begin
formatCommand= state.pagesettings->GetFormatCommand(ind)
value+=formatCommand
end
endcase
title->SetProperty,value=value
id=widget_info(state.tlb,find_by_uname='titletext')
widget_control,id,set_value=value
endif
end
PRO spd_ui_page_spacing_set_value, tlb, pagesettings, historywin, statusbar
compile_opt idl2, hidden
xid = widget_info(tlb, find_by_uname='xpanelspacing')
widget_control, xid, get_value = xspacing
yid = widget_info(tlb, find_by_uname='ypanelspacing')
widget_control, yid, get_value = yspacing
if (xspacing lt 0) or (yspacing lt 0) then begin
historywin->Update, "Panel spacing cannot be negative; value set to 0.", /dontshow
statusBar->Update, "Panel spacing cannot be negative; value set to 0."
messageString = 'Panel spacing cannot be negative; value set to 0.'
response=dialog_message(messageString,/CENTER)
if xspacing lt 0 then begin
xspacing = 0
widget_control,xid,set_value=0
endif
if yspacing lt 0 then begin
yspacing = 0
widget_control, yid, set_value=0
endif
endif else begin
historywin->Update, "Panel spacing set.", /dontshow
endelse
if in_set(finite([xspacing, yspacing]),0) then begin
statusBar->Update, 'Invalid panel spacing, value reset.'
historywin->Update, 'Invalid panel spacing, value reset.', /dontshow
messageString = 'Invalid panel spacing entered; value reset.'
response=dialog_message(messageString,/CENTER)
endif
pagesettings->getproperty, xpanelspacing=xps, ypanelspacing=yps
if (xspacing ge 0) && finite(xspacing) then pagesettings->SetProperty, xpanelspacing=xspacing $
else widget_control, xid, set_value=xps
if (yspacing ge 0) && finite(yspacing) then pagesettings->SetProperty, ypanelspacing=yspacing $
else widget_control, yid, set_value=yps
END
pro spd_ui_page_canvas_update, state, orient
compile_opt idl2, hidden
tlb = state.tlb
xid = widget_info(tlb, find_by_uname='xsize')
yid = widget_info(tlb, find_by_uname='ysize')
widget_control, xid, get_value=xsize
widget_control, yid, get_value=ysize
if (finite(xsize) && xsize gt 0) && (finite(ysize) && ysize gt 0) then begin
dims = [xsize < ysize, xsize > ysize]
if orient then dims = shift(dims,1)
widget_control, xid, set_value = dims[0]
widget_control, yid, set_value = dims[1]
endif else begin
state.info.historyWin->Update,'Invalid canvas size.', /dontshow
state.statusbar->Update,'Invalid canvas size.'
return
endelse
if orient then begin
state.info.historyWin->Update,'Orientation: Landscape.', /dontshow
state.statusbar->Update,'Orientation: Landscape.'
endif else begin
state.info.historyWin->Update,'Orientation: Portrait.', /dontshow
state.statusbar->Update,'Orientation: Portrait.'
endelse
end
PRO spd_ui_page_canvas_set_value, tlb, pagesettings, historywin, statusbar,drawObject,windowStorage
compile_opt idl2, hidden
id = widget_info(tlb, find_by_uname='landscape')
orientation = widget_info(id, /button_set)
xid = widget_info(tlb, find_by_uname='xsize')
yid = widget_info(tlb, find_by_uname='ysize')
widget_control, xid, get_value=xsize
widget_control, yid, get_value=ysize
if (xsize le 0 || ysize le 0) then begin
statusbar->Update, 'Canvas size cannot be less than or equal to zero. Value reset.'
historywin->update, 'Canvas size cannot be less than or equal to zero. Value reset.', /dontshow
messageString = 'Canvas size cannot be less than or equal to zero. Value reset.'
response=dialog_message(messageString,/CENTER)
endif
if in_set(finite([xsize, ysize]),0) then begin
statusBar->Update, 'Invalid canvas size, value reset.'
historywin->Update, 'Invalid canvas size, value reset.', /dontshow
messageString = 'Invalid canvas size entered; value reset.'
response=dialog_message(messageString,/CENTER)
endif
pageSettings->getProperty,canvasSize=oldsize
if ~finite(xsize) || xsize le 0 then begin
xsize=oldsize[0]
widget_control, xid, set_value=xsize
endif
if ~finite(ysize) || ysize le 0 then begin
ysize=oldsize[1]
widget_control, yid, set_value=ysize
endif
cz = drawObject->getZoom()
size_px = [xsize*2.54*!D.X_PX_CM,ysize*2.54*!D.Y_PX_CM]*cz
drawObject->getProperty, pointmax=pmaxres
if (size_px[0] gt pmaxres) then begin
xsize=oldsize[0]
widget_control, xid, set_value=xsize
statusBar->Update, 'Canvas size too large to render, value reset.'
historywin->Update, 'Canvas size too large to render, value reset.', /dontshow
messageString = 'Canvas size too large to render; value reset.'
response=dialog_message(messageString,/CENTER)
endif
if (size_px[1] gt pmaxres) then begin
ysize=oldsize[1]
widget_control, yid, set_value=ysize
statusBar->Update, 'Canvas size too large to render, value reset.'
historywin->Update, 'Canvas size too large to render, value reset.', /dontshow
messageString = 'Canvas size too large to render; value reset.'
response=dialog_message(messageString,/CENTER)
endif
pageSettings->setProperty,orientation=orientation,canvasSize=[xsize,ysize]
END
PRO spd_ui_page_margins_set_value, tlb, pagesettings,historywin,statusBar
compile_opt idl2, hidden
tid = widget_info(tlb, find_by_uname='tmargin')
widget_control, tid, get_value=top
bid = widget_info(tlb, find_by_uname='bmargin')
widget_control, bid, get_value=bottom
lid = widget_info(tlb, find_by_uname='lmargin')
widget_control, lid, get_value=left
rid = widget_info(tlb, find_by_uname='rmargin')
widget_control, rid, get_value=right
if (left lt 0) or (right lt 0) or (top lt 0) or (bottom lt 0) then begin
statusbar->Update, 'Page margin cannot be negative. Negative values set to 0.'
historywin->update, 'Page margin cannot be negative. Negative values set to 0.', /dontshow
messageString = 'Page margins cannot be negative; negative values set to 0.'
response=dialog_message(messageString,/CENTER)
if left lt 0 then begin
left = 0
widget_control, lid, set_value=0
endif
if right lt 0 then begin
right = 0
widget_control, rid, set_value=0
endif
if top lt 0 then begin
top = 0
widget_control, tid, set_value=0
endif
if bottom lt 0 then begin
bottom = 0
widget_control, bid, set_value=0
endif
endif else begin
historywin->update, 'Page margins set.', /dontshow
endelse
pagesettings->getproperty, leftprintmargin=l, rightprintmargin=r, topprintmargin=t, bottomprintmargin=b
if ~finite(left,/nan) && (left ge 0) then pagesettings->setproperty, leftprintmargin=left $
else widget_control, lid, set_value=l
if ~finite(right,/nan) && (right ge 0) then pagesettings->setproperty, rightprintmargin=right $
else widget_control, rid, set_value=r
if ~finite(top,/nan) && (top ge 0) then pagesettings->setproperty, topprintmargin=top $
else widget_control, tid, set_value=t
if ~finite(bottom,/nan) && (bottom ge 0) then pagesettings->setproperty, bottomprintmargin=bottom $
else widget_control, bid, set_value=b
if in_set(finite([left,right,top,bottom],/nan),1) then begin
statusBar->Update, 'Invalid page margin, value not applied.'
historywin->Update, 'Invalid page margin, value not applied.', /dontshow
messageString = 'Invalid page margins entered; values reset.'
response=dialog_message(messageString,/CENTER)
endif
return
END
pro spd_ui_page_title_set_value,tlb,pagesettings,historywin,statusBar
compile_opt idl2,hidden
pageSettings->getProperty,title=title
titletext = widget_info(tlb,find_by_uname='titletext')
widget_control,titletext,get_value=textvalue
title->setProperty,value=textvalue
historywin->update,'Set Title Text', /dontshow
title->setProperty,font=spd_ui_page_font_get_value(tlb,'titlecombo')
historywin->update,'Set Title Font', /dontshow
formatcombo = widget_info(tlb,find_by_uname='titleformat')
formattext = widget_info(formatcombo,/combobox_gettext)
widget_control,formatcombo,get_value=formatnames
idx = where(formattext eq formatnames)
title->setProperty,format=idx
showbutton = widget_info(tlb,find_by_uname='showtitle')
title->setProperty,show=widget_info(showbutton,/button_set)
historywin->update,'Set Title Show Flag', /dontshow
sizespinner = widget_info(tlb,find_by_uname='titlesize')
widget_control,sizespinner,get_value=val
if val lt 1 then begin
historywin->update,'Current font less than 1. Font size set to 1.', /dontshow
statusBar->update,'Current font less than 1. Font size set to 1.'
widget_control,sizespinner,set_value=1
val = 1
messageString = 'Title font size cannot be less than 1. Size has been set to 1.'
response=dialog_message(messageString,/CENTER)
endif
if ~finite(val,/nan) then begin
title->setProperty,size=val
historywin->update,'Set Title Size', /dontshow
endif else begin
historywin->update, 'Invalid title size, value reset.',/dontshow
statusbar->update, 'Invalid title size, Value reset.'
title->getProperty,size=size
widget_control,sizespinner,set_value=size
messageString = 'Invalid title font size entered. Size has been reset.'
response=dialog_message(messageString,/CENTER)
endelse
title->setProperty,color=spd_ui_page_color_get_value(tlb,'tcolorwindow')
historywin->update,'Set Title Color', /dontshow
end
pro spd_ui_page_footer_set_value,tlb,pagesettings,historywin,statusBar
compile_opt idl2,hidden
pageSettings->getProperty,footer=footer
footertext = widget_info(tlb,find_by_uname='footertext')
widget_control,footertext,get_value=textvalue
footer->setProperty,value=textvalue
historywin->update,'Set Footer Text', /dontshow
footer->setProperty,font=spd_ui_page_font_get_value(tlb,'footercombo')
historywin->update,'Set footer Font', /dontshow
formatcombo = widget_info(tlb,find_by_uname='footerformat')
formattext = widget_info(formatcombo,/combobox_gettext)
widget_control,formatcombo,get_value=formatnames
idx = where(formattext eq formatnames)
footer->setProperty,format=idx
showbutton = widget_info(tlb,find_by_uname='showfooter')
footer->setProperty,show=widget_info(showbutton,/button_set)
historywin->update,'Set footer Show Flag', /dontshow
sizespinner = widget_info(tlb,find_by_uname='footersize')
widget_control,sizespinner,get_value=val
val = double(val)
if val lt 1 then begin
historywin->update,'Current font less than 1. Font size set to 1.', /dontshow
statusBar->update,'Current font less than 1. Font size set to 1.'
val = 1
widget_control,sizespinner,set_value=1
messageString = 'Footer font size cannot be less than 1. Size has been set to 1.'
response=dialog_message(messageString,/CENTER)
endif
if ~finite(val,/nan) then begin
footer->setProperty,size=val
historywin->update,'Set footer Size', /dontshow
endif else begin
historywin->update,'Invalid footer size, value reset.', /dontshow
statusBar->update,'Invalid footer size, value reset.'
footer->getProperty,size=size
widget_control,sizespinner,set_value=size
messageString = 'Invalid footer font size entered. Size has been reset.'
response=dialog_message(messageString,/CENTER)
endelse
footer->setProperty,color=spd_ui_page_color_get_value(tlb,'fcolorwindow')
historywin->update,'Set footer Color', /dontshow
end
pro spd_ui_page_all_set_value,tlb,state
historywin = state.info.historywin
statusBar = state.statusBar
state.pagesettings->GetProperty,backgroundcolor=currcolor
mywindowObjs=state.windowstorage->GetObjects()
IF N_Elements(mywindowObjs) GT 0 THEN BEGIN
FOR i=0,N_Elements(mywindowObjs)-1 DO BEGIN
mywindowObjs[i]->GetProperty,settings=settings
settings->SetProperty, background = currcolor
titletext = widget_info(tlb,find_by_uname='titletext')
widget_control,titletext,get_value=textvalue
spd_ui_page_title_set_value,tlb, settings, historywin, statusBar
spd_ui_page_footer_set_value,tlb, settings, historywin, statusBar
spd_ui_page_margins_set_value, tlb, settings, historywin, statusBar
spd_ui_page_canvas_set_value, tlb, settings, historywin, statusbar,state.drawObject,state.windowStorage
spd_ui_page_spacing_set_value, tlb, settings, historywin, statusbar
ENDFOR
ENDIF
end
pro spd_ui_page_set_value,tlb,state
compile_opt idl2,hidden
pagesettings = state.pagesettings
historywin = state.info.historywin
statusBar = state.statusBar
window = state.cWindow
spd_ui_page_title_set_value,tlb,pagesettings,historywin,statusBar
spd_ui_page_footer_set_value,tlb,pagesettings,historywin,statusBar
spd_ui_page_margins_set_value, tlb, pagesettings,historywin,statusBar
spd_ui_page_canvas_set_value, tlb, pagesettings, historywin, statusbar,state.drawObject,state.windowStorage
spd_ui_page_spacing_set_value, tlb, pagesettings, historywin, statusbar
end
pro spd_ui_page_color_event,tlb,uname,messagename,historywin,statusbar
compile_opt idl2,hidden
colorwindow = widget_info(tlb,find_by_uname=uname)
Widget_Control, colorwindow, Get_Value=colorWin
ColorWin->getProperty,graphics_tree=scene
scene->getProperty,color=currcolor
color = PickColor(!p.color, Group_Leader=tlb, Cancel=cancelled,currentcolor=currcolor)
if ~cancelled then begin
scene->setProperty,color=reform(color)
Colorwin->draw
historyWin->Update,messagename + ' color changed.'
statusbar->Update,messagename + ' color changed.'
endif
end
function spd_ui_page_font_get_value,tlb,uname
compile_opt idl2,hidden
combo = widget_info(tlb,find_by_uname=uname)
text = widget_info(combo,/combobox_gettext)
widget_control,combo,get_value=fontnames
return,where(text eq fontnames)
end
function spd_ui_page_color_get_value,tlb,uname
compile_opt idl2,hidden
colorwindow = widget_info(tlb,find_by_uname=uname)
Widget_Control, colorwindow, Get_Value=colorWin
ColorWin->getProperty,graphics_tree=scene
scene->getProperty,color=color
return,color
end
PRO spd_ui_page_options_event, event, pagesettings
Compile_Opt hidden
Widget_Control, event.TOP, Get_UValue=state, /No_Copy
err_xxx = 0
Catch, err_xxx
IF (err_xxx NE 0) THEN BEGIN
Catch, /Cancel
Help, /Last_Message, Output = err_msg
spd_ui_sbar_hwin_update, state, err_msg, /error, err_msgbox_title='Error in Page Options'
if is_struct(state) then begin
if obj_valid(state.pagesettings) then state.pagesettings->Reset
endif
Widget_Control, event.TOP, Set_UValue=state, /No_Copy
widget_control, event.top,/destroy
RETURN
ENDIF
IF(Tag_Names(event, /Structure_Name) EQ 'WIDGET_KILL_REQUEST') THEN BEGIN
state.pagesettings->Reset
state.cwindow->GetProperty, Panels=panels
IF Obj_Valid(panels) THEN BEGIN
panelObjs = panels->Get(/all)
IF obj_valid(panelobjs[0]) then begin
FOR i=0, N_Elements(panelObjs)-1 do panelobjs[i]->reset
endif
state.info.historyWin->Update,'Panels reset.'
state.statusbar->Update,'Panels reset.'
endif
state.info.drawObject->update,state.info.windowStorage,state.info.loadedData
state.info.drawObject->draw
state.info.historyWin->Update,'Active window refreshed.'
state.statusbar->Update,'Active window refreshed.'
dprint, dlevel=4, 'widget killed'
state.info.historyWin->Update,'SPD_UI_PAGE_OPTIONS: Widget killed'
state.info.statusbar->update,'Page Options killed'
Widget_Control, event.TOP, Set_UValue=state, /No_Copy
Widget_Control, event.top, /Destroy
RETURN
ENDIF
IF (Tag_Names(event, /Structure_Name) EQ 'WIDGET_TAB') THEN BEGIN
Widget_Control, event.TOP, Set_UValue=state, /No_Copy
RETURN
EndIF
Widget_Control, event.id, Get_UValue=uval
if size(uval, /type) ne 0 then begin
if size(uval,/type) eq 8 then uvalname=uval.name else uvalname=uval
endif else uvalname = strtrim(-1,2)
state.info.historyWin->Update,'SPD_UI_PAGE_OPTIONS: User value: '+uvalname,/dontshow
CASE uvalname OF
'CANC': BEGIN
dprint, dlevel=4, 'Page widget canceled'
mywindowObjs=state.windowstorage->GetObjects()
IF N_Elements(mywindowObjs) GT 0 THEN BEGIN
FOR i=0,N_Elements(mywindowObjs)-1 DO BEGIN
mywindowObjs[i]->GetProperty,settings=settings
settings->Reset
spd_ui_orientation_update,state.info.drawObject,state.info.windowStorage
mywindowObjs[i]->GetProperty, Panels=panels
IF Obj_Valid(panels) THEN BEGIN
panelObjs = panels->Get(/all)
IF obj_valid(panelObjs[0]) then begin
FOR j=0, N_Elements(panelObjs)-1 do begin
panelObjs[j]->reset
endfor
endif
endif
endfor
endif
state.info.drawObject->update,state.info.windowStorage,state.info.loadedData
state.info.drawObject->draw
state.info.historyWin->Update,'Active window refreshed.'
state.statusbar->Update,'Active window refreshed.'
state.info.historyWin->Update,'Exiting Page Options.'
state.statusbar->Update,'Exiting Page Options.'
state.info.statusBar->update,'Page Options cancelled'
Widget_Control, event.TOP, Set_UValue=state, /No_Copy
Widget_Control, event.top, /Destroy
RETURN
END
'OK': BEGIN
spd_ui_page_set_value,event.top,state
spd_ui_orientation_update, state.info.drawObject, state.info.windowStorage
state.info.drawObject->update,state.info.windowStorage,state.info.loadedData
state.info.drawObject->draw
state.info.historyWin->Update,'Active window refreshed.'
state.statusbar->Update,'Active window refreshed.'
state.info.historyWin->Update,'Exiting Page Options.'
state.statusbar->Update,'Exiting Page Options.'
state.info.statusBar->update,'Page Options closed'
Widget_Control, event.TOP, Set_UValue=state, /No_Copy
Widget_Control, event.top, /Destroy
dprint, dlevel=4, 'Settings updated. Page widget closed.'
RETURN
END
'TEMP':begin
spd_ui_page_set_value,event.top,state
state.template->setProperty,page=state.pagesettings->Copy()
state.statusbar->update,'Saved Current Page Settings to Template'
state.historywin->update,'Saved Current Page Settings to Template'
end
'BPALETTE': begin
state.pagesettings->GetProperty,backgroundcolor=currcolor
color = PickColor(!p.color, Group_Leader=state.tlb, Cancel=cancelled,currentcolor=currcolor)
if ~cancelled then begin
state.pagesettings->SetProperty,backgroundcolor=color
bcolorwindow = widget_info(state.tlb,find_by_uname='bcolorwindow')
Widget_Control, bcolorwindow, Get_Value=bcolorWin
if obj_valid(scene) then scene->remove,/all
scene=obj_new('IDLGRSCENE', color=reform(color))
bcolorWin->draw, scene
state.info.historyWin->Update,'Background color changed.'
state.statusbar->Update,'Background color changed.'
endif
END
'TPALETTE': begin
spd_ui_page_color_event,state.tlb,'tcolorwindow','Title',state.info.historyWin,state.statusBar
END
'FPALETTE': BEGIN
spd_ui_page_color_event,state.tlb,'fcolorwindow','Footer',state.info.historyWin,state.statusBar
END
'PORTRAIT': if event.select then $
spd_ui_page_canvas_update, state, ~event.select
'LANDSCAPE': if event.select then $
spd_ui_page_canvas_update, state, event.select
'TMARGIN': begin
state.statusbar->update, 'Top Margin changed.'
state.info.historywin->update, 'Top Margin changed.'
end
'BMARGIN': begin
state.info.historywin->update, 'Bottom Margin changed.'
state.statusbar->update, 'Bottom Margin changed.'
end
'RMARGIN': begin
state.info.historywin->update, 'Right Margin changed.'
state.statusbar->update, 'Right Margin changed.'
end
'LMARGIN': begin
state.info.historywin->update, 'Left Margin changed.'
state.statusbar->update, 'Left Margin changed.'
end
'XPANELSPACING': begin
state.info.historywin->update, 'Horizontal panel spacing changed.'
state.statusbar->update, 'Horizontal panel spacing changed.'
end
'YPANELSPACING': begin
state.info.historywin->update, 'Vertical panel spacing changed.'
state.statusbar->update, 'Vertical panel spacing changed.'
end
'XSIZE': begin
state.info.historywin->update, 'Canvas width changed.'
state.statusbar->update, 'Canvas width changed.'
end
'YSIZE': begin
state.info.historywin->update, 'Canvas height changed.'
state.statusbar->update, 'Canvas height changed.'
end
'TITLE': begin
end
'LABEL': begin
state.pagesettings->GetProperty,labels=labels
labels->SetProperty, font=event.index
state.cwindow->GetProperty, Panels=panels
IF Obj_Valid(panels) THEN BEGIN
panelObjs = panels->Get(/all)
IF NOT Is_Num(panelObjs) THEN BEGIN
FOR i=0, N_Elements(panelObjs)-1 DO BEGIN
panelObjs[i]->GetProperty, XAxis=xaxis, yAxis=yaxis, zAxis=zaxis
IF Obj_Valid(xaxis) THEN BEGIN
xaxis->GetProperty, Labels=labels
labelObjs=labels->Get(/all)
IF Obj_Valid(labelObjs[0]) && N_Elements(labelObjs) GT 0 THEN BEGIN
FOR i=0, N_Elements(labelObjs)-1 DO labelObjs[i]->SetProperty, Font=event.index
ENDIF
ENDIF
IF Obj_Valid(yaxis) THEN BEGIN
yaxis->GetProperty, Labels=labels
labelObjs=labels->Get(/all)
IF Obj_Valid(labelObjs[0]) && N_Elements(labelObjs) GT 0 THEN BEGIN
FOR i=0, N_Elements(labelObjs)-1 DO labelObjs[i]->SetProperty, Font=event.index
ENDIF
ENDIF
IF Obj_Valid(zaxis) THEN BEGIN
zaxis->GetProperty, labelTextObject=labelTextObject
IF Obj_Valid(labelTextObject) THEN labelTextObject->SetProperty, Font=event.index
ENDIF
state.info.historywin->Update, "Label font changed."
state.statusBar->Update, "Label font changed."
ENDFOR
ENDIF
ENDIF
end
'FOOTER': begin
end
'APPLYTOALLPAGES': begin
spd_ui_page_all_set_value,event.top,state
spd_ui_orientation_update, state.info.drawObject, state.info.windowStorage
state.info.historyWin->Update,'Apply to All Pages.'
state.statusbar->Update,'Apply to All Pages.'
state.info.drawObject->update,state.info.windowStorage,state.info.loadedData
state.info.drawObject->draw
state.info.historyWin->Update,'Active window refreshed.'
state.statusbar->Update,'Active window refreshed.'
end
'APPLY': begin
spd_ui_page_set_value,event.top,state
spd_ui_orientation_update, state.info.drawObject, state.info.windowStorage
state.info.drawObject->update,state.info.windowStorage,state.info.loadedData
state.info.drawObject->draw
state.info.historyWin->Update,'Active window refreshed.'
state.statusbar->Update,'Active window refreshed.'
END
'PAGETITLE': begin
state.info.historywin->update, 'Page Title changed.'
state.statusbar->update, 'Page Title changed.'
end
'PAGEFOOTER': begin
state.info.historywin->update, 'Page Footer changed.'
state.statusbar->update, 'Page Footer changed.'
end
'TITLESIZE': begin
if event.valid then begin
state.info.historywin->update, 'Page Title font size changed.'
state.statusbar->update, 'Page Title font size changed.'
endif
end
'LABELSIZE': begin
state.pagesettings->GetProperty, Labels=labels
labels->GetProperty, Size=size
IF double(event.value) LT 0 THEN BEGIN
state.info.historywin->Update, "Font size values cannot be negative."
state.statusBar->Update, "Font size values cannot be negative."
ENDIF ELSE BEGIN
state.info.historywin->Update, "Label font size changed."
state.statusBar->Update, "Label font size changed."
ENDELSE
size=fix(event.value)
labels->SetProperty, size=size
state.cwindow->GetProperty, Panels=panels
IF Obj_Valid(panels) THEN BEGIN
panelObjs = panels->Get(/all)
IF NOT Is_Num(panelObjs) THEN BEGIN
FOR j=0, N_Elements(panelObjs)-1 DO BEGIN
panelObjs[j]->GetProperty, XAxis=xaxis, yAxis=yaxis, zAxis=zaxis
IF Obj_Valid(xaxis) THEN BEGIN
xaxis->GetProperty, Labels=Labels
if obj_valid(labels) then begin
labelObjs=labels->Get(/all)
IF Obj_Valid(labelObjs[0]) && N_Elements(labelObjs) GT 0 THEN BEGIN
FOR i=0, N_Elements(labelObjs)-1 DO labelObjs[i]->SetProperty, Size=size
ENDIF
endif
ENDIF
IF Obj_Valid(yaxis) THEN BEGIN
yaxis->GetProperty, Labels=Labels
if obj_valid(labels) then begin
labelObjs=labels->Get(/all)
IF Obj_Valid(labelObjs[0]) && N_Elements(labelObjs) GT 0 THEN BEGIN
FOR i=0, N_Elements(labelObjs)-1 DO labelObjs[i]->SetProperty, Size=size
ENDIF
endif
ENDIF
IF Obj_Valid(zaxis) THEN BEGIN
zaxis->GetProperty, Labeltextobject=Labeltextobject
if obj_valid(Labeltextobject) then labeltextobject->SetProperty, Size=size
ENDIF
ENDFOR
ENDIF
ENDIF
Widget_Control, event.id, set_value=size
end
'FOOTERSIZE': begin
state.info.historywin->update, 'Page Footer font size changed.'
state.statusbar->update, 'Page Footer font size changed.'
end
'TOKEN': BEGIN
state.pageSettings->SetProperty, Token=uval.ind
token = state.pageSettings->GetTokenCommand(uval.ind)
titletext = widget_info(state.tlb,find_by_uname='titletext')
widget_control,titletext,get_value=value
textselect = widget_info(titletext,/text_select)
offset = (widget_info(titletext,text_offset_to_xy=textselect[0]))[0]
if offset gt strlen(value) then begin
titleString = value+token
endif else begin
titleString = strmid(value,0,offset) + token + strmid(value,offset,strlen(value))
endelse
widget_control, titletext, set_value=titlestring
widget_control, titletext, set_text_select=textselect
state.info.historywin->Update, "Token inserted into title."
state.statusBar->Update, "Token inserted into title."
END
'FOOTERTOKEN': BEGIN
state.pageSettings->SetProperty, ifooterToken=uval.ind
token = state.pageSettings->GetTokenCommand(uval.ind)
footertext = widget_info(state.tlb,find_by_uname='footertext')
widget_control,footertext,get_value=value
textselect = widget_info(footertext,/text_select)
offset = (widget_info(footertext,text_offset_to_xy=textselect[0]))[0]
if offset gt strlen(value) then begin
footerString = value+token
endif else begin
footerString = strmid(value,0,offset) + token + strmid(value,offset,strlen(value))
endelse
Widget_Control, footerText, set_value=footerString
Widget_control, footertext, set_text_select=textselect
state.info.historywin->Update, "Token inserted into footer."
state.statusBar->Update, "Token inserted into footer."
END
'FORMAT': BEGIN
state.info.historywin->update, 'Page Title format changed.'
state.statusbar->update, 'Page Title format changed.'
END
'FOOTERFORMAT': BEGIN
state.info.historywin->update, 'Page Footer format changed.'
state.statusbar->update, 'Page Footer format changed.'
END
'SHOWTITLE': begin
state.info.historywin->update, 'Show Title changed.'
state.statusbar->update, 'Show Title changed.'
end
'SHOWFOOTER': begin
state.info.historywin->update, 'Show Footer changed.'
state.statusbar->update, 'Show Footer changed.'
end
'OVERLAPMAJORTICKS': begin
widget_control,event.id,get_value=value
if ~stregex(value,'[^0-9]',/boolean) then begin
state.pagesettings->SetProperty, overlapmajorticks=fix(value)
endif else begin
state.pagesettings->GetProperty, overlapmajorticks=curr_value
widget_control,event.id, set_value=strtrim(curr_value,2)
endelse
end
'SHOWVALUES': begin
state.pagesettings->SetProperty,showvalues=event.select
id=widget_info(state.tlb,find_by_uname='closertext')
widget_control,id,sensitive=event.select
id=widget_info(state.tlb,find_by_uname='closerdroplist')
widget_control,id,sensitive=event.select
end
'CLOSERTHANVALUE': begin
widget_control,event.id,get_value=value
if ~stregex(value,'[^0-9]',/boolean) then begin
state.pagesettings->SetProperty, CloserThanValue=fix(value)
endif else begin
state.pagesettings->GetProperty, CloserThanValue=curr_value
widget_control,event.id, set_value=strtrim(curr_value,2)
endelse
end
'CLOSERTHANUNITS': begin
state.pagesettings->SetProperty,CloserThanUnits=event.index
end
'USESAMEYRANGE': begin
state.pagesettings->SetProperty,UseSameYRange=event.select
id=widget_info(state.tlb,find_by_uname='yminorlabel')
widget_control,id,sensitive=event.select
id=widget_info(state.tlb,find_by_uname='yminortext')
widget_control,id,sensitive=event.select
id=widget_info(state.tlb,find_by_uname='ymajorlabel')
widget_control,id,sensitive=event.select
id=widget_info(state.tlb,find_by_uname='ymajortext')
widget_control,id,sensitive=event.select
end
'YMINORTEXT': begin
widget_control,event.id,get_value=value
if ~stregex(value,'[^0-9]',/boolean) then begin
state.pagesettings->SetProperty, numMinorTicks=fix(value)
endif else begin
state.pagesettings->GetProperty, numMinorTicks=curr_value
widget_control,event.id, set_value=strtrim(curr_value,2)
endelse
end
'YMAJORTEXT': begin
widget_control,event.id,get_value=value
if ~stregex(value,'[^0-9]',/boolean) then begin
state.pagesettings->SetProperty, numMajorTicks=fix(value)
endif else begin
state.pagesettings->GetProperty, numMinorTicks=curr_value
widget_control,event.id, set_value=strtrim(curr_value,2)
endelse
end
'SKIPBLANKS': state.pagesettings->SetProperty,skipBlanks = event.select
ELSE:
ENDCASE
Widget_Control, event.TOP, Set_UValue=state, /No_Copy
RETURN
END
pro spd_ui_page_options, info
cwindow = info.windowstorage->getactive()
cwindow->GetProperty,settings = pagesettings
gui_id=info.master
mywindowObjs=info.windowstorage->GetObjects()
IF N_Elements(mywindowObjs) GT 0 THEN BEGIN
FOR i=0,N_Elements(mywindowObjs)-1 DO BEGIN
mywindowObjs[i]->GetProperty,settings=settings
settings->save
endfor
endif
err_xxx = 0
Catch, err_xxx
IF (err_xxx NE 0) THEN BEGIN
Catch, /Cancel
Help, /Last_Message, Output = err_msg
FOR j = 0, N_Elements(err_msg)-1 DO info.historywin->update,err_msg[j]
Print, 'Error--See history'
ok=error_message('Unknown error starting Page Options. See console for details.',$
/noname, /center, title='Error in Page Options')
widget_control, tlb,/destroy
spd_gui_error,gui_id,info.historywin
RETURN
ENDIF
info.statusBar->update,'Page Options opened'
tlb = Widget_Base(/Col, Title='Page Options ', Group_Leader=info.master, /Modal, /Floating,/TLB_KILL_REQUEST_EVENTS, tab_mode=1)
tabBase = Widget_Tab(tlb, Location=location)
buttonBase = Widget_Base(tlb, /Row, /Align_Center)
statusBase = Widget_Base(tlb, /Row, /Align_Center)
mainBase = Widget_Base(tabBase, Title='Text', /Col, YPad=1)
textBase = Widget_Base(mainBase, Title='Text', /Col)
titleBase = Widget_Base(textBase, /Row)
tokenBase = Widget_Base(textBase, /Row, /Align_Center)
footerBase = Widget_Base(textBase, /Row, YPad=2)
footertokenBase = Widget_Base(textBase, /Row, /Align_Center)
fontlabelBase=Widget_Base(textBase, /row)
fontFrameBase=Widget_Base(textBase, /row)
fontBase = Widget_Base(textBase, /row, /Align_Left, frame=3)
fontsBase = Widget_Base(fontBase, /col, space=6)
layoutBase = Widget_Base(tabBase, title='Layout', /Col, YPad=2)
row1Base = Widget_Base(layoutBase, /Row, YPad=2)
panelBase = Widget_Base(row1Base, /Col)
canvasSizeBase = Widget_Base(row1Base, /Col)
row2Base = Widget_Base(layoutBase, /Row)
marginBase = Widget_Base(row2Base, /Col)
row2Col2Base = Widget_Base(row2Base, /Col)
backgroundBase = Widget_Base(row2Col2Base, /Col)
pagesettings->GetProperty, $
xpanelspacing=xpanelspacing, $
ypanelspacing=ypanelspacing, $
title=title, $
labels=labels, $
variables=variables, $
footer=footer, $
marker=marker, $
overlapmajorticks=overlapmajorticks, $
topprintmargin=topprintmargin, $
bottomprintmargin = bottomprintmargin, $
rightprintmargin = rightprintmargin, $
leftprintmargin = leftprintmargin, $
ShowValues=ShowValues, $
CloserThanValue= CloserThanValue, $
CloserThanUnits= CloserThanUnits, $
useSameYRange= useSameYRange, $
numMinorTicks= numMinorTicks, $
numMajorTicks= numMajorTicks, $
canvasSize=canvassize, $
orientation=orientation, $
backgroundcolor=backgroundcolor, $
skipBlanks= skipBlanks
title->GetProperty, $
value=pagetitle, $
size=titlesize, $
font=titlefont, $
format=titleformat,$
color=titlecolor, $
show=showtitle
labels->GetProperty, $
size=labelsize, $
color=labelcolor, $
font=labelfont
variables->GetProperty, $
size=varsize, $
color=variablescolor, $
font=varsfont
footer->GetProperty, $
size=footersize, $
font=footerfont, $
format=footerformat,$
value=pagefooter, $
color=footercolor, $
show=showfooter
marker->GetProperty, $
size=markersize, $
font=markerfont, $
color=markercolor
mywindowObjs=info.windowstorage->GetObjects()
IF N_Elements(mywindowObjs) GT 0 THEN BEGIN
FOR i=0,N_Elements(mywindowObjs)-1 DO BEGIN
mywindowObjs[i]->GetProperty, Panels=panels
IF Obj_Valid(panels) THEN BEGIN
panelObjs = panels->Get(/all)
IF obj_valid(panelObjs[0]) then begin
FOR j=0, N_Elements(panelObjs)-1 do begin
panelObjs[j]->save
endfor
endif
endif
endfor
endif
getresourcepath,rpath
palettebmp = read_bmp(rpath + 'color.bmp', /rgb)
spd_ui_match_background, tlb, palettebmp
tokennames = pagesettings->GetTokenNames()
formatnames= pagesettings->GetFormatNames()
footerLabel = Widget_Label(footerBase, Value='Page Footer: ',/align_left)
geo_struct = widget_info(footerLabel,/geometry)
labelXSize = geo_struct.scr_xsize
titleLabel = Widget_Label(titleBase, Value='Page Title: ',xsize=labelXSize,/align_left)
titleText = Widget_Text(titleBase,/all_events, /Editable, Value=pagetitle, XSize=35, ysize=1, uval='PAGETITLE', uname='titletext')
showTitleBase = Widget_Base(titleBase, /Row, /Nonexclusive)
showTitleButton = Widget_Button(showTitleBase, Value = 'Show Title', uval='SHOWTITLE',uname='showtitle')
if showtitle then Widget_Control, showtitleButton, /Set_Button
tokenButton = Widget_Button(tokenBase, Value=' Token... ', /Menu)
tokenSubButtons=lonarr(n_elements(tokennames))
for i = 0,n_elements(tokennames)-1 do tokenSubButtons[i]= Widget_Button(tokenButton, Value=tokennames[i], uval={name:'TOKEN', ind:i, format:0})
spaceLabel = Widget_Label(tokenBase, Value=' ')
noformatidx = where(formatNames eq 'No Format')
formatbox = widget_combobox(tokenBase,value=formatNames,UVALUE='FORMAT',uname='titleformat')
if titleformat eq -1 then begin
widget_control,formatbox,set_combobox_select=noformatidx
endif else begin
widget_control,formatbox,set_combobox_select=titleformat
endelse
footerTokenButton = Widget_Button(footerTokenBase, Value=' Token... ', /Menu)
footerTokenSubButtons=lonarr(n_elements(tokennames))
for i = 0,n_elements(tokennames)-1 do footertokenSubButtons[i]= Widget_Button(footerTokenButton, Value=tokennames[i], uval={name:'FOOTERTOKEN', $
ind:i, format:0})
spaceLabel = Widget_Label(footerTokenBase, Value=' ')
formatbox = widget_combobox(footertokenBase,value=formatNames,UVALUE='FOOTERFORMAT',uname='footerformat')
if footerformat eq -1 then begin
widget_control,formatbox,set_combobox_select=noformatidx
endif else begin
widget_control,formatbox,set_combobox_select=footerformat
endelse
footerText = Widget_Text(footerBase, /all_events , /Editable, Value=pagefooter, XSize=35, YSize=1, uval='PAGEFOOTER',uname='footertext')
showFooterBase = Widget_Base(footerBase, /Row, /Nonexclusive)
showFooterButton = Widget_Button(showfooterBase, Value = 'Show Footer', uval='SHOWFOOTER',uname='showfooter')
if showfooter then Widget_Control, showfooterButton, /Set_Button
fontLabel = Widget_Label(fontLabelBase, Value = 'Font Styles: ', /Align_Left)
fontValues = pagesettings->GetFontnames()
fontslabelsBase = widget_base(fontsbase,/row,ypad=0)
titleFontBase = widget_base(fontsBase,/row,ypad=0)
footerFontBase = widget_base(fontsBase,/row,ypad=0)
label_xsize = geo_struct.scr_xsize
label_ysize = geo_struct.scr_ysize
fontTitleLabel = widget_label(titleFontBase,value='Title: ',xsize=label_xsize)
fontFooterLabel = widget_label(footerFontBase,value='Footer: ',xsize=label_xsize)
fontname_xsize = 150
combobase = widget_base(titleFontBase,/row,ypad=0,xpad=0)
fontTitleDroplist = Widget_Combobox(combobase,xsize=fontname_xsize, Value=fontValues, uval='TITLE',uname='titlecombo')
widget_control,fontTitleDroplist,set_combobox_select=titlefont
combobase = widget_base(footerFontBase,/row,ypad=0,xpad=0)
fontFooterdroplist = Widget_Combobox(comboBase, XSize=fontname_xsize, Value=fontValues, uval='FOOTER',uname='footercombo')
widget_control,fontFooterDroplist,set_combobox_select=footerfont
widget_control,fontTitleDroplist,set_combobox_select=titlefont
fontTitleIncrement = spd_ui_spinner(titleFontBase, Increment=1, Value=titlesize, uval='TITLESIZE',/all_events,uname='titlesize', min_value=1)
cb1Base = Widget_Base(titleFontBase, /row)
tpaletteButton = Widget_Button(cb1Base, Value=palettebmp, /Bitmap, UValue='TPALETTE', Tooltip='Choose color from Palette')
geo_struct = widget_info(tpaletteButton,/geometry)
rowysize = geo_struct.scr_ysize
tcolorWindow = Widget_Draw(titleFontBase, XSize=50, YSize=rowysize,uname='tcolorwindow', $
graphics_level=2,renderer=1,retain=1,units=0,frame=1, /expose_events)
widget_control,fontFooterDroplist,set_combobox_select=footerfont
fontFooterIncrement=spd_ui_spinner(footerFontBase, Increment=1, Value=footersize, uval='FOOTERSIZE',uname='footersize', min_value=1)
cb4Base = Widget_Base(footerFontBase, /row,ypad=pad)
fpaletteButton = Widget_Button(cb4Base, Value=palettebmp, /Bitmap, $
UValue='FPALETTE', Tooltip='Choose color from Palette')
fcolorWindow = Widget_Draw(footerFontBase, XSize=50, YSize=rowysize,uname='fcolorwindow', $
graphics_level=2,renderer=1,retain=2,units=0,frame=1, /expose_events)
spaceLabel = widget_label(fontsLabelsBase,value=' ',/align_center,xsize=label_xsize)
fontNamelabel = Widget_Label(fontsLabelsBase, value='Font Name', /align_center,xsize=fontname_xsize)
sizeLabel = Widget_Label(fontsLabelsBase, value='Size (points)', /align_center)
spaceLabel = Widget_Label(fontsLabelsBase, value=' ', /align_center)
arrangeLabel = Widget_Label(panelBase, Value= 'Panel Arrangement: ', /Align_Left)
arrangeBase = Widget_Base(panelBase, /Col, frame=3, tab_mode=1)
label1txt = 'Horizontal Panel Spacing (pts): '
label2txt = 'Vertical Panel Spacing (pts): '
xspacingBase = Widget_Base(arrangeBase, /Row)
yspacingBase = Widget_Base(arrangeBase, /Row)
if strlen(label1txt) ge strlen(label2txt) then begin
spacingIncrement=spd_ui_spinner(xspacingBase, label= label1txt, uname='xpanelspacing',$
Increment=1, Value=xpanelspacing, uval='XPANELSPACING',getXLabelSize=xsize, min_value=0)
spacingIncrement=spd_ui_spinner(yspacingBase, label= label2txt, uname='ypanelspacing',$
Increment=1, Value=ypanelspacing, uval='YPANELSPACING',xlabelsize=xsize,min_value=0)
endif else begin
spacingIncrement=spd_ui_spinner(yspacingBase, label= label2txt, uname='ypanelspacing',$
Increment=1, Value=ypanelspacing, uval='YPANELSPACING',getXLabelSize=xsize,min_value=0)
spacingIncrement=spd_ui_spinner(xspacingBase, label= label1txt, uname='xpanelspacing',$
Increment=1, Value=xpanelspacing, uval='XPANELSPACING',xlabelsize=xsize, min_value=0)
endelse
canvasSizeLabel = Widget_Label(canvasSizeBase, Value='Canvas Size (inches):', /Align_Left)
xSizeBase = Widget_Base(canvasSizeBase, /col, frame=3, /Align_Center, ypad=5, space=6)
xSizeBase2 = Widget_Base(xSizeBase, /row, /Align_Center, ypad=0, space=0)
xSizeIncrement = spd_ui_spinner(xSizeBase2, Label='X:', Value=canvassize[0], uval='XSIZE', uname='xsize', min_value=0)
ySizeIncrement = spd_ui_spinner(xSizeBase2, Label='Y:', Value=canvassize[1], uval='YSIZE', uname='ysize', min_value=0)
orientationBase = widget_base(xsizebase, /row, /exclusive, ypad=0)
portrait = widget_button(orientationbase, value='Portrait', uval='PORTRAIT', uname='portrait')
landscape = widget_button(orientationbase, value='Landscape', uval='LANDSCAPE', uname='landscape')
if orientation then widget_control, landscape, set_button=1 $
else widget_control, portrait, set_button=1
backgroundLabel = Widget_Label(backgroundBase, Value='Background:', /Align_Left)
backFrameBase = Widget_Base(backgroundBase, /Row, Frame=3, XPad=2, YPad=3)
paletteBase = Widget_Base(backframeBase, /Row, XPad=3, ypad=2, space=3)
colorLabel = Widget_Label(paletteBase, Value='Color: ')
paletteButton = Widget_Button(paletteBase, Value=palettebmp, /Bitmap, UValue='BPALETTE', Tooltip='Choose color from Palette')
vspaceLabel = Widget_Label(paletteBase, Value=' ')
bcolorWindow = Widget_Draw(paletteBase, XSize=50, YSize=21,uname='bcolorwindow', $
graphics_level=2,renderer=1,retain=2,units=0,frame=1, /expose_events, Tooltip='Current Color')
spaceLabel = Widget_Label(paletteBase, Value=' ')
marginLabel = Widget_Label(marginBase, Value='Margins: ', /Align_Left)
mframeBase = Widget_Base(marginBase, /Col, Frame=3, tab_mode=1)
topMarginBase = Widget_Base(mframeBase, /Row, /Align_Center)
tmIncrement = spd_ui_spinner(topmarginBase, Label='Top: ', Value=topprintmargin, uval='TMARGIN', uname='tmargin', min_value=0,precision=5)
centerMarginBase = Widget_Base(mframeBase, /Row)
lmIncrement = spd_ui_spinner(centerMarginBase, Label='Left: ', Value=leftprintmargin, uval='LMARGIN', uname='lmargin',min_value=0,precision=5)
rmIncrement = spd_ui_spinner(centerMarginBase, Label=' Right: ', Value=rightprintmargin, uval='RMARGIN', uname='rmargin',min_value=0,precision=5)
bottomMarginBase = Widget_Base(mframeBase, /Row, /Align_Center)
bmIncrement = spd_ui_spinner(bottomMarginBase, Label='Bottom: ', Value=bottomprintmargin, uval='BMARGIN', uname='bmargin',min_value=0,precision=5)
dimensionLabel = Widget_Label(mframeBase, Value='All dimensions in inches', /Align_Center)
okButton = Widget_Button(buttonBase, Value='OK', XSize = 75, uval='OK')
applyButton = Widget_Button(buttonBase, Value='Apply', XSize = 75, uval='APPLY')
applytoallButton = Widget_Button(buttonBase, Value='Apply to All Pages', XSize = 115, uval='APPLYTOALLPAGES')
cancelButton = Widget_Button(buttonBase, Value='Cancel', UValue='CANC', XSize = 75)
templateButton = Widget_Button(buttonBase, Value='Save as Default', UValue='TEMP',xsize=125,tooltip="Save current settings as default template")
statusBar = Obj_New('SPD_UI_MESSAGE_BAR', Value='Status information is displayed here.', statusBase,Xsize=75, YSize=1)
pagesettings->getProperty,orientation=orient
state = {tlb:tlb, gui_id:gui_id, pagesettings:pagesettings, lcolorWin:0, $
mcolorWin:0, info:info,drawObject:info.drawObject,windowStorage:info.windowStorage,historywin:info.historywin,template:info.template_object,statusBar:statusBar, cwindow:cwindow,orient:orient}
centerTLB,tlb
Widget_Control, tlb, Set_UValue=state, /No_Copy
Widget_Control, tlb, /Realize
tcolorwindow = widget_info(tlb,find_by_uname='tcolorwindow')
Widget_Control, tcolorwindow, Get_Value=tcolorWin
scene=obj_new('IDLGRSCENE', color=titlecolor)
tcolorWin->setProperty,graphics_tree=scene
tcolorWin->draw
fcolorwindow = widget_info(tlb,find_by_uname='fcolorwindow')
Widget_Control, fcolorwindow, Get_Value=fcolorWin
scene=obj_new('IDLGRSCENE', color=footercolor)
fcolorWin->setProperty,graphics_tree=scene
fcolorWin->draw, scene
bcolorwindow = widget_info(tlb,find_by_uname='bcolorwindow')
Widget_Control, bcolorwindow, Get_Value=bcolorWin
if obj_valid(scene) then scene->remove,/all
scene=obj_new('IDLGRSCENE', color=backgroundcolor)
bcolorWin->draw, scene
if !d.NAME eq 'X' then begin
widget_control, tlb, xoffset=0, yoffset=0
endif
XManager, 'spd_ui_page_options', tlb, /No_Block
RETURN
END