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

PageEditor Class Reference

This class controls the editor notebook page. More...

#include <page_editor.h>

Inheritance diagram for PageEditor:

Inheritance graph
[legend]
Collaboration diagram for PageEditor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PageEditor (KinoCommon *common)
 Constructor for the page editor object.
virtual ~PageEditor ()
 Destructor for the page editor object.
FrameDisplayergetFrameDisplayer ()
gulong activate ()
 Activate the returned widgets.
void newFile ()
 New File action.
void start ()
 Start action.
void clean ()
 Clean action.
gboolean processKeyboard (GdkEventKey *event)
 Process a keyboard event.
gboolean processCommand (char *)
 Internal method for handling a complete keyboard scene.
void selectScene (int)
 Move to start of selected scene.
void videoStartOfMovie ()
 Move to the start of the movie.
void videoPreviousScene ()
 Move to the start of the previous scene.
void videoStartOfScene ()
 Move to the start of the current scene.
void videoRewind ()
 Rewind.
void videoBack (int step=-1)
 Move one frame back.
void videoPlay ()
 Play.
void videoForward (int step=1)
 Move one frame forward.
void videoFastForward ()
 Fast forward.
void videoShuttle (int)
 Shuttle.
void videoNextScene ()
 Move to the start of the next scene.
void videoEndOfScene ()
 Move to the end of the current scene.
void videoEndOfMovie ()
 Move to the end of the play list.
void videoPause ()
 Pause.
void videoStop ()
 Stop.
void startNavigator ()
 Starts the navigator thread.
void stopNavigator ()
 Stops the navigator thread.
void movedToFrame (int frame)
 Called when the current frame has changed through the common moveToFrame method and this page is the current page.
void showFrame (int, gboolean)
 Show the frame requested.
void showFrame (int, Frame &)
void windowMoved ()
void showFrameInfo (int)
void showFrameInfo (int, Frame &)
void DrawBar (int currentFrame)
void ResetBar ()
vector< int > GetScene ()
void snapshot ()
void CopyFrames (int, int)
 Copy the requested frames to the playlist buffer.
void PasteFrames (int)
 Paste the playlist buffer before the specified frame.
void DeleteFrames (int, int)
 Delete and copy the requested frames to the playlist buffer.
std::string getHelpPage ()

Private Attributes

KinoCommoncommon
FrameDisplayerdisplayer
GtkDrawingArea * frameArea
GtkLabel * positionLabelCurrent
GtkLabel * positionLabelTotal
GtkWidget * scrubBar
GtkAdjustment * scrubAdjustment
int lastFrameShown
gint idleCommand
gboolean idleCommandActive
GArray * sceneIndex
vector< int > sceneStartList
PlayListg_copiedPlayList

Detailed Description

This class controls the editor notebook page.

Definition at line 36 of file page_editor.h.


Constructor & Destructor Documentation

PageEditor::PageEditor KinoCommon common  ) 
 

Constructor for the page editor object.

Parameters:
common KinCommon object to which this page belongs

Definition at line 108 of file page_editor.cc.

References frameArea, g_copiedPlayList, KinoCommon::getWidget(), gtk_enhanced_scale_new(), lastFrameShown, lookup_widget(), on_scrub_bar_button_press_event(), on_scrub_bar_button_release_event(), on_scrub_bar_value_changed_event(), positionLabelCurrent, positionLabelTotal, sceneIndex, scrubAdjustment, and scrubBar.

00109 {
00110     cerr << "> Creating page editor" << endl;
00111     this->common = common;
00112 
00113     this->frameArea = GTK_DRAWING_AREA( lookup_widget( common->getWidget(), "drawingarea1" ) );
00114     gtk_widget_set_double_buffered( GTK_WIDGET( frameArea ), FALSE );
00115     this->positionLabelCurrent = GTK_LABEL( lookup_widget( common->getWidget(), "position_label_current" ) );
00116     this->positionLabelTotal = GTK_LABEL( lookup_widget( common->getWidget(), "position_label_total" ) );
00117     this->lastFrameShown = -1;
00118     this->g_copiedPlayList = new PlayList();
00119 
00120     scrubAdjustment = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 0, 1, 10, 0 ) );
00121     g_signal_connect( G_OBJECT( scrubAdjustment ), "value_changed",
00122                       G_CALLBACK( on_scrub_bar_value_changed_event ), NULL );
00123 
00124     scrubBar = gtk_enhanced_scale_new( ( GtkObject** ) & scrubAdjustment, 1 );
00125     sceneIndex = g_array_new( FALSE, FALSE, sizeof( int ) );
00126     gtk_widget_set_name( scrubBar, "scrubBar" );
00127     gtk_widget_ref( scrubBar );
00128     gtk_object_set_data_full( GTK_OBJECT( common->getWidget() ), "scrubBar", scrubBar,
00129                               ( GtkDestroyNotify ) gtk_widget_unref );
00130     GtkWidget *vbox_edit = lookup_widget( common->getWidget(), "vbox58" );
00131     gtk_widget_show( scrubBar );
00132     gtk_box_pack_start( GTK_BOX( vbox_edit ), scrubBar, FALSE, TRUE, 0 );
00133     g_signal_connect( G_OBJECT( scrubBar ), "button_press_event",
00134                       G_CALLBACK( on_scrub_bar_button_press_event ), NULL );
00135     g_signal_connect( G_OBJECT( scrubBar ), "button_release_event",
00136                       G_CALLBACK( on_scrub_bar_button_release_event ), NULL );
00137 
00138 }

