<?xml version="1.0"?>
<OriginStorage Label="fft_filters (User)" Display="652" FileName="E:\C\VC32\originlab\X-Functions\Signal Processing\fft_filters.OXF"><XFname NodeID="11" Label="Name" DataID="300">fft_filters</XFname><xFdescription NodeID="11" Label="Description" DataID="310">&amp;FFT Filters:Perform FFT Filtering</xFdescription><attachTo NodeID="13" Label="Attach to Origin Object" Combo="None|Auto|Column|Sheet/Layer|Book/Graph" DataID="320" Show="0">1</attachTo><author NodeID="11" Label="Author" DataID="314"></author><AutoDependent NodeID="10" Label="Auto Compile Dependent Files" DataID="451">1</AutoDependent><UsageCtxt NodeID="268435456" Label="Usage Context" DataID="329"><LabTalk NodeID="10" Label="Labtalk" DataID="357">1</LabTalk><WksSel NodeID="10" Label="Worksheet Selection" DataID="350">0.</WksSel><GrObj NodeID="268435456" Label="Graphic Object Events" DataID="330" Use="0"><InitAnchors NodeID="10" Label="Initialization" DataID="339">1.</InitAnchors><Move NodeID="10" Label="Move" DataID="331">1.</Move><Moving NodeID="10" Label="Moving" DataID="332">0.</Moving><Resize NodeID="10" Label="Resize" DataID="333">0.</Resize><Resizing NodeID="10" Label="Resizing" DataID="334">0.</Resizing><Delete NodeID="10" Label="Delete" DataID="335">0.</Delete><Select NodeID="10" Label="Select" DataID="336">0.</Select><Unselect NodeID="10" Label="Unselect" DataID="337">0.</Unselect><BtnClick NodeID="10" Label="Button Click" DataID="338">0.</BtnClick><Rotate NodeID="10" Label="Rotate" DataID="340">0.</Rotate><Rotating NodeID="10" Label="Rotating" DataID="341">0.</Rotating><Skew NodeID="10" Label="Skew" DataID="342">0.</Skew><Skewing NodeID="10" Label="Skewing" DataID="343">0.</Skewing><EditEv NodeID="10" Label="Edit" DataID="344">0.</EditEv><Editing NodeID="10" Label="Editing" DataID="345">0.</Editing><NewSelection NodeID="10" Label="New Selection" DataID="346">0.</NewSelection><DeletePart NodeID="10" Label="Delete Part" DataID="347">0.</DeletePart><Keyboard NodeID="10" Label="Keyboard" DataID="348">0.</Keyboard><ObjType NodeID="13" Label="Type" Combo="Rect|Line" DataID="349">0.</ObjType></GrObj><Theme NodeID="268435456" Label="Theme" DataID="386"><UseInDialog NodeID="10" Label="Support Saving Themes in Dialog" DataID="372">1.</UseInDialog><ShowInMenu NodeID="10" Label="Show Themes as Popups in Menu" DataID="352">1.</ShowInMenu><SaveInBook NodeID="10" Label="Support Saving to Book" DataID="387">0.</SaveInBook><SaveInSheet NodeID="10" Label="Support Saving to Sheet" DataID="388">0.</SaveInSheet></Theme><mainmenu NodeID="268435456" Label="Menus" DataID="365" Use="1" BranchCombo="None|Main Menus|Context Menus|Both|Context Menus 1|Context Menus 2|Context Menus 3|Context Menus 4"><AddAsTool NodeID="10" Label="Add As Tool" DataID="366">0.</AddAsTool><ClassOp NodeID="10" Label="Class Operation" DataID="367">0</ClassOp><GetN NodeID="13" Label="Auto GetN Dialog" Combo="None|Simple GetNBox|GetNGraphBox with Preview|GetNImageBox|Wizard|Custom" DataID="371">2</GetN><CustomDialog NodeID="11" Label="Custom Dialog Function" DataID="395" Show="0"></CustomDialog><DlgFromMenu NodeID="10" Label="Open Dialog from Menu for Option Index" DataID="374">1.</DlgFromMenu><checkMenu NodeID="10" Label="Check Menu" DataID="470">0.</checkMenu></mainmenu><windows NodeID="268435456" Label="Windows" DataID="450" Use="1"><graph NodeID="10" Label="Graph" DataID="368">1</graph><worksheet NodeID="10" Label="Worksheet" DataID="369">1</worksheet><matrix NodeID="10" Label="Matrix" DataID="370">0</matrix><report NodeID="10" Label="Report" DataID="360">0.</report><none NodeID="10" Label="Layout" DataID="359">0.</none><none NodeID="10" Label="None" DataID="361">0.</none></windows></UsageCtxt><outTree NodeID="10" Label="Generate LabTalk Tree upon execution" DataID="373">1.</outTree><askOutResultsLog NodeID="10" Label="Add Checkbox to Auto GetN Dialog about Results Log Output" DataID="393">0.</askOutResultsLog><outResultsLog NodeID="13" Label="Output to Results Log upon execution" Combo="None|All|Report Tree|First Input|First Output|All Outputs|All Except Trees" DataID="394">0.</outResultsLog><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="391"></customButtons><syntax NodeID="41" Label="Command Line Usage" DataID="305" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="2-18"><![CDATA[1. fft_filters Col(2) cutoff:=5; 
2. fft_filters Col(2) filter:=bandpass Freq1:=3 Freq2:=3.6; 
3. fft_filters Col(2) filter:=threshold threshold:=1; 
4. fft_filters Col(2) filter:=bandblock Freq1:=1.1 Freq2:=1.3 oy:= (Col(3), Col(4));
]]></syntax><vars NodeID="268435456" Label="Variables" Branch="1" MoveRows="" EditCol="1|1|1"><v1 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="1"><name NodeID="11" Label="Name" DataID="10">iy</name><description NodeID="11" Label="Label" DataID="20" Show="0"></description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">XYRange</type><valdata NodeID="44" Label="Data" DataID="50"><X NodeID="35" DataID="51">&lt;active&gt;</X><Y NodeID="35" DataID="52">&lt;active&gt;</Y><ED NodeID="35" DataID="53">&lt;active&gt;</ED></valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">I:16</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">Specifies the input range</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Input Data</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">入力データ範囲を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">入力データ</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Bestimmt den Eingabebereich</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Eingabedaten</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v1><v2 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="2"><name NodeID="11" Label="Name" DataID="10">filter</name><description NodeID="11" Label="Label" DataID="20" Show="0">Filter Type</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">int</type><valdata NodeID="13" Label="Data" DataID="50" Enable="1" EnumList="low|high|bandpass|bandblock|threshold|lowpp" Combo="Low Pass|High Pass|Band Pass|Band Block|Threshold|Low Pass Parabolic">0</valdata><comboString NodeID="11" Label="Control" DataID="70"><![CDATA[low:Low Pass|high:High Pass|bandpass:Band Pass|bandblock:Band Block|threshold:Threshold|lowpp:Low Pass Parabolic
]]></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69"></optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Filter Type</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">Specifies the type of the filter</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Filter Type</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" TypeID="65543" BlobArrElementaryType="8" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">QWxsb3dzIG9ubHkgbG93IGZyZXF1ZW5jeSBjb21wb25lbnRzIHRvIHBhc3MAQWxsb3dzIG9u
bHkgaGlnaCBmcmVxdWVuY3kgY29tcG9uZW50cyB0byBwYXNzAEFsbG93IG9ubHkgZnJlcXVl
bmN5IGNvbXBvbmVudHMgd2l0aGluIGEgc3BlY2lmaWVkIHJhbmdlIHRvIHBhc3MAQWxsb3cg
b25seSBmcmVxdWVuY3kgY29tcG9uZW50cyBvdXRzaWRlIGEgc3BlY2lmaWVkIHJhbmdlIHRv
IHBhc3MAQWxsb3cgb25seSBmcmVxdWVuY3kgY29tcG9uZW50cyB3aG9zZSBhbXBsaXR1ZGVz
IGFyZSBsYXJnZXIgdGhhbiB0aGUgdGhyZXNob2xkIHRvIHBhc3MAAAA=</comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">フィルタの種類</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">フィルタの種類を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">フィルタの種類</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Filtertyp</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Bestimmt den Filtertyp</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Filtertyp</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v2><v3 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="3"><name NodeID="11" Label="Name" DataID="10">freq1</name><description NodeID="11" Label="Label" DataID="20" Show="0">Lower Cutoff Frequency</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">double</type><valdata NodeID="11" Label="Data" DataID="50" Enable="1">0</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">F:*6*</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Lower Cutoff Frequency</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">This option is available only when the filter type is band pass or band block. It specifies the lower cutoff frequency.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Lower Cutoff Frequency</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">低域のカットオフ周波数</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">このオプションは、フィルタの種類がバンドパスまたはバンドブロックの場合のみ利用できます。 低域のカットオフ周波数を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">低域のカットオフ周波数</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Untere Grenzfrequenz</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Diese Option ist nur verfügbar, wenn als Filtertyp Bandpass oder Bandsperre ausgewählt wurde. Dies bestimmt die untere Grenzfrequenz.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Untere Grenzfrequenz</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v3><v4 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="4"><name NodeID="11" Label="Name" DataID="10">freq2</name><description NodeID="11" Label="Label" DataID="20" Show="0">Upper Cutoff Frequency</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">double</type><valdata NodeID="11" Label="Data" DataID="50" Enable="1">-1</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">F:*6*</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Upper Cutoff Frequency</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">This option is available only when the filter type is band pass or band block. It specifies the upper cutoff frequency.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Upper Cutoff Frequency</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">高域のカットオフ周波数</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">このオプションは、フィルタの種類がバンドパスまたはバンドブロックの場合のみ利用できます。 高域のカットオフ周波数を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">高域のカットオフ周波数</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Obere Grenzfrequenz</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Diese Option ist nur verfügbar, wenn als Filtertyp Bandpass oder Bandsperre ausgewählt wurde. Dies bestimmt die obere Grenzfrequenz.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Obere Grenzfrequenz</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v4><v5 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="5"><name NodeID="11" Label="Name" DataID="10">cutoff</name><description NodeID="11" Label="Label" DataID="20" Show="0">Cutoff Frequency</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">double</type><valdata NodeID="11" Label="Data" DataID="50" Enable="1">0</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">F:*6*</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Cutoff Frequency</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">This option is available only when the filter type is low pass or high pass. It specifies the cutoff frequency.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Cutoff Frequency</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">カットオフ周波数</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">このオプションは、フィルタの種類がローパスまたはハイパスの場合のみ利用できます。 カットオフ周波数を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">カットオフ周波数</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Grenzfrequenz</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Diese Option ist nur verfügbar, wenn als Filtertyp Tiefpass oder Hochpass ausgewählt wurde. Dies bestimmt die Grenzfrequenz.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Grenzfrequenz</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v5><v6 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="6"><name NodeID="11" Label="Name" DataID="10">pass</name><description NodeID="11" Label="Label" DataID="20" Show="0">Pass Frequency</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">double</type><valdata NodeID="11" Label="Data" DataID="50" Enable="1">-1</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">F:*6*</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Pass Frequency</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">This option is available only when the filter type is Low Pass Parabolic. All frequencies below this value will be kept unchanged after being filtered.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Pass Frequency</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Passfrequenz</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v6><v7 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="7"><name NodeID="11" Label="Name" DataID="10">stop</name><description NodeID="11" Label="Label" DataID="20" Show="0">Stop Frequency</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">double</type><valdata NodeID="11" Label="Data" DataID="50" Enable="1">-1</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">F:*6*</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Stop Frequency</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">This option is available only when the filter type is Low Pass Parabolic. All frequencies above this value will be removed completely.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Stop Frequency</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Stopfrequenz</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v7><v8 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="8"><name NodeID="11" Label="Name" DataID="10">threshold</name><description NodeID="11" Label="Label" DataID="20" Show="0">Threshold</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">double</type><valdata NodeID="11" Label="Data" DataID="50" Enable="1">-1</valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">F:*6*</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Threshold</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">This option is available only when the filter type is threshold. It specifies the amplitude threshold.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Threshold</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">しきい値</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">このオプションは、フィルタの種類がしきい値の場合のみ利用できます。 振幅のしきい値を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">しきい値</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">Schwellenwert</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Diese Option ist nur verfügbar, wenn als Filtertyp Schwellenwert ausgewählt wurde. Dies bestimmt den Amplitudenschwellenwert.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Schwellenwert</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v8><v9 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="9"><name NodeID="11" Label="Name" DataID="10">offset</name><description NodeID="11" Label="Label" DataID="20" Show="0">Keep DC Offset</description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">0.</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">int</type><valdata NodeID="10" Label="Data" DataID="50" Enable="1">1</valdata><comboString NodeID="11" Label="Control" DataID="70">0|1</comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69"></optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408">Keep DC Offset</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">This option is available only when the filter type is high pass, band pass or band block. If this option is checked, the DC offset will remain unchanged during the filtering.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Keep DC Offset</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932">DCオフセットを保持</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">このオプションは、フィルタの種類がハイパス、バンドパス、バンドブロックの場合のみ利用できます。 このオプションにチェックが付いていると、DCオフセットはフィルタリング処理中に変更されません。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">DCオフセットを保持</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252">DC-Offset behalten</description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Diese Option ist nur verfügbar, wenn als Filtertyp Hochpass, Bandpass oder Bandsperre ausgewählt wurde. Wenn diese Option ausgewählt ist, wird der DÜ-Offset während des Filterns unverändert bleiben.</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">DC-Offset behalten</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v9><v10 NodeID="268435456" _XFUNCTION_VAR="1" RepeatID="10"><name NodeID="11" Label="Name" DataID="10">oy</name><description NodeID="11" Label="Label" DataID="20" Show="0"></description><io NodeID="13" Label="Input/Output" Combo="Input|Output|Input/Output" DataID="30">1</io><type NodeID="11" Label="Data Type" Combo="double|string|int|vector|vector&lt;string&gt;|vector&lt;complex&gt;|Range|XYRange|XYRangeComplex|XYZRange|matrix|ButtonInfo|LineInfo|TextInfo|EventInfo|MarkerInfo|RectInfo|Column|MatrixObject|Image|DataPlot|Page|GraphPage|WorksheetPage|MatrixPage|GraphLayer|Worksheet|MatrixLayer|TreeNode|FileLink|ReportTree|ReportData|GraphPageBase|Layer" DataID="40">XYRange</type><valdata NodeID="44" Label="Data" DataID="50"><X NodeID="35" DataID="51">&lt;new&gt;</X><Y NodeID="35" DataID="52">&lt;new&gt;</Y><ED NodeID="35" DataID="53">&lt;new&gt;</ED></valdata><comboString NodeID="11" Label="Control" DataID="70"></comboString><context NodeID="268435456" Label="Context" DataID="71"></context><optionString NodeID="11" Label="Option String" DataID="69">N:X:="Filtered X1" Y:="Filtered Y1"</optionString><suggestedValues NodeID="11" Label="Suggested Values" DataID="405"></suggestedValues><themeID NodeID="14" Label="Theme ID" DataID="35">0.</themeID><help NodeID="268435456" Label="English Help" DataID="410" RepeatID="256"><description NodeID="11" Label="Display Name" DataID="408"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8">Specifies the output</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3">Output Data</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407"></comboDescription></help><helpj NodeID="268435456" Label="Japanese Help" DataID="410" RepeatID="512"><description NodeID="11" Label="Display Name" DataID="408" CdPg="932"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="932">出力を指定します。</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="932">出力データ</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="932"></comboDescription></helpj><helpg NodeID="268435456" Label="German Help" DataID="410" RepeatID="768"><description NodeID="11" Label="Display Name" DataID="408" CdPg="1252"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="1252">Bestimmt die Ausgabe</remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="1252">Ausgabedaten</hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="1252"></comboDescription></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="410" RepeatID="1024"><description NodeID="11" Label="Display Name" DataID="408" CdPg="936"></description><remark NodeID="41" Label="Description" DataID="409" RowHeightRange="3-8" CdPg="936"></remark><hint NodeID="41" Label="Auto Complete Hint" DataID="406" RowHeightRange="1-3" CdPg="936"></hint><comboDescription NodeID="47" Label="Option Explanations" DataID="407" CdPg="936"></comboDescription></helpc></v10></vars><modificationLog NodeID="41" Label="Modification Log" DataID="438" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="2-15">5/9/2006 Deanna. Modify usage, add brief info and variable descriptions
8/4/2006 Deanna. Edit
8/8/2006 Deanna. Edit
12/26/2006 Deanna. Edit
4/14/2007 Deanna. Edit
5/14/2007 Deanna. Edit
8/14/2007 Fisher. Edit
6/13/2008 Max. Add document for variables pass and stop</modificationLog><codes NodeID="268435456" Label="Code" DataID="324"><rettype NodeID="11" Label="Return Type" Combo="void|int|double|string|vector" DataID="41">void</rettype><header NodeID="45" Label="Header" DataID="323" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="3-15"><![CDATA[

static bool s_bInit = false;
static bool s_bChangeParam = false;
static string s_strErrMsg = "";

#include <xfbase.h> // for calling another XF, see add_axis_scroller
#include <event_utils.h> ///justin 10/30/2006 JUST_RECACULATE_WHEN_NECESSARY

//put additional include files here
#include <GetNBox.h>
#include <fft_utils.h>
#include <o8dlg.h>

///sandy 2007-3-8 add
#include <..\originlab\grobj_utils.h>

////////////////////////
// modification log
// CPY 11/14/06 ON_CHANGE_EVENT_SHOULD_NOT_REINIT_PREVIEW
// CPY 11/14/06 ON_MOVE_LINE_SHOULD_NOT_RESCALE_GRAPH
// CPY 6/13/08 FFT_FILTER_EXAMPLE_SAME_AS_75_NEED_SIMPLER_INTERFACE
// Folger 07/23/08 BETTER_OPREATION_OUTPUT_COLUMN_COMMENTS
// CPY 7/27/08 QA70-11868 CHANGE_BACK_TO_USE_CRLF_TO_SEP_LN_COMMENT
// CPY 10/18/08 QA70-12373 FFT_FILTER_PREVIEW_X_INC_MESS
/// Folger 04/10/09 QA80-12356 FFT_FILTERS_OUTPUT_FAILS_TO_KEEP_MISSING_VALUES_POSITION_AS_INPUT
/// Folger 04/14/09 QA80-13436 IMPROVE_MECHANISM_ABOUT_XF_ERR_MSG_SHOWN_IN_BODY
/// Folger 04/17/09 QA80-13429 RECREATE_X_DATA_FOR_NOT_EVEN_SPACE_INPUT_X
/// Kyle 07/28/2009 QA80-14026 FIX_WRONG_LEGEND_FOR_PREVIEW
/// CPY QA70-14088 FFT_FILTER_PREVIEW_RESCALE_TRIANGLE_ADDED_FOR_TOP_LEFT_GRAPH
/// CPY 8/20/09 QA70-14088-P3 INIFINITE_REFRESH_DUE_TO_TRIANGLE_MOVE_FOLLOWED_BY_LINE_MOVE
///	Jasmine 08/13/2010 ORG-172-S2 CENTRALIZE_NOCLICK_BIT_FOR_PREVIEW_IN_OC_TOOL

///------ Folger 04/14/09 QA80-13436 IMPROVE_MECHANISM_ABOUT_XF_ERR_MSG_SHOWN_IN_BODY
IMPLEMENT_SHOULD_WARNING_MSG_SHOW_IN_XF_BODY
///------ End IMPROVE_MECHANISM_ABOUT_XF_ERR_MSG_SHOWN_IN_BODY

#define STR_DATA_DISP_FORMAT		"*4*"
//---- CPY 10/25/06 
#define _DBM(_str)				//out_str(_str)
#define _DBM1(_fmt, _x1)		//printf(_fmt, _x1);
#define _DBM2(_fmt, _x1, _x2)	//printf(_fmt, _x1, _x2);
//----

//defined in FFTFilters.cpp, reuse
//enum
//{
	//filter_low		= 0,
	//filter_high,
	//filter_bandpass,
	//filter_bandblock,
	//filter_threshold,
//};

static void _update_tree_shown(TreeNode& tr)
{
	int nType = tr.filter.nVal;
	
	TreeNode trLow = tr.freq1;
	TreeNode trHigh = tr.freq2;
	TreeNode trCutOff = tr.cutoff;
	TreeNode trPass = tr.pass;
	TreeNode trStop = tr.stop;
	TreeNode trThresHold = tr.threshold;
	TreeNode trOffset = tr.offset;
	
	switch(nType)
	{
	case filter_low:			//	low-pass filtering;
		trLow.Show = false;
		trHigh.Show = false;
		trCutOff.Show = true;
		trPass.Show = false;
		trStop.Show = false;
		trThresHold.Show = false;
		trOffset.Enable = false;
		break;
	case filter_high:			//	high-pass filtering;
		trLow.Show = false;
		trHigh.Show = false;
		trCutOff.Show = true;
		trPass.Show = false;
		trStop.Show = false;
		trThresHold.Show = false;
		trOffset.Enable = true;
		break;
	case filter_bandpass:			//	band-pass filtering;
		trLow.Show = true;
		trHigh.Show = true;
		trCutOff.Show = false;
		trPass.Show = false;
		trStop.Show = false;
		trThresHold.Show = false;
		trOffset.Enable = true;
		break;
	case filter_bandblock:			//	band-block filtering;
		trLow.Show = true;
		trHigh.Show = true;
		trCutOff.Show = false;
		trPass.Show = false;
		trStop.Show = false;
		trThresHold.Show = false;
		trOffset.Enable = true;
		break;
	case filter_threshold:			//	threshold filtering
		trLow.Show = false;
		trHigh.Show = false;
		trCutOff.Show = false;
		trPass.Show = false;
		trStop.Show = false;
		trThresHold.Show = true;
		trOffset.Enable = false;
		break;
	case filter_lowpp:			//	low-pass parabolic filtering
		trLow.Show = false;
		trHigh.Show = false;
		trCutOff.Show = false;
		trPass.Show = true;
		trStop.Show = true;
		trThresHold.Show = false;
		trOffset.Enable = false;
		break;
	default:
		break;
	}
}

static void _update_graph_object_shown(TreeNode& tr, GraphLayer& gl)
{
	GraphObject goTop = gl.GraphObjects("top");
	GraphObject goLeft = gl.GraphObjects("left");
	GraphObject goRight = gl.GraphObjects("right");
	
	int nType = tr.filter.nVal;
	switch(nType)
	{
	case filter_low:			//	low-pass filtering;
	case filter_high:			//	high-pass filtering;
		goTop.Show = false;
		goLeft.Show = true;
		goRight.Show = false;
		break;
	case filter_bandpass:			//	band-pass filtering;
	case filter_bandblock:			//	band-block filtering;
	case filter_lowpp:			//	low-pass parabolic filtering
		goTop.Show = false;
		goLeft.Show = true;
		goRight.Show = true;
		break;
	case filter_threshold:			//	threshold filtering
		goTop.Show = true;
		goLeft.Show = false;
		goRight.Show = false;
		break;
	default:
		break;
	}
}

//----- CPY 11/14/06 ON_CHANGE_EVENT_SHOULD_NOT_REINIT_PREVIEW
// centralizd err checking code into this function, moved Sandy's code inside

///Sandy 2007-8-28 Rename
//static bool _check_GUI_params(TreeNode& trGetN, string& strErrMsg)
static bool _check_input(TreeNode& trGetN, string& strErrMsg, double& dXMin=NULL, double& dXMax=NULL, double& dYMin=NULL, double& dYMax=NULL)
{
	XYRange xyIn;
	//add by sandy 2006-11-9
	int nSize;
	TreeNode trInput= trGetN.iy;
	bool bRet;
	
	bRet = get_error_for_input_xyrange(trInput, strErrMsg, nSize, xyIn);
	if(bRet == false)
	{
		return false;
	}
	//end
	
	vector vecX, vecY;
	
	/////Sandy 2008-8-11 get all data including missing
	//xyIn.GetData(vecY, vecX);
	int nIndex = 0;
    vector vErr;
	xyIn.GetData(vecY, vecX, &vErr, nIndex,  DRR_GET_MISSING);
	if(vecY.GetSize() == 0)
	{
		//XF_THROW(XFERR_GET_DATA_FAILED);
		strErrMsg = XFERR_GET_DATA_FAILED;
		return false;
	}
	
	///Sandy 2008-8-11 prevent missing in y data
	int nMissing = ocmath_count(NANUM, nSize, vecY);
	if(nMissing != 0 )
	{
		//strErrMsg = XFWAR_MISSING_IN_INPUT;
		strErrMsg = CER_HAS_MISSING_VALUE;
		return false;
	}
	
	if(dXMin!=NULL && dXMax!=NULL && dYMin!=NULL && dYMax!=NULL)
	{
		//if(!_get_fft_range_amp_of_input(vecX, vecY))
		if(!_get_fft_range_amp_of_input(vecX, vecY, strErrMsg))//Sandy 2008-6-13 add error message
			return false;
		
		vecX.GetMinMax(dXMin, dXMax);
		vecY.GetMinMax(dYMin, dYMax);
	}
	
	return true;
}
//-----


//static void _init_filter_graph(TreeNode& trGetN, PageBase& pgTemp, Datasheet& wksTemp)
//static bool _init_filter_graph(TreeNode& trGetN, PageBase& pgTemp, Datasheet& wksTemp, string& strErrMsg)
static bool _init_filter_graph(TreeNode& trGetN, PageBase& pgTemp, Datasheet& wksTemp)
{
	Worksheet wks = wksTemp;
	XYRange xyIn, xyPrew;
	// 1 = 2nd layer, which will automatically check to see if there is a 3rd layer and move data plots from 2nd to 3rd as well
	// it will also run gr script upon rescale to also update 3rd layer scale.
	init_preview_graph(trGetN.iy, pgTemp, wks, "FFTFilterCntrl", &xyIn, &xyPrew, 1, SYSCOLOR_GRAY, SYSCOLOR_LTMAGENTA);

	GraphPage gp = pgTemp;
	if(!gp)
		return false;
	
	GraphLayer gl = gp.Layers(0);
	XFBase xf("axis_scroller");
	if( xf )
	{
		xf.SetArg(0, gl);
		//--- CPY QA70-14088 FFT_FILTER_PREVIEW_RESCALE_TRIANGLE_ADDED_FOR_TOP_LEFT_GRAPH
		double ss=1.5;
		xf.SetArg("ysize", ss);
		//---
		xf.Evaluate();
		
		//--- CPY QA70-14088 FFT_FILTER_PREVIEW_RESCALE_TRIANGLE_ADDED_FOR_TOP_LEFT_GRAPH
		GraphLayer gl2 = gp.Layers(1);
		xf.SetArg(0, gl2);
		int nTop = 1;
		xf.SetArg(1, nTop);
		ss = 2;
		xf.SetArg(2, ss);
		xf.Evaluate();
		//----
	}
	else
		XF_WARN(XFERR_AXIS_SCROLLER_NOT_FOUND);

	//out_str("_init_filter_graph");

	///Sandy 2007-8-28 Move the checking to _check_input()
	vector vecX, vecY;
	xyIn.GetData(vecY, vecX);
	
	_update_graph_object_shown(trGetN, gl);
	

	///Sandy 2008-6-13 add error checking
	//_control_graph(trGetN, vecX, vecY, gl, wks, true);
	if(!_control_graph(trGetN, vecX, vecY, gl, wks, true))
		return false;
	
	return true;
}
			
/*
static bool _get_data_from_range(XYRange& dr, Dataset& dsDataX, Dataset& dsDataY)
{
	if(!dr.IsValid())
		return -1;
	
	Worksheet wks;
	int r1, r2, cx, c2, cy;
	string strRange = "X";
	dr.GetRange(strRange, r1, cx, r2, c2, wks);
	strRange = "Y";
	dr.GetRange(strRange, r1, cy, r2, c2, wks);
	
	dsDataX.Attach(wks, cx);
	dsDataY.Attach(wks, cy);
	
	return true;
}*/
static void _set_frequency(TreeNode& tr, double dLow, double dHigh, double dThreshold)
{
	TreeNode trLow = tr.freq1;
	TreeNode trHigh = tr.freq2;
	TreeNode trCutOff = tr.cutoff;
	TreeNode trThresHold = tr.threshold;
	/// Cloud 11/9/07 add lowpass parabolic filter
	TreeNode trPass = tr.pass;
	TreeNode trStop = tr.stop;
	
	//trLow.strVal = ftoa(dLow, STR_DATA_DISP_FORMAT);
	//trHigh.strVal = ftoa(dHigh, STR_DATA_DISP_FORMAT);
	//trCutOff.strVal = ftoa(dLow, STR_DATA_DISP_FORMAT);
	//trThresHold.strVal = ftoa(dThreshold, STR_DATA_DISP_FORMAT);
	//trPass.strVal = ftoa(dLow, STR_DATA_DISP_FORMAT);
	//trStop.strVal = ftoa(dHigh, STR_DATA_DISP_FORMAT);
	
	trLow.dVal = dLow;//ftoa(dLow, STR_DATA_DISP_FORMAT);
	trHigh.dVal =dHigh;// ftoa(dHigh, STR_DATA_DISP_FORMAT);
	trCutOff.dVal = dLow;//ftoa(dLow, STR_DATA_DISP_FORMAT);
	trThresHold.dVal = dThreshold;//ftoa(dThreshold, STR_DATA_DISP_FORMAT);
	trPass.dVal = dLow;//ftoa(dLow, STR_DATA_DISP_FORMAT);
	trStop.dVal = dHigh;//ftoa(dHigh, STR_DATA_DISP_FORMAT);
}
//----- CPY 11/14/06 ON_MOVE_LINE_SHOULD_NOT_RESCALE_GRAPH
// we should try not to change obj xy if not needed
static bool _check_range(double v, double v1, double v2)
//static bool _check_range(double v, double v1, double v2, double& vNew)
{
	//if(v < v1) {vNew = v1; return true;}
	//if(v > v2) {vNew = v2; return true;}
	//return false;
	
	if(v < v1) return false;
	if(v > v2) return false;
	
	return true;
}
//-----
//bSetTree = true to update grid tree, false = update graph lines
//----- CPY 11/14/06 ON_MOVE_LINE_SHOULD_NOT_RESCALE_GRAPH, added bCheckRange, should call this only when init first time
static bool _graph_lines_and_tree_update(GraphLayer& gl, TreeNode& trGetN, bool bSetTree, bool bCheckRange = false)
{
	GraphObject goTop = gl.GraphObjects("top");
	GraphObject goLeft = gl.GraphObjects("left");
	GraphObject goRight = gl.GraphObjects("right");
	
	//----- CPY 8/20/09 QA70-14088-P3 INIFINITE_REFRESH_DUE_TO_TRIANGLE_MOVE_FOLLOWED_BY_LINE_MOVE
	LTVarTempChange __junk("@GOS", 1);// disable event trigger when setting obj position, which will lead to reentrance due to PostMessage
	//-----
	
	int nType = trGetN.filter.nVal;
	if(nType != filter_low && nType != filter_high)//add by sandy 2008-2-20 only two line-controls need compare and interchange
	{
		///Sandy 2006-11-22 move from upward, since always need to exchange the low and high freq value
		if(goLeft.X > goRight.X)
		{
			double temp = goLeft.X;
			goLeft.X = goRight.X;
			goRight.X = temp;
		}
	}
	
	///Sandy 2006-11-22 add for check the frequency always should be larger than zero
	if(goLeft.X < 0) goLeft.X = 0;
	if(goRight.X < 0) goRight.X = 0;
	//if(goTop.Y < 0) goTop.Y = 0;

	///Sandy 2007-8-8 
	//if(bSetTree)
	if(bSetTree)// check range = init
	{
		double dTop = goTop.Y, dMin=goLeft.X, dMax=goRight.X;
		
		if(bCheckRange)
		{
			if(!_check_range(goLeft.X, gl.X.From, gl.X.To))
			{
				double dLow;
				dLow =  (gl.X.To - gl.X.From)/4.0 + gl.X.From;
				goLeft.X = dLow;
				move_span_vline(goLeft, dLow);	
			}
			if(!_check_range(goRight.X, gl.X.From, gl.X.To))
			{
				double dHight;
				dHight =  (gl.X.To - gl.X.From)/4.0*3 + gl.X.From;
				goRight.X = dHight;
				move_span_vline(goRight, dHight);
			}
			if(!_check_range(goTop.Y, gl.Y.From, gl.Y.To))
			{
				double dThres;
				dThres = (gl.Y.To - gl.Y.From)/10.0 + gl.Y.From;
				goTop.Y = dThres;
			}
		}	
		
		//_set_frequency(trGetN, dMin, dMax, dTop);
		_set_frequency(trGetN, dMin, dMax, dTop);
		_DBM2("setting tree, low = %g, hight = %g\n", dMin, dMax)
		

	}
	else 
	{
		//goTop.Y = trGetN.threshold.dVal;
		/// Cloud 11/9/07 add lowpass palabolic filter
		//double dLow = trGetN.cutoff.Show ? trGetN.cutoff.dVal : trGetN.freq1.dVal;
		//double dHigh = trGetN.freq2.dVal;
		double dLow, dHigh;
		switch (trGetN.filter.nVal)
		{
		case filter_low:
		case filter_high:
			dLow = trGetN.cutoff.dVal;
			break;
		case filter_bandpass:
		case filter_bandblock:
			dLow = trGetN.freq1.dVal;
			dHigh = trGetN.freq2.dVal;
			break;
		case filter_lowpp:
			dLow = trGetN.pass.dVal;
			dHigh = trGetN.stop.dVal;
			break;
		default:
			break;
		}
		double dThres = trGetN.threshold.dVal;
		

		if(bCheckRange)
		{
			if(!_check_range(dLow, gl.X.From, gl.X.To))
			{
				dLow =  (gl.X.To - gl.X.From)/4.0 + gl.X.From;
				trGetN.cutoff.dVal = trGetN.freq1.dVal = dLow;
			}
			if(!_check_range(dHigh, gl.X.From, gl.X.To))
			{
				dHigh =  (gl.X.To - gl.X.From)/4.0*3 + gl.X.From;
				trGetN.freq2.dVal = dHigh;
			}
			if(!_check_range(dThres, gl.Y.From, gl.Y.To))
			{
				
				dThres = (gl.Y.To - gl.Y.From)/10.0 + gl.Y.From;
				trGetN.threshold.dVal = dThres;
			}
		}
			
		//Sandy move line by utility function
		//goLeft.X= dLow;
		//goRight.X= dHigh;
		move_span_vline(goLeft, dLow);
		move_span_vline(goRight, dHigh);
		goTop.Y = dThres;
		
		///Sandy 2006-11-22 for test the GraphObject postion problem
		//double dd = goLeft.X;	
		//end 
		_DBM2("setting line in graph, low = %g, hight = %g\n", dLow, dHigh)
	}
	//----- CPY 11/14/06 ON_MOVE_LINE_SHOULD_NOT_RESCALE_GRAPH
	//gl.Rescale();
	//-----			
	return true;
}

///Sandy 2008-6-13 add error message return 
//static bool _get_fft_range_amp_of_input(vector& vecX, vector& vecY)
static bool _get_fft_range_amp_of_input(vector& vecX, vector& vecY, string& strErrMsg =NULL)
{	
	int nSize = vecY.GetSize();
	if(nSize < 2) return error_report("vecX size < 2");
	double dXStep;
	int nRet = fft_sampling_resolution(&vecX, dXStep);
	
	///Sandy 2008-6-13  add error checking for uneven spaced signal
	//if( nRet > 0 )	
		//return false;
		
	//Sandy 2009-4-9 QA80-13429 JUST_WARNNING_WHEN_UNEVEN_INTERVAL
	//if( dXStep <= 0 || dXStep == NANUM || nRet == OE_NOT_SPACED_EQUALLY)
	//{
		//if(strErrMsg)
			//strErrMsg = XF_ERR_INVALID_FFT_INTERVAL;
		//
		//return false;
	//}
	if(nRet == OE_NOT_SPACED_EQUALLY && strErrMsg)
		strErrMsg = XFWAR_TIME_SEQ_INVALID;	
		
	if(dXStep < 0)
		dXStep *= -1;
		
    if(dXStep == NANUM || dXStep == 0)
    {
		if(strErrMsg)
			strErrMsg = XF_ERR_INVALID_FFT_INTERVAL;
		return false;
    }
	//end  JUST_WARNNING_WHEN_UNEVEN_INTERVAL

	///end  make error checking perfect
	
	double dFreMax = 1/(2*dXStep);
	double dStep = dFreMax/(nSize/2);

	
	vecX.Data(0, dFreMax, dStep);

	fft_real(nSize, vecY);

	vector<complex> vResult(nSize);
	fft_hermitian_to_complex(nSize, vecY, vResult);
	vector vecAmp(nSize);
	vResult.GetAmplitude(vecAmp);
	vecY = vecAmp;
	
	return true;
}

static bool _control_graph(TreeNode& tr, vector& vecX, vector& vecY, GraphLayer& gl, Worksheet& wksdata, bool bInit = false)
{
	int nColX = 2;
	int nColY = 3;
	if(bInit)
	{
		
		///Sandy 2007-6-22 for clear data and reuse when changing iy
		//if(wksdata.GetNumCols() < nColY+1)
		//	wksdata.SetSize(-1, nColY+1); // we will use col 1,2 for preview data and col 3,4 for control spectrum
		wksdata.SetSize(-1, nColY+1, true);
		
		wksdata.Columns(nColX).SetType(OKDATAOBJ_DESIGNATION_X);
		wksdata.Columns(nColY).SetType(OKDATAOBJ_DESIGNATION_Y);
	}
	
	Dataset dsX(wksdata, nColX), dsY(wksdata, nColY);
	
	///Sandy 2007-8-30 centeralize code
	if(!_get_fft_range_amp_of_input(vecX, vecY))
		return false;
	///end of centeralize code
	dsX = vecX;
	dsY = vecY;
	
	//Curve cur(dsY.GetName());
	if(bInit)
	{
		Curve cur(wksdata, nColX, nColY);
		int nn = gl.AddPlot(cur, IDM_PLOT_LINE);
	}
	//init tree by data
	double dYMin, dYMax, dXMin, dXMax;
	
	//Sandy 2006-7-25 DEBUG
	//vecFre.GetMinMax(dYMin, dYMax);
	vecY.GetMinMax(dYMin, dYMax);
	vecX.GetMinMax(dXMin, dXMax);
	//--- CPY 8/8/06 INIT_LINE_POSITION_NOT_EFFECTIVE_FIX
	if(!bInit)
		return true;
	
	Scale xaxis(gl.X);
	xaxis.From = dXMin;
	xaxis.To = dXMax;
	//---- CPY 10/18/08 QA70-12373 FFT_FILTER_PREVIEW_X_INC_MESS
	//xaxis.Inc = (dXMax-dXMin)/10;  ///Sandy 2008-2-20 displace sticks
	xaxis.Inc = 0;// to force internal recalculate nice inc
	//----
	Scale yaxis(gl.Y);
	//since Y is log scale, we have to limit to 10 decades
	if(dYMin < dYMax * 1E-10)
		dYMin = dYMax * 1E-10;
	yaxis.From = dYMin;
	yaxis.To = dYMax;
	//--------	

	///sandy 2009-4-14 Fix when change parameters the line controls in back to default position
	bool bNeedCheckGLRange = !s_bChangeParam && bInit;
	///Sandy 2007-8-8 should update lines after scale changing
	//_graph_lines_and_tree_update(gl, tr, false, bInit);
	_graph_lines_and_tree_update(gl, tr, false, bNeedCheckGLRange);
	return true;
}
// apply filter to input XYRange
static void _update_preview(TreeNode& trGetN, Worksheet& wksdata, GraphLayer& gl)
{
	XYRange xyIn;
	
	TreeNode& trGetNinputData = trGetN.iy;
	xy_range_from_GetN_data_node(trGetNinputData, xyIn);

	/// ML 10/11/2006 GETTING_SAMPLE_RATE_EVEN_IF_NO_DATAPLOT 
	/////add by Sandy 2006-10-09 temp solution for XYRange
	//DataPlot dpData = xyIn.MakePlot(gl);
	////end
	/// end GETTING_SAMPLE_RATE_EVEN_IF_NO_DATAPLOT
	vector vecX, vecY;
	xyIn.GetData(vecY, vecX);	//Empty XYRange will cause run time error
	_update_preview_data(trGetN, vecX, vecY, wksdata);
}
// apply filter to vecX, vecY and put into wksdata col 1,2
///Sandy 2007-7-12 get error message with standard way
//static void _update_preview_data(TreeNode& tr, vector& vecX, vector& vecY, Worksheet& wksdata)
static bool _update_preview_data(TreeNode& tr, vector& vecX, vector& vecY, Worksheet& wksdata)
{
	Dataset dsX(wksdata, 0), dsY(wksdata, 1);
	
	TreeNode trLow = tr.freq1;
	TreeNode trHigh = tr.freq2;
	TreeNode trCutOff = tr.cutoff;
	TreeNode trPass = tr.pass;
	TreeNode trStop = tr.stop;
	TreeNode trThresHold = tr.threshold;
	TreeNode trOffset = tr.offset;
	
	bool bAddOffset = trOffset.nVal;
	int nType = tr.filter.nVal;
	double dFre1, dFre2;
	switch(nType)
	{
	case filter_low:
	case filter_high:
		dFre1 = trCutOff.dVal;
		break;
	case filter_bandpass:
	case filter_bandblock:
		dFre1 = trLow.dVal;
		dFre2 = trHigh.dVal;
		break;
	case filter_threshold:
		dFre1 = trThresHold.dVal;
		break;
	case filter_lowpp:
		dFre1 = trPass.dVal;
		dFre2 = trStop.dVal;
		break;
	default:
		//out_int("FFT_filter: nType not valid ", nType);
		//strErrMsg = XFERR_FFT_FILTER_TYPE_INVALID;
		return false;
		break;
	}

	///Sandy 2007-7-12 get error message with standard way
	//if(_apply_filters(nType, dFre1, dFre2, bAddOffset, vecY, &vecX) <= 0)
	//{
		//_DBM2("filter applied, f1=%g, f2=%g\n", dFre1, dFre2)
		//dsX = vecX;
		//dsY = vecY;
	//}
	//else
		//out_str("failed to apply filter");
		
	int nRet = _apply_filters(nType, dFre1, dFre2, bAddOffset, vecY, &vecX);
	if(nRet > 0)
	{
		//strErrMsg = XFERR_FAIL_APPLY_FILTER;
		return false;
	}
	///Justin 2007-07-16 
	//else if(nRet < 0)
	//{
		////strErrMsg = XFWAR_TIME_SEQ_INVALID;
		//return true;		
	//}
	else 
	{
		dsX = vecX;
		dsY = vecY;
		return true;		
	}
	///End
	//end
	
	
	
	return true;
		
}

static int _apply_filters(int nType, double dFre1, double dFre2, bool bAddOffset, vector& vecY, vector* pvecX=NULL)
{
	int nStatus = 0;
	switch(nType)
	{
	case filter_low:
		if(0 > dFre1)
			dFre1 = 0;
		nStatus = fft_lowpass(vecY, dFre1, pvecX);
		break;
	case filter_high:
		if(0 > dFre1)
			dFre1 = 0;
		nStatus = fft_highpass(vecY, dFre1, pvecX, bAddOffset);
		break;
	case filter_bandpass:
		if(0 > dFre1)
			dFre1 = 0;
		if(0 > dFre2)
			dFre2 = 0;
		if(dFre1 > dFre2)
		{
			//exchange frequency
			double dTemp = dFre1;
			dFre1 = dFre2;
			dFre2 = dTemp;
		}
		nStatus = fft_bandpass(vecY, dFre1, dFre2, pvecX, bAddOffset);
		break;
	case filter_bandblock:
		if(0 > dFre1)
			dFre1 = 0;
		if(0 > dFre2)
			dFre2 = 0;
		if(dFre1 > dFre2)
		{
			//exchange frequency
			double dTemp = dFre1;
			dFre1 = dFre2;
			dFre2 = dTemp;
		}
		nStatus = fft_bandblock(vecY, dFre1, dFre2, pvecX, bAddOffset);
		break;
	case filter_threshold:
		if(0 > dFre1)
			dFre1=0;
		nStatus = fft_threshold(vecY, dFre1, pvecX);
		break;
	/// Cloud 11/9/07 add lowpass parabolic filter
	case filter_lowpp:
		int nSize = vecY.GetSize();
		vector vWindow(nSize);
		double dFreqStep;
		//fft_sampling_resolution(pvecX, dFreqStep);
		int nRet = fft_sampling_resolution(pvecX, dFreqStep);//Sandy 2009-4-9 add error checking, maybe need centralized after SR5
		if(nRet != 0 || dFreqStep == 0 || dFreqStep == NANUM)////Sandy 2009-4-9 QA80-13429 JUST_WARNNING_WHEN_UNEVEN_INTERVAL
		{
			//if(nRet != OE_NOT_SPACED_EQUALLY || dFreqStep <= 0)
			if(nRet != OE_NOT_SPACED_EQUALLY || dFreqStep == 0 || dFreqStep == NANUM)  //Sandy 2009-4-10 allow descending x data or unsorted xy data
				return nRet;
			///------ Folger 04/17/09 QA80-13429 RECREATE_X_DATA_FOR_NOT_EVEN_SPACE_INPUT_X
			if ( pvecX )
				recreate_even_space_time_vector(*pvecX, dFreqStep);
			///------ End RECREATE_X_DATA_FOR_NOT_EVEN_SPACE_INPUT_X
		}
		//dFreqStep = 1 / nSize / dFreqStep;
		dFreqStep = abs(1 / nSize / dFreqStep); //Sandy 2009-4-10 allow descending x data or unsorted xy data
		
		nStatus = fft_filter_window(nSize, LOW_PASS_PARABOLIC_FILTERING, vWindow,
			dFre1, dFre2, dFreqStep, true);
		if (nStatus==OE_NOERROR)
			nStatus = fft_fft_filter(nSize, vecY, vWindow);
		break;
	default:
		nStatus = 1;//error happen
		break;
	}
	
	///Sandy 2007-7-12 should move outside and let caller to handle
	//if(nStatus < 0)
		/////Cheney 2006-10-30 USE_WARNING_BOX
		////XF_TRACE();
		////warning_msg_box("Warning: Not appropriate time increament! Will use default setting.", false);
		//XF_WARN(XFWAR_TIME_SEQ_INVALID);
		/////end USE_WARNING_BOX
	
	return nStatus;
}
//---- CPY 7/27/08 QA70-11868 CHANGE_BACK_TO_USE_CRLF_TO_SEP_LN_COMMENT
/*
//------ Folger 07/23/08 BETTER_OPREATION_OUTPUT_COLUMN_COMMENTS
static	void	_set_output_range_comments(XYRange& oy, const XYRange& iy, int nFilter, double freq1, double freq2, double cutoff, double pass, double stop, double threshold)
{
	vector<string>	vsFilterTypes = {"Low Pass", "High Pass", "Band Pass", "Band Block", "Threshold", "Low Pass Parabolic"};
	string strComment;
	switch ( nFilter )
	{
	case filter_low:
	case filter_high:
		strComment.Format("%g Hz ", cutoff);
		break;
	case filter_bandpass:
	case filter_bandblock:
		strComment.Format("%g Hz %s %g Hz ", freq1, _L("to"), freq2);
		break;
	
	case filter_threshold:
		strComment.Format("%g ", threshold);
		break;
		
	case filter_lowpp:
		strComment.Format("%g Hz %s %g Hz ", pass, _L("to"), stop);
		break;
		
	default:
		break;
	}
	
	oy.SetOutputComment(strComment + _LC(vsFilterTypes[nFilter], "fft_filters") + " Filter\r\n" + get_input_data_range_string(iy));
}
//------ End BETTER_OPREATION_OUTPUT_COLUMN_COMMENTS
*/
static	void	_set_output_range_comments(XYRange& oy, const XYRange& iy, int nFilter, double freq1, double freq2, double cutoff, double pass, double stop, double threshold)
{
	vector<string>	vsFilterTypes = {"Low Pass", "High Pass", "Band Pass", "Band Block", "Threshold", "Parabolic"};
	string strComment;
	switch ( nFilter )
	{
	case filter_low:
	case filter_high:
		strComment.Format("%g Hz ", cutoff);
		break;
	case filter_bandpass:
	case filter_bandblock:
		strComment.Format("%g - %g Hz ", freq1, freq2);
		break;
	
	case filter_threshold:
		strComment.Format("%g ", threshold);
		break;
		
	case filter_lowpp:
		strComment.Format("%g, %g Hz ", pass, stop);
		break;
		
	default:
		break;
	}
	
	oy.SetOutputComment(strComment + _LC(vsFilterTypes[nFilter], "fft_filters") + " fft filter of " + get_input_data_range_string(iy));
}
//----- end CHANGE_BACK_TO_USE_CRLF_TO_SEP_LN_COMMENT

]]></header><code NodeID="45" Label="Expression" DataID="325" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20"><![CDATA[waitCursor junk;																
vector vecX, vecY;
///------ Folger 04/10/09 QA80-12356 FFT_FILTERS_OUTPUT_FAILS_TO_KEEP_MISSING_VALUES_POSITION_AS_INPUT
//iy.GetData(vecY, vecX);
vector<int>		vnMissingValsIndices;
if( !iy.GetData(vecY, vecX, NULL, 0, DRR_BAD_WEIGHT_TREATMENT, &vnMissingValsIndices) )
	XF_THROW(XFERR_GET_DATA_FAILED);
