author | qifeima <> |
Mon, 21 Jun 2010 13:52:33 +0800 | |
changeset 14 | e7871f3699e6 |
parent 13 | a5c0fe6456b2 |
child 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 |
{ |
14 | 793 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams(" |
794 |
"" |
|
795 |
")"); |
|
12 | 796 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
797 |
|
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 |
// RestoreTempParams |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
800 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
801 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
802 |
void CImageEditorDrawControl::RestoreTempParams() |
12 | 803 |
{ |
14 | 804 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); |
12 | 805 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
806 |
|
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 |
// GetHelpContext |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
809 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
810 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
811 |
void CImageEditorDrawControl::GetHelpContext(TCoeHelpContext& aContext) const |
12 | 812 |
{ |
14 | 813 |
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
|
814 |
|
12 | 815 |
aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); |
14 | 816 |
aContext.iContext = KSIE_HLP_EDIT_DRAW; |
12 | 817 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
818 |
|
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 |
// PrepareL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
821 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
822 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
823 |
void CImageEditorDrawControl::PrepareL() |
12 | 824 |
{ |
14 | 825 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::PrepareL()"); |
12 | 826 |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
827 |
// Get current view port |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
828 |
TRect rect = iSysPars->VisibleImageRectPrev(); |
12 | 829 |
|
830 |
iReadyToRender = ETrue; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
831 |
|
12 | 832 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
833 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
834 |
|
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 |
// LoadIndicatorL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
837 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
838 |
// |
12 | 839 |
void CImageEditorDrawControl::LoadIndicatorL(TInt aBitmapInd, TInt aMaskInd) |
840 |
{ |
|
14 | 841 |
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
|
842 |
|
12 | 843 |
// Delete old indicator |
844 |
delete iIndicator; |
|
845 |
iIndicator = 0; |
|
846 |
delete iIndicatorMask; |
|
847 |
iIndicatorMask = 0; |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
848 |
|
12 | 849 |
// Load new indicator |
850 |
SDrawUtils::GetIndicatorBitmapL(iIndicator, iIndicatorMask, aBitmapInd, |
|
851 |
aMaskInd); |
|
852 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
853 |
|
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 |
// ComputeIndicatorPosition |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
856 |
// --------------------------------------------------------------------------- |
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 |
TPoint CImageEditorDrawControl::ComputeIndicatorPosition() const |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
859 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
860 |
TRect vprect = iSysPars->VisibleImageRect(); |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
861 |
TRect vpprect = iSysPars->VisibleImageRectPrev(); |
12 | 862 |
|
863 |
TInt x(0); |
|
864 |
TInt y(0); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
865 |
// check if there is no indicator |
12 | 866 |
if (!iIndicator) |
867 |
{ |
|
868 |
return TPoint(x, y); |
|
869 |
} |
|
870 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
871 |
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
|
872 |
y += vpprect.iTl.iY; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
873 |
|
12 | 874 |
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
|
875 |
x += vpprect.iTl.iX; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
876 |
|
12 | 877 |
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
|
878 |
} |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
879 |
|
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 |
// IsReadyToRender |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
882 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
883 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
884 |
TBool CImageEditorDrawControl::IsReadyToRender() const |
12 | 885 |
{ |
14 | 886 |
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
|
887 |
return iReadyToRender; |
12 | 888 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
889 |
|
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 |
// StoreParameters |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
892 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
893 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
894 |
void CImageEditorDrawControl::StoreParameters(TBool aLastItem, TBool aDone) |
12 | 895 |
{ |
14 | 896 |
LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreParameters()"); |
12 | 897 |
RDebug::Print(_L("CImageEditorDrawControl::StoreParameters color[%d]"), |
14 | 898 |
iRgb.Internal()); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
899 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
900 |
iParam.Copy(_L("x ")); |
12 | 901 |
iParam.AppendNum(iX); |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
902 |
iParam.Append(_L(" y ")); |
12 | 903 |
iParam.AppendNum(iY); |
904 |
if (aLastItem) |
|
905 |
{ |
|
906 |
iParam.Append(_L(" size ")); |
|
907 |
iParam.AppendNum(iSize.iHeight); |
|
908 |
iParam.Append(_L(" color ")); |
|
909 |
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
|
910 |
iParam.Append(_L(" lastItem ")); |
12 | 911 |
} |
912 |
||
913 |
if (aDone) |
|
914 |
{ |
|
915 |
iParam.Zero(); |
|
916 |
iParam.Append(_L("done")); |
|
917 |
} |
|
918 |
if (iUndo) |
|
919 |
{ |
|
920 |
iParam.Zero(); |
|
921 |
iParam.Append(_L("Undo")); |
|
922 |
} |
|
923 |
if (iRedo) |
|
924 |
{ |
|
925 |
iParam.Zero(); |
|
926 |
iParam.Append(_L("redone")); |
|
927 |
} |
|
928 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
929 |
|
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 |
// TimerCallBack |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
932 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
933 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
934 |
void CImageEditorDrawControl::TimerCallBack() |
12 | 935 |
{ |
14 | 936 |
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
|
937 |
|
12 | 938 |
if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) |
939 |
{ |
|
940 |
iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; |
|
941 |
} |
|
942 |
else |
|
943 |
{ |
|
944 |
iTickCount++; |
|
945 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
946 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
947 |
if (iKeyCode) |
12 | 948 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
949 |
|
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
950 |
switch (iKeyCode) |
12 | 951 |
{ |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
952 |
case 1: |
12 | 953 |
{ |
954 |
NaviUp(); |
|
955 |
break; |
|
956 |
} |
|
957 |
case 2: |
|
958 |
{ |
|
959 |
NaviDown(); |
|
960 |
break; |
|
961 |
} |
|
962 |
case 3: |
|
963 |
{ |
|
964 |
NaviLeft(); |
|
965 |
break; |
|
966 |
} |
|
967 |
case 4: |
|
968 |
{ |
|
969 |
NaviRight(); |
|
970 |
break; |
|
971 |
} |
|
972 |
default: |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
973 |
break; |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
974 |
} |
14 | 975 |
//StoreParameters(); |
976 |
TRAP_IGNORE(iEditorView->HandleCommandL(EImageEditorCmdRender)); |
|
12 | 977 |
iTimer->Call(KWait); |
1
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 |
|
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 |
// StorePosAndScaleRelScreen |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
983 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
984 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
985 |
void CImageEditorDrawControl::StorePosAndScaleRelScreen() |
12 | 986 |
{ |
14 | 987 |
LOG(KDrawPluginLogFile, |
988 |
"CImageEditorClipartControl::StorePosAndScaleRelScreen()"); |
|
12 | 989 |
iParam.Copy(_L("nop")); |
990 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
991 |
|
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 |
// ?description_if_needed |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
994 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
995 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
996 |
void CImageEditorDrawControl::RestorePosAndScaleRelScreen() |
12 | 997 |
{ |
14 | 998 |
LOG(KDrawPluginLogFile, |
999 |
"CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); |
|
12 | 1000 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1001 |
|
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 |
// StorePosAndScaleRelImage |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1004 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1005 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1006 |
void CImageEditorDrawControl::StorePosAndScaleRelImage() |
12 | 1007 |
{ |
1008 |
TReal relscale = iSysPars->RelScale(); |
|
14 | 1009 |
LOGFMT(KDrawPluginLogFile, |
1010 |
"CImageEditorClipartControl::StorePosAndScaleRelImage():%g", |
|
1011 |
relscale); |
|
12 | 1012 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1013 |
|
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 |
// RestorePosAndScaleRelImage |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1016 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1017 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1018 |
void CImageEditorDrawControl::RestorePosAndScaleRelImage() |
12 | 1019 |
{ |
1020 |
TReal relscale = iSysPars->RelScale(); |
|
14 | 1021 |
LOGFMT(KDrawPluginLogFile, |
1022 |
"CImageEditorClipartControl::RestorePosAndScaleRelImage():%g", |
|
1023 |
relscale); |
|
12 | 1024 |
} |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1025 |
|
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 |
// ClipPosition |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1028 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1029 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1030 |
void CImageEditorDrawControl::ClipPosition() |
12 | 1031 |
{ |
1032 |
if (iX < iSysPars->VisibleImageRect().iTl.iX) |
|
1033 |
{ |
|
1034 |
iX = iSysPars->VisibleImageRect().iTl.iX; |
|
1035 |
} |
|
1036 |
else if (iX > iSysPars->VisibleImageRect().iBr.iX) |
|
1037 |
{ |
|
1038 |
iX = iSysPars->VisibleImageRect().iBr.iX; |
|
1039 |
} |
|
1040 |
||
1041 |
if (iY < iSysPars->VisibleImageRect().iTl.iY) |
|
1042 |
{ |
|
1043 |
iY = iSysPars->VisibleImageRect().iTl.iY; |
|
1044 |
} |
|
1045 |
else if (iY > iSysPars->VisibleImageRect().iBr.iY) |
|
1046 |
{ |
|
1047 |
iY = iSysPars->VisibleImageRect().iBr.iY; |
|
1048 |
} |
|
1049 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1050 |
|
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 |
// HandlePointerEventL |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1053 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1054 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1055 |
void CImageEditorDrawControl::HandlePointerEventL( |
12 | 1056 |
const TPointerEvent &aPointerEvent) |
1057 |
{ |
|
1058 |
SetToolBarStatus(); |
|
1059 |
RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), |
|
14 | 1060 |
AknLayoutUtils::PenEnabled()); |
12 | 1061 |
if (iRollflag) |
1062 |
return; |
|
1063 |
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
|
1064 |
{ |
12 | 1065 |
RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), |
14 | 1066 |
aPointerEvent.iType); |
12 | 1067 |
TBool lastItem(EFalse); |
1068 |
TPoint point = aPointerEvent.iPosition; |
|
1069 |
||
1070 |
switch (aPointerEvent.iType) |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1071 |
{ |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1072 |
case TPointerEvent::EButton1Down: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1073 |
{ |
12 | 1074 |
|
1075 |
iButtonDownPoint = point; |
|
1076 |
iLastPointEventType = EFalse; |
|
1077 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
14 | 1078 |
//Handle Drag tool bar event. |
12 | 1079 |
if (iLoopMenuRect.Contains(point) && !iCustomComponetClick |
1080 |
&& iDisplayTool) |
|
1081 |
||
1082 |
{ |
|
1083 |
iPointStartInLoopRect = ETrue; |
|
1084 |
if (iDragIsStart) |
|
1085 |
{ |
|
1086 |
iAnimationAO->Cancel(); |
|
1087 |
iDragIsStart = EFalse; |
|
1088 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1089 |
|
12 | 1090 |
} |
14 | 1091 |
//Doodle event. |
12 | 1092 |
else if ((!iLoopMenuRect.Contains(point) |
1093 |
&& !iCustomComponetClick && iDisplayTool) |
|
1094 |
|| (!iDisplayTool && !iCustomComponetClick)) |
|
1095 |
{ |
|
1096 |
iPointStartInLoopRect = EFalse; |
|
1097 |
//System dispose |
|
14 | 1098 |
iReadyToRender = EFalse; |
12 | 1099 |
CDrawPath* lastPath = CDrawPath::NewL(); |
1100 |
CleanupStack::PushL(lastPath); |
|
1101 |
lastPath->SetColor(iRgb); |
|
1102 |
lastPath->SetSize(iSize); |
|
1103 |
SetPositionOnImage(aPointerEvent.iPosition); |
|
1104 |
lastPath->AddItemL(aPointerEvent.iPosition); |
|
1105 |
iPaths.AppendL(lastPath); |
|
1106 |
CleanupStack::Pop(lastPath); |
|
1107 |
iCanRedo = EFalse; |
|
1108 |
iUndoPaths.ResetAndDestroy(); |
|
1109 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1110 |
} |
12 | 1111 |
break; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1112 |
case TPointerEvent::EButton1Up: |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1113 |
{ |
12 | 1114 |
// System dispose |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1115 |
iReadyToRender = ETrue; |
12 | 1116 |
iCustomComponetClick = EFalse; |
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1117 |
lastItem = ETrue; |
14 | 1118 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
12 | 1119 |
HandleMainMenuButtonUp(point); |
1120 |
DrawNow(); |
|
14 | 1121 |
|
12 | 1122 |
} |
1123 |
break; |
|
1124 |
case TPointerEvent::EDrag: |
|
1125 |
{ |
|
1126 |
CCoeControl::HandlePointerEventL(aPointerEvent); |
|
14 | 1127 |
//Mark last event use for custompoent. |
12 | 1128 |
iLastPointEventType = ETrue; |
1129 |
||
1130 |
if ((iDisplayTool && iPaths.Count() && !iCustomComponetClick |
|
1131 |
&& !iPointStartInLoopRect) || (!iDisplayTool |
|
1132 |
&& iPaths.Count() && !iCustomComponetClick)) |
|
1133 |
{ |
|
1134 |
iCanRedo = EFalse; |
|
1135 |
iUndoPaths.ResetAndDestroy(); |
|
1136 |
CDrawPath* path = iPaths[iPaths.Count() - 1]; |
|
1137 |
// store current position for next round |
|
1138 |
iPointerPosition = aPointerEvent.iPosition; |
|
1139 |
SetPositionOnImage(aPointerEvent.iPosition); |
|
1140 |
path->AddItemL(aPointerEvent.iPosition); |
|
1141 |
} |
|
14 | 1142 |
//Drag customcomponent event |
12 | 1143 |
if (iCustomComponetClick) |
1144 |
{ |
|
1145 |
TPoint con(aPointerEvent.iPosition.iX - 25, |
|
1146 |
aPointerEvent.iPosition.iY - 25); |
|
1147 |
iCustomComponet->SetExtent(con, TSize(50, 50)); |
|
1148 |
DrawNow(); |
|
1149 |
} |
|
14 | 1150 |
//Drag tool bar event |
12 | 1151 |
if (iDisplayTool && iPointStartInLoopRect) |
1152 |
||
1153 |
{ |
|
14 | 1154 |
iFlagDragToolBar = ETrue; |
12 | 1155 |
HandleMainMenuButtonDrag(point); |
1156 |
} |
|
1157 |
} |
|
1158 |
break; |
|
1159 |
default: |
|
1160 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1161 |
break; |
12 | 1162 |
|
1163 |
} |
|
1164 |
||
1165 |
//System dispose |
|
1166 |
if ((!iPointStartInLoopRect && iDisplayTool) || !iDisplayTool) |
|
1167 |
{ |
|
1168 |
if (!(iCustomComponet->Rect().Contains(aPointerEvent.iPosition))) |
|
1169 |
{ |
|
1170 |
StoreParameters(lastItem, EFalse); |
|
1171 |
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
|
1172 |
} |
12 | 1173 |
} |
1174 |
} |
|
1175 |
||
1176 |
} |
|
1177 |
||
1178 |
// --------------------------------------------------------------------------- |
|
14 | 1179 |
// CImageEditorDrawControl::HandleMainMenuButtonUp() |
1180 |
// |
|
12 | 1181 |
// --------------------------------------------------------------------------- |
1182 |
// |
|
1183 |
void CImageEditorDrawControl::HandleMainMenuButtonUp(TPoint aPoint) |
|
1184 |
{ |
|
14 | 1185 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 1186 |
{ |
1187 |
if (iDragIsStart) |
|
1188 |
{ |
|
1189 |
//Drag event is end (Except activating animation effect). |
|
1190 |
iDragIsStart = EFalse; |
|
1191 |
||
1192 |
if (Abs(iDragPrePoint.iX - aPoint.iX) > 1) |
|
1193 |
{ |
|
1194 |
//Animation effect is activated |
|
1195 |
iDragIsStart = ETrue; |
|
1196 |
iStartSpeed = aPoint.iX - iDragPrePoint.iX; |
|
1197 |
iAnimationAO->StartL(0); |
|
1198 |
} |
|
1199 |
} |
|
1200 |
} |
|
14 | 1201 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 1202 |
{ |
1203 |
if (iDragIsStart) |
|
1204 |
{ |
|
1205 |
//Drag event is end (Except activating animation effect). |
|
1206 |
iDragIsStart = EFalse; |
|
1207 |
||
1208 |
if (Abs(iDragPrePoint.iY - aPoint.iY) > 1) |
|
1209 |
{ |
|
1210 |
//Animation effect is activated |
|
1211 |
iDragIsStart = ETrue; |
|
1212 |
iStartSpeed = aPoint.iY - iDragPrePoint.iY; |
|
1213 |
iAnimationAO->StartL(0); |
|
1214 |
} |
|
1215 |
} |
|
1216 |
} |
|
1217 |
} |
|
1218 |
||
1219 |
// --------------------------------------------------------------------------- |
|
1220 |
// HandleMainMenuButtonDrag |
|
1221 |
// --------------------------------------------------------------------------- |
|
1222 |
// |
|
1223 |
void CImageEditorDrawControl::HandleMainMenuButtonDrag(TPoint aPoint) |
|
1224 |
{ |
|
14 | 1225 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 1226 |
{ |
1227 |
if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iX |
|
1228 |
- iButtonDownPoint.iX) >= DRAG_LENGTH) |
|
1229 |
{ |
|
1230 |
iDragIsStart = ETrue; |
|
1231 |
iDragStartPoint = aPoint; |
|
14 | 1232 |
|
12 | 1233 |
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
|
1234 |
{ |
12 | 1235 |
if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
1236 |
{ |
|
1237 |
iLabels[i]->LabelIsMoving(); |
|
1238 |
} |
|
1239 |
} |
|
1240 |
} |
|
1241 |
||
1242 |
if (iDragIsStart) |
|
1243 |
{ |
|
1244 |
iDragPrePoint = iDragUpPoint; |
|
1245 |
iDragUpPoint = aPoint; |
|
1246 |
iDragOffset = aPoint.iX - iDragStartPoint.iX; |
|
1247 |
iDragStartPoint = aPoint; |
|
14 | 1248 |
|
12 | 1249 |
CalculateEffectiveOffset(); |
1250 |
SizeChanged(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1251 |
} |
12 | 1252 |
} |
14 | 1253 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 1254 |
{ |
1255 |
if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iY |
|
1256 |
- iButtonDownPoint.iY) >= DRAG_LENGTH) |
|
1257 |
{ |
|
1258 |
iDragIsStart = ETrue; |
|
1259 |
iDragStartPoint = aPoint; |
|
14 | 1260 |
|
12 | 1261 |
for (TInt i = 0; i < iTotalComponent; i++) |
1262 |
{ |
|
1263 |
if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
|
1264 |
{ |
|
1265 |
iLabels[i]->LabelIsMoving(); |
|
1266 |
} |
|
1267 |
} |
|
1268 |
} |
|
1269 |
||
1270 |
if (iDragIsStart) |
|
1271 |
{ |
|
1272 |
iDragPrePoint = iDragUpPoint; |
|
1273 |
iDragUpPoint = aPoint; |
|
1274 |
iDragOffset = aPoint.iY - iDragStartPoint.iY; |
|
1275 |
iDragStartPoint = aPoint; |
|
14 | 1276 |
|
12 | 1277 |
CalculateEffectiveOffset(); |
1278 |
SizeChanged(); |
|
1279 |
} |
|
1280 |
} |
|
1281 |
} |
|
1282 |
||
1283 |
// --------------------------------------------------------------------------- |
|
1284 |
// UndoDrawPath |
|
1285 |
// --------------------------------------------------------------------------- |
|
1286 |
// |
|
1287 |
void CImageEditorDrawControl::UndoDrawPath() |
|
1288 |
{ |
|
1289 |
if (iPaths.Count()) |
|
1290 |
{ |
|
1291 |
iUndoPaths.Append(iPaths[iPaths.Count() - 1]); |
|
1292 |
iPaths.Remove(iPaths.Count() - 1); |
|
1293 |
iCanRedo = ETrue; |
|
1294 |
} |
|
1295 |
} |
|
1296 |
||
1297 |
// --------------------------------------------------------------------------- |
|
1298 |
// RedoDrawPath |
|
1299 |
// --------------------------------------------------------------------------- |
|
1300 |
// |
|
1301 |
void CImageEditorDrawControl::RedoDrawPath() |
|
1302 |
{ |
|
1303 |
if (iUndoPaths.Count()) |
|
1304 |
{ |
|
1305 |
iPaths.Append(iUndoPaths[iUndoPaths.Count() - 1]); |
|
1306 |
iUndoPaths.Remove(iUndoPaths.Count() - 1); |
|
1307 |
} |
|
1308 |
} |
|
1309 |
||
1310 |
// --------------------------------------------------------------------------- |
|
1311 |
// HandlePointerNotify |
|
1312 |
// --------------------------------------------------------------------------- |
|
1313 |
// |
|
1314 |
void CImageEditorDrawControl::HandlePointerNotify(CCoeControl* aComponent) |
|
1315 |
{ |
|
1316 |
//pen size |
|
1317 |
if (iLabels[0] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1318 |
{ |
|
1319 |
MakeVisibleLable(EFalse); |
|
1320 |
SelectSizeL(); |
|
1321 |
MakeVisibleLable(ETrue); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1322 |
} |
12 | 1323 |
//pen color |
1324 |
else if (iLabels[1] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1325 |
{ |
|
1326 |
MakeVisibleLable(EFalse); |
|
1327 |
SDrawUtils::LaunchColorSelectionPopupL(iPreview, Rect(), iRgb); |
|
1328 |
MakeVisibleLable(ETrue); |
|
1329 |
} |
|
1330 |
//undo |
|
1331 |
else if (iLabels[2] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1332 |
{ |
|
1333 |
UndoDrawPath(); |
|
1334 |
iUndo = ETrue; |
|
1335 |
StoreParameters(EFalse, EFalse); |
|
1336 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
1337 |
iUndo = EFalse; |
|
1338 |
} |
|
14 | 1339 |
//save and quit |
12 | 1340 |
else if (iLabels[3] == dynamic_cast<CImageLabel*> (aComponent)) |
1341 |
{ |
|
1342 |
iRedo = ETrue; |
|
1343 |
RedoDrawPath(); |
|
1344 |
StoreParameters(EFalse, EFalse); |
|
1345 |
iEditorView->HandleCommandL(EImageEditorCmdRender); |
|
1346 |
iRedo = EFalse; |
|
1347 |
} |
|
13 | 1348 |
else if (iLabels[4] == dynamic_cast<CImageLabel*> (aComponent)) |
1349 |
{ |
|
1350 |
iPopupController->HideInfoPopupNote(); |
|
1351 |
StoreParameters(EFalse, ETrue); |
|
1352 |
iEditorView->HandleCommandL(EImageEditorApplyPlugin); |
|
1353 |
} |
|
1354 |
else if (iLabels[5] == dynamic_cast<CImageLabel*> (aComponent)) |
|
1355 |
{ |
|
14 | 1356 |
iEditorView->HandleCommandL(EImageEditorMenuCmdHelp); |
13 | 1357 |
} |
12 | 1358 |
else if (iLabels[6] == dynamic_cast<CImageLabel*> (aComponent)) |
1359 |
{ |
|
1360 |
||
1361 |
} |
|
1362 |
else if (iCustomComponet == dynamic_cast<CCustomerComponet*> (aComponent)) |
|
1363 |
{ |
|
1364 |
if (iCustomComponet->GetButtonType()) |
|
1365 |
{ |
|
1366 |
iCustomComponetClick = ETrue; |
|
1367 |
} |
|
14 | 1368 |
|
12 | 1369 |
if ((!iCustomComponet->GetButtonType()) && (!iLastPointEventType)) |
1370 |
{ |
|
1371 |
StartTheAnimation(); |
|
1372 |
||
1373 |
} |
|
1374 |
} |
|
1375 |
||
1376 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1377 |
|
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 |
// SetPositionOnImage |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1380 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1381 |
// |
12 | 1382 |
void CImageEditorDrawControl::SetPositionOnImage(TPoint aPointedPosition) |
1383 |
{ |
|
1384 |
ASSERT(iSysPars); |
|
1385 |
// Get system parameters |
|
1386 |
TRect visibleImageRect(iSysPars->VisibleImageRect()); |
|
1387 |
TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); |
|
1388 |
||
1389 |
TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
|
1390 |
TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
|
1391 |
||
14 | 1392 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::vir w:%d h:%d", |
1393 |
visibleImageRect.Width(), visibleImageRect.Height()); |
|
1394 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::virp w:%d h:%d", |
|
1395 |
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
|
1396 |
|
12 | 1397 |
// Dividing by zero will cause panic -> check |
1398 |
if (xPosFactorDivider == 0 || yPosFactorDivider == 0) |
|
1399 |
{ |
|
1400 |
// Set default position |
|
1401 |
iX = (visibleImageRect.iTl.iX + visibleImageRect.iBr.iX) / 2; |
|
1402 |
iY = (visibleImageRect.iTl.iY + visibleImageRect.iBr.iY) / 2; |
|
1403 |
} |
|
1404 |
else |
|
1405 |
{ |
|
1406 |
// Calculate relative position on the screen |
|
1407 |
TReal xPositionFactor(TReal(aPointedPosition.iX |
|
1408 |
- visibleImageRectPrev.iTl.iX) / xPosFactorDivider); |
|
1409 |
// |
|
1410 |
// TReal yPositionFactor(TReal(aPointedPosition.iY - iStatuspaneHeight |
|
1411 |
// - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
|
1412 |
TReal yPositionFactor(TReal(aPointedPosition.iY |
|
1413 |
- visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
|
14 | 1414 |
LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::pfx:%g pfy:%g", |
1415 |
xPositionFactor, yPositionFactor); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1416 |
// 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
|
1417 |
|
12 | 1418 |
iX = visibleImageRect.iTl.iX + visibleImageRect.Width() |
1419 |
* xPositionFactor + 0.5; |
|
1420 |
||
1421 |
iY = visibleImageRect.iTl.iY + visibleImageRect.Height() |
|
1422 |
* yPositionFactor + 0.5; |
|
1423 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1424 |
|
14 | 1425 |
LOGFMT4(KDrawPluginLogFile, |
1426 |
"CImageEditorDrawControl::Draw x:%d iX:%d y:%d iY:%d", |
|
1427 |
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
|
1428 |
// Check that not out of bounds |
12 | 1429 |
//ClipPosition(); |
1430 |
} |
|
1431 |
||
1
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 |
// GetPositionOnView |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1434 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1435 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1436 |
TPoint CImageEditorDrawControl::GetPositionOnView() |
12 | 1437 |
{ |
1438 |
ASSERT(iSysPars); |
|
1439 |
// Get system parameters |
|
1440 |
TRect visibleImageRect(iSysPars->VisibleImageRect()); |
|
1441 |
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
|
1442 |
|
12 | 1443 |
TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
1444 |
TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
|
1445 |
||
1446 |
// Calculate relative position on the screen |
|
1447 |
TReal xPositionFactor(TReal(iX + visibleImageRectPrev.iTl.iX) |
|
1448 |
/ xPosFactorDivider); |
|
1449 |
||
1450 |
TReal yPositionFactor(TReal(iY + visibleImageRectPrev.iTl.iY) |
|
1451 |
/ yPosFactorDivider); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1452 |
|
14 | 1453 |
LOGFMT2(KDrawPluginLogFile, |
1454 |
"CImageEditorDrawControl::GetPositionOnView xf:%g yf:%g", |
|
1455 |
xPositionFactor, yPositionFactor); |
|
12 | 1456 |
|
14 | 1457 |
LOGFMT2(KDrawPluginLogFile, |
1458 |
"CImageEditorDrawControl::GetPositionOnView xf:%d yf:%d", |
|
1459 |
xPosFactorDivider, yPosFactorDivider); |
|
12 | 1460 |
|
14 | 1461 |
LOGFMT2(KDrawPluginLogFile, |
1462 |
"CImageEditorDrawControl::GetPositionOnView w:%d h:%d", iX, iY); |
|
12 | 1463 |
|
1464 |
TInt xPosition(iX + visibleImageRectPrev.iTl.iX); |
|
1465 |
TInt yPosition(iY + visibleImageRectPrev.iTl.iY); |
|
1466 |
||
14 | 1467 |
LOGFMT3(KDrawPluginLogFile, |
1468 |
"CImageEditorDrawControl::GetPositionOnView w:%d h:%d S:%g", |
|
1469 |
xPosition, yPosition, iSysPars->RelScale()); |
|
12 | 1470 |
|
1471 |
return TPoint(xPosition, yPosition); |
|
1472 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1473 |
|
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 |
// ShowTooltip |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1476 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1477 |
// |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1478 |
void CImageEditorDrawControl::ShowTooltip() |
12 | 1479 |
{ |
1480 |
iPopupController->HideInfoPopupNote(); |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1481 |
|
12 | 1482 |
TPoint iconPosition = ComputeIndicatorPosition(); |
1483 |
TRect iconRect(iconPosition.iX, iconPosition.iY, iconPosition.iX, |
|
1484 |
iconPosition.iY); |
|
1485 |
} |
|
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1486 |
|
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 |
// ScaledLineSize |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1489 |
// --------------------------------------------------------------------------- |
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1490 |
// |
12 | 1491 |
TSize CImageEditorDrawControl::ScaledLineSize(TSize aOriginalSize) const |
1492 |
{ |
|
1493 |
TInt sizew(aOriginalSize.iWidth * iSysPars->RelScale() + 0.5); |
|
1494 |
TInt sizeh(aOriginalSize.iHeight * iSysPars->RelScale() + 0.5); |
|
1495 |
if (sizew < 1) |
|
1496 |
{ |
|
1497 |
sizew++; |
|
1498 |
} |
|
1499 |
if (sizeh < 1) |
|
1500 |
{ |
|
1501 |
sizeh++; |
|
1502 |
} |
|
1503 |
||
14 | 1504 |
LOGFMT3(KDrawPluginLogFile, |
1505 |
"CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", sizew, |
|
1506 |
sizeh, iSysPars->RelScale()); |
|
12 | 1507 |
return TSize(sizew, sizeh); |
1508 |
} |
|
1509 |
||
1510 |
// --------------------------------------------------------------------------- |
|
1511 |
// CountComponentControls |
|
1512 |
// --------------------------------------------------------------------------- |
|
1513 |
// |
|
1514 |
TInt CImageEditorDrawControl::CountComponentControls() const |
|
1515 |
{ |
|
1516 |
return iTotalComponent + 1; |
|
1517 |
} |
|
1518 |
||
1519 |
// --------------------------------------------------------------------------- |
|
1520 |
// ComponentControl |
|
1521 |
// --------------------------------------------------------------------------- |
|
1522 |
// |
|
1523 |
CCoeControl* CImageEditorDrawControl::ComponentControl(TInt aIndex) const |
|
1524 |
{ |
|
1525 |
switch (aIndex) |
|
1526 |
{ |
|
1527 |
case 7: |
|
1528 |
return iCustomComponet; |
|
1529 |
case 0: |
|
1530 |
return iLabels[0]; |
|
1531 |
case 1: |
|
1532 |
return iLabels[1]; |
|
1533 |
case 2: |
|
1534 |
return iLabels[2]; |
|
1535 |
case 3: |
|
1536 |
return iLabels[3]; |
|
1537 |
case 4: |
|
1538 |
return iLabels[4]; |
|
1539 |
case 5: |
|
1540 |
return iLabels[5]; |
|
1541 |
case 6: |
|
1542 |
return iLabels[6]; |
|
1543 |
default: |
|
1544 |
return NULL; |
|
1545 |
} |
|
1546 |
return NULL; |
|
1547 |
} |
|
1548 |
||
1549 |
// --------------------------------------------------------------------------- |
|
1550 |
// Notify |
|
1551 |
// --------------------------------------------------------------------------- |
|
1552 |
// |
|
1553 |
void CImageEditorDrawControl::Notify() |
|
1554 |
{ |
|
1555 |
if (iStartSpeed > 0) |
|
1556 |
{ |
|
1557 |
iStartSpeed -= 2; |
|
1558 |
if (iStartSpeed <= 0) |
|
1559 |
{ |
|
1560 |
iStartSpeed = 0; |
|
1561 |
iDragIsStart = EFalse; |
|
1562 |
iAnimationAO->Cancel(); |
|
1563 |
} |
|
1564 |
} |
|
1565 |
else if (iStartSpeed < 0) |
|
1566 |
{ |
|
1567 |
iStartSpeed += 2; |
|
1568 |
if (iStartSpeed >= 0) |
|
1569 |
{ |
|
1570 |
iStartSpeed = 0; |
|
1571 |
iDragIsStart = EFalse; |
|
1572 |
iAnimationAO->Cancel(); |
|
1573 |
} |
|
1574 |
} |
|
1575 |
else |
|
1576 |
{ |
|
1577 |
iDragIsStart = EFalse; |
|
1578 |
iAnimationAO->Cancel(); |
|
1579 |
} |
|
1580 |
||
1581 |
iDragOffset += iStartSpeed; |
|
1582 |
CalculateEffectiveOffset(); |
|
1583 |
SizeChanged(); |
|
1584 |
} |
|
1585 |
||
1586 |
// --------------------------------------------------------------------------- |
|
1587 |
// Roll |
|
1588 |
// --------------------------------------------------------------------------- |
|
1589 |
// |
|
1590 |
void CImageEditorDrawControl::Roll() |
|
1591 |
{ |
|
1592 |
SetToolBarStatus(); |
|
14 | 1593 |
|
12 | 1594 |
TInt offset = 0; |
1595 |
iRollflag = ETrue; |
|
1596 |
if (iDisplayTool) |
|
1597 |
iRollDirection = EFalse; |
|
1598 |
else |
|
1599 |
iRollDirection = ETrue; |
|
1600 |
||
1601 |
if (iRollDirection) |
|
1602 |
{ |
|
1603 |
offset = 4; |
|
1604 |
} |
|
1605 |
else |
|
1606 |
{ |
|
1607 |
offset = -4; |
|
1608 |
} |
|
14 | 1609 |
|
1610 |
if (iMainMenuLayout == EMainMenuVertical) |
|
12 | 1611 |
{ |
1612 |
for (TInt i = 0; i < iLabels.Count(); i++) |
|
1613 |
{ |
|
1614 |
TInt x = iLabels[i]->Rect().iTl.iX; |
|
1615 |
iLabels[i]->SetPosition(TPoint(x + offset, iLoopMenuRect.iTl.iY)); |
|
1616 |
iLabels[i]->ResetControl(); |
|
1617 |
} |
|
1618 |
if (iLabels[0]->Rect().iTl.iX == 0 |
|
1619 |
|| iLabels[iLabels.Count() - 1]->Rect().iBr.iX == 0) |
|
1620 |
iRollflag = EFalse; |
|
1621 |
} |
|
14 | 1622 |
else if (iMainMenuLayout == EMainMenuHorizontal) |
12 | 1623 |
{ |
1624 |
for (TInt i = 0; i < iLabels.Count(); i++) |
|
1625 |
{ |
|
1626 |
TInt y = iLabels[i]->Rect().iTl.iY; |
|
1627 |
iLabels[i]->SetPosition(TPoint(iLoopMenuRect.iTl.iX, y + offset)); |
|
1628 |
iLabels[i]->ResetControl(); |
|
1629 |
} |
|
1630 |
if (iLabels[0]->Rect().iTl.iY == 0 |
|
1631 |
|| iLabels[iLabels.Count() - 1]->Rect().iBr.iY == 0) |
|
1632 |
iRollflag = EFalse; |
|
1633 |
} |
|
14 | 1634 |
|
12 | 1635 |
DrawNow(); |
14 | 1636 |
|
12 | 1637 |
if (!iRollflag) |
1638 |
{ |
|
1639 |
iRollAo->Cancel(); |
|
1640 |
} |
|
1641 |
} |
|
1642 |
||
1643 |
// --------------------------------------------------------------------------- |
|
1644 |
// CalculateEffectiveOffset |
|
1645 |
// --------------------------------------------------------------------------- |
|
1646 |
// |
|
1647 |
void CImageEditorDrawControl::CalculateEffectiveOffset() |
|
1648 |
{ |
|
14 | 1649 |
if (iMainMenuLayout == EMainMenuVertical) |
12 | 1650 |
{ |
1651 |
TInt leftX = iLabels[0]->Rect().iTl.iX; |
|
1652 |
TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
|
1653 |
TInt offset = iDragOffset; |
|
1654 |
if (leftX + offset > 0) |
|
1655 |
{ |
|
1656 |
iDragOffset = Abs(leftX); |
|
1657 |
} |
|
1658 |
||
1659 |
if (rightX + offset < 360) |
|
1660 |
{ |
|
1661 |
iDragOffset = -(rightX - 360); |
|
1662 |
} |
|
1663 |
} |
|
14 | 1664 |
else if (iMainMenuLayout ==EMainMenuHorizontal ) |
12 | 1665 |
{ |
1666 |
TInt topY = iLabels[0]->Rect().iTl.iY; |
|
1667 |
TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; |
|
1668 |
TInt offset = iDragOffset; |
|
1669 |
if (topY + offset > 0) |
|
1670 |
{ |
|
1671 |
iDragOffset = Abs(topY); |
|
1672 |
} |
|
1673 |
||
1674 |
if (bottomY + offset < 360) |
|
1675 |
{ |
|
1676 |
iDragOffset = -(bottomY - 360); |
|
1677 |
} |
|
1678 |
} |
|
1679 |
} |
|
1680 |
||
1681 |
// --------------------------------------------------------------------------- |
|
1682 |
// MakeVisibleLable |
|
1683 |
// --------------------------------------------------------------------------- |
|
1684 |
// |
|
1685 |
void CImageEditorDrawControl::MakeVisibleLable(TBool aFlag) |
|
1686 |
{ |
|
1687 |
if (aFlag) |
|
1688 |
{ |
|
1689 |
for (int i = 0; i < iTotalComponent; i++) |
|
1690 |
{ |
|
1691 |
iLabels[i]->MakeVisible(ETrue); |
|
1692 |
} |
|
1693 |
} |
|
1694 |
else |
|
1695 |
{ |
|
1696 |
for (int i = 0; i < iTotalComponent; i++) |
|
1697 |
{ |
|
1698 |
iLabels[i]->MakeVisible(EFalse); |
|
1699 |
} |
|
1700 |
} |
|
1701 |
} |
|
1702 |
||
1703 |
// --------------------------------------------------------------------------- |
|
1704 |
// StartTheAnimation |
|
1705 |
// --------------------------------------------------------------------------- |
|
1706 |
// |
|
1707 |
void CImageEditorDrawControl::StartTheAnimation() |
|
1708 |
{ |
|
1709 |
iRollAo->StartL(0); |
|
1710 |
} |
|
1711 |
||
1
edfc90759b9f
Committing the Image Editor package under the Eclipse Public License
Mikael Laine <mikael.laine@ixonos.com>
parents:
diff
changeset
|
1712 |
// End of File |