#FEATURE by cg
class: GnuplotGraphView
class definition
added:
#gnuplotCommand
#gnuplotCommand:
changed:
#generateImage
#redrawX:y:width:height:
--- a/GnuplotGraphView.st Tue Mar 10 15:26:11 2020 +0100
+++ b/GnuplotGraphView.st Sat Mar 21 11:42:53 2020 +0100
@@ -16,7 +16,7 @@
"{ NameSpace: Smalltalk }"
ImageView subclass:#GnuplotGraphView
- instanceVariableNames:'script data title formatHolder'
+ instanceVariableNames:'script data title formatHolder gnuplotCommand'
classVariableNames:''
poolDictionaries:''
category:'Views-Misc'
@@ -215,6 +215,10 @@
data := something.
!
+gnuplotCommand:something
+ gnuplotCommand := something.
+!
+
hasNoScript
^ [ script isEmptyOrNil ]
!
@@ -353,7 +357,7 @@
scriptUsed := self defaultScript.
].
- command := 'gnuplot "%1"'.
+ command := self gnuplotCommand,' "%1"'.
argsDict := Dictionary new.
tmpDir := Filename tempDirectory.
@@ -428,8 +432,29 @@
"/ super generateMagnifiedImage.
!
+gnuplotCommand
+ gnuplotCommand isNil ifTrue:[
+ gnuplotCommand := OperatingSystem getEnvironment:'GNUPLOT'.
+ gnuplotCommand isEmptyOrNil ifTrue:[
+ gnuplotCommand := 'gnuplot'
+ ].
+ (OperatingSystem canExecuteCommand:gnuplotCommand) ifFalse:[
+ OperatingSystem isMSWINDOWSlike ifTrue:[
+ (OperatingSystem canExecuteCommand:'%PROGRAMFILES%\gnuplot\bin\gnuplot.exe') ifTrue:[
+ gnuplotCommand := '%PROGRAMFILES%\gnuplot\bin\gnuplot.exe'
+ ].
+ ].
+ ].
+ ].
+ ^ gnuplotCommand
+
+ "
+ self basicNew gnuplotCommand
+ "
+!
+
redrawX:x y:y width:w height:h
- (OperatingSystem canExecuteCommand:'gnuplot') ifFalse:[
+ (OperatingSystem canExecuteCommand:(self gnuplotCommand)) ifFalse:[
self clearRectangleX:x y:y width:w height:h.
self showWarning.
^ self.