PageEditor::~PageEditor  )  [virtual]
 

Destructor for the page editor object.

Definition at line 143 of file page_editor.cc.

References g_copiedPlayList, and sceneIndex.

00144 {
00145     cerr << "> Destroying page editor" << endl;
00146     delete this->g_copiedPlayList;
00147     if ( sceneIndex != NULL )
00148         g_array_free( sceneIndex, TRUE );
00149 }


Member Function Documentation

gulong PageEditor::activate  )  [virtual]
 

Activate the returned widgets.

Reimplemented from Page.

Definition at line 207 of file page_editor.cc.

References EDIT_MENU, INFO_FRAME, SCENE_LIST, VIDEO_BACK, VIDEO_END_OF_MOVIE, VIDEO_FAST_FORWARD, VIDEO_FORWARD, VIDEO_NEXT_SCENE, VIDEO_PAUSE, VIDEO_PLAY, VIDEO_REWIND, VIDEO_SHUTTLE, VIDEO_START_OF_MOVIE, VIDEO_START_OF_SCENE, and VIDEO_STOP.

00208 {
00209     return EDIT_MENU |
00210            SCENE_LIST |
00211            VIDEO_START_OF_MOVIE |
00212            VIDEO_START_OF_SCENE |
00213            VIDEO_REWIND |
00214            VIDEO_BACK |
00215            VIDEO_PLAY |
00216            VIDEO_PAUSE |
00217            VIDEO_STOP |
00218            VIDEO_FORWARD |
00219            VIDEO_FAST_FORWARD |
00220            VIDEO_NEXT_SCENE |
00221            VIDEO_END_OF_MOVIE |
00222            VIDEO_SHUTTLE |
00223            INFO_FRAME;
00224 }

void PageEditor::clean  )  [virtual]
 

Clean action.

Called when another page becomes current.

Reimplemented from Page.

Definition at line 229 of file page_editor.cc.

References common, displayer, frameContent, GetFramePool(), KinoCommon::getWidget(), lookup_widget(), PLAYBACK_FRAMES, stopNavigator(), and writer1394.

00230 {
00231     cerr << ">> Leaving Editor" << endl;
00232     stopNavigator();
00233     delete displayer;
00234     displayer = 0;
00235     delete writer1394;
00236     writer1394 = NULL;
00237     for ( int i = 0; i < PLAYBACK_FRAMES; i ++ )
00238         GetFramePool( ) ->DoneWithFrame( frameContent[ i ] );
00239     gtk_check_menu_item_set_active( GTK_CHECK_MENU_ITEM( lookup_widget( common->getWidget(), "menuitem_editor" ) ), FALSE );
00240     cerr << ">> Left Editor" << endl;
00241 }

void PageEditor::CopyFrames int  first,
int  last
 

Copy the requested frames to the playlist buffer.

Parameters:
first first frame
last last frame

Definition at line 1224 of file page_editor.cc.

References common, g_copiedPlayList, KinoCommon::getPlayList(), PlayList::SetDirty(), and PlayList::SetDocName().

Referenced by processCommand().

01225 {
01226     PlayList * playList = new PlayList;
01227 
01228     // Delete the old list
01229     delete g_copiedPlayList;
01230     // Create the one requested
01231     common->getPlayList() ->GetPlayList( first, last, *playList );
01232     g_copiedPlayList = playList;
01233     playList->SetDocName( "" );
01234     playList->SetDirty( true );
01235 }

void PageEditor::DeleteFrames int  first,
int  last
 

Delete and copy the requested frames to the playlist buffer.

Parameters:
first first frame
last last frame

Definition at line 1261 of file page_editor.cc.

References common, GetEditorBackup(), KinoCommon::getPlayList(), KinoCommon::hasListChanged, and KinoCommon::setWindowTitle().

Referenced by processCommand().

01262 {
01263     int before, after;
01264 
01265     before = common->getPlayList() ->GetNumFrames();
01266     if ( common->getPlayList() ->Delete( first, last ) )
01267     {
01268         after = common->getPlayList() ->GetNumFrames();
01269         common->hasListChanged = TRUE;
01270         GetEditorBackup() ->Store( common->getPlayList() );
01271     }
01272     common->setWindowTitle( );
01273 }

void PageEditor::DrawBar int  currentFrame  ) 
 

Definition at line 1347 of file page_editor.cc.

References common, KinoCommon::hasListChanged, ResetBar(), and scrubAdjustment.

Referenced by processCommand(), and showFrame().

01348 {
01349     if ( common->hasListChanged == TRUE )
01350     {
01351         ResetBar();
01352         common->hasListChanged = FALSE;
01353     }
01354     if ( currentFrame > -1 )
01355         gtk_adjustment_set_value( scrubAdjustment, ( gfloat ) currentFrame );
01356 }

FrameDisplayer* PageEditor::getFrameDisplayer  )  [inline]
 

Definition at line 63 of file page_editor.h.

References displayer.

Referenced by showFrame(), and stopNavigator().

00064     {
00065         return this->displayer;
00066     }

std::string PageEditor::getHelpPage  )  [inline, virtual]
 

Reimplemented from Page.

Definition at line 109 of file page_editor.h.

00110     {
00111         return "edit";
00112     }

vector< int > PageEditor::GetScene  ) 
 

Definition at line 1386 of file page_editor.cc.

