~ubuntu-branches/ubuntu/precise/grass/precise

« back to all changes in this revision

Viewing changes to visualization/nviz/scripts/panel_kanimator.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2011-04-13 17:08:41 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110413170841-ss1t9bic0d0uq0gz
Tags: 6.4.1-1
* New upstream version.
* Now build-dep on libjpeg-dev and current libreadline6-dev.
* Removed patch swig: obsolete.
* Policy bumped to 3.9.2, without changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
    global bit_map_path
77
77
 
78
78
    frame $BASE  -relief groove -borderwidth 2
79
 
    set panel [St_create {window name size priority} $BASE "Keyframe Animation" 2 5]
80
 
    Nv_mkPanelname $BASE "Keyframe Animation Panel"
 
79
    set panel [St_create {window name size priority} $BASE [G_msg "Keyframe Animation"] 2 5]
 
80
    Nv_mkPanelname $BASE [G_msg "Keyframe Animation Panel"]
81
81
 
82
82
    # Create the top section containing play control, framerate, and Add and Delete buttons
83
83
    frame $BASE.playcontrol -relief groove -borderwidth 2
93
93
        -command "keyanimOneForward $BASE"
94
94
    button $rname.forward -height 20 -width 20 -bitmap @$bit_map_path/right \
95
95
        -command "keyanimPlayForward $BASE"
96
 
    button $rname.label -text "Framerate :" -command "keyanimChangeFramerate $BASE"
 
96
    button $rname.label -text [G_msg "Framerate :"] -command "keyanimChangeFramerate $BASE"
97
97
    label  $rname.val   -textvariable keyanimFrameRate
98
98
    pack $rname.back $rname.slow_back $rname.stop $rname.slow_forward \
99
99
        $rname.forward -side left -padx 4 -pady 2 -fill y -expand no
102
102
 
103
103
    frame $BASE.commands -relief groove -borderwidth 2
104
104
    set rname $BASE.commands
105
 
    label $rname.label -text "File: "
106
 
    button $rname.save          -text "Save"    -command "keyanimSaveAnim $BASE"
107
 
    button $rname.load          -text "Load"    -command "keyanimLoadAnim $BASE"
 
105
    label $rname.label -text [G_msg "File: "]
 
106
    button $rname.save -text [G_msg "Save"]    -command "keyanimSaveAnim $BASE"
 
107
    button $rname.load -text [G_msg "Load"]    -command "keyanimLoadAnim $BASE"
108
108
 
109
 
    label $rname.label2 -text "Animation: "
110
 
    button $rname.rands -text "Run and Save" -command "keyanimRunAndSave $BASE"
111
 
    button $rname.close -text "Close" -command "Nv_closePanel $BASE"
 
109
    label $rname.label2 -text [G_msg "Animation: "]
 
110
    button $rname.rands -text [G_msg "Run and Save"] -command "keyanimRunAndSave $BASE"
 
111
    button $rname.close -text [G_msg "Close"] -command "Nv_closePanel $BASE"
112
112
 
113
113
    pack $rname.label2 $rname.rands $rname.label $rname.save $rname.load \
114
114
        -side left -padx 2 -pady 2 -padx 2 -fill y -expand no
127
127
    # Create bottom section containing current keytime
128
128
    frame $BASE.keytime -relief groove -borderwidth 2
129
129
    set rname $BASE.keytime
130
 
    button $rname.add           -text "Add"     -command "keyanimAddKey $BASE"
131
 
    button $rname.delete        -text "Delete"  -command "keyanimDeleteKeys $BASE"
132
 
    button $rname.change -text "New Key Time:" -command "keyanimChangeKeytime $BASE"
 
130
    button $rname.add           -text [G_msg "Add"]     -command "keyanimAddKey $BASE"
 
131
    button $rname.delete        -text [G_msg "Delete"]  -command "keyanimDeleteKeys $BASE"
 
132
    button $rname.change -text [G_msg "New Key Time:"] -command "keyanimChangeKeytime $BASE"
133
133
    label $rname.current -textvariable keyanimCurrentKeyTime
134
134
    pack $rname.add $rname.delete -side left -padx 2 -pady 2 -fill y -expand no