///------ End FFT_FILTERS_OUTPUT_FAILS_TO_KEEP_MISSING_VALUES_POSITION_AS_INPUT

double dFre1, dFre2;
switch(filter)
{
case filter_low:
case filter_high:
	//-----CPY 6/13/08 FFT_FILTER_EXAMPLE_SAME_AS_75_NEED_SIMPLER_INTERFACE
	if(cutoff < 0)
		dFre1 = freq1;
	else
	//-----
	dFre1 = cutoff;
	break;
case filter_bandpass:
case filter_bandblock:
	dFre1 = freq1;
	dFre2 = freq2;
	break;
case filter_threshold:
	//-----CPY 6/13/08 FFT_FILTER_EXAMPLE_SAME_AS_75_NEED_SIMPLER_INTERFACE
	if(threshold < 0)
		dFre1 = freq1;
	else
	//-----
	dFre1 = threshold;
	break;
/// Cloud 11/9/07 add lowpass parabolic filter
case filter_lowpp:
	//-----CPY 6/13/08 FFT_FILTER_EXAMPLE_SAME_AS_75_NEED_SIMPLER_INTERFACE
	if(pass < 0 && stop < 0)
	{
		dFre1 = freq1;
		dFre2 = freq2;
	}
	else
	//-----
	{
		dFre1 = pass;
		dFre2 = stop;
	}
	break;
default:
	break;
}

