# # # add_file "Annotate.pm" # content [fdf6c24098c9b17339084f46abe2ed9477c172af] # # patch "AdvancedFind.pm" # from [def35842dde7df7a16b069185cdb148945dd2efa] # to [dab06fa171f32513f342afe4928b4e0883408791] # # patch "ChangeLog.pm" # from [bbaeb9fe833b6c05b752ed17023c943946ed0837] # to [c1df85fb55c1046aaca0babef4b93a92b4a87cb3] # # patch "ComboAutoCompletion.pm" # from [a45bbf62e7f2efa0377247431714280e5cfd48cd] # to [4c2350e7944a3787d784c1bb67b4c3ff8218d03e] # # patch "Completion.pm" # from [0f7981a9869e1ba9ba02fbd7787c47ff049f4356] # to [8bbd4fcd439fc2a24b37882223d212e7cd05a994] # # patch "History.pm" # from [b73d263a8bef77075f30a740a1da06bf21207277] # to [41c40e6321bf77ae373492051e6386c353c23753] # # patch "Utilities.pm" # from [13b6314e75888c8e6431a0bdf11d12478c31a3b5] # to [ed70fcf9cb4926124ffacfaaf44c0496b7556ff8] # # patch "mtn-browse" # from [900690ff1257eaa6bddc465bbc66c96cd85ed282] # to [3430674b23ddf46f086b4001c0fa3c5ec495b605] # # patch "mtn-browse.glade" # from [f9bea6f7182a5d136274863c36fbe4101e582772] # to [79138c09ac145c8365a8a8de09c67f80b4b834e3] # ============================================================ --- Annotate.pm fdf6c24098c9b17339084f46abe2ed9477c172af +++ Annotate.pm fdf6c24098c9b17339084f46abe2ed9477c172af @@ -0,0 +1,349 @@ +############################################################################## +# +# File Name - Annotate.pm +# +# Description - The annotate module for the mtn-browse application. This +# module contains all the routines for implementing the +# annotation window. +# +# Author - A.E.Cooper. +# +# Legal Stuff - Copyright (c) 2007 Anthony Edward Cooper +# . +# +# This program is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public +# License as published by the Free Software Foundation; +# either version 3 of the License, or (at your option) any +# later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public +# License along with this software; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307 USA. +# +############################################################################## +# +############################################################################## +# +# Global Data For This Module +# +############################################################################## + + + +# ***** DIRECTIVES ***** + +require 5.008; + +use lib "/home/aecoope/perl"; +use strict; + +# ***** FUNCTIONAL PROTOTYPES FOR THIS FILE ***** + +# Public routines. + +sub display_annotation($$$); + +# Private routines. + +sub get_annotation_window(); +sub mtn_annotate($$$$); +# +############################################################################## +# +# Routine - display_annotation +# +# Description - Display the annotated listing for the specified file. +# +# Data - $mtn : The Monotone instance handle that is to be +# used to display the annotated file. +# $revision_id : The revision id in which the desired version +# of the file resides. +# $file_name : The name of the file that is to be +# annotated. +# +############################################################################## + + + +sub display_annotation($$$) +{ + + my($mtn, $revision_id, $file_name) = @_; + + my($i, + $instance, + $iter, + $len, + @lines, + $max_len, + $padding, + @prefix, + $prefix_tag, + $template, + $text_tag); + + $instance = get_annotation_window(); + local $instance->{in_cb} = 1; + + $instance->{window}->set_title("Annotated Listing Of " . $file_name); + $instance->{window}->show_all(); + + make_busy($instance, 1); + $instance->{appbar}->push(""); + gtk2_update(); + + # Get Monotone to do the annotation. + + $instance->{appbar}->set_status("Annotating file"); + gtk2_update(); + mtn_annotate(address@hidden, $mtn->get_db_name(), $revision_id, $file_name); + + # Find the longest line for future padding and also split each line into + # the prefix and text parts. + + $max_len = 0; + $template = sprintf("a%da2a*", length(($lines[0] =~ m/^([^:]+):.*$/o)[0])); + for ($i = 0; $i <= $#lines; ++ $i) + { + ($prefix[$i], $lines[$i]) = (unpack($template, $lines[$i]))[0,2]; + $lines[$i] =~ s/\s+$//o; + $lines[$i] = expand($lines[$i]); + $max_len = $len if (($len = length($lines[$i])) > $max_len); + } + + # Display the result, highlighting according to the annotate output. + + $instance->{appbar}->set_status + ("Formatting and displaying annotated file"); + gtk2_update(); + $padding = " " x $max_len; + $prefix_tag = $text_tag = ""; + for ($i = 0; $i <= $#lines; ++ $i) + { + + # Change the colours if there is a new prefix. + + if ($prefix[$i] !~ m/^\s+$/o) + { + if ($prefix_tag ne "annotate-prefix-1") + { + $prefix_tag = "annotate-prefix-1"; + $text_tag = "annotate-text-1"; + } + else + { + $prefix_tag = "annotate-prefix-2"; + $text_tag = "annotate-text-2"; + } + } + + # Print out the prefix. + + $instance->{annotation_buffer}->insert_with_tags_by_name + ($instance->{annotation_buffer}->get_end_iter(), + $prefix[$i] . " ", + $prefix_tag); + + # Print out the text. + + $instance->{annotation_buffer}->insert_with_tags_by_name + ($instance->{annotation_buffer}->get_end_iter(), + substr($lines[$i] . $padding, 0, $max_len) . "\n", + $text_tag); + + if (($i % 100) == 0) + { + $instance->{appbar}->set_progress_percentage + (($i + 1) / scalar(@lines)); + gtk2_update(); + } + + } + + # Delete the trailing newline. + + $iter = $instance->{annotation_buffer}->get_end_iter(); + $instance->{annotation_buffer}->delete + ($iter, $instance->{annotation_buffer}->get_end_iter()) + if ($iter->backward_char()); + + # Make sure we are at the top. + + $instance->{annotation_scrolledwindow}->get_vadjustment()->set_value(0); + $instance->{annotation_scrolledwindow}->get_hadjustment()->set_value(0); + $instance->{appbar}->set_progress_percentage(0); + $instance->{appbar}->set_status(""); + gtk2_update(); + + $instance->{appbar}->pop(); + make_busy($instance, 0); + +} +# +############################################################################## +# +# Routine - get_annotation_window +# +# Description - Creates or prepares an existing annotation window for use. +# +# Data - Return Value : A reference to the newly created or unused +# annotation instance record. +# +############################################################################## + + + +sub get_annotation_window() +{ + + my($font, + $height, + $instance, + $width); + + foreach my $window (@windows) + { + if ($window->{type} eq "annotation_window" + && ! $window->{window}->mapped()) + { + $instance = $window; + last; + } + } + + # Create a new annotation window if an unused one wasn't found, otherwise + # reuse an existing unused one. + + if (! defined($instance)) + { + $instance = {}; + $instance->{type} = "annotation_window"; + $instance->{glade} = + Gtk2::GladeXML->new("../mtn-browse.glade", "annotation_window"); + + # Flag to stop recursive calling of callbacks. + + $instance->{in_cb} = 0; + + # Connect Glade registered signal handlers. + + glade_signal_autoconnect($instance->{glade}, $instance); + + # Get the widgets that we are interested in. + + $instance->{window} = + $instance->{glade}->get_widget("annotation_window"); + $instance->{window}->set_icon($app_icon); + $instance->{appbar} = $instance->{glade}->get_widget("appbar"); + $instance->{annotation_textview} = + $instance->{glade}->get_widget("annotation_textview"); + $instance->{annotation_scrolledwindow} = + $instance->{glade}->get_widget("annotation_scrolledwindow"); + + # Setup the annotation window deletion handler. + + $instance->{window}->signal_connect + ("delete_event", + sub { + my($widget, $event, $instance) = @_; + return TRUE if ($instance->{in_cb}); + local $instance->{in_cb} = 1; + $widget->hide(); + $instance->{annotation_buffer}->set_text(""); + return TRUE; + }, + $instance); + + # Setup the revision annotation viewer. + + $instance->{annotation_buffer} = + $instance->{annotation_textview}->get_buffer(); + create_format_tags($instance->{annotation_buffer}); + $font = Gtk2::Pango::FontDescription->from_string("monospace 10"); + $instance->{annotation_textview}->modify_font($font) + if (defined($font)); + + $instance->{grab_widget} = $instance->{window}; + + # Setup the list of windows that can be made busy for this application + # window. + + $instance->{busy_windows} = []; + push(@{$instance->{busy_windows}}, $instance->{window}->window()); + push(@{$instance->{busy_windows}}, + $instance->{annotation_textview}->get_window("text")); + + push(@windows, $instance); + } + else + { + $instance->{in_cb} = 0; + ($width, $height) = $instance->{window}->get_default_size(); + $instance->{window}->resize($width, $height); + } + + # Empty out the contents. + + $instance->{annotation_buffer}->set_text(""); + + return $instance; + +} +# +############################################################################## +# +# Routine - mtn_annotate +# +# Description - Annotate the specified file on the specified revision. +# +# Data - $list : A reference to the list that is to contain +# the output from the annotate command. +# $mtn : The Monotone database that is to be used or +# undef if the database associated with the +# current workspace is to be used. +# $revision_id : The revision id on which the desired version +# of the file resides. +# $file_name : The name of file that is to be annotated. +# Return Value : True if the comparison worked, otherwise +# false if something went wrong. +# +############################################################################## + + + +sub mtn_annotate($$$$) +{ + + my($list, $mtn_db, $revision_id, $file_name) = @_; + + my($buffer, + @cmd); + + # Run mtn annotate. + + @$list = (); + push(@cmd, "mtn"); + push(@cmd, "--db=" . $mtn_db) if (defined($mtn_db)); + push(@cmd, "annotate"); + push(@cmd, "-r"); + push(@cmd, "i:" . $revision_id); + push(@cmd, $file_name); + run_command(\$buffer, @cmd) or return; + + # Break up the input into a list of lines. + + @$list = split(/\n/o, $buffer); + + return 1; + +} + +1; ============================================================ --- AdvancedFind.pm def35842dde7df7a16b069185cdb148945dd2efa +++ AdvancedFind.pm dab06fa171f32513f342afe4928b4e0883408791 @@ -32,7 +32,7 @@ # ############################################################################## # -# GLOBAL DATA FOR THIS MODULE +# Global Data For This Module # ############################################################################## @@ -259,15 +259,7 @@ sub create_advanced_find_window() # Connect Glade registered signal handlers. - $instance->{glade}->signal_autoconnect - (sub { - my($callback_name, $widget, $signal_name, $signal_data, - $connect_object, $after, $user_data) = @_; - my $func = $after ? "signal_connect_after" : "signal_connect"; - $widget->$func($signal_name, - $callback_name, - $connect_object ? $connect_object : $user_data); }, - $instance); + glade_signal_autoconnect($instance->{glade}, $instance); # Link in the update handler for the advanced find window. @@ -987,9 +979,9 @@ sub update_advanced_find_state($$) if ($advanced_find->{selected_revision_label}->get_text() ne $advanced_find->{revisions_treeview_details}->{value}) { - my ($branch, - @certs_list, - @revision_details); + my($branch, + @certs_list, + @revision_details); $advanced_find->{details_buffer}->set_text(""); $advanced_find->{mtn}->certs ============================================================ --- ChangeLog.pm bbaeb9fe833b6c05b752ed17023c943946ed0837 +++ ChangeLog.pm c1df85fb55c1046aaca0babef4b93a92b4a87cb3 @@ -32,7 +32,7 @@ # ############################################################################## # -# GLOBAL DATA FOR THIS MODULE +# Global Data For This Module # ############################################################################## @@ -49,14 +49,66 @@ use strict; # Public routines. +sub display_change_log($$;$$); + +# Private routines. + sub get_change_log_window(); # ############################################################################## # +# Routine - display_change_log +# +# Description - Display a revision's change log in a window. +# +# Data - $mtn : The Monotone instance handle that is to be +# used to display the change log. +# $revision_id : The revision id that is to have its change +# log displayed. +# $text_colour : Either the colour of the text or undef or "" +# if the colour should be black. +# $tag : Either a tag name for the specified revision +# that is to be used in the window title +# instead of the revision id or undef if the +# revision id should be used. +# +############################################################################## + + + +sub display_change_log($$;$$) +{ + + my($mtn, $revision_id, $text_colour, $tag) = @_; + + my(@certs_list, + $instance, + @revision_details); + + $instance = get_change_log_window(); + $instance->{changelog_buffer}->set_text(""); + $instance->{window}->set_title("Revision " . ($tag ? $tag : $revision_id)); + $mtn->certs(address@hidden, $revision_id); + $mtn->get_revision(address@hidden, $revision_id); + generate_revision_report($instance->{changelog_buffer}, + $revision_id, + address@hidden, + $text_colour ? $text_colour : "", + address@hidden); + if ($instance->{changelog_scrolledwindow}->realized()) + { + $instance->{changelog_scrolledwindow}->get_vadjustment()->set_value(0); + $instance->{changelog_scrolledwindow}->get_hadjustment()->set_value(0); + } + $instance->{window}->show_all(); + +} +# +############################################################################## +# # Routine - get_change_log_window # -# Description - Creates or prepares an existing a change log window for -# use. +# Description - Creates or prepares an existing change log window for use. # # Data - Return Value : A reference to the newly created or unused # change log instance record. @@ -68,10 +120,10 @@ sub get_change_log_window() sub get_change_log_window() { - my ($font, - $height, - $instance, - $width); + my($font, + $height, + $instance, + $width); foreach my $window (@windows) { @@ -99,16 +151,7 @@ sub get_change_log_window() # Connect Glade registered signal handlers. - $instance->{glade}->signal_autoconnect - (sub { - my($callback_name, $widget, $signal_name, $signal_data, - $connect_object, $after, $user_data) = @_; - my $func = $after ? "signal_connect_after" : "signal_connect"; - $widget->$func($signal_name, - $callback_name, - $connect_object ? - $connect_object : $user_data); }, - $instance); + glade_signal_autoconnect($instance->{glade}, $instance); # Get the widgets that we are interested in. ============================================================ --- ComboAutoCompletion.pm a45bbf62e7f2efa0377247431714280e5cfd48cd +++ ComboAutoCompletion.pm 4c2350e7944a3787d784c1bb67b4c3ff8218d03e @@ -33,7 +33,7 @@ # ############################################################################## # -# GLOBAL DATA FOR THIS MODULE +# Global Data For This Module # ############################################################################## @@ -76,10 +76,10 @@ sub combo_changed_cb($$) return if ($instance->{in_cb}); local $instance->{in_cb} = 1; - my ($change_state, - $combo_details, - $item, - $value); + my($change_state, + $combo_details, + $item, + $value); if ($widget == $instance->{branch_combo}) { @@ -153,17 +153,17 @@ sub combo_key_release_event_cb($$$) return FALSE if ($instance->{in_cb}); local $instance->{in_cb} = 1; - my ($change_state, - $combo, - $combo_details, - $completed, - $completion, - $item, - $len, - $name, - $old_completed, - $old_value, - $value); + my($change_state, + $combo, + $combo_details, + $completed, + $completion, + $item, + $len, + $name, + $old_completed, + $old_value, + $value); if ($widget == $instance->{branch_combo}->child()) { ============================================================ --- Completion.pm 0f7981a9869e1ba9ba02fbd7787c47ff049f4356 +++ Completion.pm 8bbd4fcd439fc2a24b37882223d212e7cd05a994 @@ -86,7 +86,7 @@ sub new($@) sub new($@) { - my ($class, $list) = @_; + my($class, $list) = @_; $class = ref($class) if ref($class); my($char, ============================================================ --- History.pm b73d263a8bef77075f30a740a1da06bf21207277 +++ History.pm 41c40e6321bf77ae373492051e6386c353c23753 @@ -32,7 +32,7 @@ # ############################################################################## # -# GLOBAL DATA FOR THIS MODULE +# Global Data For This Module # ############################################################################## @@ -55,8 +55,8 @@ use constant CLS_LINE_NR_COLUMN => 1; # Public routines. -sub display_file_change_history($); -sub display_revision_change_history($); +sub display_file_change_history($$$); +sub display_revision_change_history($$); # Private routines. @@ -78,35 +78,34 @@ sub mtn_diff($$$$;$); # Description - Display a revision's change history, complete with # selection and comparison buttons. # -# Data - $browser : The browser instance that is associated with -# this widget. +# Data - $mtn : The Monotone instance handle that is to be +# used to get the change history. +# $revision_id : The if of the revision that is to have its +# change log displayed. # ############################################################################## -sub display_revision_change_history($) +sub display_revision_change_history($$) { - my $browser = $_[0]; + my($mtn, $revision_id) = @_; - my ($button, - @certs_list, - $counter, - $file_name, - %history_hash, - $instance, - @revision_ids); + my($button, + @certs_list, + $counter, + %history_hash, + $instance); $instance = get_history_window(); local $instance->{in_cb} = 1; - $instance->{mtn} = $browser->{mtn}; + $instance->{mtn} = $mtn; $instance->{file_name} = undef; - get_revision_ids($browser, address@hidden); $instance->{first_revision_id} = ""; $instance->{second_revision_id} = ""; - $instance->{window}->set_title("Revision History For " . $revision_ids[0]); + $instance->{window}->set_title("Revision History For " . $revision_id); $instance->{history_label}->set_markup("Revision History"); $instance->{window}->show_all(); @@ -122,8 +121,8 @@ sub display_revision_change_history($) $instance->{appbar}->set_progress_percentage(0); $instance->{appbar}->set_status("Fetching revision list"); gtk2_update(); - $history_hash{$revision_ids[0]} = 1; - get_revision_history_helper($instance, \%history_hash, $revision_ids[0]); + $history_hash{$revision_id} = 1; + get_revision_history_helper($instance, \%history_hash, $revision_id); # Sort the list. @@ -258,32 +257,33 @@ sub display_revision_change_history($) # Description - Display a file's change history, complete with selection # and comparison buttons. # -# Data - $browser : The browser instance that is associated with -# this widget. +# Data - $mtn : The Monotone instance handle that is to be +# used to get the change history. +# $revision_id : The revision id in which the desired version +# of the file resides. +# $file_name : The name of the file that is to have its +# change log displayed. # ############################################################################## -sub display_file_change_history($) +sub display_file_change_history($$$) { - my $browser = $_[0]; + my($mtn, $revision_id, $file_name) = @_; - my ($button, - @certs_list, - $counter, - $file_name, - %history_hash, - $instance, - @revision_ids); + my($button, + @certs_list, + $counter, + %history_hash, + $instance); $instance = get_history_window(); local $instance->{in_cb} = 1; - $instance->{mtn} = $browser->{mtn}; - $instance->{file_name} = - $browser->{file_being_viewed}->{manifest_entry}->{name}; + $instance->{mtn} = $mtn; + $instance->{file_name} = $file_name; $instance->{first_revision_id} = ""; $instance->{second_revision_id} = ""; $instance->{window}->set_title @@ -304,8 +304,7 @@ sub display_file_change_history($) $instance->{stop_button}->set_sensitive(TRUE); gtk2_update(); Monotone::AutomateStdio->register_error_handler("warning"); - get_revision_ids($browser, address@hidden); - get_file_history_helper($instance, \%history_hash, $revision_ids[0]); + get_file_history_helper($instance, \%history_hash, $revision_id); Monotone::AutomateStdio->register_error_handler("both", \&mtn_error_handler); $instance->{stop_button}->set_sensitive(FALSE); @@ -444,8 +443,7 @@ sub history_list_button_clicked_cb($$) my($widget, $details) = @_; - my($cl_instance, - $instance, + my($instance, $revision_id); $instance = $details->{instance}; @@ -491,29 +489,9 @@ sub history_list_button_clicked_cb($$) else { - my(@certs_list, - @revision_details); - # Display the full revision change log. - $cl_instance = get_change_log_window(); - $cl_instance->{changelog_buffer}->set_text(""); - $cl_instance->{window}->set_title("Revision " . $revision_id); - $instance->{mtn}->certs(address@hidden, $revision_id); - $instance->{mtn}->get_revision(address@hidden, $revision_id); - generate_revision_report($cl_instance->{changelog_buffer}, - $revision_id, - address@hidden, - "", - address@hidden); - if ($cl_instance->{changelog_scrolledwindow}->realized()) - { - $cl_instance->{changelog_scrolledwindow}->get_vadjustment()-> - set_value(0); - $cl_instance->{changelog_scrolledwindow}->get_hadjustment()-> - set_value(0); - } - $cl_instance->{window}->show_all(); + display_change_log($instance->{mtn}, $revision_id); } @@ -621,10 +599,7 @@ sub coloured_revision_change_log_button_ return if ($instance->{in_cb}); local $instance->{in_cb} = 1; - my(@certs_list, - $cl_instance, - $colour, - @revision_details, + my($colour, $revision_id); # Work out what revision id to use. @@ -642,24 +617,7 @@ sub coloured_revision_change_log_button_ # Display the full revision change log. - $cl_instance = get_change_log_window(); - $cl_instance->{changelog_buffer}->set_text(""); - $cl_instance->{window}->set_title("Revision " . $revision_id); - $instance->{mtn}->certs(address@hidden, $revision_id); - $instance->{mtn}->get_revision(address@hidden, $revision_id); - generate_revision_report($cl_instance->{changelog_buffer}, - $revision_id, - address@hidden, - $colour, - address@hidden); - if ($cl_instance->{changelog_scrolledwindow}->realized()) - { - $cl_instance->{changelog_scrolledwindow}->get_vadjustment()-> - set_value(0); - $cl_instance->{changelog_scrolledwindow}->get_hadjustment()-> - set_value(0); - } - $cl_instance->{window}->show_all(); + display_change_log($instance->{mtn}, $revision_id, $colour); } # @@ -679,10 +637,10 @@ sub get_history_window() sub get_history_window() { - my ($font, - $height, - $instance, - $width); + my($font, + $height, + $instance, + $width); # Look for an unused window first. @@ -712,16 +670,7 @@ sub get_history_window() # Connect Glade registered signal handlers. - $instance->{glade}->signal_autoconnect - (sub { - my($callback_name, $widget, $signal_name, $signal_data, - $connect_object, $after, $user_data) = @_; - my $func = $after ? "signal_connect_after" : "signal_connect"; - $widget->$func($signal_name, - $callback_name, - $connect_object ? - $connect_object : $user_data); }, - $instance); + glade_signal_autoconnect($instance->{glade}, $instance); # Get the widgets that we are interested in. @@ -911,11 +860,11 @@ sub get_revision_comparison_window() sub get_revision_comparison_window() { - my ($font, - $height, - $instance, - $renderer, - $width); + my($font, + $height, + $instance, + $renderer, + $width); # Look for an unused window first. @@ -1068,19 +1017,19 @@ sub compare_revisions($$$;$) my($mtn, $revision_id_1, $revision_id_2, $file_name) = @_; - my ($char, - @files, - $i, - $instance, - $is_binary, - $iter, - $len, - $line, - @lines, - $max_len, - $name, - $padding, - $rest); + my($char, + @files, + $i, + $instance, + $is_binary, + $iter, + $len, + $line, + @lines, + $max_len, + $name, + $padding, + $rest); $instance = get_revision_comparison_window(); local $instance->{in_cb} = 1; @@ -1099,7 +1048,6 @@ sub compare_revisions($$$;$) set_markup("Revision Comparison"); } $instance->{window}->show_all(); - gtk2_update(); make_busy($instance, 1); $instance->{appbar}->push(""); ============================================================ --- Utilities.pm 13b6314e75888c8e6431a0bdf11d12478c31a3b5 +++ Utilities.pm ed70fcf9cb4926124ffacfaaf44c0496b7556ff8 @@ -32,7 +32,7 @@ # ############################################################################## # -# GLOBAL DATA FOR THIS MODULE +# Global Data For This Module # ############################################################################## @@ -52,6 +52,7 @@ sub get_revision_ids($$); sub generate_revision_report($$$$;$); sub get_dir_contents($$$); sub get_revision_ids($$); +sub glade_signal_autoconnect($$); sub gtk2_update(); sub make_busy($$); sub run_command($@); @@ -500,6 +501,40 @@ sub get_revision_ids($$) # ############################################################################## # +# Routine - glade_signal_autoconnect +# +# Description - This routine uses the Glade library to connect up all the +# registered signal handlers to their related widgets. +# +# Data - $glade : The Glade object describing the widgets that +# are to have their signal handlers +# registered. +# $client_data : The client data that is to be passed into +# each callback routine when it is called. +# +############################################################################## + + + +sub glade_signal_autoconnect($$) +{ + + my($glade, $client_data) = @_; + + $glade->signal_autoconnect + (sub { + my($callback_name, $widget, $signal_name, $signal_data, + $connect_object, $after, $user_data) = @_; + my $func = $after ? "signal_connect_after" : "signal_connect"; + $widget->$func($signal_name, + $callback_name, + $connect_object ? $connect_object : $user_data); }, + $client_data); + +} +# +############################################################################## +# # Routine - make_busy # # Description - This routine simply makes the main window busy or active. @@ -608,8 +643,10 @@ sub create_format_tags($) sub create_format_tags($) { - my ($text_buffer) = @_; + my($text_buffer) = @_; + # Normal Black text, assorted styles, on a white background. + $text_buffer->create_tag("normal", "weight" => PANGO_WEIGHT_NORMAL); $text_buffer->create_tag("bold", "weight" => PANGO_WEIGHT_BOLD); @@ -618,6 +655,8 @@ sub create_format_tags($) "weight" => PANGO_WEIGHT_BOLD, "style" => "italic"); + # Green text, assorted styles, on a white background. + $text_buffer->create_tag("green", "foreground" => "DarkGreen"); $text_buffer->create_tag("bold-green", "weight" => PANGO_WEIGHT_BOLD, @@ -630,6 +669,8 @@ sub create_format_tags($) "style" => "italic", "foreground" => "DarkGreen"); + # Red text, assorted styles, on a white background. + $text_buffer->create_tag("red", "foreground" => "DarkRed"); $text_buffer->create_tag("bold-red", "weight" => PANGO_WEIGHT_BOLD, @@ -642,10 +683,14 @@ sub create_format_tags($) "style" => "italic", "foreground" => "DarkRed"); + # Yellow text on a grey background. + $text_buffer->create_tag("compare-info", "foreground" => "Yellow", "background" => "LightSlateGrey"); + # Red text, assorted styles, on pink and grey backgrounds. + $text_buffer->create_tag("compare-first-file", "foreground" => "DarkRed", "background" => "MistyRose1"); @@ -654,6 +699,8 @@ sub create_format_tags($) "foreground" => "IndianRed1", "background" => "DarkSlateGrey"); + # Green text, assorted styles, on light green and grey backgrounds. + $text_buffer->create_tag("compare-second-file", "foreground" => "DarkGreen", "background" => "DarkSeaGreen1"); @@ -662,6 +709,25 @@ sub create_format_tags($) "foreground" => "SpringGreen1", "background" => "DarkSlateGrey"); + # Blue text, assorted shades, on assorted blue backgrounds. + + $text_buffer->create_tag("annotate-prefix-1", + "foreground" => "AliceBlue", + "background" => "CadetBlue"); + $text_buffer->create_tag("annotate-text-1", + "foreground" => "MidnightBlue", + "background" => "PaleTurquoise"); + + # Blue text, assorted shades, on assorted blue backgrounds (slightly darker + # than the previous group). + + $text_buffer->create_tag("annotate-prefix-2", + "foreground" => "AliceBlue", + "background" => "SteelBlue"); + $text_buffer->create_tag("annotate-text-2", + "foreground" => "MidnightBlue", + "background" => "SkyBlue"); + } # ############################################################################## ============================================================ --- mtn-browse 900690ff1257eaa6bddc465bbc66c96cd85ed282 +++ mtn-browse 3430674b23ddf46f086b4001c0fa3c5ec495b605 @@ -33,7 +33,7 @@ # ############################################################################## # -# GLOBAL DATA FOR THIS MODULE +# Global Data For This Module # ############################################################################## @@ -75,6 +75,7 @@ use AdvancedFind; use Globals qw(:constants :variables); use AdvancedFind; +use Annotate; use ChangeLog; use ComboAutoCompletion; use Completion; @@ -96,6 +97,7 @@ sub advanced_find_button_clicked_cb($$); # Private routines. sub advanced_find_button_clicked_cb($$); +sub annotate_button_clicked_cb($$); sub delete_event_cb($$$); sub destroy_event_cb($$;$); sub directory_up_button_clicked_cb($$); @@ -277,8 +279,11 @@ sub revision_change_history_button_click return if ($browser->{in_cb}); local $browser->{in_cb} = 1; - display_revision_change_history($browser); + my @revision_ids; + get_revision_ids($browser, address@hidden); + display_revision_change_history($browser->{mtn}, $revision_ids[0]); + } # ############################################################################## @@ -304,36 +309,16 @@ sub revision_change_log_button_clicked_c return if ($browser->{in_cb}); local $browser->{in_cb} = 1; - my (@certs_list, - $instance, - @revision_details, - @revision_ids); + my @revision_ids; - $instance = get_change_log_window(); + # Get the currently selected revision id and then display its change log. - # Get the currently selected revision id. - get_revision_ids($browser, address@hidden); + display_change_log($browser->{mtn}, + $revision_ids[0], + "", + $browser->{revision_combo_details}->{value}); - # Put the details into the text view and display it. - - $instance->{changelog_buffer}->set_text(""); - $instance->{window}->set_title - ("Revision " . $browser->{revision_combo_details}->{value}); - $browser->{mtn}->certs(address@hidden, $revision_ids[0]); - $browser->{mtn}->get_revision(address@hidden, $revision_ids[0]); - generate_revision_report($instance->{changelog_buffer}, - $revision_ids[0], - address@hidden, - "", - address@hidden); - if ($instance->{changelog_scrolledwindow}->realized()) - { - $instance->{changelog_scrolledwindow}->get_vadjustment()->set_value(0); - $instance->{changelog_scrolledwindow}->get_hadjustment()->set_value(0); - } - $instance->{window}->show_all(); - } # ############################################################################## @@ -405,6 +390,39 @@ sub directory_up_button_clicked_cb($$) # ############################################################################## # +# Routine - annotate_button_clicked_cb +# +# Description - Callback routine called when the user clicks on the +# annotate button in a main browser window. +# +# Data - $widget : The widget object that received the signal. +# $browser : The browser instance that is associated with +# this widget. +# +############################################################################## + + + +sub annotate_button_clicked_cb($$) +{ + + my($widget, $browser) = @_; + + return if ($browser->{in_cb}); + local $browser->{in_cb} = 1; + + my @revision_ids; + + get_revision_ids($browser, address@hidden); + display_annotation($browser->{mtn}, + $revision_ids[0], + $browser->{file_being_viewed}->{manifest_entry}-> + {name}); + +} +# +############################################################################## +# # Routine - file_change_history_button_clicked_cb # # Description - Callback routine called when the user clicks on the file @@ -426,8 +444,14 @@ sub file_change_history_button_clicked_c return if ($browser->{in_cb}); local $browser->{in_cb} = 1; - display_file_change_history($browser); + my @revision_ids; + get_revision_ids($browser, address@hidden); + display_file_change_history($browser->{mtn}, + $revision_ids[0], + $browser->{file_being_viewed}-> + {manifest_entry}->{name}); + } # ############################################################################## @@ -640,15 +664,7 @@ sub new_browser_instance() # Connect Glade registered signal handlers. - $browser->{glade}->signal_autoconnect - (sub { - my($callback_name, $widget, $signal_name, $signal_data, - $connect_object, $after, $user_data) = @_; - my $func = $after ? "signal_connect_after" : "signal_connect"; - $widget->$func($signal_name, - $callback_name, - $connect_object ? $connect_object : $user_data); }, - $browser); + glade_signal_autoconnect($browser->{glade}, $browser); # Link in the update handler for the browser. ============================================================ --- mtn-browse.glade f9bea6f7182a5d136274863c36fbe4101e582772 +++ mtn-browse.glade 79138c09ac145c8365a8a8de09c67f80b4b834e3 @@ -1401,6 +1401,7 @@ into a viewer True GTK_RELIEF_NORMAL True + @@ -4098,4 +4099,122 @@ that had the green highlighted text + + True + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 750 + 550 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + + + + True + False + 0 + + + + 5 + True + 0 + 0.5 + GTK_SHADOW_ETCHED_IN + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 0 + + + + 5 + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + False + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + + + True + <b>Annotation</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + label_item + + + + + 0 + True + True + + + + + + True + True + True + + + 0 + False + True + + + + + +