135
135
    pack $rname.current $rname.change -side right -padx 2 -fill y -expand no
140
140
    frame $BASE.other_commands -relief groove -borderwidth 2
141
141
    set rname $BASE.other_commands
142
142
    menubutton $rname.menu1 -menu $rname.menu1.m1 \
143
 
        -indicatoron 1 -text "Show Feature" -relief raised
 
143
        -indicatoron 1 -text [G_msg "Show Feature"] -relief raised
144
144
 
145
145
    menu $rname.menu1.m1
146
 
    $rname.menu1.m1 add checkbutton -label "Path" -variable keyanimPathState \
 
146
    $rname.menu1.m1 add checkbutton -label [G_msg "Path"] -variable keyanimPathState \
147
147
        -command {Nshow_path $keyanimPathState} -onvalue on -offvalue off
148
 
    $rname.menu1.m1 add checkbutton -label "Vect Lines/Polygons" -variable keyanimVectState \
 
148
    $rname.menu1.m1 add checkbutton -label [G_msg "Vect Lines/Polygons"] -variable keyanimVectState \
149
149
        -command {Nshow_vect $keyanimVectState} -onvalue on -offvalue off
150
 
    $rname.menu1.m1 add checkbutton -label "Vect Points" -variable keyanimSiteState \
 
150
    $rname.menu1.m1 add checkbutton -label [G_msg "Vect Points"] -variable keyanimSiteState \
151
151
        -command {Nshow_site $keyanimSiteState} -onvalue on -offvalue off
152
 
    $rname.menu1.m1 add checkbutton -label "Volume" -variable keyanimVolState \
 
152
    $rname.menu1.m1 add checkbutton -label [G_msg "Volume"] -variable keyanimVolState \
153
153
        -command {Nshow_vol $keyanimVolState} -onvalue on -offvalue off
154
 
    $rname.menu1.m1 add checkbutton -label "Labels/Legend" \
 
154
    $rname.menu1.m1 add checkbutton -label [G_msg "Labels/Legend"] \
155
155
        -variable keyanimLabState \
156
156
        -command {Nshow_lab $keyanimLabState} -onvalue on -offvalue off
157
157
 
158
158
    menubutton $rname.menu2 -menu $rname.menu2.m1 \
159
 
        -indicatoron 1 -text "Interp." -relief raised
 
159
        -indicatoron 1 -text [G_msg "Interp."] -relief raised
160
160
 
161
161
    menu $rname.menu2.m1
162
 
    $rname.menu2.m1 add radiobutton -label "linear" \
 
162
    $rname.menu2.m1 add radiobutton -label [G_msg "linear"] \
163
163
        -variable keyanimInterpType -value linear \
164
164
        -command "Nset_interp_mode linear ; Nupdate_frames ; $rname.tension configure -state disabled -background gray80"
165
 
    $rname.menu2.m1 add radiobutton -label "spline" \
 
165
    $rname.menu2.m1 add radiobutton -label [G_msg "spline"] \
166
166
        -variable keyanimInterpType -value spline \
167
167
        -command "Nset_interp_mode spline ; Nupdate_frames ; $rname.tension configure -state normal -background gray90"
168
 
    scale $rname.tension -label "tension" -orient h \
 
168
    scale $rname.tension -label [G_msg "tension"] -orient h \
169
169
        -showvalue f -from 0 -to 1000 -command keyanimChangeTension \
170
170
        -activebackground gray80 -background gray90
171
171
 
227
227
 
228
228
    frame $rname
229
229
    label $rname.label -relief raised -text [lindex $element 0] -width 10
230
 
    checkbutton $rname.active -text "On" -variable $channel_iname
 
230
    checkbutton $rname.active -text [G_msg "On"] -variable $channel_iname
231
231
    global $channel_iname
232
232
    set $channel_iname 1
233
233
 
444
444
    append name [keyanimGenTag]
445
445
 
446
446
    toplevel $name
447
 
    label $name.label -text "New Key Time"
 
447
    label $name.label -text [G_msg "New Key Time"]
448
448
    pack $name.label
449
449
 
450
450
    frame $name.lgroup -relief groove
451
 
    label $name.lgroup.mlabel -text "Minute:" -relief raised