///Sandy 2007-7-12 get error message with standard way
//if(_apply_filters(filter, dFre1, dFre2, offset, vecY, &vecX) > 0)
	//XF_THROW(XFERR_FAIL_APPLY_FILTER);
int nRet = _apply_filters(filter, dFre1, dFre2, offset, vecY, &vecX);
if(nRet > 0)
{
	XF_THROW(XFERR_FAIL_APPLY_FILTER);
}
else if(nRet < 0)
{
	///------ Folger 04/14/09 QA80-13436 IMPROVE_MECHANISM_ABOUT_XF_ERR_MSG_SHOWN_IN_BODY
	if ( SHOULD_WARNING_MSG_SHOW_IN_XF_BODY )
	///------ End IMPROVE_MECHANISM_ABOUT_XF_ERR_MSG_SHOWN_IN_BODY
		XF_WARN(XFWAR_TIME_SEQ_INVALID);		
}	
//end


/// Cloud 6/13/2007 XYRANGE_EVEN_SAMPLING
//oy.SetData(&vecY, &vecX);
///------ Folger 04/10/09 QA80-12356 FFT_FILTERS_OUTPUT_FAILS_TO_KEEP_MISSING_VALUES_POSITION_AS_INPUT
//if (!set_xyrange_data_ex(oy, &vecY, &vecX, 0, iy))
if( !set_xyrange_data_ex(oy, &vecY, &vecX, 0, iy, &vnMissingValsIndices) )
///------ End FFT_FILTERS_OUTPUT_FAILS_TO_KEEP_MISSING_VALUES_POSITION_AS_INPUT
	XF_THROW(XFERR_FAIL_IN_SET_XYRANGE_DATA);
