Commit 5714567e authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Fixed some tooltips in SettingsCanvas

Added Button to validate/select Net Drivers for FIUs
Added MenuBar, TODO: decide if we use this
parent 6805520b
......@@ -486,7 +486,7 @@ BEGIN {
order => 30,
},
general_control => {
title => "General FIC settings",
title => "General settings",
subtitle => "",
description => "Settings concerning miscellanous features of FIJI",
order => 10,
......@@ -507,16 +507,19 @@ BEGIN {
%fiumap = (
FIU_NET_NAME => {
ini_name => "NET_NAME",
phases_opt => [qw(setup)], # defaults to undef
default => "",
phases_opt => [qw(setup)],
},
FIU_DRIVER_TYPE => {
ini_name => "DRIVER_TYPE",
values => [qw(PIN PORT ASSIGN)],
phases_opt => [qw(setup)], # defaults to undef
default => "",
phases_opt => [qw(setup)],
},
FIU_DRIVER_PATH => {
ini_name => "DRIVER_PATH",
phases_opt => [qw(setup)], # defaults to undef
phases_opt => [qw(setup)],
default => "",
},
FIU_MODEL => {
ini_name => "FAULT_MODEL",
......
......@@ -107,6 +107,8 @@ sub read_file ($) {
return 1;
}
$self->{'filename'} = $filename;
$logger->info("Successfully read in netlist from file \"$filename\".");
return 0;
}
......@@ -148,16 +150,8 @@ sub _get_subnets ($$) {
$thishier .= $mod->name;
foreach my $n ($mod->nets) {
if ((defined $n->msb && defined $n->lsb)) {
$logger->debug("Net ".$thishier.$HIERSEP.$n->name." is bussed [".$n->msb.":".$n->lsb."]");
# for (my $i = $n->lsb; $i <= $n->msb; $i++) {
# my $thisnet_ref = {name => $n->name[$i], path => $thishier, net => $n};
# push(@{$nets_ref}, $thisnet_ref);
# }
}
my $thisnet_ref = {name => $n->name, path => $thishier, net => $n};
push(@{$nets_ref}, $thisnet_ref);
#$self->_get_net_connections($n,$mod,$hier);
}
foreach my $cell ($mod->cells_sorted) {
......@@ -469,6 +463,35 @@ sub instrument_net ($$;$) {
return undef;
}
## @method validate_driver(net_path, driver_path, driver_type)
# Check if the driver specified by $driver_type and $driver_path
# is actually connected to the net specified by $net_path
sub _validate_driver {
my $logger = get_logger();
my ($self, $net_path, $driver_path, $driver_type) = @_;
my $connection_object = $self->get_connection_object($driver_path, $driver_type);
my $net_ref = $self->splitnet($net_path);
my $connections = {};
if(ref($net_ref) eq "HASH") {
$self->_get_net_connections($net_ref->{'net'},$connections);
} else {
return $net_ref;
}
my @in_drivers = grep {$_ == $connection_object} @{$connections->{'drivers'}};
my @in_connections = grep {$_ == $connection_object} @{$connections->{'connected'}};
if(@in_drivers == 0 && @in_connections == 0) {
my $msg = "No possible driver found";
$logger->error($msg);
return $msg;
}
return undef;
}
# Prompt the user to select a driver for a net from a set of given cells/outputs
# Params:
# connected list reference containing connected Verilog::Perl instances
......@@ -840,21 +863,21 @@ sub splitnet ($) {
my @net_split = split(/\|/,$netpath);
if(!defined $net_split[-2]) {
$msg = "Not a valid net path.\n";
$msg = "Not a valid net path.";
return $msg;
}
my $mod = $self->{'nl'}->find_module($net_split[-2]);
if (!defined $mod) {
$msg = "Could not find module '".$net_split[-2]."'\n";
$msg = "Could not find module '".$net_split[-2]."' in netlist $self->{'filename'}\n";
return $msg;
}
my $net = $mod->find_net($net_split[-1]);
if (!defined $net) {
$msg = "Could not find net '".$mod->name."|".$net_split[-1]."'\n";
$msg = "Could not find net '".$mod->name."|".$net_split[-1]." in netlist $self->{'filename'}'\n";
return $msg;
}
......
......@@ -654,14 +654,13 @@ sub _log2 {
## Determined by experiment & fitted by scipy.optimize.curve_fit
#
sub _est_resources {
my $logger = get_logger();
my ($FREQUENCY, $BAUD, $TIMER_WIDTH, $RESET_CYCLES, $LFSR_WIDTH, $FIU_NUM, $algo) = @_;
# FIXME where do we put these values? they are likely to change if the VHDL
# source is changed...
$algo = "logarithmic" if (!defined $algo);
my $registers;
......@@ -678,20 +677,20 @@ sub _est_resources {
if ($algo eq "logarithmic") {
$registers = 105.90215234;
$registers += (-8.78501935753e-10)*($FREQUENCY) + (2.02400278472)*(_log2($FREQUENCY));
$registers += (-1.92362445319e-08)*($BAUD) + (-1.99903895447)*(_log2($BAUD));
$registers += (25.294652022)*($TIMER_WIDTH) + (-3.6942823707)*(_log2($TIMER_WIDTH));
$registers += (-0.0388887762348)*($RESET_CYCLES) + (1.12647034117)*(_log2($RESET_CYCLES));
$registers += (1.0012871074)*($LFSR_WIDTH) + (-0.035302419887)*(_log2($LFSR_WIDTH));
$registers += (13.0019033469)*($FIU_NUM) + (-1.06808285072)*(_log2($FIU_NUM));
$registers += (-8.78501935753e-10) * ($FREQUENCY) + (2.02400278472) * (_log2($FREQUENCY));
$registers += (-1.92362445319e-08) * ($BAUD) + (-1.99903895447) * (_log2($BAUD));
$registers += (25.294652022) * ($TIMER_WIDTH) + (-3.6942823707) * (_log2($TIMER_WIDTH));
$registers += (-0.0388887762348) * ($RESET_CYCLES) + (1.12647034117) * (_log2($RESET_CYCLES));
$registers += (1.0012871074) * ($LFSR_WIDTH) + (-0.035302419887) * (_log2($LFSR_WIDTH));
$registers += (13.0019033469) * ($FIU_NUM) + (-1.06808285072) * (_log2($FIU_NUM));
$lutsum = 141.184641269;
$lutsum += (5.14383788335e-09)*($FREQUENCY) + (4.44319121639)*(_log2($FREQUENCY));
$lutsum += (8.15160754702e-07)*($BAUD) + (-4.96956691254)*(_log2($BAUD));
$lutsum += (21.280632646)*($TIMER_WIDTH) + (-7.40399315196)*(_log2($TIMER_WIDTH));
$lutsum += (0.0181923149046)*($RESET_CYCLES) + (1.33545547133)*(_log2($RESET_CYCLES));
$lutsum += (0.0264092868862)*($LFSR_WIDTH) + (-0.817645982805)*(_log2($LFSR_WIDTH));
$lutsum += (3.88874581602)*($FIU_NUM) + (0.262418360097)*(_log2($FIU_NUM));
$lutsum += (5.14383788335e-09) * ($FREQUENCY) + (4.44319121639) * (_log2($FREQUENCY));
$lutsum += (8.15160754702e-07) * ($BAUD) + (-4.96956691254) * (_log2($BAUD));
$lutsum += (21.280632646) * ($TIMER_WIDTH) + (-7.40399315196) * (_log2($TIMER_WIDTH));
$lutsum += (0.0181923149046) * ($RESET_CYCLES) + (1.33545547133) * (_log2($RESET_CYCLES));
$lutsum += (0.0264092868862) * ($LFSR_WIDTH) + (-0.817645982805) * (_log2($LFSR_WIDTH));
$lutsum += (3.88874581602) * ($FIU_NUM) + (0.262418360097) * (_log2($FIU_NUM));
# $lut6 = 108.374524207;
# $lut6 += (2.01487096337e-09)*($FREQUENCY) + (1.83543879998)*(_log2($FREQUENCY));
......@@ -750,132 +749,8 @@ sub _est_resources {
sub estimate_resources {
my $logger = get_logger();
my ($settings_ref) = @_;
# FIXME where do we put these values? they are likely to change if the VHDL
# source is changed...
my $CTRL_COMB_FACTOR_MIN = 0.85; # c5 ft1
my $CTRL_COMB_FACTOR_MAX = 1.2; # c3de0
my $FIU_COMB_FACTOR_RT_MIN = 0.36; # v5max
my $FIU_COMB_FACTOR_RT_MAX = 1.22; # c3 de0
my $FIU_COMB_FACTOR_SI_MIN = 0.42; # v5mid
my $FIU_COMB_FACTOR_SI_MAX = 0.75; # c3 de0
my $BUFFER_COMB_FACTOR_MIN = 0.85; # v5max
my $BUFFER_COMB_FACTOR_MAX = 1.1; # c5 ft1
my $UART_COMB_FACTOR_MIN = 0.9; # v5mid
my $UART_COMB_FACTOR_MAX = 1.83; # c3 de0
my $consts_ref = $settings_ref->{'design'};
my $fiu_ref = $settings_ref->{'fius'};
my $fiubytes = ceil((@$fiu_ref*$consts_ref->{'CFGS_PER_MSG'}*$consts_ref->{'FIU_CFG_BITS'})/8.0);
my $cfgbytes = ($consts_ref->{'TIMER_WIDTH'} * $consts_ref->{'CFGS_PER_MSG'} + 4);
my $comb_min = 0;
my $comb_max = 0;
my $reg = 0;
my $uart_regs = 0;
my $ctrl_regs = 0;
my $fiu_regs = 0;
my $buffer_regs = 0;
my $rv;
# resources for FIC
my $ctrl_reg_hash = {
TRIGGER_SYNC => 3,
FSM_STATE => 9,
CRC => 8,
ERROR_BITS => 3,
INJ_START => 1,
ID => 16,
CONFIG => 8,
RST_CNTR => ($consts_ref->{'RESET_DUT_IN_EN'}) ? ceil(_log2($consts_ref->{'RESET_DUT_IN_DURATION'})) : 0,
BYTE_CNTR => ceil(_log2(max($fiubytes,$cfgbytes))),
PAT_CNTR => ceil(_log2($consts_ref->{'CFGS_PER_MSG'})) * 2, # we need to store an older value, too
TIMER_STOR => $consts_ref->{'TIMER_WIDTH'} * 8 * $consts_ref->{'CFGS_PER_MSG'}, # value storage
TIMER_VAL => $consts_ref->{'TIMER_WIDTH'} * 8,
TIMER_IDLE => 1
};
my $uart_reg_hash = {
RX_SYNC => 4,
RX_BIT_COUNT => 3,
RX_BAUD_GEN => ceil(_log2($consts_ref->{'FREQUENCY'}/$consts_ref->{'BAUDRATE'})),
RX_STATE => 4,
TX_BIT_COUNT => 3,
TX_BAUD_GEN => ceil(_log2($consts_ref->{'FREQUENCY'}/$consts_ref->{'BAUDRATE'})),
TX_DATA_REG => 8,
TX_OUT_REG => 1,
TX_STATE => 4,
OUT_REGS_TO_CTRL=> 4
};
my $buffer_reg_hash = {
BUFFER_STORAGE => 10, # Buffer width * (Depth+1)
BUFFER_INDEX_RD => 3, # (ceil(log2(depth)) + 1)
BUFFER_INDEX_WR => 3, # (ceil(log2(depth)) + 1)
READER_STATE => 2
};
$logger->debug("Num FIUs: ".@$fiu_ref);
my $stuck_open_flag = 0;
# resources for FIUs
foreach my $fiu (@$fiu_ref) {
my $this_fiu_reg;
$this_fiu_reg += 12; # we don't assume regs get optimized away when using a single model
$this_fiu_reg += 1 if ($fiu->{'FIU_MODEL'} eq "RUNTIME" or $fiu->{'FIU_MODEL'} eq "DELAY");
if (($fiu->{'FIU_MODEL'} eq "RUNTIME" or $fiu->{'FIU_MODEL'} eq "STUCK_OPEN")) {
# actually, STUCK_OPEN will only be implemented if additionally $fiu->{'FIU_LFSR_MASK'} != 0
# but to give the user a conservative estimate immediately, we omit this condition
$this_fiu_reg += 1;
$stuck_open_flag = 1;
}
# if ($fiu->{'FIU_MODEL'} eq "RUNTIME") {
# $comb_min += $this_fiu_reg * $FIU_COMB_FACTOR_RT_MIN;
# $comb_max += $this_fiu_reg * $FIU_COMB_FACTOR_RT_MAX;
# } else {
# $comb_min += $this_fiu_reg * $FIU_COMB_FACTOR_SI_MIN;
# $comb_max += $this_fiu_reg * $FIU_COMB_FACTOR_RT_MAX;
# }
$fiu_regs += $this_fiu_reg
}
# LFSR will get optimized away if it is not used
$ctrl_reg_hash->{'LFSR'} = $consts_ref->{'LFSR_WIDTH'} if $stuck_open_flag != 0;
# calculate total registers
for my $k (keys(%$ctrl_reg_hash)) {
$ctrl_regs += $ctrl_reg_hash->{$k};
}
$logger->debug("ESTIMATE: CTRL will need ~$ctrl_regs registers");
for my $k (keys(%$uart_reg_hash)) {
$uart_regs += $uart_reg_hash->{$k};
}
$logger->debug("ESTIMATE: UART will need ~$uart_regs registers");
for my $k (keys(%$buffer_reg_hash)) {
$buffer_regs += $buffer_reg_hash->{$k};
}
$logger->debug("ESTIMATE: BUFFER will need ~$buffer_regs registers");
$logger->debug("ESTIMATE: FIUS will need ~$fiu_regs registers");
$reg = $ctrl_regs + $buffer_regs + $uart_regs + $fiu_regs;
# $comb_min += $ctrl_regs * $CTRL_COMB_FACTOR_MIN;
# $comb_max += $ctrl_regs * $CTRL_COMB_FACTOR_MAX;
# $comb_min += $buffer_regs * $BUFFER_COMB_FACTOR_MIN;
# $comb_max += $buffer_regs * $BUFFER_COMB_FACTOR_MAX;
# $comb_min += $uart_regs * $UART_COMB_FACTOR_MIN;
# $comb_max += $uart_regs * $UART_COMB_FACTOR_MAX;
my $fiu_ref = $settings_ref->{'fius'};
my $fiu_num = @{$fiu_ref};
my @calcrv = _est_resources($consts_ref->{'FREQUENCY'},
......@@ -883,16 +758,14 @@ sub estimate_resources {
$consts_ref->{'TIMER_WIDTH'},
$consts_ref->{'RESET_DUT_IN_DURATION'},
$consts_ref->{'LFSR_WIDTH'},
$fiu_num,"logarithmic");
$fiu_num, "logarithmic");
# $rv->{'regs'} = ceil($reg/10)*10;
# $rv->{'comb_min'} = ceil($comb_min/10)*10;
# $rv->{'comb_max'} = ceil($comb_max/10)*10;
#$rv->{'lut_calc'} = ceil($calcrv[1]/10)*10;
$rv->{'regs'} = sprintf("%.2f", $calcrv[0]/$base_resources[0]);
$rv->{'lut_calc'} = sprintf("%.2f", $calcrv[1]/$base_resources[1]);
my $rv = {
regs => sprintf("%.2f", $calcrv[0]/$base_resources[0]),
lut_calc => sprintf("%.2f", $calcrv[1]/$base_resources[1]),
};
$logger->debug("ESTIMATE: current config will need ~$rv->{'regs'} registers and ~$rv->{'lut_calc'} Virtex5 LUTs");
$logger->debug("ESTIMATE: current config will need Base*$rv->{'regs'} registers and Base*$rv->{'lut_calc'} combinational resources");
return $rv;
}
......
This diff is collapsed.
This diff is collapsed.
; Config::Simple 4.58
; Mon Aug 31 16:18:03 2015
; Tue Sep 15 18:49:03 2015
[FIU0]
FAULT_MODEL=RUNTIME
DRIVER_PATH=i2c_master_bit_ctrl|al_RNIHURE|combout
DRIVER_TYPE=PIN
[FIU1]
LFSR_MASK=0x0
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|N_152_tz
DRIVER_TYPE=PIN
FAULT_MODEL=RUNTIME
DRIVER_PATH=i2c_master_bit_ctrl|c_state_RNO_0_|combout
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|c_state_ns_0_0__g0_0_0
[FIU2]
DRIVER_PATH=i2c_master_top|byte_controller|cnt_RNIOCS1_combout_0
[FIU0]
DRIVER_TYPE=PIN
NET_NAME=i2c_master_top|cnt_RNIOCS1_combout
LFSR_MASK=0x0
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|N_152_tz
DRIVER_PATH=i2c_master_bit_ctrl|al_RNIHURE|combout
FAULT_MODEL=RUNTIME
[FIU1]
FAULT_MODEL=RUNTIME
DRIVER_PATH=i2c_master_bit_ctrl|c_state_RNO_0_|combout
NET_NAME=i2c_master_top|i2c_master_byte_ctrl|i2c_master_bit_ctrl|c_state_ns_0_0__g0_0_0
[FIU2]
LFSR_MASK=0x0
DRIVER_TYPE=PIN
FAULT_MODEL=RUNTIME
DRIVER_PATH=i2c_master_top|byte_controller|cnt_RNIOCS1_combout_0
NET_NAME=i2c_master_top|cnt_RNIOCS1_combout
[CONSTS]
LFSR_WIDTH=32
RESET_EXT_IN_NAME=s_fiji_reset
FAULT_DETECT_1_EN=1
RESET_DUT_IN_ACTIVE=1
TRIGGER_EXT_EN=0
TRIGGER_EXT_IN_NAME=s_fiji_trigger_ext
FIU_NUM=3
FREQUENCY=50000000
FAULT_DETECT_2_EN=1
TRIGGER_DUT_ACTIVE=1
RESET_EXT_IN_NAME=s_fiji_reset
FAULT_DETECT_2_NAME=i2c_master_top|i2c_master_byte_ctrl|N_70
LFSR_POLY=0x2d
LFSR_WIDTH=32
ID=0xaa4
RESET_EXT_ACTIVE=0
TRIGGER_DUT_EN=0
OUTPUT_DIR=.
RESET_EXT_EN=1
RESET_DUT_IN_NAME=wb_rst_i
FAULT_DETECT_2_EN=1
RESET_DUT_OUT_EN=1
FIU_CFG_BITS=3
FAULT_DETECT_1_INVERT=0
TRIGGER_DUT_EN=0
FAULT_DETECT_1_EN=1
TRIGGER_EXT_ACTIVE=1
TRIGGER_EXT_EN=0
RESET_DUT_OUT_EN=1
RESET_DUT_IN_EN=0
RESET_DUT_IN_DURATION=4
RESET_DUT_OUT_NAME=i2c_master_top|i2c_master_byte_ctrl|c_state_ns_0_0_0_5__g1
TRIGGER_DUT_NAME=i2c_master_top|cnt_RNIOCS1_combout
TX_OUT_NAME=s_fiji_tx_o
LFSR_SEED=0xcafe
BAUDRATE=115200
FAULT_DETECT_2_NAME=i2c_master_top|i2c_master_byte_ctrl|N_70
LFSR_POLY=0x2d
FAULT_DETECT_1_NAME=i2c_master_top|i2c_master_byte_ctrl|N_11_i
TRIGGER_EXT_IN_NAME=s_fiji_trigger_ext
RX_IN_NAME=s_fiji_rx_i
FAULT_DETECT_2_INVERT=1
RESET_EXT_ACTIVE=0
CFGS_PER_MSG=2
FAULT_DETECT_1_INVERT=0
RX_IN_NAME=s_fiji_rx_i
RESET_DUT_IN_DURATION=4
RESET_DUT_OUT_NAME=i2c_master_top|i2c_master_byte_ctrl|c_state_ns_0_0_0_5__g1
CLOCK_NET=i2c_master_top|wb_clk_i_c
TRIGGER_DUT_ACTIVE=1
FAULT_DETECT_2_INVERT=1
RESET_DUT_IN_EN=0
TIMER_WIDTH=4
RESET_DUT_IN_NAME=wb_rst_i
FIU_NUM=3
TRIGGER_DUT_NAME=i2c_master_top|cnt_RNIOCS1_combout
RESET_DUT_IN_ACTIVE=1
RESET_DUT_OUT_ACTIVE=0
BAUDRATE=115200
LFSR_SEED=0xcafe
......@@ -30,7 +30,7 @@ use Tk::widgets qw(LabFrame Label Entry Button Dialog FBox Checkbutton);
use Tk::PNG;
use Clone qw(clone);
use File::Spec;
use Data::Dumper;
use FIJI::Settings;
use Tk::FIJISettingsViewer;
......@@ -44,6 +44,24 @@ use constant FILE_TYPES_NETLIST => [
['All files' , '*' ],
];
my $abouttxt = <<'END_ABOUT';
#-------------------------------------------------------------------------------
# University of Applied Sciences Technikum Wien
#
# Department of Embedded Systems
# http://embsys.technikum-wien.at
#
# Josef Ressel Center for Verification of Embedded Computing Systems
# http://vecs.technikum-wien.at
#
#-------------------------------------------------------------------------------
#
# $LastChangedBy$
# $LastChangedDate$
#
#-------------------------------------------------------------------------------
END_ABOUT
sub main {
my $logger = get_logger();
my $name = $0;
......@@ -59,19 +77,14 @@ sub main {
my ($vol,$basedir,$file) = File::Spec->splitpath($abspath);
my $libdir = File::Spec->catdir($basedir,"lib");
# my %cfg;
# my $cfgname = $name . ".cfg";
# if (!Config::Simple->import_from($cfgname, \%cfg)) {
# $logger->fatal("Could not read config file \"$cfgname\": " . Config::Simple->error());
# return 1;
# }
# $hash{'cfg'} = $cfg;
my $ini_name; # = $cfg{"cli.fiji_cfg"};
$self->{'ini_name'} = \$ini_name;
my $nl_name;
$self->{'nl_name'} = \$nl_name;
#
# Start out with default settings
#
my $settings_ref = FIJI::Settings->new();
if (!ref($settings_ref)) {
$logger->error($settings_ref);
......@@ -79,31 +92,29 @@ sub main {
}
$self->{'settings'} = $settings_ref;
#
# Build GUI
#
my $mw = MainWindow->new(
-title => 'FIJI Settings Editor'
);
$self->{'mw'} = $mw;
$self->{'ctrl'} = _ctrl_frame($self, $mw);
$self->{'menu'} = _menu($self,$mw);
# $self->{'resources'} = "...";
# $self->{'StatusBar'} = $mw->StatusBar();
# $self->{'StatusBar'} ->addLabel(
# -relief => 'flat',
# -textvariable => \$self->{'resources'},
# );
$self->{'documentation_path'} = File::Spec->catpath($vol,$libdir,'fiji.pdf');
$self->{'FIJISettingsViewer'} = $mw->FIJISettingsViewer(
-settings => $self->{'settings'},
-documentation_path => File::Spec->catpath($vol,$libdir,'fiji.pdf'),
-documentation_path => $self->{'documentation_path'},
)->pack(
'-fill' => 'both',
'-expand' => 1
);
#
# Set icon
#
my $icon_base;
if ($^O eq "MSWin32") {
$icon_base = File::Spec->catpath($vol,$libdir,'/fiji_logo');
......@@ -112,25 +123,23 @@ sub main {
# The .xbm is needed for transparency, generate with e.g. GIMP
my $iconmask_path = "$icon_base-mask.xbm";
$mw->iconmask("\@$iconmask_path") if -r $iconmask_path;
$self->{'icon_base'} = $icon_base;
}
my $fiji_icon = $mw->Photo(-file => "$icon_base.png", -format => 'PNG');
$mw->iconimage($fiji_icon);
$self->{'FIJISettingsViewer'}->append_fiu(); # add dummy FIU for layouting purposes
$mw->update();
#my @fiu_dims = $self->{'FIJISettingsViewer'}->get_fiu_dimensions();
#my @ctrl_dims = $self->{'FIJISettingsViewer'}->get_ctrl_dimensions();
#$mw->minsize(int($fiu_dims[0] + $fiu_dims[0] * 0.1), $mw->height());
#$mw->geometry(sprintf("%dx%d", int($fiu_dims[0] + $fiu_dims[0] * 0.1), $mw->height()));
$mw->minsize($self->{'FIJISettingsViewer'}->width(), $self->{'FIJISettingsViewer'}->height()+$self->{'ctrl'}->height());
$self->{'FIJISettingsViewer'}->remove_fiu(0); # remove dummy again
$mw->update();
$mw->minsize(($self->{'FIJISettingsViewer'}->get_ctrl_dimensions)[0], ($self->{'FIJISettingsViewer'}->get_ctrl_dimensions)[1]+$self->{'ctrl'}->height());
# FIXME does not work ??
$mw->resizable(0,1);
$mw->update();
#
# Load settings if specified
#
if(defined $ARGV[0]) {
my $filename = $ARGV[0];
my $fr = $mw;
......@@ -146,7 +155,7 @@ sub main {
)->Show();
return;
}
if (!defined($self->{'FIJISettingsViewer'}->configure(-settings => $tmp_settings))) {
if (!defined($self->{'FIJISettingsViewer'}->settings($tmp_settings))) {
my $msg = "Could not update GUI correctly with new settings.";
$logger->error($msg);
$fr->Dialog(
......@@ -168,6 +177,175 @@ sub main {
return 0;
}
sub _menu {
my ($self, $mw) = @_;
my $menubar = $self->{'menu'} = $mw->Menu(-relief=>"groove");
my $file = $menubar->cascade(-label => '~File', -tearoff => 0);
my $netlist = $menubar->cascade(-label => '~Netlist', -tearoff => 0);
my $help = $menubar->cascade(-label => '~Help', -tearoff => 0);
$file->separator;
$file->command(
-label => 'Open',
-accelerator => 'Ctrl-o',
-underline => 0,
-command => sub {
my $logger = get_logger();
my $filename = $mw->FBox(
-type => 'open',
-title => 'Open FIJI Configuration file',
-filetypes => FILE_TYPES_CFG,
-initialdir => '.',
-initialfile => 'fiji.cfg'
)->Show();
if (!defined($filename)) {
$logger->debug("User aborted open configuration action");
return;
}
my $tmp_settings = \%{ Clone::clone ($self->{'settings'}) };
$tmp_settings = FIJI::Settings->new('setup', $filename, $tmp_settings);
if (!ref($tmp_settings)) {
my $msg = "Settings file $filename could not be loaded correctly: $tmp_settings";
$logger->error($msg);
$mw->Dialog(
-title => 'Open FIJI Settings failed!',
-text => "$msg\n",
)->Show();
return;
}
my $rv = $self->{'FIJISettingsViewer'}->settings($tmp_settings);
if (!defined($rv)) {
my $msg = "Could not update GUI correctly with new settings.";
$logger->error($msg);
$mw->Dialog(
-title => 'Open FIJI Settings failed!',
-text => "$msg\n",
)->Show();
return;
} elsif (ref($rv) eq "FIJI::Settings") {
$self->{'settings'} = $tmp_settings;
${$self->{'ini_name'}} = $filename;