452
 
    label $name.lgroup.slabel -text "Second:" -relief raised
453
 
    label $name.lgroup.flabel -text "Frame:" -relief raised
 
451
    label $name.lgroup.mlabel -text [G_msg "Minute:"] -relief raised
 
452
    label $name.lgroup.slabel -text [G_msg "Second:"] -relief raised
 
453
    label $name.lgroup.flabel -text [G_msg "Frame:"] -relief raised
454
454
    pack $name.lgroup.mlabel $name.lgroup.slabel \
455
455
        $name.lgroup.flabel -fill both -padx 2 -pady 2
456
456
    pack $name.lgroup -side left -fill both
463
463
        $name.egroup.fentry -fill both -padx 2 -pady 2
464
464
    pack $name.egroup -side right -fill both
465
465
 
466
 
    button $name.ok -text "Ok" -command "set button 1"
 
466
    button $name.ok -text [G_msg "Ok"] -command "set button 1"
467
467
    pack $name.ok -side bottom -fill both -before $name.label
468
468
 
469
469
    # Grab the focus
493
493
    if { [string length $frames] == 0 } then { set frames 0 }
494
494
 
495
495
    if { ($minutes < 0) || ($seconds < 0) || ($frames < 0) } then {
496
 
        tk_dialog .kt_error "KeyTime Error" "Error - All values must be at least zero." \
497
 
            {} 0 Dismiss
 
496
        tk_dialog .kt_error [G_msg "KeyTime Error"] [G_msg "Error - All values must be at least zero."] \
 
497
            {} 0 [G_msg "Dismiss"
498
498
        destroy $name
499
499
        focus $oldFocus
500
500
        return
501
501
    }
502
502
 
503
503
    if { $frames >= $keyanimFrameRate } then {
504
 
        tk_dialog .kt_error "KeyTime Error" \
505
 
            "Error - Frame number must be less than frame rate." \
506
 
            {} 0 Dismiss
 
504
        tk_dialog .kt_error [G_msg "KeyTime Error"] [G_msg "Error - Frame number must be less than frame rate."] \
 
505
            {} 0 [G_msg "Dismiss"]
507
506
        destroy $name
508
507
        focus $oldFocus
509
508
        return
538
537
    append name [keyanimGenTag]
539
538
 
540
539
    toplevel $name
541
 
    label $name.label -text "New Frame Rate"
 
540
    label $name.label -text [G_msg "New Frame Rate"]
542
541
    pack $name.label
543
542
 
544
543
    frame $name.lgroup -relief groove
545
 
    label $name.lgroup.flabel -text "Framerate:" -relief raised
 
544
    label $name.lgroup.flabel -text [G_msg "Framerate:"] -relief raised
546
545
    pack $name.lgroup.flabel -fill both -padx 2 -pady 2
547
546
    pack $name.lgroup -side left -fill both
548
547
 
551
550
    pack $name.egroup.fentry -fill both -padx 2 -pady 2
552
551
    pack $name.egroup -side right -fill both
553
552
 
554
 
    button $name.ok -text "Ok" -command "set button 1"
 
553
    button $name.ok -text [G_msg "Ok"] -command "set button 1"
555
554
    pack $name.ok -side bottom -fill both -before $name.label
556
555
 
557
556
    # Grab the focus
574
573
    }
575
574
 
576
575
    if {$framerate < 1} then {
577
 
        tk_dialog .fr_error "Frame Rate Error" "Error - Frame rate must be at least 1." \
578
 
            {} 0 Dismiss
 
576
        tk_dialog .fr_error [G_msg "Frame Rate Error"] [G_msg "Error - Frame rate must be at least 1."] \
 
577
            {} 0 [G_msg "Dismiss"]
579
578
        destroy $name
580
579
        focus $oldFocus
581
580
        return
674
673
                }
675
674
            }
676
675
            if {$tag_name == ""} then {
677
 
                tk_dialog .ierror "Internal Error" \
678
 
                    "Internal Error - Can't find channel $cname for keyframe $i" \
679
 
                    {} 0 Dismiss
 
676
                tk_dialog .ierror [G_msg "Internal Error"] \
 
677
                    [format [G_msg "Internal Error - Can't find channel %s for keyframe %s"] $cname $i] \
 
678
                    {} 0 [G_msg "Dismiss"]
680
679
                return
681
680
            }