/// End XYRANGE_EVEN_SAMPLING
//Column col;
//bool bRet = oy.GetXColumn(col);
//bRet = col.SetLongName("Filtered X");
//bRet = oy.GetYColumn(col);
//bRet = col.SetLongName("Filtered Y");
///Arvin 08/16/07 QA70-10073 KEEP_OUTPUT_CURVE_CUSTOMIZATION_AFTER_RECALCULATE_FOR_XF
//DataPlot dp = oy.MakePlot(iy);
//if( !dp )
//{
	////ASSERT(FALSE);	///DG 7/6/05 : do filter to wks, no need plot
	//return;
//}
//dp.SetColor(1, true);
	
//GraphLayer gl;
//dp.GetParent(gl);

//Set legend
//string strSourceColName = curData.GetName();

///Sandy 2007-8-20
//DataPlot dpSrc;
//iy.GetPlot(dpSrc);
//if(!dpSrc)
//{
	////ASSERT(0);
//}
//string strSourceColName = dpSrc.GetDatasetName();
/// Max 07-11-06 SHOULD_NOT_SET_NAME_IN_XF_BODY // use option string N instead
/*
Column colSrcY;
iy.GetYColumn(colSrcY);
string strSourceColName = colSrcY.GetName();

vector<string> vsFilterTypeLabel={" Hz Low Pass", " Hz High Pass", " Hz Band Pass", " Hz Band Block", " Amp ThresHold"};
Column colY;
oy.GetYColumn(colY);
string strLabel;
strLabel = ftoa(dFre1, STR_DATA_DISP_FORMAT);
if(filter_bandpass==filter || filter_bandblock==filter)
	strLabel = ftoa(dFre1, STR_DATA_DISP_FORMAT) + " to "+ ftoa(dFre2, STR_DATA_DISP_FORMAT);

strLabel += vsFilterTypeLabel[filter] + " Filter on Col" + strSourceColName;
colY.SetLabel(strLabel);
*/
/// END SHOULD_NOT_SET_NAME_IN_XF_BODY
///Arvin 08/16/07 QA70-10073 KEEP_OUTPUT_CURVE_CUSTOMIZATION_AFTER_RECALCULATE_FOR_XF
//gl.LT_execute("legend -s");
//gl.Rescale();
DataPlot dp;
xf_check_plot_output_rng_in_source_rng_graph(iy, oy, &dp);
if(dp.IsValid())
{
	GraphLayer gl;
	dp.GetParent(gl);
	//gl.Rescale();//Sandy 2009-3-6  DON'T_RESCALE_AND_KEEP_USER_SCALES
}
///end KEEP_OUTPUT_CURVE_CUSTOMIZATION_AFTER_RECALCULATE_FOR_XF

