author | Simon Howkins <simonh@symbian.org> |
Mon, 15 Nov 2010 12:21:35 +0000 | |
changeset 24 | f8a4151f4fe1 |
parent 18 | ef7741bd05bf |
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 |
/* |
12 | 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> |
12 | 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 |
12 | 55 |
const TInt KWait = 1; |
56 |
const TInt KMainTextIndex = 0; |
|
14 | 57 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
58 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
59 |
// NewL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
60 |
// --------------------------------------------------------------------------- |
14 | 61 |
|
12 | 62 |
CImageEditorDrawControl* CImageEditorDrawControl::NewL(const TRect& aRect, |
63 |
CCoeControl* aParent, RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, |
|
64 |
TSize& aSize, TBool &aDisplayTool) |
|
65 |
{ |
|
14 | 66 |
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
|
67 |
|
12 | 68 |
CImageEditorDrawControl * self = new (ELeave) CImageEditorDrawControl( |
69 |
aPaths, aRgb, aSize, aDisplayTool); |
|
70 |
CleanupStack::PushL(self); |
|
71 |
self->ConstructL(aRect, aParent); |
|
72 |
CleanupStack::Pop(); // self |
|
73 |
return self; |
|
74 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
75 |
|
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 |
// CImageEditorDrawControl |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
78 |
// --------------------------------------------------------------------------- |
12 | 79 |
CImageEditorDrawControl::CImageEditorDrawControl( |
80 |
RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, TSize& aSize, |
|
81 |
TBool& aDisplayTool) : |
|
82 |
iTickCount(0), iX(0), iY(0), iNaviStepMultiplier( |
|
83 |
KDefaultSmallNavigationStepMultiplier), iDisplayingOkOptionsMenu( |
|
84 |
EFalse), iReadyToRender(EFalse), iResLoader(*ControlEnv()), iPaths( |
|
85 |
aPaths), iRgb(aRgb), iSize(aSize), iDisplayTool(aDisplayTool) |
|
86 |
||
87 |
{ |
|
88 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
89 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
90 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
91 |
// ~CImageEditorDrawControl() |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
92 |
// --------------------------------------------------------------------------- |
14 | 93 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
94 |
CImageEditorDrawControl::~CImageEditorDrawControl() |
12 | 95 |
{ |
14 | 96 |
LOG(KDrawPluginLogFile, |
97 |
"CImageEditorDrawControl::~CImageEditorDrawControl()"); |
|
12 | 98 |
delete iCustomComponet; |
99 |
delete iTimer; |
|
100 |
delete iIndicator; |
|
101 |
delete iIndicatorMask; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
102 |
delete iPopupController; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
103 |
delete iTooltipResize; |
12 | 104 |
delete iRollAo; |
105 |
delete iNaviPaneText; |
|
106 |
delete iGc; |
|
107 |
delete iBitmapDev; |
|
108 |
delete iAnimationAO; |
|
14 | 109 |
|
12 | 110 |
iUndoPaths.ResetAndDestroy(); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
111 |
iResLoader.Close(); |
14 | 112 |
|
12 | 113 |
for (int i = 0; i < iTotalComponent; i++) |
114 |
{ |
|
115 |
CImageLabel* &temp = iLabels[i]; |
|
116 |
if (temp != NULL) |
|
117 |
{ |
|
118 |
delete temp; |
|
119 |
temp = NULL; |
|
120 |
} |
|
121 |
} |
|
122 |
iLabels.ResetAndDestroy(); |
|
123 |
||
124 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
125 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
126 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
127 |
// ConstructL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
128 |
// --------------------------------------------------------------------------- |
12 | 129 |
void CImageEditorDrawControl::ConstructL(const TRect& aRect, |
130 |
CCoeControl* aParent) |
|
131 |
{ |
|
14 | 132 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::ConstructL()"); |
12 | 133 |
|
134 |
CreateWindowL(); |
|
135 |
EnableDragEvents(); |
|
14 | 136 |
|
12 | 137 |
iStatuspaneHeight = aRect.iTl.iY; |
138 |
iUndo = EFalse; |
|
139 |
iRedo = EFalse; |
|
140 |
iCanRedo = EFalse; |
|
141 |
// Create resource utility |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
142 |
TFileName resFile; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
143 |
// resource file name |
12 | 144 |
_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
|
145 |
resFile.Append(KPgnResourcePath); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
146 |
resFile.Append(KResourceFile); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
147 |
|
12 | 148 |
User::LeaveIfError(CompleteWithAppPath(resFile)); |
149 |
// Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile |
|
150 |
// to search for a localised resource in proper search order |
|
151 |
iResLoader.OpenL(resFile); |
|
152 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
153 |
// Create timer for fast key repeat |
12 | 154 |
iTimer = CJPTimer::NewL(this); |
155 |
||
156 |
iPopupController = CAknInfoPopupNoteController::NewL(); |
|
157 |
iTooltipResize = ControlEnv()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); |
|
158 |
||
159 |
SetExtentToWholeScreen(); |
|
14 | 160 |
|
12 | 161 |
iCustomComponetClick = EFalse; |
162 |
TRect rect = Rect(); |
|
14 | 163 |
//judge the current screen status. |
12 | 164 |
if (rect.Width() < rect.Height()) |
165 |
{ |
|
14 | 166 |
InitializeMainMenu(EMainMenuVertical); |
12 | 167 |
} |
168 |
else if (rect.Width() > rect.Height()) |
|
169 |
{ |
|
14 | 170 |
InitializeMainMenu(EMainMenuHorizontal); |
12 | 171 |
} |
172 |
||
173 |
TRect Trect(TPoint(0, 0), TPoint(50, 50)); |
|
174 |
iCustomComponet = CCustomerComponet::NewL(Trect, this); |
|
175 |
iCustomComponet->SetExtent(TPoint(40, 100), TSize(50, 50)); |
|
176 |
iCustomComponet->SetHandlePointerObserver(this); |
|
177 |
iLastPointEventType = EFalse; |
|
178 |
// Activate control |
|
179 |
ActivateL(); |
|
180 |
||
181 |
} |
|
14 | 182 |
// --------------------------------------------------------------------------- |
183 |
// CImageEditorDrawControl::InitializeMainMenu£¨£© |
|
184 |
// initialize tool bar component. |
|
185 |
// --------------------------------------------------------------------------- |
|
12 | 186 |
void CImageEditorDrawControl::InitializeMainMenu( |
187 |
TMainMenuLayout aMainMenuLayout) |
|
188 |
{ |
|
189 |
iMainMenuLayout = aMainMenuLayout; |
|
190 |
_LIT(KSvgPath, "\\resource\\apps\\icons_doodle.mif"); |
|
191 |
TFileName svgFile(KSvgPath); |
|
192 |
User::LeaveIfError(CompleteWithAppPath(svgFile)); |
|
193 |
iTotalComponent = 7; |
|
194 |
TRect clipRect; |
|
14 | 195 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 196 |
{ |
197 |
iLoopMenuRect = TRect(TPoint(0, Rect().iBr.iY - 87), TSize(360, 87)); |
|
198 |
||
199 |
for (int i = 0; i < iTotalComponent; i++) |
|
200 |
{ |
|
201 |
if (iDisplayTool) |
|
202 |
{ |
|
203 |
TRect |
|
204 |
Rect1(TPoint(i * 72, iLoopMenuRect.iTl.iY), TSize(72, |
|
205 |
87)); |
|
206 |
clipRect = Rect1; |
|
207 |
} |
|
208 |
||
209 |
else |
|
210 |
{ |
|
211 |
TRect Rect2(TPoint(i * 72 - iLoopMenuRect.Width() - 72 * 2, |
|
212 |
iLoopMenuRect.iTl.iY), TSize(72, 87)); |
|
213 |
clipRect = Rect2; |
|
214 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
215 |
|
12 | 216 |
CImageLabel* label = CImageLabel::NewL(this, clipRect, |
14 | 217 |
CImageLabel::ELabelVertical); |
12 | 218 |
label->SetHandlePointerObserver(this); |
219 |
iLabels.Append(label); |
|
220 |
} |
|
221 |
} |
|
14 | 222 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 223 |
{ |
224 |
iLoopMenuRect = TRect(TPoint(Rect().iBr.iX - 87, 0), TSize(87, 360)); |
|
225 |
||
226 |
for (int i = 0; i < iTotalComponent; i++) |
|
227 |
{ |
|
228 |
if (iDisplayTool) |
|
229 |
{ |
|
230 |
TRect |
|
231 |
Rect1(TPoint(iLoopMenuRect.iTl.iX, i * 72), TSize(87, |
|
232 |
72)); |
|
233 |
clipRect = Rect1; |
|
234 |
} |
|
235 |
else |
|
236 |
{ |
|
237 |
TRect Rect2(TPoint(iLoopMenuRect.iTl.iX, i * 72 |
|
238 |
- iLoopMenuRect.Height() - 72 * 2), TSize(87, 72)); |
|
239 |
clipRect = Rect2; |
|
240 |
} |
|
241 |
||
242 |
CImageLabel* label = CImageLabel::NewL(this, clipRect, |
|
14 | 243 |
CImageLabel::ELabelHorizontal); |
12 | 244 |
label->SetHandlePointerObserver(this); |
245 |
iLabels.Append(label); |
|
246 |
} |
|
247 |
} |
|
248 |
||
14 | 249 |
iLabels[0]->SetImage(svgFile, EMbmIcons_doodlePen); |
12 | 250 |
iLabels[0]->SetTooltip(_L("Pensize")); |
251 |
||
14 | 252 |
iLabels[1]->SetImage(svgFile, EMbmIcons_doodlePalette_colored); |
12 | 253 |
iLabels[1]->SetTooltip(_L("Palette")); |
254 |
||
255 |
iLabels[2]->SetImage(svgFile, EMbmIcons_doodleUndo); |
|
256 |
iLabels[2]->SetTooltip(_L("Undo")); |
|
257 |
||
14 | 258 |
iLabels[3]->SetImage(svgFile, EMbmIcons_doodleRedo); |
13 | 259 |
iLabels[3]->SetTooltip(_L("Redo")); |
14 | 260 |
|
261 |
iLabels[4]->SetImage(svgFile, EMbmIcons_doodleSave1); |
|
13 | 262 |
iLabels[4]->SetTooltip(_L("Save")); |
12 | 263 |
|
14 | 264 |
iLabels[5]->SetImage(svgFile, EMbmIcons_doodleInfo); |
13 | 265 |
iLabels[5]->SetTooltip(_L("About")); |
12 | 266 |
|
14 | 267 |
iLabels[6]->SetImage(svgFile, EMbmIcons_doodleSave2); |
12 | 268 |
iLabels[6]->SetTooltip(_L("Null")); |
269 |
||
270 |
iAnimationAO = CAnimationAO::NewL(); |
|
271 |
iAnimationAO->SetObserver(this); |
|
272 |
iRollAo = CRollAO::NewL(); |
|
273 |
iRollAo->SetObserver(this); |
|
274 |
||
275 |
iButtonDownPoint = TPoint(0, 0); |
|
276 |
iDragStartPoint = TPoint(0, 0); |
|
277 |
iDragPrePoint = TPoint(0, 0); |
|
278 |
iDragUpPoint = TPoint(0, 0); |
|
279 |
||
280 |
iPointStartInLoopRect = EFalse; |
|
281 |
iDragIsStart = EFalse; |
|
282 |
iDragOffset = 0; |
|
283 |
||
284 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
285 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
286 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
287 |
// SetView |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
288 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
289 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
290 |
void CImageEditorDrawControl::SetView(CAknView* aView) |
12 | 291 |
{ |
14 | 292 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetView()"); |
12 | 293 |
ASSERT(aView); |
294 |
iEditorView = aView; |
|
295 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
296 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
297 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
298 |
// SetSelectedUiItemL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
299 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
300 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
301 |
void CImageEditorDrawControl::SetSelectedUiItemL(CPluginInfo* aItem) |
12 | 302 |
{ |
14 | 303 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSelectedUiItemL()"); |
12 | 304 |
ASSERT(aItem); |
305 |
iItem = aItem; |
|
306 |
delete iNaviPaneText; |
|
307 |
iNaviPaneText = NULL; |
|
308 |
iNaviPaneText = (iItem->Parameters()[KMainTextIndex]).AllocL(); |
|
309 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
310 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
311 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
312 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
313 |
// OfferKeyEventL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
314 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
315 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
316 |
TKeyResponse CImageEditorDrawControl::OfferKeyEventL( |
12 | 317 |
const TKeyEvent& aKeyEvent, TEventCode aType) |
318 |
{ |
|
14 | 319 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::OfferKeyEventL()"); |
12 | 320 |
|
321 |
TKeyResponse response = EKeyWasNotConsumed; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
322 |
|
12 | 323 |
// If busy, do not handle anything |
324 |
if (Busy()) |
|
325 |
{ |
|
326 |
response = EKeyWasConsumed; |
|
327 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
328 |
|
12 | 329 |
// In main state handle the OK Options menu |
330 |
else if (aKeyEvent.iCode == EKeyOK) |
|
331 |
{ |
|
332 |
iDisplayingOkOptionsMenu = ETrue; |
|
333 |
iEditorView->HandleCommandL(EImageEditorTryDisplayMenuBar); |
|
334 |
response = EKeyWasConsumed; |
|
335 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
336 |
|
12 | 337 |
// We handle only event keys |
338 |
else if (EEventKey == aType) |
|
339 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
340 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
341 |
switch (aKeyEvent.iCode) |
12 | 342 |
{ |
343 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
344 |
case EKeyDownArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
345 |
case EKeyUpArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
346 |
case EKeyRightArrow: |
12 | 347 |
case EKeyLeftArrow: |
348 |
{ |
|
349 |
SetPositionOnImage(ComputeIndicatorPosition()); |
|
350 |
StoreParameters(EFalse, EFalse); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
351 |
response = EKeyWasConsumed; |
12 | 352 |
break; |
353 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
354 |
|
12 | 355 |
case EKeyOK: |
356 |
{ |
|
357 |
break; |
|
358 |
} |
|
359 |
||
360 |
case 0x30: // 0 |
|
361 |
case 0x32: // 2 |
|
362 |
case 0x34: // 4 |
|
363 |
case 0x35: // 5 |
|
364 |
case 0x36: // 6 |
|
365 |
case 0x38: // 8 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
366 |
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
|
367 |
case EStdKeyDecVolume: // zoom out key |
12 | 368 |
{ |
369 |
StorePosAndScaleRelScreen(); |
|
370 |
break; |
|
371 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
372 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
373 |
default: |
12 | 374 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
375 |
break; |
12 | 376 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
377 |
} |
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 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
380 |
// 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
|
381 |
else if (aType == EEventKeyDown) |
12 | 382 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
383 |
switch (aKeyEvent.iScanCode) |
12 | 384 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
385 |
case EStdKeyUpArrow: |
12 | 386 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
387 |
iKeyCode = 1; |
12 | 388 |
response = EKeyWasConsumed; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
389 |
break; |
12 | 390 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
391 |
case EStdKeyDownArrow: |
12 | 392 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
393 |
iKeyCode = 2; |
12 | 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; |
12 | 396 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
397 |
case EStdKeyLeftArrow: |
12 | 398 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
399 |
iKeyCode = 3; |
12 | 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; |
12 | 402 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
403 |
case EStdKeyRightArrow: |
12 | 404 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
405 |
iKeyCode = 4; |
12 | 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; |
12 | 408 |
} |
409 |
} |
|
410 |
||
411 |
if (iKeyCode != 0) |
|
412 |
{ |
|
413 |
iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier; |
|
414 |
iTickCount = 0; |
|
415 |
iTimer->Call(KWait); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
416 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
417 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
418 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
419 |
// 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
|
420 |
else if (aType == EEventKeyUp) |
12 | 421 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
422 |
switch (aKeyEvent.iScanCode) |
12 | 423 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
424 |
case EStdKeyUpArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
425 |
case EStdKeyDownArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
426 |
case EStdKeyLeftArrow: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
427 |
case EStdKeyRightArrow: |
12 | 428 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
429 |
iKeyCode = 0; |
12 | 430 |
response = EKeyWasConsumed; |
431 |
ShowTooltip(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
432 |
break; |
12 | 433 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
434 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
435 |
} |
12 | 436 |
|
437 |
return response; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
438 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
439 |
|
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 |
// SizeChanged |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
442 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
443 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
444 |
void CImageEditorDrawControl::SizeChanged() |
12 | 445 |
{ |
446 |
if (iSizeChangeFlag) |
|
447 |
{ |
|
448 |
SetToolBarStatus(); |
|
449 |
} |
|
450 |
else |
|
451 |
{ |
|
452 |
iSizeChangeFlag = ETrue; |
|
453 |
} |
|
454 |
if (iDragIsStart) |
|
455 |
{ |
|
14 | 456 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 457 |
{ |
458 |
for (TInt i = 0; i < iTotalComponent; i++) |
|
459 |
{ |
|
460 |
if (iLabels[0]->Rect().iTl.iX <= 0) |
|
461 |
{ |
|
462 |
TInt x = iLabels[i]->Rect().iTl.iX; |
|
463 |
iLabels[i]->SetPosition(TPoint(x + iDragOffset, |
|
464 |
iLoopMenuRect.iTl.iY)); |
|
465 |
iLabels[i]->ResetControl(); |
|
466 |
} |
|
467 |
} |
|
468 |
} |
|
14 | 469 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 470 |
{ |
471 |
for (TInt i = 0; i < iTotalComponent; i++) |
|
472 |
{ |
|
473 |
if (iLabels[0]->Rect().iTl.iY <= 0) |
|
474 |
{ |
|
475 |
TInt y = iLabels[i]->Rect().iTl.iY; |
|
476 |
iLabels[i]->SetPosition(TPoint(iLoopMenuRect.iTl.iX, y |
|
477 |
+ iDragOffset)); |
|
478 |
iLabels[i]->ResetControl(); |
|
479 |
} |
|
480 |
} |
|
481 |
} |
|
482 |
DrawNow(); |
|
483 |
} |
|
484 |
} |
|
14 | 485 |
// --------------------------------------------------------------------------- |
486 |
// CImageEditorDrawControl::SetToolBarStatus() |
|
487 |
// Set and get current status : display or hidden. |
|
488 |
// --------------------------------------------------------------------------- |
|
489 |
// |
|
12 | 490 |
void CImageEditorDrawControl::SetToolBarStatus() |
491 |
{ |
|
14 | 492 |
if (iFlagDragToolBar) |
493 |
{ |
|
494 |
iDisplayTool = ETrue; |
|
495 |
iFlagDragToolBar = EFalse; |
|
496 |
} |
|
497 |
if (iMainMenuLayout == EMainMenuVertical) |
|
12 | 498 |
{ |
499 |
TInt leftX = iLabels[0]->Rect().iTl.iX; |
|
500 |
TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
|
501 |
if (leftX == 0) |
|
502 |
iDisplayTool = ETrue; |
|
503 |
else if (rightX == 0) |
|
504 |
iDisplayTool = EFalse; |
|
505 |
} |
|
14 | 506 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 507 |
{ |
508 |
TInt topY = iLabels[0]->Rect().iTl.iY; |
|
509 |
TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; |
|
510 |
if (topY == 0) |
|
511 |
iDisplayTool = ETrue; |
|
512 |
else if (bottomY == 0) |
|
513 |
iDisplayTool = EFalse; |
|
514 |
||
515 |
} |
|
516 |
||
517 |
} |
|
1
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 |
// GetParam |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
520 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
521 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
522 |
TDesC& CImageEditorDrawControl::GetParam() |
12 | 523 |
{ |
14 | 524 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetParam()"); |
525 |
LOGDES(KDrawPluginLogFile, iParam); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
526 |
return iParam; |
12 | 527 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
528 |
|
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 |
// SetSystemParameters |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
531 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
532 |
// |
12 | 533 |
void CImageEditorDrawControl::SetSystemParameters( |
534 |
const CSystemParameters* aPars) |
|
535 |
{ |
|
14 | 536 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSystemParameters()"); |
12 | 537 |
ASSERT(aPars); |
538 |
iSysPars = aPars; |
|
539 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
540 |
|
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 |
// HandlePluginCommandL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
543 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
544 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
545 |
void CImageEditorDrawControl::HandlePluginCommandL(const TInt aCommand) |
12 | 546 |
{ |
14 | 547 |
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
|
548 |
|
12 | 549 |
switch (aCommand) |
550 |
{ |
|
551 |
case EImageEditorFocusLost: |
|
552 |
{ |
|
553 |
if (iTimer) |
|
554 |
{ |
|
555 |
iTimer->Cancel(); |
|
556 |
} |
|
557 |
break; |
|
558 |
} |
|
559 |
case EPgnSoftkeyIdOk: |
|
560 |
{ |
|
561 |
iPopupController->HideInfoPopupNote(); |
|
562 |
break; |
|
563 |
} |
|
564 |
case EPgnSoftkeyIdCancel: |
|
565 |
{ |
|
566 |
iPopupController->HideInfoPopupNote(); |
|
567 |
iEditorView->HandleCommandL(EImageEditorCancelPlugin); |
|
568 |
break; |
|
569 |
} |
|
570 |
case EPgnSoftkeyIdDone: |
|
571 |
// FALLTROUHG |
|
572 |
case EDrawPgnMenuCmdDone: |
|
573 |
{ |
|
574 |
iPopupController->HideInfoPopupNote(); |
|
575 |
StoreParameters(EFalse, ETrue); |
|
576 |
iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call |
|
577 |
iEditorView->HandleCommandL(EImageEditorApplyPlugin); |
|
578 |
break; |
|
579 |
} |
|
580 |
case EDrawPgnMenuCmdResize: |
|
581 |
{ |
|
582 |
StoreParameters(ETrue, ETrue); |
|
583 |
iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call |
|
584 |
SelectSizeL(); |
|
585 |
break; |
|
586 |
} |
|
587 |
case EDrawPgnMenuCmdColor: |
|
588 |
{ |
|
589 |
StoreParameters(ETrue, ETrue); |
|
590 |
iEditorView->HandleCommandL(EImageEditorCmdRender);//results Draw call |
|
591 |
SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); |
|
592 |
break; |
|
593 |
} |
|
594 |
case EDrawPgnMenuCmdCancel: |
|
595 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
596 |
iReadyToRender = EFalse; |
12 | 597 |
iEditorView->HandleCommandL(EImageEditorCancelPlugin); |
598 |
break; |
|
599 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
600 |
|
12 | 601 |
case EImageEditorGlobalZoomChanged: |
602 |
// FALLTROUGHT |
|
603 |
case EImageEditorGlobalPanChanged: |
|
604 |
{ |
|
605 |
RestorePosAndScaleRelScreen(); |
|
606 |
StoreTempParams(); |
|
607 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
608 |
break; |
|
609 |
} |
|
610 |
||
611 |
case EImageEditorPreScreenModeChange: |
|
612 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
613 |
StorePosAndScaleRelImage(); |
12 | 614 |
break; |
615 |
} |
|
616 |
||
617 |
case EImageEditorPostScreenModeChange: |
|
618 |
{ |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
619 |
RestorePosAndScaleRelImage(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
620 |
ClipPosition(); |
12 | 621 |
StoreTempParams(); |
622 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
623 |
break; |
|
624 |
} |
|
625 |
default: |
|
626 |
{ |
|
627 |
break; |
|
628 |
} |
|
629 |
} |
|
630 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
631 |
|
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 |
// GetSoftkeyIndexL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
634 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
635 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
636 |
TInt CImageEditorDrawControl::GetSoftkeyIndexL() |
12 | 637 |
{ |
14 | 638 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetSoftkeyIndexL()"); |
12 | 639 |
// : Check needed states |
640 |
TInt state(2); |
|
641 |
return state; |
|
642 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
643 |
|
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 |
// GetContextMenuResourceId |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
646 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
647 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
648 |
TInt CImageEditorDrawControl::GetContextMenuResourceId() |
12 | 649 |
{ |
650 |
return R_TEXT_CONTEXT_MENUBAR; |
|
651 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
652 |
|
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 |
// GetDimmedMenuItems |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
655 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
656 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
657 |
TBitField CImageEditorDrawControl::GetDimmedMenuItems() |
12 | 658 |
{ |
14 | 659 |
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
|
660 |
|
12 | 661 |
TBitField dimmedMenuItems; |
662 |
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
|
663 |
|
12 | 664 |
if (iDisplayingOkOptionsMenu) |
665 |
{ |
|
666 |
// Dim the command EImageEditorCancelPlugin |
|
667 |
for (TInt i = 0; i < count; i++) |
|
668 |
{ |
|
669 |
// get the menu item id |
|
670 |
TInt menuItem = iItem->MenuItems().At(i).iCommandId; |
|
671 |
if (menuItem == EDrawPgnMenuCmdCancel) |
|
672 |
{ |
|
673 |
dimmedMenuItems.SetBit(i); |
|
674 |
} |
|
675 |
} |
|
676 |
iDisplayingOkOptionsMenu = EFalse; |
|
677 |
} |
|
678 |
||
679 |
for (TInt i = 0; i < count; i++) |
|
680 |
{ |
|
681 |
// get the menu item id |
|
682 |
TInt menuItem = iItem->MenuItems().At(i).iCommandId; |
|
683 |
if (menuItem == EDrawPgnMenuCmdMax) |
|
684 |
{ |
|
685 |
dimmedMenuItems.SetBit(i); |
|
686 |
} |
|
687 |
} |
|
688 |
return dimmedMenuItems; |
|
689 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
690 |
|
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 |
// GetNaviPaneTextL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
693 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
694 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
695 |
TPtrC CImageEditorDrawControl::GetNaviPaneTextL( |
12 | 696 |
TBool& aLeftNaviPaneScrollButtonVisibile, |
697 |
TBool& aRightNaviPaneScrollButtonVisible) |
|
698 |
{ |
|
14 | 699 |
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
|
700 |
|
12 | 701 |
aLeftNaviPaneScrollButtonVisibile = EFalse; |
702 |
aRightNaviPaneScrollButtonVisible = EFalse; |
|
703 |
return *iNaviPaneText; |
|
704 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
705 |
|
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 |
// Draw |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
708 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
709 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
710 |
void CImageEditorDrawControl::Draw(const TRect& aRect) const |
12 | 711 |
{ |
712 |
CWindowGc & gc = SystemGc(); |
|
713 |
gc.SetBrushColor(KRgbBlack); |
|
714 |
gc.Clear(aRect); |
|
715 |
||
716 |
TRect ImageRect(iSysPars->VisibleImageRectPrev()); |
|
717 |
CPreviewControlBase::DrawPreviewImage(aRect); |
|
718 |
gc.SetClippingRect(TRect(TPoint(ImageRect.iTl.iX, ImageRect.iTl.iY |
|
719 |
+ iStatuspaneHeight), ImageRect.Size())); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
720 |
|
12 | 721 |
if (iPaths.Count() > 0) |
722 |
{ |
|
723 |
// ASSERT( iSysPars ); |
|
724 |
TInt count = iPaths.Count(); |
|
725 |
for (TInt i(0); i < iPaths.Count(); ++i) |
|
726 |
{ |
|
727 |
CDrawPath* path = iPaths[i]; |
|
728 |
CArrayFix<TPoint>* pathPoints = path->ItemArray(); |
|
729 |
gc.SetPenStyle(CGraphicsContext::ESolidPen); |
|
730 |
gc.SetPenColor(path->Color()); |
|
731 |
gc.SetPenSize(ScaledLineSize(path->Size())); |
|
732 |
gc.DrawPolyLine(pathPoints); |
|
733 |
} |
|
734 |
} |
|
735 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
736 |
|
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 |
// NaviDown |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
739 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
740 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
741 |
void CImageEditorDrawControl::NaviDown() |
12 | 742 |
{ |
14 | 743 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviDown()"); |
12 | 744 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
745 |
|
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 |
// NaviUp |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
748 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
749 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
750 |
void CImageEditorDrawControl::NaviUp() |
12 | 751 |
{ |
14 | 752 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviUp()"); |
12 | 753 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
754 |
|
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 |
// NaviRight |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
757 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
758 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
759 |
void CImageEditorDrawControl::NaviRight() |
12 | 760 |
{ |
14 | 761 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviRight()"); |
12 | 762 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
763 |
|
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 |
// NaviLeft |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
766 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
767 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
768 |
void CImageEditorDrawControl::NaviLeft() |
12 | 769 |
{ |
14 | 770 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviLeft()"); |
12 | 771 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
772 |
|
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 |
// SelectSizeL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
775 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
776 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
777 |
void CImageEditorDrawControl::SelectSizeL() |
12 | 778 |
{ |
14 | 779 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SelectSizeL()"); |
12 | 780 |
// Symmetric line width / height |
781 |
TInt size(iSize.iWidth); |
|
782 |
CSelectionDialog::RunDlgLD(iPreview, Rect(), size, iRgb, |
|
783 |
iSysPars->VisibleImageRectPrev()); |
|
784 |
iSize = TSize(size, size); |
|
785 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
786 |
|
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 |
// StoreTempParams |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
789 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
790 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
791 |
void CImageEditorDrawControl::StoreTempParams() |
12 | 792 |
{ |
18
ef7741bd05bf
Image editor- changes to fix Unfrozen export errors.
srilekhas
parents:
14
diff
changeset
|
793 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams()"); |
12 | 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() |
12 | 801 |
{ |
14 | 802 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); |
12 | 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 |
12 | 810 |
{ |
14 | 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 |
|
12 | 813 |
aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); |
14 | 814 |
aContext.iContext = KSIE_HLP_EDIT_DRAW; |
12 | 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() |
12 | 822 |
{ |
14 | 823 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::PrepareL()"); |
12 | 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(); |
12 | 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 |
|
12 | 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 |
// |
12 | 837 |
void CImageEditorDrawControl::LoadIndicatorL(TInt aBitmapInd, TInt aMaskInd) |
838 |
{ |
|
14 | 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 |
|
12 | 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 |
|
12 | 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(); |
12 | 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 |
12 | 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 |
|
12 | 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 |
|
12 | 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 |
12 | 883 |
{ |
14 | 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; |
12 | 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) |
12 | 893 |
{ |
14 | 894 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreParameters()"); |
12 | 895 |
RDebug::Print(_L("CImageEditorDrawControl::StoreParameters color[%d]"), |
14 | 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 ")); |
12 | 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 ")); |
12 | 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 ")); |
12 | 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() |
12 | 933 |
{ |
14 | 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 |
|
12 | 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) |
12 | 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) |
12 | 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: |
12 | 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 |
} |
14 | 973 |
//StoreParameters(); |
974 |
TRAP_IGNORE(iEditorView->HandleCommandL(EImageEditorCmdRender)); |
|
12 | 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() |
12 | 984 |
{ |
14 | 985 |
LOG(KDrawPluginLogFile, |
986 |
"CImageEditorClipartControl::StorePosAndScaleRelScreen()"); |
|
12 | 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() |
12 | 995 |
{ |
14 | 996 |
LOG(KDrawPluginLogFile, |
997 |
"CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); |
|
12 | 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() |
12 | 1005 |
{ |
1006 |
TReal relscale = iSysPars->RelScale(); |
|
14 | 1007 |
LOGFMT(KDrawPluginLogFile, |
1008 |
"CImageEditorClipartControl::StorePosAndScaleRelImage():%g", |
|
1009 |
relscale); |
|
12 | 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() |
12 | 1017 |
{ |
1018 |
TReal relscale = iSysPars->RelScale(); |
|
14 | 1019 |
LOGFMT(KDrawPluginLogFile, |
1020 |
"CImageEditorClipartControl::RestorePosAndScaleRelImage():%g", |
|
1021 |
relscale); |
|
12 | 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() |
12 | 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( |
12 | 1054 |
const TPointerEvent &aPointerEvent) |
1055 |
{ |
|
1056 |
SetToolBarStatus(); |
|
1057 |
RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), |
|
14 | 1058 |
AknLayoutUtils::PenEnabled()); |
12 | 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 |
{ |
12 | 1063 |
RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), |
14 | 1064 |
aPointerEvent.iType); |
12 | 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 |
{ |
12 | 1072 |
|
1073 |
iButtonDownPoint = point; |
|
1074 |
iLastPointEventType = EFalse; |
|
1075 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
14 | 1076 |
//Handle Drag tool bar event. |
12 | 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 |
|
12 | 1088 |
} |
14 | 1089 |
//Doodle event. |
12 | 1090 |
else if ((!iLoopMenuRect.Contains(point) |
1091 |
&& !iCustomComponetClick && iDisplayTool) |
|
1092 |
|| (!iDisplayTool && !iCustomComponetClick)) |
|
1093 |
{ |
|
1094 |
iPointStartInLoopRect = EFalse; |
|
1095 |
//System dispose |
|
14 | 1096 |
iReadyToRender = EFalse; |
12 | 1097 |
CDrawPath* lastPath = CDrawPath::NewL(); |
1098 |
CleanupStack::PushL(lastPath); |
|
1099 |
lastPath->SetColor(iRgb); |
|
1100 |
lastPath->SetSize(iSize); |
|
1101 |
SetPositionOnImage(aPointerEvent.iPosition); |
|
1102 |
lastPath->AddItemL(aPointerEvent.iPosition); |
|
1103 |
iPaths.AppendL(lastPath); |
|
1104 |
CleanupStack::Pop(lastPath); |
|
1105 |
iCanRedo = EFalse; |
|
1106 |
iUndoPaths.ResetAndDestroy(); |
|
1107 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1108 |
} |
12 | 1109 |
break; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1110 |
case TPointerEvent::EButton1Up: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1111 |
{ |
12 | 1112 |
// System dispose |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1113 |
iReadyToRender = ETrue; |
12 | 1114 |
iCustomComponetClick = EFalse; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1115 |
lastItem = ETrue; |
14 | 1116 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
12 | 1117 |
HandleMainMenuButtonUp(point); |
1118 |
DrawNow(); |
|
14 | 1119 |
|
12 | 1120 |
} |
1121 |
break; |
|
1122 |
case TPointerEvent::EDrag: |
|
1123 |
{ |
|
1124 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
14 | 1125 |
//Mark last event use for custompoent. |
12 | 1126 |
iLastPointEventType = ETrue; |
1127 |
||
1128 |
if ((iDisplayTool && iPaths.Count() && !iCustomComponetClick |
|
1129 |
&& !iPointStartInLoopRect) || (!iDisplayTool |
|
1130 |
&& iPaths.Count() && !iCustomComponetClick)) |
|
1131 |
{ |
|
1132 |
iCanRedo = EFalse; |
|
1133 |
iUndoPaths.ResetAndDestroy(); |
|
1134 |
CDrawPath* path = iPaths[iPaths.Count() - 1]; |
|
1135 |
// store current position for next round |
|
1136 |
iPointerPosition = aPointerEvent.iPosition; |
|
1137 |
SetPositionOnImage(aPointerEvent.iPosition); |
|
1138 |
path->AddItemL(aPointerEvent.iPosition); |
|
1139 |
} |
|
14 | 1140 |
//Drag customcomponent event |
12 | 1141 |
if (iCustomComponetClick) |
1142 |
{ |
|
1143 |
TPoint con(aPointerEvent.iPosition.iX - 25, |
|
1144 |
aPointerEvent.iPosition.iY - 25); |
|
1145 |
iCustomComponet->SetExtent(con, TSize(50, 50)); |
|
1146 |
DrawNow(); |
|
1147 |
} |
|
14 | 1148 |
//Drag tool bar event |
12 | 1149 |
if (iDisplayTool && iPointStartInLoopRect) |
1150 |
||
1151 |
{ |
|
14 | 1152 |
iFlagDragToolBar = ETrue; |
12 | 1153 |
HandleMainMenuButtonDrag(point); |
1154 |
} |
|
1155 |
} |
|
1156 |
break; |
|
1157 |
default: |
|
1158 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1159 |
break; |
12 | 1160 |
|
1161 |
} |
|
1162 |
||
1163 |
//System dispose |
|
1164 |
if ((!iPointStartInLoopRect && iDisplayTool) || !iDisplayTool) |
|
1165 |
{ |
|
1166 |
if (!(iCustomComponet->Rect().Contains(aPointerEvent.iPosition))) |
|
1167 |
{ |
|
1168 |
StoreParameters(lastItem, EFalse); |
|
1169 |
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
|
1170 |
} |
12 | 1171 |
} |
1172 |
} |
|
1173 |
||
1174 |
} |
|
1175 |
||
1176 |
// --------------------------------------------------------------------------- |
|
14 | 1177 |
// CImageEditorDrawControl::HandleMainMenuButtonUp() |
1178 |
// |
|
12 | 1179 |
// --------------------------------------------------------------------------- |
1180 |
// |
|
1181 |
void CImageEditorDrawControl::HandleMainMenuButtonUp(TPoint aPoint) |
|
1182 |
{ |
|
14 | 1183 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 1184 |
{ |
1185 |
if (iDragIsStart) |
|
1186 |
{ |
|
1187 |
//Drag event is end (Except activating animation effect). |
|
1188 |
iDragIsStart = EFalse; |
|
1189 |
||
1190 |
if (Abs(iDragPrePoint.iX - aPoint.iX) > 1) |
|
1191 |
{ |
|
1192 |
//Animation effect is activated |
|
1193 |
iDragIsStart = ETrue; |
|
1194 |
iStartSpeed = aPoint.iX - iDragPrePoint.iX; |
|
1195 |
iAnimationAO->StartL(0); |
|
1196 |
} |
|
1197 |
} |
|
1198 |
} |
|
14 | 1199 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 1200 |
{ |
1201 |
if (iDragIsStart) |
|
1202 |
{ |
|
1203 |
//Drag event is end (Except activating animation effect). |
|
1204 |
iDragIsStart = EFalse; |
|
1205 |
||
1206 |
if (Abs(iDragPrePoint.iY - aPoint.iY) > 1) |
|
1207 |
{ |
|
1208 |
//Animation effect is activated |
|
1209 |
iDragIsStart = ETrue; |
|
1210 |
iStartSpeed = aPoint.iY - iDragPrePoint.iY; |
|
1211 |
iAnimationAO->StartL(0); |
|
1212 |
} |
|
1213 |
} |
|
1214 |
} |
|
1215 |
} |
|
1216 |
||
1217 |
// --------------------------------------------------------------------------- |
|
1218 |
// HandleMainMenuButtonDrag |
|
1219 |
// --------------------------------------------------------------------------- |
|
1220 |
// |
|
1221 |
void CImageEditorDrawControl::HandleMainMenuButtonDrag(TPoint aPoint) |
|
1222 |
{ |
|
14 | 1223 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 1224 |
{ |
1225 |
if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iX |
|
1226 |
- iButtonDownPoint.iX) >= DRAG_LENGTH) |
|
1227 |
{ |
|
1228 |
iDragIsStart = ETrue; |
|
1229 |
iDragStartPoint = aPoint; |
|
14 | 1230 |
|
12 | 1231 |
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
|
1232 |
{ |
12 | 1233 |
if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
1234 |
{ |
|
1235 |
iLabels[i]->LabelIsMoving(); |
|
1236 |
} |
|
1237 |
} |
|
1238 |
} |
|
1239 |
||
1240 |
if (iDragIsStart) |
|
1241 |
{ |
|
1242 |
iDragPrePoint = iDragUpPoint; |
|
1243 |
iDragUpPoint = aPoint; |
|
1244 |
iDragOffset = aPoint.iX - iDragStartPoint.iX; |
|
1245 |
iDragStartPoint = aPoint; |
|
14 | 1246 |
|
12 | 1247 |
CalculateEffectiveOffset(); |
1248 |
SizeChanged(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1249 |
} |
12 | 1250 |
} |
14 | 1251 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 1252 |
{ |
1253 |
if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iY |
|
1254 |
- iButtonDownPoint.iY) >= DRAG_LENGTH) |
|
1255 |
{ |
|
1256 |
iDragIsStart = ETrue; |
|
1257 |
iDragStartPoint = aPoint; |
|
14 | 1258 |
|
12 | 1259 |
for (TInt i = 0; i < iTotalComponent; i++) |
1260 |
{ |
|
1261 |
if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
|
1262 |
{ |
|
1263 |
iLabels[i]->LabelIsMoving(); |
|
1264 |
} |
|
1265 |
} |
|
1266 |
} |
|
1267 |
||
1268 |
if (iDragIsStart) |
|
1269 |
{ |
|
1270 |
iDragPrePoint = iDragUpPoint; |
|
1271 |
iDragUpPoint = aPoint; |
|
1272 |
iDragOffset = aPoint.iY - iDragStartPoint.iY; |
|
1273 |
iDragStartPoint = aPoint; |
|
14 | 1274 |
|
12 | 1275 |
CalculateEffectiveOffset(); |
1276 |
SizeChanged(); |
|
1277 |
} |
|
1278 |
} |
|
1279 |
} |
|
1280 |
||
1281 |
// --------------------------------------------------------------------------- |
|
1282 |
// UndoDrawPath |
|
1283 |
// --------------------------------------------------------------------------- |
|
1284 |
// |
|
1285 |
void CImageEditorDrawControl::UndoDrawPath() |
|
1286 |
{ |
|
1287 |
if (iPaths.Count()) |
|
1288 |
{ |
|
1289 |
iUndoPaths.Append(iPaths[iPaths.Count() - 1]); |
|
1290 |
iPaths.Remove(iPaths.Count() - 1); |
|
1291 |
iCanRedo = ETrue; |
|
1292 |
} |
|
1293 |
} |
|
1294 |
||
1295 |
// --------------------------------------------------------------------------- |
|
1296 |
// RedoDrawPath |
|
1297 |
// --------------------------------------------------------------------------- |
|
1298 |
// |
|
1299 |
void CImageEditorDrawControl::RedoDrawPath() |
|
1300 |
{ |
|
1301 |
if (iUndoPaths.Count()) |
|
1302 |
{ |
|
1303 |
iPaths.Append(iUndoPaths[iUndoPaths.Count() - 1]); |
|
1304 |
iUndoPaths.Remove(iUndoPaths.Count() - 1); |
|
1305 |
} |
|
1306 |
} |
|
1307 |
||
1308 |
// --------------------------------------------------------------------------- |
|
1309 |
// HandlePointerNotify |
|
1310 |
// --------------------------------------------------------------------------- |
|
1311 |
// |
|
1312 |
void CImageEditorDrawControl::HandlePointerNotify(CCoeControl* aComponent) |
|
1313 |
{ |
|
1314 |
//pen size |
|
1315 |
if (iLabels[0] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1316 |
{ |
|
1317 |
MakeVisibleLable(EFalse); |
|
1318 |
SelectSizeL(); |
|
1319 |
MakeVisibleLable(ETrue); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1320 |
} |
12 | 1321 |
//pen color |
1322 |
else if (iLabels[1] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1323 |
{ |
|
1324 |
MakeVisibleLable(EFalse); |
|
1325 |
SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); |
|
1326 |
MakeVisibleLable(ETrue); |
|
1327 |
} |
|
1328 |
//undo |
|
1329 |
else if (iLabels[2] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1330 |
{ |
|
1331 |
UndoDrawPath(); |
|
1332 |
iUndo = ETrue; |
|
1333 |
StoreParameters(EFalse, EFalse); |
|
1334 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
1335 |
iUndo = EFalse; |
|
1336 |
} |
|
14 | 1337 |
//save and quit |
12 | 1338 |
else if (iLabels[3] == dynamic_cast<CImageLabel*> (aComponent)) |
1339 |
{ |
|
1340 |
iRedo = ETrue; |
|
1341 |
RedoDrawPath(); |
|
1342 |
StoreParameters(EFalse, EFalse); |
|
1343 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
1344 |
iRedo = EFalse; |
|
1345 |
} |
|
13 | 1346 |
else if (iLabels[4] == dynamic_cast<CImageLabel*> (aComponent)) |
1347 |
{ |
|
1348 |
iPopupController->HideInfoPopupNote(); |
|
1349 |
StoreParameters(EFalse, ETrue); |
|
1350 |
iEditorView->HandleCommandL(EImageEditorApplyPlugin); |
|
1351 |
} |
|
1352 |
else if (iLabels[5] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1353 |
{ |
|
14 | 1354 |
iEditorView->HandleCommandL(EImageEditorMenuCmdHelp); |
13 | 1355 |
} |
12 | 1356 |
else if (iLabels[6] == dynamic_cast<CImageLabel*> (aComponent)) |
1357 |
{ |
|
1358 |
||
1359 |
} |
|
1360 |
else if (iCustomComponet == dynamic_cast<CCustomerComponet*> (aComponent)) |
|
1361 |
{ |
|
1362 |
if (iCustomComponet->GetButtonType()) |
|
1363 |
{ |
|
1364 |
iCustomComponetClick = ETrue; |
|
1365 |
} |
|
14 | 1366 |
|
12 | 1367 |
if ((!iCustomComponet->GetButtonType()) && (!iLastPointEventType)) |
1368 |
{ |
|
1369 |
StartTheAnimation(); |
|
1370 |
||
1371 |
} |
|
1372 |
} |
|
1373 |
||
1374 |
} |
|
1
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 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1377 |
// SetPositionOnImage |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1378 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1379 |
// |
12 | 1380 |
void CImageEditorDrawControl::SetPositionOnImage(TPoint aPointedPosition) |
1381 |
{ |
|
1382 |
ASSERT(iSysPars); |
|
1383 |
// Get system parameters |
|
1384 |
TRect visibleImageRect(iSysPars->VisibleImageRect()); |
|
1385 |
TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); |
|
1386 |
||
1387 |
TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
|
1388 |
TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
|
1389 |
||
14 | 1390 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::vir w:%d h:%d", |
1391 |
visibleImageRect.Width(), visibleImageRect.Height()); |
|
1392 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::virp w:%d h:%d", |
|
1393 |
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
|
1394 |
|
12 | 1395 |
// Dividing by zero will cause panic -> check |
1396 |
if (xPosFactorDivider == 0 || yPosFactorDivider == 0) |
|
1397 |
{ |
|
1398 |
// Set default position |
|
1399 |
iX = (visibleImageRect.iTl.iX + visibleImageRect.iBr.iX) / 2; |
|
1400 |
iY = (visibleImageRect.iTl.iY + visibleImageRect.iBr.iY) / 2; |
|
1401 |
} |
|
1402 |
else |
|
1403 |
{ |
|
1404 |
// Calculate relative position on the screen |
|
1405 |
TReal xPositionFactor(TReal(aPointedPosition.iX |
|
1406 |
- visibleImageRectPrev.iTl.iX) / xPosFactorDivider); |
|
1407 |
// |
|
1408 |
// TReal yPositionFactor(TReal(aPointedPosition.iY - iStatuspaneHeight |
|
1409 |
// - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
|
1410 |
TReal yPositionFactor(TReal(aPointedPosition.iY |
|
1411 |
- visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
|
14 | 1412 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::pfx:%g pfy:%g", |
1413 |
xPositionFactor, yPositionFactor); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1414 |
// 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
|
1415 |
|
12 | 1416 |
iX = visibleImageRect.iTl.iX + visibleImageRect.Width() |
1417 |
* xPositionFactor + 0.5; |
|
1418 |
||
1419 |
iY = visibleImageRect.iTl.iY + visibleImageRect.Height() |
|
1420 |
* yPositionFactor + 0.5; |
|
1421 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1422 |
|
14 | 1423 |
LOGFMT4(KDrawPluginLogFile, |
1424 |
"CImageEditorDrawControl::Draw x:%d iX:%d y:%d iY:%d", |
|
1425 |
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
|
1426 |
// Check that not out of bounds |
12 | 1427 |
//ClipPosition(); |
1428 |
} |
|
1429 |
||
1
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 |
// GetPositionOnView |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1432 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1433 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1434 |
TPoint CImageEditorDrawControl::GetPositionOnView() |
12 | 1435 |
{ |
1436 |
ASSERT(iSysPars); |
|
1437 |
// Get system parameters |
|
1438 |
TRect visibleImageRect(iSysPars->VisibleImageRect()); |
|
1439 |
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
|
1440 |
|
12 | 1441 |
TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
1442 |
TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
|
1443 |
||
1444 |
// Calculate relative position on the screen |
|
1445 |
TReal xPositionFactor(TReal(iX + visibleImageRectPrev.iTl.iX) |
|
1446 |
/ xPosFactorDivider); |
|
1447 |
||
1448 |
TReal yPositionFactor(TReal(iY + visibleImageRectPrev.iTl.iY) |
|
1449 |
/ yPosFactorDivider); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1450 |
|
14 | 1451 |
LOGFMT2(KDrawPluginLogFile, |
1452 |
"CImageEditorDrawControl::GetPositionOnView xf:%g yf:%g", |
|
1453 |
xPositionFactor, yPositionFactor); |
|
12 | 1454 |
|
14 | 1455 |
LOGFMT2(KDrawPluginLogFile, |
1456 |
"CImageEditorDrawControl::GetPositionOnView xf:%d yf:%d", |
|
1457 |
xPosFactorDivider, yPosFactorDivider); |
|
12 | 1458 |
|
14 | 1459 |
LOGFMT2(KDrawPluginLogFile, |
1460 |
"CImageEditorDrawControl::GetPositionOnView w:%d h:%d", iX, iY); |
|
12 | 1461 |
|
1462 |
TInt xPosition(iX + visibleImageRectPrev.iTl.iX); |
|
1463 |
TInt yPosition(iY + visibleImageRectPrev.iTl.iY); |
|
1464 |
||
14 | 1465 |
LOGFMT3(KDrawPluginLogFile, |
1466 |
"CImageEditorDrawControl::GetPositionOnView w:%d h:%d S:%g", |
|
1467 |
xPosition, yPosition, iSysPars->RelScale()); |
|
12 | 1468 |
|
1469 |
return TPoint(xPosition, yPosition); |
|
1470 |
} |
|
1
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 |
// ShowTooltip |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1474 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1475 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1476 |
void CImageEditorDrawControl::ShowTooltip() |
12 | 1477 |
{ |
1478 |
iPopupController->HideInfoPopupNote(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1479 |
|
12 | 1480 |
TPoint iconPosition = ComputeIndicatorPosition(); |
1481 |
TRect iconRect(iconPosition.iX, iconPosition.iY, iconPosition.iX, |
|
1482 |
iconPosition.iY); |
|
1483 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1484 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1485 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1486 |
// ScaledLineSize |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1487 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1488 |
// |
12 | 1489 |
TSize CImageEditorDrawControl::ScaledLineSize(TSize aOriginalSize) const |
1490 |
{ |
|
1491 |
TInt sizew(aOriginalSize.iWidth * iSysPars->RelScale() + 0.5); |
|
1492 |
TInt sizeh(aOriginalSize.iHeight * iSysPars->RelScale() + 0.5); |
|
1493 |
if (sizew < 1) |
|
1494 |
{ |
|
1495 |
sizew++; |
|
1496 |
} |
|
1497 |
if (sizeh < 1) |
|
1498 |
{ |
|
1499 |
sizeh++; |
|
1500 |
} |
|
1501 |
||
14 | 1502 |
LOGFMT3(KDrawPluginLogFile, |
1503 |
"CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", sizew, |
|
1504 |
sizeh, iSysPars->RelScale()); |
|
12 | 1505 |
return TSize(sizew, sizeh); |
1506 |
} |
|
1507 |
||
1508 |
// --------------------------------------------------------------------------- |
|
1509 |
// CountComponentControls |
|
1510 |
// --------------------------------------------------------------------------- |
|
1511 |
// |
|
1512 |
TInt CImageEditorDrawControl::CountComponentControls() const |
|
1513 |
{ |
|
1514 |
return iTotalComponent + 1; |
|
1515 |
} |
|
1516 |
||
1517 |
// --------------------------------------------------------------------------- |
|
1518 |
// ComponentControl |
|
1519 |
// --------------------------------------------------------------------------- |
|
1520 |
// |
|
1521 |
CCoeControl* CImageEditorDrawControl::ComponentControl(TInt aIndex) const |
|
1522 |
{ |
|
1523 |
switch (aIndex) |
|
1524 |
{ |
|
1525 |
case 7: |
|
1526 |
return iCustomComponet; |
|
1527 |
case 0: |
|
1528 |
return iLabels[0]; |
|
1529 |
case 1: |
|
1530 |
return iLabels[1]; |
|
1531 |
case 2: |
|
1532 |
return iLabels[2]; |
|
1533 |
case 3: |
|
1534 |
return iLabels[3]; |
|
1535 |
case 4: |
|
1536 |
return iLabels[4]; |
|
1537 |
case 5: |
|
1538 |
return iLabels[5]; |
|
1539 |
case 6: |
|
1540 |
return iLabels[6]; |
|
1541 |
default: |
|
1542 |
return NULL; |
|
1543 |
} |
|
1544 |
return NULL; |
|
1545 |
} |
|
1546 |
||
1547 |
// --------------------------------------------------------------------------- |
|
1548 |
// Notify |
|
1549 |
// --------------------------------------------------------------------------- |
|
1550 |
// |
|
1551 |
void CImageEditorDrawControl::Notify() |
|
1552 |
{ |
|
1553 |
if (iStartSpeed > 0) |
|
1554 |
{ |
|
1555 |
iStartSpeed -= 2; |
|
1556 |
if (iStartSpeed <= 0) |
|
1557 |
{ |
|
1558 |
iStartSpeed = 0; |
|
1559 |
iDragIsStart = EFalse; |
|
1560 |
iAnimationAO->Cancel(); |
|
1561 |
} |
|
1562 |
} |
|
1563 |
else if (iStartSpeed < 0) |
|
1564 |
{ |
|
1565 |
iStartSpeed += 2; |
|
1566 |
if (iStartSpeed >= 0) |
|
1567 |
{ |
|
1568 |
iStartSpeed = 0; |
|
1569 |
iDragIsStart = EFalse; |
|
1570 |
iAnimationAO->Cancel(); |
|
1571 |
} |
|
1572 |
} |
|
1573 |
else |
|
1574 |
{ |
|
1575 |
iDragIsStart = EFalse; |
|
1576 |
iAnimationAO->Cancel(); |
|
1577 |
} |
|
1578 |
||
1579 |
iDragOffset += iStartSpeed; |
|
1580 |
CalculateEffectiveOffset(); |
|
1581 |
SizeChanged(); |
|
1582 |
} |
|
1583 |
||
1584 |
// --------------------------------------------------------------------------- |
|
1585 |
// Roll |
|
1586 |
// --------------------------------------------------------------------------- |
|
1587 |
// |
|
1588 |
void CImageEditorDrawControl::Roll() |
|
1589 |
{ |
|
1590 |
SetToolBarStatus(); |
|
14 | 1591 |
|
12 | 1592 |
TInt offset = 0; |
1593 |
iRollflag = ETrue; |
|
1594 |
if (iDisplayTool) |
|
1595 |
iRollDirection = EFalse; |
|
1596 |
else |
|
1597 |
iRollDirection = ETrue; |
|
1598 |
||
1599 |
if (iRollDirection) |
|
1600 |
{ |
|
1601 |
offset = 4; |
|
1602 |
} |
|
1603 |
else |
|
1604 |
{ |
|
1605 |
offset = -4; |
|
1606 |
} |
|
14 | 1607 |
|
1608 |
if (iMainMenuLayout == EMainMenuVertical) |
|
12 | 1609 |
{ |
1610 |
for (TInt i = 0; i < iLabels.Count(); i++) |
|
1611 |
{ |
|
1612 |
TInt x = iLabels[i]->Rect().iTl.iX; |
|
1613 |
iLabels[i]->SetPosition(TPoint(x + offset, iLoopMenuRect.iTl.iY)); |
|
1614 |
iLabels[i]->ResetControl(); |
|
1615 |
} |
|
1616 |
if (iLabels[0]->Rect().iTl.iX == 0 |
|
1617 |
|| iLabels[iLabels.Count() - 1]->Rect().iBr.iX == 0) |
|
1618 |
iRollflag = EFalse; |
|
1619 |
} |
|
14 | 1620 |
else if (iMainMenuLayout == EMainMenuHorizontal) |
12 | 1621 |
{ |
1622 |
for (TInt i = 0; i < iLabels.Count(); i++) |
|
1623 |
{ |
|
1624 |
TInt y = iLabels[i]->Rect().iTl.iY; |
|
1625 |
iLabels[i]->SetPosition(TPoint(iLoopMenuRect.iTl.iX, y + offset)); |
|
1626 |
iLabels[i]->ResetControl(); |
|
1627 |
} |
|
1628 |
if (iLabels[0]->Rect().iTl.iY == 0 |
|
1629 |
|| iLabels[iLabels.Count() - 1]->Rect().iBr.iY == 0) |
|
1630 |
iRollflag = EFalse; |
|
1631 |
} |
|
14 | 1632 |
|
12 | 1633 |
DrawNow(); |
14 | 1634 |
|
12 | 1635 |
if (!iRollflag) |
1636 |
{ |
|
1637 |
iRollAo->Cancel(); |
|
1638 |
} |
|
1639 |
} |
|
1640 |
||
1641 |
// --------------------------------------------------------------------------- |
|
1642 |
// CalculateEffectiveOffset |
|
1643 |
// --------------------------------------------------------------------------- |
|
1644 |
// |
|
1645 |
void CImageEditorDrawControl::CalculateEffectiveOffset() |
|
1646 |
{ |
|
14 | 1647 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 1648 |
{ |
1649 |
TInt leftX = iLabels[0]->Rect().iTl.iX; |
|
1650 |
TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
|
1651 |
TInt offset = iDragOffset; |
|
1652 |
if (leftX + offset > 0) |
|
1653 |
{ |
|
1654 |
iDragOffset = Abs(leftX); |
|
1655 |
} |
|
1656 |
||
1657 |
if (rightX + offset < 360) |
|
1658 |
{ |
|
1659 |
iDragOffset = -(rightX - 360); |
|
1660 |
} |
|
1661 |
} |
|
14 | 1662 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 1663 |
{ |
1664 |
TInt topY = iLabels[0]->Rect().iTl.iY; |
|
1665 |
TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; |
|
1666 |
TInt offset = iDragOffset; |
|
1667 |
if (topY + offset > 0) |
|
1668 |
{ |
|
1669 |
iDragOffset = Abs(topY); |
|
1670 |
} |
|
1671 |
||
1672 |
if (bottomY + offset < 360) |
|
1673 |
{ |
|
1674 |
iDragOffset = -(bottomY - 360); |
|
1675 |
} |
|
1676 |
} |
|
1677 |
} |
|
1678 |
||
1679 |
// --------------------------------------------------------------------------- |
|
1680 |
// MakeVisibleLable |
|
1681 |
// --------------------------------------------------------------------------- |
|
1682 |
// |
|
1683 |
void CImageEditorDrawControl::MakeVisibleLable(TBool aFlag) |
|
1684 |
{ |
|
1685 |
if (aFlag) |
|
1686 |
{ |
|
1687 |
for (int i = 0; i < iTotalComponent; i++) |
|
1688 |
{ |
|
1689 |
iLabels[i]->MakeVisible(ETrue); |
|
1690 |
} |
|
1691 |
} |
|
1692 |
else |
|
1693 |
{ |
|
1694 |
for (int i = 0; i < iTotalComponent; i++) |
|
1695 |
{ |
|
1696 |
iLabels[i]->MakeVisible(EFalse); |
|
1697 |
} |
|
1698 |
} |
|
1699 |
} |
|
1700 |
||
1701 |
// --------------------------------------------------------------------------- |
|
1702 |
// StartTheAnimation |
|
1703 |
// --------------------------------------------------------------------------- |
|
1704 |
// |
|
1705 |
void CImageEditorDrawControl::StartTheAnimation() |
|
1706 |
{ |
|
1707 |
iRollAo->StartL(0); |
|
1708 |
} |
|
1709 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1710 |
// End of File |