blib/lib/Video/DVDRip/GUI/Project/ClipZoom.pm untested

filter: Statementstmt 0.0% 0 / 237 Branchbran 0.0% 0 / 64 Conditioncond 0.0% 0 / 27 MC/DCmcdc 0.0% 0 / 15 Subroutinesub 0.0% 0 / 27 Podpod 0.0% 0 / 21 totaltotal 0.0% 0 / 391 CC 33 SCAR 28.0
CC
33
Cov
0%
preview_video
42.0
build_preview_images
30.0
open_preview
30.0
CRAP 16.4
1 # $Id: ClipZoom.pm 2344 2007-08-09 21:37:41Z 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::Project::ClipZoom;
12  
13 use base qw( Video::DVDRip::GUI::Base );
14  
15 use Locale::TextDomain qw (video.dvdrip);
16  
17 use Carp;
18 use strict;
19 use Video::DVDRip::GUI::FormFactory::ClipImage;
20  
21 sub get_preview_hbox_width { shift->{preview_hbox_width} }
22 sub get_preview_hbox_height { shift->{preview_hbox_height} }
23 sub get_preview_image_sizes { shift->{preview_image_sizes} }
24  
25 sub set_preview_hbox_width { shift->{preview_hbox_width} = $_[1] }
26 sub set_preview_hbox_height { shift->{preview_hbox_height} = $_[1] }
27 sub set_preview_image_sizes { shift->{preview_image_sizes} = $_[1] }
28  
29 sub new {
30 my $class = shift;
31  
32 my $self = $class->SUPER::new(@_);
33  
34 $self->{preview_hbox_width} => undef;
35 $self->{preview_hbox_height} => undef;
36 $self->{preview_image_sizes} => {};
37  
38 # { clip1 => { mtime => $mtime, width => $width, height => $height } }
39  
40 $self->get_context->set_object( "clip_zoom" => $self );
41  
42 return $self;
43 }
44  
45 sub build_factory {
46 my $self = shift;
47  
48 my $context = $self->get_context;
49  
50 return Gtk2::Ex::FormFactory::VBox->new(
51 $self->get_optimum_screen_size_options("page"),
52 title => '[gtk-zoom-in]'.__ "Clip & Zoom",
53 object => "title",
54 active_cond => sub {
55 $self->selected_title
56 && $self->project
57 && $self->project->created;
58 },
59 active_depends => "project.created",
60 no_frame => 1,
61 content => [
62 Video::DVDRip::GUI::Main->build_selected_title_factory,
63 $self->build_preview_images,
64 $self->build_adjust_form,
65 ],
66 );
67 }
68  
69 sub build_preview_images {
70 my $self = shift;
71  
72 my $update_timeout;
73 my $preview_image_hbox;
74 return Gtk2::Ex::FormFactory::VBox->new(
75 expand => 1,
76 title => __ "Preview images",
77 object => "title",
78 content => [
79 Gtk2::Ex::FormFactory::HBox->new(
80 spacing => 5,
81 content => [
82 Gtk2::Ex::FormFactory::Entry->new(
83 attr => "title.preview_frame_nr",
84 label => __ "Grab preview frame #",
85 rules => "integer",
86 width => 80,
87 rules => [ "positive-integer", "or-empty" ],
88 ),
89 Gtk2::Ex::FormFactory::CheckButton->new(
90 attr => "title.tc_force_slow_grabbing",
91 label => __ "Force slow grabbing",
92 ),
93 Gtk2::Ex::FormFactory::Button->new(
94 object => "title",
95 label => __ "Grab frame",
96 stock => "gtk-redo",
97 clicked_hook => sub { $self->grab_preview_frame },
98 active_cond => sub { !$self->progress_is_active },
99 active_depends => "progress.is_active",
100 ),
101 Gtk2::Ex::FormFactory::Button->new(
102 object => "title",
103 label => __ "Show video from here",
104 stock => "dvdrip-play-movie",
105 clicked_hook => sub { $self->preview_video },
106 active_cond => sub {
107 return unless $self->project;
108 return 0 if $self->project->rip_mode ne 'rip';
109 return !$self->progress_is_active;
110 },
111 active_depends => [ "project.rip_mode", "progress.is_active" ],
112 ),
113 ],
114 ),
115 $preview_image_hbox = Gtk2::Ex::FormFactory::HBox->new(
116 homogenous => 1,
117 expand => 1,
118 content => [
119 Gtk2::Ex::FormFactory::VBox->new(
120 content => [
121 Gtk2::Ex::FormFactory::Image->new(
122 name => "preview_image_clip1",
123 expand => 1,
124 attr => "title.preview_filename_clip1",
125 bgcolor => "#ffffff",
126 scale_hook =>
127 sub { $self->get_preview_image_scale },
128 properties => { xalign => 0, yalign => 0 },
129 with_frame => 1,
130 signal_connect => {
131 button_release_event => sub {
132 $self->open_preview(
133 type => "clip1" );
134 },
135 size_allocate => sub {
136 return
137 if $self->get_preview_hbox_width
138 == $_[1]->width * 3
139 and $self->get_preview_hbox_height
140 == $_[1]->height;
141 $self->set_preview_hbox_width(
142 $_[1]->width * 3 );
143 $self->set_preview_hbox_height(
144 $_[1]->height );
145 Glib::Source->remove($update_timeout)
146 if $update_timeout;
147 $update_timeout = Glib::Timeout->add(
148 500,
149 sub {
150 $_->get_content->[0]->update
151 for @{ $preview_image_hbox
152 ->get_content };
153 $update_timeout = undef;
154 0;
155 }
156 );
157 0;
158 },
159 realize => sub {
160 $_[0]->window->set_cursor(
161 Gtk2::Gdk::Cursor->new(
162 'GDK_HAND1')
163 );
164 1;
165 },
166 },
167 ),
168 Gtk2::Ex::FormFactory::Label->new(
169 name => "preview_label_clip1",
170 attr => "title.preview_label_clip1",
171 with_markup => 1,
172 ),
173 ],
174 ),
175 Gtk2::Ex::FormFactory::VBox->new(
176 content => [
177 Gtk2::Ex::FormFactory::Image->new(
178 name => "preview_image_zoom",
179 expand => 1,
180 attr => "title.preview_filename_zoom",
181 bgcolor => "#ffffff",
182 scale_hook =>
183 sub { $self->get_preview_image_scale },
184 properties => { xalign => 0, yalign => 0 },
185 with_frame => 1,
186 signal_connect => {
187 button_release_event => sub {
188 $self->open_preview( type => "zoom" );
189 },
190 realize => sub {
191 $_[0]->window->set_cursor(
192 Gtk2::Gdk::Cursor->new(
193 'GDK_HAND1')
194 );
195 1;
196 },
197 },
198 ),
199 Gtk2::Ex::FormFactory::Label->new(
200 name => "preview_label_zoom",
201 attr => "title.preview_label_zoom",
202 with_markup => 1,
203 ),
204 ],
205 ),
206 Gtk2::Ex::FormFactory::VBox->new(
207 content => [
208 Gtk2::Ex::FormFactory::Image->new(
209 name => "preview_image_clip2",
210 expand => 1,
211 attr => "title.preview_filename_clip2",
212 bgcolor => "#ffffff",
213 scale_hook =>
214 sub { $self->get_preview_image_scale },
215 properties => { xalign => 0, yalign => 0 },
216 with_frame => 1,
217 signal_connect => {
218 button_release_event => sub {
219 $self->open_preview(
220 type => "clip2" );
221 },
222 realize => sub {
223 $_[0]->window->set_cursor(
224 Gtk2::Gdk::Cursor->new(
225 'GDK_HAND1')
226 );
227 1;
228 },
229 },
230 ),
231 Gtk2::Ex::FormFactory::Label->new(
232 name => "preview_label_clip2",
233 attr => "title.preview_label_clip2",
234 with_markup => 1,
235 ),
236 ],
237 ),
238 ],
239 ),
240 ],
241 );
242 }
243  
244 sub build_adjust_form {
245 my $self = shift;
246  
247 return Gtk2::Ex::FormFactory::VBox->new(
248 title => __ "Adjust clip and zoom parameters",
249 object => "title",
250 content => [
251 Gtk2::Ex::FormFactory::Table->new(
252 layout => "
253 +--------+---------------+--+-----------------+
254 | Preset | Popup |XX| Apply |
255 +--------+---------------+--+-----------------+
256 | | Separator | | |
257 +--------+---+---+---+---+--+-----------------+
258 | | T | B | L | R | | |
259 +--------+---+---+---+---+--+-----------------+
260 | 1stCl | X | X | X | X | | Generate |
261 +--------+---+---+---+---+--+-----------------+
262 | 2ndCl | X | X | X | X | | 2nd to 1st |
263 +--------+---+---+---+---+--+-----------------+
264 | | Separator | | |
265 +--------+---+---+---+---+--+-----------------+
266 | | W | H | V | B | | |
267 +--------+---+---+---+---+--+--------+--------+
268 | Zoom | X | X | X | X | | CalcW | CalcH |
269 +--------+---+---+---+---+--+--------+--------+
270 | FastR | X | | ZoomCalculator |
271 +--------+---------------+--+-----------------+
272 ",
273  
274 # properties => { column_spacing => 5, row_spacing => 5 },
275 content => [
276  
277 #-- Presets
278 Gtk2::Ex::FormFactory::Label->new(
279 label => __ "Presets",
280 widget_group => "clip_zoom_widgets",
281 ),
282 Gtk2::Ex::FormFactory::Popup->new(
283 attr => "title.preset",
284 ),
285 Gtk2::Ex::FormFactory::Label->new( label => " ", ),
286 Gtk2::Ex::FormFactory::Button->new(
287 label => __ "Apply preset values",
288 stock => "gtk-apply",
289 clicked_hook => sub { $self->apply_preset_values },
290 active_cond => sub { !$self->progress_is_active },
291 active_depends => "progress.is_active",
292 tip => __"Overwrites all Clip & Zoom settings from the selected ".
293 "preset and regenerates the preview images.",
294 ),
295  
296 #-- Separator
297 Gtk2::Ex::FormFactory::HSeparator->new(),
298  
299 #-- Clipping labels
300 Gtk2::Ex::FormFactory::Label->new(
301 label => __ "Top",
302 widget_group => "clip_zoom_widgets",
303 ),
304 Gtk2::Ex::FormFactory::Label->new(
305 label => __ "Bottom",
306 widget_group => "clip_zoom_widgets",
307 ),
308 Gtk2::Ex::FormFactory::Label->new(
309 label => __ "Left",
310 widget_group => "clip_zoom_widgets",
311 ),
312 Gtk2::Ex::FormFactory::Label->new(
313 label => __ "Right",
314 widget_group => "clip_zoom_widgets",
315 ),
316  
317 #-- 1st Clipping
318 Gtk2::Ex::FormFactory::Label->new(
319 label => __ "1st clipping",
320 label_group => "clip_zoom_labels",
321 ),
322 Gtk2::Ex::FormFactory::Entry->new(
323 attr => "title.tc_clip1_top",
324 widget_group => "clip_zoom_widgets",
325 width => 10,
326 rules => [ "integer", "or-empty" ],
327 ),
328 Gtk2::Ex::FormFactory::Entry->new(
329 attr => "title.tc_clip1_bottom",
330 widget_group => "clip_zoom_widgets",
331 width => 10,
332 rules => [ "integer", "or-empty" ],
333 ),
334 Gtk2::Ex::FormFactory::Entry->new(
335 attr => "title.tc_clip1_left",
336 widget_group => "clip_zoom_widgets",
337 width => 10,
338 rules => [ "integer", "or-empty" ],
339 ),
340 Gtk2::Ex::FormFactory::Entry->new(
341 attr => "title.tc_clip1_right",
342 widget_group => "clip_zoom_widgets",
343 width => 10,
344 rules => [ "integer", "or-empty" ],
345 ),
346  
347 #-- Generate preview images button
348 Gtk2::Ex::FormFactory::Button->new(
349 label => __ "Generate preview images",
350 stock => "gtk-refresh",
351 clicked_hook => sub { $self->make_previews },
352 active_cond => sub { !$self->progress_is_active },
353 active_depends => "progress.is_active",
354 tip => __"Generates new preview images based ".
355 "on the actual settings",
356 ),
357  
358 #-- 2nd Clipping
359 Gtk2::Ex::FormFactory::Label->new(
360 label => __ "2nd clipping",
361 label_group => "clip_zoom_labels",
362 ),
363 Gtk2::Ex::FormFactory::Entry->new(
364 attr => "title.tc_clip2_top",
365 widget_group => "clip_zoom_widgets",
366 width => 10,
367 rules => [ "integer", "or-empty" ],
368 ),
369 Gtk2::Ex::FormFactory::Entry->new(
370 attr => "title.tc_clip2_bottom",
371 widget_group => "clip_zoom_widgets",
372 width => 10,
373 rules => [ "integer", "or-empty" ],
374 ),
375 Gtk2::Ex::FormFactory::Entry->new(
376 attr => "title.tc_clip2_left",
377 widget_group => "clip_zoom_widgets",
378 width => 10,
379 rules => [ "integer", "or-empty" ],
380 ),
381 Gtk2::Ex::FormFactory::Entry->new(
382 attr => "title.tc_clip2_right",
383 widget_group => "clip_zoom_widgets",
384 width => 10,
385 rules => [ "integer", "or-empty" ],
386 ),
387  
388 #-- Move clipping values button
389 Gtk2::Ex::FormFactory::Button->new(
390 label => __ "Move 2nd clipping to 1st",
391 stock => "dvdrip-clip-move",
392 clicked_hook => sub { $self->move_clip2_to_clip1 },
393 tip => __"Turns second clipping into first clipping. ".
394 "This is possible only with high quality scaling."
395 ),
396  
397 #-- Separator
398 Gtk2::Ex::FormFactory::HSeparator->new(),
399  
400 #-- Zoom titles
401 Gtk2::Ex::FormFactory::Label->new(
402 label => __ "Width",
403 widget_group => "clip_zoom_widgets",
404 ),
405 Gtk2::Ex::FormFactory::Label->new(
406 label => __ "Height",
407 widget_group => "clip_zoom_widgets",
408 ),
409  
410 #-- V-Bitrate / BPP Titles
411 Gtk2::Ex::FormFactory::Label->new(
412 label => __ "V-Rate",
413 widget_group => "clip_zoom_widgets",
414 ),
415 Gtk2::Ex::FormFactory::Label->new(
416 label => __ "BPP",
417 widget_group => "clip_zoom_widgets",
418 ),
419  
420 #-- Zoom widgets
421 Gtk2::Ex::FormFactory::Label->new(
422 label => __ "Zoom",
423 label_group => "clip_zoom_labels",
424 ),
425 Gtk2::Ex::FormFactory::Entry->new(
426 attr => "title.tc_zoom_width",
427 widget_group => "clip_zoom_widgets",
428 width => 10,
429 rules => [ "positive-integer", "or-empty" ],
430 ),
431 Gtk2::Ex::FormFactory::Entry->new(
432 attr => "title.tc_zoom_height",
433 widget_group => "clip_zoom_widgets",
434 width => 10,
435 rules => [ "positive-integer", "or-empty" ],
436 ),
437  
438 Gtk2::Ex::FormFactory::Label->new(
439 attr => "title.tc_video_bitrate",
440 ),
441 Gtk2::Ex::FormFactory::Label->new(
442 attr => "title.tc_video_bpp",
443 ),
444  
445 Gtk2::Ex::FormFactory::Button->new(
446 label => __ "Calc height",
447 stock => "dvdrip-calc-height",
448 clicked_hook =>
449 sub { $self->calc_zoom( height => 1 ) },
450 tip => __"Calculates the height based on the given width ".
451 "with correct aspect ratio",
452 ),
453 Gtk2::Ex::FormFactory::Button->new(
454 label => __ "Calc width",
455 stock => "dvdrip-calc-width",
456 clicked_hook => sub { $self->calc_zoom( width => 1 ) },
457 tip => __"Calculates the width based on the given height ".
458 "with correct aspect ratio",
459 ),
460  
461 #-- Fast resizing
462 Gtk2::Ex::FormFactory::Label->new(
463 label => __ "Use fast resizing",
464 label_group => "clip_zoom_labels",
465 ),
466 Gtk2::Ex::FormFactory::YesNo->new(
467 attr => "title.tc_fast_resize",
468 true_label => __"Yes",
469 false_label => __"No",
470 ),
471 Gtk2::Ex::FormFactory::Button->new(
472 label => __ "Open zoom calculator",
473 stock => "gtk-zoom-in",
474 clicked_hook => sub {
475 $self->open_zoom_calculator;
476 },
477 ),
478 ],
479 ),
480 ],
481 );
482 }
483  
484 sub get_max_preview_image_size {
485 my $self = shift;
486  
487 my $context = $self->get_context;
488 my $title = $context->get_object("title");
489  
490 my $preview_image_sizes = $self->get_preview_image_sizes;
491  
492 my ( $max_width, $max_height ) = ( -999999, -999999 );
493  
494 foreach my $type ( "clip1", "zoom", "clip2" ) {
495 my $filename = $title->preview_filename( type => $type );
496 my $mtime = ( stat $filename )[9];
497 my ( $width, $height );
498 if ( not $preview_image_sizes->{$type}
499 or not $preview_image_sizes->{$type}->{$filename}
500 or $preview_image_sizes->{$type}->{$filename}->{mtime} <= $mtime )
501 {
502 my $gtk_pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($filename);
503 $preview_image_sizes->{$type}->{$filename} = {
504 mtime => $mtime,
505 width => ( $width = $gtk_pixbuf->get_width ),
506 height => ( $height = $gtk_pixbuf->get_height ),
507 };
508 }
509 else {
510 $width = $preview_image_sizes->{$type}->{$filename}->{width};
511 $height = $preview_image_sizes->{$type}->{$filename}->{height};
512 }
513 $max_width = $width if $width > $max_width;
514 $max_height = $height if $height > $max_height;
515 }
516  
517 return ( $max_width, $max_height );
518 }
519  
520 sub get_preview_image_scale {
521 my $self = shift;
522  
523 my ( $max_image_width, $max_image_height )
524 = $self->get_max_preview_image_size;
525  
526 my $widget_width = int( $self->get_preview_hbox_width / 3 ) - 5;
527 my $widget_height = $self->get_preview_hbox_height - 5;
528  
529 my $width_scale = $widget_width / $max_image_width;
530 my $height_scale = $widget_height / $max_image_height;
531  
532 my $scale = $width_scale < $height_scale ? $width_scale : $height_scale;
533  
534 return $scale;
535 }
536  
537 sub open_preview {
538 my $self = shift;
539 my %par = @_;
540 my ($type) = @par{'type'};
541  
542 my $image;
543 if ( $type =~ /clip/ ) {
544 my $file_type = $type eq 'clip1' ? "orig" : "zoom";
545 $image = Video::DVDRip::GUI::FormFactory::ClipImage->new(
546 attr => "title.preview_filename_$file_type",
547 attr_left => "tc_${type}_left",
548 attr_right => "tc_${type}_right",
549 attr_top => "tc_${type}_top",
550 attr_bottom => "tc_${type}_bottom",
551 image_type => $type,
552 );
553 }
554 else {
555 $image = Video::DVDRip::GUI::FormFactory::ClipImage->new(
556 attr => "title.preview_filename_$type",
557 no_clip => 1
558 );
559 }
560  
561 my $ff;
562 my $images_generated = 0;
563  
564 $ff = Gtk2::Ex::FormFactory->new(
565 sync => 1,
566 context => $self->get_context,
567 content => [
568 Gtk2::Ex::FormFactory::Window->new(
569 title => "dvd::rip "
570 . __x( "Preview image: {type}", type => $type ),
571 customize_hook => sub {
572 $_[0]->parent->set_resizable(0);
573 },
574 signal_connect_after => {
575 "destroy" => sub {
576 my ($widget) = @_;
577 $self->make_previews
578 if $type ne 'zoom'
579 && !$images_generated
580 && $image->get_clipping_changed;
581 }
582 },
583 content => [
584 $image,
585 Gtk2::Ex::FormFactory::DialogButtons->new(
586 clicked_hook => sub {
587 my ($widget) = @_;
588 $ff->change_mouse_cursor("watch");
589 $self->make_previews
590 if $type ne 'zoom' &&
591 $image->get_clipping_changed;
592 $images_generated = 1;
593 1;
594 },
595 ),
596 ],
597 ),
598 ],
599 );
600  
601 $ff->open;
602 $ff->update;
603  
604 1;
605 }
606  
607 sub show_preview_images {
608 my $self = shift;
609 my %par = @_;
610 my ($type) = @par{'type'};
611  
612 my $title = $self->selected_title;
613 return 1 if not $title;
614  
615 my ( $image, @types, $filename );
616  
617 if ($type) {
618 push @types, $type;
619 }
620 else {
621 @types = qw ( clip1 zoom clip2 );
622 }
623  
624 my $form_factory = $self->get_form_factory;
625  
626 foreach $type (@types) {
627 $form_factory->get_widget("preview_image_$type")->update;
628 $form_factory->get_widget("preview_label_$type")->update;
629 }
630  
631 1;
632 }
633  
634 sub make_previews {
635 my $self = shift;
636  
637 my $title = $self->selected_title;
638 return 1 if not $title;
639 return 1 if $self->progress_is_active;
640  
641 my $job_planner = $self->get_context->get_object("job_planner");
642 my $exec_flow_gui = $self->get_context->get_object("exec_flow_gui");
643 my $job = $job_planner->build_make_previews_job($title);
644  
645 $job->get_post_callbacks->add(sub {
646 $self->get_context->update_object_widgets("title");
647 $self->get_context->update_object_widgets("bitrate_calc");
648 });
649  
650 $exec_flow_gui->start_job($job);
651  
652 1;
653 }
654  
655 sub grab_preview_frame {
656 my $self = shift;
657  
658 my $title = $self->selected_title;
659 return 1 if not $title;
660 return 1 if $self->progress_is_active;
661  
662 my $job_planner = $self->get_context->get_object("job_planner");
663 my $exec_flow_gui = $self->get_context->get_object("exec_flow_gui");
664 my $job = $job_planner->build_grab_preview_frame_job($title);
665  
666 $job->get_post_callbacks->add(sub {
667 $self->get_context->update_object_widgets("title");
668 $self->get_context->update_object_widgets("bitrate_calc");
669 });
670  
671 $exec_flow_gui->start_job($job);
672  
673 1;
674 }
675  
676 sub apply_preset_values {
677 my $self = shift;
678  
679 my $title = $self->selected_title;
680 return 1 if not $title;
681 return 1 if not $title->is_ripped;
682  
683 my $job_planner = $self->get_context->get_object("job_planner");
684 my $exec_flow_gui = $self->get_context->get_object("exec_flow_gui");
685 my $job = $job_planner->build_apply_preset_job($title);
686  
687 $job->get_post_callbacks->add(sub {
688 $self->get_context->update_object_widgets("title");
689 $self->get_context->update_object_widgets("bitrate_calc");
690 });
691  
692 $exec_flow_gui->start_job($job);
693  
694 1;
695 }
696  
697 sub preview_video {
698 my $self = shift;
699  
700 my $title = $self->selected_title;
701 return 1 if not $title;
702  
703 my $frame_nr = $title->preview_frame_nr;
704 my $filename = $title->preview_filename( type => 'orig' );
705  
706 return 1 if not defined $frame_nr;
707  
708 if ( not $title->is_ripped ) {
709 $self->message_window(
710 message => __ "You first have to rip this title." );
711 return 1;
712 }
713  
714 if ( $title->project->rip_mode ne 'rip' ) {
715 $self->message_window( message => __
716 "This function is only avaiable for ripped DVD's." );
717 return 1;
718 }
719  
720 if ( $frame_nr > $title->frames or $frame_nr !~ /^\d+/ ) {
721 $self->message_window(
722 message => __ "Illegal frame number. Maximum is "
723 . ( $title->frames - 1 ) );
724 return 1;
725 }
726  
727 my $command = $title->get_view_stdin_command(
728 command_tmpl => $self->config('play_stdin_command'), );
729  
730 $self->log(
731 __x("Executing command for video preview: {command}",
732 command => $command
733 )
734 );
735  
736 system("$command &");
737  
738 1;
739 }
740  
741 sub move_clip2_to_clip1 {
742 my $self = shift;
743  
744 my $title = $self->selected_title;
745 return 1 if not $title;
746  
747 if ( not $title->is_ripped ) {
748 $self->message_window(
749 message => __ "You first have to rip this title." );
750 return 1;
751 }
752  
753 if ( $title->tc_fast_resize ) {
754 $self->message_window( message => __
755 "This is not possible because\nfast resizing is enabled." );
756 return 1;
757 }
758  
759 $title->move_clip2_to_clip1;
760  
761 $self->make_previews;
762  
763 1;
764 }
765  
766 sub calc_zoom {
767 my $self = shift;
768 my %par = @_;
769 my ( $width, $height ) = @par{ 'width', 'height' };
770  
771 my $title = $self->selected_title;
772 return 1 if not $title;
773  
774 if ( not $title->is_ripped ) {
775 $self->message_window(
776 message => __ "You first have to rip this title." );
777 return 1;
778 }
779  
780 $title->calc_zoom(
781 width => $width,
782 height => $height,
783 );
784  
785 $self->make_previews;
786  
787 1;
788 }
789  
790 sub open_zoom_calculator {
791 my $self = shift;
792  
793 my $title = $self->selected_title;
794 return 1 if not $title;
795  
796 if ( not $title->is_ripped ) {
797 $self->message_window(
798 message => __ "You first have to rip this title." );
799 return 1;
800 }
801  
802 require Video::DVDRip::GUI::ZoomCalculator;
803  
804 my $calculator = Video::DVDRip::GUI::ZoomCalculator->new(
805 form_factory => $self->get_form_factory, );
806 $calculator->open_window;
807  
808 1;
809 }
810  
811 1;