//------ Folger 07/23/08 BETTER_OPREATION_OUTPUT_COLUMN_COMMENTS
_set_output_range_comments(oy, iy, filter, freq1, freq2, cutoff, pass, stop, threshold);
//------
]]></code><event1 NodeID="45" Label="Event1" DataID="327" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20" Show="0"><![CDATA[
	_update_tree_shown(trGetN);
	return true;	
]]></event1><event2 NodeID="45" Label="Event2" DataID="376" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20" Show="0"><![CDATA[
// from old code
/*
	bool bInit = (dwCntrl & GETNEVENT_ON_INIT) ? true : false;
	bool bUpdateGraph = (dwCntrl & GETNEVENT_UPDATE_GRAPH) ? true : false;
	bool bUpdatePrew = (dwCntrl & GETNEVENT_UPDATE_PREVIEW) ? true : false;

	bool bUpdateTreeByGraph = (dwCntrl & GETNEVENT_UPDATE_GUI_TREE) ? true : false;

	///DG 7/27/05 : handle input data change
	if(!bInit && trNode && trNode.Parent())
	{
		TreeNode trData = trNode.Parent();
		if("xy"==trData.tagName)
			bInit=true;
	}
	///end

	GraphPage gp(theGraph);
	GraphLayer gl = gp.Layers(0);
	GraphObject goTop = gl.GraphObjects("top");
	GraphObject goLeft = gl.GraphObjects("left");
	GraphObject goRight = gl.GraphObjects("right");

	//update tree, should put to another event, but now we don't have, so temp put here
	if((bInit || (trNode && "type"==trNode.tagName)) && bUpdateGraph)
	{
		//update_tree_shown(myTree);
		update_graph_object_shown(trGetN, gl);
	}
	else if(bUpdateGraph && trNode && ("low"==trNode.tagName || "high"==trNode.tagName || "cutoff"==trNode.tagName || "threshold"==trNode.tagName))
	{
		TreeNode trLow = trGetN.low;
		TreeNode trHigh = trGetN.high;
		TreeNode trCutOff = trGetN.cutoff;
		TreeNode trThresHold = trGetN.threshold;

		goTop.Y=trThresHold.dVal;
		double dLow = trCutOff.Show ? trCutOff.dVal : trLow.dVal;
		goLeft.X=dLow;
		goRight.X=trHigh.dVal;
	}
	else if(bUpdatePrew && trNode && "Color" == trNode.tagName)	//update curve color only
	{
		DataPlot dpCurve = gl.DataPlots(1);
		if(dpCurve)
			dpCurve.SetColor(trGetN.output.curve.color.nVal);

		goto quit;
	}
	else if(bUpdateTreeByGraph)
	{
		double dTop = goTop.Y, dMin=goLeft.X, dMax=goRight.X;
		set_frequency(trGetN, dMin, dMax, dTop);
	}

	//update graph	
	vector vecX, vecY;
	XYRange xy;
	TreeNode trJunk;
	xy.SetTree(trGetN.src, trJunk);
	xy.InitFromTree();

	bool bData;
	try
	{
		bData = xy.GetData(vecY, vecX);	//Empty XYRange will cause run time error
	}
	catch(int nError)
	{
		bData = false;
	}
	if(!bData)
	{
		ASSERT(0);
		XF_THROW(ERR_GET_INPUT_FAIL);
	}

	if(bUpdateGraph)	//update view graph
	{
		if(bInit)
			init_viewgraph(trGetN, vecX, vecY, gl, datawks);
	}
	else if(bUpdatePrew)
	{
		if(bInit)
			init_previewgraph(trGetN, xy, gl, datawks);

		update_previewgraph(trGetN, vecX, vecY, gl, datawks);
	}
quit:	
	gl.Rescale();
	gp.Refresh();
	return true;	
*/
return false;]]></event2><event3 NodeID="45" Label="Event3" DataID="378" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20" Show="0"><![CDATA[
string strErrMsg;

