author | qifeima <> |
Thu, 03 Jun 2010 18:57:10 +0800 | |
changeset 8 | 18b321db4884 |
parent 1 | edfc90759b9f |
child 9 | a5c0fe6456b2 |
permissions | -rw-r--r-- |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1 |
/* |
8 | 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 |
* Image Editor plugin control class. |
|
17 |
* |
|
18 |
*/ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
19 |
// INCLUDES |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
20 |
#include "imageeditordrawcontrol.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
21 |
#include "draw.hrh" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
22 |
#include "ImageEditorUI.hrh" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
23 |
#include "ImageEditorPluginBase.hrh" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
24 |
#include "PluginInfo.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
25 |
#include "JpTimer.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
26 |
#include "ImageEditorUids.hrh" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
27 |
#include "ImageEditorUiDefs.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
28 |
#include "SystemParameters.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
29 |
#include "drawpath.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
30 |
#include "selectionpopup.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
31 |
#include "iepb.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
32 |
// debug log |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
33 |
#include "imageeditordebugutils.h" |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
34 |
#include <fbs.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
35 |
#include <badesca.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
36 |
#include <gdi.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
37 |
#include <eikenv.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
38 |
#include <bitdev.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
39 |
#include <aknview.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
40 |
#include <aknutils.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
41 |
#include <ImageEditorUI.mbg> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
42 |
#include <AknInfoPopupNoteController.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
43 |
#include <draw.rsg> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
44 |
#include <bautils.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
45 |
#include <ConeResLoader.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
46 |
#include <gulalign.h> |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
47 |
#include <csxhelp/sie.hlp.hrh> |
8 | 48 |
#include <Icons_doodle.mbg> |
49 |
#include "CImageLabel.h" |
|
50 |
#include <aknnotewrappers.h> |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
51 |
// Log file |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
52 |
_LIT(KDrawPluginLogFile,"drawplugin.log"); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
53 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
54 |
// CONSTANTS |
8 | 55 |
const TInt KWait = 1; |
56 |
const TInt KMainTextIndex = 0; |
|
57 |
//#define HORIZ TPoint(0,72),TPoint(502,360) |
|
58 |
//#define VERTICAL TPoint(0,92),TPoint(360,579) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
59 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
60 |
// NewL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
61 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
62 |
// |
8 | 63 |
CImageEditorDrawControl* CImageEditorDrawControl::NewL(const TRect& aRect, |
64 |
CCoeControl* aParent, RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, |
|
65 |
TSize& aSize, TBool &aDisplayTool) |
|
66 |
{ |
|
67 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NewL()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
68 |
|
8 | 69 |
CImageEditorDrawControl * self = new (ELeave) CImageEditorDrawControl( |
70 |
aPaths, aRgb, aSize, aDisplayTool); |
|
71 |
CleanupStack::PushL(self); |
|
72 |
self->ConstructL(aRect, aParent); |
|
73 |
CleanupStack::Pop(); // self |
|
74 |
return self; |
|
75 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
76 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
77 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
78 |
// CImageEditorDrawControl |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
79 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
80 |
// |
8 | 81 |
CImageEditorDrawControl::CImageEditorDrawControl( |
82 |
RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, TSize& aSize, |
|
83 |
TBool& aDisplayTool) : |
|
84 |
iTickCount(0), iX(0), iY(0), iNaviStepMultiplier( |
|
85 |
KDefaultSmallNavigationStepMultiplier), iDisplayingOkOptionsMenu( |
|
86 |
EFalse), iReadyToRender(EFalse), iResLoader(*ControlEnv()), iPaths( |
|
87 |
aPaths), iRgb(aRgb), iSize(aSize), iDisplayTool(aDisplayTool) |
|
88 |
||
89 |
{ |
|
90 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
91 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
92 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
93 |
// ~CImageEditorDrawControl() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
94 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
95 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
96 |
CImageEditorDrawControl::~CImageEditorDrawControl() |
8 | 97 |
{ |
98 |
LOG(KDrawPluginLogFile, |
|
99 |
"CImageEditorDrawControl::~CImageEditorDrawControl()"); |
|
100 |
delete iCustomComponet; |
|
101 |
delete iTimer; |
|
102 |
delete iIndicator; |
|
103 |
delete iIndicatorMask; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
104 |
delete iPopupController; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
105 |
delete iTooltipResize; |
8 | 106 |
delete iRollAo; |
107 |
delete iNaviPaneText; |
|
108 |
delete iGc; |
|
109 |
delete iBitmapDev; |
|
110 |
delete iAnimationAO; |
|
111 |
||
112 |
iUndoPaths.ResetAndDestroy(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
113 |
iResLoader.Close(); |
8 | 114 |
|
115 |
for (int i = 0; i < iTotalComponent; i++) |
|
116 |
{ |
|
117 |
CImageLabel* &temp = iLabels[i]; |
|
118 |
if (temp != NULL) |
|
119 |
{ |
|
120 |
delete temp; |
|
121 |
temp = NULL; |
|
122 |
} |
|
123 |
} |
|
124 |
iLabels.ResetAndDestroy(); |
|
125 |
||
126 |
||
127 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
128 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
129 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
130 |
// ConstructL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
131 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
132 |
// |
8 | 133 |
void CImageEditorDrawControl::ConstructL(const TRect& aRect, |
134 |
CCoeControl* aParent) |
|
135 |
{ |
|
136 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::ConstructL()"); |
|
137 |
||
138 |
CreateWindowL(); |
|
139 |
EnableDragEvents(); |
|
140 |
//iRollDirection = EFalse; |
|
141 |
iStatuspaneHeight = aRect.iTl.iY; |
|
142 |
iUndo = EFalse; |
|
143 |
iRedo = EFalse; |
|
144 |
iCanRedo = EFalse; |
|
145 |
//iRollDirection = ETrue; |
|
146 |
// Create resource utility |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
147 |
TFileName resFile; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
148 |
// resource file name |
8 | 149 |
_LIT(KResourceFile, "draw.rsc"); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
150 |
resFile.Append(KPgnResourcePath); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
151 |
resFile.Append(KResourceFile); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
152 |
|
8 | 153 |
User::LeaveIfError(CompleteWithAppPath(resFile)); |
154 |
// Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile |
|
155 |
// to search for a localised resource in proper search order |
|
156 |
iResLoader.OpenL(resFile); |
|
157 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
158 |
// Create timer for fast key repeat |
8 | 159 |
iTimer = CJPTimer::NewL(this); |
160 |
||
161 |
iPopupController = CAknInfoPopupNoteController::NewL(); |
|
162 |
iTooltipResize = ControlEnv()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); |
|
163 |
||
164 |
SetExtentToWholeScreen(); |
|
165 |
// TRect a(HORIZ); |
|
166 |
// iClientRectH = a; |
|
167 |
// TRect b(VERTICAL); |
|
168 |
// iClientRectV = b; |
|
169 |
iCustomComponetClick = EFalse; |
|
170 |
TRect rect = Rect(); |
|
171 |
//iDisplayTool=ETrue; |
|
172 |
if (rect.Width() < rect.Height()) |
|
173 |
{ |
|
174 |
InitializeMainMenu(EMainMenuHorizontal); |
|
175 |
} |
|
176 |
else if (rect.Width() > rect.Height()) |
|
177 |
{ |
|
178 |
InitializeMainMenu(EMainMenuVertical); |
|
179 |
} |
|
180 |
||
181 |
TRect Trect(TPoint(0, 0), TPoint(50, 50)); |
|
182 |
iCustomComponet = CCustomerComponet::NewL(Trect, this); |
|
183 |
iCustomComponet->SetExtent(TPoint(40, 100), TSize(50, 50)); |
|
184 |
iCustomComponet->SetHandlePointerObserver(this); |
|
185 |
iLastPointEventType = EFalse; |
|
186 |
// Activate control |
|
187 |
ActivateL(); |
|
188 |
||
189 |
} |
|
190 |
||
191 |
void CImageEditorDrawControl::InitializeMainMenu( |
|
192 |
TMainMenuLayout aMainMenuLayout) |
|
193 |
{ |
|
194 |
iMainMenuLayout = aMainMenuLayout; |
|
195 |
_LIT(KSvgPath, "\\resource\\apps\\icons_doodle.mif"); |
|
196 |
TFileName svgFile(KSvgPath); |
|
197 |
User::LeaveIfError(CompleteWithAppPath(svgFile)); |
|
198 |
iTotalComponent = 7; |
|
199 |
TRect clipRect; |
|
200 |
if (iMainMenuLayout == EMainMenuHorizontal) |
|
201 |
{ |
|
202 |
iLoopMenuRect = TRect(TPoint(0, Rect().iBr.iY - 87), TSize(360, 87)); |
|
203 |
||
204 |
for (int i = 0; i < iTotalComponent; i++) |
|
205 |
{ |
|
206 |
if (iDisplayTool) |
|
207 |
{ |
|
208 |
TRect |
|
209 |
Rect1(TPoint(i * 72, iLoopMenuRect.iTl.iY), TSize(72, |
|
210 |
87)); |
|
211 |
clipRect = Rect1; |
|
212 |
} |
|
213 |
||
214 |
else |
|
215 |
{ |
|
216 |
TRect Rect2(TPoint(i * 72 - iLoopMenuRect.Width() - 72 * 2, |
|
217 |
iLoopMenuRect.iTl.iY), TSize(72, 87)); |
|
218 |
clipRect = Rect2; |
|
219 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
220 |
|
8 | 221 |
CImageLabel* label = CImageLabel::NewL(this, clipRect, |
222 |
CImageLabel::ELabelHorizontal); |
|
223 |
label->SetHandlePointerObserver(this); |
|
224 |
iLabels.Append(label); |
|
225 |
} |
|
226 |
} |
|
227 |
else if (iMainMenuLayout == EMainMenuVertical) |
|
228 |
{ |
|
229 |
iLoopMenuRect = TRect(TPoint(Rect().iBr.iX - 87, 0), TSize(87, 360)); |
|
230 |
||
231 |
for (int i = 0; i < iTotalComponent; i++) |
|
232 |
{ |
|
233 |
if (iDisplayTool) |
|
234 |
{ |
|
235 |
TRect |
|
236 |
Rect1(TPoint(iLoopMenuRect.iTl.iX, i * 72), TSize(87, |
|
237 |
72)); |
|
238 |
clipRect = Rect1; |
|
239 |
} |
|
240 |
else |
|
241 |
{ |
|
242 |
TRect Rect2(TPoint(iLoopMenuRect.iTl.iX, i * 72 |
|
243 |
- iLoopMenuRect.Height() - 72 * 2), TSize(87, 72)); |
|
244 |
clipRect = Rect2; |
|
245 |
} |
|
246 |
||
247 |
CImageLabel* label = CImageLabel::NewL(this, clipRect, |
|
248 |
CImageLabel::ELabelVertical); |
|
249 |
label->SetHandlePointerObserver(this); |
|
250 |
iLabels.Append(label); |
|
251 |
} |
|
252 |
} |
|
253 |
||
254 |
iLabels[0]->SetImage(svgFile, EMbmIcons_doodlePensize); |
|
255 |
iLabels[0]->SetTooltip(_L("Pensize")); |
|
256 |
||
257 |
iLabels[1]->SetImage(svgFile, EMbmIcons_doodlePalette); |
|
258 |
iLabels[1]->SetTooltip(_L("Palette")); |
|
259 |
||
260 |
iLabels[2]->SetImage(svgFile, EMbmIcons_doodleUndo); |
|
261 |
iLabels[2]->SetTooltip(_L("Undo")); |
|
262 |
||
263 |
iLabels[3]->SetImage(svgFile, EMbmIcons_doodleSave); |
|
264 |
iLabels[3]->SetTooltip(_L("Save")); |
|
265 |
||
266 |
iLabels[4]->SetImage(svgFile, EMbmIcons_doodleMenu); |
|
267 |
iLabels[4]->SetTooltip(_L("About")); |
|
268 |
||
269 |
iLabels[5]->SetImage(svgFile, EMbmIcons_doodlePalette); |
|
270 |
iLabels[5]->SetTooltip(_L("Redo")); |
|
271 |
||
272 |
iLabels[6]->SetImage(svgFile, EMbmIcons_doodlePensize); |
|
273 |
iLabels[6]->SetTooltip(_L("Null")); |
|
274 |
||
275 |
iAnimationAO = CAnimationAO::NewL(); |
|
276 |
iAnimationAO->SetObserver(this); |
|
277 |
iRollAo = CRollAO::NewL(); |
|
278 |
iRollAo->SetObserver(this); |
|
279 |
||
280 |
iButtonDownPoint = TPoint(0, 0); |
|
281 |
iDragStartPoint = TPoint(0, 0); |
|
282 |
iDragPrePoint = TPoint(0, 0); |
|
283 |
iDragUpPoint = TPoint(0, 0); |
|
284 |
||
285 |
iPointStartInLoopRect = EFalse; |
|
286 |
iDragIsStart = EFalse; |
|
287 |
iEnableAnimationEffect = EFalse; |
|
288 |
iDragOffset = 0; |
|
289 |
||
290 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
291 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
292 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
293 |
// SetView |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
294 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
295 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
296 |
void CImageEditorDrawControl::SetView(CAknView* aView) |
8 | 297 |
{ |
298 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetView()"); |
|
299 |
ASSERT(aView); |
|
300 |
iEditorView = aView; |
|
301 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
302 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
303 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
304 |
// SetSelectedUiItemL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
305 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
306 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
307 |
void CImageEditorDrawControl::SetSelectedUiItemL(CPluginInfo* aItem) |
8 | 308 |
{ |
309 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSelectedUiItemL()"); |
|
310 |
ASSERT(aItem); |
|
311 |
iItem = aItem; |
|
312 |
delete iNaviPaneText; |
|
313 |
iNaviPaneText = NULL; |
|
314 |
iNaviPaneText = (iItem->Parameters()[KMainTextIndex]).AllocL(); |
|
315 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
316 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
317 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
318 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
319 |
// OfferKeyEventL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
320 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
321 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
322 |
TKeyResponse CImageEditorDrawControl::OfferKeyEventL( |
8 | 323 |
const TKeyEvent& aKeyEvent, TEventCode aType) |
324 |
{ |
|
325 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::OfferKeyEventL()"); |
|
326 |
||
327 |
TKeyResponse response = EKeyWasNotConsumed; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
328 |
|
8 | 329 |
// If busy, do not handle anything |
330 |
if (Busy()) |
|
331 |
{ |
|
332 |
response = EKeyWasConsumed; |
|
333 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
334 |
|
8 | 335 |
// In main state handle the OK Options menu |
336 |
else if (aKeyEvent.iCode == EKeyOK) |
|
337 |
{ |
|
338 |
iDisplayingOkOptionsMenu = ETrue; |
|
339 |
iEditorView->HandleCommandL(EImageEditorTryDisplayMenuBar); |
|
340 |
response = EKeyWasConsumed; |
|
341 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
342 |
|
8 | 343 |
// We handle only event keys |
344 |
else if (EEventKey == aType) |
|
345 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
346 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
347 |
switch (aKeyEvent.iCode) |
8 | 348 |
{ |
349 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
350 |
case EKeyDownArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
351 |
case EKeyUpArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
352 |
case EKeyRightArrow: |
8 | 353 |
case EKeyLeftArrow: |
354 |
{ |
|
355 |
SetPositionOnImage(ComputeIndicatorPosition()); |
|
356 |
StoreParameters(EFalse, EFalse); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
357 |
response = EKeyWasConsumed; |
8 | 358 |
break; |
359 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
360 |
|
8 | 361 |
case EKeyOK: |
362 |
{ |
|
363 |
break; |
|
364 |
} |
|
365 |
||
366 |
case 0x30: // 0 |
|
367 |
case 0x32: // 2 |
|
368 |
case 0x34: // 4 |
|
369 |
case 0x35: // 5 |
|
370 |
case 0x36: // 6 |
|
371 |
case 0x38: // 8 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
372 |
case EStdKeyIncVolume: // zoom in key |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
373 |
case EStdKeyDecVolume: // zoom out key |
8 | 374 |
{ |
375 |
StorePosAndScaleRelScreen(); |
|
376 |
break; |
|
377 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
378 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
379 |
default: |
8 | 380 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
381 |
break; |
8 | 382 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
383 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
384 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
385 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
386 |
// Key pressed down, mark pressed key |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
387 |
else if (aType == EEventKeyDown) |
8 | 388 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
389 |
switch (aKeyEvent.iScanCode) |
8 | 390 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
391 |
case EStdKeyUpArrow: |
8 | 392 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
393 |
iKeyCode = 1; |
8 | 394 |
response = EKeyWasConsumed; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
395 |
break; |
8 | 396 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
397 |
case EStdKeyDownArrow: |
8 | 398 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
399 |
iKeyCode = 2; |
8 | 400 |
response = EKeyWasConsumed; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
401 |
break; |
8 | 402 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
403 |
case EStdKeyLeftArrow: |
8 | 404 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
405 |
iKeyCode = 3; |
8 | 406 |
response = EKeyWasConsumed; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
407 |
break; |
8 | 408 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
409 |
case EStdKeyRightArrow: |
8 | 410 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
411 |
iKeyCode = 4; |
8 | 412 |
response = EKeyWasConsumed; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
413 |
break; |
8 | 414 |
} |
415 |
} |
|
416 |
||
417 |
if (iKeyCode != 0) |
|
418 |
{ |
|
419 |
iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier; |
|
420 |
iTickCount = 0; |
|
421 |
iTimer->Call(KWait); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
422 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
423 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
424 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
425 |
// Key released, mark all keys to zero |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
426 |
else if (aType == EEventKeyUp) |
8 | 427 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
428 |
switch (aKeyEvent.iScanCode) |
8 | 429 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
430 |
case EStdKeyUpArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
431 |
case EStdKeyDownArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
432 |
case EStdKeyLeftArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
433 |
case EStdKeyRightArrow: |
8 | 434 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
435 |
iKeyCode = 0; |
8 | 436 |
response = EKeyWasConsumed; |
437 |
ShowTooltip(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
438 |
break; |
8 | 439 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
440 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
441 |
} |
8 | 442 |
|
443 |
return response; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
444 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
445 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
446 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
447 |
// SizeChanged |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
448 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
449 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
450 |
void CImageEditorDrawControl::SizeChanged() |
8 | 451 |
{ |
452 |
if (iSizeChangeFlag) |
|
453 |
{ |
|
454 |
SetToolBarStatus(); |
|
455 |
} |
|
456 |
else |
|
457 |
{ |
|
458 |
iSizeChangeFlag = ETrue; |
|
459 |
} |
|
460 |
if (iDragIsStart) |
|
461 |
{ |
|
462 |
if (iMainMenuLayout == EMainMenuHorizontal) |
|
463 |
{ |
|
464 |
for (TInt i = 0; i < iTotalComponent; i++) |
|
465 |
{ |
|
466 |
if (iLabels[0]->Rect().iTl.iX <= 0) |
|
467 |
{ |
|
468 |
TInt x = iLabels[i]->Rect().iTl.iX; |
|
469 |
iLabels[i]->SetPosition(TPoint(x + iDragOffset, |
|
470 |
iLoopMenuRect.iTl.iY)); |
|
471 |
iLabels[i]->ResetControl(); |
|
472 |
} |
|
473 |
} |
|
474 |
} |
|
475 |
else if (iMainMenuLayout == EMainMenuVertical) |
|
476 |
{ |
|
477 |
for (TInt i = 0; i < iTotalComponent; i++) |
|
478 |
{ |
|
479 |
if (iLabels[0]->Rect().iTl.iY <= 0) |
|
480 |
{ |
|
481 |
TInt y = iLabels[i]->Rect().iTl.iY; |
|
482 |
iLabels[i]->SetPosition(TPoint(iLoopMenuRect.iTl.iX, y |
|
483 |
+ iDragOffset)); |
|
484 |
iLabels[i]->ResetControl(); |
|
485 |
} |
|
486 |
} |
|
487 |
} |
|
488 |
DrawNow(); |
|
489 |
} |
|
490 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
491 |
|
8 | 492 |
void CImageEditorDrawControl::SetToolBarStatus() |
493 |
{ |
|
494 |
||
495 |
if (iMainMenuLayout == EMainMenuHorizontal) |
|
496 |
{ |
|
497 |
TInt leftX = iLabels[0]->Rect().iTl.iX; |
|
498 |
TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
|
499 |
if (leftX == 0) |
|
500 |
iDisplayTool = ETrue; |
|
501 |
else if (rightX == 0) |
|
502 |
iDisplayTool = EFalse; |
|
503 |
} |
|
504 |
else if (iMainMenuLayout == EMainMenuVertical) |
|
505 |
{ |
|
506 |
TInt topY = iLabels[0]->Rect().iTl.iY; |
|
507 |
TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; |
|
508 |
if (topY == 0) |
|
509 |
iDisplayTool = ETrue; |
|
510 |
else if (bottomY == 0) |
|
511 |
iDisplayTool = EFalse; |
|
512 |
||
513 |
} |
|
514 |
||
515 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
516 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
517 |
// GetParam |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
518 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
519 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
520 |
TDesC& CImageEditorDrawControl::GetParam() |
8 | 521 |
{ |
522 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetParam()"); |
|
523 |
LOGDES(KDrawPluginLogFile, iParam); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
524 |
return iParam; |
8 | 525 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
526 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
527 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
528 |
// SetSystemParameters |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
529 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
530 |
// |
8 | 531 |
void CImageEditorDrawControl::SetSystemParameters( |
532 |
const CSystemParameters* aPars) |
|
533 |
{ |
|
534 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSystemParameters()"); |
|
535 |
ASSERT(aPars); |
|
536 |
iSysPars = aPars; |
|
537 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
538 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
539 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
540 |
// HandlePluginCommandL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
541 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
542 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
543 |
void CImageEditorDrawControl::HandlePluginCommandL(const TInt aCommand) |
8 | 544 |
{ |
545 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::HandlePluginCommandL()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
546 |
|
8 | 547 |
switch (aCommand) |
548 |
{ |
|
549 |
case EImageEditorFocusLost: |
|
550 |
{ |
|
551 |
if (iTimer) |
|
552 |
{ |
|
553 |
iTimer->Cancel(); |
|
554 |
} |
|
555 |
break; |
|
556 |
} |
|
557 |
case EPgnSoftkeyIdOk: |
|
558 |
{ |
|
559 |
iPopupController->HideInfoPopupNote(); |
|
560 |
break; |
|
561 |
} |
|
562 |
case EPgnSoftkeyIdCancel: |
|
563 |
{ |
|
564 |
iPopupController->HideInfoPopupNote(); |
|
565 |
iEditorView->HandleCommandL(EImageEditorCancelPlugin); |
|
566 |
break; |
|
567 |
} |
|
568 |
case EPgnSoftkeyIdDone: |
|
569 |
// FALLTROUHG |
|
570 |
case EDrawPgnMenuCmdDone: |
|
571 |
{ |
|
572 |
iPopupController->HideInfoPopupNote(); |
|
573 |
StoreParameters(EFalse, ETrue); |
|
574 |
iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call |
|
575 |
iEditorView->HandleCommandL(EImageEditorApplyPlugin); |
|
576 |
break; |
|
577 |
} |
|
578 |
case EDrawPgnMenuCmdResize: |
|
579 |
{ |
|
580 |
StoreParameters(ETrue, ETrue); |
|
581 |
iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call |
|
582 |
SelectSizeL(); |
|
583 |
break; |
|
584 |
} |
|
585 |
case EDrawPgnMenuCmdColor: |
|
586 |
{ |
|
587 |
StoreParameters(ETrue, ETrue); |
|
588 |
iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call |
|
589 |
SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); |
|
590 |
break; |
|
591 |
} |
|
592 |
case EDrawPgnMenuCmdCancel: |
|
593 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
594 |
iReadyToRender = EFalse; |
8 | 595 |
iEditorView->HandleCommandL(EImageEditorCancelPlugin); |
596 |
break; |
|
597 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
598 |
|
8 | 599 |
case EImageEditorGlobalZoomChanged: |
600 |
// FALLTROUGHT |
|
601 |
case EImageEditorGlobalPanChanged: |
|
602 |
{ |
|
603 |
RestorePosAndScaleRelScreen(); |
|
604 |
StoreTempParams(); |
|
605 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
606 |
break; |
|
607 |
} |
|
608 |
||
609 |
case EImageEditorPreScreenModeChange: |
|
610 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
611 |
StorePosAndScaleRelImage(); |
8 | 612 |
break; |
613 |
} |
|
614 |
||
615 |
case EImageEditorPostScreenModeChange: |
|
616 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
617 |
RestorePosAndScaleRelImage(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
618 |
ClipPosition(); |
8 | 619 |
StoreTempParams(); |
620 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
621 |
break; |
|
622 |
} |
|
623 |
default: |
|
624 |
{ |
|
625 |
break; |
|
626 |
} |
|
627 |
} |
|
628 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
629 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
630 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
631 |
// GetSoftkeyIndexL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
632 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
633 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
634 |
TInt CImageEditorDrawControl::GetSoftkeyIndexL() |
8 | 635 |
{ |
636 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetSoftkeyIndexL()"); |
|
637 |
// : Check needed states |
|
638 |
TInt state(2); |
|
639 |
return state; |
|
640 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
641 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
642 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
643 |
// GetContextMenuResourceId |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
644 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
645 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
646 |
TInt CImageEditorDrawControl::GetContextMenuResourceId() |
8 | 647 |
{ |
648 |
return R_TEXT_CONTEXT_MENUBAR; |
|
649 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
650 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
651 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
652 |
// GetDimmedMenuItems |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
653 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
654 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
655 |
TBitField CImageEditorDrawControl::GetDimmedMenuItems() |
8 | 656 |
{ |
657 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetDimmedMenuItems()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
658 |
|
8 | 659 |
TBitField dimmedMenuItems; |
660 |
TInt count = iItem->MenuItems().Count(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
661 |
|
8 | 662 |
if (iDisplayingOkOptionsMenu) |
663 |
{ |
|
664 |
// Dim the command EImageEditorCancelPlugin |
|
665 |
for (TInt i = 0; i < count; i++) |
|
666 |
{ |
|
667 |
// get the menu item id |
|
668 |
TInt menuItem = iItem->MenuItems().At(i).iCommandId; |
|
669 |
if (menuItem == EDrawPgnMenuCmdCancel) |
|
670 |
{ |
|
671 |
dimmedMenuItems.SetBit(i); |
|
672 |
} |
|
673 |
} |
|
674 |
iDisplayingOkOptionsMenu = EFalse; |
|
675 |
} |
|
676 |
||
677 |
for (TInt i = 0; i < count; i++) |
|
678 |
{ |
|
679 |
// get the menu item id |
|
680 |
TInt menuItem = iItem->MenuItems().At(i).iCommandId; |
|
681 |
if (menuItem == EDrawPgnMenuCmdMax) |
|
682 |
{ |
|
683 |
dimmedMenuItems.SetBit(i); |
|
684 |
} |
|
685 |
} |
|
686 |
return dimmedMenuItems; |
|
687 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
688 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
689 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
690 |
// GetNaviPaneTextL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
691 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
692 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
693 |
TPtrC CImageEditorDrawControl::GetNaviPaneTextL( |
8 | 694 |
TBool& aLeftNaviPaneScrollButtonVisibile, |
695 |
TBool& aRightNaviPaneScrollButtonVisible) |
|
696 |
{ |
|
697 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetNaviPaneTextL()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
698 |
|
8 | 699 |
aLeftNaviPaneScrollButtonVisibile = EFalse; |
700 |
aRightNaviPaneScrollButtonVisible = EFalse; |
|
701 |
return *iNaviPaneText; |
|
702 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
703 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
704 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
705 |
// Draw |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
706 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
707 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
708 |
void CImageEditorDrawControl::Draw(const TRect& aRect) const |
8 | 709 |
{ |
710 |
CWindowGc & gc = SystemGc(); |
|
711 |
gc.SetBrushColor(KRgbBlack); |
|
712 |
gc.Clear(aRect); |
|
713 |
||
714 |
TRect ImageRect(iSysPars->VisibleImageRectPrev()); |
|
715 |
CPreviewControlBase::DrawPreviewImage(aRect); |
|
716 |
gc.SetClippingRect(TRect(TPoint(ImageRect.iTl.iX, ImageRect.iTl.iY |
|
717 |
+ iStatuspaneHeight), ImageRect.Size())); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
718 |
|
8 | 719 |
if (iPaths.Count() > 0) |
720 |
{ |
|
721 |
// ASSERT( iSysPars ); |
|
722 |
TInt count = iPaths.Count(); |
|
723 |
for (TInt i(0); i < iPaths.Count(); ++i) |
|
724 |
{ |
|
725 |
CDrawPath* path = iPaths[i]; |
|
726 |
CArrayFix<TPoint>* pathPoints = path->ItemArray(); |
|
727 |
gc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
728 |
gc.SetPenColor(path->Color()); |
|
729 |
gc.SetPenSize(ScaledLineSize(path->Size())); |
|
730 |
gc.DrawPolyLine(pathPoints); |
|
731 |
} |
|
732 |
} |
|
733 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
734 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
735 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
736 |
// NaviDown |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
737 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
738 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
739 |
void CImageEditorDrawControl::NaviDown() |
8 | 740 |
{ |
741 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviDown()"); |
|
742 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
743 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
744 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
745 |
// NaviUp |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
746 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
747 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
748 |
void CImageEditorDrawControl::NaviUp() |
8 | 749 |
{ |
750 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviUp()"); |
|
751 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
752 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
753 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
754 |
// NaviRight |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
755 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
756 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
757 |
void CImageEditorDrawControl::NaviRight() |
8 | 758 |
{ |
759 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviRight()"); |
|
760 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
761 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
762 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
763 |
// NaviLeft |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
764 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
765 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
766 |
void CImageEditorDrawControl::NaviLeft() |
8 | 767 |
{ |
768 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviLeft()"); |
|
769 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
770 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
771 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
772 |
// SelectSizeL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
773 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
774 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
775 |
void CImageEditorDrawControl::SelectSizeL() |
8 | 776 |
{ |
777 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SelectSizeL()"); |
|
778 |
// Symmetric line width / height |
|
779 |
TInt size(iSize.iWidth); |
|
780 |
CSelectionDialog::RunDlgLD(iPreview, Rect(), size, iRgb, |
|
781 |
iSysPars->VisibleImageRectPrev()); |
|
782 |
iSize = TSize(size, size); |
|
783 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
784 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
785 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
786 |
// StoreTempParams |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
787 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
788 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
789 |
void CImageEditorDrawControl::StoreTempParams() |
8 | 790 |
{ |
791 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams(" |
|
792 |
"" |
|
793 |
")"); |
|
794 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
795 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
796 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
797 |
// RestoreTempParams |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
798 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
799 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
800 |
void CImageEditorDrawControl::RestoreTempParams() |
8 | 801 |
{ |
802 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); |
|
803 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
804 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
805 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
806 |
// GetHelpContext |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
807 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
808 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
809 |
void CImageEditorDrawControl::GetHelpContext(TCoeHelpContext& aContext) const |
8 | 810 |
{ |
811 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetHelpContext()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
812 |
|
8 | 813 |
aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); |
814 |
aContext.iContext = KSIE_HLP_EDIT_TEXT; |
|
815 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
816 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
817 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
818 |
// PrepareL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
819 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
820 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
821 |
void CImageEditorDrawControl::PrepareL() |
8 | 822 |
{ |
823 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::PrepareL()"); |
|
824 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
825 |
// Get current view port |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
826 |
TRect rect = iSysPars->VisibleImageRectPrev(); |
8 | 827 |
|
828 |
iReadyToRender = ETrue; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
829 |
|
8 | 830 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
831 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
832 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
833 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
834 |
// LoadIndicatorL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
835 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
836 |
// |
8 | 837 |
void CImageEditorDrawControl::LoadIndicatorL(TInt aBitmapInd, TInt aMaskInd) |
838 |
{ |
|
839 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::LoadIndicatorL()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
840 |
|
8 | 841 |
// Delete old indicator |
842 |
delete iIndicator; |
|
843 |
iIndicator = 0; |
|
844 |
delete iIndicatorMask; |
|
845 |
iIndicatorMask = 0; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
846 |
|
8 | 847 |
// Load new indicator |
848 |
SDrawUtils::GetIndicatorBitmapL(iIndicator, iIndicatorMask, aBitmapInd, |
|
849 |
aMaskInd); |
|
850 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
851 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
852 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
853 |
// ComputeIndicatorPosition |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
854 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
855 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
856 |
TPoint CImageEditorDrawControl::ComputeIndicatorPosition() const |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
857 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
858 |
TRect vprect = iSysPars->VisibleImageRect(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
859 |
TRect vpprect = iSysPars->VisibleImageRectPrev(); |
8 | 860 |
|
861 |
TInt x(0); |
|
862 |
TInt y(0); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
863 |
// check if there is no indicator |
8 | 864 |
if (!iIndicator) |
865 |
{ |
|
866 |
return TPoint(x, y); |
|
867 |
} |
|
868 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
869 |
y = ((iY - vprect.iTl.iY) * vpprect.Height()) / vprect.Height(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
870 |
y += vpprect.iTl.iY; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
871 |
|
8 | 872 |
x = ((iX - vprect.iTl.iX) * vpprect.Width()) / vprect.Width(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
873 |
x += vpprect.iTl.iX; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
874 |
|
8 | 875 |
return TPoint(x, y); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
876 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
877 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
878 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
879 |
// IsReadyToRender |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
880 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
881 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
882 |
TBool CImageEditorDrawControl::IsReadyToRender() const |
8 | 883 |
{ |
884 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::IsReadyToRender()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
885 |
return iReadyToRender; |
8 | 886 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
887 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
888 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
889 |
// StoreParameters |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
890 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
891 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
892 |
void CImageEditorDrawControl::StoreParameters(TBool aLastItem, TBool aDone) |
8 | 893 |
{ |
894 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreParameters()"); |
|
895 |
RDebug::Print(_L("CImageEditorDrawControl::StoreParameters color[%d]"), |
|
896 |
iRgb.Internal()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
897 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
898 |
iParam.Copy(_L("x ")); |
8 | 899 |
iParam.AppendNum(iX); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
900 |
iParam.Append(_L(" y ")); |
8 | 901 |
iParam.AppendNum(iY); |
902 |
if (aLastItem) |
|
903 |
{ |
|
904 |
iParam.Append(_L(" size ")); |
|
905 |
iParam.AppendNum(iSize.iHeight); |
|
906 |
iParam.Append(_L(" color ")); |
|
907 |
iParam.AppendNum(iRgb.Value()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
908 |
iParam.Append(_L(" lastItem ")); |
8 | 909 |
} |
910 |
||
911 |
if (aDone) |
|
912 |
{ |
|
913 |
iParam.Zero(); |
|
914 |
iParam.Append(_L("done")); |
|
915 |
} |
|
916 |
if (iUndo) |
|
917 |
{ |
|
918 |
iParam.Zero(); |
|
919 |
iParam.Append(_L("Undo")); |
|
920 |
} |
|
921 |
if (iRedo) |
|
922 |
{ |
|
923 |
iParam.Zero(); |
|
924 |
iParam.Append(_L("redone")); |
|
925 |
} |
|
926 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
927 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
928 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
929 |
// TimerCallBack |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
930 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
931 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
932 |
void CImageEditorDrawControl::TimerCallBack() |
8 | 933 |
{ |
934 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::TimerCallBack()"); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
935 |
|
8 | 936 |
if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) |
937 |
{ |
|
938 |
iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; |
|
939 |
} |
|
940 |
else |
|
941 |
{ |
|
942 |
iTickCount++; |
|
943 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
944 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
945 |
if (iKeyCode) |
8 | 946 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
947 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
948 |
switch (iKeyCode) |
8 | 949 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
950 |
case 1: |
8 | 951 |
{ |
952 |
NaviUp(); |
|
953 |
break; |
|
954 |
} |
|
955 |
case 2: |
|
956 |
{ |
|
957 |
NaviDown(); |
|
958 |
break; |
|
959 |
} |
|
960 |
case 3: |
|
961 |
{ |
|
962 |
NaviLeft(); |
|
963 |
break; |
|
964 |
} |
|
965 |
case 4: |
|
966 |
{ |
|
967 |
NaviRight(); |
|
968 |
break; |
|
969 |
} |
|
970 |
default: |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
971 |
break; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
972 |
} |
8 | 973 |
//StoreParameters(); |
974 |
TRAP_IGNORE(iEditorView->HandleCommandL(EImageEditorCmdRender)); |
|
975 |
iTimer->Call(KWait); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
976 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
977 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
978 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
979 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
980 |
// StorePosAndScaleRelScreen |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
981 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
982 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
983 |
void CImageEditorDrawControl::StorePosAndScaleRelScreen() |
8 | 984 |
{ |
985 |
LOG(KDrawPluginLogFile, |
|
986 |
"CImageEditorClipartControl::StorePosAndScaleRelScreen()"); |
|
987 |
iParam.Copy(_L("nop")); |
|
988 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
989 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
990 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
991 |
// ?description_if_needed |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
992 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
993 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
994 |
void CImageEditorDrawControl::RestorePosAndScaleRelScreen() |
8 | 995 |
{ |
996 |
LOG(KDrawPluginLogFile, |
|
997 |
"CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); |
|
998 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
999 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1000 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1001 |
// StorePosAndScaleRelImage |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1002 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1003 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1004 |
void CImageEditorDrawControl::StorePosAndScaleRelImage() |
8 | 1005 |
{ |
1006 |
TReal relscale = iSysPars->RelScale(); |
|
1007 |
LOGFMT(KDrawPluginLogFile, |
|
1008 |
"CImageEditorClipartControl::StorePosAndScaleRelImage():%g", |
|
1009 |
relscale); |
|
1010 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1011 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1012 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1013 |
// RestorePosAndScaleRelImage |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1014 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1015 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1016 |
void CImageEditorDrawControl::RestorePosAndScaleRelImage() |
8 | 1017 |
{ |
1018 |
TReal relscale = iSysPars->RelScale(); |
|
1019 |
LOGFMT(KDrawPluginLogFile, |
|
1020 |
"CImageEditorClipartControl::RestorePosAndScaleRelImage():%g", |
|
1021 |
relscale); |
|
1022 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1023 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1024 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1025 |
// ClipPosition |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1026 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1027 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1028 |
void CImageEditorDrawControl::ClipPosition() |
8 | 1029 |
{ |
1030 |
if (iX < iSysPars->VisibleImageRect().iTl.iX) |
|
1031 |
{ |
|
1032 |
iX = iSysPars->VisibleImageRect().iTl.iX; |
|
1033 |
} |
|
1034 |
else if (iX > iSysPars->VisibleImageRect().iBr.iX) |
|
1035 |
{ |
|
1036 |
iX = iSysPars->VisibleImageRect().iBr.iX; |
|
1037 |
} |
|
1038 |
||
1039 |
if (iY < iSysPars->VisibleImageRect().iTl.iY) |
|
1040 |
{ |
|
1041 |
iY = iSysPars->VisibleImageRect().iTl.iY; |
|
1042 |
} |
|
1043 |
else if (iY > iSysPars->VisibleImageRect().iBr.iY) |
|
1044 |
{ |
|
1045 |
iY = iSysPars->VisibleImageRect().iBr.iY; |
|
1046 |
} |
|
1047 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1048 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1049 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1050 |
// HandlePointerEventL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1051 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1052 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1053 |
void CImageEditorDrawControl::HandlePointerEventL( |
8 | 1054 |
const TPointerEvent &aPointerEvent) |
1055 |
{ |
|
1056 |
SetToolBarStatus(); |
|
1057 |
RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), |
|
1058 |
AknLayoutUtils::PenEnabled()); |
|
1059 |
if (iRollflag) |
|
1060 |
return; |
|
1061 |
if (AknLayoutUtils::PenEnabled() && !Busy()) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1062 |
{ |
8 | 1063 |
RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), |
1064 |
aPointerEvent.iType); |
|
1065 |
TBool lastItem(EFalse); |
|
1066 |
TPoint point = aPointerEvent.iPosition; |
|
1067 |
||
1068 |
switch (aPointerEvent.iType) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1069 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1070 |
case TPointerEvent::EButton1Down: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1071 |
{ |
8 | 1072 |
|
1073 |
iButtonDownPoint = point; |
|
1074 |
iLastPointEventType = EFalse; |
|
1075 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
1076 |
||
1077 |
if (iLoopMenuRect.Contains(point) && !iCustomComponetClick |
|
1078 |
&& iDisplayTool) |
|
1079 |
||
1080 |
{ |
|
1081 |
iPointStartInLoopRect = ETrue; |
|
1082 |
if (iDragIsStart) |
|
1083 |
{ |
|
1084 |
iAnimationAO->Cancel(); |
|
1085 |
iDragIsStart = EFalse; |
|
1086 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1087 |
|
8 | 1088 |
} |
1089 |
else if ((!iLoopMenuRect.Contains(point) |
|
1090 |
&& !iCustomComponetClick && iDisplayTool) |
|
1091 |
|| (!iDisplayTool && !iCustomComponetClick)) |
|
1092 |
{ |
|
1093 |
iPointStartInLoopRect = EFalse; |
|
1094 |
//System dispose |
|
1095 |
iReadyToRender = EFalse; |
|
1096 |
CDrawPath* lastPath = CDrawPath::NewL(); |
|
1097 |
CleanupStack::PushL(lastPath); |
|
1098 |
lastPath->SetColor(iRgb); |
|
1099 |
lastPath->SetSize(iSize); |
|
1100 |
SetPositionOnImage(aPointerEvent.iPosition); |
|
1101 |
lastPath->AddItemL(aPointerEvent.iPosition); |
|
1102 |
iPaths.AppendL(lastPath); |
|
1103 |
CleanupStack::Pop(lastPath); |
|
1104 |
iCanRedo = EFalse; |
|
1105 |
iUndoPaths.ResetAndDestroy(); |
|
1106 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1107 |
} |
8 | 1108 |
break; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1109 |
case TPointerEvent::EButton1Up: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1110 |
{ |
8 | 1111 |
// System dispose |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1112 |
iReadyToRender = ETrue; |
8 | 1113 |
iCustomComponetClick = EFalse; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1114 |
lastItem = ETrue; |
8 | 1115 |
HandleMainMenuButtonUp(point); |
1116 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
1117 |
DrawNow(); |
|
1118 |
||
1119 |
} |
|
1120 |
break; |
|
1121 |
case TPointerEvent::EDrag: |
|
1122 |
{ |
|
1123 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
1124 |
//System dispose |
|
1125 |
iLastPointEventType = ETrue; |
|
1126 |
||
1127 |
if ((iDisplayTool && iPaths.Count() && !iCustomComponetClick |
|
1128 |
&& !iPointStartInLoopRect) || (!iDisplayTool |
|
1129 |
&& iPaths.Count() && !iCustomComponetClick)) |
|
1130 |
{ |
|
1131 |
iCanRedo = EFalse; |
|
1132 |
iUndoPaths.ResetAndDestroy(); |
|
1133 |
CDrawPath* path = iPaths[iPaths.Count() - 1]; |
|
1134 |
// store current position for next round |
|
1135 |
iPointerPosition = aPointerEvent.iPosition; |
|
1136 |
SetPositionOnImage(aPointerEvent.iPosition); |
|
1137 |
path->AddItemL(aPointerEvent.iPosition); |
|
1138 |
} |
|
1139 |
//Self dispose |
|
1140 |
if (iCustomComponetClick) |
|
1141 |
{ |
|
1142 |
TPoint con(aPointerEvent.iPosition.iX - 25, |
|
1143 |
aPointerEvent.iPosition.iY - 25); |
|
1144 |
iCustomComponet->SetExtent(con, TSize(50, 50)); |
|
1145 |
DrawNow(); |
|
1146 |
} |
|
1147 |
||
1148 |
if (iDisplayTool && iPointStartInLoopRect) |
|
1149 |
||
1150 |
{ |
|
1151 |
HandleMainMenuButtonDrag(point); |
|
1152 |
} |
|
1153 |
} |
|
1154 |
break; |
|
1155 |
default: |
|
1156 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1157 |
break; |
8 | 1158 |
|
1159 |
} |
|
1160 |
||
1161 |
//System dispose |
|
1162 |
if ((!iPointStartInLoopRect && iDisplayTool) || !iDisplayTool) |
|
1163 |
{ |
|
1164 |
if (!(iCustomComponet->Rect().Contains(aPointerEvent.iPosition))) |
|
1165 |
{ |
|
1166 |
StoreParameters(lastItem, EFalse); |
|
1167 |
iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1168 |
} |
8 | 1169 |
} |
1170 |
} |
|
1171 |
||
1172 |
} |
|
1173 |
||
1174 |
// --------------------------------------------------------------------------- |
|
1175 |
// HandleMainMenuButtonUp |
|
1176 |
// --------------------------------------------------------------------------- |
|
1177 |
// |
|
1178 |
void CImageEditorDrawControl::HandleMainMenuButtonUp(TPoint aPoint) |
|
1179 |
{ |
|
1180 |
if (iMainMenuLayout == EMainMenuHorizontal) |
|
1181 |
{ |
|
1182 |
if (iDragIsStart) |
|
1183 |
{ |
|
1184 |
//Drag event is end (Except activating animation effect). |
|
1185 |
iDragIsStart = EFalse; |
|
1186 |
||
1187 |
if (Abs(iDragPrePoint.iX - aPoint.iX) > 1) |
|
1188 |
{ |
|
1189 |
//Animation effect is activated |
|
1190 |
iDragIsStart = ETrue; |
|
1191 |
iStartSpeed = aPoint.iX - iDragPrePoint.iX; |
|
1192 |
iAnimationAO->StartL(0); |
|
1193 |
} |
|
1194 |
} |
|
1195 |
} |
|
1196 |
else if (iMainMenuLayout == EMainMenuVertical) |
|
1197 |
{ |
|
1198 |
if (iDragIsStart) |
|
1199 |
{ |
|
1200 |
//Drag event is end (Except activating animation effect). |
|
1201 |
iDragIsStart = EFalse; |
|
1202 |
||
1203 |
if (Abs(iDragPrePoint.iY - aPoint.iY) > 1) |
|
1204 |
{ |
|
1205 |
//Animation effect is activated |
|
1206 |
iDragIsStart = ETrue; |
|
1207 |
iStartSpeed = aPoint.iY - iDragPrePoint.iY; |
|
1208 |
iAnimationAO->StartL(0); |
|
1209 |
} |
|
1210 |
} |
|
1211 |
} |
|
1212 |
} |
|
1213 |
||
1214 |
// --------------------------------------------------------------------------- |
|
1215 |
// HandleMainMenuButtonDrag |
|
1216 |
// --------------------------------------------------------------------------- |
|
1217 |
// |
|
1218 |
void CImageEditorDrawControl::HandleMainMenuButtonDrag(TPoint aPoint) |
|
1219 |
{ |
|
1220 |
if (iMainMenuLayout == EMainMenuHorizontal) |
|
1221 |
{ |
|
1222 |
if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iX |
|
1223 |
- iButtonDownPoint.iX) >= DRAG_LENGTH) |
|
1224 |
{ |
|
1225 |
iDragIsStart = ETrue; |
|
1226 |
iDragStartPoint = aPoint; |
|
1227 |
||
1228 |
for (TInt i = 0; i < iTotalComponent; i++) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1229 |
{ |
8 | 1230 |
if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
1231 |
{ |
|
1232 |
iLabels[i]->LabelIsMoving(); |
|
1233 |
} |
|
1234 |
} |
|
1235 |
} |
|
1236 |
||
1237 |
if (iDragIsStart) |
|
1238 |
{ |
|
1239 |
iDragPrePoint = iDragUpPoint; |
|
1240 |
iDragUpPoint = aPoint; |
|
1241 |
iDragOffset = aPoint.iX - iDragStartPoint.iX; |
|
1242 |
iDragStartPoint = aPoint; |
|
1243 |
||
1244 |
CalculateEffectiveOffset(); |
|
1245 |
SizeChanged(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1246 |
} |
8 | 1247 |
} |
1248 |
else if (iMainMenuLayout == EMainMenuVertical) |
|
1249 |
{ |
|
1250 |
if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iY |
|
1251 |
- iButtonDownPoint.iY) >= DRAG_LENGTH) |
|
1252 |
{ |
|
1253 |
iDragIsStart = ETrue; |
|
1254 |
iDragStartPoint = aPoint; |
|
1255 |
||
1256 |
for (TInt i = 0; i < iTotalComponent; i++) |
|
1257 |
{ |
|
1258 |
if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
|
1259 |
{ |
|
1260 |
iLabels[i]->LabelIsMoving(); |
|
1261 |
} |
|
1262 |
} |
|
1263 |
} |
|
1264 |
||
1265 |
if (iDragIsStart) |
|
1266 |
{ |
|
1267 |
iDragPrePoint = iDragUpPoint; |
|
1268 |
iDragUpPoint = aPoint; |
|
1269 |
iDragOffset = aPoint.iY - iDragStartPoint.iY; |
|
1270 |
iDragStartPoint = aPoint; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1271 |
|
8 | 1272 |
CalculateEffectiveOffset(); |
1273 |
SizeChanged(); |
|
1274 |
} |
|
1275 |
} |
|
1276 |
} |
|
1277 |
||
1278 |
// --------------------------------------------------------------------------- |
|
1279 |
// UndoDrawPath |
|
1280 |
// --------------------------------------------------------------------------- |
|
1281 |
// |
|
1282 |
void CImageEditorDrawControl::UndoDrawPath() |
|
1283 |
{ |
|
1284 |
if (iPaths.Count()) |
|
1285 |
{ |
|
1286 |
iUndoPaths.Append(iPaths[iPaths.Count() - 1]); |
|
1287 |
iPaths.Remove(iPaths.Count() - 1); |
|
1288 |
iCanRedo = ETrue; |
|
1289 |
} |
|
1290 |
} |
|
1291 |
||
1292 |
// --------------------------------------------------------------------------- |
|
1293 |
// RedoDrawPath |
|
1294 |
// --------------------------------------------------------------------------- |
|
1295 |
// |
|
1296 |
void CImageEditorDrawControl::RedoDrawPath() |
|
1297 |
{ |
|
1298 |
if (iUndoPaths.Count()) |
|
1299 |
{ |
|
1300 |
iPaths.Append(iUndoPaths[iUndoPaths.Count() - 1]); |
|
1301 |
iUndoPaths.Remove(iUndoPaths.Count() - 1); |
|
1302 |
} |
|
1303 |
} |
|
1304 |
||
1305 |
// --------------------------------------------------------------------------- |
|
1306 |
// HandlePointerNotify |
|
1307 |
// --------------------------------------------------------------------------- |
|
1308 |
// |
|
1309 |
void CImageEditorDrawControl::HandlePointerNotify(CCoeControl* aComponent) |
|
1310 |
{ |
|
1311 |
//pen size |
|
1312 |
if (iLabels[0] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1313 |
{ |
|
1314 |
MakeVisibleLable(EFalse); |
|
1315 |
SelectSizeL(); |
|
1316 |
MakeVisibleLable(ETrue); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1317 |
} |
8 | 1318 |
//pen color |
1319 |
else if (iLabels[1] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1320 |
{ |
|
1321 |
MakeVisibleLable(EFalse); |
|
1322 |
SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); |
|
1323 |
MakeVisibleLable(ETrue); |
|
1324 |
} |
|
1325 |
//undo |
|
1326 |
else if (iLabels[2] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1327 |
{ |
|
1328 |
UndoDrawPath(); |
|
1329 |
iUndo = ETrue; |
|
1330 |
StoreParameters(EFalse, EFalse); |
|
1331 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
1332 |
iUndo = EFalse; |
|
1333 |
} |
|
1334 |
//save and quit |
|
1335 |
else if (iLabels[3] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1336 |
{ |
|
1337 |
iPopupController->HideInfoPopupNote(); |
|
1338 |
StoreParameters(EFalse, ETrue); |
|
1339 |
iEditorView->HandleCommandL(EImageEditorApplyPlugin); |
|
1340 |
} |
|
1341 |
else if (iLabels[4] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1342 |
{ |
|
1343 |
||
1344 |
} |
|
1345 |
else if (iLabels[5] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1346 |
{ |
|
1347 |
iRedo = ETrue; |
|
1348 |
RedoDrawPath(); |
|
1349 |
StoreParameters(EFalse, EFalse); |
|
1350 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
1351 |
iRedo = EFalse; |
|
1352 |
} |
|
1353 |
else if (iLabels[6] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1354 |
{ |
|
1355 |
||
1356 |
} |
|
1357 |
else if (iCustomComponet == dynamic_cast<CCustomerComponet*> (aComponent)) |
|
1358 |
{ |
|
1359 |
if (iCustomComponet->GetButtonType()) |
|
1360 |
{ |
|
1361 |
iCustomComponetClick = ETrue; |
|
1362 |
} |
|
1363 |
||
1364 |
if ((!iCustomComponet->GetButtonType()) && (!iLastPointEventType)) |
|
1365 |
{ |
|
1366 |
StartTheAnimation(); |
|
1367 |
||
1368 |
} |
|
1369 |
} |
|
1370 |
||
1371 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1372 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1373 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1374 |
// SetPositionOnImage |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1375 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1376 |
// |
8 | 1377 |
void CImageEditorDrawControl::SetPositionOnImage(TPoint aPointedPosition) |
1378 |
{ |
|
1379 |
ASSERT(iSysPars); |
|
1380 |
// Get system parameters |
|
1381 |
TRect visibleImageRect(iSysPars->VisibleImageRect()); |
|
1382 |
TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); |
|
1383 |
||
1384 |
TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
|
1385 |
TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
|
1386 |
||
1387 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::vir w:%d h:%d", |
|
1388 |
visibleImageRect.Width(), visibleImageRect.Height()); |
|
1389 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::virp w:%d h:%d", |
|
1390 |
visibleImageRectPrev.Width(), visibleImageRectPrev.Height()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1391 |
|
8 | 1392 |
// Dividing by zero will cause panic -> check |
1393 |
if (xPosFactorDivider == 0 || yPosFactorDivider == 0) |
|
1394 |
{ |
|
1395 |
// Set default position |
|
1396 |
iX = (visibleImageRect.iTl.iX + visibleImageRect.iBr.iX) / 2; |
|
1397 |
iY = (visibleImageRect.iTl.iY + visibleImageRect.iBr.iY) / 2; |
|
1398 |
} |
|
1399 |
else |
|
1400 |
{ |
|
1401 |
// Calculate relative position on the screen |
|
1402 |
TReal xPositionFactor(TReal(aPointedPosition.iX |
|
1403 |
- visibleImageRectPrev.iTl.iX) / xPosFactorDivider); |
|
1404 |
// |
|
1405 |
// TReal yPositionFactor(TReal(aPointedPosition.iY - iStatuspaneHeight |
|
1406 |
// - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
|
1407 |
TReal yPositionFactor(TReal(aPointedPosition.iY |
|
1408 |
- visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
|
1409 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::pfx:%g pfy:%g", |
|
1410 |
xPositionFactor, yPositionFactor); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1411 |
// Calculate position on visible image |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1412 |
|
8 | 1413 |
iX = visibleImageRect.iTl.iX + visibleImageRect.Width() |
1414 |
* xPositionFactor + 0.5; |
|
1415 |
||
1416 |
iY = visibleImageRect.iTl.iY + visibleImageRect.Height() |
|
1417 |
* yPositionFactor + 0.5; |
|
1418 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1419 |
|
8 | 1420 |
LOGFMT4(KDrawPluginLogFile, |
1421 |
"CImageEditorDrawControl::Draw x:%d iX:%d y:%d iY:%d", |
|
1422 |
aPointedPosition.iX, iX, aPointedPosition.iY, iY); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1423 |
// Check that not out of bounds |
8 | 1424 |
//ClipPosition(); |
1425 |
} |
|
1426 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1427 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1428 |
// GetPositionOnView |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1429 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1430 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1431 |
TPoint CImageEditorDrawControl::GetPositionOnView() |
8 | 1432 |
{ |
1433 |
ASSERT(iSysPars); |
|
1434 |
// Get system parameters |
|
1435 |
TRect visibleImageRect(iSysPars->VisibleImageRect()); |
|
1436 |
TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1437 |
|
8 | 1438 |
TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
1439 |
TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
|
1440 |
||
1441 |
// Calculate relative position on the screen |
|
1442 |
TReal xPositionFactor(TReal(iX + visibleImageRectPrev.iTl.iX) |
|
1443 |
/ xPosFactorDivider); |
|
1444 |
||
1445 |
TReal yPositionFactor(TReal(iY + visibleImageRectPrev.iTl.iY) |
|
1446 |
/ yPosFactorDivider); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1447 |
|
8 | 1448 |
LOGFMT2(KDrawPluginLogFile, |
1449 |
"CImageEditorDrawControl::GetPositionOnView xf:%g yf:%g", |
|
1450 |
xPositionFactor, yPositionFactor); |
|
1451 |
||
1452 |
LOGFMT2(KDrawPluginLogFile, |
|
1453 |
"CImageEditorDrawControl::GetPositionOnView xf:%d yf:%d", |
|
1454 |
xPosFactorDivider, yPosFactorDivider); |
|
1455 |
||
1456 |
LOGFMT2(KDrawPluginLogFile, |
|
1457 |
"CImageEditorDrawControl::GetPositionOnView w:%d h:%d", iX, iY); |
|
1458 |
||
1459 |
TInt xPosition(iX + visibleImageRectPrev.iTl.iX); |
|
1460 |
TInt yPosition(iY + visibleImageRectPrev.iTl.iY); |
|
1461 |
||
1462 |
LOGFMT3(KDrawPluginLogFile, |
|
1463 |
"CImageEditorDrawControl::GetPositionOnView w:%d h:%d S:%g", |
|
1464 |
xPosition, yPosition, iSysPars->RelScale()); |
|
1465 |
||
1466 |
return TPoint(xPosition, yPosition); |
|
1467 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1468 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1469 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1470 |
// ShowTooltip |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1471 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1472 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1473 |
void CImageEditorDrawControl::ShowTooltip() |
8 | 1474 |
{ |
1475 |
iPopupController->HideInfoPopupNote(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1476 |
|
8 | 1477 |
TPoint iconPosition = ComputeIndicatorPosition(); |
1478 |
TRect iconRect(iconPosition.iX, iconPosition.iY, iconPosition.iX, |
|
1479 |
iconPosition.iY); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1480 |
|
8 | 1481 |
/*SDrawUtils::ShowToolTip( iPopupController, |
1482 |
this, |
|
1483 |
iconPosition, |
|
1484 |
EHRightVTop, |
|
1485 |
*iTooltipResize ); |
|
1486 |
*/ |
|
1487 |
||
1488 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1489 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1490 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1491 |
// ScaledLineSize |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1492 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1493 |
// |
8 | 1494 |
TSize CImageEditorDrawControl::ScaledLineSize(TSize aOriginalSize) const |
1495 |
{ |
|
1496 |
TInt sizew(aOriginalSize.iWidth * iSysPars->RelScale() + 0.5); |
|
1497 |
TInt sizeh(aOriginalSize.iHeight * iSysPars->RelScale() + 0.5); |
|
1498 |
if (sizew < 1) |
|
1499 |
{ |
|
1500 |
sizew++; |
|
1501 |
} |
|
1502 |
if (sizeh < 1) |
|
1503 |
{ |
|
1504 |
sizeh++; |
|
1505 |
} |
|
1506 |
||
1507 |
LOGFMT3(KDrawPluginLogFile, |
|
1508 |
"CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", sizew, |
|
1509 |
sizeh, iSysPars->RelScale()); |
|
1510 |
return TSize(sizew, sizeh); |
|
1511 |
} |
|
1512 |
||
1513 |
// --------------------------------------------------------------------------- |
|
1514 |
// CountComponentControls |
|
1515 |
// --------------------------------------------------------------------------- |
|
1516 |
// |
|
1517 |
TInt CImageEditorDrawControl::CountComponentControls() const |
|
1518 |
{ |
|
1519 |
return iTotalComponent + 1; |
|
1520 |
} |
|
1521 |
||
1522 |
// --------------------------------------------------------------------------- |
|
1523 |
// ComponentControl |
|
1524 |
// --------------------------------------------------------------------------- |
|
1525 |
// |
|
1526 |
CCoeControl* CImageEditorDrawControl::ComponentControl(TInt aIndex) const |
|
1527 |
{ |
|
1528 |
switch (aIndex) |
|
1529 |
{ |
|
1530 |
case 7: |
|
1531 |
return iCustomComponet; |
|
1532 |
case 0: |
|
1533 |
return iLabels[0]; |
|
1534 |
case 1: |
|
1535 |
return iLabels[1]; |
|
1536 |
case 2: |
|
1537 |
return iLabels[2]; |
|
1538 |
case 3: |
|
1539 |
return iLabels[3]; |
|
1540 |
case 4: |
|
1541 |
return iLabels[4]; |
|
1542 |
case 5: |
|
1543 |
return iLabels[5]; |
|
1544 |
case 6: |
|
1545 |
return iLabels[6]; |
|
1546 |
default: |
|
1547 |
return NULL; |
|
1548 |
} |
|
1549 |
return NULL; |
|
1550 |
} |
|
1551 |
||
1552 |
// --------------------------------------------------------------------------- |
|
1553 |
// Notify |
|
1554 |
// --------------------------------------------------------------------------- |
|
1555 |
// |
|
1556 |
void CImageEditorDrawControl::Notify() |
|
1557 |
{ |
|
1558 |
if (iStartSpeed > 0) |
|
1559 |
{ |
|
1560 |
iStartSpeed -= 2; |
|
1561 |
if (iStartSpeed <= 0) |
|
1562 |
{ |
|
1563 |
iStartSpeed = 0; |
|
1564 |
iDragIsStart = EFalse; |
|
1565 |
iAnimationAO->Cancel(); |
|
1566 |
} |
|
1567 |
} |
|
1568 |
else if (iStartSpeed < 0) |
|
1569 |
{ |
|
1570 |
iStartSpeed += 2; |
|
1571 |
if (iStartSpeed >= 0) |
|
1572 |
{ |
|
1573 |
iStartSpeed = 0; |
|
1574 |
iDragIsStart = EFalse; |
|
1575 |
iAnimationAO->Cancel(); |
|
1576 |
} |
|
1577 |
} |
|
1578 |
else |
|
1579 |
{ |
|
1580 |
iDragIsStart = EFalse; |
|
1581 |
iAnimationAO->Cancel(); |
|
1582 |
} |
|
1583 |
||
1584 |
iDragOffset += iStartSpeed; |
|
1585 |
CalculateEffectiveOffset(); |
|
1586 |
SizeChanged(); |
|
1587 |
} |
|
1588 |
||
1589 |
// --------------------------------------------------------------------------- |
|
1590 |
// Roll |
|
1591 |
// --------------------------------------------------------------------------- |
|
1592 |
// |
|
1593 |
void CImageEditorDrawControl::Roll() |
|
1594 |
{ |
|
1595 |
SetToolBarStatus(); |
|
1596 |
//TInt leftX = iLabels[0]->Rect().iTl.iX; |
|
1597 |
//TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
|
1598 |
TInt offset = 0; |
|
1599 |
iRollflag = ETrue; |
|
1600 |
if (iDisplayTool) |
|
1601 |
iRollDirection = EFalse; |
|
1602 |
else |
|
1603 |
iRollDirection = ETrue; |
|
1604 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1605 |
|
8 | 1606 |
if (iRollDirection) |
1607 |
{ |
|
1608 |
offset = 4; |
|
1609 |
} |
|
1610 |
else |
|
1611 |
{ |
|
1612 |
offset = -4; |
|
1613 |
} |
|
1614 |
||
1615 |
if (iMainMenuLayout == EMainMenuHorizontal) |
|
1616 |
{ |
|
1617 |
for (TInt i = 0; i < iLabels.Count(); i++) |
|
1618 |
{ |
|
1619 |
TInt x = iLabels[i]->Rect().iTl.iX; |
|
1620 |
iLabels[i]->SetPosition(TPoint(x + offset, iLoopMenuRect.iTl.iY)); |
|
1621 |
iLabels[i]->ResetControl(); |
|
1622 |
} |
|
1623 |
if (iLabels[0]->Rect().iTl.iX == 0 |
|
1624 |
|| iLabels[iLabels.Count() - 1]->Rect().iBr.iX == 0) |
|
1625 |
iRollflag = EFalse; |
|
1626 |
} |
|
1627 |
else if (iMainMenuLayout == EMainMenuVertical) |
|
1628 |
{ |
|
1629 |
for (TInt i = 0; i < iLabels.Count(); i++) |
|
1630 |
{ |
|
1631 |
TInt y = iLabels[i]->Rect().iTl.iY; |
|
1632 |
iLabels[i]->SetPosition(TPoint(iLoopMenuRect.iTl.iX, y + offset)); |
|
1633 |
iLabels[i]->ResetControl(); |
|
1634 |
} |
|
1635 |
if (iLabels[0]->Rect().iTl.iY == 0 |
|
1636 |
|| iLabels[iLabels.Count() - 1]->Rect().iBr.iY == 0) |
|
1637 |
iRollflag = EFalse; |
|
1638 |
} |
|
1639 |
||
1640 |
DrawNow(); |
|
1641 |
||
1642 |
if (!iRollflag) |
|
1643 |
{ |
|
1644 |
//iRollDirection = !iRollDirection; |
|
1645 |
iRollAo->Cancel(); |
|
1646 |
} |
|
1647 |
} |
|
1648 |
||
1649 |
// --------------------------------------------------------------------------- |
|
1650 |
// CalculateEffectiveOffset |
|
1651 |
// --------------------------------------------------------------------------- |
|
1652 |
// |
|
1653 |
void CImageEditorDrawControl::CalculateEffectiveOffset() |
|
1654 |
{ |
|
1655 |
if (iMainMenuLayout == EMainMenuHorizontal) |
|
1656 |
{ |
|
1657 |
TInt leftX = iLabels[0]->Rect().iTl.iX; |
|
1658 |
TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
|
1659 |
TInt offset = iDragOffset; |
|
1660 |
if (leftX + offset > 0) |
|
1661 |
{ |
|
1662 |
iDragOffset = Abs(leftX); |
|
1663 |
} |
|
1664 |
||
1665 |
if (rightX + offset < 360) |
|
1666 |
{ |
|
1667 |
iDragOffset = -(rightX - 360); |
|
1668 |
} |
|
1669 |
} |
|
1670 |
else if (iMainMenuLayout == EMainMenuVertical) |
|
1671 |
{ |
|
1672 |
TInt topY = iLabels[0]->Rect().iTl.iY; |
|
1673 |
TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; |
|
1674 |
TInt offset = iDragOffset; |
|
1675 |
if (topY + offset > 0) |
|
1676 |
{ |
|
1677 |
iDragOffset = Abs(topY); |
|
1678 |
} |
|
1679 |
||
1680 |
if (bottomY + offset < 360) |
|
1681 |
{ |
|
1682 |
iDragOffset = -(bottomY - 360); |
|
1683 |
} |
|
1684 |
} |
|
1685 |
} |
|
1686 |
||
1687 |
// --------------------------------------------------------------------------- |
|
1688 |
// MakeVisibleLable |
|
1689 |
// --------------------------------------------------------------------------- |
|
1690 |
// |
|
1691 |
void CImageEditorDrawControl::MakeVisibleLable(TBool aFlag) |
|
1692 |
{ |
|
1693 |
if (aFlag) |
|
1694 |
{ |
|
1695 |
for (int i = 0; i < iTotalComponent; i++) |
|
1696 |
{ |
|
1697 |
iLabels[i]->MakeVisible(ETrue); |
|
1698 |
} |
|
1699 |
} |
|
1700 |
else |
|
1701 |
{ |
|
1702 |
for (int i = 0; i < iTotalComponent; i++) |
|
1703 |
{ |
|
1704 |
iLabels[i]->MakeVisible(EFalse); |
|
1705 |
} |
|
1706 |
} |
|
1707 |
} |
|
1708 |
||
1709 |
// --------------------------------------------------------------------------- |
|
1710 |
// StartTheAnimation |
|
1711 |
// --------------------------------------------------------------------------- |
|
1712 |
// |
|
1713 |
void CImageEditorDrawControl::StartTheAnimation() |
|
1714 |
{ |
|
1715 |
iRollAo->StartL(0); |
|
1716 |
} |
|
1717 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1718 |
// End of File |