00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _KINO_COMMON_H
00022 #define _KINO_COMMON_H
00023
00024 #include <vector>
00025
00026 #include <gtk/gtk.h>
00027 #include <glib/gi18n.h>
00028 #include <gdk/gdkkeysyms.h>
00029 #include <limits.h>
00030 #include <stdlib.h>
00031 #include <stdint.h>
00032
00033 #include "playlist.h"
00034 #include "frame.h"
00035 #include "preferences.h"
00036 #include "filehandler.h"
00037 #include "smiltime.h"
00038
00039
00044 typedef enum component_enum {
00045 EDIT_MENU = 2,
00046 SCENE_LIST = 32,
00047 VIDEO_START_OF_MOVIE = 64,
00048 VIDEO_START_OF_SCENE = 128,
00049 VIDEO_REWIND = 256,
00050 VIDEO_BACK = 512,
00051 VIDEO_PLAY = 1024,
00052 VIDEO_PAUSE = 2048,
00053 VIDEO_STOP = 4096,
00054 VIDEO_FORWARD = 8192,
00055 VIDEO_FAST_FORWARD = 16384,
00056 VIDEO_NEXT_SCENE = 32768,
00057 VIDEO_END_OF_MOVIE = 65536,
00058 INFO_FRAME = 131072,
00059 VIDEO_SHUTTLE = 262144
00060 };
00061
00062
00068 typedef enum page_enum {
00069 PAGE_EDITOR,
00070 PAGE_CAPTURE,
00071 PAGE_TIMELINE,
00072 PAGE_TRIM,
00073 PAGE_MAGICK,
00074 PAGE_EXPORT,
00075 PAGE_BTTV
00076 };
00077
00078
00079
00080 class Page;
00081 class PageEditor;
00082 class PageCapture;
00083 class PageTimeline;
00084 class PageBttv;
00085 class PageExport;
00086 class PageTrim;
00087 class PageMagick;
00088 class PageUndefined;
00089
00108 class KinoCommon
00109 {
00110 private:
00111
00112
00113
00114 GtkWidget *widget;
00115 GtkWidget *edit_menu;
00116 GtkWidget *view_menu;
00117 GtkNotebook *notebook;
00118 GtkEntry *command;
00119 GtkButton *video_start_movie_button;
00120 GtkButton *video_start_scene_button;
00121 GtkButton *video_rewind_button;
00122 GtkButton *video_back_button;
00123 GtkButton *video_play_button;
00124 GtkButton *video_stop_button;
00125 GtkButton *video_forward_button;
00126 GtkButton *video_fast_forward_button;
00127 GtkButton *video_end_scene_button;
00128 GtkButton *video_end_movie_button;
00129 GtkRange *video_shuttle;
00130 GtkStatusbar *statusbar;
00131
00132
00133 PlayList playlist;
00134
00135
00136 int currentPage;
00137
00138
00139 PageEditor *editor;
00140 PageCapture *capture;
00141 PageTimeline *timeline;
00142 PageBttv *bttv;
00143 PageExport *exportPage;
00144 PageTrim *trimPage;
00145 PageMagick *magickPage;
00146 PageUndefined *undefined;
00147
00148
00149 char tempFileName[ PATH_MAX + NAME_MAX ];
00150 char playlistFileName[ PATH_MAX + NAME_MAX ];
00151
00152
00153
00154 gulong component_state;
00155 bool is_component_state_changing;
00156 string last_directory;
00157 bool showMoreInfo;
00158 int currentScene;
00159 SMIL::MediaClippingTime time;
00160 std::vector< GtkWidget* > recentMenuItems;
00161
00162 public:
00163
00164 static GtkWindow * getWidgetWindow( GtkWidget *widget );
00165
00166 KinoCommon( GtkWidget *widget );
00167 ~KinoCommon();
00168
00169 GtkWidget *getWidget( )
00170 {
00171 return this->widget;
00172 }
00173
00174 PlayList *getPlayList()
00175 {
00176 return & playlist;
00177 }
00178
00179 int getCurrentScene()
00180 {
00181 return this->currentScene;
00182 }
00183
00184
00185 bool newFile( bool prompt = true );
00186
00187
00188 void bulkLoad( int, char *[] );
00189 std::string importFile( const char *filename );
00190 void insertFile( );
00191 void appendFile( );
00192 void loadFile( );
00193 bool savePlayListAs( );
00194 bool savePlayList( );
00195 void saveFrame( );
00196 void publishPlayList( );
00197 void publishFrame( );
00198 void loadPlayList( char* );
00199
00200
00201 void changePageRequest( int page );
00202 void setCurrentPage( int page );
00203 Page *getCurrentPage();
00204 Page *getPage( int page );
00205 void activateWidgets();
00206
00207
00208 PageEditor *getPageEditor();
00209 PageCapture *getPageCapture();
00210 PageTimeline *getPageTimeline();
00211 PageBttv *getPageBttv();
00212 PageExport *getPageExport();
00213 PageTrim *getPageTrim();
00214 PageMagick *getPageMagick();
00215 PageUndefined *getPageUndefined();
00216
00217
00218 int moveToFrame( );
00219 int moveToFrame( int );
00220 int moveByFrames( int );
00221 void showFrameInfo( int );
00222 void showFrameMoreInfo( Frame&, FileHandler* );
00223 int g_currentFrame;
00224 gboolean hasListChanged;
00225
00226
00227 void keyboardFeedback( const char *, const char * );
00228
00229
00230 gboolean processKeyboard( GdkEventKey *event );
00231 gboolean processCommand( char * );
00232 void selectScene( int );
00233 void videoStartOfMovie();
00234 void videoPreviousScene();
00235 void videoStartOfScene();
00236 void videoRewind();
00237 void videoBack(int step = -1);
00238 void videoPlay();
00239 void videoForward(int step = 1);
00240 void videoFastForward();
00241 void videoNextScene();
00242 void videoEndOfScene();
00243 void videoEndOfMovie();
00244 void videoPause();
00245 void videoStop();
00246 void videoShuttle( int );
00247 void windowMoved();
00248 void visibilityChanged( gboolean );
00249
00250
00251 void toggleComponents( component_enum, bool );
00252 component_enum getComponentState();
00253 void commitComponentState( component_enum = ( component_enum ) 0 );
00254
00255
00256 char *getFileToOpen( char *title, bool isDVFile, GtkWidget *widget );
00257 char *getFileToSaveFormat( char *title, GtkWidget *widget, int& format );
00258 char *getFileToOpen( char *title, bool isDVFile = true )
00259 {
00260 return getFileToOpen( title, isDVFile, getWidget() );
00261 }
00262 char *getFileToSave( char *title )
00263 {
00264 int format = 0;
00265 return getFileToSaveFormat( title, getWidget(), format );
00266 }
00267 char *getFileToSaveFormat( char *title, int& format )
00268 {
00269 return getFileToSaveFormat( title, getWidget(), format );
00270 }
00271
00272
00273 void setPreviewSize( float factor, bool noWarning = false );
00274 void loadSplash( GtkDrawingArea * );
00275 void clearPreview( GtkDrawingArea * );
00276 void setWindowTitle( );
00277 void saveFrame( int, char * );
00278 bool loadMediaObject( char *, int );
00279 void packIt( const char *, const char * );
00280 void setStatusBar( const char *, ... );
00281 void setMoreInfo( bool state )
00282 {
00283 showMoreInfo = state;
00284 }
00285 SMIL::Time::TimeFormat getTimeFormat() const
00286 {
00287 return static_cast< SMIL::Time::TimeFormat >( Preferences::getInstance().timeFormat );
00288 }
00289 void setTimeFormat( SMIL::Time::TimeFormat format );
00290 SMIL::MediaClippingTime& getTime()
00291 {
00292 return time;
00293 }
00294 void setCurrentScene( int frame );
00295 string getLastDirectory( )
00296 {
00297 if ( last_directory == "" )
00298 last_directory = playlist.GetProjectDirectory( );
00299 return ( last_directory + "/" );
00300 }
00301 void setLastDirectory( const string& value )
00302 {
00303 last_directory = value;
00304 }
00305 void updateRecentFiles();
00306
00307
00308 bool exitKino( );
00309
00310
00311 int checkFile( char * );
00312
00313 protected:
00314
00315 void start();
00316 void clean();
00317
00318
00319 void setFileEditted( char * );
00320 void setCurrentDirectoryFromFile( char * );
00321
00322 void saveAVI( char * );
00323 bool loadPlayList( char *, int );
00324 bool savePlayList( char * );
00325 void fetchProjectMetadata( const std::string& projectKey );
00326 };
00327
00328 extern "C" {
00329
00330 extern KinoCommon *common;
00331 }
00332
00333 #endif