//------ fisher 11/16/07 ADD_MAP_ID_TO_CHM
if(is_use_origin_chm())
	trGetN.SetAttribute(STR_HELPID_ATTRIB, IDD_XF_fft_filters);

if ( (dwCntrl&LTXF_THEME_USED) && nGetNDialog <= 0 )
{ 
	int nSize;
	TreeNode trInput= trGetN.iy;
	XYRange xyi;
	
	if(!get_error_for_input_xyrange(trInput, strErrMsg, nSize, xyi))
		nRet = XFEVT_PROCEED_WITH_DLG; 
}

///Sandy 2007-9-3 FIX_CHANGE_PARAM
s_bChangeParam = false;
if(dwCntrl&LTXF_CHANGE_PARAM) 	
{
	s_bChangeParam = true;
}


if(nGetNDialog>-1)
{
	s_bInit = false;
}

///------ Folger 04/14/09 QA80-13436 IMPROVE_MECHANISM_ABOUT_XF_ERR_MSG_SHOWN_IN_BODY
if ( is_xf_startup(nGetNDialog, dwCntrl) )
	SET_WARNING_MSG_SHOW_IN_XF_BODY(IS_ERR_MSG_OK_TO_SHOW_IN_BODY);
///------ End IMPROVE_MECHANISM_ABOUT_XF_ERR_MSG_SHOWN_IN_BODY]]></event3><event4 NodeID="45" Label="Event4" DataID="377" MultilineEditExpShrink="1" DispFormat="33554432" RowHeightRange="5-20" Show="0"><![CDATA[return false;]]></event4><GetNEvent NodeID="47" Label="GetNBox Event" DataID="379" Show="0" TypeID="65543" BlobArrElementaryType="8" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">CgkvLy8vL1NhbmR5IDIwMDctOC0zMCBhZGQgY29kZSB0byBpbml0aWFsIGN1dG9mZgoJZG91
[encoded data, 7632 characters]
R1JBUEhfRVJST1I7CQoJAAAAAAA=</GetNEvent></codes><SaveInOpj NodeID="10" Label="Save with Object" DataID="560">0.</SaveInOpj><optargindex NodeID="14" Label="Option Argument Index" DataID="72">0.</optargindex><version NodeID="14" Label="Version" DataID="73">2.</version><category NodeID="11" Label="Primary Category" DataID="74" Show="0">Signal Processing</category><subcategory NodeID="11" Label="Primary Subcategory" DataID="77" Show="0"></subcategory><seccategory1 NodeID="11" Label="Secondary Category" DataID="75" Show="0"></seccategory1><secsubcategory1 NodeID="11" Label="Secondary Subcategory 1" DataID="78" Show="0"></secsubcategory1><seccategory2 NodeID="11" Label="Secondary Category 2" DataID="76" Show="0"></seccategory2><secsubcategory2 NodeID="11" Label="Secondary Subcategory 2" DataID="79" Show="0"></secsubcategory2><module NodeID="11" Label="Module" DataID="80"></module><subGroup NodeID="17" Label="Subgroup Index Within a Category" Combo="-10|-9|-8|-7|-6|-5|-4|-3|-2|-1|0|1|2|3|4|5|6|7|8|9" DataID="82">-9</subGroup><errmsgCount NodeID="14" Label="Number of Error Messages" DataID="412">0.</errmsgCount><helpe NodeID="268435456" Label="English Help" DataID="420" RepeatID="256"><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8">FFT Fi&amp;lters:  Perform Fouriers Filter on input data</info><summary NodeID="47" Label="Summary" DataID="421" Show="0"><![CDATA[]]></summary><example NodeID="47" Label="Examples" DataID="431" Show="0"><![CDATA[]]></example><ref NodeID="47" Label="References" DataID="432" Show="0"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" DataID="434" Show="0"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" DataID="444" Show="0"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12">/*
This script remove the high frequency part of a section of sound. The sample data is located in
exe_path\Samples\Signal Processing\.

1. Import a wav file to a new book.
2. Perform low-pass filters on the data to remove the high frequency part of the sound.
3. Export the data to a new wav file.
*/