References sceneStartList.

Referenced by selectScene().

01387 {
01388     return sceneStartList;
01389 }

void PageEditor::movedToFrame int  frame  )  [virtual]
 

Called when the current frame has changed through the common moveToFrame method and this page is the current page.

Parameters:
frame frame moved to

Reimplemented from Page.

Definition at line 279 of file page_editor.cc.

References navigate_control::active, common, KinoCommon::g_currentFrame, g_nav_ctl, Preferences::getInstance(), lastFrameShown, showFrame(), startNavigator(), and stopNavigator().

00280 {
00281     if ( g_nav_ctl.active == FALSE )
00282     {
00283         showFrame( frame, ( frame == lastFrameShown ) || ( Preferences::getInstance().audioScrub == FALSE ) );
00284     }
00285     else
00286     {
00287         stopNavigator();
00288         common->g_currentFrame = frame;
00289         startNavigator();
00290     }
00291 }

void PageEditor::newFile  )  [virtual]
 

New File action.

Reimplemented from Page.

Definition at line 154 of file page_editor.cc.

References common, frameArea, KinoCommon::loadSplash(), ResetBar(), and stopNavigator().

00155 {
00156     this->stopNavigator();
00157     common->loadSplash( frameArea );
00158     this->ResetBar( );
00159 }

void PageEditor::PasteFrames int  before  ) 
 

Paste the playlist buffer before the specified frame.

Parameters:
before frame

Definition at line 1243 of file page_editor.cc.

References common, g_copiedPlayList, GetEditorBackup(), KinoCommon::getPlayList(), KinoCommon::hasListChanged, and KinoCommon::setWindowTitle().

Referenced by processCommand().

01244 {
01245     PlayList temp( *g_copiedPlayList );
01246 
01247     if ( common->getPlayList() ->InsertPlayList( temp, before ) )
01248     {
01249         common->hasListChanged = TRUE;
01250         GetEditorBackup() ->Store( common->getPlayList() );
01251     }
01252     common->setWindowTitle( );
01253 }

gboolean PageEditor::processCommand char *  command  )  [virtual]
 

Internal method for handling a complete keyboard scene.

Parameters:
cmd command to be processed;

Reimplemented from Page.

Definition at line 708 of file page_editor.cc.

References _getOneSecond(), navigate_control::active, KinoCommon::appendFile(), CAPTURE_FRAME_APPEND, CAPTURE_MOVIE_APPEND, KinoCommon::changePageRequest(), cmd, common, CopyFrames(), count, DeleteFrames(), DrawBar(), KinoCommon::g_currentFrame, g_nav_ctl, GetEditorBackup(), FileTracker::GetInstance(), KinoCommon::getPlayList(), KinoCommon::hasListChanged, KinoCommon::insertFile(), KinoCommon::keyboardFeedback(), kinoDeactivate(), lastcmd, KinoCommon::moveByFrames(), KinoCommon::moveToFrame(), PAGE_CAPTURE, PAGE_EXPORT, PAGE_MAGICK, PAGE_TIMELINE, PAGE_TRIM, PasteFrames(), KinoCommon::savePlayList(), KinoCommon::setStatusBar(), KinoCommon::setWindowTitle(), start(), KinoCommon::videoEndOfMovie(), KinoCommon::videoEndOfScene(), KinoCommon::videoNextScene(), KinoCommon::videoPause(), KinoCommon::videoPlay(), KinoCommon::videoPreviousScene(), KinoCommon::videoStartOfMovie(), KinoCommon::videoStartOfScene(), and KinoCommon::videoStop().

Referenced by processKeyboard().

