| 1 | # $Id: Context.pm 2365 2009-02-22 10:18:53Z joern $ | ||
| 2 | |||
| 3 | #----------------------------------------------------------------------- | ||
| 4 | # Copyright (C) 2001-2006 Jörn Reder <joern AT zyn.de>. | ||
| 5 | # All Rights Reserved. See file COPYRIGHT for details. | ||
| 6 | # | ||
| 7 | # This module is part of Video::DVDRip, which is free software; you can | ||
| 8 | # redistribute it and/or modify it under the same terms as Perl itself. | ||
| 9 | #----------------------------------------------------------------------- | ||
| 10 | |||
| 11 | package Video::DVDRip::GUI::Context; | ||
| 12 | |||
| 13 | use base Video::DVDRip::GUI::Base; | ||
| 14 | |||
| 15 | use Locale::TextDomain qw (video.dvdrip); | ||
| 16 | use File::Basename; | ||
| 17 | use Text::Wrap; | ||
| 18 | |||
| 19 | use strict; | ||
| 20 | use Carp; | ||
| 21 | |||
| 22 | my @BITRATE_PARAMS = ( | ||
| 23 | "title.tc_container", "title.tc_video_codec", | ||
| 24 | "title.tc_video_bitrate_mode", "title.tc_disc_cnt", | ||
| 25 | "title.tc_disc_size", "title.tc_target_size", | ||
| 26 | "title.tc_video_bitrate_range", "title.tc_video_bpp_manual", | ||
| 27 | "title.tc_video_bitrate_manual", "title.tc_clip1_top", | ||
| 28 | "title.tc_clip1_bottom", "title.tc_clip1_left", | ||
| 29 | "title.tc_clip1_right", "title.tc_zoom_width", | ||
| 30 | "title.tc_zoom_height", "title.tc_clip2_top", | ||
| 31 | "title.tc_clip2_bottom", "title.tc_clip2_left", | ||
| 32 | "title.tc_clip2_right", "title.tc_start_frame", | ||
| 33 | "title.tc_end_frame", "audio_track.tc_audio_codec", | ||
| 34 | "audio_track.tc_mp3_bitrate", "audio_track.tc_mp2_bitrate", | ||
| 35 | "audio_track.tc_ac3_bitrate", "audio_track.tc_pcm_bitrate", | ||
| 36 | "audio_track.tc_vorbis_bitrate", "audio_track.tc_vorbis_quality", | ||
| 37 | "audio_track.tc_vorbis_quality_enable", "multi_audio.matrix", | ||
| 38 | "audio_track.bitrate", | ||
| 39 | ); | ||
| 40 | |||
| 41 | my $NO_SUB_ACTIVE = __ "No subtitles activated."; | ||
| 42 | |||
| 43 | sub create { | ||
| 44 | my $class = shift; | ||
| 45 | |||
| 46 | my $config = $class->config_object; | ||
| 47 | my $depend = $class->depend_object; | ||
| 48 | |||
| 49 | #-- Create the Context | ||
| 50 | my $context = Gtk2::Ex::FormFactory::Context->new( | ||
| 51 | default_get_prefix => "", | ||
| 52 | default_set_prefix => "set_", | ||
| 53 | ); | ||
| 54 | |||
| 55 | #-- Add preferences Config object to Context | ||
| 56 | $context->add_object( | ||
| 57 | name => "config", | ||
| 58 | object => undef, | ||
| 59 | accessor => sub { | ||
| 60 | my ( $config, $attr, $value ) = @_; | ||
| 61 | if ( @_ == 2 ) { | ||
| 62 | |||
| 63 | # getter | ||
| 64 | return $config->get_value($attr); | ||
| 65 | } | ||
| 66 | else { | ||
| 67 | |||
| 68 | # setter | ||
| 69 | return $config->set_value( $attr, $value ); | ||
| 70 | } | ||
| 71 | }, | ||
| 72 | attr_activity_href => { | ||
| 73 | nptl_ld_assume_kernel => sub { | ||
| 74 | $_[0]->get_value("workaround_nptl_bugs"); | ||
| 75 | }, | ||
| 76 | }, | ||
| 77 | attr_depends_href => | ||
| 78 | { nptl_ld_assume_kernel => "config.workaround_nptl_bugs", } | ||
| 79 | ); | ||
| 80 | |||
| 81 | #-- Add depend object to Context | ||
| 82 | $context->add_object( | ||
| 83 | name => "depend", | ||
| 84 | object => $depend, | ||
| 85 | attr_accessors_href => { | ||
| 86 | tools => sub { | ||
| 87 | my $self = shift; | ||
| 88 | my @data; | ||
| 89 | my $tools = $self->tools; | ||
| 90 | foreach my $tool ( | ||
| 91 | sort { $tools->{$a}->{order} <=> $tools->{$b}->{order} } | ||
| 92 | keys %{$tools} | ||
| 93 | ) { | ||
| 94 | my $def = $tools->{$tool}; | ||
| 95 | push @data, | ||
| 96 | [ | ||
| 97 | $tool, | ||
| 98 | $def->{comment}, | ||
| 99 | ( $def->{optional} ? __ "No" : __ "Yes" ), | ||
| 100 | $def->{suggested}, | ||
| 101 | $def->{min}, | ||
| 102 | ( $def->{max} || "-" ), | ||
| 103 | $def->{installed}, | ||
| 104 | ( $def->{installed_ok} ? __ "Yes" : __ "No" ), | ||
| 105 | $def->{installed_ok} | ||
| 106 | ]; | ||
| 107 | } | ||
| 108 | return \@data; | ||
| 109 | }, | ||
| 110 | }, | ||
| 111 | ); | ||
| 112 | |||
| 113 | #-- Add JobPlanner Objects to the Contect | ||
| 114 | $context->add_object( | ||
| 115 | name => "job_planner", | ||
| 116 | object => undef, | ||
| 117 | ); | ||
| 118 | $context->add_object( | ||
| 119 | name => "exec_flow_gui", | ||
| 120 | object => undef, | ||
| 121 | ); | ||
| 122 | |||
| 123 | #-- Add main GUI object to the Context | ||
| 124 | $context->add_object( | ||
| 125 | name => "main", | ||
| 126 | object => "undef", | ||
| 127 | attr_depends_href => { window_name => "project.name", }, | ||
| 128 | ); | ||
| 129 | |||
| 130 | #-- Add TOC GUI object to the Context | ||
| 131 | $context->add_object( | ||
| 132 | name => "toc_gui", | ||
| 133 | object => undef, | ||
| 134 | ); | ||
| 135 | |||
| 136 | #-- Add progress GUI object to the Context | ||
| 137 | $context->add_object( | ||
| 138 | name => "progress", | ||
| 139 | object => undef, | ||
| 140 | ); | ||
| 141 | |||
| 142 | #-- Add Clip & Zoom GUI object to the Context | ||
| 143 | $context->add_object( | ||
| 144 | name => "clip_zoom", | ||
| 145 | object => undef, | ||
| 146 | ); | ||
| 147 | |||
| 148 | #-- Add Logging GUI object to the Context | ||
| 149 | $context->add_object( | ||
| 150 | name => "logging", | ||
| 151 | object => undef, | ||
| 152 | ); | ||
| 153 | |||
| 154 | #-- Add Transcode GUI object to the Context | ||
| 155 | $context->add_object( | ||
| 156 | name => "transcode", | ||
| 157 | object => undef, | ||
| 158 | ); | ||
| 159 | |||
| 160 | #-- Add Subtitle GUI object to the Context | ||
| 161 | $context->add_object( | ||
| 162 | name => "subtitle_gui", | ||
| 163 | object => undef, | ||
| 164 | ); | ||
| 165 | |||
| 166 | #-- Add Zoom Calculator GUI object to the Context | ||
| 167 | $context->add_object( | ||
| 168 | name => "zoom_calc", | ||
| 169 | object => undef, | ||
| 170 | attr_depends_href => { | ||
| 171 | result_list => [ | ||
| 172 | "zoom_calc.fast_resize_align", | ||
| 173 | "zoom_calc.result_frame_align", | ||
| 174 | "zoom_calc.achieve_result_align", | ||
| 175 | "zoom_calc.auto_clip", | ||
| 176 | @BITRATE_PARAMS, | ||
| 177 | ], | ||
| 178 | }, | ||
| 179 | ); | ||
| 180 | |||
| 181 | #-- Once the project directory is created, the project | ||
| 182 | #-- name and directories must kept unchanged. | ||
| 183 | my $project_dirs_unlocked = sub { | ||
| 184 | $_[0]->name eq 'unnamed' | ||
| 185 | || !-d $_[0]->snap_dir; | ||
| 186 | }; | ||
| 187 | |||
| 188 | #-- Add !project object to Context (set to 1 if no project | ||
| 189 | #-- is open, splash screen is associated with it) | ||
| 190 | $context->add_object( | ||
| 191 | name => "!project", | ||
| 192 | object => 1, | ||
| 193 | ); | ||
| 194 | |||
| 195 | #-- Add project object to Context | ||
| 196 | $context->add_object( | ||
| 197 | name => "project", | ||
| 198 | object => undef, | ||
| 199 | |||
| 200 | changes_attr_filter => qr[^last_selected_nb_page$], | ||
| 201 | |||
| 202 | attr_depends_href => { | ||
| 203 | vob_dir => "project.name", | ||
| 204 | avi_dir => "project.name", | ||
| 205 | snap_dir => "project.name", | ||
| 206 | }, | ||
| 207 | attr_activity_href => { | ||
| 208 | name => $project_dirs_unlocked, | ||
| 209 | vob_dir => $project_dirs_unlocked, | ||
| 210 | avi_dir => $project_dirs_unlocked, | ||
| 211 | snap_dir => $project_dirs_unlocked, | ||
| 212 | }, | ||
| 213 | ); | ||
| 214 | |||
| 215 | #-- Add content to Context | ||
| 216 | $context->add_object( | ||
| 217 | name => "content", | ||
| 218 | aggregated_by => "project.content", | ||
| 219 | |||
| 220 | #-- We override some attribute accessors here, which need | ||
| 221 | #-- some transformation before being displayed. | ||
| 222 | attr_accessors_href => { | ||
| 223 | |||
| 224 | #-- This builds the table of contents on the Title page | ||
| 225 | titles => sub { | ||
| 226 | my $self = shift; | ||
| 227 | my ( @slist_data, $t ); | ||
| 228 | return [] unless $self->titles; | ||
| 229 | foreach my $nr ( sort { $a <=> $b } keys %{ $self->titles } ) | ||
| 230 | { | ||
| 231 | $t = $self->titles->{$nr}; | ||
| 232 | push @slist_data, | ||
| 233 | [ | ||
| 234 | $nr - 1, | ||
| 235 | $nr, | ||
| 236 | $class->format_time( time => $t->runtime ), | ||
| 237 | uc( $t->video_mode ), | ||
| 238 | $t->chapters, | ||
| 239 | scalar( @{ $t->audio_tracks } ), | ||
| 240 | $t->frame_rate, | ||
| 241 | $t->aspect_ratio, | ||
| 242 | $t->frames, | ||
| 243 | $t->width . "x" . $t->height | ||
| 244 | ]; | ||
| 245 | } | ||
| 246 | return \@slist_data; | ||
| 247 | }, | ||
| 248 | selected_title_nr_list => sub { | ||
| 249 | my $self = shift; | ||
| 250 | return [] unless $self->titles; | ||
| 251 | my @titles; | ||
| 252 | foreach my $nr ( sort { $a <=> $b } keys %{ $self->titles } ) | ||
| 253 | { | ||
| 254 | push @titles, | ||
| 255 | [ $nr, __x( "DVD title #{nr}", nr => $nr ) ]; | ||
| 256 | } | ||
| 257 | return \@titles; | ||
| 258 | }, | ||
| 259 | }, | ||
| 260 | attr_depends_href => { | ||
| 261 | selected_title => | ||
| 262 | [ "content.selected_titles", "content.selected_title_nr" ], | ||
| 263 | selected_title_nr => "content.selected_titles", | ||
| 264 | titles => "content.selected_title_nr", | ||
| 265 | }, | ||
| 266 | ); | ||
| 267 | |||
| 268 | #-- Add selected title to Context | ||
| 269 | $context->add_object( | ||
| 270 | name => "title", | ||
| 271 | aggregated_by => "content.selected_title", | ||
| 272 | |||
| 273 | #-- We override some attribute accessors here, which need | ||
| 274 | #-- some transformation before being displayed. | ||
| 275 | attr_accessors_href => { | ||
| 276 | |||
| 277 | #-- Audio channel list - for the audio selection popups | ||
| 278 | #-- If not used for the widget on the Title/Ripping page, | ||
| 279 | #-- the selected target track is added to each entry. | ||
| 280 | audio_channel_list => sub { | ||
| 281 | my $self = shift; | ||
| 282 | my ($widget) = @_; | ||
| 283 | |||
| 284 | my $audio_tracks = $self->audio_tracks; | ||
| 285 | my $with_target_track = $widget !~ /^audio_selection/; | ||
| 286 | |||
| 287 | my @audio_list; | ||
| 288 | my $i = 0; | ||
| 289 | foreach my $audio ( @{$audio_tracks} ) { | ||
| 290 | push @audio_list, ($i+1).": " | ||
| 291 | . $audio->info( with_target => $with_target_track ); | ||
| 292 | ++$i; | ||
| 293 | } | ||
| 294 | |||
| 295 | return \@audio_list; | ||
| 296 | }, | ||
| 297 | |||
| 298 | #-- List of available viewing angles. | ||
| 299 | tc_viewing_angle_list => sub { | ||
| 300 | my $self = shift; | ||
| 301 | my @viewing_angle_list; | ||
| 302 | foreach my $angle ( 1 .. $self->viewing_angles ) { | ||
| 303 | push @viewing_angle_list, | ||
| 304 | [$angle, __x( "Angle {angle}", angle => $angle )]; | ||
| 305 | } | ||
| 306 | return \@viewing_angle_list; | ||
| 307 | }, | ||
| 308 | |||
| 309 | #-- List of available chapters for chapter selection. | ||
| 310 | chapter_list => sub { | ||
| 311 | my $self = shift; | ||
| 312 | my @chapters_list; | ||
| 313 | for ( my $i = 1; $i <= $self->chapters; ++$i ) { | ||
| 314 | my $len = $self->format_time( | ||
| 315 | time => int( | ||
| 316 | $self->chapter_frames->{$i} / $self->frame_rate | ||
| 317 | ) | ||
| 318 | ); | ||
| 319 | push @chapters_list, | ||
| 320 | [ | ||
| 321 | $i, | ||
| 322 | __x("#{chapter} [{len}]", | ||
| 323 | chapter => $i, | ||
| 324 | len => $len | ||
| 325 | ) | ||
| 326 | ]; | ||
| 327 | } | ||
| 328 | return \@chapters_list; | ||
| 329 | }, | ||
| 330 | |||
| 331 | #-- List of subtitle languages | ||
| 332 | subtitle_languages => sub { | ||
| 333 | my $self = shift; | ||
| 334 | my $title_sub_langs = $self->get_subtitle_languages; | ||
| 335 | my @lang = sort keys %{$title_sub_langs}; | ||
| 336 | my @lang_list; | ||
| 337 | push @lang_list, [$_] for grep !/\?\?/, @lang; | ||
| 338 | return \@lang_list; | ||
| 339 | }, | ||
| 340 | |||
| 341 | #-- List of available subtitles for subtitle selection | ||
| 342 | selected_subtitle_id_list => sub { | ||
| 343 | my $self = shift; | ||
| 344 | my %subtitles; | ||
| 345 | foreach my $subtitle ( values %{ $self->subtitles } ) { | ||
| 346 | $subtitles{ $subtitle->id } = $subtitle->info; | ||
| 347 | } | ||
| 348 | foreach my $id ( 0 .. 31 ) { | ||
| 349 | next if $subtitles{$id}; | ||
| 350 | $subtitles{$id} = __x( | ||
| 351 | "{id} - ?? - probably unused", | ||
| 352 | id => sprintf( "%02d", $id ) | ||
| 353 | ); | ||
| 354 | } | ||
| 355 | return \%subtitles; | ||
| 356 | }, | ||
| 357 | |||
| 358 | #-- Create Subtitle object on the fly if not yet there | ||
| 359 | set_selected_subtitle_id => sub { | ||
| 360 | my $self = shift; | ||
| 361 | my ($id) = @_; | ||
| 362 | |||
| 363 | if ( !$self->subtitles->{$id} ) { | ||
| 364 | $self->subtitles->{$id} = Video::DVDRip::Subtitle->new( | ||
| 365 | id => $id, | ||
| 366 | lang => "??", | ||
| 367 | title => $self, | ||
| 368 | ); | ||
| 369 | } | ||
| 370 | |||
| 371 | $self->set_selected_subtitle_id($id); | ||
| 372 | return $id; | ||
| 373 | }, | ||
| 374 | |||
| 375 | #-- List of available Clip & Zoom Presets | ||
| 376 | preset_list => sub { | ||
| 377 | my $presets = $config->presets; | ||
| 378 | my @presets; | ||
| 379 | push @presets, $_->{title} for @{$presets}; | ||
| 380 | return \@presets; | ||
| 381 | }, | ||
| 382 | |||
| 383 | #-- Get current selected preset | ||
| 384 | preset => sub { | ||
| 385 | my ($title) = @_; | ||
| 386 | my $preset = $title->preset; | ||
| 387 | my $i; | ||
| 388 | for ( $i = 0; $i < @{ $config->presets }; ++$i ) { | ||
| 389 | last if $config->presets->[$i]->{name} eq $preset; | ||
| 390 | } | ||
| 391 | return $i; | ||
| 392 | }, | ||
| 393 | |||
| 394 | #-- Set selected preset | ||
| 395 | set_preset => sub { | ||
| 396 | my ( $title, $idx ) = @_; | ||
| 397 | $title->set_preset( $config->presets->[$idx]->{name} ); | ||
| 398 | }, | ||
| 399 | |||
| 400 | #-- List of available containers | ||
| 401 | tc_container_list => | ||
| 402 | [ [ "avi", "AVI", ], [ "ogg", "OGG", ], [ "vcd", "MPEG", ], ], | ||
| 403 | |||
| 404 | #-- Video Codec presets | ||
| 405 | tc_video_codec_presets => sub { | ||
| 406 | my ($title) = @_; | ||
| 407 | return [ "SVCD", "VCD", "XSVCD", "XVCD", "CVD" ] | ||
| 408 | if $title->tc_container eq 'vcd'; | ||
| 409 | return [ | ||
| 410 | "divx4", "divx5", "xvid", "xvid2", "xvid3", | ||
| 411 | "xvid4", "ffmpeg", "fame", "af6" | ||
| 412 | ]; | ||
| 413 | }, | ||
| 414 | |||
| 415 | #-- Button for xvid4conf | ||
| 416 | video_codec_details => "", | ||
| 417 | |||
| 418 | #-- Keyframe Interval presets | ||
| 419 | tc_keyframe_interval_presets => [ 25, 50, 100, 150, 250 ], | ||
| 420 | |||
| 421 | #-- Video framerate presets | ||
| 422 | tc_video_af6_codec_presets => [ "mpeg4", "h264" ], | ||
| 423 | |||
| 424 | #-- ffmpeg video codec presets | ||
| 425 | tc_video_framerate_presets => [ "25", "23.976", "29.97" ], | ||
| 426 | |||
| 427 | #-- List of deinterlacers | ||
| 428 | tc_deinterlace_list => [ | ||
| 429 | [ 0 => __ "No deinterlacing" ], | ||
| 430 | [ 1 => __ "Interpolate scanlines (fast)" ], | ||
| 431 | [ 3 => __ "Zoom to full frame (slow)" ], | ||
| 432 | [ 5 => __ "Interpolate scanlines / blend frames (pp=lb)" ], | ||
| 433 | [ '32detect' => __ | ||
| 434 | "Automatic deinterlacing of single frames" | ||
| 435 | ], | ||
| 436 | [ 'smart' => __ "Smart deinterlacing" ], | ||
| 437 | [ 'ivtc' => __ "Inverse telecine" ], | ||
| 438 | ], | ||
| 439 | |||
| 440 | #-- Video bitrate calculation mode | ||
| 441 | tc_video_bitrate_mode => sub { | ||
| 442 | my $mode = shift->tc_video_bitrate_mode; | ||
| 443 | return 0 if $mode eq 'size'; | ||
| 444 | return 1 if $mode eq 'bpp'; | ||
| 445 | return 2 if $mode eq 'manual'; | ||
| 446 | return 0; | ||
| 447 | }, | ||
| 448 | |||
| 449 | #-- Video bitrate calculation mode | ||
| 450 | set_tc_video_bitrate_mode => sub { | ||
| 451 | my ( $title, $notebook_page ) = @_; | ||
| 452 | my $mode; | ||
| 453 | $mode = 'size' if $notebook_page == 0; | ||
| 454 | $mode = 'bpp' if $notebook_page == 1; | ||
| 455 | $mode = 'manual' if $notebook_page == 2; | ||
| 456 | $title->set_tc_video_bitrate_mode($mode); | ||
| 457 | return $mode; | ||
| 458 | }, | ||
| 459 | |||
| 460 | #-- Target media count popup | ||
| 461 | tc_disc_cnt_list => [ | ||
| 462 | [ 1, __ "One" ], | ||
| 463 | [ 2, __ "Two" ], | ||
| 464 | [ 3, __ "Three" ], | ||
| 465 | [ 4, __ "Four" ] | ||
| 466 | ], | ||
| 467 | |||
| 468 | #-- Target media size combo presets | ||
| 469 | tc_disc_size_presets => [ | ||
| 470 | "650", "700", "800", "850", "2290", "4580", "6870", "9160" | ||
| 471 | ], | ||
| 472 | |||
| 473 | #-- BPP presets | ||
| 474 | tc_video_bpp_manual_presets => [ | ||
| 475 | reverse qw( | ||
| 476 | 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 | ||
| 477 | 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 | ||
| 478 | ) | ||
| 479 | ], | ||
| 480 | |||
| 481 | #-- Nice level presets | ||
| 482 | tc_nice_presets => [ | ||
| 483 | qw( | ||
| 484 | 0 1 2 3 4 5 6 | ||
| 485 | 7 8 9 10 11 12 13 | ||
| 486 | 14 15 16 17 18 19 | ||
| 487 | ) | ||
| 488 | ], | ||
| 489 | |||
| 490 | #-- Make storage_total_size bold | ||
| 491 | storage_total_size => sub { | ||
| 492 | "<b>" . $_[0]->storage_total_size . "</b>"; | ||
| 493 | }, | ||
| 494 | |||
| 495 | #-- Label listing all activated subtitles | ||
| 496 | subtitles_activated => sub { | ||
| 497 | my $self = shift; | ||
| 498 | my $subtitles = $self->subtitles; | ||
| 499 | return __ "No subtitles available" | ||
| 500 | unless scalar( keys %{$subtitles} ); | ||
| 501 | my $selected_label; | ||
| 502 | foreach my $subtitle ( sort { $a->id <=> $b->id } | ||
| 503 | values %{$subtitles} ) { | ||
| 504 | if ( $subtitle->tc_render ) { | ||
| 505 | $selected_label | ||
| 506 | .= $subtitle->info . " (" . __("render") . ") | "; | ||
| 507 | } | ||
| 508 | elsif ( $subtitle->tc_vobsub ) { | ||
| 509 | $selected_label | ||
| 510 | .= $subtitle->info . " (" . __("vobsub") . ") | "; | ||
| 511 | } | ||
| 512 | } | ||
| 513 | $selected_label =~ s/\| $//; | ||
| 514 | $selected_label ||= $NO_SUB_ACTIVE; | ||
| 515 | return $selected_label; | ||
| 516 | }, | ||
| 517 | |||
| 518 | #-- Checks whether a subtitle may be activated for rendering | ||
| 519 | subtitle_render_ok => sub { | ||
| 520 | my $self = shift; | ||
| 521 | my $subtitle = $self->selected_subtitle or return 0; | ||
| 522 | return 0 if $subtitle->tc_vobsub; | ||
| 523 | return 1 if $subtitle->tc_render; | ||
| 524 | for ( values %{ $self->subtitles } ) { | ||
| 525 | return 0 if $_->tc_render; | ||
| 526 | } | ||
| 527 | return 1; | ||
| 528 | 1; | ||
| 529 | }, | ||
| 530 | }, | ||
| 531 | |||
| 532 | attr_activity_href => { | ||
| 533 | |||
| 534 | #-- Chapter list is active only for the 'select' | ||
| 535 | #-- chapter mode. | ||
| 536 | chapter_list => sub { | ||
| 537 | $_[0]->tc_use_chapter_mode eq 'select'; | ||
| 538 | }, | ||
| 539 | |||
| 540 | #-- Subtitle languages list is active only for the 'lang' | ||
| 541 | #-- subtitle mode. | ||
| 542 | subtitle_languages => sub { | ||
| 543 | $_[0]->has_subtitles && | ||
| 544 | $_[0]->tc_rip_subtitle_mode eq 'lang'; | ||
| 545 | }, | ||
| 546 | |||
| 547 | #-- ffmpeg/af6 codec depends on Video codec | ||
| 548 | tc_video_af6_codec => sub { | ||
| 549 | $_[0]->tc_video_codec =~ /ffmpeg|af6/; | ||
| 550 | }, | ||
| 551 | |||
| 552 | #-- Button for xvid4conf | ||
| 553 | video_codec_details => sub { | ||
| 554 | $_[0]->tc_video_codec =~ /xvid4/; | ||
| 555 | }, | ||
| 556 | |||
| 557 | #-- Preview Images | ||
| 558 | preview_filename_clip1 => sub { -f $_[0]->preview_filename_orig }, | ||
| 559 | preview_filename_zoom => sub { -f $_[0]->preview_filename_clip1 }, | ||
| 560 | preview_filename_clip2 => sub { -f $_[0]->preview_filename_zoom }, | ||
| 561 | |||
| 562 | #-- multipass only with non MPEG files | ||
| 563 | tc_multipass => sub { ! $_[0]->is_mpeg }, # && | ||
| 564 | # $_[0]->tc_video_af6_codec ne 'h264' }, | ||
| 565 | |||
| 566 | #-- reuse log active only with 2pass encoding | ||
| 567 | tc_multipass_reuse_log => sub { $_[0]->tc_multipass && | ||
| 568 | ! $_[0]->is_mpeg }, # && | ||
| 569 | # $_[0]->tc_video_af6_codec ne 'h264' }, | ||
| 570 | |||
| 571 | #-- fast resizing | ||
| 572 | tc_fast_resize => sub { $_[0]->fast_resize_possible }, | ||
| 573 | }, | ||
| 574 | attr_depends_href => { | ||
| 575 | |||
| 576 | #-- So the chapter_list attribute depends | ||
| 577 | #-- on the current chapter mode, same | ||
| 578 | #-- for subtitle languages | ||
| 579 | chapter_list => "title.tc_use_chapter_mode", | ||
| 580 | subtitle_languages => "title.tc_rip_subtitle_mode", | ||
| 581 | |||
| 582 | #-- The preview lables depend on the | ||
| 583 | #-- corresponding clip/zoom values | ||
| 584 | preview_label_clip1 => [ | ||
| 585 | "title.tc_clip1_top", "title.tc_clip1_bottom", | ||
| 586 | "title.tc_clip1_left", "title.tc_clip1_right", | ||
| 587 | ], | ||
| 588 | preview_label_zoom => [ | ||
| 589 | "title.tc_clip1_top", "title.tc_clip1_bottom", | ||
| 590 | "title.tc_clip1_left", "title.tc_clip1_right", | ||
| 591 | "title.tc_zoom_width", "title.tc_zoom_height", | ||
| 592 | ], | ||
| 593 | preview_label_clip2 => [ | ||
| 594 | "title.tc_clip1_top", "title.tc_clip1_bottom", | ||
| 595 | "title.tc_clip1_left", "title.tc_clip1_right", | ||
| 596 | "title.tc_zoom_width", "title.tc_zoom_height", | ||
| 597 | "title.tc_clip2_top", "title.tc_clip2_bottom", | ||
| 598 | "title.tc_clip2_left", "title.tc_clip2_right", | ||
| 599 | ], | ||
| 600 | |||
| 601 | #-- audio_track depends on audio_channel setting | ||
| 602 | audio_track => "title.audio_channel", | ||
| 603 | |||
| 604 | #-- audio_channel_list depends on audio matrix | ||
| 605 | audio_channel => "multi_audio.matrix", | ||
| 606 | |||
| 607 | #-- Video codec changes when container changes | ||
| 608 | tc_video_codec => "title.tc_container", | ||
| 609 | |||
| 610 | #-- ffmpeg/af6 codec depends on Video codec | ||
| 611 | tc_video_af6_codec => ["title.tc_video_codec"], | ||
| 612 | |||
| 613 | #-- Button for xvid4conf depends on Video codec | ||
| 614 | video_codec_details => ["title.tc_video_codec"], | ||
| 615 | |||
| 616 | #-- Target size depends on media cnt and size | ||
| 617 | tc_target_size => [ "title.tc_disc_cnt", "title.tc_disc_size" ], | ||
| 618 | |||
| 619 | #-- Video bitrate, bpp and storage depend on several | ||
| 620 | #-- input parameters | ||
| 621 | tc_video_bitrate => \@BITRATE_PARAMS, | ||
| 622 | tc_video_bpp => \@BITRATE_PARAMS, | ||
| 623 | storage_video_size => \@BITRATE_PARAMS, | ||
| 624 | storage_audio_size => \@BITRATE_PARAMS, | ||
| 625 | storage_other_size => \@BITRATE_PARAMS, | ||
| 626 | storage_total_size => \@BITRATE_PARAMS, | ||
| 627 | tc_video_bitrate_manual => "tc_video_codec", | ||
| 628 | |||
| 629 | #-- multipass depends on container | ||
| 630 | tc_multipass => [ "tc_container", "tc_video_af6_codec" ], | ||
| 631 | |||
| 632 | #-- reuse log active only with 2pass encoding | ||
| 633 | tc_multipass_reuse_log => [ "tc_container", "tc_multipass", "tc_video_af6_codec" ], | ||
| 634 | |||
| 635 | #-- fast resizing depends on a bunch of parameters | ||
| 636 | tc_fast_resize => [ | ||
| 637 | "tc_clip1_left", "tc_clip1_right", | ||
| 638 | "tc_clip1_top", "tc_clip1_bottom", | ||
| 639 | "tc_zoom_width", "tc_zoom_height" | ||
| 640 | ], | ||
| 641 | |||
| 642 | #-- Selected subtitles depends on the selected ID | ||
| 643 | selected_subtitle => "selected_subtitle_id", | ||
| 644 | |||
| 645 | #-- Info of activated subtitles | ||
| 646 | subtitles_activated => | ||
| 647 | [ "subtitle.tc_render", "subtitle.tc_vobsub" ], | ||
| 648 | }, | ||
| 649 | ); | ||
| 650 | |||
| 651 | my %audio_codecs = ( | ||
| 652 | 0 => "mp3", | ||
| 653 | 1 => "mp2", | ||
| 654 | 2 => "vorbis", | ||
| 655 | 3 => "ac3", | ||
| 656 | 4 => "pcm", | ||
| 657 | mp3 => 0, | ||
| 658 | mp2 => 1, | ||
| 659 | vorbis => 2, | ||
| 660 | ac3 => 3, | ||
| 661 | pcm => 4, | ||
| 662 | ); | ||
| 663 | |||
| 664 | $context->add_object( | ||
| 665 | name => "audio_track", | ||
| 666 | aggregated_by => "title.audio_track", | ||
| 667 | attr_accessors_href => { | ||
| 668 | tc_mp3_bitrate_presets => | ||
| 669 | [ 64, 96, 128, 160, 192, 224, 256, 320, 384 ], | ||
| 670 | tc_mp2_bitrate_presets => | ||
| 671 | [ 64, 96, 128, 160, 192, 224, 256, 320, 384 ], | ||
| 672 | tc_mp3_samplerate_presets => [ 24000, 44100, 48000, ], | ||
| 673 | tc_vorbis_bitrate_presets => | ||
| 674 | [ 64, 96, 128, 160, 192, 224, 256, 320, 384 ], | ||
| 675 | tc_vorbis_samplerate_presets => [ 24000, 44100, 48000, ], | ||
| 676 | tc_audio_codec => sub { $audio_codecs{ shift->tc_audio_codec } }, | ||
| 677 | set_tc_audio_codec => | ||
| 678 | sub { $_[0]->set_tc_audio_codec( $audio_codecs{ $_[1] } ) }, | ||
| 679 | tc_audio_filter_list => { | ||
| 680 | 'rescale' => __ "None, volume rescale only", | ||
| 681 | 'a52drc' => __ "Range compression (liba52 filter)", | ||
| 682 | 'normalize' => __ "Normalizing (mplayer filter)", | ||
| 683 | }, | ||
| 684 | tc_mp3_quality_list => { | ||
| 685 | 0 => "0 - " . __ "best but slower", | ||
| 686 | 1 => "1", | ||
| 687 | 2 => "2", | ||
| 688 | 3 => "3", | ||
| 689 | 4 => "4", | ||
| 690 | 5 => "5 - " . __ "medium", | ||
| 691 | 6 => "6", | ||
| 692 | 7 => "7", | ||
| 693 | 8 => "8", | ||
| 694 | 9 => "9 - " . __ "low but faster", | ||
| 695 | }, | ||
| 696 | tc_vorbis_quality_presets => [ | ||
| 697 | -1, 0, 1.00, 2.00, 3.00, 4.00, | ||
| 698 | 5.00, 6.00, 7.00, 8.00, 9.00, 10.00 | ||
| 699 | ], | ||
| 700 | }, | ||
| 701 | attr_activity_href => { | ||
| 702 | audio_codec_mp3_form => sub { | ||
| 703 | $context->get_object("title")->tc_container ne 'vcd'; | ||
| 704 | }, | ||
| 705 | audio_codec_mp2_form => sub { | ||
| 706 | $context->get_object("title")->tc_container eq 'vcd'; | ||
| 707 | }, | ||
| 708 | audio_codec_vorbis_form => sub { | ||
| 709 | $context->get_object("title")->tc_container eq 'ogg'; | ||
| 710 | }, | ||
| 711 | audio_codec_ac3_form => sub { | ||
| 712 | $context->get_object("title")->tc_container ne 'vcd' | ||
| 713 | }, | ||
| 714 | audio_codec_pcm_form => sub { | ||
| 715 | $context->get_object("title")->tc_container ne 'vcd' | ||
| 716 | && shift->pcm_ok; | ||
| 717 | }, | ||
| 718 | bitrate => 0, | ||
| 719 | sample_rate => 0, | ||
| 720 | tc_vorbis_bitrate => sub { | ||
| 721 | !$context->get_object("audio_track") | ||
| 722 | ->tc_vorbis_quality_enable; | ||
| 723 | }, | ||
| 724 | tc_vorbis_quality => sub { | ||
| 725 | $context->get_object("audio_track")->tc_vorbis_quality_enable; | ||
| 726 | }, | ||
| 727 | tc_mp2_samplerate => 0, | ||
| 728 | }, | ||
| 729 | attr_depends_href => { | ||
| 730 | audio_codec_mp3_form => ["title.tc_container"], | ||
| 731 | audio_codec_mp2_form => ["title.tc_container"], | ||
| 732 | audio_codec_vorbis_form => ["title.tc_container"], | ||
| 733 | audio_codec_ac3_form => ["title.tc_container"], | ||
| 734 | audio_codec_pcm_form => ["title.tc_container"], | ||
| 735 | tc_vorbis_bitrate => ["audio_track.tc_vorbis_quality_enable"], | ||
| 736 | tc_vorbis_quality => ["audio_track.tc_vorbis_quality_enable"], | ||
| 737 | tc_volume_rescale => ["audio_track.tc_audio_filter"], | ||
| 738 | }, | ||
| 739 | ); | ||
| 740 | |||
| 741 | #-- Add Bitrate Calculation object to the Context | ||
| 742 | $context->add_object( | ||
| 743 | name => "bitrate_calc", | ||
| 744 | object => sub { $context->get_object("title")->bitrate_calc }, | ||
| 745 | attr_accessors_href => { | ||
| 746 | sheet => sub { | ||
| 747 | my $bc = shift; | ||
| 748 | my $sheet = $bc->sheet; | ||
| 749 | my @data; | ||
| 750 | push @data, | ||
| 751 | [ $_->{label}, $_->{operator}, $_->{value}, $_->{unit} ] | ||
| 752 | for @{$sheet}; | ||
| 753 | return \@data; | ||
| 754 | } | ||
| 755 | }, | ||
| 756 | attr_depends_href => { | ||
| 757 | sheet => [ | ||
| 758 | "title", | ||
| 759 | "content.selected_title_nr", "content.selected_titles", | ||
| 760 | "content.selected_title", "title.tc_container", | ||
| 761 | @BITRATE_PARAMS, | ||
| 762 | ], | ||
| 763 | }, | ||
| 764 | ); | ||
| 765 | |||
| 766 | #-- Add Multi Audio Matrix GUI object to the Context | ||
| 767 | $context->add_object( | ||
| 768 | name => "multi_audio", | ||
| 769 | object => undef, | ||
| 770 | attr_depends_href => { | ||
| 771 | matrix => [ | ||
| 772 | "content.selected_title_nr", "content.selected_titles", | ||
| 773 | "content.selected_title", | ||
| 774 | ], | ||
| 775 | }, | ||
| 776 | ); | ||
| 777 | |||
| 778 | #-- Add selected subtitle to the Context | ||
| 779 | my $render_active_sub = sub { $_[0]->tc_render }; | ||
| 780 | my $color_active_sub = sub { $_[0]->tc_render && $_[0]->tc_color_manip }; | ||
| 781 | |||
| 782 | $context->add_object( | ||
| 783 | name => "subtitle", | ||
| 784 | object => undef, | ||
| 785 | aggregated_by => "title.selected_subtitle", | ||
| 786 | attr_accessors_href => { | ||
| 787 | tc_assign_color_a_list => [ 0, 1, 2, 3 ], | ||
| 788 | tc_assign_color_b_list => [ 0, 1, 2, 3 ], | ||
| 789 | grab_button_label => sub { | ||
| 790 | $_[0]->is_ripped ? __ "Show" : __ "Grab"; | ||
| 791 | }, | ||
| 792 | }, | ||
| 793 | attr_activity_href => { | ||
| 794 | tc_vertical_offset => $render_active_sub, | ||
| 795 | tc_time_shift => $render_active_sub, | ||
| 796 | tc_postprocess => $render_active_sub, | ||
| 797 | tc_antialias => $render_active_sub, | ||
| 798 | tc_color_manip => $render_active_sub, | ||
| 799 | tc_color_a => $color_active_sub, | ||
| 800 | tc_color_b => $color_active_sub, | ||
| 801 | tc_assign_color_a => $color_active_sub, | ||
| 802 | tc_assign_color_b => $color_active_sub, | ||
| 803 | tc_test_image_cnt => $render_active_sub, | ||
| 804 | |||
| 805 | }, | ||
| 806 | attr_depends_href => { | ||
| 807 | tc_vertical_offset => "tc_render", | ||
| 808 | tc_time_shift => "tc_render", | ||
| 809 | tc_postprocess => "tc_render", | ||
| 810 | tc_antialias => "tc_render", | ||
| 811 | tc_color_manip => "tc_render", | ||
| 812 | tc_color_a => [ "tc_render", "tc_color_manip" ], | ||
| 813 | tc_color_b => [ "tc_render", "tc_color_manip" ], | ||
| 814 | tc_assign_color_a => [ "tc_render", "tc_color_manip" ], | ||
| 815 | tc_assign_color_b => [ "tc_render", "tc_color_manip" ], | ||
| 816 | tc_test_image_cnt => "tc_render", | ||
| 817 | }, | ||
| 818 | ); | ||
| 819 | |||
| 820 | #-- Add FilterList object to Context | ||
| 821 | $context->add_object( | ||
| 822 | name => "avail_filter_list", | ||
| 823 | object => Video::DVDRip::FilterList->get_filter_list, | ||
| 824 | attr_accessors_href => { | ||
| 825 | filters => sub { | ||
| 826 | my $filter_list = shift; | ||
| 827 | my $filter_settings = $context->get_object("filter_settings"); | ||
| 828 | my @filters; | ||
| 829 | my $filters_href = $filter_list->filters; | ||
| 830 | foreach my $filter_name ( sort keys %{$filters_href} ) { | ||
| 831 | push @filters, [ | ||
| 832 | $filter_name, | ||
| 833 | $filters_href->{$filter_name}->desc, | ||
| 834 | $filter_settings->filter_used( filter_name => $filter_name) | ||
| 835 | && !$filters_href->{$filter_name}->can_multiple, | ||
| 836 | ]; | ||
| 837 | } | ||
| 838 | return \@filters; | ||
| 839 | }, | ||
| 840 | }, | ||
| 841 | ); | ||
| 842 | |||
| 843 | #-- Filter Settings | ||
| 844 | $context->add_object ( | ||
| 845 | name => "filter_settings", | ||
| 846 | object => undef, | ||
| 847 | aggregated_by => "title.tc_filter_settings", | ||
| 848 | attr_accessors_href => { | ||
| 849 | filters => sub { | ||
| 850 | my $tc_filter_settings = shift; | ||
| 851 | |||
| 852 | my $selected_filters = $tc_filter_settings->get_selected_filters; | ||
| 853 | |||
| 854 | my @filters; | ||
| 855 | foreach my $queue ( 'pre', 'post' ) { | ||
| 856 | my $filter; | ||
| 857 | push @filters, [ | ||
| 858 | $queue, "-----------", uc($queue) | ||
| 859 | ]; | ||
| 860 | foreach my $filter_instance ( @{$selected_filters} ) { | ||
| 861 | eval { $filter = $filter_instance->get_filter }; | ||
| 862 | next if $@; # if a filter doesn't exist anymore | ||
| 863 | next if $filter_instance->queue ne $queue; | ||
| 864 | push @filters, [ | ||
| 865 | $filter_instance->id, | ||
| 866 | $filter->filter_name, | ||
| 867 | $filter->desc, | ||
| 868 | ], | ||
| 869 | } | ||
| 870 | } | ||
| 871 | |||
| 872 | return \@filters; | ||
| 873 | }, | ||
| 874 | }, | ||
| 875 | ); | ||
| 876 | |||
| 877 | #-- Add preview window to context | ||
| 878 | $context->add_object ( | ||
| 879 | name => "filter_window", | ||
| 880 | object => undef, | ||
| 881 | attr_depends_href => { | ||
| 882 | selected_avail_filter => [ "selected_avail_filter_name" ], | ||
| 883 | selected_used_filter_instance => [ "selected_used_filter_instance_id" ], | ||
| 884 | |||
| 885 | current_filter => [ "selected_avail_filter_name", | ||
| 886 | "selected_used_filter_instance_id" ], | ||
| 887 | # | ||
| 888 | # current_filter_settings => [ "selected_avail_filter_name", | ||
| 889 | # "selected_used_filter_instance_id" ], | ||
| 890 | }, | ||
| 891 | attr_accessors_href => { | ||
| 892 | set_selected_avail_filter_name => sub { | ||
| 893 | my $self = shift; | ||
| 894 | my ($value) = @_; | ||
| 895 | $self->set_selected_avail_filter_name($value); | ||
| 896 | my $filter = $self->selected_avail_filter; | ||
| 897 | $self->set_current_filter($filter); | ||
| 898 | my $instance = $filter ? $filter->get_dummy_instance : undef; | ||
| 899 | $self->set_current_filter_settings($instance); | ||
| 900 | # $self->build_filter_settings_form; | ||
| 901 | return $value; | ||
| 902 | }, | ||
| 903 | set_selected_used_filter_instance_id => sub { | ||
| 904 | my $self = shift; | ||
| 905 | my ($value) = @_; | ||
| 906 | $self->set_selected_used_filter_instance_id($value); | ||
| 907 | my $instance = $self->selected_used_filter_instance; | ||
| 908 | $self->set_current_filter_settings($instance); | ||
| 909 | # $self->build_filter_settings_form; | ||
| 910 | my $filter = $instance ? $instance->get_filter : undef; | ||
| 911 | $self->set_current_filter($filter); | ||
| 912 | return $value; | ||
| 913 | }, | ||
| 914 | }, | ||
| 915 | ); | ||
| 916 | |||
| 917 | #-- Add selected filter instance to context | ||
| 918 | $context->add_object ( | ||
| 919 | name => "current_filter", | ||
| 920 | object => undef, | ||
| 921 | aggregated_by => "filter_window.current_filter", | ||
| 922 | attr_accessors_href => { | ||
| 923 | desc => sub { | ||
| 924 | my $self = shift; | ||
| 925 | local $Text::Wrap::columns = 32; | ||
| 926 | return wrap("","",$self->desc); | ||
| 927 | }, | ||
| 928 | author => sub { | ||
| 929 | my $self = shift; | ||
| 930 | local $Text::Wrap::columns = 32; | ||
| 931 | return wrap("","",$self->author); | ||
| 932 | }, | ||
| 933 | }, | ||
| 934 | ); | ||
| 935 | |||
| 936 | #-- Add selected filter to context | ||
| 937 | $context->add_object ( | ||
| 938 | name => "current_filter_settings", | ||
| 939 | object => undef, | ||
| 940 | # aggregated_by => "filter_window.current_filter_settings", | ||
| 941 | accessor => sub { | ||
| 942 | my $self = shift; | ||
| 943 | my ($attr, $value) = @_; | ||
| 944 | if ( @_ == 2 ) { | ||
| 945 | #-- setter | ||
| 946 | my $setter = "set_$attr"; | ||
| 947 | return $self->$setter($value) if $self->can($setter); | ||
| 948 | #-- filter setting? | ||
| 949 | if ( $attr =~ /^filter_option_(.*)_(\d+)$/ ) { | ||
| 950 | return $self->set_value( | ||
| 951 | option_name => $1, | ||
| 952 | idx => $2, | ||
| 953 | value => $value | ||
| 954 | ); | ||
| 955 | } | ||
| 956 | croak "Unknown FilterSettingsInstance attribute: $attr"; | ||
| 957 | } | ||
| 958 | else { | ||
| 959 | #-- getter | ||
| 960 | my $getter = $attr; | ||
| 961 | return $self->$getter() if $self->can($getter); | ||
| 962 | #-- filter setting? | ||
| 963 | if ( $attr =~ /^filter_option_(.*)_(\d+)$/ ) { | ||
| 964 | return $self->get_value( | ||
| 965 | option_name => $1, | ||
| 966 | idx => $2, | ||
| 967 | ); | ||
| 968 | } | ||
| 969 | croak "Unknown FilterSettingsInstance attribute: $attr"; | ||
| 970 | } | ||
| 971 | }, | ||
| 972 | ); | ||
| 973 | |||
| 974 | #-- Add cluster control daemon object to Context | ||
| 975 | $context->add_object( | ||
| 976 | name => "cluster", | ||
| 977 | object => undef, | ||
| 978 | ); | ||
| 979 | |||
| 980 | #-- Add cluster control daemon object to Context | ||
| 981 | $context->add_object( | ||
| 982 | name => "!cluster", | ||
| 983 | object => 1, | ||
| 984 | ); | ||
| 985 | |||
| 986 | #-- Add cluster control GUI object to Context | ||
| 987 | $context->add_object( | ||
| 988 | name => "cluster_gui", | ||
| 989 | object => undef, | ||
| 990 | attr_depends_href => { | ||
| 991 | selected_node => "selected_node_name", | ||
| 992 | selected_project => "selected_project_id", | ||
| 993 | selected_job => "selected_job_id", | ||
| 994 | jobs_list => "selected_project_id", | ||
| 995 | }, | ||
| 996 | ); | ||
| 997 | |||
| 998 | #-- Add cluster node object to Context | ||
| 999 | $context->add_object( | ||
| 1000 | name => "cluster_node", | ||
| 1001 | aggregated_by => "cluster_gui.selected_node", | ||
| 1002 | ); | ||
| 1003 | |||
| 1004 | #-- Add cluster node object to Context | ||
| 1005 | $context->add_object( | ||
| 1006 | name => "cluster_project", | ||
| 1007 | aggregated_by => "cluster_gui.selected_project", | ||
| 1008 | ); | ||
| 1009 | |||
| 1010 | #-- Add cluster node object to Context | ||
| 1011 | $context->add_object( | ||
| 1012 | name => "cluster_job", | ||
| 1013 | aggregated_by => "cluster_gui.selected_job", | ||
| 1014 | ); | ||
| 1015 | |||
| 1016 | #-- Add currently edited cluster node object to Context | ||
| 1017 | $context->add_object( | ||
| 1018 | name => "cluster_node_edited", | ||
| 1019 | buffered => 1, | ||
| 1020 | attr_activity_href => { | ||
| 1021 | username => sub { | ||
| 1022 | !$context->get_object_attr("cluster_node_edited.is_master"); | ||
| 1023 | }, | ||
| 1024 | ssh_cmd => sub { | ||
| 1025 | !$context->get_object_attr("cluster_node_edited.is_master"); | ||
| 1026 | }, | ||
| 1027 | }, | ||
| 1028 | attr_depends_href => { | ||
| 1029 | username => "is_master", | ||
| 1030 | ssh_cmd => "is_master", | ||
| 1031 | }, | ||
| 1032 | ); | ||
| 1033 | |||
| 1034 | #-- Add currently cluster node GUI object to Context | ||
| 1035 | $context->add_object( | ||
| 1036 | name => "cluster_node_gui", | ||
| 1037 | buffered => 1, | ||
| 1038 | ); | ||
| 1039 | |||
| 1040 | #-- Add currently cluster title GUI object to Context | ||
| 1041 | $context->add_object( | ||
| 1042 | name => "cluster_title_gui", | ||
| 1043 | # buffered => 1, | ||
| 1044 | ); | ||
| 1045 | |||
| 1046 | #-- Add currently edited cluster title object to Context | ||
| 1047 | $context->add_object( name => "cluster_title_edited", ); | ||
| 1048 | |||
| 1049 | #-- Add Preview Window to context | ||
| 1050 | $context->add_object ( | ||
| 1051 | name => "preview_window", | ||
| 1052 | attr_accessors_href => { | ||
| 1053 | set_paused => sub { 1 }, | ||
| 1054 | }, | ||
| 1055 | ); | ||
| 1056 | |||
| 1057 | return $context; | ||
| 1058 | } | ||
| 1059 | |||
| 1060 | 1; |