// Import the wav file
fnin$ = system.path.program$ + "Samples\Signal Processing\sample.wav";
fnout$ = system.path.program$ + "Samples\Signal Processing\Low-pass sample.wav";
newbook s:=0;
newsheet col:=1;
impWav fnin$;
string bkn$=%H;

// Remove the high frequency part
fft_filters [bkn$]1!col(1) cutoff:=2000 oy:=(&lt;input&gt;,&lt;new name:="Low Frequency of the Sound"&gt;);

// Set the new wav column's format to be short(2) type for later export
wks.col2.format=1;
wks.col2.numerictype=3;

// Export to a new wav file;
expWav iw:=[bkn$]1! left:=2 fname:=fnout$;</script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0" TypeID="65543" BlobArrElementaryType="8" xmlns:dt="urn:schemas-microsoft-com:datatypes" dt:dt="bin.base64">AAA=</errmsgs></helpe><helpj NodeID="268435456" Label="Japanese Help" DataID="420" RepeatID="512"><description NodeID="11" Label="Description" DataID="440" CdPg="932">FFTフィルタ:FFTフィルタを実行する。</description><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="448" CdPg="932"></customButtons><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8" CdPg="932">FFT????(&amp;L):  ??????FFT???????????</info><summary NodeID="47" Label="Summary" DataID="421" Show="0" CdPg="932"><![CDATA[]]></summary><example NodeID="47" Label="Examples" DataID="431" Show="0" CdPg="932"><![CDATA[]]></example><ref NodeID="47" Label="References" DataID="432" Show="0" CdPg="932"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" DataID="434" Show="0" CdPg="932"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" DataID="444" Show="0" CdPg="932"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12" CdPg="932"></script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0" CdPg="932"></errmsgs></helpj><helpg NodeID="268435456" Label="German Help" DataID="420" RepeatID="768"><description NodeID="11" Label="Description" DataID="440" CdPg="1252">FFT Filter:FFT Filter ausführen</description><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="448" CdPg="1252"></customButtons><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8" CdPg="1252">FFT Fi&amp;lter:  Fourier Filter auf Eingabedaten ausführen</info><summary NodeID="47" Label="Summary" DataID="421" Show="0" CdPg="1252"><![CDATA[]]></summary><example NodeID="47" Label="Examples" DataID="431" Show="0" CdPg="1252"><![CDATA[]]></example><ref NodeID="47" Label="References" DataID="432" Show="0" CdPg="1252"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" DataID="434" Show="0" CdPg="1252"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" DataID="444" Show="0" CdPg="1252"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12" CdPg="1252"></script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0" CdPg="1252"></errmsgs></helpg><helpc NodeID="268435456" Label="Chinese Help" DataID="420" RepeatID="1024"><description NodeID="11" Label="Description" DataID="440" CdPg="936"></description><customButtons NodeID="11" Label="GetN Dialog Custom Buttons" DataID="448" CdPg="936"></customButtons><info NodeID="41" Label="Auto Complete Hint" DataID="422" RowHeightRange="2-8" CdPg="936"></info><summary NodeID="47" Label="Summary" DataID="421" Show="0" CdPg="936"><![CDATA[]]></summary><example NodeID="47" Label="Examples" DataID="431" Show="0" CdPg="936"><![CDATA[]]></example><ref NodeID="47" Label="References" DataID="432" Show="0" CdPg="936"><![CDATA[]]></ref><algorithm NodeID="47" Label="Algorithm" DataID="434" Show="0" CdPg="936"><![CDATA[]]></algorithm><parameters NodeID="47" Label="Parameters" DataID="444" Show="0" CdPg="936"><![CDATA[]]></parameters><script NodeID="41" Label="LabTalk Script Example" Show="0" DataID="436" RowHeightRange="2-12" CdPg="936"></script><errmsgs NodeID="47" Label="Error Messages" DataID="413" Show="0" CdPg="936"></errmsgs></helpc><SkipHiddenInDlg NodeID="10" Label="Skip hidden in dialog" DataID="295">0.</SkipHiddenInDlg><ClearMsg NodeID="10" Label="Auto Clear Error Message in dialog" DataID="296">0</ClearMsg><KeepBtnStatus NodeID="10" Label="Keep Button Status for Event Handler" DataID="298">0.</KeepBtnStatus><SptApplyUndoButtonSts NodeID="10" Label="Control Apply and Undo button by User" DataID="294">0.</SptApplyUndoButtonSts><PreviewButton NodeID="10" Label="Show Preview Button" DataID="299">1</PreviewButton><AutoApplyChkbox NodeID="10" Label="Show Auto Apply CheckBox" DataID="290">1.</AutoApplyChkbox><SkipHelpDoc NodeID="10" Label="Skip Help Document Processing" DataID="297">0.</SkipHelpDoc><SupportFolderLastUsed NodeID="10" Label="Support Folder Last Used Theme" DataID="291">0.</SupportFolderLastUsed><NotCloseOnEnterKey NodeID="10" Label="Do not Close Dialog upon Enter Key" DataID="292">0.</NotCloseOnEnterKey><seeAlso NodeID="11" Label="See Also" DataID="430"></seeAlso><relatedXF NodeID="11" Label="Related X-Functions" DataID="442">fft1, ifft1</relatedXF></OriginStorage>