00709 {
00710     int start, end;
00711     int count = 1;
00712     char real[ 256 ] = "";
00713 
00714     strcpy( cmd, command );
00715 
00716     switch ( sscanf( cmd, "%d%s", &count, real ) )
00717     {
00718     case 1:
00719         // Numeric value only - return immediately if the cmd is not "0"
00720         if ( strcmp( cmd, "0" ) )
00721         {
00722             common->keyboardFeedback( cmd, "" );
00723             return FALSE;
00724         }
00725         break;
00726     case 0:
00727         sscanf( cmd, "%s", real );
00728         count = 1;
00729         break;
00730     }
00731 
00732     if ( strcmp( cmd, "." ) )
00733         strcpy( lastcmd, cmd );
00734 
00735     /* Navigation */
00736 
00737     /* play, pause */
00738 
00739     if ( strcmp( cmd, " " ) == 0 )
00740     {
00741         if ( g_nav_ctl.active == FALSE )
00742         {
00743             common->keyboardFeedback( cmd, _( "Play" ) );
00744             common->videoPlay( );
00745         }
00746         else
00747         {
00748             common->keyboardFeedback( cmd, _( "Pause" ) );
00749             common->videoPause( );
00750         }
00751         cmd[ 0 ] = 0;
00752     }
00753 
00754     else if ( strcmp( real, "Esc" ) == 0 )
00755     {
00756         common->keyboardFeedback( cmd, _( "Stop" ) );
00757         common->videoStop( );
00758         cmd[ 0 ] = 0;
00759     }
00760 
00761     /* advance one frame */
00762 
00763     else if ( strcmp( real, "l" ) == 0 )
00764     {
00765         common->keyboardFeedback( cmd, _( "Move forward" ) );
00766         common->moveByFrames( count );
00767         cmd[ 0 ] = 0;
00768     }
00769 
00770     /* backspace one frame */
00771 
00772     else if ( strcmp( real, "h" ) == 0 )
00773     {
00774         common->keyboardFeedback( cmd, _( "Move backward" ) );
00775         common->moveByFrames( 0 - count );
00776         cmd[ 0 ] = 0;
00777     }
00778 
00779     /* advance one second */
00780 
00781     else if ( strcmp( real, "w" ) == 0 || strcmp( real, "W" ) == 0 ||
00782               strcmp( real, "e" ) == 0 || strcmp( real, "E" ) == 0 )
00783     {
00784         common->keyboardFeedback( cmd, _( "Move forward second" ) );
00785         common->moveByFrames( count * _getOneSecond() );
00786         cmd[ 0 ] = 0;
00787     }
00788 
00789     /* backspace one second */
00790 
00791     else if ( ( strcmp( real, "b" ) == 0 ) || ( strcmp( real, "B" ) == 0 ) )
00792     {
00793         common->keyboardFeedback( cmd, _( "Move backwards one second" ) );
00794         common->moveByFrames( 0 - count * _getOneSecond() );
00795         cmd[ 0 ] = 0;
00796     }
00797 
00798     /* start of scene */
00799 
00800     else if ( ( strcmp( cmd, "0" ) == 0 ) || ( strcmp( real, "^" ) == 0 ) )
00801     {
00802         common->videoStartOfScene( );
00803         for ( ; count > 1 && common->g_currentFrame > 0; count -- )
00804         {
00805             common->g_currentFrame --;
00806             common->videoStartOfScene( );
00807         }
00808         common->keyboardFeedback( cmd, _( "Move to start of scene" ) );
00809         cmd[ 0 ] = 0;
00810     }
00811 
00812     /* end of scene */
00813 
00814     else if ( strcmp( real, "$" ) == 0 )
00815     {
00816         common->videoEndOfScene( );
00817         for ( ; count > 1 && common->g_currentFrame < common->getPlayList() ->GetNumFrames() - 1; count -- )
00818         {
00819             common->g_currentFrame ++;
00820             common->videoEndOfScene( );
00821         }
00822         common->keyboardFeedback( cmd, _( "Move to end of scene" ) );
00823         cmd[ 0 ] = 0;
00824     }
00825 
00826     /* start of next scene */
00827 
00828     else if ( ( strcmp( real, "j" ) == 0 ) || strcmp( real, "+" ) == 0 )
00829     {
00830         for ( ; count >= 1 && common->g_currentFrame < common->getPlayList() ->GetNumFrames() - 1; count -- )
00831             common->videoNextScene( );
00832         common->keyboardFeedback( cmd, _( "Move to start of next scene" ) );
00833         cmd[ 0 ] = 0;
00834     }
00835 
00836     /* start of previous scene */
00837 
00838     else if ( ( strcmp( real, "k" ) == 0 ) || ( strcmp( real, "-" ) == 0 ) )
00839     {
00840         for ( ; count >= 1 && common->g_currentFrame > 0; count -- )
00841             common->videoPreviousScene( );
00842         common->keyboardFeedback( cmd, _( "Move to start of previous scene" ) );
00843         cmd[ 0 ] = 0;
00844     }
00845 
00846     /* first frame */
00847 
00848     else if ( strcmp( cmd, "gg" ) == 0 )
00849     {
00850         common->videoStartOfMovie( );
00851         common->keyboardFeedback( cmd, _( "Move to first frame" ) );
00852         cmd[ 0 ] = 0;
00853     }
00854 
00855     /* last frame */
00856 
00857     else if ( strcmp( cmd, "G" ) == 0 )
00858     {
00859         common->videoEndOfMovie( );
00860         common->keyboardFeedback( cmd, _( "Move to last frame" ) );
00861         cmd[ 0 ] = 0;
00862     }
00863 
00864     /* delete current frame */
00865 
00866     else if ( ( strcmp( real, "x" ) == 0 ) || ( strcmp( cmd, "d " ) == 0 ) || ( strcmp( real, "dl" ) == 0 ) )
00867     {
00868         CopyFrames( common->g_currentFrame, common->g_currentFrame + count - 1 );
00869         DeleteFrames( common->g_currentFrame, common->g_currentFrame + count - 1 );
00870         common->moveToFrame( );
00871         common->keyboardFeedback( cmd, _( "Cut current frame" ) );
00872         DrawBar( common->g_currentFrame );
00873         cmd[ 0 ] = 0;
00874     }
00875 
00876     /* delete one second */
00877 
00878     else if ( strcmp( cmd, "dw" ) == 0 )
00879     {
00880         end = common->g_currentFrame + _getOneSecond() - 1;
00881         CopyFrames( common->g_currentFrame, end );
00882         DeleteFrames( common->g_currentFrame, end );
00883         common->moveToFrame( );
00884         common->keyboardFeedback( cmd, _( "Cut one second" ) );
00885         DrawBar( common->g_currentFrame );
00886         cmd[ 0 ] = 0;
00887     }
00888 
00889     /* delete current scene */
00890 
00891     else if ( strcmp( real, "dd" ) == 0 )
00892     {
00893         start = common->getPlayList() ->FindStartOfScene( common->g_currentFrame );
00894         end = start;
00895         for ( ; count >= 1 && end <= common->getPlayList() ->GetNumFrames() - 1; count -- )
00896         {
00897             end = common->getPlayList() ->FindEndOfScene( end );
00898             end ++;
00899         }
00900         CopyFrames( start, end - 1 );
00901         DeleteFrames( start, end - 1 );
00902         common->moveToFrame( start );
00903         common->keyboardFeedback( cmd, _( "Cut current scene" ) );
00904         DrawBar( common->g_currentFrame );
00905         cmd[ 0 ] = 0;
00906     }
00907 
00908     /* delete from current frame up to end of scene */
00909 
00910     else if ( ( strcmp( cmd, "o" ) == 0 ) || strcmp( cmd, "d$" ) == 0 )
00911     {
00912         start = common->g_currentFrame;
00913         if ( strcmp( cmd, "o" ) == 0 )
00914             ++start;
00915         end = common->getPlayList() ->FindEndOfScene( common->g_currentFrame );
00916         CopyFrames( start, end );
00917         DeleteFrames( start, end );
00918         common->moveToFrame( );
00919         common->keyboardFeedback( cmd, _( "Cut to end of scene" ) );
00920         DrawBar( common->g_currentFrame );
00921         cmd[ 0 ] = 0;
00922     }
00923 
00924     /* delete from current frame up to end of file */
00925 
00926     else if ( strcmp( cmd, "dG" ) == 0 )
00927     {
00928         end = common->getPlayList() ->GetNumFrames();
00929         CopyFrames( common->g_currentFrame, end );
00930         DeleteFrames( common->g_currentFrame, end );
00931         common->moveByFrames( -1 );
00932         common->keyboardFeedback( cmd, _( "Cut to end of movie" ) );
00933         DrawBar( common->g_currentFrame );
00934         cmd[ 0 ] = 0;
00935     }
00936 
00937     /* delete from start of scene just before current frame */
00938 
00939     else if ( ( strcmp( cmd, "i" ) == 0 ) || ( strcmp( cmd, "d0" ) == 0 ) || strcmp( cmd, "d^" ) == 0 )
00940     {
00941         start = common->getPlayList() ->FindStartOfScene( common->g_currentFrame );
00942         if ( start < common->g_currentFrame )
00943         {
00944             CopyFrames( start, common->g_currentFrame - 1 );
00945             DeleteFrames( start, common->g_currentFrame - 1 );
00946             common->moveToFrame( start );
00947         }
00948         common->keyboardFeedback( cmd, _( "Cut from start of scene" ) );
00949         DrawBar( common->g_currentFrame );
00950         cmd[ 0 ] = 0;
00951     }
00952 
00953     /* delete from start of file just before current frame */
00954 
00955     else if ( strcmp( cmd, "dgg" ) == 0 )
00956     {
00957         CopyFrames( 0, common->g_currentFrame - 1 );
00958         DeleteFrames( 0, common->g_currentFrame - 1 );
00959         common->moveToFrame( 0 );
00960         common->keyboardFeedback( cmd, _( "Cut from start of movie" ) );
00961         DrawBar( common->g_currentFrame );
00962         cmd[ 0 ] = 0;
00963     }
00964 
00965     /* copy current frame */
00966 
00967     else if ( ( strcmp( cmd, "y " ) == 0 ) || ( strcmp( real, "yl" ) == 0 ) )
00968     {
00969         CopyFrames( common->g_currentFrame, common->g_currentFrame + count - 1 );
00970         common->keyboardFeedback( cmd, _( "Copy current frame" ) );
00971         cmd[ 0 ] = 0;
00972     }
00973 
00974     /* copy current scene */
00975 
00976     else if ( ( strcmp( real, "yy" ) == 0 ) || ( strcmp( real, "Y" ) == 0 ) )
00977     {
00978         start = common->getPlayList() ->FindStartOfScene( common->g_currentFrame );
00979         end = start;
00980         for ( ; count >= 1; count -- )
00981         {
00982             end = common->getPlayList() ->FindEndOfScene( end );
00983             end ++;
00984         }
00985         CopyFrames( start, end - 1 );
00986         common->keyboardFeedback( cmd, _( "Copy current scene" ) );
00987         cmd[ 0 ] = 0;
00988     }
00989 
00990     /* copy from current frame up to end of scene */
00991 
00992     else if ( strcmp( cmd, "y$" ) == 0 )
00993     {
00994         end = common->getPlayList() ->FindEndOfScene( common->g_currentFrame );
00995         CopyFrames( common->g_currentFrame, end );
00996         common->keyboardFeedback( cmd, _( "Copy to end of scene" ) );
00997         cmd[ 0 ] = 0;
00998     }
00999 
01000     /* copy from start of scene just before current frame */
01001 
01002     else if ( ( strcmp( cmd, "y0" ) == 0 ) || strcmp( cmd, "y^" ) == 0 )
01003     {
01004         start = common->getPlayList() ->FindStartOfScene( common->g_currentFrame );
01005         if ( start < common->g_currentFrame )
01006         {
01007             CopyFrames( start, common->g_currentFrame - 1 );
01008             common->moveToFrame( start );
01009         }
01010         common->keyboardFeedback( cmd, _( "Copy from start of scene" ) );
01011         cmd[ 0 ] = 0;
01012     }
01013 
01014     /* paste after current frame */
01015 
01016     else if ( strcmp( real, "p" ) == 0 )
01017     {
01018         start = common->g_currentFrame;
01019         for ( ; count >= 1; count -- )
01020             PasteFrames( common->g_currentFrame + 1 );
01021         common->moveToFrame( start + 1 );
01022         common->keyboardFeedback( cmd, _( "Paste after current frame" ) );
01023         DrawBar( common->g_currentFrame );
01024         cmd[ 0 ] = 0;
01025     }
01026 
01027     /* paste before current frame */
01028 
01029     else if ( strcmp( real, "P" ) == 0 )
01030     {
01031         for ( ; count >= 1; count -- )
01032             PasteFrames( common->g_currentFrame );
01033         end = common->getPlayList() ->FindEndOfScene( common->g_currentFrame + 1 );
01034         common->moveToFrame( );
01035         common->keyboardFeedback( cmd, _( "Paste before current frame" ) );
01036         DrawBar( common->g_currentFrame );
01037         cmd[ 0 ] = 0;
01038     }
01039 
01040     /* Switch to capture mode */
01041 
01042     else if ( strcmp( cmd, "a" ) == 0 )
01043     {
01044         common->keyboardFeedback( cmd, "Capture, insert after frame" );
01045         end = common->getPlayList() ->FindEndOfScene( common->g_currentFrame );
01046         common->moveToFrame( end );
01047         FileTracker::GetInstance().SetMode( CAPTURE_FRAME_APPEND );
01048         common->changePageRequest( PAGE_CAPTURE );
01049         cmd[ 0 ] = 0;
01050     }
01051 
01052     else if ( strcmp( cmd, "A" ) == 0 )
01053     {
01054         common->keyboardFeedback( cmd, _( "Capture, append to movie" ) );
01055         end = common->getPlayList() ->GetNumFrames();
01056         common->moveToFrame( end );
01057         FileTracker::GetInstance().SetMode( CAPTURE_MOVIE_APPEND );
01058         common->changePageRequest( PAGE_CAPTURE );
01059         cmd[ 0 ] = 0;
01060     }
01061 
01062     else if ( strcmp( cmd, "t" ) == 0 )
01063     {
01064         common->keyboardFeedback( cmd, _( "Trim" ) );
01065         common->changePageRequest( PAGE_TRIM );
01066         cmd[ 0 ] = 0;
01067     }
01068 
01069     else if ( strcmp( cmd, "v" ) == 0 )
01070     {
01071         common->keyboardFeedback( cmd, _( "Timeline" ) );
01072         common->changePageRequest( PAGE_TIMELINE );
01073         cmd[ 0 ] = 0;
01074     }
01075 
01076     else if ( strcmp( cmd, "C" ) == 0 )
01077     {
01078         common->keyboardFeedback( cmd, _( "FX" ) );
01079         common->changePageRequest( PAGE_MAGICK );
01080         cmd[ 0 ] = 0;
01081     }
01082 
01083     else if ( strcmp( cmd, "u" ) == 0 )
01084     {
01085         GetEditorBackup() ->Undo( common->getPlayList() );
01086         common->keyboardFeedback( cmd, _( "Undo" ) );
01087         common->hasListChanged = TRUE;
01088         DrawBar( common->g_currentFrame );
01089         common->moveToFrame( );
01090         cmd[ 0 ] = 0;
01091     }
01092 
01093     else if ( strcmp( cmd, "Ctrl+R" ) == 0 )
01094     {
01095         GetEditorBackup() ->Redo( common->getPlayList() );
01096         common->keyboardFeedback( cmd, _( "Redo" ) );
01097         common->hasListChanged = TRUE;
01098         DrawBar( common->g_currentFrame );
01099         common->moveToFrame( );
01100         cmd[ 0 ] = 0;
01101     }
01102 
01103     else if ( strcmp( real, "J" ) == 0 )
01104     {
01105         common->keyboardFeedback( cmd, _( "Join scenes" ) );
01106         for ( ; count >= 1 && common->getPlayList() ->JoinScenesAt( common->g_currentFrame ); count -- )
01107             common->hasListChanged = TRUE;
01108         if ( common->hasListChanged == TRUE )
01109         {
01110             common->moveToFrame();
01111             DrawBar( common->g_currentFrame );
01112             GetEditorBackup() ->Store( common->getPlayList() );
01113             cmd[ 0 ] = 0;
01114         }
01115     }
01116 
01117     /* read AVI or PlayList */
01118 
01119     else if ( strcmp( cmd, ":r" ) == 0 )
01120     {
01121         common->keyboardFeedback( cmd, _( "Insert file" ) );
01122         common->insertFile( );
01123         cmd[ 0 ] = 0;
01124     }
01125 
01126     else if ( strcmp( cmd, ":a" ) == 0 )
01127     {
01128         common->keyboardFeedback( cmd, _( "Append file to scene" ) );
01129         int end = common->getPlayList() ->FindEndOfScene( common->g_currentFrame );
01130         common->moveToFrame( end );
01131         common->appendFile( );
01132         cmd[ 0 ] = 0;
01133     }
01134 
01135     else if ( strcmp( cmd, ":A" ) == 0 )
01136     {
01137         common->keyboardFeedback( cmd, _( "Append file to movie" ) );
01138         int end = common->getPlayList() ->GetNumFrames();
01139         common->moveToFrame( end );
01140         common->appendFile( );
01141         cmd[ 0 ] = 0;
01142     }
01143 
01144     /* switch to export mode */
01145 
01146     else if ( strcmp( cmd, ":W" ) == 0 )
01147     {
01148         common->keyboardFeedback( cmd, _( "Export" ) );
01149         common->changePageRequest( PAGE_EXPORT );
01150         cmd[ 0 ] = 0;
01151     }
01152 
01153     /* write PlayList */
01154 
01155     else if ( strcmp( cmd, ":w" ) == 0 )
01156     {
01157         common->keyboardFeedback( cmd, _( "Write playlist" ) );
01158         common->savePlayList( );
01159         cmd[ 0 ] = 0;
01160     }
01161 
01162     /* quit */
01163 
01164     else if ( strcmp( cmd, ":q" ) == 0 )
01165     {
01166         common->keyboardFeedback( cmd, _( "quit" ) );
01167         kinoDeactivate();
01168         cmd[ 0 ] = 0;
01169     }
01170 
01171     /* split scene */
01172 
01173     else if ( strcmp( cmd, "Ctrl+J" ) == 0 )
01174     {
01175         common->keyboardFeedback( cmd, _( "Split scene before frame" ) );
01176         if ( common->getPlayList() ->SplitSceneBefore( common->g_currentFrame ) )
01177         {
01178             common->hasListChanged = TRUE;
01179             common->moveToFrame();
01180             DrawBar( common->g_currentFrame );
01181             GetEditorBackup() ->Store( common->getPlayList() );
01182             cmd[ 0 ] = 0;
01183         }
01184     }
01185 
01186     /* goto a frame */
01187     else if ( strncmp( cmd, ":", 1 ) == 0 )
01188     {
01189         int val = 0;
01190         char t[ 132 ] = "";
01191         if ( sscanf( cmd + 1, "%d", &val ) == 1 )
01192         {
01193             common->moveToFrame( val );
01194             sprintf( t, _( "Move to frame %d" ), val );
01195             common->keyboardFeedback( cmd, t );
01196         }
01197         else
01198             common->setStatusBar( cmd );
01199     }
01200 
01201     else
01202     {
01203         // Check for invalid commands
01204         if ( strlen( real ) > 5 )
01205             cmd[ 0 ] = 0;
01206         else if ( strchr( "dgy ", real[ strlen( real ) - 1 ] ) == NULL )
01207             cmd[ 0 ] = 0;
01208 
01209         common->keyboardFeedback( cmd, "" );
01210 
01211     }
01212 
01213     common->setWindowTitle( );
01214 
01215     return FALSE;
01216 }

