videditor/ManualVideoEditor/src/VeiPopup.cpp
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 // System includes
       
    23 #include <avkon.hrh>
       
    24 #include <manualvideoeditor.rsg>
       
    25 
       
    26 
       
    27 #include <akntitle.h> 
       
    28 #include <aknlists.h>
       
    29 #include <aknquerydialog.h>  
       
    30 #include <eikmenub.h> 
       
    31 #include <caknfileselectiondialog.h>
       
    32 #include <stringloader.h> 
       
    33 #include <mgfetch.h> 
       
    34 #include <akncolourselectiongrid.h>
       
    35 
       
    36 // User includes
       
    37 #include "VeiEditVideoView.h"
       
    38 #include "manualvideoeditor.hrh" 
       
    39 #include "veipopup.h" 
       
    40 #include "veiaddqueue.h"
       
    41 #include "veieditvideocontainer.h"
       
    42 #include "videoeditorcommon.h"
       
    43 #include "veiappui.h"
       
    44 
       
    45 
       
    46 CVeiPopup* CVeiPopup::NewL( CVeiEditVideoView& aView )
       
    47     {
       
    48     CVeiPopup* self = CVeiPopup::NewLC( aView );
       
    49     CleanupStack::Pop( self );
       
    50     return self;
       
    51     }
       
    52 
       
    53 CVeiPopup* CVeiPopup::NewLC( CVeiEditVideoView& aView )
       
    54     {
       
    55     CVeiPopup* self = new( ELeave )CVeiPopup( aView );
       
    56     CleanupStack::PushL( self );
       
    57     self->ConstructL();
       
    58     return self;
       
    59     }
       
    60 
       
    61 CVeiPopup::CVeiPopup( CVeiEditVideoView& aView ): iView( aView )
       
    62 {
       
    63 
       
    64 }
       
    65 
       
    66 
       
    67 void CVeiPopup::ConstructL()
       
    68     {
       
    69     LOG( KVideoEditorLogFile, "CVeiPopup::ConstructL: in" );
       
    70     LOG( KVideoEditorLogFile, "CVeiPopup::ConstructL: out" );
       
    71     }
       
    72 
       
    73 CVeiPopup::~CVeiPopup()
       
    74     {
       
    75     LOG( KVideoEditorLogFile, "CVeiPopup::~CVeiPopup" );
       
    76     }
       
    77 
       
    78 TInt CVeiPopup::ExecutePopupListL( TInt aSoftkeysResourceId, 
       
    79                                    TInt aPopupTitleResourceId, 
       
    80                                    TInt aArrayResourceId, 
       
    81                                    TInt aTablesize, 
       
    82                                    TBool aDynPopup ) const
       
    83     {
       
    84 
       
    85     // Create listbox and PUSH it.
       
    86     CAknSinglePopupMenuStyleListBox* listBox = new( ELeave )CAknSinglePopupMenuStyleListBox;
       
    87     CleanupStack::PushL( listBox );
       
    88 
       
    89     // Create popup list and PUSH it.
       
    90     CAknPopupList* popupList = CAknPopupList::NewL( listBox, aSoftkeysResourceId );
       
    91     CleanupStack::PushL( popupList );
       
    92 
       
    93     // Set title for popup from defined resource.
       
    94     HBufC* title = CCoeEnv::Static()->AllocReadResourceLC( aPopupTitleResourceId );
       
    95     popupList->SetTitleL( *title );
       
    96     CleanupStack::PopAndDestroy( title );
       
    97 
       
    98     // initialize listbox.
       
    99     listBox->ConstructL( popupList, EAknListBoxMenuList );
       
   100 
       
   101     // Make listitems. and PUSH it
       
   102     CDesCArrayFlat* items = CCoeEnv::Static()->ReadDesCArrayResourceL( aArrayResourceId );
       
   103     CleanupStack::PushL( items );
       
   104 
       
   105     // Remove given index if at correct range.
       
   106 
       
   107     if ( aDynPopup )
       
   108         {
       
   109         TInt i;
       
   110         for ( i = aTablesize - 1; i >= 0; i-- )
       
   111             {
       
   112             if ( 0 == RemoveArrayIndex[i] )
       
   113                 {
       
   114                 items->Delete( i );
       
   115                 }
       
   116             }
       
   117         }
       
   118     else
       
   119         {
       
   120         if ( aTablesize >= 0 && aTablesize <= ( items->Count() - 1 ))
       
   121             {
       
   122             items->Delete( aTablesize );
       
   123             }
       
   124         }
       
   125 
       
   126 
       
   127     // Set listitems.
       
   128     CTextListBoxModel* model = listBox->Model();
       
   129     model->SetItemTextArray( items );
       
   130     model->SetOwnershipType( ELbmOwnsItemArray );
       
   131 
       
   132     CleanupStack::Pop( items ); // Pop effect items
       
   133 
       
   134     listBox->CreateScrollBarFrameL( ETrue );
       
   135     listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
       
   136 
       
   137     TInt popOk = popupList->ExecuteLD();
       
   138 
       
   139     TInt returnValue;
       
   140 
       
   141     if ( popOk )
       
   142         {
       
   143         // Return selected item's index.
       
   144         returnValue = listBox->CurrentItemIndex();
       
   145         }
       
   146     else
       
   147         {
       
   148         returnValue =  - 1;
       
   149         }
       
   150 
       
   151     // Clenup and destroy.
       
   152     CleanupStack::Pop( popupList );
       
   153     CleanupStack::PopAndDestroy( listBox );
       
   154 
       
   155     return returnValue;
       
   156     }
       
   157 
       
   158 
       
   159 void CVeiPopup::ShowEndTransitionPopupListL()
       
   160     {
       
   161     TInt removeIndex;
       
   162     // Which effect to remove from listbox.
       
   163     switch ( iView.Movie()->EndTransitionEffect())
       
   164         {
       
   165         case EVedEndTransitionEffectFadeToBlack:
       
   166             removeIndex = 0;
       
   167             break;
       
   168         case EVedEndTransitionEffectFadeToWhite:
       
   169             removeIndex = 1;
       
   170             break;
       
   171         case EVedEndTransitionEffectNone:
       
   172             removeIndex = 2;
       
   173             break;
       
   174         default:
       
   175             removeIndex =  - 1;
       
   176             break;
       
   177         }
       
   178 
       
   179     TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
       
   180                                             R_VEI_TRANSTION_POPUP_TITLE, 
       
   181                                             R_VEI_END_TRANSITION_LIST_BOX_ARRAY, 
       
   182                                             removeIndex, 
       
   183                                             EFalse );
       
   184 
       
   185     switch ( selectedIndex )
       
   186         {
       
   187         case 0:
       
   188                 {
       
   189                 if ( removeIndex == 0 )
       
   190                     {
       
   191                     iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToWhite );
       
   192                     }
       
   193                 else
       
   194                     {
       
   195                     iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToBlack );
       
   196                     }
       
   197                 break;
       
   198                 }
       
   199         case 1:
       
   200                 {
       
   201                 if ( removeIndex <= 1 )
       
   202                     {
       
   203                     iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectNone );
       
   204                     }
       
   205                 else
       
   206                     {
       
   207                     iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToWhite );
       
   208                     }
       
   209                 break;
       
   210                 }
       
   211         default:
       
   212             break;
       
   213         }
       
   214 
       
   215     }
       
   216 
       
   217 void CVeiPopup::ShowMiddleTransitionPopupListL()
       
   218     {
       
   219     TInt currentindex = iView.Container()->CurrentIndex() - 1;
       
   220     TInt removeIndex;
       
   221     switch ( iView.Movie()->MiddleTransitionEffect( currentindex ))
       
   222         {
       
   223         case EVedMiddleTransitionEffectWipeTopToBottom:
       
   224             removeIndex = 0;
       
   225             break;
       
   226         case EVedMiddleTransitionEffectWipeBottomToTop:
       
   227             removeIndex = 1;
       
   228             break;
       
   229         case EVedMiddleTransitionEffectWipeLeftToRight:
       
   230             removeIndex = 2;
       
   231             break;
       
   232         case EVedMiddleTransitionEffectWipeRightToLeft:
       
   233             removeIndex = 3;
       
   234             break;
       
   235         case EVedMiddleTransitionEffectCrossfade:
       
   236             removeIndex = 4;
       
   237             break;
       
   238         case EVedMiddleTransitionEffectDipToBlack:
       
   239             removeIndex = 5;
       
   240             break;
       
   241         case EVedMiddleTransitionEffectDipToWhite:
       
   242             removeIndex = 6;
       
   243             break;
       
   244         case EVedMiddleTransitionEffectNone:
       
   245             removeIndex = 7;
       
   246             break;
       
   247         default:
       
   248             removeIndex =  - 1;
       
   249             break;
       
   250         }
       
   251 
       
   252     TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
       
   253                                             R_VEI_TRANSTION_POPUP_TITLE, 
       
   254                                             R_VEI_MIDDLE_TRANSITION_LIST_BOX_ARRAY, 
       
   255                                             removeIndex, 
       
   256                                             EFalse );
       
   257 
       
   258     switch ( selectedIndex )
       
   259         {
       
   260         case 0:
       
   261                 {
       
   262                 if ( removeIndex == 0 )
       
   263                     {
       
   264                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeBottomToTop, currentindex );
       
   265                     }
       
   266                 else
       
   267                     {
       
   268                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeTopToBottom, currentindex );
       
   269                     }
       
   270                 break;
       
   271                 }
       
   272         case 1:
       
   273                 {
       
   274                 if ( removeIndex <= 1 )
       
   275                     {
       
   276                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeLeftToRight, currentindex );
       
   277                     }
       
   278                 else
       
   279                     {
       
   280                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeBottomToTop, currentindex );
       
   281                     }
       
   282                 break;
       
   283                 }
       
   284         case 2:
       
   285                 {
       
   286                 if ( removeIndex <= 2 )
       
   287                     {
       
   288                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeRightToLeft, currentindex );
       
   289                     }
       
   290                 else
       
   291                     {
       
   292                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeLeftToRight, currentindex );
       
   293                     }
       
   294                 break;
       
   295                 }
       
   296         case 3:
       
   297                 {
       
   298                 if ( removeIndex <= 3 )
       
   299                     {
       
   300                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectCrossfade, currentindex );
       
   301                     }
       
   302                 else
       
   303                     {
       
   304                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeRightToLeft, currentindex );
       
   305                     }
       
   306                 break;
       
   307                 }
       
   308         case 4:
       
   309                 {
       
   310                 if ( removeIndex <= 4 )
       
   311                     {
       
   312                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToBlack, currentindex );
       
   313                     }
       
   314                 else
       
   315                     {
       
   316                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectCrossfade, currentindex );
       
   317                     }
       
   318                 break;
       
   319                 }
       
   320         case 5:
       
   321                 {
       
   322                 if ( removeIndex <= 5 )
       
   323                     {
       
   324                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToWhite, currentindex );
       
   325                     }
       
   326                 else
       
   327                     {
       
   328                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToBlack, currentindex );
       
   329                     }
       
   330                 break;
       
   331                 }
       
   332         case 6:
       
   333                 {
       
   334                 if ( removeIndex <= 6 )
       
   335                     {
       
   336                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectNone, currentindex );
       
   337                     }
       
   338                 else
       
   339                     {
       
   340                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectDipToWhite, currentindex );
       
   341                     }
       
   342                 break;
       
   343                 }
       
   344         case 7:
       
   345                 {
       
   346                 if ( removeIndex <= 7 )
       
   347                     {
       
   348                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectWipeLeftToRight, currentindex );
       
   349                     }
       
   350                 else
       
   351                     {
       
   352                     iView.Movie()->SetMiddleTransitionEffect( EVedMiddleTransitionEffectNone, currentindex );
       
   353                     iView.Movie()->SetEndTransitionEffect( EVedEndTransitionEffectFadeToWhite );
       
   354                     }
       
   355                 break;
       
   356                 }
       
   357         default:
       
   358             break;
       
   359         }
       
   360 
       
   361     }
       
   362 
       
   363 void CVeiPopup::ShowStartTransitionPopupListL()
       
   364     {
       
   365     TInt removeIndex;
       
   366     switch ( iView.Movie()->StartTransitionEffect())
       
   367         {
       
   368         case EVedStartTransitionEffectFadeFromBlack:
       
   369             removeIndex = 0;
       
   370             break;
       
   371         case EVedStartTransitionEffectFadeFromWhite:
       
   372             removeIndex = 1;
       
   373             break;
       
   374         case EVedStartTransitionEffectNone:
       
   375             removeIndex = 2;
       
   376             break;
       
   377         default:
       
   378             removeIndex =  - 1;
       
   379             break;
       
   380         }
       
   381 
       
   382     TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
       
   383                                             R_VEI_TRANSTION_POPUP_TITLE, 
       
   384                                             R_VEI_START_TRANSITION_LIST_BOX_ARRAY, 
       
   385                                             removeIndex, 
       
   386                                             EFalse );
       
   387 
       
   388     switch ( selectedIndex )
       
   389         {
       
   390         case 0:
       
   391                 {
       
   392                 if ( removeIndex == 0 )
       
   393                     {
       
   394                     iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromWhite );
       
   395                     }
       
   396                 else
       
   397                     {
       
   398                     iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromBlack );
       
   399                     }
       
   400                 break;
       
   401                 }
       
   402         case 1:
       
   403                 {
       
   404                 if ( removeIndex <= 1 )
       
   405                     {
       
   406                     iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectNone );
       
   407                     }
       
   408                 else
       
   409                     {
       
   410                     iView.Movie()->SetStartTransitionEffect( EVedStartTransitionEffectFadeFromWhite );
       
   411                     }
       
   412                 break;
       
   413                 }
       
   414         default:
       
   415             break;
       
   416         }
       
   417 
       
   418     }
       
   419 
       
   420 void CVeiPopup::ShowInsertAudioPopupList()
       
   421     {
       
   422     TInt selectedIndex; // Selected item's index in popup list.
       
   423     TInt removeIndex; // Index to remove from list.
       
   424 
       
   425     removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   426 
       
   427     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
       
   428                                        R_VEI_POPUP_INSERT_AUDIO_TITLE, 
       
   429                                        R_VEI_INSERT_AUDIO_LIST_BOX_ARRAY, 
       
   430                                        removeIndex, 
       
   431                                        EFalse );
       
   432 
       
   433     switch ( selectedIndex )
       
   434         {
       
   435         /**
       
   436          * Sound clip
       
   437          */
       
   438         case 0:
       
   439             iView.HandleCommandL( EVeiCmdEditVideoViewInsertAudio );
       
   440             break;
       
   441             /**
       
   442              * New sound clip
       
   443              */
       
   444         case 1:
       
   445             iView.InsertNewAudio();
       
   446             break;
       
   447         default:
       
   448             break;
       
   449         }
       
   450 
       
   451     }
       
   452 
       
   453 /*
       
   454 Show popup list when cursor is on empty video track.
       
   455 Video, text, image etc..
       
   456  */
       
   457 
       
   458 void CVeiPopup::ShowInsertStuffPopupList()
       
   459     {
       
   460     TInt selectedIndex; // Selected item's index in popup list.
       
   461     TInt removeIndex; // Index to remove from list.
       
   462 
       
   463     removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   464 
       
   465     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
       
   466                                        R_VEI_POPUP_INSERT_STUFF_TITLE, 
       
   467                                        R_VEI_INSERT_STUFF_LIST_BOX_ARRAY, 
       
   468                                        removeIndex, 
       
   469                                        EFalse );
       
   470 
       
   471     switch ( selectedIndex )
       
   472         {
       
   473         /**
       
   474          * Video clip
       
   475          */
       
   476         case 0:
       
   477             iView.HandleCommandL( EVeiCmdEditVideoViewInsertVideo );
       
   478             break;
       
   479             /**
       
   480             INSERT IMAGE
       
   481              */
       
   482         case 1:
       
   483             iView.HandleCommandL( EVeiCmdEditVideoViewInsertImage );
       
   484             break;
       
   485             /**
       
   486             INSERT Text
       
   487              */
       
   488         case 2:
       
   489             ShowInsertTextPopupList();
       
   490             break;
       
   491         default:
       
   492             break;
       
   493         }
       
   494 
       
   495     }
       
   496 
       
   497 /*
       
   498 Show popup list when cursor is on empty video track.
       
   499 Video, text, image etc..
       
   500  */
       
   501 
       
   502 
       
   503 void CVeiPopup::ShowInsertTextPopupList()
       
   504     {
       
   505     TInt selectedIndex; // Selected item's index in popup list.
       
   506     TInt removeIndex; // Index to remove from list.
       
   507 
       
   508     removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   509 
       
   510     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
       
   511                                        R_VEI_POPUP_INSERT_STUFF_TITLE, 
       
   512                                        R_VEI_INSERT_TEXT_LIST_BOX_ARRAY, 
       
   513                                        removeIndex, 
       
   514                                        EFalse );
       
   515 
       
   516     switch ( selectedIndex )
       
   517         {
       
   518         case 0:
       
   519             iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextTitle );
       
   520             break;
       
   521         case 1:
       
   522             iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextTitleFading );
       
   523             break;
       
   524         case 2:
       
   525             iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextSubTitle );
       
   526             break;
       
   527         case 3:
       
   528             iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextSubTitleFading );
       
   529             break;
       
   530         case 4:
       
   531             iView.HandleCommandL( EVeiCmdEditVideoViewInsertTextCredits );
       
   532             break;
       
   533         default:
       
   534             break;
       
   535         }
       
   536     }
       
   537 
       
   538 void CVeiPopup::ShowEffectSelectionPopupListL()
       
   539     {
       
   540     TInt currentIndex = iView.Container()->CurrentIndex();
       
   541     TInt removeIndex;
       
   542 
       
   543     // Which effect to remove from listbox.
       
   544     switch ( iView.Movie()->VideoClipColorEffect( currentIndex ))
       
   545         {
       
   546         case EVedColorEffectBlackAndWhite:
       
   547             removeIndex = 0; // blackandwhite removed from list
       
   548             break;
       
   549             /*case EVedColorEffectToning: // some other color must be able to be chosen still
       
   550             removeIndex = 1;
       
   551             break;					
       
   552              */
       
   553         case EVedColorEffectNone:
       
   554             removeIndex = 2;
       
   555             break;
       
   556         default:
       
   557             removeIndex =  - 1; // Remove nothing from array.
       
   558             break;
       
   559         }
       
   560 
       
   561 
       
   562     /*
       
   563     array indexes:
       
   564     qtn_vei_list_query_select_effect_black_white;
       
   565     qtn_vei_list_query_select_effect_colour;
       
   566     qtn_vei_list_query_select_effect_no_effect;	
       
   567 
       
   568      */
       
   569 
       
   570     // Execute popup list with proper parameters.
       
   571     TInt selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, 
       
   572                                             R_VEI_POPUP_SELECT_EFFECT_TITLE, 
       
   573                                             R_VEI_EFFECT_LIST_BOX_ARRAY, // order: bw, col, no effect
       
   574                                             removeIndex, 
       
   575                                             EFalse );
       
   576     switch ( selectedIndex )
       
   577         {
       
   578         case 0:
       
   579             // blackandwhite
       
   580                 {
       
   581                 if ( removeIndex == 0 )
       
   582                 // current effect blackandwhite -> colour chosen
       
   583                     {
       
   584                     TRgb color;
       
   585                     if ( !ShowColorSelectorL( color ))
       
   586                         {
       
   587                         break;
       
   588                         }
       
   589 
       
   590                     iView.Movie()->VideoClipSetColorTone( currentIndex, color );
       
   591                     iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectToning );
       
   592                     }
       
   593                 else
       
   594                     {
       
   595                     iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectBlackAndWhite );
       
   596                     }
       
   597                 break;
       
   598                 }
       
   599         case 1:
       
   600             // colour
       
   601                 {
       
   602                 if ( removeIndex == 0 )
       
   603                 // // current effect blackandwhite -> no effect chosen
       
   604                     {
       
   605                     iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectNone );
       
   606                     }
       
   607                 else
       
   608                     {
       
   609                     // current event none
       
   610                     TRgb color;
       
   611 
       
   612                     if ( !ShowColorSelectorL( color ))
       
   613                         {
       
   614                         break;
       
   615                         }
       
   616 
       
   617                     //				TInt R_ct = color.Red();
       
   618                     //				TInt G_ct = color.Green();
       
   619                     //				TInt B_ct = color.Blue();	
       
   620 
       
   621                     iView.Movie()->VideoClipSetColorTone( currentIndex, color );
       
   622                     iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectToning );
       
   623 
       
   624                     //				TRgb toning = iView.Movie()->VideoClipColorTone(currentIndex);
       
   625                     //				R_ct = toning.Red();
       
   626                     //				G_ct = toning.Green();
       
   627                     //				B_ct = toning.Blue();
       
   628                     }
       
   629                 break;
       
   630                 }
       
   631         case 2:
       
   632             // no effect
       
   633                 {
       
   634                 iView.Movie()->VideoClipSetColorEffect( currentIndex, EVedColorEffectNone );
       
   635                 break;
       
   636                 }
       
   637         default:
       
   638             break;
       
   639         }
       
   640 
       
   641     }
       
   642 
       
   643 void CVeiPopup::ShowEditTextPopupList()
       
   644     {
       
   645     TInt selectedIndex =  - 1; // Selected item's index in popup list.
       
   646     TInt listSelection =  - 1; // -1 = Nothing to remove from list array.
       
   647     TInt removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   648 
       
   649     TBool oneclip = EFalse;
       
   650 
       
   651     if ( iView.Movie()->VideoClipCount() <= 1 )
       
   652         {
       
   653         removeIndex = 0;
       
   654         oneclip = ETrue;
       
   655         }
       
   656 
       
   657     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_TEXT_TITLE, R_VEI_EDIT_TEXT_LIST_BOX_ARRAY, removeIndex, EFalse );
       
   658 
       
   659     listSelection = selectedIndex;
       
   660 
       
   661     if ( selectedIndex >= 0 )
       
   662         {
       
   663         if ( oneclip )
       
   664             {
       
   665             listSelection++;
       
   666             }
       
   667         }
       
   668 
       
   669     switch ( listSelection )
       
   670         {
       
   671         case 0:
       
   672             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextMove );
       
   673             break;
       
   674         case 1:
       
   675             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextRemove );
       
   676             break;
       
   677         case 2:
       
   678             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextChangeDuration );
       
   679             break;
       
   680         case 3:
       
   681             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextChangeText );
       
   682             break;
       
   683         case 4:
       
   684             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextSetTextColor );
       
   685             break;
       
   686         case 5:
       
   687             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextSetBackGround );
       
   688             break;
       
   689         case 6:
       
   690             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextAddColorEffect );
       
   691             break;
       
   692         case 7:
       
   693             ShowEditTextStylePopUpList();
       
   694             break;
       
   695         case 8:
       
   696             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextDuplicate );
       
   697             break;
       
   698         default:
       
   699             break;
       
   700         }
       
   701 
       
   702     }
       
   703 
       
   704 void CVeiPopup::ShowEditTextStylePopUpList()
       
   705     {
       
   706 
       
   707     TInt selectedIndex; // Selected item's index in popup list.
       
   708     TInt removeIndex; // Index to remove from list.
       
   709 
       
   710     removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   711 
       
   712     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_TEXT_TITLE, R_VEI_INSERT_TEXT_LIST_BOX_ARRAY, removeIndex, EFalse );
       
   713 
       
   714     switch ( selectedIndex )
       
   715         {
       
   716         case 0:
       
   717             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitle );
       
   718             break;
       
   719         case 1:
       
   720             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitleFading );
       
   721             break;
       
   722         case 2:
       
   723             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitle );
       
   724             break;
       
   725         case 3:
       
   726             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitleFading );
       
   727             break;
       
   728         case 4:
       
   729             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleCredit );
       
   730             break;
       
   731         default:
       
   732             break;
       
   733         }
       
   734 
       
   735     }
       
   736 
       
   737 void CVeiPopup::ShowEditVideoPopupList()
       
   738     {
       
   739 
       
   740     TInt originalIndex =  - 1;
       
   741     // Selected item's index in original list (read from resource file)	
       
   742     TInt dynamicIndex =  - 1;
       
   743     // Selected item's index in dynamic list (where some items in original list may be removed)
       
   744 
       
   745     // by default, all items are included in list (all are 1s)			
       
   746     for ( TInt i = 0; i < KAmountOfMenuItems; i++ )
       
   747         {
       
   748         RemoveArrayIndex[i] = 1;
       
   749         }
       
   750 
       
   751     // next some items are possibly removed from the list (by marking their index with '0's)
       
   752     // the reference order MUST be the same what it is in the original list in .rss
       
   753 
       
   754     // menu item "Cut" removed
       
   755     TTimeIntervalMicroSeconds duration = iView.Movie()->VideoClipInfo( iView.Container()->CurrentIndex())->Duration();
       
   756     if ( duration.Int64() < KMinCutVideoLength )
       
   757         {
       
   758         RemoveArrayIndex[0] = 0;
       
   759         }
       
   760     // menu item "Move" removed
       
   761     if ( iView.Movie()->VideoClipCount() <= 1 )
       
   762         {
       
   763         RemoveArrayIndex[1] = 0;
       
   764         }
       
   765 
       
   766     // menu items "Mute" and "Unmute" removed		
       
   767     if ( EFalse == iView.Movie()->VideoClipIsMuteable( iView.Container()->CurrentIndex()))
       
   768         {
       
   769         RemoveArrayIndex[4] = 0;
       
   770         RemoveArrayIndex[5] = 0;
       
   771         }
       
   772     else
       
   773         {
       
   774         // menu item "Mute" removed
       
   775         if ( iView.Movie()->VideoClipIsMuted( iView.Container()->CurrentIndex()) )
       
   776             {
       
   777             RemoveArrayIndex[4] = 0;
       
   778             }
       
   779         // menu item "Unmute" removed	
       
   780         else
       
   781             {
       
   782             RemoveArrayIndex[5] = 0;
       
   783             }
       
   784         }
       
   785 
       
   786     if ( !( iView.Movie()->VideoClipInfo( iView.Container()->CurrentIndex()))->HasAudio())
       
   787         {
       
   788         RemoveArrayIndex[6] = 0; //EVeiCmdEditVideoAdjustVolume);
       
   789         }
       
   790 
       
   791 
       
   792     dynamicIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_VIDEO_TITLE, R_VEI_EDIT_VIDEO_LIST_BOX_ARRAY, KAmountOfMenuItems, ETrue );
       
   793 
       
   794     if ( dynamicIndex < 0 )
       
   795         {
       
   796         return ;
       
   797         }
       
   798 
       
   799     // next find out what was the selected item in the original list
       
   800     // i.e. count 1's until dynamicIndex reached
       
   801     TInt cnt =  - 1;
       
   802     for ( TInt i = 0; i < KAmountOfMenuItems; i++ )
       
   803         {
       
   804         if ( 1 == RemoveArrayIndex[i] )
       
   805             {
       
   806             cnt++;
       
   807             if ( dynamicIndex == cnt )
       
   808                 {
       
   809                 originalIndex = i;
       
   810                 break;
       
   811                 }
       
   812             }
       
   813         }
       
   814 
       
   815     switch ( originalIndex )
       
   816         {
       
   817         case 0:
       
   818             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoCutting );
       
   819             break;
       
   820         case 1:
       
   821             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoMove );
       
   822             break;
       
   823         case 2:
       
   824             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoColorEffect );
       
   825             break;
       
   826         case 3:
       
   827             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoSlowMotion );
       
   828             break;
       
   829         case 4:
       
   830             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoMute );
       
   831             break;
       
   832         case 5:
       
   833             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoUnmute );
       
   834             break;
       
   835         case 6:
       
   836             iView.HandleCommandL( EVeiCmdEditVideoAdjustVolume );
       
   837             break;
       
   838         case 7:
       
   839             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoRemove );
       
   840             break;
       
   841         case 8:
       
   842             iView.HandleCommandL( EVeiCmdEditVideoDuplicate );
       
   843             break;
       
   844         default:
       
   845             break;
       
   846         }
       
   847     }
       
   848 
       
   849 void CVeiPopup::ShowEditImagePopupList()
       
   850     {
       
   851     TInt selectedIndex =  - 1; // Selected item's index in popup list.
       
   852     TInt listSelection =  - 1; // -1 = Nothing to remove from list array.
       
   853     TInt removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   854 
       
   855     TBool oneclip = EFalse;
       
   856 
       
   857     if ( iView.Movie()->VideoClipCount() <= 1 )
       
   858         {
       
   859         removeIndex = 0;
       
   860         oneclip = ETrue;
       
   861         }
       
   862 
       
   863 
       
   864     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_IMAGE_TITLE, R_VEI_EDIT_IMAGE_LIST_BOX_ARRAY, removeIndex, EFalse );
       
   865 
       
   866     listSelection = selectedIndex;
       
   867 
       
   868     if ( selectedIndex >= 0 )
       
   869         {
       
   870         if ( oneclip )
       
   871             {
       
   872             listSelection++;
       
   873             }
       
   874         }
       
   875 
       
   876     switch ( listSelection )
       
   877         {
       
   878         case 0:
       
   879             iView.HandleCommandL( EVeiCmdEditVideoViewEditImageMove );
       
   880             break;
       
   881         case 1:
       
   882             iView.HandleCommandL( EVeiCmdEditVideoViewEditImageRemove );
       
   883             break;
       
   884         case 2:
       
   885             iView.HandleCommandL( EVeiCmdEditVideoViewEditImageChangeDuration );
       
   886             break;
       
   887         case 3:
       
   888             iView.HandleCommandL( EVeiCmdEditVideoViewEditImageBackGround );
       
   889             break;
       
   890         case 4:
       
   891             iView.HandleCommandL( EVeiCmdEditVideoViewEditImageAddColorEffect );
       
   892             break;
       
   893         case 5:
       
   894             iView.HandleCommandL( EVeiCmdEditVideoViewEditImageDuplicate );
       
   895             break;
       
   896         default:
       
   897             break;
       
   898         }
       
   899 
       
   900     }
       
   901 
       
   902 TInt CVeiPopup::ShowTitleScreenBackgroundSelectionPopupL( TBool& aImageSelected )const
       
   903     {
       
   904     TInt selectedItem(  - 1 );
       
   905     CAknListQueryDialog* query = new( ELeave )CAknListQueryDialog( &selectedItem );
       
   906     query->PrepareLC( R_VEI_TITLESCREEN_BACKGROUND_LIST_QUERY );
       
   907     if ( !query->RunLD())
       
   908         {
       
   909         return KErrCancel;
       
   910         }
       
   911 
       
   912     if ( selectedItem == 0 )
       
   913         {
       
   914         aImageSelected = ETrue;
       
   915         }
       
   916     else
       
   917         {
       
   918         aImageSelected = EFalse;
       
   919         }
       
   920 
       
   921     return KErrNone;
       
   922 
       
   923     }
       
   924 
       
   925 void CVeiPopup::ShowTitleScreenStyleSelectionPopupL()
       
   926     {
       
   927     TInt selectedIndex; // Selected item's index in popup list.
       
   928     TInt removeIndex; // Index to remove from list.
       
   929 
       
   930     removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   931 
       
   932     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_SELECT_TEXT_STYLE_TITLE, R_VEI_INSERT_TEXT_LIST_BOX_ARRAY, removeIndex, EFalse );
       
   933 
       
   934     switch ( selectedIndex )
       
   935         {
       
   936         case 0:
       
   937             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitle );
       
   938             break;
       
   939         case 1:
       
   940             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleTitleFading );
       
   941             break;
       
   942         case 2:
       
   943             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitle );
       
   944             break;
       
   945         case 3:
       
   946             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleSubTitleFading );
       
   947             break;
       
   948         case 4:
       
   949             iView.HandleCommandL( EVeiCmdEditVideoViewEditTextStyleCredit );
       
   950             break;
       
   951         default:
       
   952             break;
       
   953         }
       
   954 
       
   955     }
       
   956 
       
   957 void CVeiPopup::ShowEditAudioPopupList()
       
   958     {
       
   959     TInt selectedIndex; // Selected item's index in popup list.
       
   960     TInt removeIndex; // Index to remove from list.
       
   961 
       
   962     removeIndex =  - 1; // -1 = Nothing to remove from list array.
       
   963 
       
   964     selectedIndex = ExecutePopupListL( R_AVKON_SOFTKEYS_SELECT_CANCEL, R_VEI_POPUP_EDIT_AUDIO_TITLE, R_VEI_EDIT_AUDIO_LIST_BOX_ARRAY, removeIndex, EFalse );
       
   965 
       
   966     switch ( selectedIndex )
       
   967         {
       
   968         case 0:
       
   969             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoCutting );
       
   970             break;
       
   971         case 1:
       
   972             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoMove );
       
   973             break;
       
   974         case 2:
       
   975             iView.HandleCommandL( EVeiCmdEditVideoViewEditAudioSetDuration );
       
   976             break;
       
   977         case 3:
       
   978             iView.HandleCommandL( EVeiCmdEditVideoAdjustVolume );
       
   979             break;
       
   980         case 4:
       
   981             iView.HandleCommandL( EVeiCmdEditVideoViewEditVideoRemove );
       
   982             break;
       
   983         case 5:
       
   984             iView.HandleCommandL( EVeiCmdEditVideoDuplicate );
       
   985             break;
       
   986         default:
       
   987             break;
       
   988         }
       
   989 
       
   990     }
       
   991 
       
   992 TBool CVeiPopup::ShowColorSelectorL( TRgb& aColor )const
       
   993     {
       
   994     TBool noneChosen = EFalse;
       
   995     /* None color option: True/False */
       
   996 
       
   997 
       
   998     TBool noneExist = EFalse;
       
   999 
       
  1000     CArrayFixFlat < TRgb > * colors = new( ELeave )CArrayFixFlat < TRgb > ( 16 );
       
  1001     CleanupStack::PushL( colors );
       
  1002 
       
  1003     colors->AppendL( TRgb( 0xffffff ));
       
  1004     colors->AppendL( TRgb( 0xcccccc ));
       
  1005     colors->AppendL( TRgb( 0x4d4d4d ));
       
  1006     colors->AppendL( TRgb( 0x000000 ));
       
  1007     colors->AppendL( TRgb( 0x00ffff ));
       
  1008     colors->AppendL( TRgb( 0x44d8ff ));
       
  1009     colors->AppendL( TRgb( 0x0268ff ));
       
  1010     colors->AppendL( TRgb( 0x001ef1 ));
       
  1011     colors->AppendL( TRgb( 0x00ffb9 ));
       
  1012     colors->AppendL( TRgb( 0x00c873 ));
       
  1013     colors->AppendL( TRgb( 0x026c3e ));
       
  1014     colors->AppendL( TRgb( 0x0017c8 ));
       
  1015     colors->AppendL( TRgb( 0xe7be7a ));
       
  1016     colors->AppendL( TRgb( 0xff9b00 ));
       
  1017     colors->AppendL( TRgb( 0xb36718 ));
       
  1018     colors->AppendL( TRgb( 0x803e00 ));
       
  1019 
       
  1020 
       
  1021     CAknColourSelectionGrid* d = CAknColourSelectionGrid::NewL( colors, noneExist, noneChosen, aColor );
       
  1022     TBool selected = d->ExecuteLD();
       
  1023     CleanupStack::PopAndDestroy( colors );
       
  1024 
       
  1025     //return !noneChosen;
       
  1026     return selected;
       
  1027     }
       
  1028 
       
  1029 // End of File