Commit 061d8756 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Scrolled driver list, refactored some single-character variable names.

parent a22f774c
......@@ -143,13 +143,13 @@ sub netlist {
my $msg = "Some nets defined in the specified netlist do not match the loaded settings.";
$logger->error($msg);
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
my $warning_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-text => $msg . "\n" . "Proceed with new netlist nevertheless?",
-wraplength => 200,
-title => 'Warning',
-buttons => [qw/~Yes ~No/]);
my $rv = $d->Show();
my $rv = $warning_dialog->Show();
if (!defined $rv || $rv eq "No") {
$logger->info("Using original netlist");
$self->{'nets'} = $old_nets;
......@@ -188,13 +188,13 @@ sub settings {
my $msg = "Some nets defined in the specified settings do not match the loaded netlist.";
$logger->info($msg);
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
my $warning_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-text => $msg . "\n" . "Proceed with new netlist nevertheless?",
-wraplength => 200,
-title => 'Warning',
-buttons => [qw/~Yes ~No/]);
my $rv = $d->Show();
my $rv = $warning_dialog->Show();
if (!defined $rv || $rv eq "No") {
$logger->info("Using original settings");
$self->{'settings'} = $old_settings;
......@@ -264,12 +264,12 @@ sub update {
my $msg = "Could not find FIJI definition for constant named \"$name\"";
$logger->error($msg);
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::error_image($self->{'mw'}),
my $error_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::error_image($self->{'mw'}),
-text => 'Something went horribly wrong!',
-wraplength => 200,
-title => 'Warning',);
$d->Show();
$error_dialog->Show();
return;
}
......@@ -558,39 +558,39 @@ sub _populate_widget {
# entry for NET
$entry = $config_frame->Frame();
my $b = $entry->Button(-text => "Select");
my $e = $entry->Entry();
my $select_button = $entry->Button(-text => "Select");
my $net_roentry = $entry->Entry();
$e->{'displaygroup'} = $displaygroup;
$e->{'key'} = $k;
$net_roentry->{'displaygroup'} = $displaygroup;
$net_roentry->{'key'} = $k;
$e->configure(-state=>"readonly",
-validatecommand=>sub {my $new = shift; $self->_highlight_widget($e, ($b->cget(-state) ne "disabled" && $new eq "")); return 1},
$net_roentry->configure(-state=>"readonly",
-validatecommand=>sub {my $new = shift; $self->_highlight_widget($net_roentry, ($select_button->cget(-state) ne "disabled" && $new eq "")); return 1},
-textvariable=>\$self->{'settings'}->{'design'}->{$k},
-takefocus=>0);
$b->configure(
$select_button->configure(
-command => sub {
my $netname = $self->{'settings'}->{'design'}->{$k};
my $rv = $self->_select_net_dialog(\$netname,"Select Net for $k");
if (defined $rv) {
$logger->warn($rv);
$logger->error($rv);
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
my $warn_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-wraplength => $self->screenwidth,
-text => "$rv",
-title => "Warning",);
$d->Show();
$warn_dialog->Show();
} elsif (defined $netname) {
$self->{'settings'}->{'design'}->{$k} = $netname;
$self->update;
$self->_highlight_widget($e, 0);
$self->_highlight_widget($net_roentry, 0);
}
$self->_check_change();
}
);
$b->grid(-row => 0, -column => 1, -sticky => "ew");
$e->grid(-row => 0, -column => 0, -sticky => "ew");
$select_button->grid(-row => 0, -column => 1, -sticky => "ew");
$net_roentry->grid(-row => 0, -column => 0, -sticky => "ew");
$entry->gridColumnconfigure(0, -weight => 1);
$entry->grid(
......@@ -951,11 +951,11 @@ sub _add_fiu ($$) {
my $rv = $self->_select_net_dialog(\$netname,"Select Net for FIU $i");
if (defined $rv) {
$logger->warn($rv);
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
my $warn_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-wraplength => $fr_fiu->screenwidth,
-text => "$rv",
-title => "Warning",);
$d->Show();
$warn_dialog->Show();
} elsif (defined $netname && $netname ne "") {
@{$self->{'settings'}->{'fius'}}[$i]->{'FIU_NET_NAME'} = $netname;
$self->_set_fields(1, $net_entry->{'dependents'});
......@@ -972,11 +972,11 @@ sub _add_fiu ($$) {
if (defined $rvd || defined $rvn) {
my $msg = ((defined $rvd) ? $rvd : "").((defined $rvn) ? $rvn : "");
$logger->warn($msg);
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
my $warn_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-wraplength => $fr_fiu->screenwidth,
-text => "$msg",
-title => "Warning",);
$d->Show();
$warn_dialog->Show();
}
}
......@@ -991,11 +991,11 @@ sub _add_fiu ($$) {
my $rv = $self->_select_driver_dialog($i);
if (defined $rv) {
$logger->warn($rv);
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
my $warn_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::alert_image($self->{'mw'}),
-wraplength => $fr_fiu->screenwidth,
-text => "$rv",
-title => "Warning",);
$d->Show();
$warn_dialog->Show();
} else {
$self->_highlight_widget($drv_entry, 0);
}
......@@ -1171,11 +1171,11 @@ sub _set_fields_by_button {
} elsif (${$button->cget('-variable')} && ${$f->cget('-variable')}) {
${$button->cget('-variable')} = 0;
my $d = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::error_image($self->{'mw'}),
my $error_dialog = $self->{'mw'}->FIJIModalDialog(-image => Tk::FIJIUtils::error_image($self->{'mw'}),
-wraplength => 200,
-text => "\"" . $f->{'description'} . "\"\nforbids\n\"" . $button->{'description'} . "\".",
-title => "Error",);
$d->Show();
$error_dialog->Show();
}
}
}
......@@ -1395,16 +1395,16 @@ sub _select_net_dialog {
$title = "Select Net" if (!defined $title);
my $d = $self->MainWindow->DialogBoxUL(
my $select_net_dialog = $self->MainWindow->DialogBoxUL(
-title => $title,
-buttons => [qw/~OK ~Cancel/],
);
$d->bind('<Return>', => sub {});
$select_net_dialog->bind('<Return>', => sub {});
my $sel = $d->FIJINetSelection(-nets =>$self->{'nets'}, -netname_ref=>$netname_ref);
my $sel = $select_net_dialog->FIJINetSelection(-nets =>$self->{'nets'}, -netname_ref=>$netname_ref);
$sel->pack(-expand=>1,-fill=>'both',-padx=>5,-pady=>5);
Tk::FIJIUtils::set_icon($d);
$d->Show();
Tk::FIJIUtils::set_icon($select_net_dialog);
$select_net_dialog->Show();
return undef;
}
......@@ -1450,11 +1450,17 @@ sub _select_driver_dialog($) {
}
# Build the DialogBox
my $d = $self->DialogBoxUL(-title => "Driver for FIU $fiu_idx", -buttons => ["~OK", "~Cancel"]);
my $f = $d->add('Frame');
Tk::FIJIUtils::set_icon($d);
$f->Label(-text => "Select the driver for net \"" . $netpath . "\"", -justify => "left")->grid(-row => 0, -column => 0, -columnspan => 2, -sticky => "w");
my $select_driver_dialog = $self->DialogBoxUL(-title => "Driver for FIU $fiu_idx", -buttons => ["~OK", "~Cancel"]);
my $frame = $select_driver_dialog->add('Frame');
my $driver_container_pane = $frame->Scrolled('Pane', '-scrollbars' => 're', '-sticky' => 'nwse');
Tk::FIJIUtils::bind_mousewheel($select_driver_dialog->toplevel,$driver_container_pane);
Tk::FIJIUtils::set_icon($select_driver_dialog);
$frame->Label(-text => "Select the driver for net \"" . $netpath . "\"", -justify => "left")->pack('-fill' => 'x', '-expand' => 0,'-side' => 'top');
$driver_container_pane->pack('-expand' => 1,
'-fill' => 'both',
'-anchor' => 'nw',
'-side' => 'top');
# Add a radio button for each possible object and save them
my $sel;
......@@ -1462,12 +1468,12 @@ sub _select_driver_dialog($) {
my $i = 0;
for my $conn (@{$possible_drivers}) { # FIXME: sort (and probably refactor this whole thing + FIJI::Netlist->_connection_tostr)
my $b = $f->Radiobutton(-value => $i, -variable => \$sel);
my $radio_button = $driver_container_pane->Radiobutton(-value => $i, -variable => \$sel);
my $conn_str = FIJI::Netlist->_connection_tostr($conn, \@conn_str_list);
if (defined($conn->userdata->{'fiji_driver_bit'})) {
$conn_str .= "[" . $conn->userdata('fiji_driver_bit') . "]";
}
my $l = $f->Label(-text => $conn_str, -justify => "left");
my $driver_label = $driver_container_pane->Label(-text => $conn_str, -justify => "left");
# preselect driver
if ( !defined $sel
......@@ -1476,15 +1482,18 @@ sub _select_driver_dialog($) {
{
$sel = $i;
}
$b->grid(-row => $i + 1, -column => 0);
$l->grid(-row => $i + 1, -column => 1, -sticky => "w");
$radio_button->grid(-row => $i + 1, -column => 0);
$driver_label->grid(-row => $i + 1, -column => 1, -sticky => "w");
$i++;
}
$f->pack;
$frame->pack('-expand' => 1,
'-fill' => 'both',
'-anchor' => 'nw',
'-side' => 'top');
my $diag_ret;
$diag_ret = $d->Show;
$diag_ret = $select_driver_dialog->Show;
if (!defined($diag_ret) || ($diag_ret eq "Cancel") || !defined $sel) {
# User aborted driver selection.
# If there was no previous selection we should probably warn him
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment