#=============================================== # TkTFT #=============================================== package TkTFT; use TkPlotModule; @ISA = qw(TkPlotModule); #公開したいサブルーチン #@EXPORT = qw(DelSpace Reduce01 MakePath RegExpQuote); use strict; use Tk::JPEG; use Utils; use CSV; use Tk; use Tk::Balloon; use MyTk::Dialog; use MyTk::MyFrame; use MyTk::MyLabFrame; use MyTk::MyLabel; use MyTk::MyEntry; use MyTk::MyListbox; use MyTk::MyBrowseEntry; use MyTk::MyText; use MyTk::MyButton; use MyTk::MyMenubutton; use MyTk::MyCanvas; use MyTk::MyAdjuster; use MyTk::MyScale; use MyTk::GraphFrameArray; use GraphData; use Sci::Science; use Sci::Material; my $pi = Sci::pi(); my $kB = Sci::kB(); my $c = Sci::c(); my $e = Sci::e(); my $e0 = Sci::e0(); my $me = Sci::me(); my $mp = Sci::mp(); my $mn = Sci::mn(); my $h = Sci::h(); my $hbar = Sci::hbar(); my $material = new Material; #============================================================ # 変数等取得関数 #============================================================ sub FileType { return shift->{FileType}; } sub SetFileType { my ($this,$t)=@_; return $this->{FileType} = $t; } sub FileName { return shift->{FileName}; } sub SetFileName { my ($this,$f)=@_; return $this->{FileName} = $f; } sub SetDataArray { my ($this, $da)=@_; return $this->{DataArray} = $da; } sub DataArray { return shift->{DataArray}; } sub GetColor { return shift->{Color}; } sub ColorMapImage { return shift->{ColorMapImage}; } sub SetColorMapImage { my ($this,$m)=@_; return shift->{ColorMapImage} = $m; } #============================================================ # コンストラクタ、デストラクタ #============================================================ sub new { my ($module, $app) = @_; # my ($module, $app, $canvas) = @_; my $this = {}; bless $this; $this->SetApplication($app); # $this->SetCanvas($canvas); return $this; } sub DESTROY { my $this = shift; $this->SUPER::DESTROY(@_); } #============================================================ # 継承クラスで定義しなおす関数 #============================================================ sub CreateLeftFrame { my ($this, $ConfigSide, @args) = @_; # return $this->SUPER::CreateLeftFrame(); return undef; } sub CreateSelectFilePane { my ($this) = @_; # return $this->SUPER::CreateSelectFilePane(); return undef; } sub CreateFileContentPane { return undef; } sub CreateWidgets { my ($this) = @_; my $App = $this->App(); my $args = $App->Args(); my $mw = $this->mw(); $this->SUPER::CreateWidgets(); #=================================================== # TFTペインを作製 #=================================================== my $Frame = $mw->MyFrame()->pack(-anchor => 'nw', -fill => 'x'); &MakeChooseFileEntry($this, $Frame, 'VdsIds', 'Vds-Ids:', '&Choose', \&ChooseFile); $Frame = $mw->MyFrame()->pack(-anchor => 'nw', -fill => 'x'); &MakeChooseFileEntry($this, $Frame, 'VgsIds', 'Vgs-Ids:', '&Choose', \&ChooseFile); $Frame = $mw->MyFrame()->pack(-anchor => 'nw', -fill => 'x'); my $lsb1 = $this->{ChooseVdsIdsPlotTypeListBox} = $Frame->MyBrowseEntry( -label => "VdsIds plot:", -state => "readonly", -takefocus => 1, -Selections => ["Vds-Ids", "Vds-log(|Ids|)"], -SelIndex => 0, # -browsecmd => [\&SelChangeListBox, "VdsIds", $this], )->pack(-side => 'left', -expand => 'yes', -fill => 'x'); my $lsb2 = $this->{ChooseVdsIdsPlotTypeListBox} = $Frame->MyBrowseEntry( -label => "Data:", -state => "readonly", -takefocus => 1, -Selections => ["all"], -SelIndex => 0, # -browsecmd => [\&SelChangeListBox, "VdsIds", $this], )->pack(-side => 'left', -expand => 'yes', -fill => 'x'); $Frame = $mw->MyFrame()->pack(-anchor => 'nw', -fill => 'x'); my $lsb3 = $this->{ChooseVgsIdsPlotTypeListBox} = $Frame->MyBrowseEntry( -label => "VgsIds plot:", -state => "readonly", -takefocus => 1, -Selections => ["Vgs-Ids", "Vgs-log(|Ids|)"], -SelIndex => 0, # -browsecmd => [\&SelChangeListBox, "VgsIds", $this], )->pack(-side => 'left', -expand => 'yes', -fill => 'x'); my $lsb4 = $this->{ChooseVgsIdsPlotTypeListBox} = $Frame->MyBrowseEntry( -label => "Data:", -state => "readonly", -takefocus => 1, -Selections => ["all"], -SelIndex => 0, # -browsecmd => [\&SelChangeListBox, "VgsIds", $this], )->pack(-side => 'left', -expand => 'yes', -fill => 'x'); if(0) { $Frame = $mw->MyFrame( )->pack(-anchor => 'nw', -fill => 'x'); $this->{VthLabel} = $Frame->MyLabel( -text => 'Vth:' )->pack(-side => 'left'); $this->{VthScale} = $Frame->MyScale( -bigincrement => 10.0, -command => sub { print "Moved to ", $this->{VthScale}->GetValue(), "\n"; }, -cursor => 'hand2', #'sb_h_double_arrow', -orient => 'horizontal', #'vertical' -digits => 4, -from => 10, -to => 120, # -label => 'label', -showvalue => 1, -length => 30, -sliderlength => 10, -width => 5, -resolution => 1, -takefocus => 1, -tickinterval => 20, -variable => 30.0, )->pack(-side => 'left', -expand => 'yes', -fill => 'x'); $Frame = $mw->MyFrame( )->pack(-anchor => 'nw', -fill => 'x'); $this->{uFELabel} = $Frame->MyLabel( -text => 'uFE:' )->pack(-side => 'left'); $this->{uFEScale} = $Frame->MyScale( -bigincrement => 10.0, -command => sub { print "Moved to ", $this->{uFEScale}->GetValue(), "\n"; }, -cursor => 'hand2', #'sb_h_double_arrow', -orient => 'horizontal', #'vertical' -digits => 4, -from => 10, -to => 120, # -label => 'label', -showvalue => 1, -length => 30, -sliderlength => 10, -width => 5, -resolution => 1, -takefocus => 1, -tickinterval => 20, -variable => 30.0, )->pack(-side => 'left', -expand => 'yes', -fill => 'x'); } my $EntryWidth = 10; $this->{T} = 300.0; # K $this->{W} = 200.0; # um $this->{L} = 50.0; # um $this->{dgate} = 100.0; # nm $this->{er} = 12.0; # e0 $this->{Cox} = 0.0; $this->{Dit} = 1.0e12; # cm-2 $this->{S} = 0.0; # V/decade $this->{uFE} = 10.0; # cm2/Vs $this->{Vth} = 0.0; # V $this->{Vds} = 5.0; # V $this->{Vgs} = 10.0; # V $this->{Neg} = 0.0; # cm-2 $Frame = $mw->MyFrame()->pack(-anchor => 'nw', -fill => 'x'); &MakeLabelEntry($this, $Frame, "T", "T:", \$this->{T}, "%g", $EntryWidth, "K", 0, 0); &MakeLabelEntry($this, $Frame, "W", "W:", \$this->{W}, "%g", $EntryWidth, "um", 1, 0); &MakeLabelEntry($this, $Frame, "L", "L:", \$this->{L}, "%g", $EntryWidth, "um", 1, 1); &MakeLabelEntry($this, $Frame, "dgate", "d(gate):", \$this->{dgate}, "%g", $EntryWidth, "nm", 2, 0); &MakeLabelEntry($this, $Frame, "er", "er:", \$this->{er}, "%g", $EntryWidth, "e0", 2, 1); &MakeLabelEntry($this, $Frame, "Cox", "Cox:", \$this->{Cox}, "%12.4g", $EntryWidth, "F/cm2", 3, 0, "disabled"); &MakeLabelEntry($this, $Frame, "Dit", "Dit:", \$this->{Dit}, "%12.4g", $EntryWidth, "cm-2", 4, 0); &MakeLabelEntry($this, $Frame, "S", "S:", \$this->{S}, "%12.4g", $EntryWidth, "V/dec", 4, 1, "disabled"); &MakeLabelEntry($this, $Frame, "uFE", "uFE:", \$this->{uFE}, "%12.4g", $EntryWidth, "cm2/Vs", 5, 0); &MakeLabelEntry($this, $Frame, "Vth", "Vth:", \$this->{Vth}, "%12.4g", $EntryWidth, "V", 5, 1); &MakeLabelEntry($this, $Frame, "Vds", "Vds:", \$this->{Vds}, "%12.4g", $EntryWidth, "V", 6, 0); &MakeLabelEntry($this, $Frame, "Vgs", "Vgs:", \$this->{Vgs}, "%12.4g", $EntryWidth, "V", 6, 1); &MakeLabelEntry($this, $Frame, "Neg", "Ne(gate):", \$this->{Neg}, "%12.4g", $EntryWidth, "cm-2", 7, 0, "disabled"); $this->UpdateParameters(); $Frame = $mw->MyFrame()->pack(-anchor => 'nw', -fill => 'x'); $this->{RecalcButton} = $Frame->MyButton( -text => 'Re&calc', -takefocus => 1, -command => [\&ButtonPressed, $this, 'RButtonDown', 'Recalc'], )->pack(-side => 'left'); $Frame = $mw->MyLabFrame( -label => 'metal', -labelside => 'acrosstop', )->pack(-anchor => 'nw', -fill => 'x'); &MakeLabelEntry($this, $Frame, "EFm", "EFm:", \$this->{EFm}, "%8.4g", $EntryWidth, "eV", 0, 0); &MakeLabelEntry($this, $Frame, "Nem", "Nem:", \$this->{Nem}, "%12.4g", $EntryWidth, "cm-3", 0, 1); #ツールバーのOpenボタンをファイル読み込みにバインドする $mw->{OpenButton}->configure( -command => [ \&ChooseVdsIdsFile, $this, $this->{VdsIdsFileEntry} ], ) if($mw->{OpenButton}); #Replotボタンを再バインドする # $mw->{ReplotButton}->configure( # -command => [ \&Draw, $this ], # ) if($mw->{ReplotButton}); #Refleshボタンを再バインドする # $mw->{RefleshButton}->configure( # -command => sub { $this->Draw(); }, #mw()->RefleshCanvas(1); }, # ) if($mw->{RefleshButton}); #$mw->bind('all', '', [\&CheckLogin, Ev('K'), 0]); #$mw->bind($ent, '', [\&CheckLogin, 'Enter', 1]); #$mw->bind($ent, '', [\&CheckLogin, 'Leave', 1]); #$mw->bind($ent, '', [\&CheckLogin, 'Property', 1]); #$mw->bind($ent, '', [\&CheckLogin, 'FocusIn', 1]); #$mw->bind($ent, '', [\&CheckLogin, 'FocusOut', 1]); # $this->{TFT} = new TFT; } sub MakeChooseFileEntry { my ($this, $Frame, $name, $Label, $ButtonLabel, $pFunction) = @_; $Frame->MyLabel(-text => $Label)->pack(-side => 'left'); $this->{"${name}FileEntry"} = $Frame->MyEntry(-takefocus => 1)->pack(-side => 'left', -expand => 'yes', -fill => 'x'); $this->{"${name}FileEntry"}->focus(); $this->{"${name}FilePathButton"} = $Frame->MyButton( -text => $ButtonLabel, -takefocus => 1, -command => [$pFunction, $this, $name, $this->{"${name}FileEntry"}], )->pack(-side => 'left'); return $this->{"${name}FileEntry"}; } sub MakeLabelEntry { my ($this, $Frame, $name, $label1, $pVariable, $format, $EntryWidth, $label2, $row, $column, $state) = @_; $state = 'normal' if(!defined $state); #print "Frame=$Frame name=$name,$label1,$format,$label2\n"; $$pVariable = Utils::DelSpace(sprintf($format, $$pVariable)); $Frame->MyLabel(-text => $label1)->grid(-row => $row, -column => 3*$column+0, -columnspan => 1, -sticky => 'e' ); my $ent = $Frame->MyEntry( -name => $name, -width => $EntryWidth, # -text => $val, -textvariable => $pVariable, -state => $state, -format => $format, )->grid(-row => $row, -column => 3*$column+1, -columnspan => 1, -sticky => 'e' ); $Frame->MyLabel(-text => $label2)->grid(-row => $row, -column => 3*$column+2, -columnspan => 1, -sticky => 'w' ); $ent->bind('', [\&EntryFocusedOut, $this, 'FocusOut', $name]); $this->{pEntryArray} = [] if(!$this->{pEntryArray}); push(@{$this->{pEntryArray}}, $ent); return $this->{"${name}Entry"} = $ent; } sub ButtonPressed { my ($this, $event, $type) = @_; if($type eq 'Recalc') { &Recalc($this); # $this->CreateGraphFrame(); $this->AssignGraphData(0); $this->Draw(); } } sub UpdateParameters { my ($this) = @_; $this->{Cox} = $material->CalCapacitance($this->{er}, 0.01*0.01, $this->{dgate}*1.0e-9); # F/cm2 $this->{S} = $material->CalSubthresholdSwing($this->{T}, $this->{er}, $this->{dgate}*1.0e-9, $this->{Dit}*1.0e4); $this->{Neg} = $this->{Cox} * ($this->{Vgs} - $this->{Vth}) / $e; # cm-2 my $pEA = $this->{pEntryArray}; for(my $i = 0 ; $i < @$pEA ; $i++) { $pEA->[$i]->Update(); } } sub EntryFocusedOut { my ($obj, $this, $event, $type) = @_; #print "type: $type\n"; if($event eq 'FocusOut') { if($type eq 'T') { } } &UpdateParameters($this); } #=================================================== # データ処理 #=================================================== sub Recalc { my ($this) = @_; &UpdateParameters($this); if($this->{"VgsIds-nData"}) { my $VgsIdsData = new GraphData; my $nData = $this->{"VgsIds-nData"}; for(my $i = 1 ; $i < $nData ; $i++) { $VgsIdsData->SetXDataArray($i-1, $this->{"VgsIds-ppDataArray"}->[0]); $VgsIdsData->SetYDataArray($i-1, $this->{"VgsIds-ppDataArray"}->[$i]); } $VgsIdsData->CalMinMax(); my ($Imin, $Imax) = $VgsIdsData->GetYMinMax(); #print "I: $Imin, $Imax\n"; my $logImin = log(abs($Imin)); my $logImax = log(abs($Imax)); my $avLogI = ($logImin + $logImax) / 2.0; my $avI = exp($avLogI); my $avV = $VgsIdsData->XVal(0, $avI); #print "av: $avV, $avI\n"; my $n = 101; my $Istep = ($logImax - $logImin) / ($n - 1); my $S = $this->{S}; my $Vth = $this->{Vth}; my @V; my @I; my $ln10 = log(10.0); for(my $i = 0 ; $i < $n ; $i++) { my $logI = $logImin + $Istep*$i; $I[$i] = exp($logI); $V[$i] = $S / $ln10 * ($logI - $avLogI) + $avV; } $this->{"SS-ppDataArray"} = [\@V, \@I]; } } sub ReadFiles { my ($this, $filepath, $type, $IsPrint) = @_; my $App = $this->App(); #print "type=$type\n"; $this->{"${type}-Path"} = $filepath; my ($nData, $pLabelArray, @pDataArray) = CSV::GetArraysFromFile($filepath); if(!defined $nData) { $App->print("Error: Can not read [$filepath] for [$type].\n"); return $this->{"${type}-Path"} = undef; } my @Vanother; $this->{"${type}-nData"} = $nData; $this->{"${type}-pLabelArray"} = $pLabelArray; $this->{"${type}-ppDataArray"} = \@pDataArray; $this->{"${type}-pVanother"} = \@Vanother; if($IsPrint) { my $pX = $this->{"${type}-ppDataArray"}->[0]; for(my $i = 0 ; $i < $nData ; $i++) { my $x = $pX->[$i]; $App->print("$i: $x, "); for(my $j = 1 ; $j < @pDataArray ; $j++) { my $pY = $this->{"${type}-ppDataArray"}->[$j]; my $y = $pY->[$i]; $App->print("$y,"); } $App->print("\n"); } } $this->{"Choose${type}PlotTypeListBox"}->DeleteAllItem(); $this->{"Choose${type}PlotTypeListBox"}->AddItem("all"); $App->print("Vanother: "); for(my $j = 1 ; $j < @pDataArray ; $j++) { my $j1 = $j-1; # ($Vanother[$j1]) = ($pLabelArray->[$j] =~ /([\+\-]?\d*(\.\d*)?([eEdD][\+\-]?\d+)?)/); ($Vanother[$j1]) = ($pLabelArray->[$j] =~ /([\+\-]?[\d\.]+([eEdD][\+\-]?\d+)?)/); if($j == 1) { $App->print("$Vanother[$j1]"); } else { $App->print(",$Vanother[$j1]"); } $this->{"Choose${type}PlotTypeListBox"}->AddItem($pLabelArray->[$j]); } $App->print("\n"); $this->CreateGraphFrame(); $this->AssignGraphData(); return $filepath; } sub CreateGraphFrame { my ($this, $canvas, $TargetData) = @_; $canvas = $this->Canvas(); my $App = $this->App(); my $font = $App->{'GraphFrameFont'}; my @font = split(/,/, $font) if($font); my $w = $canvas->width(); my $h = $canvas->height(); # my $FileType = $this->FileType(); # return undef unless($FileType); # my $pDataArray = $this->DataArray(); # return unless($pDataArray); my $GraphFrameArray = $this->{'GraphFrameArray'} = new GraphFrameArray($this->mw()); $GraphFrameArray->SetCanvasSize($w, $h); $GraphFrameArray->AddGraphFrame(); my $GraphFrame0 = $GraphFrameArray->GetGraphFrame(0); my $FramePosStr0 = $App->{"GraphFrame0Position"}; my $XScale0 = $GraphFrame0->GetXScale(0); my $YScale0 = $GraphFrame0->GetYScale(0); $GraphFrame0->SetPositionByStr($FramePosStr0); $GraphFrameArray->AddGraphFrame(); my $GraphFrame1 = $GraphFrameArray->GetGraphFrame(1); my $FramePosStr1 = $App->{"GraphFrame1Position"}; my $XScale1 = $GraphFrame1->GetXScale(0); my $YScale1 = $GraphFrame1->GetYScale(0); $GraphFrame1->SetPositionByStr($FramePosStr1); $GraphFrame0->SetXCaption("Vds / V"); $GraphFrame0->SetYCaption("Ids / A"); $GraphFrame1->SetXCaption("Vgs / V"); $GraphFrame1->SetYCaption('Ids / A'); $XScale0->SetScaleStringVisible(1); $XScale0->SetCaptionVisible(1); $XScale1->SetScaleStringVisible(1); $XScale1->SetCaptionVisible(1); $GraphFrame0->SetViewRange(0, 0, 1, 1); $GraphFrame1->SetViewRange(0, 0, 1, 1); } sub AssignGraphData { my ($this, $ResetViewRange) = @_; $ResetViewRange = 1 if(!defined $ResetViewRange); my $GraphFrameArray = $this->GetGraphFrameArray(); my $GraphFrame0 = $GraphFrameArray->GetGraphFrame(0); my $GraphFrame1 = $GraphFrameArray->GetGraphFrame(1); $GraphFrame0->ClearAllData() if($GraphFrame1); $GraphFrame1->ClearAllData() if($GraphFrame1); # my $pDataArray = $this->DataArray(); # my $FileType = $this->FileType(); # my $TargetData = $pDataArray->{'TargetData'}; # return unless($pDataArray); # my $Data0 = $pDataArray->GetGraphData(0); # my $Data1 = $pDataArray->GetGraphData(1); # return unless($Data1); # my $nData = $Data0->nData(); # my $title = $Data0->Title(); if($this->{"VdsIds-nData"}) { my $PlotType = $this->{ChooseVdsIdsPlotTypeListBox}->GetText(); #print "PlotType: $PlotType\n"; my $nData = $this->{"VdsIds-nData"}; my $pLabelArray = $this->{"VdsIds-pLabelArray"}; my $ppDataArray = $this->{"VdsIds-ppDataArray"}; my $nDataAray = @$ppDataArray; my $pVgs = $this->{"VdsIds-pVanother"}; return unless($pLabelArray); my $pX = $ppDataArray->[0]; for(my $i = 1 ; $i < $nDataAray ; $i++) { next if($PlotType ne 'all' and $PlotType ne $pLabelArray->[$i]); my $i1 = $i - 1; my $pY = $ppDataArray->[$i]; my $Vgs = $pVgs->[$i1]; #print "pX=$pX, pY/$i=$pY Vgs=$Vgs\n"; my $nData0 = $GraphFrame0->AddGraphData($pX, $pY, 1, "black", "", 6, "red", 0, "red", "XAutoSkip", "Vds", "Vgs=$Vgs"); } $GraphFrame0->SetYScalePlotType('x'); if($ResetViewRange) { $GraphFrame0->CalMinMax(); $GraphFrame0->AdjustViewRange(0.05, 0.05, 0.05, 0.05); } } if($this->{"VgsIds-nData"}) { my $PlotType = $this->{ChooseVgsIdsPlotTypeListBox}->GetText(); my $nData = $this->{"VgsIds-nData"}; my $pLabelArray = $this->{"VgsIds-pLabelArray"}; my $ppDataArray = $this->{"VgsIds-ppDataArray"}; my $nDataAray = @$ppDataArray; my $pVds = $this->{"VgsIds-pVanother"}; return unless($pLabelArray); my $pX = $ppDataArray->[0]; for(my $i = 1 ; $i < $nDataAray ; $i++) { next if($PlotType ne 'all' and $PlotType ne $pLabelArray->[$i]); my $i1 = $i - 1; my $pY = $ppDataArray->[$i]; my $Vds = $pVds->[$i1]; #print "pX=$pX, pY/$i=$pY Vds=$Vds\n"; my $nData0 = $GraphFrame1->AddGraphData($pX, $pY, 1, "black", "", 6, "red", 0, "red", "XAutoSkip", "Vgs", "Vds=$Vds"); } $GraphFrame1->SetYScalePlotType('log(|x|)'); $GraphFrame1->CalMinMax(); if($ResetViewRange) { $GraphFrame1->{YMin}= 1.0e-15; $GraphFrame1->AdjustViewRange(0.05, 0.05, 0.05, 0.05); } } if($this->{"SS-ppDataArray"}) { my $pV = $this->{"SS-ppDataArray"}->[0]; my $pI = $this->{"SS-ppDataArray"}->[1]; my $nData0 = $GraphFrame1->AddGraphData($pV, $pI, 0.5, "red", "", 6, "red", 0, "red", "XAutoSkip", "Vgs", "Ids-SS(cal)"); $GraphFrame1->CalMinMax(); if($ResetViewRange) { $GraphFrame1->{YMin}= 1.0e-15; $GraphFrame1->AdjustViewRange(0.05, 0.05, 0.05, 0.05); } } } sub AdjustViewRange { my ($this) = @_; my $GraphFrameArray = $this->GetGraphFrameArray(); my $pGraphFrame = $GraphFrameArray->GetpGraphFrameArray(); my $FileType = $this->FileType(); if($FileType =~ /(Ids)/i) { } } sub Draw { my ($this, $canvas, $TargetData) = @_; my $mw = $this->mw(); $canvas = $this->Canvas() if(!$canvas); # my $FileType = $this->FileType(); my $App = $this->App(); my $font = $App->{'GraphFrameFont'}; my @font = split(/,/, $font) if($font); my $GraphFrameArray = $this->GetGraphFrameArray(); return unless($GraphFrameArray); $canvas->ClearAll(); $mw->RefleshCanvas(); if($font) { $canvas->SetFont(\@font); $GraphFrameArray->SetFont(\@font); } my $w = $canvas->width(); my $h = $canvas->height(); $GraphFrameArray->SetCanvasSize($w, $h); $this->mw()->WriteStatusBar("Drawing TFT..."); # $this->ReadFiles($this->FileName(), $TargetData); # $this->CreateGraphFrame($canvas, $TargetData); # $this->AssignGraphData(); $mw->Balloon()->detach($canvas); $GraphFrameArray->Draw($canvas); $this->mw()->WriteStatusBar("Finish TFT."); } sub DeleteWidget { my ($this, $Frame) = @_; return undef unless($Frame); return 1; } sub AddWidget { my ($this, $Frame) = @_; return undef unless($Frame); # 左枠3列目作成: ファイルの内容を表示するセクションリストボックス # $this->mw()->CreateSectionListBox(); # 左枠4列目作成: ファイルの内容を表示するテキストボックス # $this->mw()->CreateFileContentTextBox(); return 1; } sub SetFileInfo { my ($this, $ListBox, $TextBox) = @_; return undef unless($ListBox); return undef unless($TextBox); $ListBox->ClearAll(); $TextBox->ClearText(); my $App = $this->App(); my @Font = split(/,/, $App->{"FileContentFont"}); $TextBox->configure(-font => \@Font) if(@Font > 0); my $DataArray = $App->TkData(); return undef unless($DataArray); # $TextBox->AddText("$nData\n"); return 1; } sub SelTags { my ($canvas, $this, $command, $x, $y, $X, $Y) = @_; #print "command: $command Pos: ($x, $y)\n"; if($command =~ /LButtonDown/i) { } elsif($command =~ /Move/i) { my $s = "($x,$y)"; $this->mw()->WriteStatusBar($s); } elsif($command =~ /LButtonUp/i) { } } sub SelChangeListBox { my ($this, $type, $lb) = @_; my $s = $lb->GetText(); if($s =~ /Solar/i) { } } sub ChooseFile { # $type: "VdsIds", "VgsIds" my ($this, $type, $widget) = @_; my $App = $this->App(); my $canvas = $this->Canvas(); my $mw = $this->mw(); my $dir = ''; unless($widget) { $dir = $this->App()->{'WorkDir'}; chdir($dir); } my $fmask = '*.csv'; my $defstr = ''; my $message = 'Choose file'; my $filepath = Dialog::OpenFileDialog($mw, 'open', $fmask, $defstr, $message, $dir); if($filepath) { my $DirPath = $this->SetWorkDir($filepath); if($widget) { $widget->SetText($filepath); } } my $ret = $this->ReadFiles($filepath, $type); return undef unless($ret); $this->Draw(); return $ret; } 1;