sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// Part of the MVS Application for TechView
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "MVSCropDialog.h"
|
sl@0
|
19 |
#include "MVSApp.hrh"
|
sl@0
|
20 |
#include <techview/eikmfne.h>
|
sl@0
|
21 |
#include <coecntrl.h>
|
sl@0
|
22 |
#include <techview/eikhopbt.h>
|
sl@0
|
23 |
#include <techview/eiklabel.h>
|
sl@0
|
24 |
#include "MVSAppUI.h"
|
sl@0
|
25 |
|
sl@0
|
26 |
const TUint KMicroSecs = 1000000;
|
sl@0
|
27 |
|
sl@0
|
28 |
void CMVSCropDialog::SetupDialogLD(TTimeIntervalMicroSeconds aPosition,
|
sl@0
|
29 |
TTimeIntervalMicroSeconds aClipLength,
|
sl@0
|
30 |
TTimeIntervalMicroSeconds aCropStart,
|
sl@0
|
31 |
TTimeIntervalMicroSeconds aCropEnd,
|
sl@0
|
32 |
CMVSAppUi* aAppUi)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
CMVSCropDialog* dialog = new (ELeave) CMVSCropDialog(aPosition, aClipLength,
|
sl@0
|
35 |
aCropStart, aCropEnd, aAppUi);
|
sl@0
|
36 |
dialog->ExecuteLD(R_MVS_DIALOG_CROP);
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
|
sl@0
|
40 |
void CMVSCropDialog::PreLayoutDynInitL()
|
sl@0
|
41 |
{
|
sl@0
|
42 |
TInt start = I64INT(iCropStart.Int64()) > 1? (I64INT(iCropStart.Int64())/KMicroSecs) : 0;
|
sl@0
|
43 |
TInt finish = I64INT(iCropEnd.Int64()) > 1? (I64INT(iCropEnd.Int64())/KMicroSecs) : I64INT(iClipLength.Int64())/KMicroSecs;
|
sl@0
|
44 |
//check the current position is valid.
|
sl@0
|
45 |
if(I64INT(iPosition.Int64())/KMicroSecs < start)
|
sl@0
|
46 |
iPosition = start;
|
sl@0
|
47 |
else if (I64INT(iPosition.Int64())/KMicroSecs > finish)
|
sl@0
|
48 |
iPosition = finish;
|
sl@0
|
49 |
|
sl@0
|
50 |
InitControl(TInt(EMVSCmdCropPositionNumber), I64INT(iPosition.Int64())/KMicroSecs, start, finish );
|
sl@0
|
51 |
|
sl@0
|
52 |
CEikHorOptionButtonList* button = static_cast<CEikHorOptionButtonList*>(Control(EMVSCmdCropLeftRight));
|
sl@0
|
53 |
button->SetButtonById(EMVSHorOptButtonCropFromBeginning);
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
|
sl@0
|
57 |
|
sl@0
|
58 |
//
|
sl@0
|
59 |
//CCropDialog()
|
sl@0
|
60 |
//
|
sl@0
|
61 |
// C++ Constructor, initialises the object member variables to their
|
sl@0
|
62 |
// current settings.
|
sl@0
|
63 |
//
|
sl@0
|
64 |
CMVSCropDialog::CMVSCropDialog(TTimeIntervalMicroSeconds aPosition,
|
sl@0
|
65 |
TTimeIntervalMicroSeconds aClipLength,
|
sl@0
|
66 |
TTimeIntervalMicroSeconds aCropStart,
|
sl@0
|
67 |
TTimeIntervalMicroSeconds aCropEnd,
|
sl@0
|
68 |
CMVSAppUi* aAppUi)
|
sl@0
|
69 |
: iPosition(aPosition), iCropStart(aCropStart), iCropEnd(aCropEnd), iCropFromBeginning(EFalse), iAppUi(aAppUi)
|
sl@0
|
70 |
{
|
sl@0
|
71 |
if (I64INT(aCropEnd.Int64()) > 1)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
iClipLength = aCropEnd;
|
sl@0
|
74 |
}
|
sl@0
|
75 |
else
|
sl@0
|
76 |
{
|
sl@0
|
77 |
iClipLength = aClipLength;
|
sl@0
|
78 |
}
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
|
sl@0
|
82 |
|
sl@0
|
83 |
TBool CMVSCropDialog::OkToExitL(TInt aButtonId)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
//Get a pointer to the Option Button List control
|
sl@0
|
86 |
CEikHorOptionButtonList* button = static_cast<CEikHorOptionButtonList*>(Control(EMVSCmdCropLeftRight));
|
sl@0
|
87 |
//Get a pointer to the number editor
|
sl@0
|
88 |
CEikNumberEditor* control = static_cast<CEikNumberEditor*> ( Control(EMVSCmdCropPositionNumber) );
|
sl@0
|
89 |
TInt position = control->Number()*KMicroSecs;
|
sl@0
|
90 |
TInt64 pos64(position);
|
sl@0
|
91 |
iPosition = TTimeIntervalMicroSeconds(pos64);
|
sl@0
|
92 |
if(iPosition > iClipLength)
|
sl@0
|
93 |
{
|
sl@0
|
94 |
iPosition = iClipLength;
|
sl@0
|
95 |
}
|
sl@0
|
96 |
if(iPosition < iCropStart)
|
sl@0
|
97 |
{
|
sl@0
|
98 |
iPosition = iCropStart;
|
sl@0
|
99 |
}
|
sl@0
|
100 |
TInt buttonId = button->LabeledButtonId();
|
sl@0
|
101 |
switch (aButtonId)
|
sl@0
|
102 |
{
|
sl@0
|
103 |
case(EMVSButtonUpdate):
|
sl@0
|
104 |
//update prog info based on num-editor
|
sl@0
|
105 |
if(buttonId == EMVSHorOptButtonCropFromBeginning) //'From Beginning' selected
|
sl@0
|
106 |
{
|
sl@0
|
107 |
iCropFromBeginning = ETrue;
|
sl@0
|
108 |
iCropStart = iPosition;
|
sl@0
|
109 |
}
|
sl@0
|
110 |
else
|
sl@0
|
111 |
{
|
sl@0
|
112 |
iCropFromBeginning = EFalse;
|
sl@0
|
113 |
iCropStart = iPosition;
|
sl@0
|
114 |
}
|
sl@0
|
115 |
iAppUi->SetCropL(iCropStart, iCropFromBeginning);
|
sl@0
|
116 |
break;
|
sl@0
|
117 |
|
sl@0
|
118 |
case(EMVSButtonCancel):
|
sl@0
|
119 |
break;
|
sl@0
|
120 |
|
sl@0
|
121 |
default:
|
sl@0
|
122 |
break;
|
sl@0
|
123 |
}
|
sl@0
|
124 |
return ETrue;
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
void CMVSCropDialog::InitControl( const TInt aId, const TInt aPos, const TInt aStart, const TInt aFinish )
|
sl@0
|
129 |
{
|
sl@0
|
130 |
CEikNumberEditor* control = static_cast<CEikNumberEditor*> ( Control(aId) );
|
sl@0
|
131 |
control->SetNumber(aPos);
|
sl@0
|
132 |
control->SetMinimumAndMaximum( aStart, aFinish );
|
sl@0
|
133 |
}
|
sl@0
|
134 |
|
sl@0
|
135 |
|