#include <image_filters.h>
Inheritance diagram for GDKImageFilterRepository:


Public Member Functions | |
| GDKImageFilterRepository () | |
| Constructor for the image filter repository. | |
| ~GDKImageFilterRepository () | |
| Destructor for the image repository - clears all the registered filters. | |
| void | Register (GDKImageFilter *filter) |
| Register an image filter. | |
| void | Initialise (GtkOptionMenu *menu, GtkBin *container) |
| Initialise the option menu with the current list of registered filters. | |
| GDKImageFilter * | Get () const |
| Get the currently selected image filter. | |
| void | SelectionChange () |
| Handle attach/detach widgets on last selected/selected items. | |
Private Attributes | |
| vector< GDKImageFilter * > | filters |
| GDKImageFilter * | selected_filter |
| GtkOptionMenu * | menu |
| GtkBin * | container |
Filters are currently registered in the repositories constructor and added to the OptionMenu provided via the Initialise function.
Additional filters can be registered before an Initialise call (using the Register method), and Initialise can be called many times if necessary.
Definition at line 120 of file image_filters.h.
|
|
Constructor for the image filter repository. Registers an instance of each known filter for later GUI exposure via the Initialise method. Definition at line 557 of file image_filters.cc. References Register(). 00558 : selected_filter( 0 ) 00559 { 00560 // Register an instance of each object (adapting raw filters to GDK filters where necessary) 00561 Register( new ImageFilterKeep() ); 00562 Register( new GDKImageFilterAdapter( new ImageFilterBlackWhite() ) ); 00563 Register( new ImageFilterKaleidoscope() ); 00564 Register( new GDKImageFilterAdapter( new ImageFilterFadeIn() ) ); 00565 Register( new GDKImageFilterAdapter( new ImageFilterFadeOut() ) ); 00566 Register( new ImageFilterSwap() ); 00567 Register( new ImageFilterMirror() ); 00568 Register( new GDKImageFilterAdapter( new ImageFilterReverseVideo() ) ); 00569 Register( new GDKImageFilterAdapter( new ImageFilterSepia() ) ); 00570 }
|
|
|
Destructor for the image repository - clears all the registered filters.
Definition at line 575 of file image_filters.cc. References filters. 00576 {
00577 // Remove the filters in the repository
00578 for ( unsigned int index = 0; index < filters.size(); index ++ )
00579 delete filters[ index ];
00580 }
|
|
|
Get the currently selected image filter.
Definition at line 619 of file image_filters.cc. Referenced by PageMagick::GetImageFilter(), and SelectionChange(). 00620 {
00621 GtkMenu * filterMenu = GTK_MENU( gtk_option_menu_get_menu( menu ) );
00622 GtkWidget *active_item = gtk_menu_get_active( filterMenu );
00623 return filters[ g_list_index( GTK_MENU_SHELL( filterMenu ) ->children, active_item ) ];
00624 }
|
|
||||||||||||
|
Initialise the option menu with the current list of registered filters.
Definition at line 594 of file image_filters.cc. References filters, on_optionmenu_selected(), and SelectionChange(). Referenced by PageMagick::PageMagick(). 00595 {
00596 // Store these for future reference
00597 this->menu = menu;
00598 this->container = container;
00599
00600 // Add the filters to the menu
00601 GtkMenu *menu_new = GTK_MENU( gtk_menu_new( ) );
00602 for ( unsigned int index = 0; index < filters.size(); index ++ )
00603 {
00604 GtkWidget *item = gtk_menu_item_new_with_label( filters[ index ] ->GetDescription( ) );
00605 gtk_widget_show( item );
00606 gtk_menu_append( menu_new, item );
00607 g_signal_connect( G_OBJECT( item ), "activate", G_CALLBACK( on_optionmenu_selected ), this );
00608 }
00609 gtk_menu_set_active( menu_new, 0 );
00610 gtk_option_menu_set_menu( menu, GTK_WIDGET( menu_new ) );
00611
00612 // Register the selected items widgets
00613 SelectionChange();
00614 }
|
|
|
Register an image filter.
Definition at line 585 of file image_filters.cc. References filters, and ImageFilter::GetDescription(). Referenced by GDKImageFilterRepository(), and PluginImageFilterRepository::InstallPlugins(). 00586 {
00587 std::cerr << ">>> Image Filter: " << filter->GetDescription( ) << std::endl;
00588 filters.push_back( filter );
00589 }
|
|
|
Handle attach/detach widgets on last selected/selected items.
Definition at line 629 of file image_filters.cc. References GDKImageFilter::AttachWidgets(), common, container, GDKImageFilter::DetachWidgets(), Get(), KinoCommon::getPageMagick(), PageMagick::IsPreviewing(), LOCKED_KEY, selected_filter, and PageMagick::StopPreview(). Referenced by Initialise(). 00630 {
00631 bool isPreviewing = false;
00632 PageMagick* magick = 0;
00633
00634 if ( common && common->getPageMagick( ) )
00635 magick = common->getPageMagick( );
00636 if ( magick && magick->IsPreviewing() )
00637 {
00638 isPreviewing = true;
00639 magick->StopPreview();
00640 }
00641
00642 // Detach the selected filters widgets
00643 if ( selected_filter != NULL )
00644 selected_filter->DetachWidgets( container );
00645
00646 if ( magick )
00647 {
00648 magick->SetKeyFrameControllerClient(0);
00649 magick->ShowCurrentStatus( magick->GetCurrentPosition(), LOCKED_KEY, false, false );
00650 }
00651
00652 // Get the new selection
00653 selected_filter = Get();
00654
00655 // Attach the new filters widgets
00656 if ( selected_filter != NULL )
00657 selected_filter->AttachWidgets( container );
00658
00659 if ( magick )
00660 {
00661 if ( isPreviewing )
00662 magick->StartPreview();
00663 else
00664 magick->PreviewFrame();
00665 }
00666 }
|
|
|
Definition at line 126 of file image_filters.h. Referenced by SelectionChange(). |
|
|
Definition at line 123 of file image_filters.h. Referenced by Get(), Initialise(), Register(), and ~GDKImageFilterRepository(). |
|
|
Definition at line 125 of file image_filters.h. Referenced by Get(). |
|
|
Definition at line 124 of file image_filters.h. Referenced by SelectionChange(). |
1.4.2