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

GDKAudioTransitionRepository 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 <audio_transitions.h>

Inheritance diagram for GDKAudioTransitionRepository:

Inheritance graph
[legend]
Collaboration diagram for GDKAudioTransitionRepository:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GDKAudioTransitionRepository ()
 Constructor for the audio transition repository.
 ~GDKAudioTransitionRepository ()
 Destructor for the image repository - clears all the registered transitions.
void Register (GDKAudioTransition *transition)
 Register an audio transition.
void Initialise (GtkOptionMenu *menu, GtkBin *container)
 Initialise the option menu with the current list of registered transitions.
GDKAudioTransitionGet () const
 Get the currently selected audio transition.
void SelectionChange ()
 Handle attach/detach widgets on last selected/selected items.

Private Attributes

vector< GDKAudioTransition * > transitions
GDKAudioTransitionselected_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.

The Initialise method is called with the menu to contain the selectable entries and a container for the transition specific widget handling.

Definition at line 127 of file audio_transitions.h.


Constructor & Destructor Documentation

GDKAudioTransitionRepository::GDKAudioTransitionRepository  ) 
 

Constructor for the audio transition repository.

Registers an instance of each known transition for later GUI exposure via the Initialise method.

Definition at line 143 of file audio_transitions.cc.

References Register().

00143                                                            : selected_transition( NULL ), menu( NULL ), container( NULL )
00144 {
00145     // Register an instance of each object (adapting raw transitions to GDK transitions where necessary)
00146     Register( new AudioSwitch() );
00147     Register( new AudioNone() );
00148 }

GDKAudioTransitionRepository::~GDKAudioTransitionRepository  ) 
 

Destructor for the image repository - clears all the registered transitions.

Definition at line 153 of file audio_transitions.cc.

References transitions.

00154 {
00155     // Remove the transitions in the repository
00156     for ( unsigned int index = 0; index < transitions.size(); index ++ )
00157         delete transitions[ index ];
00158 }


Member Function Documentation

GDKAudioTransition * GDKAudioTransitionRepository::Get  )  const
 

Get the currently selected audio transition.

Definition at line 197 of file audio_transitions.cc.

References menu, and transitions.

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

00198 {
00199     GtkMenu * transitionMenu = GTK_MENU( gtk_option_menu_get_menu( menu ) );
00200     GtkWidget *active_item = gtk_menu_get_active( transitionMenu );
00201     return transitions[ g_list_index( GTK_MENU_SHELL( transitionMenu ) ->children, active_item ) ];
00202 }

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

Initialise the option menu with the current list of registered transitions.

Definition at line 172 of file audio_transitions.cc.

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

Referenced by PageMagick::PageMagick().

00173 {
00174     // Store these for future reference
00175     this->menu = menu;
00176     this->container = container;
00177 
00178     // Add the transitions to the menu
00179     GtkMenu *menu_new = GTK_MENU( gtk_menu_new( ) );
00180     for ( unsigned int index = 0; index < transitions.size(); index ++ )
00181     {
00182         GtkWidget *item = gtk_menu_item_new_with_label( transitions[ index ] ->GetDescription( ) );
00183         gtk_widget_show( item );
00184         gtk_menu_append( menu_new, item );
00185         g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( on_optionmenu_selected ), this );
00186     }
00187     gtk_menu_set_active( menu_new, 0 );
00188     gtk_option_menu_set_menu( menu, GTK_WIDGET( menu_new ) );
00189 
00190     // Register the selected items widgets
00191     SelectionChange();
00192 }

void GDKAudioTransitionRepository::Register GDKAudioTransition transition  ) 
 

Register an audio transition.

Definition at line 163 of file audio_transitions.cc.

References AudioTransition::GetDescription(), and transitions.

Referenced by GDKAudioTransitionRepository(), and PluginAudioTransitionRepository::InstallPlugins().

00164 {
00165     std::cerr << ">>> Audio Transition: " << transition->GetDescription() << std::endl;
00166     transitions.push_back( transition );
00167 }

void GDKAudioTransitionRepository::SelectionChange  ) 
 

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

Definition at line 207 of file audio_transitions.cc.

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

Referenced by Initialise(), and PageMagick::start().

00208 {
00209     bool isPreviewing = false;
00210     PageMagick* magick = 0;
00211 
00212     if ( common && common->getPageMagick( ) )
00213         magick = common->getPageMagick( );
00214     if ( magick && magick->IsPreviewing() )
00215     {
00216         isPreviewing = true;
00217         magick->StopPreview();
00218     }
00219 
00220     // Detach the selected transitions widgets
00221     if ( selected_transition != NULL )
00222         selected_transition->DetachWidgets( container );
00223 
00224     // Get the new selection
00225     selected_transition = Get();
00226 
00227     // Attach the new transitions widgets
00228     if ( selected_transition != NULL )
00229         selected_transition->AttachWidgets( container );
00230 
00231     if ( magick )
00232     {
00233         if ( isPreviewing )
00234             magick->StartPreview();
00235         else
00236             magick->PreviewFrame();
00237     }
00238 }


Member Data Documentation

GtkBin* GDKAudioTransitionRepository::container [private]
 

Definition at line 133 of file audio_transitions.h.

Referenced by SelectionChange().

GtkOptionMenu* GDKAudioTransitionRepository::menu [private]
 

Definition at line 132 of file audio_transitions.h.

Referenced by Get().

GDKAudioTransition* GDKAudioTransitionRepository::selected_transition [private]
 

Definition at line 131 of file audio_transitions.h.

Referenced by SelectionChange().

vector<GDKAudioTransition *> GDKAudioTransitionRepository::transitions [private]
 

Definition at line 130 of file audio_transitions.h.

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


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