gboolean PageEditor::processKeyboard GdkEventKey *  event  )  [virtual]
 

Process a keyboard event.

Parameters:
event keyboard event

Reimplemented from Page.

Definition at line 596 of file page_editor.cc.

References cmd, common, navigate_control::escaped, g_nav_ctl, KinoCommon::keyboardFeedback(), lastcmd, processCommand(), KinoCommon::setStatusBar(), and KinoCommon::videoStop().

00597 {
00598     gboolean ret = FALSE;
00599 
00600     // Only process while not escape mode
00601     if ( g_nav_ctl.escaped == FALSE )
00602     {
00603         if ( strcmp( lastcmd, "alt" ) == 0 )
00604         {
00605             strcpy( lastcmd, "" );
00606             return ret;
00607         }
00608 
00609         // Translate special keys to equivalent command
00610         switch ( event->keyval )
00611         {
00612         case GDK_Home:
00613             strcat( cmd, "gg");
00614             ret = TRUE;
00615             break;
00616         case GDK_End:
00617             strcat( cmd, "G");
00618             ret = TRUE;
00619             break;
00620         case GDK_Page_Up:
00621             strcat( cmd, "5^" );
00622             ret = TRUE;
00623             break;
00624         case GDK_Page_Down:
00625             strcat( cmd, "5$" );
00626             ret = TRUE;
00627             break;
00628         case GDK_BackSpace:
00629         case GDK_Left:
00630             strcat( cmd, "h" );
00631             ret = TRUE;
00632             break;
00633         case GDK_Up:
00634             strcat( cmd, "k" );
00635             ret = TRUE;
00636             break;
00637         case GDK_Right:
00638             strcat( cmd, "l" );
00639             ret = TRUE;
00640             break;
00641         case GDK_Return:
00642             if ( cmd[ 0 ] != 0 )
00643             {
00644                 // Last command is now
00645                 strcpy( lastcmd, cmd );
00646 
00647                 // end the command entry
00648                 cmd[ 0 ] = 0;
00649                 common->setStatusBar( "" );
00650             }
00651             break;
00652         case GDK_Down:
00653             strcat( cmd, "j" );
00654             ret = TRUE;
00655             break;
00656         case GDK_Delete:
00657             strcat( cmd, "x" );
00658             ret = TRUE;
00659             break;
00660         case GDK_Escape:
00661             common->keyboardFeedback( cmd, _( "Stop" ) );
00662             common->videoStop( );
00663             cmd[ 0 ] = 0;
00664             return ret;
00665         case GDK_Alt_L:
00666         case GDK_Alt_R:
00667             strcpy( lastcmd, "alt" );
00668             return ret;
00669         default:
00670             if ( strcmp( event->string, "." ) )
00671                 strcat( cmd, event->string );
00672             break;
00673         }
00674 
00675         if ( !strcmp( event->string, "." ) )
00676             strcpy( cmd, lastcmd );
00677         else if ( cmd[ 0 ] == 0x06)   // Ctrl+f
00678             strcpy( cmd, "5$" );
00679         else if ( cmd[ 0 ] == 0x02 )   // Ctrl+b
00680             strcpy( cmd, "5^" );
00681         else if ( cmd[ 0 ] == 0x12 )
00682             strcpy( cmd, "Ctrl+R" );
00683 
00684 #if 0
00685         printf( "send_event: %2.2x\n", event->send_event );
00686         printf( "time  : %8.8x\n", event->time );
00687         printf( "state : %8.8x\n", event->state );
00688         printf( "keyval: %8.8x\n", event->keyval );
00689         printf( "length: %8.8x\n", event->length );
00690         printf( "string: %s\n", event->string );
00691         printf( "(hex) : %2.2x\n", event->string[ 0 ] );
00692         printf( "cmd   : %s\n", cmd );
00693         printf( "(hex) : %8.8x\n", cmd[ 0 ] );
00694         fflush( stdout );
00695 #endif
00696 
00697         processCommand( cmd );
00698     }
00699 
00700     return ret;
00701 }

