52 _LIT(KDrawPluginLogFile,"drawplugin.log"); |
52 _LIT(KDrawPluginLogFile,"drawplugin.log"); |
53 |
53 |
54 // CONSTANTS |
54 // CONSTANTS |
55 const TInt KWait = 1; |
55 const TInt KWait = 1; |
56 const TInt KMainTextIndex = 0; |
56 const TInt KMainTextIndex = 0; |
57 //#define HORIZ TPoint(0,72),TPoint(502,360) |
57 |
58 //#define VERTICAL TPoint(0,92),TPoint(360,579) |
|
59 // --------------------------------------------------------------------------- |
58 // --------------------------------------------------------------------------- |
60 // NewL |
59 // NewL |
61 // --------------------------------------------------------------------------- |
60 // --------------------------------------------------------------------------- |
62 // |
61 |
63 CImageEditorDrawControl* CImageEditorDrawControl::NewL(const TRect& aRect, |
62 CImageEditorDrawControl* CImageEditorDrawControl::NewL(const TRect& aRect, |
64 CCoeControl* aParent, RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, |
63 CCoeControl* aParent, RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, |
65 TSize& aSize, TBool &aDisplayTool) |
64 TSize& aSize, TBool &aDisplayTool) |
66 { |
65 { |
67 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NewL()"); |
66 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NewL()"); |
68 |
67 |
69 CImageEditorDrawControl * self = new (ELeave) CImageEditorDrawControl( |
68 CImageEditorDrawControl * self = new (ELeave) CImageEditorDrawControl( |
70 aPaths, aRgb, aSize, aDisplayTool); |
69 aPaths, aRgb, aSize, aDisplayTool); |
71 CleanupStack::PushL(self); |
70 CleanupStack::PushL(self); |
72 self->ConstructL(aRect, aParent); |
71 self->ConstructL(aRect, aParent); |
75 } |
74 } |
76 |
75 |
77 // --------------------------------------------------------------------------- |
76 // --------------------------------------------------------------------------- |
78 // CImageEditorDrawControl |
77 // CImageEditorDrawControl |
79 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
80 // |
|
81 CImageEditorDrawControl::CImageEditorDrawControl( |
79 CImageEditorDrawControl::CImageEditorDrawControl( |
82 RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, TSize& aSize, |
80 RPointerArray<CDrawPath>& aPaths, TRgb& aRgb, TSize& aSize, |
83 TBool& aDisplayTool) : |
81 TBool& aDisplayTool) : |
84 iTickCount(0), iX(0), iY(0), iNaviStepMultiplier( |
82 iTickCount(0), iX(0), iY(0), iNaviStepMultiplier( |
85 KDefaultSmallNavigationStepMultiplier), iDisplayingOkOptionsMenu( |
83 KDefaultSmallNavigationStepMultiplier), iDisplayingOkOptionsMenu( |
90 } |
88 } |
91 |
89 |
92 // --------------------------------------------------------------------------- |
90 // --------------------------------------------------------------------------- |
93 // ~CImageEditorDrawControl() |
91 // ~CImageEditorDrawControl() |
94 // --------------------------------------------------------------------------- |
92 // --------------------------------------------------------------------------- |
95 // |
93 |
96 CImageEditorDrawControl::~CImageEditorDrawControl() |
94 CImageEditorDrawControl::~CImageEditorDrawControl() |
97 { |
95 { |
98 LOG(KDrawPluginLogFile, |
96 LOG(KDrawPluginLogFile, |
99 "CImageEditorDrawControl::~CImageEditorDrawControl()"); |
97 "CImageEditorDrawControl::~CImageEditorDrawControl()"); |
100 delete iCustomComponet; |
98 delete iCustomComponet; |
101 delete iTimer; |
99 delete iTimer; |
102 delete iIndicator; |
100 delete iIndicator; |
103 delete iIndicatorMask; |
101 delete iIndicatorMask; |
104 delete iPopupController; |
102 delete iPopupController; |
121 temp = NULL; |
119 temp = NULL; |
122 } |
120 } |
123 } |
121 } |
124 iLabels.ResetAndDestroy(); |
122 iLabels.ResetAndDestroy(); |
125 |
123 |
126 |
|
127 } |
124 } |
128 |
125 |
129 // --------------------------------------------------------------------------- |
126 // --------------------------------------------------------------------------- |
130 // ConstructL |
127 // ConstructL |
131 // --------------------------------------------------------------------------- |
128 // --------------------------------------------------------------------------- |
132 // |
|
133 void CImageEditorDrawControl::ConstructL(const TRect& aRect, |
129 void CImageEditorDrawControl::ConstructL(const TRect& aRect, |
134 CCoeControl* aParent) |
130 CCoeControl* aParent) |
135 { |
131 { |
136 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::ConstructL()"); |
132 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::ConstructL()"); |
137 |
133 |
138 CreateWindowL(); |
134 CreateWindowL(); |
139 EnableDragEvents(); |
135 EnableDragEvents(); |
140 //iRollDirection = EFalse; |
136 |
141 iStatuspaneHeight = aRect.iTl.iY; |
137 iStatuspaneHeight = aRect.iTl.iY; |
142 iUndo = EFalse; |
138 iUndo = EFalse; |
143 iRedo = EFalse; |
139 iRedo = EFalse; |
144 iCanRedo = EFalse; |
140 iCanRedo = EFalse; |
145 //iRollDirection = ETrue; |
|
146 // Create resource utility |
141 // Create resource utility |
147 TFileName resFile; |
142 TFileName resFile; |
148 // resource file name |
143 // resource file name |
149 _LIT(KResourceFile, "draw.rsc"); |
144 _LIT(KResourceFile, "draw.rsc"); |
150 resFile.Append(KPgnResourcePath); |
145 resFile.Append(KPgnResourcePath); |
160 |
155 |
161 iPopupController = CAknInfoPopupNoteController::NewL(); |
156 iPopupController = CAknInfoPopupNoteController::NewL(); |
162 iTooltipResize = ControlEnv()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); |
157 iTooltipResize = ControlEnv()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); |
163 |
158 |
164 SetExtentToWholeScreen(); |
159 SetExtentToWholeScreen(); |
165 // TRect a(HORIZ); |
160 |
166 // iClientRectH = a; |
|
167 // TRect b(VERTICAL); |
|
168 // iClientRectV = b; |
|
169 iCustomComponetClick = EFalse; |
161 iCustomComponetClick = EFalse; |
170 TRect rect = Rect(); |
162 TRect rect = Rect(); |
171 //iDisplayTool=ETrue; |
163 //judge the current screen status. |
172 if (rect.Width() < rect.Height()) |
164 if (rect.Width() < rect.Height()) |
173 { |
165 { |
|
166 InitializeMainMenu(EMainMenuVertical); |
|
167 } |
|
168 else if (rect.Width() > rect.Height()) |
|
169 { |
174 InitializeMainMenu(EMainMenuHorizontal); |
170 InitializeMainMenu(EMainMenuHorizontal); |
175 } |
|
176 else if (rect.Width() > rect.Height()) |
|
177 { |
|
178 InitializeMainMenu(EMainMenuVertical); |
|
179 } |
171 } |
180 |
172 |
181 TRect Trect(TPoint(0, 0), TPoint(50, 50)); |
173 TRect Trect(TPoint(0, 0), TPoint(50, 50)); |
182 iCustomComponet = CCustomerComponet::NewL(Trect, this); |
174 iCustomComponet = CCustomerComponet::NewL(Trect, this); |
183 iCustomComponet->SetExtent(TPoint(40, 100), TSize(50, 50)); |
175 iCustomComponet->SetExtent(TPoint(40, 100), TSize(50, 50)); |
185 iLastPointEventType = EFalse; |
177 iLastPointEventType = EFalse; |
186 // Activate control |
178 // Activate control |
187 ActivateL(); |
179 ActivateL(); |
188 |
180 |
189 } |
181 } |
190 |
182 // --------------------------------------------------------------------------- |
|
183 // CImageEditorDrawControl::InitializeMainMenu£¨£© |
|
184 // initialize tool bar component. |
|
185 // --------------------------------------------------------------------------- |
191 void CImageEditorDrawControl::InitializeMainMenu( |
186 void CImageEditorDrawControl::InitializeMainMenu( |
192 TMainMenuLayout aMainMenuLayout) |
187 TMainMenuLayout aMainMenuLayout) |
193 { |
188 { |
194 iMainMenuLayout = aMainMenuLayout; |
189 iMainMenuLayout = aMainMenuLayout; |
195 _LIT(KSvgPath, "\\resource\\apps\\icons_doodle.mif"); |
190 _LIT(KSvgPath, "\\resource\\apps\\icons_doodle.mif"); |
196 TFileName svgFile(KSvgPath); |
191 TFileName svgFile(KSvgPath); |
197 User::LeaveIfError(CompleteWithAppPath(svgFile)); |
192 User::LeaveIfError(CompleteWithAppPath(svgFile)); |
198 iTotalComponent = 7; |
193 iTotalComponent = 7; |
199 TRect clipRect; |
194 TRect clipRect; |
200 if (iMainMenuLayout == EMainMenuHorizontal) |
195 if (iMainMenuLayout == EMainMenuVertical) |
201 { |
196 { |
202 iLoopMenuRect = TRect(TPoint(0, Rect().iBr.iY - 87), TSize(360, 87)); |
197 iLoopMenuRect = TRect(TPoint(0, Rect().iBr.iY - 87), TSize(360, 87)); |
203 |
198 |
204 for (int i = 0; i < iTotalComponent; i++) |
199 for (int i = 0; i < iTotalComponent; i++) |
205 { |
200 { |
217 iLoopMenuRect.iTl.iY), TSize(72, 87)); |
212 iLoopMenuRect.iTl.iY), TSize(72, 87)); |
218 clipRect = Rect2; |
213 clipRect = Rect2; |
219 } |
214 } |
220 |
215 |
221 CImageLabel* label = CImageLabel::NewL(this, clipRect, |
216 CImageLabel* label = CImageLabel::NewL(this, clipRect, |
222 CImageLabel::ELabelHorizontal); |
217 CImageLabel::ELabelVertical); |
223 label->SetHandlePointerObserver(this); |
218 label->SetHandlePointerObserver(this); |
224 iLabels.Append(label); |
219 iLabels.Append(label); |
225 } |
220 } |
226 } |
221 } |
227 else if (iMainMenuLayout == EMainMenuVertical) |
222 else if (iMainMenuLayout ==EMainMenuHorizontal ) |
228 { |
223 { |
229 iLoopMenuRect = TRect(TPoint(Rect().iBr.iX - 87, 0), TSize(87, 360)); |
224 iLoopMenuRect = TRect(TPoint(Rect().iBr.iX - 87, 0), TSize(87, 360)); |
230 |
225 |
231 for (int i = 0; i < iTotalComponent; i++) |
226 for (int i = 0; i < iTotalComponent; i++) |
232 { |
227 { |
243 - iLoopMenuRect.Height() - 72 * 2), TSize(87, 72)); |
238 - iLoopMenuRect.Height() - 72 * 2), TSize(87, 72)); |
244 clipRect = Rect2; |
239 clipRect = Rect2; |
245 } |
240 } |
246 |
241 |
247 CImageLabel* label = CImageLabel::NewL(this, clipRect, |
242 CImageLabel* label = CImageLabel::NewL(this, clipRect, |
248 CImageLabel::ELabelVertical); |
243 CImageLabel::ELabelHorizontal); |
249 label->SetHandlePointerObserver(this); |
244 label->SetHandlePointerObserver(this); |
250 iLabels.Append(label); |
245 iLabels.Append(label); |
251 } |
246 } |
252 } |
247 } |
253 |
248 |
254 iLabels[0]->SetImage(svgFile, EMbmIcons_doodlePensize); |
249 iLabels[0]->SetImage(svgFile, EMbmIcons_doodlePen); |
255 iLabels[0]->SetTooltip(_L("Pensize")); |
250 iLabels[0]->SetTooltip(_L("Pensize")); |
256 |
251 |
257 iLabels[1]->SetImage(svgFile, EMbmIcons_doodlePalette); |
252 iLabels[1]->SetImage(svgFile, EMbmIcons_doodlePalette_colored); |
258 iLabels[1]->SetTooltip(_L("Palette")); |
253 iLabels[1]->SetTooltip(_L("Palette")); |
259 |
254 |
260 iLabels[2]->SetImage(svgFile, EMbmIcons_doodleUndo); |
255 iLabels[2]->SetImage(svgFile, EMbmIcons_doodleUndo); |
261 iLabels[2]->SetTooltip(_L("Undo")); |
256 iLabels[2]->SetTooltip(_L("Undo")); |
262 |
257 |
263 iLabels[3]->SetImage(svgFile, EMbmIcons_doodlePalette); |
258 iLabels[3]->SetImage(svgFile, EMbmIcons_doodleRedo); |
264 iLabels[3]->SetTooltip(_L("Redo")); |
259 iLabels[3]->SetTooltip(_L("Redo")); |
265 |
260 |
266 iLabels[4]->SetImage(svgFile, EMbmIcons_doodleSave); |
261 iLabels[4]->SetImage(svgFile, EMbmIcons_doodleSave1); |
267 iLabels[4]->SetTooltip(_L("Save")); |
262 iLabels[4]->SetTooltip(_L("Save")); |
268 |
263 |
269 iLabels[5]->SetImage(svgFile, EMbmIcons_doodleMenu); |
264 iLabels[5]->SetImage(svgFile, EMbmIcons_doodleInfo); |
270 iLabels[5]->SetTooltip(_L("About")); |
265 iLabels[5]->SetTooltip(_L("About")); |
271 |
266 |
272 iLabels[6]->SetImage(svgFile, EMbmIcons_doodlePensize); |
267 iLabels[6]->SetImage(svgFile, EMbmIcons_doodleSave2); |
273 iLabels[6]->SetTooltip(_L("Null")); |
268 iLabels[6]->SetTooltip(_L("Null")); |
274 |
269 |
275 iAnimationAO = CAnimationAO::NewL(); |
270 iAnimationAO = CAnimationAO::NewL(); |
276 iAnimationAO->SetObserver(this); |
271 iAnimationAO->SetObserver(this); |
277 iRollAo = CRollAO::NewL(); |
272 iRollAo = CRollAO::NewL(); |
282 iDragPrePoint = TPoint(0, 0); |
277 iDragPrePoint = TPoint(0, 0); |
283 iDragUpPoint = TPoint(0, 0); |
278 iDragUpPoint = TPoint(0, 0); |
284 |
279 |
285 iPointStartInLoopRect = EFalse; |
280 iPointStartInLoopRect = EFalse; |
286 iDragIsStart = EFalse; |
281 iDragIsStart = EFalse; |
287 iEnableAnimationEffect = EFalse; |
|
288 iDragOffset = 0; |
282 iDragOffset = 0; |
289 |
283 |
290 } |
284 } |
291 |
285 |
292 // --------------------------------------------------------------------------- |
286 // --------------------------------------------------------------------------- |
293 // SetView |
287 // SetView |
294 // --------------------------------------------------------------------------- |
288 // --------------------------------------------------------------------------- |
295 // |
289 // |
296 void CImageEditorDrawControl::SetView(CAknView* aView) |
290 void CImageEditorDrawControl::SetView(CAknView* aView) |
297 { |
291 { |
298 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetView()"); |
292 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetView()"); |
299 ASSERT(aView); |
293 ASSERT(aView); |
300 iEditorView = aView; |
294 iEditorView = aView; |
301 } |
295 } |
302 |
296 |
303 // --------------------------------------------------------------------------- |
297 // --------------------------------------------------------------------------- |
304 // SetSelectedUiItemL |
298 // SetSelectedUiItemL |
305 // --------------------------------------------------------------------------- |
299 // --------------------------------------------------------------------------- |
306 // |
300 // |
307 void CImageEditorDrawControl::SetSelectedUiItemL(CPluginInfo* aItem) |
301 void CImageEditorDrawControl::SetSelectedUiItemL(CPluginInfo* aItem) |
308 { |
302 { |
309 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSelectedUiItemL()"); |
303 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSelectedUiItemL()"); |
310 ASSERT(aItem); |
304 ASSERT(aItem); |
311 iItem = aItem; |
305 iItem = aItem; |
312 delete iNaviPaneText; |
306 delete iNaviPaneText; |
313 iNaviPaneText = NULL; |
307 iNaviPaneText = NULL; |
314 iNaviPaneText = (iItem->Parameters()[KMainTextIndex]).AllocL(); |
308 iNaviPaneText = (iItem->Parameters()[KMainTextIndex]).AllocL(); |
320 // --------------------------------------------------------------------------- |
314 // --------------------------------------------------------------------------- |
321 // |
315 // |
322 TKeyResponse CImageEditorDrawControl::OfferKeyEventL( |
316 TKeyResponse CImageEditorDrawControl::OfferKeyEventL( |
323 const TKeyEvent& aKeyEvent, TEventCode aType) |
317 const TKeyEvent& aKeyEvent, TEventCode aType) |
324 { |
318 { |
325 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::OfferKeyEventL()"); |
319 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::OfferKeyEventL()"); |
326 |
320 |
327 TKeyResponse response = EKeyWasNotConsumed; |
321 TKeyResponse response = EKeyWasNotConsumed; |
328 |
322 |
329 // If busy, do not handle anything |
323 // If busy, do not handle anything |
330 if (Busy()) |
324 if (Busy()) |
486 } |
480 } |
487 } |
481 } |
488 DrawNow(); |
482 DrawNow(); |
489 } |
483 } |
490 } |
484 } |
491 |
485 // --------------------------------------------------------------------------- |
|
486 // CImageEditorDrawControl::SetToolBarStatus() |
|
487 // Set and get current status : display or hidden. |
|
488 // --------------------------------------------------------------------------- |
|
489 // |
492 void CImageEditorDrawControl::SetToolBarStatus() |
490 void CImageEditorDrawControl::SetToolBarStatus() |
493 { |
491 { |
494 |
492 if (iFlagDragToolBar) |
495 if (iMainMenuLayout == EMainMenuHorizontal) |
493 { |
|
494 iDisplayTool = ETrue; |
|
495 iFlagDragToolBar = EFalse; |
|
496 } |
|
497 if (iMainMenuLayout == EMainMenuVertical) |
496 { |
498 { |
497 TInt leftX = iLabels[0]->Rect().iTl.iX; |
499 TInt leftX = iLabels[0]->Rect().iTl.iX; |
498 TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
500 TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
499 if (leftX == 0) |
501 if (leftX == 0) |
500 iDisplayTool = ETrue; |
502 iDisplayTool = ETrue; |
501 else if (rightX == 0) |
503 else if (rightX == 0) |
502 iDisplayTool = EFalse; |
504 iDisplayTool = EFalse; |
503 } |
505 } |
504 else if (iMainMenuLayout == EMainMenuVertical) |
506 else if (iMainMenuLayout ==EMainMenuHorizontal ) |
505 { |
507 { |
506 TInt topY = iLabels[0]->Rect().iTl.iY; |
508 TInt topY = iLabels[0]->Rect().iTl.iY; |
507 TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; |
509 TInt bottomY = iLabels[iTotalComponent - 1]->Rect().iBr.iY; |
508 if (topY == 0) |
510 if (topY == 0) |
509 iDisplayTool = ETrue; |
511 iDisplayTool = ETrue; |
517 // GetParam |
519 // GetParam |
518 // --------------------------------------------------------------------------- |
520 // --------------------------------------------------------------------------- |
519 // |
521 // |
520 TDesC& CImageEditorDrawControl::GetParam() |
522 TDesC& CImageEditorDrawControl::GetParam() |
521 { |
523 { |
522 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetParam()"); |
524 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetParam()"); |
523 LOGDES(KDrawPluginLogFile, iParam); |
525 LOGDES(KDrawPluginLogFile, iParam); |
524 return iParam; |
526 return iParam; |
525 } |
527 } |
526 |
528 |
527 // --------------------------------------------------------------------------- |
529 // --------------------------------------------------------------------------- |
528 // SetSystemParameters |
530 // SetSystemParameters |
529 // --------------------------------------------------------------------------- |
531 // --------------------------------------------------------------------------- |
530 // |
532 // |
531 void CImageEditorDrawControl::SetSystemParameters( |
533 void CImageEditorDrawControl::SetSystemParameters( |
532 const CSystemParameters* aPars) |
534 const CSystemParameters* aPars) |
533 { |
535 { |
534 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSystemParameters()"); |
536 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SetSystemParameters()"); |
535 ASSERT(aPars); |
537 ASSERT(aPars); |
536 iSysPars = aPars; |
538 iSysPars = aPars; |
537 } |
539 } |
538 |
540 |
539 // --------------------------------------------------------------------------- |
541 // --------------------------------------------------------------------------- |
540 // HandlePluginCommandL |
542 // HandlePluginCommandL |
541 // --------------------------------------------------------------------------- |
543 // --------------------------------------------------------------------------- |
542 // |
544 // |
543 void CImageEditorDrawControl::HandlePluginCommandL(const TInt aCommand) |
545 void CImageEditorDrawControl::HandlePluginCommandL(const TInt aCommand) |
544 { |
546 { |
545 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::HandlePluginCommandL()"); |
547 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::HandlePluginCommandL()"); |
546 |
548 |
547 switch (aCommand) |
549 switch (aCommand) |
548 { |
550 { |
549 case EImageEditorFocusLost: |
551 case EImageEditorFocusLost: |
550 { |
552 { |
652 // GetDimmedMenuItems |
654 // GetDimmedMenuItems |
653 // --------------------------------------------------------------------------- |
655 // --------------------------------------------------------------------------- |
654 // |
656 // |
655 TBitField CImageEditorDrawControl::GetDimmedMenuItems() |
657 TBitField CImageEditorDrawControl::GetDimmedMenuItems() |
656 { |
658 { |
657 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetDimmedMenuItems()"); |
659 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetDimmedMenuItems()"); |
658 |
660 |
659 TBitField dimmedMenuItems; |
661 TBitField dimmedMenuItems; |
660 TInt count = iItem->MenuItems().Count(); |
662 TInt count = iItem->MenuItems().Count(); |
661 |
663 |
662 if (iDisplayingOkOptionsMenu) |
664 if (iDisplayingOkOptionsMenu) |
692 // |
694 // |
693 TPtrC CImageEditorDrawControl::GetNaviPaneTextL( |
695 TPtrC CImageEditorDrawControl::GetNaviPaneTextL( |
694 TBool& aLeftNaviPaneScrollButtonVisibile, |
696 TBool& aLeftNaviPaneScrollButtonVisibile, |
695 TBool& aRightNaviPaneScrollButtonVisible) |
697 TBool& aRightNaviPaneScrollButtonVisible) |
696 { |
698 { |
697 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetNaviPaneTextL()"); |
699 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetNaviPaneTextL()"); |
698 |
700 |
699 aLeftNaviPaneScrollButtonVisibile = EFalse; |
701 aLeftNaviPaneScrollButtonVisibile = EFalse; |
700 aRightNaviPaneScrollButtonVisible = EFalse; |
702 aRightNaviPaneScrollButtonVisible = EFalse; |
701 return *iNaviPaneText; |
703 return *iNaviPaneText; |
702 } |
704 } |
736 // NaviDown |
738 // NaviDown |
737 // --------------------------------------------------------------------------- |
739 // --------------------------------------------------------------------------- |
738 // |
740 // |
739 void CImageEditorDrawControl::NaviDown() |
741 void CImageEditorDrawControl::NaviDown() |
740 { |
742 { |
741 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviDown()"); |
743 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviDown()"); |
742 } |
744 } |
743 |
745 |
744 // --------------------------------------------------------------------------- |
746 // --------------------------------------------------------------------------- |
745 // NaviUp |
747 // NaviUp |
746 // --------------------------------------------------------------------------- |
748 // --------------------------------------------------------------------------- |
747 // |
749 // |
748 void CImageEditorDrawControl::NaviUp() |
750 void CImageEditorDrawControl::NaviUp() |
749 { |
751 { |
750 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviUp()"); |
752 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviUp()"); |
751 } |
753 } |
752 |
754 |
753 // --------------------------------------------------------------------------- |
755 // --------------------------------------------------------------------------- |
754 // NaviRight |
756 // NaviRight |
755 // --------------------------------------------------------------------------- |
757 // --------------------------------------------------------------------------- |
756 // |
758 // |
757 void CImageEditorDrawControl::NaviRight() |
759 void CImageEditorDrawControl::NaviRight() |
758 { |
760 { |
759 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviRight()"); |
761 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviRight()"); |
760 } |
762 } |
761 |
763 |
762 // --------------------------------------------------------------------------- |
764 // --------------------------------------------------------------------------- |
763 // NaviLeft |
765 // NaviLeft |
764 // --------------------------------------------------------------------------- |
766 // --------------------------------------------------------------------------- |
765 // |
767 // |
766 void CImageEditorDrawControl::NaviLeft() |
768 void CImageEditorDrawControl::NaviLeft() |
767 { |
769 { |
768 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviLeft()"); |
770 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviLeft()"); |
769 } |
771 } |
770 |
772 |
771 // --------------------------------------------------------------------------- |
773 // --------------------------------------------------------------------------- |
772 // SelectSizeL |
774 // SelectSizeL |
773 // --------------------------------------------------------------------------- |
775 // --------------------------------------------------------------------------- |
774 // |
776 // |
775 void CImageEditorDrawControl::SelectSizeL() |
777 void CImageEditorDrawControl::SelectSizeL() |
776 { |
778 { |
777 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SelectSizeL()"); |
779 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SelectSizeL()"); |
778 // Symmetric line width / height |
780 // Symmetric line width / height |
779 TInt size(iSize.iWidth); |
781 TInt size(iSize.iWidth); |
780 CSelectionDialog::RunDlgLD(iPreview, Rect(), size, iRgb, |
782 CSelectionDialog::RunDlgLD(iPreview, Rect(), size, iRgb, |
781 iSysPars->VisibleImageRectPrev()); |
783 iSysPars->VisibleImageRectPrev()); |
782 iSize = TSize(size, size); |
784 iSize = TSize(size, size); |
786 // StoreTempParams |
788 // StoreTempParams |
787 // --------------------------------------------------------------------------- |
789 // --------------------------------------------------------------------------- |
788 // |
790 // |
789 void CImageEditorDrawControl::StoreTempParams() |
791 void CImageEditorDrawControl::StoreTempParams() |
790 { |
792 { |
791 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams(" |
793 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams(" |
792 "" |
794 "" |
793 ")"); |
795 ")"); |
794 } |
796 } |
795 |
797 |
796 // --------------------------------------------------------------------------- |
798 // --------------------------------------------------------------------------- |
797 // RestoreTempParams |
799 // RestoreTempParams |
798 // --------------------------------------------------------------------------- |
800 // --------------------------------------------------------------------------- |
799 // |
801 // |
800 void CImageEditorDrawControl::RestoreTempParams() |
802 void CImageEditorDrawControl::RestoreTempParams() |
801 { |
803 { |
802 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); |
804 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); |
803 } |
805 } |
804 |
806 |
805 // --------------------------------------------------------------------------- |
807 // --------------------------------------------------------------------------- |
806 // GetHelpContext |
808 // GetHelpContext |
807 // --------------------------------------------------------------------------- |
809 // --------------------------------------------------------------------------- |
808 // |
810 // |
809 void CImageEditorDrawControl::GetHelpContext(TCoeHelpContext& aContext) const |
811 void CImageEditorDrawControl::GetHelpContext(TCoeHelpContext& aContext) const |
810 { |
812 { |
811 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetHelpContext()"); |
813 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetHelpContext()"); |
812 |
814 |
813 aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); |
815 aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); |
814 aContext.iContext = KSIE_HLP_EDIT_TEXT; |
816 aContext.iContext = KSIE_HLP_EDIT_DRAW; |
815 } |
817 } |
816 |
818 |
817 // --------------------------------------------------------------------------- |
819 // --------------------------------------------------------------------------- |
818 // PrepareL |
820 // PrepareL |
819 // --------------------------------------------------------------------------- |
821 // --------------------------------------------------------------------------- |
820 // |
822 // |
821 void CImageEditorDrawControl::PrepareL() |
823 void CImageEditorDrawControl::PrepareL() |
822 { |
824 { |
823 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::PrepareL()"); |
825 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::PrepareL()"); |
824 |
826 |
825 // Get current view port |
827 // Get current view port |
826 TRect rect = iSysPars->VisibleImageRectPrev(); |
828 TRect rect = iSysPars->VisibleImageRectPrev(); |
827 |
829 |
828 iReadyToRender = ETrue; |
830 iReadyToRender = ETrue; |
879 // IsReadyToRender |
881 // IsReadyToRender |
880 // --------------------------------------------------------------------------- |
882 // --------------------------------------------------------------------------- |
881 // |
883 // |
882 TBool CImageEditorDrawControl::IsReadyToRender() const |
884 TBool CImageEditorDrawControl::IsReadyToRender() const |
883 { |
885 { |
884 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::IsReadyToRender()"); |
886 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::IsReadyToRender()"); |
885 return iReadyToRender; |
887 return iReadyToRender; |
886 } |
888 } |
887 |
889 |
888 // --------------------------------------------------------------------------- |
890 // --------------------------------------------------------------------------- |
889 // StoreParameters |
891 // StoreParameters |
890 // --------------------------------------------------------------------------- |
892 // --------------------------------------------------------------------------- |
891 // |
893 // |
892 void CImageEditorDrawControl::StoreParameters(TBool aLastItem, TBool aDone) |
894 void CImageEditorDrawControl::StoreParameters(TBool aLastItem, TBool aDone) |
893 { |
895 { |
894 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreParameters()"); |
896 LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreParameters()"); |
895 RDebug::Print(_L("CImageEditorDrawControl::StoreParameters color[%d]"), |
897 RDebug::Print(_L("CImageEditorDrawControl::StoreParameters color[%d]"), |
896 iRgb.Internal()); |
898 iRgb.Internal()); |
897 |
899 |
898 iParam.Copy(_L("x ")); |
900 iParam.Copy(_L("x ")); |
899 iParam.AppendNum(iX); |
901 iParam.AppendNum(iX); |
900 iParam.Append(_L(" y ")); |
902 iParam.Append(_L(" y ")); |
901 iParam.AppendNum(iY); |
903 iParam.AppendNum(iY); |
968 break; |
970 break; |
969 } |
971 } |
970 default: |
972 default: |
971 break; |
973 break; |
972 } |
974 } |
973 //StoreParameters(); |
975 //StoreParameters(); |
974 TRAP_IGNORE(iEditorView->HandleCommandL(EImageEditorCmdRender)); |
976 TRAP_IGNORE(iEditorView->HandleCommandL(EImageEditorCmdRender)); |
975 iTimer->Call(KWait); |
977 iTimer->Call(KWait); |
976 } |
978 } |
977 } |
979 } |
978 |
980 |
979 // --------------------------------------------------------------------------- |
981 // --------------------------------------------------------------------------- |
980 // StorePosAndScaleRelScreen |
982 // StorePosAndScaleRelScreen |
981 // --------------------------------------------------------------------------- |
983 // --------------------------------------------------------------------------- |
982 // |
984 // |
983 void CImageEditorDrawControl::StorePosAndScaleRelScreen() |
985 void CImageEditorDrawControl::StorePosAndScaleRelScreen() |
984 { |
986 { |
985 LOG(KDrawPluginLogFile, |
987 LOG(KDrawPluginLogFile, |
986 "CImageEditorClipartControl::StorePosAndScaleRelScreen()"); |
988 "CImageEditorClipartControl::StorePosAndScaleRelScreen()"); |
987 iParam.Copy(_L("nop")); |
989 iParam.Copy(_L("nop")); |
988 } |
990 } |
989 |
991 |
990 // --------------------------------------------------------------------------- |
992 // --------------------------------------------------------------------------- |
991 // ?description_if_needed |
993 // ?description_if_needed |
992 // --------------------------------------------------------------------------- |
994 // --------------------------------------------------------------------------- |
993 // |
995 // |
994 void CImageEditorDrawControl::RestorePosAndScaleRelScreen() |
996 void CImageEditorDrawControl::RestorePosAndScaleRelScreen() |
995 { |
997 { |
996 LOG(KDrawPluginLogFile, |
998 LOG(KDrawPluginLogFile, |
997 "CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); |
999 "CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); |
998 } |
1000 } |
999 |
1001 |
1000 // --------------------------------------------------------------------------- |
1002 // --------------------------------------------------------------------------- |
1001 // StorePosAndScaleRelImage |
1003 // StorePosAndScaleRelImage |
1002 // --------------------------------------------------------------------------- |
1004 // --------------------------------------------------------------------------- |
1003 // |
1005 // |
1004 void CImageEditorDrawControl::StorePosAndScaleRelImage() |
1006 void CImageEditorDrawControl::StorePosAndScaleRelImage() |
1005 { |
1007 { |
1006 TReal relscale = iSysPars->RelScale(); |
1008 TReal relscale = iSysPars->RelScale(); |
1007 LOGFMT(KDrawPluginLogFile, |
1009 LOGFMT(KDrawPluginLogFile, |
1008 "CImageEditorClipartControl::StorePosAndScaleRelImage():%g", |
1010 "CImageEditorClipartControl::StorePosAndScaleRelImage():%g", |
1009 relscale); |
1011 relscale); |
1010 } |
1012 } |
1011 |
1013 |
1012 // --------------------------------------------------------------------------- |
1014 // --------------------------------------------------------------------------- |
1013 // RestorePosAndScaleRelImage |
1015 // RestorePosAndScaleRelImage |
1014 // --------------------------------------------------------------------------- |
1016 // --------------------------------------------------------------------------- |
1015 // |
1017 // |
1016 void CImageEditorDrawControl::RestorePosAndScaleRelImage() |
1018 void CImageEditorDrawControl::RestorePosAndScaleRelImage() |
1017 { |
1019 { |
1018 TReal relscale = iSysPars->RelScale(); |
1020 TReal relscale = iSysPars->RelScale(); |
1019 LOGFMT(KDrawPluginLogFile, |
1021 LOGFMT(KDrawPluginLogFile, |
1020 "CImageEditorClipartControl::RestorePosAndScaleRelImage():%g", |
1022 "CImageEditorClipartControl::RestorePosAndScaleRelImage():%g", |
1021 relscale); |
1023 relscale); |
1022 } |
1024 } |
1023 |
1025 |
1024 // --------------------------------------------------------------------------- |
1026 // --------------------------------------------------------------------------- |
1025 // ClipPosition |
1027 // ClipPosition |
1026 // --------------------------------------------------------------------------- |
1028 // --------------------------------------------------------------------------- |
1053 void CImageEditorDrawControl::HandlePointerEventL( |
1055 void CImageEditorDrawControl::HandlePointerEventL( |
1054 const TPointerEvent &aPointerEvent) |
1056 const TPointerEvent &aPointerEvent) |
1055 { |
1057 { |
1056 SetToolBarStatus(); |
1058 SetToolBarStatus(); |
1057 RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), |
1059 RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), |
1058 AknLayoutUtils::PenEnabled()); |
1060 AknLayoutUtils::PenEnabled()); |
1059 if (iRollflag) |
1061 if (iRollflag) |
1060 return; |
1062 return; |
1061 if (AknLayoutUtils::PenEnabled() && !Busy()) |
1063 if (AknLayoutUtils::PenEnabled() && !Busy()) |
1062 { |
1064 { |
1063 RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), |
1065 RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), |
1064 aPointerEvent.iType); |
1066 aPointerEvent.iType); |
1065 TBool lastItem(EFalse); |
1067 TBool lastItem(EFalse); |
1066 TPoint point = aPointerEvent.iPosition; |
1068 TPoint point = aPointerEvent.iPosition; |
1067 |
1069 |
1068 switch (aPointerEvent.iType) |
1070 switch (aPointerEvent.iType) |
1069 { |
1071 { |
1084 iAnimationAO->Cancel(); |
1086 iAnimationAO->Cancel(); |
1085 iDragIsStart = EFalse; |
1087 iDragIsStart = EFalse; |
1086 } |
1088 } |
1087 |
1089 |
1088 } |
1090 } |
|
1091 //Doodle event. |
1089 else if ((!iLoopMenuRect.Contains(point) |
1092 else if ((!iLoopMenuRect.Contains(point) |
1090 && !iCustomComponetClick && iDisplayTool) |
1093 && !iCustomComponetClick && iDisplayTool) |
1091 || (!iDisplayTool && !iCustomComponetClick)) |
1094 || (!iDisplayTool && !iCustomComponetClick)) |
1092 { |
1095 { |
1093 iPointStartInLoopRect = EFalse; |
1096 iPointStartInLoopRect = EFalse; |
1094 //System dispose |
1097 //System dispose |
1095 iReadyToRender = EFalse; |
1098 iReadyToRender = EFalse; |
1096 CDrawPath* lastPath = CDrawPath::NewL(); |
1099 CDrawPath* lastPath = CDrawPath::NewL(); |
1097 CleanupStack::PushL(lastPath); |
1100 CleanupStack::PushL(lastPath); |
1098 lastPath->SetColor(iRgb); |
1101 lastPath->SetColor(iRgb); |
1099 lastPath->SetSize(iSize); |
1102 lastPath->SetSize(iSize); |
1100 SetPositionOnImage(aPointerEvent.iPosition); |
1103 SetPositionOnImage(aPointerEvent.iPosition); |
1110 { |
1113 { |
1111 // System dispose |
1114 // System dispose |
1112 iReadyToRender = ETrue; |
1115 iReadyToRender = ETrue; |
1113 iCustomComponetClick = EFalse; |
1116 iCustomComponetClick = EFalse; |
1114 lastItem = ETrue; |
1117 lastItem = ETrue; |
|
1118 CCoeControl::HandlePointerEventL(aPointerEvent); |
1115 HandleMainMenuButtonUp(point); |
1119 HandleMainMenuButtonUp(point); |
1116 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
1117 DrawNow(); |
1120 DrawNow(); |
1118 |
1121 |
1119 } |
1122 } |
1120 break; |
1123 break; |
1121 case TPointerEvent::EDrag: |
1124 case TPointerEvent::EDrag: |
1122 { |
1125 { |
1123 CCoeControl::HandlePointerEventL(aPointerEvent); |
1126 CCoeControl::HandlePointerEventL(aPointerEvent); |
1124 //System dispose |
1127 //Mark last event use for custompoent. |
1125 iLastPointEventType = ETrue; |
1128 iLastPointEventType = ETrue; |
1126 |
1129 |
1127 if ((iDisplayTool && iPaths.Count() && !iCustomComponetClick |
1130 if ((iDisplayTool && iPaths.Count() && !iCustomComponetClick |
1128 && !iPointStartInLoopRect) || (!iDisplayTool |
1131 && !iPointStartInLoopRect) || (!iDisplayTool |
1129 && iPaths.Count() && !iCustomComponetClick)) |
1132 && iPaths.Count() && !iCustomComponetClick)) |
1134 // store current position for next round |
1137 // store current position for next round |
1135 iPointerPosition = aPointerEvent.iPosition; |
1138 iPointerPosition = aPointerEvent.iPosition; |
1136 SetPositionOnImage(aPointerEvent.iPosition); |
1139 SetPositionOnImage(aPointerEvent.iPosition); |
1137 path->AddItemL(aPointerEvent.iPosition); |
1140 path->AddItemL(aPointerEvent.iPosition); |
1138 } |
1141 } |
1139 //Self dispose |
1142 //Drag customcomponent event |
1140 if (iCustomComponetClick) |
1143 if (iCustomComponetClick) |
1141 { |
1144 { |
1142 TPoint con(aPointerEvent.iPosition.iX - 25, |
1145 TPoint con(aPointerEvent.iPosition.iX - 25, |
1143 aPointerEvent.iPosition.iY - 25); |
1146 aPointerEvent.iPosition.iY - 25); |
1144 iCustomComponet->SetExtent(con, TSize(50, 50)); |
1147 iCustomComponet->SetExtent(con, TSize(50, 50)); |
1145 DrawNow(); |
1148 DrawNow(); |
1146 } |
1149 } |
1147 |
1150 //Drag tool bar event |
1148 if (iDisplayTool && iPointStartInLoopRect) |
1151 if (iDisplayTool && iPointStartInLoopRect) |
1149 |
1152 |
1150 { |
1153 { |
|
1154 iFlagDragToolBar = ETrue; |
1151 HandleMainMenuButtonDrag(point); |
1155 HandleMainMenuButtonDrag(point); |
1152 } |
1156 } |
1153 } |
1157 } |
1154 break; |
1158 break; |
1155 default: |
1159 default: |
1170 } |
1174 } |
1171 |
1175 |
1172 } |
1176 } |
1173 |
1177 |
1174 // --------------------------------------------------------------------------- |
1178 // --------------------------------------------------------------------------- |
1175 // HandleMainMenuButtonUp |
1179 // CImageEditorDrawControl::HandleMainMenuButtonUp() |
|
1180 // |
1176 // --------------------------------------------------------------------------- |
1181 // --------------------------------------------------------------------------- |
1177 // |
1182 // |
1178 void CImageEditorDrawControl::HandleMainMenuButtonUp(TPoint aPoint) |
1183 void CImageEditorDrawControl::HandleMainMenuButtonUp(TPoint aPoint) |
1179 { |
1184 { |
1180 if (iMainMenuLayout == EMainMenuHorizontal) |
1185 if (iMainMenuLayout == EMainMenuVertical) |
1181 { |
1186 { |
1182 if (iDragIsStart) |
1187 if (iDragIsStart) |
1183 { |
1188 { |
1184 //Drag event is end (Except activating animation effect). |
1189 //Drag event is end (Except activating animation effect). |
1185 iDragIsStart = EFalse; |
1190 iDragIsStart = EFalse; |
1215 // HandleMainMenuButtonDrag |
1220 // HandleMainMenuButtonDrag |
1216 // --------------------------------------------------------------------------- |
1221 // --------------------------------------------------------------------------- |
1217 // |
1222 // |
1218 void CImageEditorDrawControl::HandleMainMenuButtonDrag(TPoint aPoint) |
1223 void CImageEditorDrawControl::HandleMainMenuButtonDrag(TPoint aPoint) |
1219 { |
1224 { |
1220 if (iMainMenuLayout == EMainMenuHorizontal) |
1225 if (iMainMenuLayout == EMainMenuVertical) |
1221 { |
1226 { |
1222 if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iX |
1227 if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iX |
1223 - iButtonDownPoint.iX) >= DRAG_LENGTH) |
1228 - iButtonDownPoint.iX) >= DRAG_LENGTH) |
1224 { |
1229 { |
1225 iDragIsStart = ETrue; |
1230 iDragIsStart = ETrue; |
1226 iDragStartPoint = aPoint; |
1231 iDragStartPoint = aPoint; |
1227 |
1232 |
1228 for (TInt i = 0; i < iTotalComponent; i++) |
1233 for (TInt i = 0; i < iTotalComponent; i++) |
1229 { |
1234 { |
1230 if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
1235 if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
1231 { |
1236 { |
1232 iLabels[i]->LabelIsMoving(); |
1237 iLabels[i]->LabelIsMoving(); |
1238 { |
1243 { |
1239 iDragPrePoint = iDragUpPoint; |
1244 iDragPrePoint = iDragUpPoint; |
1240 iDragUpPoint = aPoint; |
1245 iDragUpPoint = aPoint; |
1241 iDragOffset = aPoint.iX - iDragStartPoint.iX; |
1246 iDragOffset = aPoint.iX - iDragStartPoint.iX; |
1242 iDragStartPoint = aPoint; |
1247 iDragStartPoint = aPoint; |
1243 |
1248 |
1244 CalculateEffectiveOffset(); |
1249 CalculateEffectiveOffset(); |
1245 SizeChanged(); |
1250 SizeChanged(); |
1246 } |
1251 } |
1247 } |
1252 } |
1248 else if (iMainMenuLayout == EMainMenuVertical) |
1253 else if (iMainMenuLayout ==EMainMenuHorizontal ) |
1249 { |
1254 { |
1250 if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iY |
1255 if (iPointStartInLoopRect && !iDragIsStart && Abs(aPoint.iY |
1251 - iButtonDownPoint.iY) >= DRAG_LENGTH) |
1256 - iButtonDownPoint.iY) >= DRAG_LENGTH) |
1252 { |
1257 { |
1253 iDragIsStart = ETrue; |
1258 iDragIsStart = ETrue; |
1254 iDragStartPoint = aPoint; |
1259 iDragStartPoint = aPoint; |
1255 |
1260 |
1256 for (TInt i = 0; i < iTotalComponent; i++) |
1261 for (TInt i = 0; i < iTotalComponent; i++) |
1257 { |
1262 { |
1258 if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
1263 if (iLabels[i]->Rect().Contains(iButtonDownPoint)) |
1259 { |
1264 { |
1260 iLabels[i]->LabelIsMoving(); |
1265 iLabels[i]->LabelIsMoving(); |
1329 iUndo = ETrue; |
1334 iUndo = ETrue; |
1330 StoreParameters(EFalse, EFalse); |
1335 StoreParameters(EFalse, EFalse); |
1331 iEditorView->HandleCommandL(EImageEditorCmdRender); |
1336 iEditorView->HandleCommandL(EImageEditorCmdRender); |
1332 iUndo = EFalse; |
1337 iUndo = EFalse; |
1333 } |
1338 } |
1334 //redo |
1339 //save and quit |
1335 else if (iLabels[3] == dynamic_cast<CImageLabel*> (aComponent)) |
1340 else if (iLabels[3] == dynamic_cast<CImageLabel*> (aComponent)) |
1336 { |
1341 { |
1337 iRedo = ETrue; |
1342 iRedo = ETrue; |
1338 RedoDrawPath(); |
1343 RedoDrawPath(); |
1339 StoreParameters(EFalse, EFalse); |
1344 StoreParameters(EFalse, EFalse); |
1340 iEditorView->HandleCommandL(EImageEditorCmdRender); |
1345 iEditorView->HandleCommandL(EImageEditorCmdRender); |
1341 iRedo = EFalse; |
1346 iRedo = EFalse; |
1342 } |
1347 } |
1343 //save and exit |
|
1344 else if (iLabels[4] == dynamic_cast<CImageLabel*> (aComponent)) |
1348 else if (iLabels[4] == dynamic_cast<CImageLabel*> (aComponent)) |
1345 { |
1349 { |
1346 iPopupController->HideInfoPopupNote(); |
1350 iPopupController->HideInfoPopupNote(); |
1347 StoreParameters(EFalse, ETrue); |
1351 StoreParameters(EFalse, ETrue); |
1348 iEditorView->HandleCommandL(EImageEditorApplyPlugin); |
1352 iEditorView->HandleCommandL(EImageEditorApplyPlugin); |
1349 } |
1353 } |
1350 else if (iLabels[5] == dynamic_cast<CImageLabel*> (aComponent)) |
1354 else if (iLabels[5] == dynamic_cast<CImageLabel*> (aComponent)) |
1351 { |
1355 { |
1352 |
1356 iEditorView->HandleCommandL(EImageEditorMenuCmdHelp); |
1353 } |
1357 } |
1354 else if (iLabels[6] == dynamic_cast<CImageLabel*> (aComponent)) |
1358 else if (iLabels[6] == dynamic_cast<CImageLabel*> (aComponent)) |
1355 { |
1359 { |
1356 |
1360 |
1357 } |
1361 } |
1383 TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); |
1387 TRect visibleImageRectPrev(iSysPars->VisibleImageRectPrev()); |
1384 |
1388 |
1385 TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
1389 TInt xPosFactorDivider(visibleImageRectPrev.Width()); |
1386 TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
1390 TInt yPosFactorDivider(visibleImageRectPrev.Height()); |
1387 |
1391 |
1388 LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::vir w:%d h:%d", |
1392 LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::vir w:%d h:%d", |
1389 visibleImageRect.Width(), visibleImageRect.Height()); |
1393 visibleImageRect.Width(), visibleImageRect.Height()); |
1390 LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::virp w:%d h:%d", |
1394 LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::virp w:%d h:%d", |
1391 visibleImageRectPrev.Width(), visibleImageRectPrev.Height()); |
1395 visibleImageRectPrev.Width(), visibleImageRectPrev.Height()); |
1392 |
1396 |
1393 // Dividing by zero will cause panic -> check |
1397 // Dividing by zero will cause panic -> check |
1394 if (xPosFactorDivider == 0 || yPosFactorDivider == 0) |
1398 if (xPosFactorDivider == 0 || yPosFactorDivider == 0) |
1395 { |
1399 { |
1396 // Set default position |
1400 // Set default position |
1405 // |
1409 // |
1406 // TReal yPositionFactor(TReal(aPointedPosition.iY - iStatuspaneHeight |
1410 // TReal yPositionFactor(TReal(aPointedPosition.iY - iStatuspaneHeight |
1407 // - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
1411 // - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
1408 TReal yPositionFactor(TReal(aPointedPosition.iY |
1412 TReal yPositionFactor(TReal(aPointedPosition.iY |
1409 - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
1413 - visibleImageRectPrev.iTl.iY) / yPosFactorDivider); |
1410 LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::pfx:%g pfy:%g", |
1414 LOGFMT2(KDrawPluginLogFile, "CImageEditorDrawControl::pfx:%g pfy:%g", |
1411 xPositionFactor, yPositionFactor); |
1415 xPositionFactor, yPositionFactor); |
1412 // Calculate position on visible image |
1416 // Calculate position on visible image |
1413 |
1417 |
1414 iX = visibleImageRect.iTl.iX + visibleImageRect.Width() |
1418 iX = visibleImageRect.iTl.iX + visibleImageRect.Width() |
1415 * xPositionFactor + 0.5; |
1419 * xPositionFactor + 0.5; |
1416 |
1420 |
1417 iY = visibleImageRect.iTl.iY + visibleImageRect.Height() |
1421 iY = visibleImageRect.iTl.iY + visibleImageRect.Height() |
1418 * yPositionFactor + 0.5; |
1422 * yPositionFactor + 0.5; |
1419 } |
1423 } |
1420 |
1424 |
1421 LOGFMT4(KDrawPluginLogFile, |
1425 LOGFMT4(KDrawPluginLogFile, |
1422 "CImageEditorDrawControl::Draw x:%d iX:%d y:%d iY:%d", |
1426 "CImageEditorDrawControl::Draw x:%d iX:%d y:%d iY:%d", |
1423 aPointedPosition.iX, iX, aPointedPosition.iY, iY); |
1427 aPointedPosition.iX, iX, aPointedPosition.iY, iY); |
1424 // Check that not out of bounds |
1428 // Check that not out of bounds |
1425 //ClipPosition(); |
1429 //ClipPosition(); |
1426 } |
1430 } |
1427 |
1431 |
1428 // --------------------------------------------------------------------------- |
1432 // --------------------------------------------------------------------------- |
1444 / xPosFactorDivider); |
1448 / xPosFactorDivider); |
1445 |
1449 |
1446 TReal yPositionFactor(TReal(iY + visibleImageRectPrev.iTl.iY) |
1450 TReal yPositionFactor(TReal(iY + visibleImageRectPrev.iTl.iY) |
1447 / yPosFactorDivider); |
1451 / yPosFactorDivider); |
1448 |
1452 |
1449 LOGFMT2(KDrawPluginLogFile, |
1453 LOGFMT2(KDrawPluginLogFile, |
1450 "CImageEditorDrawControl::GetPositionOnView xf:%g yf:%g", |
1454 "CImageEditorDrawControl::GetPositionOnView xf:%g yf:%g", |
1451 xPositionFactor, yPositionFactor); |
1455 xPositionFactor, yPositionFactor); |
1452 |
1456 |
1453 LOGFMT2(KDrawPluginLogFile, |
1457 LOGFMT2(KDrawPluginLogFile, |
1454 "CImageEditorDrawControl::GetPositionOnView xf:%d yf:%d", |
1458 "CImageEditorDrawControl::GetPositionOnView xf:%d yf:%d", |
1455 xPosFactorDivider, yPosFactorDivider); |
1459 xPosFactorDivider, yPosFactorDivider); |
1456 |
1460 |
1457 LOGFMT2(KDrawPluginLogFile, |
1461 LOGFMT2(KDrawPluginLogFile, |
1458 "CImageEditorDrawControl::GetPositionOnView w:%d h:%d", iX, iY); |
1462 "CImageEditorDrawControl::GetPositionOnView w:%d h:%d", iX, iY); |
1459 |
1463 |
1460 TInt xPosition(iX + visibleImageRectPrev.iTl.iX); |
1464 TInt xPosition(iX + visibleImageRectPrev.iTl.iX); |
1461 TInt yPosition(iY + visibleImageRectPrev.iTl.iY); |
1465 TInt yPosition(iY + visibleImageRectPrev.iTl.iY); |
1462 |
1466 |
1463 LOGFMT3(KDrawPluginLogFile, |
1467 LOGFMT3(KDrawPluginLogFile, |
1464 "CImageEditorDrawControl::GetPositionOnView w:%d h:%d S:%g", |
1468 "CImageEditorDrawControl::GetPositionOnView w:%d h:%d S:%g", |
1465 xPosition, yPosition, iSysPars->RelScale()); |
1469 xPosition, yPosition, iSysPars->RelScale()); |
1466 |
1470 |
1467 return TPoint(xPosition, yPosition); |
1471 return TPoint(xPosition, yPosition); |
1468 } |
1472 } |
1469 |
1473 |
1470 // --------------------------------------------------------------------------- |
1474 // --------------------------------------------------------------------------- |
1476 iPopupController->HideInfoPopupNote(); |
1480 iPopupController->HideInfoPopupNote(); |
1477 |
1481 |
1478 TPoint iconPosition = ComputeIndicatorPosition(); |
1482 TPoint iconPosition = ComputeIndicatorPosition(); |
1479 TRect iconRect(iconPosition.iX, iconPosition.iY, iconPosition.iX, |
1483 TRect iconRect(iconPosition.iX, iconPosition.iY, iconPosition.iX, |
1480 iconPosition.iY); |
1484 iconPosition.iY); |
1481 |
|
1482 /*SDrawUtils::ShowToolTip( iPopupController, |
|
1483 this, |
|
1484 iconPosition, |
|
1485 EHRightVTop, |
|
1486 *iTooltipResize ); |
|
1487 */ |
|
1488 |
|
1489 } |
1485 } |
1490 |
1486 |
1491 // --------------------------------------------------------------------------- |
1487 // --------------------------------------------------------------------------- |
1492 // ScaledLineSize |
1488 // ScaledLineSize |
1493 // --------------------------------------------------------------------------- |
1489 // --------------------------------------------------------------------------- |
1503 if (sizeh < 1) |
1499 if (sizeh < 1) |
1504 { |
1500 { |
1505 sizeh++; |
1501 sizeh++; |
1506 } |
1502 } |
1507 |
1503 |
1508 LOGFMT3(KDrawPluginLogFile, |
1504 LOGFMT3(KDrawPluginLogFile, |
1509 "CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", sizew, |
1505 "CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", sizew, |
1510 sizeh, iSysPars->RelScale()); |
1506 sizeh, iSysPars->RelScale()); |
1511 return TSize(sizew, sizeh); |
1507 return TSize(sizew, sizeh); |
1512 } |
1508 } |
1513 |
1509 |
1514 // --------------------------------------------------------------------------- |
1510 // --------------------------------------------------------------------------- |
1515 // CountComponentControls |
1511 // CountComponentControls |
1592 // --------------------------------------------------------------------------- |
1588 // --------------------------------------------------------------------------- |
1593 // |
1589 // |
1594 void CImageEditorDrawControl::Roll() |
1590 void CImageEditorDrawControl::Roll() |
1595 { |
1591 { |
1596 SetToolBarStatus(); |
1592 SetToolBarStatus(); |
1597 //TInt leftX = iLabels[0]->Rect().iTl.iX; |
1593 |
1598 //TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
|
1599 TInt offset = 0; |
1594 TInt offset = 0; |
1600 iRollflag = ETrue; |
1595 iRollflag = ETrue; |
1601 if (iDisplayTool) |
1596 if (iDisplayTool) |
1602 iRollDirection = EFalse; |
1597 iRollDirection = EFalse; |
1603 else |
1598 else |
1604 iRollDirection = ETrue; |
1599 iRollDirection = ETrue; |
1605 |
1600 |
1606 |
|
1607 if (iRollDirection) |
1601 if (iRollDirection) |
1608 { |
1602 { |
1609 offset = 4; |
1603 offset = 4; |
1610 } |
1604 } |
1611 else |
1605 else |
1612 { |
1606 { |
1613 offset = -4; |
1607 offset = -4; |
1614 } |
1608 } |
1615 |
1609 |
1616 if (iMainMenuLayout == EMainMenuHorizontal) |
1610 if (iMainMenuLayout == EMainMenuVertical) |
1617 { |
1611 { |
1618 for (TInt i = 0; i < iLabels.Count(); i++) |
1612 for (TInt i = 0; i < iLabels.Count(); i++) |
1619 { |
1613 { |
1620 TInt x = iLabels[i]->Rect().iTl.iX; |
1614 TInt x = iLabels[i]->Rect().iTl.iX; |
1621 iLabels[i]->SetPosition(TPoint(x + offset, iLoopMenuRect.iTl.iY)); |
1615 iLabels[i]->SetPosition(TPoint(x + offset, iLoopMenuRect.iTl.iY)); |
1635 } |
1629 } |
1636 if (iLabels[0]->Rect().iTl.iY == 0 |
1630 if (iLabels[0]->Rect().iTl.iY == 0 |
1637 || iLabels[iLabels.Count() - 1]->Rect().iBr.iY == 0) |
1631 || iLabels[iLabels.Count() - 1]->Rect().iBr.iY == 0) |
1638 iRollflag = EFalse; |
1632 iRollflag = EFalse; |
1639 } |
1633 } |
1640 |
1634 |
1641 DrawNow(); |
1635 DrawNow(); |
1642 |
1636 |
1643 if (!iRollflag) |
1637 if (!iRollflag) |
1644 { |
1638 { |
1645 //iRollDirection = !iRollDirection; |
|
1646 iRollAo->Cancel(); |
1639 iRollAo->Cancel(); |
1647 } |
1640 } |
1648 } |
1641 } |
1649 |
1642 |
1650 // --------------------------------------------------------------------------- |
1643 // --------------------------------------------------------------------------- |
1651 // CalculateEffectiveOffset |
1644 // CalculateEffectiveOffset |
1652 // --------------------------------------------------------------------------- |
1645 // --------------------------------------------------------------------------- |
1653 // |
1646 // |
1654 void CImageEditorDrawControl::CalculateEffectiveOffset() |
1647 void CImageEditorDrawControl::CalculateEffectiveOffset() |
1655 { |
1648 { |
1656 if (iMainMenuLayout == EMainMenuHorizontal) |
1649 if (iMainMenuLayout == EMainMenuVertical) |
1657 { |
1650 { |
1658 TInt leftX = iLabels[0]->Rect().iTl.iX; |
1651 TInt leftX = iLabels[0]->Rect().iTl.iX; |
1659 TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
1652 TInt rightX = iLabels[iTotalComponent - 1]->Rect().iBr.iX; |
1660 TInt offset = iDragOffset; |
1653 TInt offset = iDragOffset; |
1661 if (leftX + offset > 0) |
1654 if (leftX + offset > 0) |