~ubuntu-branches/ubuntu/karmic/maxima/karmic

« back to all changes in this revision

Viewing changes to interfaces/xmaxima/Tkmaxima/Plotconf.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-11-13 18:39:14 UTC
  • mto: (2.1.2 hoary) (3.2.1 sid) (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041113183914-ttig0evwuatnqosl
Tags: upstream-5.9.1
ImportĀ upstreamĀ versionĀ 5.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*-mode: tcl; fill-column: 75; tab-width: 8; coding: iso-latin-1-unix -*-
2
2
#
3
 
#       $Id: Plotconf.tcl,v 1.7 2002/09/19 16:26:42 mikeclarkson Exp $
 
3
#       $Id: Plotconf.tcl,v 1.8 2004/03/28 07:28:27 vvzhy Exp $
4
4
#
5
5
###### plotconf.tcl ######
6
6
############################################################
46
46
    set buttonFont $buttonfont
47
47
    oset $win buttonFont $buttonfont
48
48
 
 
49
    menubutton $w.plotmenu -text "Menu Here" -direction below -menu $w.plotmenu.m  -relief flat -borderwidth 0 -background white -font $buttonFont
 
50
    menu $w.plotmenu.m -tearoff 0
 
51
 
49
52
    #    puts "children wb=[winfo children $w]"
50
53
    set wb $w.buttons
51
54
    frame $wb
52
55
    set dismiss [concat $dismiss "; clearLocal $win "]
53
56
 
54
 
    button $wb.dismiss -text Dismiss -command $dismiss -font $buttonFont
55
 
    setBalloonhelp $win $wb.dismiss {Close this plot window}
56
 
 
57
 
    button $wb.zoom -text "Zoom" -command "showZoom $w" -font $buttonFont
58
 
    setBalloonhelp $win $wb.zoom {Magnify the plot.  Causes clicking with the left mouse button on the plot, to magnify (zoom in) the plot where you click.  Also causes Shift+Click to  it to unmagnify (zoom out) at that point}
59
 
    oset $w position ""
60
 
 
 
57
    $w.plotmenu.m add command -label "Dismiss" -command $dismiss -font $buttonFont
 
58
    ##setBalloonhelp $win $wb.dismiss {Close this plot window}
 
59
    $w.plotmenu.m add command -label "Zoom" -command "showZoom $w" -font $buttonFont
 
60
    ##setBalloonhelp $win $wb.zoom {Magnify the plot.  Causes clicking with the left mouse button on the plot, to magnify (zoom in) the plot where you click.  Also causes Shift+Click to  it to unmagnify (zoom out) at that point}
 
61
    ##oset $w position ""
61
62
    #    button $w.position -textvariable [oloc $w position] -font $buttonFont -width 10
62
 
    label $w.position  -textvariable [oloc $w position] -font $buttonFont -width 10
63
 
    setBalloonhelp $win $w.position {Position of the pointer in real x y coordinates.  For 3d it is the position of the nearest vertex of the polygon the pointer is over.}
64
 
 
65
 
    button $wb.help -text "Help" -command "doHelp$type $win" -font $buttonFont
66
 
    setBalloonhelp $win $wb.help {Give more help about this plot window}
67
 
    button $wb.postscript -textvariable writefile -command "writePostscript $w" -font $buttonFont
68
 
    setBalloonhelp $win $wb.postscript {Prints or Saves the plot in postscript format.  The region to be printed is marked using Mark.   Other print options can be obtained by using "Print Options" in the Config menu }
69
 
 
70
 
 
71
 
    button $wb.markrect -text "Mark" -command "markToPrint $c printrectangle \[eval \[oget $win maintitle\]\]" -font $buttonFont
72
 
    setBalloonhelp $win $wb.markrect {Mark the region to be printed.  Causes the left mouse button to allow marking of a rectangle by clicking at the upper left corner, and dragging the mouse to the lower right corner.  The title can be set under "Print Options" under Config}
73
 
    button $wb.replot -text "Replot" -command "replot$type $win" -font $buttonFont
74
 
    setBalloonhelp $win $wb.replot {Use the current settings and recompute the plot.  The settings may be altered in Config}
75
 
 
76
 
 
77
 
 
78
 
    button $wb.config -text "Config" -command "doConfig$type $win" -font $buttonFont
79
 
    setBalloonhelp $win $wb.config {Configure various options about the plot window.  After doing this one may do replot.  Hint: you may leave the config menu on the screen and certain actions take place immediately, such as rotating or computing a trajectory at a point.  To make room for the window you might slide the graph to the right, and possibly shrink it using the unzoom feature}
80
 
 
81
 
 
 
63
    ##label $w.position  -textvariable [oloc $w position] -font $buttonFont -width 10
 
64
    ##setBalloonhelp $win $w.position {Position of the pointer in real x y coordinates.  For 3d it is the position of the nearest vertex of the polygon the pointer is over.}
 
65
    $w.plotmenu.m add command -label "Help" -command "doHelp$type $win" -font $buttonFont
 
66
    ##setBalloonhelp $win $wb.help {Give more help about this plot window}
 
67
    $w.plotmenu.m add command -label "Save" -command "writePostscript $w" -font $buttonFont
 
68
    ##setBalloonhelp $win $wb.postscript {Prints or Saves the plot in postscript format.  The region to be printed is marked using Mark.   Other print options can be obtained by using "Print Options" in the Config menu }
 
69
    $w.plotmenu.m add command -label "Mark" -command "markToPrint $c printrectangle \[eval \[oget $win maintitle\]\]" -font $buttonFont
 
70
    ##setBalloonhelp $win $wb.markrect {Mark the region to be printed.  Causes the left mouse button to allow marking of a rectangle by clicking at the upper left corner, and dragging the mouse to the lower right corner.  The title can be set under "Print Options" under Config}
 
71
    $w.plotmenu.m add command -label "Replot" -command "replot$type $win" -font $buttonFont
 
72
    ##setBalloonhelp $win $wb.replot {Use the current settings and recompute the plot.  The settings may be altered in Config}
 
73
    $w.plotmenu.m add command -label "Config" -command "doConfig$type $win" -font $buttonFont
 
74
    ##setBalloonhelp $win $wb.config {Configure various options about the plot window.  After doing this one may do replot.  Hint: you may leave the config menu on the screen and certain actions take place immediately, such as rotating or computing a trajectory at a point.  To make room for the window you might slide the graph to the right, and possibly shrink it using the unzoom feature}
82
75
 
83
76
    #mike FIXME: this is a wrong use of after cancel
84
 
    bind $win.position <Enter> "+place $win.buttons -in $win.position -x 0 -rely 1.0 ;  after cancel lower $win.position ; raise $win.buttons "
85
 
    bind $win.buttons <Leave> "deleteBalloon $c ; place forget $win.buttons"
 
77
    ##bind $win.position <Enter> "+place $win.buttons -in $win.position -x 0 -rely 1.0 ;  after cancel lower $win.position ; raise $win.buttons "
 
78
    ##bind $win.buttons <Leave> "deleteBalloon $c ; place forget $win.buttons"
86
79
 
87
80
    # pack $wb
88
81
    scrollbar $w.hscroll -orient horiz -command "$c xview"
107
100
    bind $c <B3-Motion> "$c scan dragto %x %y"
108
101
    bind $c <Motion> "showPosition $w %x %y"
109
102
    bind $c <Configure> "reConfigure $c %w %h"
110
 
    bind $c <Enter> "raise $win.position"
111
 
    bind $c <Leave> "after 200 lower $win.position"
112
 
    $w.position config -background [$c cget -background]
113
 
 
114
 
 
115
 
    pack  $wb.dismiss $wb.help $wb.zoom   \
116
 
        $wb.postscript $wb.markrect $wb.replot $wb.config -side top -expand 1 -fill x
 
103
    ##bind $c <Enter> "raise $win.position"
 
104
    ##bind $c <Leave> "after 200 lower $win.position"
 
105
    $w.plotmenu config -background [$c cget -background]
 
106
 
 
107
 
 
108
    ##pack  $wb.dismiss $wb.help $wb.zoom   \
 
109
    ##  $wb.postscript $wb.markrect $wb.replot $wb.config -side top -expand 1 -fill x
117
110
    if { 0 } {
118
111
        pack $w.hscroll -side bottom -expand 1 -fill x
119
112
        pack $w.vscroll -side right -expand 1 -fill y
121
114
    pack $w.c -side right -expand 1 -fill both
122
115
 
123
116
    pack $w
124
 
    place $w.position -in $w -x 2 -y 2 -anchor nw
125
 
    oset $w position "Menu Here"
 
117
    place $w.plotmenu -in $w -x 2 -y 2 -anchor nw
 
118
    
126
119
    if { ![info exists maxima_priv(showedplothelp)] ||
127
120
         [llength $maxima_priv(showedplothelp)] < 2 } {
128
121
        lappend maxima_priv(showedplothelp) 1
129
122
        
130
 
        after 100 balloonhelp $w $w.position [list \
131
 
                                                  "Initial help: Moving the mouse over the position \
132
 
                window (top left corner), will bring up a menu.  Holding down \
 
123
        after 100 balloonhelp $w $w.plotmenu [list \
 
124
                "Initial help: Clicking the left mouse button on the plot menu \
 
125
                (top left corner), will bring up a menu.  Holding down \
133
126
                right mouse button and dragging will translate the plot"]
134
 
        after 2000 $w.c delete balloon
 
127
        after 3000 $w.c delete balloon
135
128
        
136
129
 
137
130
    }
138
131
 
139
 
    raise $w.position
 
132
    raise $w.plotmenu
140
133
 
141
134
    pack [winfo parent $wb]
142
135
    # update
217
210
    makeLocal $win c
218
211
    # we catch so that in case have no functions or data..
219
212
    catch {
220
 
        oset $win position \
 
213
        $win.plotmenu config -text \
221
214
            "[format {(%.2f,%.2f)}  [storx$win [$c canvasx $x]] [story$win [$c canvasy $y]]]"
222
215
    }
223
216
}
225
218
proc showZoom  { win } {
226
219
    #  global c position
227
220
    makeLocal $win c
228
 
    oset $win position "Click to Zoom\nShift+Click Unzoom"
 
221
    $win.plotmenu config -text "Click to Zoom\nShift+Click Unzoom"
229
222
 
230
223
    bind $c <1> "doZoom $win %x %y 1"
231
224
    bind $c  <Shift-1> "doZoom $win %x %y -1"