void PageEditor::ResetBar  ) 
 

Definition at line 1358 of file page_editor.cc.

References common, KinoCommon::getPlayList(), GetStoryboard(), gtk_enhanced_scale_set_breaks(), lastFrame, sceneIndex, sceneStartList, scrubAdjustment, and scrubBar.

Referenced by DrawBar(), and newFile().

01359 {
01360     int frameNum = 0, lastFrame = 0;
01361 
01362     sceneStartList.erase( sceneStartList.begin(), sceneStartList.end() );
01363 
01364     if ( sceneIndex != NULL )
01365         g_array_free( sceneIndex, TRUE );
01366     sceneIndex = g_array_new( FALSE, FALSE, sizeof( int ) );
01367     g_array_set_size( sceneIndex, 0 );
01368 
01369     while ( frameNum < common->getPlayList() ->GetNumFrames() )
01370     {
01371         lastFrame = frameNum = common->getPlayList() ->FindEndOfScene( frameNum );
01372         frameNum++;
01373         g_array_append_val( sceneIndex, frameNum );
01374         sceneStartList.insert( sceneStartList.end(), frameNum );
01375     }
01376     GetStoryboard() ->reset();
01377     GetStoryboard() ->redraw();
01378     frameNum = common->getPlayList() ->GetNumFrames() - 1;
01379     if ( frameNum < 0 )
01380         frameNum = 0;
01381     scrubAdjustment->upper = frameNum;
01382     g_signal_emit_by_name( scrubAdjustment, "changed" );
01383     gtk_enhanced_scale_set_breaks( scrubBar, sceneIndex );
01384 }

