From 8223d83b88d32e0e541172fc247c86904004d931 Mon Sep 17 00:00:00 2001 From: freesource Date: Thu, 29 Nov 2001 19:16:41 +0000 Subject: [PATCH] This adds more improvements to New Template, allowing a template of the same name to be written over as a blank file, and puts a blank entry .. if the user attempts to write to the blank entry, the dialog will ask if they want to save the original template. --- BootRoot/YardBox.pm | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/BootRoot/YardBox.pm b/BootRoot/YardBox.pm index 097819f..233d5bc 100644 --- a/BootRoot/YardBox.pm +++ b/BootRoot/YardBox.pm @@ -1612,7 +1612,9 @@ sub save_as { my $new_template; my $entry = Gtk::Entry->new(); $entry->set_editable( $true ); - $entry->set_text($template) if $template; + if ( $whoami == 101 ) { + $entry->set_text($template) if $template; + } $entry->signal_connect( "changed", sub { $new_template = $entry->get_text(); }); @@ -1715,9 +1717,15 @@ sub save_as { } - $label->set_text("$new_template already exists, " . - "do\nyou want to write over it, " . - "or\nsave $template with a different name?"); + if ( $whoami == 101 ) { + $label->set_text("$new_template already exists, " . + "do\nyou want to write over it, " . + "or\nsave $template with a different name?"); + } + elsif ( $whoami == 103 ) { + $label->set_text("$new_template already exists, " . + "do\nyou want to write over it?"); + } $event_count++; my $event = pop(@_); @@ -1728,7 +1736,15 @@ sub save_as { open(NEW,">$new") or ($error = error("Can't create $new")); return if $error && $error eq "ERROR"; - print NEW $changed_text_from_template; + if ( $whoami == 101 ) { + print NEW $changed_text_from_template; + } + elsif ( $whoami == 103 ) { + my $text_length = $text->get_length(); + $text->set_point($text_length); + $text->backward_delete($text->get_length()); + print NEW ""; + } close(NEW); $template = $new_template;