682
681
 
854
853
    }
855
854
 
856
855
    # Popup a dialog to verify the delete
857
 
    set ans [tk_dialog .delete_keys "Delete Keys" \
858
 
                 "Delete the selected keys?" \
859
 
                 {} 1 Ok Dismiss]
 
856
    set ans [tk_dialog .delete_keys [G_msg "Delete Keys"] \
 
857
                 [G_msg "Delete the selected keys?"] \
 
858
                 {} 1 [G_msg "Ok"] [G_msg "Dismiss"]]
860
859
    if {$ans == 1} then { return }
861
860
 
862
861
    # Delete each key in turn
869
868
        # Deleted the specified key internally
870
869
        set internal_time [lindex [lindex $keyanimKeyList $where] 0]
871
870
        if {[Ndelete_key $internal_time 0 1] == 0} then {
872
 
            tk_dialog .ierror "Internal Error" \
873
 
                "Internal Error - Failed to delete keyframe in GK key list" \
874
 
                {} 0 Dismiss
 
871
            tk_dialog .ierror [G_msg "Internal Error"] \
 
872
                [G_msg "Internal Error - Failed to delete keyframe in GK key list"] \
 
873
                {} 0 [G_msg "Dismiss"]
875
874
        }
876
875
        Nupdate_frames
877
876
 
1003
1002
 
1004
1003
    # Move the key internally
1005
1004
    if {[Nmove_key $old_time 0 $new_time] == 0} then {
1006
 
        tk_dialog .ierror "Internal Error" \
1007
 
            "Internal Error - Failed to move keyframe in GK key list" \
1008
 
            {} 0 Dismiss
 
1005
        tk_dialog .ierror [G_msg "Internal Error"] \
 
1006
            [G_msg "Internal Error - Failed to move keyframe in GK key list"] \
 
1007
            {} 0 [G_msg "Dismiss"]
1009
1008
    }
1010
1009
 
1011
1010
    # After everything's said and done, redraw the keyframes
1122
1121
    if { $extract_where != -1} then {
1123
1122
 
1124
1123
        # Found the new key, do a popup for the replace
1125
 
        set ans [tk_dialog .replace "Replace Key" \
1126
 
                     "There is already a keyframe at this time, replace it?" \
1127
 
                     {} 1 Ok Dismiss]
 
1124
        set ans [tk_dialog .replace [G_msg "Replace Key"] \
 
1125
                     [G_msg "There is already a keyframe at this time, replace it?"] \
 
1126
                     {} 1 [G_msg "Ok"] [G_msg "Dismiss"]]
1128
1127
        if {$ans == 1} then { return }
1129
1128
 
1130
1129
        # Otherwise do the replace
1219
1218
    append BASE .keycontrol
1220
1219
 
1221
1220
    # Create canvas to hold channels for keyframes
1222
 
    label $BASE.title -text "Keyframe Attributes"
 
1221
    label $BASE.title -text [G_msg "Keyframe Attributes"]
1223
1222
    canvas $BASE.key_channels -width 10c -height 2c -yscrollcommand "$BASE.scrolly set" \
1224
1223
        -xscrollcommand "$BASE.scrollx set" -confine true -xscrollincrement 1 \
1225
1224
        -yscrollincrement 1
1247
1246
    frame $BASE.key_times.hold_times -width 10c -height 10c
1248
1247
    label $BASE.key_times.hold_times.spacer1 -width 10 -text ""
1249
1248
    checkbutton $BASE.key_times.hold_times.spacer2 \
1250
 
        -text "On" -state disabled -relief flat -bd 0 -padx 3
 
1249
        -text [G_msg "On"] -state disabled -relief flat -bd 0 -padx 3
1251
1250
    $BASE.key_times.hold_times.spacer2 configure \
1252
1251
        -disabledforeground [lindex [$BASE.key_times.hold_times.spacer2 \
1253
1252
                                         configure -background] 4]
1697
1696
    frame .ras_fname.frame3
1698
1697
    frame .ras_fname.frame4
1699
1698
    frame .ras_fname.frame5
1700
 
    label .ras_fname.title -text "Enter a base name:"
 
1699
    label .ras_fname.title -text [G_msg "Enter a base name:"]
1701
1700
    entry .ras_fname.enter -relief sunken
1702
1701
 
1703
 
    label .ras_fname.label -text "Render:"
1704
 
    radiobutton .ras_fname.norm -text "Wireframe" \
 
1702
    label .ras_fname.label -text [G_msg "Render:"]
 
1703
    radiobutton .ras_fname.norm -text [G_msg "Wireframe"] \
1705
1704
        -variable keyanimSaveRenderStyle -value 0
1706
 
    radiobutton .ras_fname.fancy -text "Full Rendering" \
 
1705
    radiobutton .ras_fname.fancy -text [G_msg "Full Rendering"] \
1707
1706
        -variable keyanimSaveRenderStyle -value 1
1708
1707
 
1709
 
    button .ras_fname.ok -text "Ok" -command "set keyanimWaitPress true"
 
1708
    button .ras_fname.ok -text [G_msg "Ok"] -command "set keyanimWaitPress true"
1710
1709
 
1711
 
    label .ras_fname.label1 -text "Image:"
 
1710
    label .ras_fname.label1 -text [G_msg "Image:"]
1712
1711
    # Start at value 2. 1 used to be SGI .rgb support
1713
 
    radiobutton .ras_fname.img2 -text "PPM" -variable IMG -value 2
1714
 
    radiobutton .ras_fname.img3 -text "TIFF" -variable IMG -value 3
1715
 
    radiobutton .ras_fname.img4 -text "MPEG-1" -variable IMG -value 4
 
1712
    radiobutton .ras_fname.img2 -text [G_msg "PPM"] -variable IMG -value 2
 
1713
    radiobutton .ras_fname.img3 -text [G_msg "TIFF"] -variable IMG -value 3
 
1714
    radiobutton .ras_fname.img4 -text [G_msg "MPEG-1"] -variable IMG -value 4
1716
1715
 
1717
 
    label .ras_fname.label2 -text "Start Frame:"
 
1716
    label .ras_fname.label2 -text [G_msg "Start Frame:"]
1718
1717
    entry .ras_fname.enter2 -relief sunken -width 6
1719
 
    checkbutton .ras_fname.check1 -text "Off-Screen" \
 
1718
    checkbutton .ras_fname.check1 -text [G_msg "Off-Screen"] \
1720
1719
    -variable "keyanimOff"
1721
1720
 
1722
1721
#Pack Menu
1870
1869
    if {[llength $keyanimKeyList] == 0} then {
1871
1870
        tk_dialog .na_error "No Anim Error" \
1872
1871
            "There are no keys in the current animation to save" \
1873
 
            {} 0 Dismiss
 
1872
            {} 0 [G_msg "Dismiss"]
1874
1873
        return
1875
1874
    }
1876
1875
 
1906
1905
    global keyanimKeyList keyanimFrameRate keyanimSaved keyanimUniqueTag
1907
1906
 
1908
1907
    if {($keyanimSaved == 0) && ([llength $keyanimKeyList] != 0)} then {
1909
 
        set status [tk_dialog .ka_check "Verify" \
1910
 
                        "Warning - Current animation has not been saved, continue?" \
1911
 
                        {} 1 Ok Cancel]
 
1908
        set status [tk_dialog .ka_check [G_msg "Verify"] \
 
1909
                        [G_msg "Warning - Current animation has not been saved, continue?"] \
 
1910
                        {} 1 [G_msg "Ok"] [G_msg "Cancel"]]
1912
1911
        if {$status == 1} return
1913
1912
    }
1914
1913
 
1921
1920
 
1922
1921
    set file_handle ""
1923
1922
    if {[catch "open $file_name r" file_handle] != 0} then {
1924
 
        tk_dialog .ka_error "File Error" \
1925
 
            "Error - Could not open file $file_name for reading" \
1926
 
            {} 0 Dismiss
 
1923
        tk_dialog .ka_error [G_msg "File Error"] \
 
1924
            [format [G_msg "Error - Could not open file %s for reading"] $file_name] \
 
1925
            {} 0 [G_msg "Dismiss"]
1927
1926
        return
1928
1927
    }
1929
1928