void PageEditor::selectScene int  i  )  [virtual]
 

Move to start of selected scene.

Parameters:
i scene to move to

Reimplemented from Page.

Definition at line 584 of file page_editor.cc.

References common, GetScene(), and KinoCommon::moveToFrame().

00585 {
00586     vector <int> scene = GetScene();
00587     int value = i == 0 ? 0 : scene[ i - 1 ];
00588     common->moveToFrame( value );
00589 }

void PageEditor::showFrame int  ,
Frame
 

Definition at line 1275 of file page_editor.cc.

References common, DrawBar(), frameArea, KinoCommon::g_currentFrame, g_nav_ctl, getFrameDisplayer(), KinoCommon::getPlayList(), KinoCommon::loadSplash(), navigate_control::rate, showFrameInfo(), navigate_control::step, and KinoCommon::videoStop().

01276 {
01277     gdk_threads_enter();
01278     if ( common->getPlayList() ->GetNumFrames() == 0 )
01279     {
01280         common->loadSplash( frameArea );
01281     }
01282     else
01283     {
01284         DrawBar( position );
01285         getFrameDisplayer() ->Put( frame, GTK_WIDGET( frameArea ), TRUE );
01286         showFrameInfo( position, frame );
01287         common->g_currentFrame = position;
01288     }
01289     gdk_flush();
01290     if ( position >= ( common->getPlayList()->GetNumFrames() - 1 ) ||
01291         ( position <= 0 && ( g_nav_ctl.step < 0 || g_nav_ctl.rate < 0 ) ) )
01292     {
01293         common->videoStop();
01294     }
01295     gdk_threads_leave();
01296 }

