Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

GDKImageTransitionRepository Class Reference

Public class for exposing each of the registered transitions through a selectable GUI component (in this case, only an OptionMenu is provided). More...

#include <image_transitions.h>

Inheritance diagram for GDKImageTransitionRepository:

Inheritance graph
[legend]
Collaboration diagram for GDKImageTransitionRepository:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GDKImageTransitionRepository ()
 ~GDKImageTransitionRepository ()
void Register (GDKImageTransition *transition)
 Register an image transition.
void Initialise (GtkOptionMenu *menu, GtkBin *container)
GDKImageTransitionGet () const
void SelectionChange ()
 Handle attach/detach widgets on last selected/selected items.

Private Attributes

vector< GDKImageTransition * > transitions
GDKImageTransitionselected_transition
GtkOptionMenu * menu
GtkBin * container

Detailed Description

Public class for exposing each of the registered transitions through a selectable GUI component (in this case, only an OptionMenu is provided).

Transitions are currently registered in the repositories constructor and added to the OptionMenu provided via the Initialise function.

Additional transitions can be registered before an Initialise call (using the Register method), and Initialise can be called many times if necessary.

Definition at line 107 of file image_transitions.h.


Constructor & Destructor Documentation

GDKImageTransitionRepository::GDKImageTransitionRepository  ) 
 

Definition at line 455 of file image_transitions.cc.

References Register().

00456     : selected_transition( 0 )
00457 {
00458     // Register an instance of each object (adapting raw transitions to GDK transitions where necessary)
00459     Register( new ImageTransitionFade() );
00460     Register( new ImageTransitionBarnDoorWipe() );
00461     Register( new ImageTransitionDifferences() );
00462     Register( new ImageTransitionNone() );
00463     Register( new ImageTransitionBarWipe() );
00464     Register( new ImageTransitionSwitch() );
00465 }

GDKImageTransitionRepository::~GDKImageTransitionRepository  ) 
 

Definition at line 467 of file image_transitions.cc.

References transitions.

00468 {
00469     // Remove the transitions in the repository
00470     for ( unsigned int index = 0; index < transitions.size(); index ++ )
00471         delete transitions[ index ];
00472 }


Member Function Documentation

GDKImageTransition * GDKImageTransitionRepository::Get  )  const
 

Definition at line 505 of file image_transitions.cc.

References menu, and transitions.

Referenced by PageMagick::GetImageTransition(), and SelectionChange().

00506 {
00507     GtkMenu * innerMenu = GTK_MENU( gtk_option_menu_get_menu( menu ) );
00508     GtkWidget *active_item = gtk_menu_get_active( innerMenu );
00509     return transitions[ g_list_index( GTK_MENU_SHELL( innerMenu ) ->children, active_item ) ];
00510 }

void GDKImageTransitionRepository::Initialise GtkOptionMenu *  menu,
GtkBin *  container
 

Definition at line 483 of file image_transitions.cc.

References on_optionmenu_selected(), SelectionChange(), and transitions.

Referenced by PageMagick::PageMagick().

00484 {
00485     // Store these for future reference
00486     this->menu = menu;
00487     this->container = container;
00488 
00489     // Add the transitions to the menu
00490     GtkMenu *menu_new = GTK_MENU( gtk_menu_new( ) );
00491     for ( unsigned int index = 0; index < transitions.size(); index ++ )
00492     {
00493         GtkWidget *item = gtk_menu_item_new_with_label( transitions[ index ] ->GetDescription( ) );
00494         gtk_widget_show( item );
00495         gtk_menu_append( menu_new, item );
00496         g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( on_optionmenu_selected ), this );
00497     }
00498     gtk_menu_set_active( menu_new, 0 );
00499     gtk_option_menu_set_menu( menu, GTK_WIDGET( menu_new ) );
00500 
00501     // Register the selected items widgets
00502     SelectionChange();
00503 }

void GDKImageTransitionRepository::Register GDKImageTransition transition  ) 
 

Register an image transition.

Definition at line 477 of file image_transitions.cc.

References ImageTransition::GetDescription(), and transitions.

Referenced by GDKImageTransitionRepository(), and PluginImageTransitionRepository::InstallPlugins().

00478 {
00479     std::cerr << ">>> Image Transition: " << transition->GetDescription() << std::endl;
00480     transitions.push_back( transition );
00481 }

void GDKImageTransitionRepository::SelectionChange  ) 
 

Handle attach/detach widgets on last selected/selected items.

Definition at line 515 of file image_transitions.cc.

References GDKImageTransition::AttachWidgets(), common, container, GDKImageTransition::DetachWidgets(), Get(), KinoCommon::getPageMagick(), PageMagick::IsPreviewing(), LOCKED_KEY, selected_transition, and PageMagick::StopPreview().

Referenced by Initialise().

00516 {
00517     bool isPreviewing = false;
00518     PageMagick* magick = 0;
00519 
00520     if ( common && common->getPageMagick( ) )
00521         magick = common->getPageMagick( );
00522     if ( magick && magick->IsPreviewing() )
00523     {
00524         isPreviewing = true;
00525         magick->StopPreview();
00526     }
00527 
00528     // Detach the selected Transitions widgets
00529     if ( selected_transition != NULL )
00530         selected_transition->DetachWidgets( container );
00531 
00532     if ( magick )
00533     {
00534         magick->SetKeyFrameControllerClient(0);
00535         magick->ShowCurrentStatus( magick->GetCurrentPosition(), LOCKED_KEY, false, false );
00536     }
00537 
00538     // Get the new selection
00539     selected_transition = Get();
00540 
00541     // Attach the new transition widgets
00542     if ( selected_transition != NULL )
00543         selected_transition->AttachWidgets( container );
00544 
00545     if ( magick )
00546     {
00547         if ( isPreviewing )
00548             magick->StartPreview();
00549         else
00550             magick->PreviewFrame();
00551     }
00552 }


Member Data Documentation

GtkBin* GDKImageTransitionRepository::container [private]
 

Definition at line 113 of file image_transitions.h.

Referenced by SelectionChange().

GtkOptionMenu* GDKImageTransitionRepository::menu [private]
 

Definition at line 112 of file image_transitions.h.

Referenced by Get().

GDKImageTransition* GDKImageTransitionRepository::selected_transition [private]
 

Definition at line 111 of file image_transitions.h.

Referenced by SelectionChange().

vector<GDKImageTransition *> GDKImageTransitionRepository::transitions [private]
 

Definition at line 110 of file image_transitions.h.

Referenced by Get(), Initialise(), Register(), and ~GDKImageTransitionRepository().


The documentation for this class was generated from the following files:
Generated on Sun Mar 11 22:13:00 2007 for Kino by  doxygen 1.4.2