Changeset 2765 for branches/blt4
- Timestamp:
- Jan 15, 2012, 8:23:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/xyprint.tcl
r2748 r2765 40 40 private variable _outputFormatType ""; 41 41 private variable _formatIcon ""; 42 private variable _colorIcon ""; 43 private variable _colorText ""; 42 44 43 45 private common _oldSettingsFile "~/.rpsettings" … … 81 83 private method GetAxisType { axis } 82 84 private method restore { toolName plotName data } 85 private method AddColorToMenu { menu name color } 83 86 84 87 # Same dialog may be used for different graphs … … 564 567 itcl::body Rappture::XyPrint::GetElement { args } { 565 568 set index 1 569 set page $itk_component(legend_page) 566 570 array unset _settings $this-element-* 567 571 foreach elem [$_clone element show] { … … 572 576 set elem $_settings($this-element-$index) 573 577 set _settings($this-element-label) [$_clone element cget $elem -label] 574 set _settings($this-element-color) [$_clone element cget $elem -color] 578 579 set color [$_clone element cget $elem -color] 580 set found 0 581 set m $page.color.menu 582 foreach item [$m names] { 583 set c [$m item cget $item -value] 584 if { $c == $color } { 585 set color $item 586 set found 1 587 break 588 } 589 } 590 if { !$found } { 591 AddColorToMenu $m $color $color 592 } 593 $m select $color 594 575 595 if { [$_clone element type $elem] != "bar" } { 576 596 set _settings($this-element-symbol) [$_clone element cget $elem -symbol] 577 597 set _settings($this-element-dashes) [$_clone element cget $elem -dashes] 578 }579 set page $itk_component(legend_page)580 set color [$page.color label $_settings($this-element-color)]581 if { $color == "" } {582 set color [Color2RGB $_settings($this-element-color)]583 $page.color choices insert end $color $color584 $page.color value $color585 } else {586 $page.color value [$page.color label $_settings($this-element-color)]587 598 } 588 599 if { [$_clone element type $elem] != "bar" } { … … 764 775 "Display the legend." 765 776 766 label $page.position_l -text "position"777 blt::tk::label $page.position_l -text "position" 767 778 Rappture::Combobox $page.position -width 15 -editable no 768 779 $page.position choices insert end \ … … 807 818 "Select the current entry." 808 819 809 label $page.label_l -text "label"820 blt::tk::label $page.label_l -text "label" 810 821 entry $page.label \ 811 822 -background white \ … … 815 826 "Set the label of the current entry in the legend." 816 827 828 blt::tk::label $page.color_l -text "color" 829 set m $page.color.menu 830 blt::comboentry $page.color \ 831 -width 1i \ 832 -textvariable [itcl::scope _colorText] \ 833 -iconvariable [itcl::scope _colorIcon] \ 834 -editable no -menu $m \ 835 -command [itcl::code $this ApplyElementSettings] 836 blt::combomenu $m \ 837 -xscrollbar $m.xs \ 838 -yscrollbar $m.ys \ 839 -textvariable [itcl::scope _colorText] \ 840 -iconvariable [itcl::scope _colorIcon] \ 841 -height { 0 2i } 842 blt::tk::scrollbar $m.xs 843 blt::tk::scrollbar $m.ys 844 foreach {rgb name} { 845 "#000000" "black" 846 "#ffffff" "white" 847 "#0000cd" "blue" 848 "#cd0000" "red" 849 "#00cd00" "green" 850 "#3a5fcd" "royal blue" 851 "#cdcd00" "yellow" 852 "#cd1076" "deep pink" 853 "#009acd" "deep sky blue" 854 "#00c5cd" "turquoise" 855 "#a2b5cd" "light steel blue" 856 "#7ac5cd" "cadet blue" 857 "#66cdaa" "aquamarine" 858 "#a2cd5a" "dark olive green" 859 "#cd9b9b" "rosy brown" 860 "#0000ff" "blue1" 861 "#ff0000" "red1" 862 "#00ff00" "green1" 863 } { 864 AddColorToMenu $m $name $rgb 865 } 866 Rappture::Tooltip::for $page.color \ 867 "Set the color of the current entry." 868 869 if 0 { 817 870 label $page.color_l -text "color " 818 871 Rappture::Combobox $page.color -width 15 -editable no … … 839 892 Rappture::Tooltip::for $page.color \ 840 893 "Set the color of the current entry." 841 842 label $page.dashes_l -text "line style"894 } 895 blt::tk::label $page.dashes_l -text "line style" 843 896 Rappture::Combobox $page.dashes -width 15 -editable no 844 897 $page.dashes choices insert end \ … … 852 905 "Set the line style of the current entry." 853 906 854 label $page.symbol_l -text "symbol"907 blt::tk::label $page.symbol_l -text "symbol" 855 908 Rappture::Combobox $page.symbol -editable no 856 909 $page.symbol choices insert end \ … … 1278 1331 set index [$itk_component(element_slider) get] 1279 1332 set page $itk_component(legend_page) 1280 set _settings($this-element-color) [$page.color current]1281 1333 if { $_clone != "" } { 1282 1334 set elem $_settings($this-element-$index) … … 1545 1597 return $out 1546 1598 } 1599 1600 itcl::body Rappture::XyPrint::AddColorToMenu { m name color } { 1601 set icon [image create picture -width 19 -height 17] 1602 $icon blank 0x0 1603 $icon draw circle 7 7 8 -color black \ 1604 -antialiased 1 -linewidth 0 -shadow { -width 1 -offset 1 } 1605 $icon draw circle 7 7 7 -color $color \ 1606 -antialiased 1 -linewidth 0 1607 $m add -text $name -icon $icon -value $color \ 1608 -variable [itcl::scope _settings($this-element-color)] 1609 }
Note: See TracChangeset
for help on using the changeset viewer.