void PageEditor::showFrame int  i,
gboolean  no_audio
 

Show the frame requested.

Parameters:
i frame to be shown
no_audio indicate if audio is required or not

Definition at line 299 of file page_editor.cc.

References common, DrawBar(), frameArea, getFrameDisplayer(), GetFramePool(), KinoCommon::getPlayList(), lastFrameShown, KinoCommon::loadSplash(), IEEE1394Writer::SendFrame(), KinoCommon::showFrameInfo(), and writer1394.

Referenced by movedToFrame(), and windowMoved().

00300 {
00301     DrawBar( i );
00302     if ( common->getPlayList() ->GetNumFrames() == 0 )
00303     {
00304         common->loadSplash( frameArea );
00305         common->showFrameInfo( 0 );
00306     }
00307     else
00308     {
00309         Frame *frame = GetFramePool( ) ->GetFrame( );
00310         common->getPlayList() ->GetFrame( i, *frame );
00311         common->showFrameInfo( i );
00312         if ( writer1394 != NULL )
00313             writer1394->SendFrame( *frame, false ) ;
00314         getFrameDisplayer() ->Put( *frame, GTK_WIDGET( frameArea ), no_audio );
00315         lastFrameShown = i;
00316         GetFramePool( ) ->DoneWithFrame( frame );
00317     }
00318 }

void PageEditor::showFrameInfo int  ,
Frame